Replace newlines in parsoid-only parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Extra newlines: More paragraphs with indented comment
308 !! input
309 a
310
311 <!--boo-->
312
313 b
314 !!result
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 !!end
320
321 !! test
322 Extra newlines followed by heading
323 !! input
324 a
325
326
327
328 =b=
329 [[a]]
330
331
332 =b=
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
342
343 !! end
344
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
348 =b=
349
350
351
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p>
357 !! end
358
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
368
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
378
379 !! end
380
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
416
417 !! end
418
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
426 </p>
427 !! end
428
429 ###
430 ### 2-quote opening sequence tests
431 ###
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
450
451
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
460
461
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
465 php
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
483
484
485 ###
486 ### 3-quote opening sequence tests
487 ###
488
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
497
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
517
518
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
522 php
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
540
541
542 ###
543 ### 4-quote opening sequence tests
544 ###
545
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
554
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
574
575
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
579 php
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
597
598
599 ###
600 ### 5-quote opening sequence tests
601 ###
602
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
606 php
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
634
635
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
644
645
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
654
655 ###
656 ### multiple quote sequences in a line
657 ###
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
691 php
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
714 php
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
732
733 ###
734 ### other quote tests
735 ###
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
744
745
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
764
765
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
774 php
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
792
793
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
812
813 !! test
814 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
815 (Requires tidy for PHP parser output to be fixed up)
816 !! options
817 parsoid=wt2html,wt2wt
818 !! input
819 {|
820 !''a!!''b
821 |''a||''b
822 |}
823 !! result
824 <table>
825 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
826 <td><i>a</i></td><td><i>b</i></td></tr>
827 </tbody></table>
828 !! end
829
830 ###
831 ### Non-html5 tags
832 ###
833
834 !! test
835 Non-html5 tags should be accepted
836 !! input
837 <center>''foo''</center>
838 <big>''foo''</big>
839 <font>''foo''</font>
840 <strike>''foo''</strike>
841 <tt>''foo''</tt>
842 !! result
843 <center><i>foo</i></center>
844 <p><big><i>foo</i></big>
845 <font><i>foo</i></font>
846 <strike><i>foo</i></strike>
847 <tt><i>foo</i></tt>
848 </p>
849 !! end
850
851 ###
852 ### <nowiki> test cases
853 ###
854
855 !! test
856 <nowiki> unordered list
857 !! input
858 <nowiki>* This is not an unordered list item.</nowiki>
859 !! result
860 <p>* This is not an unordered list item.
861 </p>
862 !! end
863
864 !! test
865 <nowiki> spacing
866 !! input
867 <nowiki>Lorem ipsum dolor
868
869 sed abit.
870 sed nullum.
871
872 :and a colon
873 </nowiki>
874 !! result
875 <p>Lorem ipsum dolor
876
877 sed abit.
878 sed nullum.
879
880 :and a colon
881
882 </p>
883 !! end
884
885 !! test
886 nowiki 3
887 !! input
888 :There is not nowiki.
889 :There is <nowiki>nowiki</nowiki>.
890
891 #There is not nowiki.
892 #There is <nowiki>nowiki</nowiki>.
893
894 *There is not nowiki.
895 *There is <nowiki>nowiki</nowiki>.
896 !! result
897 <dl><dd>There is not nowiki.
898 </dd><dd>There is nowiki.
899 </dd></dl>
900 <ol><li>There is not nowiki.
901 </li><li>There is nowiki.
902 </li></ol>
903 <ul><li>There is not nowiki.
904 </li><li>There is nowiki.
905 </li></ul>
906
907 !! end
908
909 !! test
910 Entities inside <nowiki>
911 !! input
912 <nowiki>&lt;</nowiki>
913 !! result
914 <p>&lt;
915 </p>
916 !! end
917
918 !! test
919 Entities inside template parameters
920 !! options
921 parsoid
922 !! input
923 {{echo|&ndash;}}
924 !! result
925 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
926 </p>
927 !! end
928
929 ###
930 ### Comments
931 ###
932 !! test
933 Comments and Indent-Pre
934 !! input
935 <!-- comment 1 --> asdf
936
937 <!-- comment 1 --> asdf
938 <!-- comment 2 -->
939
940 <!-- comment 1 --> asdf
941 <!-- comment 2 -->xyz
942
943 <!-- comment 1 --> asdf
944 <!-- comment 2 --> xyz
945 !! result
946 <pre>asdf
947 </pre>
948 <pre>asdf
949 </pre>
950 <pre>asdf
951 </pre>
952 <p>xyz
953 </p>
954 <pre>asdf
955 xyz
956 </pre>
957 !! end
958
959 !! test
960 Comment test 2a
961 !! input
962 asdf
963 <!-- comment 1 -->
964 jkl
965 !! result
966 <p>asdf
967 jkl
968 </p>
969 !! end
970
971 !! test
972 Comment test 2b
973 !! input
974 asdf
975 <!-- comment 1 -->
976
977 jkl
978 !! result
979 <p>asdf
980 </p><p>jkl
981 </p>
982 !! end
983
984 !! test
985 Comment test 3
986 !! input
987 asdf
988 <!-- comment 1 -->
989 <!-- comment 2 -->
990 jkl
991 !! result
992 <p>asdf
993 jkl
994 </p>
995 !! end
996
997 !! test
998 Comment test 4
999 !! input
1000 asdf<!-- comment 1 -->jkl
1001 !! result
1002 <p>asdfjkl
1003 </p>
1004 !! end
1005
1006 !! test
1007 Comment spacing
1008 !! input
1009 a
1010 <!-- foo --> b <!-- bar -->
1011 c
1012 !! result
1013 <p>a
1014 </p>
1015 <pre> b
1016 </pre>
1017 <p>c
1018 </p>
1019 !! end
1020
1021 !! test
1022 Comment whitespace
1023 !! input
1024 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1025 !! result
1026
1027 !! end
1028
1029 !! test
1030 Comment semantics and delimiters
1031 !! input
1032 <!-- --><!----><!-----><!------>
1033 !! result
1034
1035 !! end
1036
1037 !! test
1038 Comment semantics and delimiters, redux
1039 !! input
1040 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1041 -- foo -- funky huh? ... -->
1042 !! result
1043
1044 !! end
1045
1046 !! test
1047 Comment semantics and delimiters: directors cut
1048 !! input
1049 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1050 everything starting with < followed by !-- until the first -- and > we see,
1051 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1052 -->-->
1053 !! result
1054 <p>--&gt;
1055 </p>
1056 !! end
1057
1058 !! test
1059 Comment semantics: nesting
1060 !! input
1061 <!--<!-- no, we're not going to do anything fancy here -->-->
1062 !! result
1063 <p>--&gt;
1064 </p>
1065 !! end
1066
1067 !! test
1068 Comment semantics: unclosed comment at end
1069 !! input
1070 <!--This comment will run out to the end of the document
1071 !! result
1072
1073 !! end
1074
1075 !! test
1076 Comment in template title
1077 !! input
1078 {{f<!---->oo}}
1079 !! result
1080 <p>FOO
1081 </p>
1082 !! end
1083
1084 !! test
1085 Comment on its own line post-expand
1086 !! input
1087 a
1088 {{blank}}<!---->
1089 b
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment on its own line post-expand with non-significant whitespace
1098 !! input
1099 a
1100 {{blank}} <!---->
1101 b
1102 !! result
1103 <p>a
1104 </p><p>b
1105 </p>
1106 !! end
1107
1108 ###
1109 ### paragraph wraping tests
1110 ###
1111 !! test
1112 No block tags
1113 !! input
1114 a
1115
1116 b
1117 !! result
1118 <p>a
1119 </p><p>b
1120 </p>
1121 !! end
1122 !! test
1123 Block tag on one line
1124 !! input
1125 a <div>foo</div>
1126
1127 b
1128 !! result
1129 a <div>foo</div>
1130 <p>b
1131 </p>
1132 !! end
1133
1134 !! test
1135 Block tag on both lines
1136 !! input
1137 a <div>foo</div>
1138
1139 b <div>foo</div>
1140 !! result
1141 a <div>foo</div>
1142 b <div>foo</div>
1143
1144 !! end
1145
1146 !! test
1147 Multiple lines without block tags
1148 !! input
1149 <div>foo</div> a
1150 b
1151 c
1152 d<!--foo--> e
1153 x <div>foo</div> z
1154 !! result
1155 <div>foo</div> a
1156 <p>b
1157 c
1158 d e
1159 </p>
1160 x <div>foo</div> z
1161
1162 !! end
1163
1164 !! test
1165 Empty lines between lines with block tags
1166 !! input
1167 <div></div>
1168
1169
1170 <div></div>a
1171
1172 b
1173 <div>a</div>b
1174
1175 <div>b</div>d
1176
1177
1178 <div>e</div>
1179 !! result
1180 <div></div>
1181 <p><br />
1182 </p>
1183 <div></div>a
1184 <p>b
1185 </p>
1186 <div>a</div>b
1187 <div>b</div>d
1188 <p><br />
1189 </p>
1190 <div>e</div>
1191
1192 !! end
1193
1194 ###
1195 ### Preformatted text
1196 ###
1197 !! test
1198 Preformatted text
1199 !! input
1200 This is some
1201 Preformatted text
1202 With ''italic''
1203 And '''bold'''
1204 And a [[Main Page|link]]
1205 !! result
1206 <pre>This is some
1207 Preformatted text
1208 With <i>italic</i>
1209 And <b>bold</b>
1210 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1211 </pre>
1212 !! end
1213
1214 !! test
1215 Ident preformatting with inline content
1216 !! input
1217 a
1218 ''b''
1219 !! result
1220 <pre>a
1221 <i>b</i>
1222 </pre>
1223 !! end
1224
1225 !! test
1226 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1227 !! input
1228 <pre><nowiki>
1229 <b>
1230 <cite>
1231 <em>
1232 </nowiki></pre>
1233 !! result
1234 <pre>
1235 &lt;b&gt;
1236 &lt;cite&gt;
1237 &lt;em&gt;
1238 </pre>
1239
1240 !! end
1241
1242 !! test
1243 Regression with preformatted in <center>
1244 !! input
1245 <center>
1246 Blah
1247 </center>
1248 !! result
1249 <center>
1250 <pre>Blah
1251 </pre>
1252 </center>
1253
1254 !! end
1255
1256 # Expected output in the following test is not really expected (there should be
1257 # <pre> in the output) -- it's only testing for well-formedness.
1258 !! test
1259 Bug 6200: Preformatted in <blockquote>
1260 !! input
1261 <blockquote>
1262 Blah
1263 </blockquote>
1264 !! result
1265 <blockquote>
1266 Blah
1267 </blockquote>
1268
1269 !! end
1270
1271 !! test
1272 <pre> with attributes (bug 3202)
1273 !! input
1274 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1275 !! result
1276 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1277
1278 !! end
1279
1280 !! test
1281 <pre> with width attribute (bug 3202)
1282 !! input
1283 <pre width="8">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8">Narrow screen goodies</pre>
1286
1287 !! end
1288
1289 !! test
1290 <pre> with forbidden attribute (bug 3202)
1291 !! input
1292 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1293 !! result
1294 <pre width="8">Narrow screen goodies</pre>
1295
1296 !! end
1297
1298 !! test
1299 Entities inside <pre>
1300 !! input
1301 <pre>&lt;</pre>
1302 !! result
1303 <pre>&lt;</pre>
1304
1305 !! end
1306
1307 !! test
1308 <pre> with forbidden attribute values (bug 3202)
1309 !! input
1310 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1311 !! result
1312 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1313
1314 !! end
1315
1316 !! test
1317 <nowiki> inside <pre> (bug 13238)
1318 !! input
1319 <pre>
1320 <nowiki>
1321 </pre>
1322 <pre>
1323 <nowiki></nowiki>
1324 </pre>
1325 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <pre>
1331
1332 </pre>
1333 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1334
1335 !! end
1336
1337 !! test
1338 <nowiki> and <pre> preference (first one wins)
1339 !! input
1340 <pre>
1341 <nowiki>
1342 </pre>
1343 </nowiki>
1344 </pre>
1345
1346 <nowiki>
1347 <pre>
1348 <nowiki>
1349 </pre>
1350 </nowiki>
1351 </pre>
1352
1353 !! result
1354 <pre>
1355 &lt;nowiki&gt;
1356 </pre>
1357 <p>&lt;/nowiki&gt;
1358 &lt;/pre&gt;
1359 </p><p>
1360 &lt;pre&gt;
1361 &lt;nowiki&gt;
1362 &lt;/pre&gt;
1363
1364 &lt;/pre&gt;
1365 </p>
1366 !! end
1367
1368 !! test
1369 </pre> inside nowiki
1370 !! input
1371 <nowiki></pre></nowiki>
1372 !! result
1373 <p>&lt;/pre&gt;
1374 </p>
1375 !! end
1376
1377 !!test
1378 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1379 !!input
1380 {{echo|}}
1381 !!result
1382
1383 !!end
1384
1385 !!test
1386 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1387 !!input
1388 {{echo|
1389 foo}}
1390 !!result
1391 <p>foo
1392 </p>
1393 !!end
1394
1395 !! test
1396 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1397 !! input
1398 {{echo|a
1399 b}}
1400 !!result
1401 <pre>a
1402 </pre>
1403 <p>b
1404 </p>
1405 !!end
1406
1407 !! test
1408 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1409 !! input
1410 {{echo|a
1411 b
1412 c
1413 d
1414 e
1415 }}
1416 !!result
1417 <pre>a
1418 </pre>
1419 <p>b
1420 c
1421 </p>
1422 <pre>d
1423 </pre>
1424 <p>e
1425 </p>
1426 !!end
1427
1428 !!test
1429 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1430 !!input
1431 {{echo| foo}}
1432
1433 {{echo| foo}}{{echo| bar}}
1434
1435 {{echo| foo}}
1436 {{echo| bar}}
1437
1438 {{echo|<!--cmt--> foo}}
1439
1440 <!--cmt-->{{echo| foo}}
1441
1442 {{echo|{{echo| }}bar}}
1443 !!result
1444 <pre>foo
1445 </pre>
1446 <pre>foo bar
1447 </pre>
1448 <pre>foo
1449 bar
1450 </pre>
1451 <pre>foo
1452 </pre>
1453 <pre>foo
1454 </pre>
1455 <pre>bar
1456 </pre>
1457 !!end
1458
1459 !! test
1460 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1461 !! input
1462 {{echo| }}a
1463
1464 {{echo|
1465 }}a
1466
1467 {{echo|
1468 b}}
1469
1470 {{echo|a
1471 }}b
1472
1473 {{echo|a
1474 }} b
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p><br />
1479 </p>
1480 <pre>a
1481 </pre>
1482 <p><br />
1483 </p>
1484 <pre>b
1485 </pre>
1486 <p>a
1487 </p>
1488 <pre>b
1489 </pre>
1490 <p>a
1491 </p>
1492 <pre>b
1493 </pre>
1494 !!end
1495
1496 !! test
1497 Templates: Single-line variant of parameter whitespace stripping test
1498 !! input
1499 {{echo| a}}
1500
1501 {{echo|1= a}}
1502
1503 {{echo|{{echo| a}}}}
1504
1505 {{echo|1={{echo| a}}}}
1506 !! result
1507 <pre>a
1508 </pre>
1509 <p>a
1510 </p>
1511 <pre>a
1512 </pre>
1513 <p>a
1514 </p>
1515 !! end
1516
1517 !! test
1518 Templates: Strip whitespace from named parameters, but not positional ones
1519 !! input
1520 {{echo|
1521 foo}}
1522
1523 {{echo|
1524 * foo}}
1525
1526 {{echo| 1 =
1527 foo}}
1528
1529 {{echo| 1 =
1530 * foo}}
1531 !! result
1532 <pre>foo
1533 </pre>
1534 <p><br />
1535 </p>
1536 <ul><li> foo
1537 </li></ul>
1538 <p>foo
1539 </p>
1540 <ul><li> foo
1541 </li></ul>
1542
1543 !! end
1544
1545 !! test
1546 Templates: Dont strip whitespace from whitespace/comment-only arguments
1547 !! input
1548 {{echo| }}
1549 {{echo|<!--cmt-->}}
1550 {{echo| <!--cmt--> }}
1551 !! result
1552 <p><br />
1553 </p>
1554 !! end
1555
1556 !! test
1557 Templates: Parsoid parameter escaping test 1
1558 !! options
1559 parsoid
1560 !! input
1561 {{echo|[foo]|{{echo|[bar]}}}}
1562 !! result
1563 <p about="#mwt1" typeof="mw:Transclusion"
1564 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>
1565 !! end
1566
1567 !! test
1568 Parsoid: Pipes in external links in template parameter
1569 !! options
1570 parsoid
1571 !! input
1572 {{echo|[{{echo|http://example.com}} link]}}
1573 !! result
1574 <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>
1575 !! end
1576
1577 !! test
1578 Parsoid: pipe in transclusion parameter
1579 !! options
1580 parsoid
1581 !! input
1582 {{echo|http://foo.com/a&#124;b}}
1583 !! result
1584 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1585 typeof="mw:Transclusion"
1586 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>
1587 !! end
1588
1589 !! test
1590 Parsoid: Pipe in external link target and content in template parameter
1591 !! options
1592 parsoid=html2wt,wt2wt
1593 !! input
1594 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1595 !! result
1596 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1597 typeof="mw:Transclusion"
1598 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1599 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1600 !! end
1601
1602 !! test
1603 Templates: Dont escape already nowiki-escaped text in template parameters
1604 !! options
1605 parsoid=html2wt,wt2wt
1606 !! input
1607 {{echo|foo<nowiki>|</nowiki>bar}}
1608 !! result
1609 <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>
1610 !! end
1611
1612 ###
1613 ### Parsoid-centric tests for testing RT edge cases for pre
1614 ###
1615
1616 !!test
1617 1a. Indent-Pre and Comments
1618 !!input
1619 a
1620 <!--a-->
1621 c
1622 !!result
1623 <pre>a
1624 </pre>
1625 <p>c
1626 </p>
1627 !!end
1628
1629 !!test
1630 1b. Indent-Pre and Comments
1631 !!input
1632 a
1633 <!--a-->
1634 c
1635 !!result
1636 <pre>a
1637 </pre>
1638 <p>c
1639 </p>
1640 !!end
1641
1642 !!test
1643 1c. Indent-Pre and Comments
1644 !!input
1645 <!--a--> a
1646
1647 <!--a--> a
1648 !!result
1649 <pre> a
1650 </pre>
1651 <pre> a
1652 </pre>
1653 !!end
1654
1655 !!test
1656 2a. Indent-Pre and tables
1657 !!input
1658 {|
1659 |-
1660 !h1!!h2
1661 |foo||bar
1662 |}
1663 !!result
1664 <table>
1665
1666 <tr>
1667 <th>h1</th>
1668 <th>h2
1669 </th>
1670 <td>foo</td>
1671 <td>bar
1672 </td></tr></table>
1673
1674 !!end
1675
1676 !!test
1677 2b. Indent-Pre and tables
1678 !!input
1679 {|
1680 |-
1681 |foo
1682 |}
1683 !!result
1684 <table>
1685
1686 <tr>
1687 <td>foo
1688 </td></tr></table>
1689
1690 !!end
1691
1692 !!test
1693 2c. Indent-Pre and tables (bug 42252)
1694 !!input
1695 {|
1696 |+ foo
1697 ! | bar
1698 |}
1699 !!result
1700 <table>
1701 <caption> foo
1702 </caption>
1703 <tr>
1704 <th> bar
1705 </th></tr></table>
1706
1707 !!end
1708
1709 !!test
1710 3a. Indent-Pre and block tags (single-line html)
1711 !!input
1712 <p> foo </p>
1713 <div> foo </div>
1714 <span> foo </span>
1715 !!result
1716 <p> foo </p>
1717 <div> foo </div>
1718 <pre><span> foo </span>
1719 </pre>
1720 !!end
1721
1722 !!test
1723 3b. Indent-Pre and block tags (pre-content on separate line)
1724 !!input
1725 <p>
1726 foo
1727 </p>
1728
1729 <div>
1730 foo
1731 </div>
1732
1733 <center>
1734 foo
1735 </center>
1736
1737 <blockquote>
1738 foo
1739 </blockquote>
1740
1741 <table><tr><td>
1742 foo
1743 </td></tr></table>
1744
1745 <ul><li>
1746 foo
1747 </li></ul>
1748
1749 !!result
1750 <p>
1751 foo
1752 </p>
1753 <div>
1754 <pre>foo
1755 </pre>
1756 </div>
1757 <center>
1758 <pre>foo
1759 </pre>
1760 </center>
1761 <blockquote>
1762 foo
1763 </blockquote>
1764 <table><tr><td>
1765 <pre>foo
1766 </pre>
1767 </td></tr></table>
1768 <ul><li>
1769 foo
1770 </li></ul>
1771
1772 !!end
1773
1774 !!test
1775 4. Multiple spaces at start-of-line
1776 !!input
1777 <p> foo </p>
1778 foo
1779 {|
1780 |foo
1781 |}
1782 !!result
1783 <p> foo </p>
1784 <pre> foo
1785 </pre>
1786 <table>
1787 <tr>
1788 <td>foo
1789 </td></tr></table>
1790
1791 !!end
1792
1793 !! test
1794 5. White-space in indent-pre
1795 NOTE: the white-space char on 2nd line is significant
1796 !! input
1797 a<br/>
1798
1799 b
1800 !! result
1801 <pre>a<br />
1802
1803 b
1804 </pre>
1805 !! end
1806
1807 ###
1808 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1809 ###
1810
1811 !!test
1812 HTML-pre: 1. embedded newlines
1813 !!input
1814 <pre>foo</pre>
1815
1816 <pre>
1817 foo
1818 </pre>
1819
1820 <pre>
1821
1822 foo
1823 </pre>
1824
1825 <pre>
1826
1827
1828 foo
1829 </pre>
1830 !!result
1831 <pre>foo</pre>
1832 <pre>
1833 foo
1834 </pre>
1835 <pre>
1836
1837 foo
1838 </pre>
1839 <pre>
1840
1841
1842 foo
1843 </pre>
1844
1845 !!end
1846
1847 !!test
1848 HTML-pre: 2: indented text
1849 !!input
1850 <pre>
1851 foo
1852 </pre>
1853 !!result
1854 <pre>
1855 foo
1856 </pre>
1857
1858 !!end
1859
1860 !!test
1861 HTML-pre: 3: other wikitext
1862 !!input
1863 <pre>
1864 * foo
1865 # bar
1866 = no-h =
1867 '' no-italic ''
1868 [[ NoLink ]]
1869 </pre>
1870 !!result
1871 <pre>
1872 * foo
1873 # bar
1874 = no-h =
1875 '' no-italic ''
1876 [[ NoLink ]]
1877 </pre>
1878
1879 !!end
1880
1881 ###
1882 ### Definition lists
1883 ###
1884 !! test
1885 Simple definition
1886 !! input
1887 ; name : Definition
1888 !! result
1889 <dl><dt> name&#160;</dt><dd> Definition
1890 </dd></dl>
1891
1892 !! end
1893
1894 !! test
1895 Definition list for indentation only
1896 !! input
1897 : Indented text
1898 !! result
1899 <dl><dd> Indented text
1900 </dd></dl>
1901
1902 !! end
1903
1904 !! test
1905 Definition list with no space
1906 !! input
1907 ;name:Definition
1908 !! result
1909 <dl><dt>name</dt><dd>Definition
1910 </dd></dl>
1911
1912 !!end
1913
1914 !! test
1915 Definition list with URL link
1916 !! input
1917 ; http://example.com/ : definition
1918 !! result
1919 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1920 </dd></dl>
1921
1922 !! end
1923
1924 !! test
1925 Definition list with bracketed URL link
1926 !! input
1927 ;[http://www.example.com/ Example]:Something about it
1928 !! result
1929 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1930 </dd></dl>
1931
1932 !! end
1933
1934 !! test
1935 Definition list with wikilink containing colon
1936 !! input
1937 ; [[Help:FAQ]]: The least-read page on Wikipedia
1938 !! result
1939 <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
1940 </dd></dl>
1941
1942 !! end
1943
1944 # At Brion's and JeLuF's insistence... :)
1945 !! test
1946 Definition list with news link containing colon
1947 !! input
1948 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1949 !! result
1950 <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!
1951 </dd></dl>
1952
1953 !! end
1954
1955 !! test
1956 Malformed definition list with colon
1957 !! input
1958 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1959 !! result
1960 <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
1961 </dt></dl>
1962
1963 !! end
1964
1965 !! test
1966 Definition lists: colon in external link text
1967 !! input
1968 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1969 !! result
1970 <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
1971 </dd></dl>
1972
1973 !! end
1974
1975 !! test
1976 Definition lists: colon in HTML attribute
1977 !! input
1978 ;<b style="display: inline">bold</b>
1979 !! result
1980 <dl><dt><b style="display: inline">bold</b>
1981 </dt></dl>
1982
1983 !! end
1984
1985 !! test
1986 Definition lists: self-closed tag
1987 !! input
1988 ;one<br/>two : two-line fun
1989 !! result
1990 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1991 </dd></dl>
1992
1993 !! end
1994
1995 !! test
1996 Bug 11748: Literal closing tags
1997 !! input
1998 <dl>
1999 <dt>test 1</dt>
2000 <dd>test test test test test</dd>
2001 <dt>test 2</dt>
2002 <dd>test test test test test</dd>
2003 </dl>
2004 !! result
2005 <dl>
2006 <dt>test 1</dt>
2007 <dd>test test test test test</dd>
2008 <dt>test 2</dt>
2009 <dd>test test test test test</dd>
2010 </dl>
2011
2012 !! end
2013
2014 !! test
2015 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2016 !! input
2017 <ul><li>
2018 ; term : description
2019 * unordered
2020 </li>
2021 </ul>
2022 !! result
2023 <ul><li>
2024 <dl><dt> term&#160;</dt><dd> description
2025 </dd></dl>
2026 <ul><li> unordered
2027 </li></ul>
2028 </li>
2029 </ul>
2030
2031 !! end
2032
2033 !! test
2034
2035 Definition list with empty definition and following paragraph
2036 !! input
2037 ; term:
2038 Paragraph text
2039 !! result
2040 <dl><dt> term</dt><dd>
2041 </dd></dl>
2042 <p>Paragraph text
2043 </p>
2044 !! end
2045
2046 !! test
2047 Nested definition lists using html syntax
2048 !! input
2049 <dl><dd>
2050 <dl>
2051 <dd>Foo</dd>
2052 </dl>
2053 </dd></dl>
2054 !! result
2055 <dl><dd>
2056 <dl>
2057 <dd>Foo</dd>
2058 </dl>
2059 </dd></dl>
2060
2061 !! end
2062
2063 !! test
2064 Definition Lists: No nesting: Multiple dd's
2065 !! input
2066 ;x
2067 :a
2068 :b
2069 !! result
2070 <dl><dt>x
2071 </dt><dd>a
2072 </dd><dd>b
2073 </dd></dl>
2074
2075 !! end
2076
2077 !! test
2078 Definition Lists: Indentation: Regular
2079 !! input
2080 :i1
2081 ::i2
2082 :::i3
2083 !! result
2084 <dl><dd>i1
2085 <dl><dd>i2
2086 <dl><dd>i3
2087 </dd></dl>
2088 </dd></dl>
2089 </dd></dl>
2090
2091 !! end
2092
2093 !! test
2094 Definition Lists: Indentation: Missing 1st level
2095 !! input
2096 ::i2
2097 :::i3
2098 !! result
2099 <dl><dd><dl><dd>i2
2100 <dl><dd>i3
2101 </dd></dl>
2102 </dd></dl>
2103 </dd></dl>
2104
2105 !! end
2106
2107 !! test
2108 Definition Lists: Indentation: Multi-level indent
2109 !! input
2110 :::i3
2111 !! result
2112 <dl><dd><dl><dd><dl><dd>i3
2113 </dd></dl>
2114 </dd></dl>
2115 </dd></dl>
2116
2117 !! end
2118
2119 !! test
2120 Definition Lists: Hacky use to indent tables
2121 !! input
2122 ::{|
2123 |foo
2124 |bar
2125 |}
2126 this text
2127 should be left alone
2128 !! result
2129 <dl><dd><dl><dd><table>
2130 <tr>
2131 <td>foo
2132 </td>
2133 <td>bar
2134 </td></tr></table></dd></dl></dd></dl>
2135 <p>this text
2136 should be left alone
2137 </p>
2138 !! end
2139 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2140 ## as an empty dt item. It also ignores all but the last ";" when followed
2141 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2142 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2143 ## ";"s.
2144 ##
2145 ## Ex: ";;t2 ::d2" is transformed into:
2146 ##
2147 ## <dl>
2148 ## <dt>t2 </dt>
2149 ## <dd>
2150 ## <dl>
2151 ## <dt></dt>
2152 ## <dd>d2</dd>
2153 ## </dl>
2154 ## </dd>
2155 ## </dl>
2156 ##
2157 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2158 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2159 ##
2160 ## <dl>
2161 ## <dt>
2162 ## <dl>
2163 ## <dt>t2 </dt>
2164 ## <dd>:d2</dd>
2165 ## </dl>
2166 ## </dt>
2167 ## </dl>
2168 ##
2169 ## All Parsoid only definition list tests have this difference.
2170 ##
2171 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2172 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2173
2174 !! test
2175 Table / list interaction: indented table with lists in table contents
2176 !! input
2177 :{|
2178 |-
2179 | a
2180 * b
2181 |-
2182 | c
2183 * d
2184 |}
2185 !! result
2186 <dl><dd><table>
2187
2188 <tr>
2189 <td> a
2190 <ul><li> b
2191 </li></ul>
2192 </td></tr>
2193 <tr>
2194 <td> c
2195 <ul><li> d
2196 </li></ul>
2197 </td></tr></table></dd></dl>
2198
2199 !! end
2200
2201 !!test
2202 Table / list interaction: lists nested in tables nested in indented lists
2203 !!input
2204 :{|
2205 |
2206 :a
2207 :b
2208 |
2209 *c
2210 *d
2211 |}
2212
2213 *e
2214 *f
2215 !!result
2216 <dl><dd><table>
2217 <tr>
2218 <td>
2219 <dl><dd>a
2220 </dd><dd>b
2221 </dd></dl>
2222 </td>
2223 <td>
2224 <ul><li>c
2225 </li><li>d
2226 </li></ul>
2227 </td></tr></table></dd></dl>
2228 <ul><li>e
2229 </li><li>f
2230 </li></ul>
2231
2232 !!end
2233
2234 !! test
2235 Definition Lists: Nesting: Multi-level (Parsoid only)
2236 !! options
2237 parsoid
2238 !! input
2239 ;t1 :d1
2240 ;;t2 ::d2
2241 ;;;t3 :::d3
2242 !! result
2243 <dl>
2244 <dt>t1 </dt>
2245 <dd>d1</dd>
2246 <dt>
2247 <dl>
2248 <dt>t2 </dt>
2249 <dd>:d2</dd>
2250 <dt>
2251 <dl>
2252 <dt>t3 </dt>
2253 <dd>::d3</dd>
2254 </dl>
2255 </dt>
2256 </dl>
2257 </dt>
2258 </dl>
2259
2260
2261 !! end
2262
2263
2264 !! test
2265 Definition Lists: Nesting: Test 2 (Parsoid only)
2266 !! options
2267 parsoid
2268 !! input
2269 ;t1
2270 ::d2
2271 !! result
2272 <dl>
2273 <dt>t1</dt>
2274 <dd>
2275 <dl>
2276 <dd>d2</dd>
2277 </dl>
2278 </dd>
2279 </dl>
2280
2281 !! end
2282
2283
2284 !! test
2285 Definition Lists: Nesting: Test 3 (Parsoid only)
2286 !! options
2287 parsoid
2288 !! input
2289 :;t1
2290 ::::d2
2291 !! result
2292 <dl>
2293 <dd>
2294 <dl>
2295 <dt>t1</dt>
2296 <dd>
2297 <dl>
2298 <dd>
2299 <dl>
2300 <dd>d2</dd>
2301 </dl>
2302 </dd>
2303 </dl>
2304 </dd>
2305 </dl>
2306 </dd>
2307 </dl>
2308
2309 !! end
2310
2311
2312 !! test
2313 Definition Lists: Nesting: Test 4
2314 !! input
2315 ::;t3
2316 :::d3
2317 !! result
2318 <dl><dd><dl><dd><dl><dt>t3
2319 </dt><dd>d3
2320 </dd></dl>
2321 </dd></dl>
2322 </dd></dl>
2323
2324 !! end
2325
2326
2327 ## The Parsoid team believes the following three test exposes a
2328 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2329 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2330 !! test
2331 Definition Lists: Mixed Lists: Test 1 (php)
2332 !! options
2333 php
2334 !! input
2335 :;* foo
2336 ::* bar
2337 :; baz
2338 !! result
2339 <dl><dd><dl><dt><ul><li> foo
2340 </li><li> bar
2341 </li></ul>
2342 </dt></dl>
2343 <dl><dt> baz
2344 </dt></dl>
2345 </dd></dl>
2346
2347 !! end
2348 !! test
2349 Definition Lists: Mixed Lists: Test 1 (parsoid)
2350 !! options
2351 parsoid
2352 !! input
2353 :;* foo
2354 ::* bar
2355 :; baz
2356 !! result
2357 <dl><dd><dl><dt><ul><li> foo
2358 </li></ul></dt><dd><ul><li> bar
2359 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2360 !! end
2361
2362 !! test
2363 Definition Lists: Mixed Lists: Test 2
2364 !! input
2365 *: d1
2366 *: d2
2367 !! result
2368 <ul><li><dl><dd> d1
2369 </dd><dd> d2
2370 </dd></dl>
2371 </li></ul>
2372
2373 !! end
2374
2375
2376 !! test
2377 Definition Lists: Mixed Lists: Test 3
2378 !! input
2379 *::: d1
2380 *::: d2
2381 !! result
2382 <ul><li><dl><dd><dl><dd><dl><dd> d1
2383 </dd><dd> d2
2384 </dd></dl>
2385 </dd></dl>
2386 </dd></dl>
2387 </li></ul>
2388
2389 !! end
2390
2391
2392 !! test
2393 Definition Lists: Mixed Lists: Test 4
2394 !! input
2395 *;d1 :d2
2396 *;d3 :d4
2397 !! result
2398 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2399 </dd><dt>d3&#160;</dt><dd>d4
2400 </dd></dl>
2401 </li></ul>
2402
2403 !! end
2404
2405
2406 !! test
2407 Definition Lists: Mixed Lists: Test 5
2408 !! input
2409 *:d1
2410 *:: d2
2411 !! result
2412 <ul><li><dl><dd>d1
2413 <dl><dd> d2
2414 </dd></dl>
2415 </dd></dl>
2416 </li></ul>
2417
2418 !! end
2419
2420
2421 !! test
2422 Definition Lists: Mixed Lists: Test 6
2423 !! input
2424 #*:d1
2425 #*::: d3
2426 !! result
2427 <ol><li><ul><li><dl><dd>d1
2428 <dl><dd><dl><dd> d3
2429 </dd></dl>
2430 </dd></dl>
2431 </dd></dl>
2432 </li></ul>
2433 </li></ol>
2434
2435 !! end
2436
2437
2438 !! test
2439 Definition Lists: Mixed Lists: Test 7
2440 !! input
2441 :* d1
2442 :* d2
2443 !! result
2444 <dl><dd><ul><li> d1
2445 </li><li> d2
2446 </li></ul>
2447 </dd></dl>
2448
2449 !! end
2450
2451
2452 !! test
2453 Definition Lists: Mixed Lists: Test 8
2454 !! input
2455 :* d1
2456 ::* d2
2457 !! result
2458 <dl><dd><ul><li> d1
2459 </li></ul>
2460 <dl><dd><ul><li> d2
2461 </li></ul>
2462 </dd></dl>
2463 </dd></dl>
2464
2465 !! end
2466
2467
2468 !! test
2469 Definition Lists: Mixed Lists: Test 9
2470 !! input
2471 *;foo :bar
2472 !! result
2473 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2474 </dd></dl>
2475 </li></ul>
2476
2477 !! end
2478
2479
2480 !! test
2481 Definition Lists: Mixed Lists: Test 10
2482 !! input
2483 *#;foo :bar
2484 !! result
2485 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2486 </dd></dl>
2487 </li></ol>
2488 </li></ul>
2489
2490 !! end
2491
2492 # The Parsoid team disagrees with the PHP parser's seemingly-random
2493 # rules regarding dd/dt on the next two tests. Parsoid is more
2494 # consistent, and recognizes the shared nesting and keeps the
2495 # still-open tags around until the nesting is complete.
2496
2497 !! test
2498 Definition Lists: Mixed Lists: Test 11 (php)
2499 !! options
2500 php
2501 !! input
2502 *#*#;*;;foo :bar
2503 *#*#;boo :baz
2504 !! result
2505 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2506 </dt></dl>
2507 </dd></dl>
2508 </li></ul>
2509 </dd></dl>
2510 <dl><dt>boo&#160;</dt><dd>baz
2511 </dd></dl>
2512 </li></ol>
2513 </li></ul>
2514 </li></ol>
2515 </li></ul>
2516
2517 !! end
2518 !! test
2519 Definition Lists: Mixed Lists: Test 11 (parsoid)
2520 !! options
2521 parsoid
2522 !! input
2523 *#*#;*;;foo :bar
2524 *#*#;boo :baz
2525 !! result
2526 <ul>
2527 <li>
2528 <ol>
2529 <li>
2530 <ul>
2531 <li>
2532 <ol>
2533 <li>
2534 <dl>
2535 <dt>
2536 <ul>
2537 <li>
2538 <dl>
2539 <dt>
2540 <dl>
2541 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2542 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2543 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2544 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2545 !! end
2546
2547
2548 !! test
2549 Definition Lists: Weird Ones: Test 1 (php)
2550 !! options
2551 php
2552 !! input
2553 *#;*::;; foo : bar (who uses this?)
2554 !! result
2555 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2556 </dt></dl>
2557 </dd></dl>
2558 </dd></dl>
2559 </dd></dl>
2560 </li></ul>
2561 </dd></dl>
2562 </li></ol>
2563 </li></ul>
2564
2565 !! end
2566 !! test
2567 Definition Lists: Weird Ones: Test 1 (parsoid)
2568 !! options
2569 parsoid
2570 !! input
2571 *#;*::;; foo : bar (who uses this?)
2572 !! result
2573 <ul>
2574 <li>
2575 <ol>
2576 <li>
2577 <dl>
2578 <dt>
2579 <ul>
2580 <li>
2581 <dl>
2582 <dd>
2583 <dl>
2584 <dd>
2585 <dl>
2586 <dt>
2587 <dl>
2588 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2589 <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>
2590 !! end
2591
2592 ###
2593 ### External links
2594 ###
2595 !! test
2596 External links: non-bracketed
2597 !! input
2598 Non-bracketed: http://example.com
2599 !! result
2600 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2601 </p>
2602 !! end
2603
2604 !! test
2605 External links: numbered
2606 !! input
2607 Numbered: [http://example.com]
2608 Numbered: [http://example.net]
2609 Numbered: [http://example.com]
2610 !! result
2611 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2612 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2613 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2614 </p>
2615 !!end
2616
2617 !! test
2618 External links: specified text
2619 !! input
2620 Specified text: [http://example.com link]
2621 !! result
2622 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2623 </p>
2624 !!end
2625
2626 !! test
2627 External links: trail
2628 !! input
2629 Linktrails should not work for external links: [http://example.com link]s
2630 !! result
2631 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2632 </p>
2633 !! end
2634
2635 !! test
2636 External links: dollar sign in URL
2637 !! input
2638 http://example.com/1$2345
2639 !! result
2640 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2641 </p>
2642 !! end
2643
2644 !! test
2645 External links: dollar sign in URL (named)
2646 !! input
2647 [http://example.com/1$2345]
2648 !! result
2649 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2650 </p>
2651 !!end
2652
2653 !! test
2654 External links: open square bracket forbidden in URL (bug 4377)
2655 !! input
2656 http://example.com/1[2345
2657 !! result
2658 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2659 </p>
2660 !! end
2661
2662 !! test
2663 External links: open square bracket forbidden in URL (named) (bug 4377)
2664 !! input
2665 [http://example.com/1[2345]
2666 !! result
2667 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2668 </p>
2669 !!end
2670
2671 !! test
2672 External links: nowiki in URL link text (bug 6230)
2673 !!input
2674 [http://example.com/ <nowiki>''example site''</nowiki>]
2675 !! result
2676 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2677 </p>
2678 !! end
2679
2680 !! test
2681 External links: newline forbidden in text (bug 6230 regression check)
2682 !! input
2683 [http://example.com/ first
2684 second]
2685 !! result
2686 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2687 second]
2688 </p>
2689 !!end
2690
2691 !! test
2692 External links: Pipe char between url and text
2693 !! input
2694 [http://example.com | link]
2695 !! result
2696 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2697 </p>
2698 !!end
2699
2700 !! test
2701 External links: protocol-relative URL in brackets
2702 !! input
2703 [//example.com/ Test]
2704 !! result
2705 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2706 </p>
2707 !! end
2708
2709 !! test
2710 External links: protocol-relative URL in brackets without text
2711 !! input
2712 [//example.com]
2713 !! result
2714 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2715 </p>
2716 !! end
2717
2718 !! test
2719 External links: protocol-relative URL in free text is left alone
2720 !! input
2721 //example.com/Foo
2722 !! result
2723 <p>//example.com/Foo
2724 </p>
2725 !!end
2726
2727 !! test
2728 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2729 !! input
2730 foo//example.com/Foo
2731 !! result
2732 <p>foo//example.com/Foo
2733 </p>
2734 !! end
2735
2736 !! test
2737 External image
2738 !! input
2739 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2740 !! result
2741 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2742 </p>
2743 !! end
2744
2745 !! test
2746 External image from https
2747 !! input
2748 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2749 !! result
2750 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2751 </p>
2752 !! end
2753
2754 !! test
2755 Link to non-http image, no img tag
2756 !! input
2757 Link to non-http image, no img tag: ftp://example.com/test.jpg
2758 !! result
2759 <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>
2760 </p>
2761 !! end
2762
2763 !! test
2764 External links: terminating separator
2765 !! input
2766 Terminating separator: http://example.com/thing,
2767 !! result
2768 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2769 </p>
2770 !! end
2771
2772 !! test
2773 External links: intervening separator
2774 !! input
2775 Intervening separator: http://example.com/1,2,3
2776 !! result
2777 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2778 </p>
2779 !! end
2780
2781 !! test
2782 External links: old bug with URL in query
2783 !! input
2784 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2785 !! result
2786 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2787 </p>
2788 !! end
2789
2790 !! test
2791 External links: old URL-in-URL bug, mixed protocols
2792 !! input
2793 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2794 !! result
2795 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2796 </p>
2797 !!end
2798
2799 !! test
2800 External links: URL in text
2801 !! input
2802 URL in text: [http://example.com http://example.com]
2803 !! result
2804 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2805 </p>
2806 !! end
2807
2808 !! test
2809 External links: Clickable images
2810 !! input
2811 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2812 !! result
2813 <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>
2814 </p>
2815 !!end
2816
2817 !! test
2818 External links: raw ampersand
2819 !! input
2820 Old &amp; use: http://x&y
2821 !! result
2822 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2823 </p>
2824 !! end
2825
2826 !! test
2827 External links: encoded ampersand
2828 !! input
2829 Old &amp; use: http://x&amp;y
2830 !! result
2831 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2832 </p>
2833 !! end
2834
2835 !! test
2836 External links: encoded equals (bug 6102)
2837 !! input
2838 http://example.com/?foo&#61;bar
2839 !! result
2840 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: [raw ampersand]
2846 !! input
2847 Old &amp; use: [http://x&y]
2848 !! result
2849 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2850 </p>
2851 !! end
2852
2853 !! test
2854 External links: [encoded ampersand]
2855 !! input
2856 Old &amp; use: [http://x&amp;y]
2857 !! result
2858 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2859 </p>
2860 !! end
2861
2862 !! test
2863 External links: [encoded equals] (bug 6102)
2864 !! input
2865 [http://example.com/?foo&#61;bar]
2866 !! result
2867 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2868 </p>
2869 !! end
2870
2871 !! test
2872 External links: [IDN ignored character reference in hostname; strip it right off]
2873 !! input
2874 [http://e&zwnj;xample.com/]
2875 !! result
2876 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2877 </p>
2878 !! end
2879
2880 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2881 # Where an external link could easily circumvent the sanitization of the text of
2882 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2883 # test demands a higher standard. That's a bit strange.
2884 #
2885 # Example:
2886 #
2887 # http://e‌xample.com -> [http://example.com|http://example.com]
2888 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2889 #
2890 # The first example is sanitized, but the second is not. Any security benefits
2891 # from this production are trivial to circumvent. Either remove this test and
2892 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2893 # the test accordingly.
2894 #
2895 # All our love,
2896 # The Parsoid team.
2897 !! test
2898 External links: IDN ignored character reference in hostname; strip it right off
2899 !! input
2900 http://e&zwnj;xample.com/
2901 !! result
2902 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2903 </p>
2904 !! end
2905
2906 !! test
2907 External links: www.jpeg.org (bug 554)
2908 !! input
2909 http://www.jpeg.org
2910 !!result
2911 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2912 </p>
2913 !! end
2914
2915 !! test
2916 External links: URL within URL (original bug 2)
2917 !! input
2918 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2919 !! result
2920 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2921 </p>
2922 !! end
2923
2924 !! test
2925 BUG 361: URL inside bracketed URL
2926 !! input
2927 [http://www.example.com/foo http://www.example.com/bar]
2928 !! result
2929 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2930 </p>
2931 !! end
2932
2933 !! test
2934 BUG 361: URL within URL, not bracketed
2935 !! input
2936 http://www.example.com/foo?=http://www.example.com/bar
2937 !! result
2938 <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>
2939 </p>
2940 !! end
2941
2942 !! test
2943 BUG 289: ">"-token in URL-tail
2944 !! input
2945 http://www.example.com/<hello>
2946 !! result
2947 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2948 </p>
2949 !!end
2950
2951 !! test
2952 BUG 289: literal ">"-token in URL-tail
2953 !! input
2954 http://www.example.com/<b>html</b>
2955 !! result
2956 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2957 </p>
2958 !!end
2959
2960 !! test
2961 BUG 289: ">"-token in bracketed URL
2962 !! input
2963 [http://www.example.com/<hello> stuff]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2966 </p>
2967 !!end
2968
2969 !! test
2970 BUG 289: literal ">"-token in bracketed URL
2971 !! input
2972 [http://www.example.com/<b>html</b> stuff]
2973 !! result
2974 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2975 </p>
2976 !!end
2977
2978 !! test
2979 BUG 289: literal double quote at end of URL
2980 !! input
2981 http://www.example.com/"hello"
2982 !! result
2983 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2984 </p>
2985 !!end
2986
2987 !! test
2988 BUG 289: literal double quote in bracketed URL
2989 !! input
2990 [http://www.example.com/"hello" stuff]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2993 </p>
2994 !!end
2995
2996 !! test
2997 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2998 !! input
2999 [http://www.example.com test]
3000 !! result
3001 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3002 </p>
3003 !! end
3004
3005 !! test
3006 External links: link text with spaces
3007 !! input
3008 [http://www.example.com a b c]
3009 [http://www.example.com ''a'' ''b'']
3010 !! result
3011 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3012 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3013 </p>
3014 !! end
3015
3016 !! test
3017 External links: wiki links within external link (Bug 3695)
3018 !! input
3019 [http://example.com [[wikilink]] embedded in ext link]
3020 !! result
3021 <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>
3022 </p>
3023 !! end
3024
3025 !! test
3026 BUG 787: Links with one slash after the url protocol are invalid
3027 !! input
3028 http:/example.com
3029
3030 [http:/example.com title]
3031 !! result
3032 <p>http:/example.com
3033 </p><p>[http:/example.com title]
3034 </p>
3035 !! end
3036
3037 !! test
3038 Bracketed external links with template-generated invalid target
3039 !! input
3040 [{{echo|http:/example.com}} title]
3041 !! result
3042 <p>[http:/example.com title]
3043 </p>
3044 !! end
3045
3046 !! test
3047 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3048 !! input
3049 ''[http://example.com text'']
3050 [http://example.com '''text]'''
3051 ''Something [http://example.com in italic'']
3052 ''Something [http://example.com mixed''''', even bold]'''
3053 '''''Now [http://example.com both''''']
3054 !! result
3055 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3056 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3057 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3058 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3059 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3060 </p>
3061 !! end
3062
3063
3064 !! test
3065 Bug 4781: %26 in URL
3066 !! input
3067 http://www.example.com/?title=AT%26T
3068 !! result
3069 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3070 </p>
3071 !! end
3072
3073 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3074 # % is actually legal in HTML5. Any change in output would need testing though.
3075 !! test
3076 Bug 4781, 5267: %25 in URL
3077 !! input
3078 http://www.example.com/?title=100%25_Bran
3079 !! result
3080 <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>
3081 </p>
3082 !! end
3083
3084 !! test
3085 Bug 4781, 5267: %28, %29 in URL
3086 !! input
3087 http://www.example.com/?title=Ben-Hur_%281959_film%29
3088 !! result
3089 <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>
3090 </p>
3091 !! end
3092
3093
3094 !! test
3095 Bug 4781: %26 in autonumber URL
3096 !! input
3097 [http://www.example.com/?title=AT%26T]
3098 !! result
3099 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3100 </p>
3101 !! end
3102
3103 !! test
3104 Bug 4781, 5267: %26 in autonumber URL
3105 !! input
3106 [http://www.example.com/?title=100%25_Bran]
3107 !! result
3108 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3109 </p>
3110 !! end
3111
3112 !! test
3113 Bug 4781, 5267: %28, %29 in autonumber URL
3114 !! input
3115 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3116 !! result
3117 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3118 </p>
3119 !! end
3120
3121
3122 !! test
3123 Bug 4781: %26 in bracketed URL
3124 !! input
3125 [http://www.example.com/?title=AT%26T link]
3126 !! result
3127 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3128 </p>
3129 !! end
3130
3131 !! test
3132 Bug 4781, 5267: %26 in bracketed URL
3133 !! input
3134 [http://www.example.com/?title=100%25_Bran link]
3135 !! result
3136 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3137 </p>
3138 !! end
3139
3140 !! test
3141 Bug 4781, 5267: %28, %29 in bracketed URL
3142 !! input
3143 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3144 !! result
3145 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3146 </p>
3147 !! end
3148
3149 !! test
3150 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3151 !! input
3152 Some [http://example.com/ pretty ''italics'' and stuff]!
3153 !! result
3154 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3155 </p>
3156 !! end
3157
3158 !! test
3159 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3160 !! input
3161 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3162 !! result
3163 <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>
3164 </p>
3165 !! end
3166
3167 !! test
3168 External link containing double-single-quotes with no space separating the url from text in italics
3169 !! input
3170 [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]].]
3171 !! result
3172 <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>
3173 </p>
3174 !! end
3175
3176 !! test
3177 External link with comments in link text
3178 !! input
3179 [http://www.google.com Google <!-- comment -->]
3180 !! result
3181 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3182 </p>
3183 !! end
3184
3185 !! test
3186 URL-encoding in URL functions (single parameter)
3187 !! input
3188 {{localurl:Some page|amp=&}}
3189 !! result
3190 <p>/index.php?title=Some_page&amp;amp=&amp;
3191 </p>
3192 !! end
3193
3194 !! test
3195 URL-encoding in URL functions (multiple parameters)
3196 !! input
3197 {{localurl:Some page|q=?&amp=&}}
3198 !! result
3199 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3200 </p>
3201 !! end
3202
3203 !! test
3204 Brackets in urls
3205 !! input
3206 http://example.com/index.php?foozoid%5B%5D=bar
3207
3208 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3209 !! result
3210 <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>
3211 </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>
3212 </p>
3213 !! end
3214
3215 !! test
3216 IPv6 urls (bug 21261)
3217 !! options
3218 disabled
3219 !! input
3220 http://[2404:130:0:1000::187:2]/index.php
3221 !! result
3222 <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>
3223 </p>
3224 !! end
3225
3226 !! test
3227 Non-extlinks in brackets
3228 !! input
3229 [foo]
3230 [foo bar]
3231 [foo ''bar'']
3232 [fool's] errand
3233 [fool's errand]
3234 [{{echo|foo}}]
3235 [{{echo|foo}} bar]
3236 [{{echo|foo}} ''bar'']
3237 [{{echo|foo}}l's] errand
3238 [{{echo|foo}}l's errand]
3239 [url={{echo|foo}}]
3240 [url=http://example.com]
3241 !! result
3242 <p>[foo]
3243 [foo bar]
3244 [foo <i>bar</i>]
3245 [fool's] errand
3246 [fool's errand]
3247 [foo]
3248 [foo bar]
3249 [foo <i>bar</i>]
3250 [fool's] errand
3251 [fool's errand]
3252 [url=foo]
3253 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3254 </p>
3255 !! end
3256
3257 !! test
3258 Parsoid: Percent encoding in external links
3259 !! options
3260 parsoid
3261 !! input
3262 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3263 !! result
3264 <p><a rel="mw:ExtLink"
3265 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3266 !! end
3267
3268 !! test
3269 Parsoid: use url link syntax for links where the content is equal the link
3270 target
3271 !! options
3272 parsoid
3273 !! input
3274 http://example.com
3275 !! result
3276 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3277 !! end
3278
3279 ###
3280 ### Quotes
3281 ###
3282
3283 !! test
3284 Quotes
3285 !! input
3286 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3287
3288 Normal text. '''''Bold italic text.''''' Normal text.
3289 !!result
3290 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3291 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3292 </p>
3293 !! end
3294
3295
3296 !! test
3297 Unclosed and unmatched quotes (php)
3298 !! options
3299 php
3300 !! input
3301 '''''Bold italic text '''with bold deactivated''' in between.'''''
3302
3303 '''''Bold italic text ''with italic deactivated'' in between.'''''
3304
3305 '''Bold text..
3306
3307 ..spanning two paragraphs (should not work).'''
3308
3309 '''Bold tag left open
3310
3311 ''Italic tag left open
3312
3313 Normal text.
3314
3315 <!-- Unmatching number of opening, closing tags: -->
3316 '''This year''''s election ''should'' beat '''last year''''s.
3317
3318 ''Tom'''s car is bigger than ''Susan'''s.
3319
3320 Plain ''italic'''s plain
3321 !! result
3322 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3323 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3324 </p><p><b>Bold text..</b>
3325 </p><p>..spanning two paragraphs (should not work).
3326 </p><p><b>Bold tag left open</b>
3327 </p><p><i>Italic tag left open</i>
3328 </p><p>Normal text.
3329 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3330 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3331 </p><p>Plain <i>italic'</i>s plain
3332 </p>
3333 !! end
3334 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3335 # parser strips. The wikitext contains just the first half of the bold
3336 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3337 # differently than the PHP parser.)
3338 !! test
3339 Unclosed and unmatched quotes (parsoid)
3340 !! options
3341 parsoid
3342 !! input
3343 '''''Bold italic text '''with bold deactivated''' in between.'''''
3344
3345 '''''Bold italic text ''with italic deactivated'' in between.'''''
3346
3347 '''Bold text..
3348
3349 ..spanning two paragraphs (should not work).'''
3350
3351 '''Bold tag left open
3352
3353 ''Italic tag left open
3354
3355 Normal text.
3356
3357 <!-- Unmatching number of opening, closing tags: -->
3358 '''This year''''s election ''should'' beat '''last year''''s.
3359
3360 ''Tom'''s car is bigger than ''Susan'''s.
3361
3362 Plain ''italic'''s plain
3363 !! result
3364 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3365 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3366 </p><p><b>Bold text..</b>
3367 </p><p>..spanning two paragraphs (should not work).<b></b>
3368 </p><p><b>Bold tag left open</b>
3369 </p><p><i>Italic tag left open</i>
3370 </p><p>Normal text.
3371 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3372 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3373 </p><p>Plain <i>italic'</i>s plain
3374 </p>
3375 !! end
3376
3377 ###
3378 ### Tables
3379 ###
3380 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3381 ###
3382
3383 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3384 # is the bare minimum required by the spec, see:
3385 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3386 !! test
3387 A table with no data. (php)
3388 !! options
3389 php
3390 !! input
3391 {||}
3392 !! result
3393 !! end
3394 # Parsoid team replies: empty table tags are legal in HTML5
3395 !! test
3396 A table with no data. (parsoid)
3397 !! options
3398 parsoid
3399 !! input
3400 {||}
3401 !! result
3402 <table></table>
3403 !! end
3404
3405 # A table with nothing but a caption is invalid XHTML, we might want to render
3406 # this as <p>caption</p>
3407 !! test
3408 A table with nothing but a caption (php)
3409 !! options
3410 php
3411 !! input
3412 {|
3413 |+ caption
3414 |}
3415 !! result
3416 <table>
3417 <caption> caption
3418 </caption><tr><td></td></tr></table>
3419
3420 !! end
3421 # Parsoid team replies: table with only a caption is legal in HTML5
3422 !! test
3423 A table with nothing but a caption (parsoid)
3424 !! options
3425 parsoid
3426 !! input
3427 {|
3428 |+ caption
3429 |}
3430 !! result
3431 <table><caption> caption</caption></table>
3432 !! end
3433
3434 !! test
3435 A table with caption with default-spaced attributes and a table row
3436 !! input
3437 {|
3438 |+ style="color: red;" | caption1
3439 |-
3440 | foo
3441 |}
3442 !! result
3443 <table>
3444 <caption style="color: red;"> caption1
3445 </caption>
3446 <tr>
3447 <td> foo
3448 </td></tr></table>
3449
3450 !! end
3451
3452 !! test
3453 A table with captions with non-default spaced attributes and a table row
3454 !! input
3455 {|
3456 |+style="color: red;"|caption2
3457 |+ style="color: red;"| caption3
3458 |-
3459 | foo
3460 |}
3461 !! result
3462 <table>
3463 <caption style="color: red;">caption2
3464 </caption>
3465 <caption style="color: red;"> caption3
3466 </caption>
3467 <tr>
3468 <td> foo
3469 </td></tr></table>
3470
3471 !! end
3472
3473 !! test
3474 Table td-cell syntax variations
3475 !! input
3476 {|
3477 | foo bar foo | baz
3478 | foo bar foo || baz
3479 | style='color:red;' | baz
3480 | style='color:red;' || baz
3481 |}
3482 !! result
3483 <table>
3484 <tr>
3485 <td> baz
3486 </td>
3487 <td> foo bar foo </td>
3488 <td> baz
3489 </td>
3490 <td style="color:red;"> baz
3491 </td>
3492 <td> style='color:red;' </td>
3493 <td> baz
3494 </td></tr></table>
3495
3496 !! end
3497
3498 !! test
3499 Simple table
3500 !! input
3501 {|
3502 | 1 || 2
3503 |-
3504 | 3 || 4
3505 |}
3506 !! result
3507 <table>
3508 <tr>
3509 <td> 1 </td>
3510 <td> 2
3511 </td></tr>
3512 <tr>
3513 <td> 3 </td>
3514 <td> 4
3515 </td></tr></table>
3516
3517 !! end
3518
3519 !! test
3520 Simple table but with multiple dashes for row wikitext
3521 !! input
3522 {|
3523 | foo
3524 |-----
3525 | bar
3526 |}
3527 !! result
3528 <table>
3529 <tr>
3530 <td> foo
3531 </td></tr>
3532 <tr>
3533 <td> bar
3534 </td></tr></table>
3535
3536 !! end
3537 !! test
3538 Multiplication table
3539 !! input
3540 {| border="1" cellpadding="2"
3541 |+Multiplication table
3542 |-
3543 ! &times; !! 1 !! 2 !! 3
3544 |-
3545 ! 1
3546 | 1 || 2 || 3
3547 |-
3548 ! 2
3549 | 2 || 4 || 6
3550 |-
3551 ! 3
3552 | 3 || 6 || 9
3553 |-
3554 ! 4
3555 | 4 || 8 || 12
3556 |-
3557 ! 5
3558 | 5 || 10 || 15
3559 |}
3560 !! result
3561 <table border="1" cellpadding="2">
3562 <caption>Multiplication table
3563 </caption>
3564 <tr>
3565 <th> &#215; </th>
3566 <th> 1 </th>
3567 <th> 2 </th>
3568 <th> 3
3569 </th></tr>
3570 <tr>
3571 <th> 1
3572 </th>
3573 <td> 1 </td>
3574 <td> 2 </td>
3575 <td> 3
3576 </td></tr>
3577 <tr>
3578 <th> 2
3579 </th>
3580 <td> 2 </td>
3581 <td> 4 </td>
3582 <td> 6
3583 </td></tr>
3584 <tr>
3585 <th> 3
3586 </th>
3587 <td> 3 </td>
3588 <td> 6 </td>
3589 <td> 9
3590 </td></tr>
3591 <tr>
3592 <th> 4
3593 </th>
3594 <td> 4 </td>
3595 <td> 8 </td>
3596 <td> 12
3597 </td></tr>
3598 <tr>
3599 <th> 5
3600 </th>
3601 <td> 5 </td>
3602 <td> 10 </td>
3603 <td> 15
3604 </td></tr></table>
3605
3606 !! end
3607
3608 !! test
3609 Accept "||" in table headings
3610 !! input
3611 {|
3612 !h1 || h2
3613 |}
3614 !! result
3615 <table>
3616 <tr>
3617 <th>h1 </th>
3618 <th> h2
3619 </th></tr></table>
3620
3621 !! end
3622
3623 !! test
3624 Accept "||" in indented table headings
3625 !! input
3626 :{|
3627 !h1 || h2
3628 |}
3629 !! result
3630 <dl><dd><table>
3631 <tr>
3632 <th>h1 </th>
3633 <th> h2
3634 </th></tr></table></dd></dl>
3635
3636 !! end
3637
3638 !! test
3639 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3640 !! input
3641 {|
3642 !| h1
3643 || a
3644 |}
3645 !! result
3646 <table>
3647 <tr>
3648 <th> h1
3649 </th>
3650 <td> a
3651 </td></tr></table>
3652
3653 !! end
3654
3655 !!test
3656 Accept "| !" at start of line in tables (ignore !-attribute)
3657 !!input
3658 {|
3659 |-
3660 | !style="color:red" | bar
3661 |}
3662 !!result
3663 <table>
3664
3665 <tr>
3666 <td> bar
3667 </td></tr></table>
3668
3669 !!end
3670
3671 !!test
3672 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 +/-
3673 !!input
3674 {|
3675 |-
3676 |style='color:red;'|+1
3677 |style='color:blue;'|-1
3678 |-
3679 | 1 || 2 || 3
3680 | 1 ||+2 ||-3
3681 |-
3682 | +1
3683 | -1
3684 |}
3685 !!result
3686 <table>
3687
3688 <tr>
3689 <td style="color:red;">+1
3690 </td>
3691 <td style="color:blue;">-1
3692 </td></tr>
3693 <tr>
3694 <td> 1 </td>
3695 <td> 2 </td>
3696 <td> 3
3697 </td>
3698 <td> 1 </td>
3699 <td>+2 </td>
3700 <td>-3
3701 </td></tr>
3702 <tr>
3703 <td> +1
3704 </td>
3705 <td> -1
3706 </td></tr></table>
3707
3708 !!end
3709
3710 !! test
3711 Table rowspan
3712 !! input
3713 {| border=1
3714 | Cell 1, row 1
3715 |rowspan=2| Cell 2, row 1 (and 2)
3716 | Cell 3, row 1
3717 |-
3718 | Cell 1, row 2
3719 | Cell 3, row 2
3720 |}
3721 !! result
3722 <table border="1">
3723 <tr>
3724 <td> Cell 1, row 1
3725 </td>
3726 <td rowspan="2"> Cell 2, row 1 (and 2)
3727 </td>
3728 <td> Cell 3, row 1
3729 </td></tr>
3730 <tr>
3731 <td> Cell 1, row 2
3732 </td>
3733 <td> Cell 3, row 2
3734 </td></tr></table>
3735
3736 !! end
3737
3738 !! test
3739 Nested table
3740 !! input
3741 {| border=1
3742 | &alpha;
3743 |
3744 {| bgcolor=#ABCDEF border=2
3745 |nested
3746 |-
3747 |table
3748 |}
3749 |the original table again
3750 |}
3751 !! result
3752 <table border="1">
3753 <tr>
3754 <td> &#945;
3755 </td>
3756 <td>
3757 <table bgcolor="#ABCDEF" border="2">
3758 <tr>
3759 <td>nested
3760 </td></tr>
3761 <tr>
3762 <td>table
3763 </td></tr></table>
3764 </td>
3765 <td>the original table again
3766 </td></tr></table>
3767
3768 !! end
3769
3770 !! test
3771 Invalid attributes in table cell (bug 1830)
3772 !! input
3773 {|
3774 |Cell:|broken
3775 |}
3776 !! result
3777 <table>
3778 <tr>
3779 <td>broken
3780 </td></tr></table>
3781
3782 !! end
3783
3784
3785 !! test
3786 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3787 !! input
3788 {|
3789 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3790 !! result
3791 <table>
3792 <tr>
3793 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3794 <td>]" onmouseover="alert(document.cookie)"&gt;test
3795 </td>
3796 </tr>
3797 </table>
3798
3799 !! end
3800
3801
3802 !! test
3803 Indented table markup mixed with indented pre content (proposed in bug 6200)
3804 !! input
3805 <table>
3806 <tr>
3807 <td>
3808 Text that should be rendered preformatted
3809 </td>
3810 </tr>
3811 </table>
3812 !! result
3813 <table>
3814 <tr>
3815 <td>
3816 <pre>Text that should be rendered preformatted
3817 </pre>
3818 </td>
3819 </tr>
3820 </table>
3821
3822 !! end
3823
3824 !! test
3825 Template-generated table cell attributes and cell content
3826 !! input
3827 {|
3828 |{{table_attribs}}
3829 |}
3830 !! result
3831 <table>
3832 <tr>
3833 <td style="color: red"> Foo
3834 </td></tr></table>
3835
3836 !! end
3837
3838 !! test
3839 Table with row followed by newlines and table heading
3840 !! input
3841 {|
3842 |-
3843
3844 ! foo
3845 |}
3846 !! result
3847 <table>
3848
3849
3850 <tr>
3851 <th> foo
3852 </th></tr></table>
3853
3854 !! end
3855
3856 !! test
3857 Table with empty line following the start tag
3858 !! input
3859 {|
3860
3861 |-
3862 | foo
3863 |}
3864 !! result
3865 <table>
3866
3867
3868 <tr>
3869 <td> foo
3870 </td></tr></table>
3871
3872 !! end
3873
3874 # FIXME: Preserve the attribute properly (with an empty string as value) in
3875 # the PHP parser. Parsoid implements the behavior below.
3876 !! test
3877 Table attributes with empty value
3878 !! options
3879 parsoid
3880 !! input
3881 {|
3882 | style=| hello
3883 |}
3884 !! result
3885 <table>
3886 <tbody>
3887 <tr>
3888 <td style=""> hello
3889 </td></tr></tbody></table>
3890
3891 !! end
3892
3893 !! test
3894 Wikitext table with a lot of comments
3895 !! input
3896 {|
3897 <!-- c0 -->
3898 | foo
3899 <!-- c1 -->
3900 |- <!-- c2 -->
3901 <!-- c3 -->
3902 |<!-- c4 -->
3903 <!-- c5 -->
3904 |}
3905 !! result
3906 <table>
3907 <tr>
3908 <td> foo
3909 </td></tr>
3910 <tr>
3911 <td>
3912 </td></tr></table>
3913
3914 !! end
3915
3916 !! test
3917 Wikitext table with double-line table cell
3918 !! input
3919 {|
3920 |a
3921 b
3922 |}
3923 !! result
3924 <table>
3925 <tr>
3926 <td>a
3927 <p>b
3928 </p>
3929 </td></tr></table>
3930
3931 !! end
3932
3933 !! test
3934 Table cell with a single comment
3935 !! input
3936 {|
3937 | <!-- c1 -->
3938 | a
3939 |}
3940 !! result
3941 <table>
3942 <tr>
3943 <td>
3944 </td>
3945 <td> a
3946 </td></tr></table>
3947
3948 !! end
3949
3950 # The expected HTML structure in this test is debatable. The PHP parser does
3951 # not parse this kind of table at all. The main focus for Parsoid is on
3952 # round-tripping, so this output is ok for now. TODO: revisit!
3953 !! test
3954 Wikitext table with html-syntax row (Parsoid)
3955 !! options
3956 parsoid
3957 !! input
3958 {|
3959 |-
3960 <td>foo</td>
3961 |}
3962 !! result
3963 <table>
3964 <tbody>
3965 <tr>
3966 <td>foo</td></tr></tbody></table>
3967 !! end
3968
3969 !! test
3970 Implicit <td> after a |-
3971 (PHP parser relies on Tidy to add the missing <td> tags)
3972 !! options
3973 parsoid=wt2html,wt2wt
3974 !! input
3975 {|
3976 |-
3977 a
3978 |}
3979 !! result
3980 <table>
3981 <tr><td>a</td></tr>
3982 </table>
3983 !! end
3984
3985 !! test
3986 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
3987 (PHP parser relies on Tidy to add the missing <td> tags)
3988 !! options
3989 parsoid=wt2html,wt2wt
3990 !! input
3991 {|
3992 |-
3993 |
3994 a
3995 |-
3996 b
3997 |}
3998 !! result
3999 <table>
4000 <tbody>
4001 <tr><td><pre>a</pre></td></tr>
4002 <tr><td> b</td></tr>
4003 </tbody>
4004 </table>
4005 !! end
4006
4007 !! test
4008 Lists should be recognized in an implicit <td> context
4009 (PHP parser relies on Tidy to add the missing <td> tags)
4010 !! options
4011 parsoid=wt2html,wt2wt
4012 !! input
4013 {|
4014 |-
4015 *a
4016 |}
4017 !! result
4018 <table>
4019 <tr>
4020 <td><ul><li>a</li></ul></td>
4021 </tr>
4022 </table>
4023 !! end
4024
4025 ###
4026 ### Internal links
4027 ###
4028 !! test
4029 Plain link, capitalized
4030 !! input
4031 [[Main Page]]
4032 !! result
4033 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4034 </p>
4035 !! end
4036
4037 !! test
4038 Plain link, uncapitalized
4039 !! input
4040 [[main Page]]
4041 !! result
4042 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4043 </p>
4044 !! end
4045
4046 !! test
4047 Piped link
4048 !! input
4049 [[Main Page|The Main Page]]
4050 !! result
4051 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4052 </p>
4053 !! end
4054
4055 !! test
4056 Piped link with comment in link text
4057 !! input
4058 [[Main Page|The Main<!--front--> Page]]
4059 !! result
4060 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4061 </p>
4062 !! end
4063
4064 !! test
4065 Broken link
4066 !! input
4067 [[Zigzagzogzagzig]]
4068 !! result
4069 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4070 </p>
4071 !! end
4072
4073 !! test
4074 Broken link with fragment
4075 !! input
4076 [[Zigzagzogzagzig#zug]]
4077 !! result
4078 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4079 </p>
4080 !! end
4081
4082 !! test
4083 Special page link with fragment
4084 !! input
4085 [[Special:Version#anchor]]
4086 !! result
4087 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4088 </p>
4089 !! end
4090
4091 !! test
4092 Nonexistent special page link with fragment
4093 !! input
4094 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4095 !! result
4096 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4097 </p>
4098 !! end
4099
4100 !! test
4101 Link with prefix
4102 !! input
4103 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4104 !! result
4105 <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>
4106 </p>
4107 !! end
4108
4109 !! test
4110 Link with suffix
4111 !! input
4112 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4113 !! result
4114 <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>!!!
4115 </p>
4116 !! end
4117
4118 !! article
4119 prefixed article
4120 !! text
4121 Some text
4122 !! endarticle
4123
4124 !! test
4125 Bug 43661: Piped links with identical prefixes
4126 !! input
4127 [[prefixed article|prefixed articles with spaces]]
4128
4129 [[prefixed article|prefixed articlesaoeu]]
4130
4131 [[Main Page|Main Page test]]
4132 !! result
4133 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4134 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4135 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4136 </p>
4137 !! end
4138
4139
4140 !! test
4141 Link with HTML entity in suffix / tail
4142 !! input
4143 [[Main Page]]&quot;, [[Main Page]]&#97;
4144 !! result
4145 <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;
4146 </p>
4147 !! end
4148
4149 !! test
4150 Link with 3 brackets
4151 !! input
4152 [[[main page]]]
4153 !! result
4154 <p>[[[main page]]]
4155 </p>
4156 !! end
4157
4158 !! test
4159 Piped link with 3 brackets
4160 !! input
4161 [[[main page|the main page]]]
4162 !! result
4163 <p>[[[main page|the main page]]]
4164 </p>
4165 !! end
4166
4167 !! test
4168 Link with multiple pipes
4169 !! input
4170 [[Main Page|The|Main|Page]]
4171 !! result
4172 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4173 </p>
4174 !! end
4175
4176 !! test
4177 Link to namespaces
4178 !! input
4179 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4180 !! result
4181 <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>
4182 </p>
4183 !! end
4184
4185 !! test
4186 Piped link to namespace
4187 !! input
4188 [[Meta:Disclaimers|The disclaimers]]
4189 !! result
4190 <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>
4191 </p>
4192 !! end
4193
4194 !! test
4195 Link containing }
4196 !! input
4197 [[Usually caused by a typo (oops}]]
4198 !! result
4199 <p>[[Usually caused by a typo (oops}]]
4200 </p>
4201 !! end
4202
4203 !! test
4204 Link containing % (not as a hex sequence)
4205 !! input
4206 [[7% Solution]]
4207 !! result
4208 <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>
4209 </p>
4210 !! end
4211
4212 !! test
4213 Link containing % as a single hex sequence interpreted to char
4214 !! input
4215 [[7%25 Solution]]
4216 !! result
4217 <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>
4218 </p>
4219 !!end
4220
4221 !! test
4222 Link containing % as a double hex sequence interpreted to hex sequence
4223 !! input
4224 [[7%2525 Solution]]
4225 !! result
4226 <p>[[7%2525 Solution]]
4227 </p>
4228 !!end
4229
4230 !! test
4231 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4232 Example for such a section: == < ==
4233 !! input
4234 [[%23%3c]][[%23%3e]]
4235 !! result
4236 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4237 </p>
4238 !! end
4239
4240 !! test
4241 Link containing "<#" and ">#" as a hex sequences
4242 !! input
4243 [[%3c%23]][[%3e%23]]
4244 !! result
4245 <p>[[%3c%23]][[%3e%23]]
4246 </p>
4247 !! end
4248
4249 !! test
4250 Link containing an equals sign
4251 !! input
4252 [[Special:BookSources/isbn=4-00-026157-6]]
4253 !! result
4254 <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>
4255 </p>
4256 !! end
4257
4258 !! article
4259 Foo~bar
4260 !! text
4261 Just a test of an article title containing a tilde.
4262 !! endarticle
4263
4264 # note that links containing signatures, like [[Foo~~~~]], are
4265 # massaged by the pre-save transform (PST) and so the tildes are never
4266 # seen by the parser.
4267 !! test
4268 Link containing a tilde
4269 !! input
4270 [[Foo~bar]]
4271 !! result
4272 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4273 </p>
4274 !! end
4275
4276 !! test
4277 Link containing double-single-quotes '' (bug 4598)
4278 !! input
4279 [[Lista d''e paise d''o munno]]
4280 !! result
4281 <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>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4287 !! input
4288 Some [[Link|pretty ''italics'' and stuff]]!
4289 !! result
4290 <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>!
4291 </p>
4292 !! end
4293
4294 !! test
4295 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4296 !! input
4297 ''Some [[Link|pretty ''italics'' and stuff]]!
4298 !! result
4299 <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>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Link with double quotes in title part (literal) and alternate part (interpreted)
4305 !! input
4306 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4307
4308 [[''Pentecoste'']]
4309
4310 [[''Pentecoste''|Pentecoste]]
4311
4312 [[''Pentecoste''|''Pentecoste'']]
4313 !! result
4314 <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>
4315 </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>
4316 </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>
4317 </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>
4318 </p>
4319 !! end
4320
4321 !! test
4322 Broken image links with HTML captions (bug 39700)
4323 !! input
4324 [[File:Nonexistent|<script></script>]]
4325 [[File:Nonexistent|100px|<script></script>]]
4326 [[File:Nonexistent|&lt;]]
4327 [[File:Nonexistent|a<i>b</i>c]]
4328 !! result
4329 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4330 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4331 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4332 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Plain link to URL
4338 !! input
4339 [[http://www.example.com]]
4340 !! result
4341 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4342 </p>
4343 !! end
4344
4345 !! test
4346 Plain link to URL with link text
4347 !! input
4348 [[http://www.example.com Link text]]
4349 !! result
4350 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4351 </p>
4352 !! end
4353
4354 !! test
4355 Plain link to protocol-relative URL
4356 !! input
4357 [[//www.example.com]]
4358 !! result
4359 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4360 </p>
4361 !! end
4362
4363 !! test
4364 Plain link to protocol-relative URL with link text
4365 !! input
4366 [[//www.example.com Link text]]
4367 !! result
4368 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4369 </p>
4370 !! end
4371
4372 !! test
4373 Plain link to page with question mark in title
4374 !! input
4375 [[A?b]]
4376
4377 [[A?b|Baz]]
4378 !! result
4379 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4380 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4381 </p>
4382 !! end
4383
4384
4385 # I'm fairly sure the expected result here is wrong.
4386 # We want these to be URL links, not pseudo-pages with URLs for titles....
4387 # However the current output is also pretty screwy.
4388 #
4389 # ----
4390 # I'm changing it to match the current output--it arguably makes more
4391 # sense in the light of the test above. Old expected result was:
4392 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4393 #</p>
4394 # But I think this test is bordering on "garbage in, garbage out" anyway.
4395 # -- wtm
4396 !! test
4397 Piped link to URL
4398 !! input
4399 Piped link to URL: [[http://www.example.com|an example URL]]
4400 !! result
4401 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4402 </p>
4403 !! end
4404
4405 !! test
4406 BUG 2: [[page|http://url/]] should link to page, not http://url/
4407 !! input
4408 [[Main Page|http://url/]]
4409 !! result
4410 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4411 </p>
4412 !! end
4413
4414 !! test
4415 BUG 337: Escaped self-links should be bold
4416 !! options
4417 title=[[Bug462]]
4418 !! input
4419 [[Bu&#103;462]] [[Bug462]]
4420 !! result
4421 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4422 </p>
4423 !! end
4424
4425 !! test
4426 Self-link to section should not be bold
4427 !! options
4428 title=[[Main Page]]
4429 !! input
4430 [[Main Page#section]]
4431 !! result
4432 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4433 </p>
4434 !! end
4435
4436 !! article
4437 00
4438 !! text
4439 This is 00.
4440 !! endarticle
4441
4442 !!test
4443 Self-link to numeric title
4444 !!options
4445 title=[[0]]
4446 !!input
4447 [[0]]
4448 !!result
4449 <p><strong class="selflink">0</strong>
4450 </p>
4451 !!end
4452
4453 !!test
4454 Link to numeric-equivalent title
4455 !!options
4456 title=[[0]]
4457 !!input
4458 [[00]]
4459 !!result
4460 <p><a href="/wiki/00" title="00">00</a>
4461 </p>
4462 !!end
4463
4464 !! test
4465 <nowiki> inside a link
4466 !! input
4467 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4468 !! result
4469 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4470 </p>
4471 !! end
4472
4473 !! test
4474 Non-breaking spaces in title
4475 !! input
4476 [[&nbsp; Main &nbsp; Page &nbsp;]]
4477 !! result
4478 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4484 !! options
4485 language=ca
4486 !! input
4487 '''[[Main Page]]'''
4488 !! result
4489 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4490 </p>
4491 !! end
4492
4493 !! test
4494 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4495 !! options
4496 language=ca
4497 !! input
4498 ''[[Main Page]]''
4499 !! result
4500 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4501 </p>
4502 !! end
4503
4504 !! test
4505 Internal link with en linktrail: no apostrophes (bug 27473)
4506 !! options
4507 language=en
4508 !! input
4509 [[Something]]'nice
4510 !! result
4511 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4512 </p>
4513 !! end
4514
4515 !! test
4516 Internal link with ca linktrail with apostrophes (bug 27473)
4517 !! options
4518 language=ca
4519 !! input
4520 [[Something]]'nice
4521 !! result
4522 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4523 </p>
4524 !! end
4525
4526 !! test
4527 Internal link with kaa linktrail with apostrophes (bug 27473)
4528 !! options
4529 language=kaa
4530 !! input
4531 [[Something]]'nice
4532 !! result
4533 <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>
4534 </p>
4535 !! end
4536
4537 !! article
4538 Söfnuður
4539 !! text
4540 Test.
4541 !! endarticle
4542
4543 !! test
4544 Internal link with is link prefix
4545 !! options
4546 language=is
4547 !! input
4548 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4549 !! result
4550 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4551 </p>
4552 !! end
4553
4554 !! article
4555 Mótmælendatrú
4556 !! text
4557 Test.
4558 !! endarticle
4559
4560 !! test
4561 Internal link with is link trail and link prefix
4562 !! options
4563 language=is
4564 !! input
4565 [[mótmælendatrú|xxx]]ar
4566 [[mótmælendatrú]]ar
4567 mótmælenda[[söfnuður]]
4568 mótmælenda[[söfnuður|söfnuðir]]
4569 mótmælenda[[söfnuður|söfnuðir]]xxx
4570 !! result
4571 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4572 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4573 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4574 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4575 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4576 </p>
4577 !! end
4578
4579 !! test
4580 Parsoid link trail escaping
4581 !! options
4582 parsoid=html2wt,html2html
4583 !! input
4584 [[apple]]<nowiki/>s
4585 !! result
4586 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4587 !! end
4588
4589 !! test
4590 Parsoid link prefix escaping
4591 !! options
4592 language=is
4593 parsoid=html2wt,html2html
4594 !! input
4595 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4596 !! result
4597 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4598 !! end
4599
4600 !! test
4601 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4602 !! input
4603 [[Foo| bar]]
4604
4605 [[Foo| ''bar'']]
4606
4607 [http://wp.org foo]
4608
4609 [http://wp.org ''foo'']
4610 !! result
4611 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4612 </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>
4613 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4614 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4615 </p>
4616 !! end
4617
4618 ###
4619 ### Interwiki links (see maintenance/interwiki.sql)
4620 ###
4621
4622 !! test
4623 Inline interwiki link
4624 !! input
4625 [[MeatBall:SoftSecurity]]
4626 !! result
4627 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4628 </p>
4629 !! end
4630
4631 !! test
4632 Inline interwiki link with empty title (bug 2372)
4633 !! input
4634 [[MeatBall:]]
4635 !! result
4636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4637 </p>
4638 !! end
4639
4640 !! test
4641 Interwiki link encoding conversion (bug 1636)
4642 !! input
4643 *[[Wikipedia:ro:Olteni&#0355;a]]
4644 *[[Wikipedia:ro:Olteni&#355;a]]
4645 !! result
4646 <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>
4647 </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>
4648 </li></ul>
4649
4650 !! end
4651
4652 !! test
4653 Interwiki link with fragment (bug 2130)
4654 !! input
4655 [[MeatBall:SoftSecurity#foo]]
4656 !! result
4657 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4658 </p>
4659 !! end
4660
4661 !! test
4662 Interlanguage link
4663 !! input
4664 Blah blah blah
4665 [[zh:Chinese]]
4666 !!result
4667 <p>Blah blah blah
4668 </p>
4669 !! end
4670
4671 !! test
4672 Double interlanguage link
4673 !! input
4674 Blah blah blah
4675 [[es:Spanish]]
4676 [[zh:Chinese]]
4677 !!result
4678 <p>Blah blah blah
4679 </p>
4680 !! end
4681
4682 !! test
4683 Interlanguage link, with prefix links
4684 !! options
4685 language=ln
4686 !! input
4687 Blah blah blah
4688 [[zh:Chinese]]
4689 !!result
4690 <p>Blah blah blah
4691 </p>
4692 !! end
4693
4694 !! test
4695 Double interlanguage link, with prefix links (bug 8897)
4696 !! options
4697 language=ln
4698 !! input
4699 Blah blah blah
4700 [[es:Spanish]]
4701 [[zh:Chinese]]
4702 !!result
4703 <p>Blah blah blah
4704 </p>
4705 !! end
4706
4707 !! test
4708 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4709 !! options
4710 language=ln
4711 !! input
4712 [[WW&nbsp;II]]
4713 !!result
4714 <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>
4715 </p>
4716 !! end
4717
4718 !! test
4719 Parsoid: handle constructor well
4720 !! options
4721 parsoid
4722 !! input
4723 [[constructor]]
4724
4725 [[constructor:foo]]
4726 !! result
4727 <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>
4728
4729
4730 <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>
4731 !! end
4732
4733 ##
4734 ## Redirects, Parsoid-only
4735 ##
4736 !! test
4737 Simple redirect to page
4738 !! options
4739 parsoid
4740 !! input
4741 #REDIRECT [[Main Page]]
4742 !! result
4743 <link rel="mw:PageProp/redirect" href="./Main_Page">
4744 !! end
4745
4746 !! test
4747 Redirect to category
4748 !! options
4749 parsoid=wt2html
4750 !! input
4751 #REDIRECT [[Category:Foo]]
4752 !! result
4753 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4754 !! end
4755
4756 !! test
4757 Redirect to category page
4758 !! options
4759 parsoid=wt2html,html2html
4760 !! input
4761 #REDIRECT [[:Category:Foo]]
4762 !! result
4763 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4764 !! end
4765
4766 !! test
4767 Redirect to image page
4768 !! options
4769 parsoid
4770 !! input
4771 #REDIRECT [[File:Wiki.png]]
4772 !! result
4773 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4774 !! end
4775
4776 !! test
4777 Redirect to language
4778 !! options
4779 parsoid
4780 !! input
4781 #REDIRECT [[en:File:Wiki.png]]
4782 !! result
4783 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4784 !! end
4785
4786 !! test
4787 Redirect to interwiki
4788 !! options
4789 parsoid
4790 !! input
4791 #REDIRECT [[meatball:File:Wiki.png]]
4792 !! result
4793 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4794 !! end
4795
4796 ##
4797 ## XHTML tidiness
4798 ###
4799
4800 !! test
4801 <br> to <br />
4802 !! input
4803 1<br>2<br />3
4804 !! result
4805 <p>1<br />2<br />3
4806 </p>
4807 !! end
4808
4809 !! test
4810 Broken br tag sanitization
4811 !! input
4812 </br>
4813 !! result
4814 <p>&lt;/br&gt;
4815 </p>
4816 !! end
4817
4818 !! test
4819 Incorrecly removing closing slashes from correctly formed XHTML
4820 !! input
4821 <br style="clear:both;" />
4822 !! result
4823 <p><br style="clear:both;" />
4824 </p>
4825 !! end
4826
4827 !! test
4828 Failing to transform badly formed HTML into correct XHTML
4829 !! input
4830 <br style="clear: left;">
4831 <br style="clear: right;">
4832 <br style="clear: both;">
4833 !! result
4834 <p><br style="clear: left;" />
4835 <br style="clear: right;" />
4836 <br style="clear: both;" />
4837 </p>
4838 !!end
4839
4840 !! test
4841 Handling html with a div self-closing tag
4842 !! input
4843 <div title />
4844 <div title/>
4845 <div title/ >
4846 <div title=bar />
4847 <div title=bar/>
4848 <div title=bar/ >
4849 !! result
4850 <p>&lt;div title /&gt;
4851 &lt;div title/&gt;
4852 </p>
4853 <div>
4854 <p>&lt;div title=bar /&gt;
4855 &lt;div title=bar/&gt;
4856 </p>
4857 <div title="bar/"></div>
4858 </div>
4859
4860 !! end
4861
4862 !! test
4863 Handling html with a br self-closing tag
4864 !! input
4865 <br title />
4866 <br title/>
4867 <br title/ >
4868 <br title=bar />
4869 <br title=bar/>
4870 <br title=bar/ >
4871 !! result
4872 <p><br title="title" />
4873 <br title="title" />
4874 <br />
4875 <br title="bar" />
4876 <br title="bar" />
4877 <br title="bar/" />
4878 </p>
4879 !! end
4880
4881 !! test
4882 Horizontal ruler (should it add that extra space?)
4883 !! input
4884 <hr>
4885 <hr >
4886 foo <hr
4887 > bar
4888 !! result
4889 <hr />
4890 <hr />
4891 foo <hr /> bar
4892
4893 !! end
4894
4895 !! test
4896 Horizontal ruler -- 4+ dashes render hr
4897 !! input
4898 ----
4899 !! result
4900 <hr />
4901
4902 !! end
4903
4904 !! test
4905 Horizontal ruler -- eats additional dashes on the same line
4906 !! input
4907 ---------
4908 !! result
4909 <hr />
4910
4911 !! end
4912
4913 !! test
4914 Horizontal ruler -- does not collapse dashes on consecutive lines
4915 !! input
4916 ----
4917 ----
4918 !! result
4919 <hr />
4920 <hr />
4921
4922 !! end
4923
4924 !! test
4925 Horizontal ruler -- <4 dashes render as plain text
4926 !! input
4927 ---
4928 !! result
4929 <p>---
4930 </p>
4931 !! end
4932
4933 !! test
4934 Horizontal ruler -- Supports content following dashes on same line
4935 !! input
4936 ---- Foo
4937 !! result
4938 <hr /> Foo
4939
4940 !! end
4941
4942 ###
4943 ### Block-level elements
4944 ###
4945 !! test
4946 Common list
4947 !! input
4948 *Common list
4949 * item 2
4950 *item 3
4951 !! result
4952 <ul><li>Common list
4953 </li><li> item 2
4954 </li><li>item 3
4955 </li></ul>
4956
4957 !! end
4958
4959 !! test
4960 Numbered list
4961 !! input
4962 #Numbered list
4963 #item 2
4964 # item 3
4965 !! result
4966 <ol><li>Numbered list
4967 </li><li>item 2
4968 </li><li> item 3
4969 </li></ol>
4970
4971 !! end
4972
4973 !! test
4974 Mixed list
4975 !! input
4976 *Mixed list
4977 *# with numbers
4978 ** and bullets
4979 *# and numbers
4980 *bullets again
4981 **bullet level 2
4982 ***bullet level 3
4983 ***#Number on level 4
4984 **bullet level 2
4985 **#Number on level 3
4986 **#Number on level 3
4987 *#number level 2
4988 *Level 1
4989 *** Level 3
4990 #** Level 3, but ordered
4991 !! result
4992 <ul><li>Mixed list
4993 <ol><li> with numbers
4994 </li></ol>
4995 <ul><li> and bullets
4996 </li></ul>
4997 <ol><li> and numbers
4998 </li></ol>
4999 </li><li>bullets again
5000 <ul><li>bullet level 2
5001 <ul><li>bullet level 3
5002 <ol><li>Number on level 4
5003 </li></ol>
5004 </li></ul>
5005 </li><li>bullet level 2
5006 <ol><li>Number on level 3
5007 </li><li>Number on level 3
5008 </li></ol>
5009 </li></ul>
5010 <ol><li>number level 2
5011 </li></ol>
5012 </li><li>Level 1
5013 <ul><li><ul><li> Level 3
5014 </li></ul>
5015 </li></ul>
5016 </li></ul>
5017 <ol><li><ul><li><ul><li> Level 3, but ordered
5018 </li></ul>
5019 </li></ul>
5020 </li></ol>
5021
5022 !! end
5023
5024 !! test
5025 Nested lists 1
5026 !! input
5027 *foo
5028 **bar
5029 !! result
5030 <ul><li>foo
5031 <ul><li>bar
5032 </li></ul>
5033 </li></ul>
5034
5035 !! end
5036
5037 !! test
5038 Nested lists 2
5039 !! input
5040 **foo
5041 *bar
5042 !! result
5043 <ul><li><ul><li>foo
5044 </li></ul>
5045 </li><li>bar
5046 </li></ul>
5047
5048 !! end
5049
5050 !! test
5051 Nested lists 3 (first element empty)
5052 !! input
5053 *
5054 **bar
5055 !! result
5056 <ul><li>
5057 <ul><li>bar
5058 </li></ul>
5059 </li></ul>
5060
5061 !! end
5062
5063 !! test
5064 Nested lists 4 (first element empty)
5065 !! input
5066 **
5067 *bar
5068 !! result
5069 <ul><li><ul><li>
5070 </li></ul>
5071 </li><li>bar
5072 </li></ul>
5073
5074 !! end
5075
5076 !! test
5077 Nested lists 5 (both elements empty)
5078 !! input
5079 **
5080 *
5081 !! result
5082 <ul><li><ul><li>
5083 </li></ul>
5084 </li><li>
5085 </li></ul>
5086
5087 !! end
5088
5089 !! test
5090 Nested lists 6 (both elements empty)
5091 !! input
5092 *
5093 **
5094 !! result
5095 <ul><li>
5096 <ul><li>
5097 </li></ul>
5098 </li></ul>
5099
5100 !! end
5101
5102 !! test
5103 Nested lists 7 (skip initial nesting levels)
5104 !! input
5105 *** foo
5106 !! result
5107 <ul><li><ul><li><ul><li> foo
5108 </li></ul>
5109 </li></ul>
5110 </li></ul>
5111
5112 !! end
5113
5114 !! test
5115 Nested lists 8 (multiple nesting transitions)
5116 !! input
5117 * foo
5118 *** bar
5119 ** baz
5120 * boo
5121 !! result
5122 <ul><li> foo
5123 <ul><li><ul><li> bar
5124 </li></ul>
5125 </li><li> baz
5126 </li></ul>
5127 </li><li> boo
5128 </li></ul>
5129
5130 !! end
5131
5132 !! test
5133 1. Lists with start-of-line-transparent tokens before bullets: Comments
5134 !! input
5135 *foo
5136 *<!--cmt-->bar
5137 <!--cmt-->*baz
5138 !! result
5139 <ul><li>foo
5140 </li><li>bar
5141 </li><li>baz
5142 </li></ul>
5143
5144 !! end
5145
5146 !! test
5147 2. Lists with start-of-line-transparent tokens before bullets: Template close
5148 !! input
5149 *foo {{echo|bar
5150 }}*baz
5151 !! result
5152 <ul><li>foo bar
5153 </li><li>baz
5154 </li></ul>
5155
5156 !! end
5157
5158 !! test
5159 Unbalanced closing block tags break a list
5160 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5161 !! options
5162 parsoid
5163 !! input
5164 <div>
5165 *a</div><div>
5166 *b</div>
5167 !! result
5168 <div>
5169 <ul><li>a
5170 </li></ul></div><div>
5171 <ul><li>b
5172 </li></ul></div>
5173 !! end
5174
5175 !! test
5176 Unbalanced closing non-block tags don't break a list
5177 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5178 !! options
5179 parsoid
5180 !! input
5181 <span>
5182 *a</span><span>
5183 *b</span>
5184 !! result
5185 <p><span></span>
5186 </p>
5187 <ul><li>a<span></span>
5188 </li><li>b
5189 </li></ul>
5190 !! end
5191
5192 !! test
5193 Unclosed formatting tags that straddle lists are closed and reopened
5194 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5195 !! options
5196 parsoid
5197 !! input
5198 # <s> a
5199 # b </s>
5200 !! result
5201 <ol><li> <s> a </s>
5202 </li><li> <s> b </s>
5203 </li></ol>
5204 !! end
5205
5206 !!test
5207 List embedded in a non-block tag
5208 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5209 !! options
5210 parsoid
5211 !!input
5212 <small>
5213 * foo
5214 </small>
5215 !!result
5216 <p><small></small></p>
5217 <small>
5218 <ul>
5219 <li> foo</li>
5220 </ul>
5221 </small>
5222 <p><small></small></p>
5223 !!end
5224
5225 !! test
5226 List items are not parsed correctly following a <pre> block (bug 785)
5227 !! input
5228 * <pre>foo</pre>
5229 * <pre>bar</pre>
5230 * zar
5231 !! result
5232 <ul><li> <pre>foo</pre>
5233 </li><li> <pre>bar</pre>
5234 </li><li> zar
5235 </li></ul>
5236
5237 !! end
5238
5239 !! test
5240 List items from template
5241 !! input
5242
5243 {{inner list}}
5244 * item 2
5245
5246 * item 0
5247 {{inner list}}
5248 * item 2
5249
5250 * item 0
5251 * notSOL{{inner list}}
5252 * item 2
5253 !! result
5254 <ul><li> item 1
5255 </li><li> item 2
5256 </li></ul>
5257 <ul><li> item 0
5258 </li><li> item 1
5259 </li><li> item 2
5260 </li></ul>
5261 <ul><li> item 0
5262 </li><li> notSOL
5263 </li><li> item 1
5264 </li><li> item 2
5265 </li></ul>
5266
5267 !! end
5268
5269 !! test
5270 List interrupted by empty line or heading
5271 !! input
5272 * foo
5273
5274 ** bar
5275 == A heading ==
5276 * Another list item
5277 !! result
5278 <ul><li> foo
5279 </li></ul>
5280 <ul><li><ul><li> bar
5281 </li></ul>
5282 </li></ul>
5283 <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>
5284 <ul><li> Another list item
5285 </li></ul>
5286
5287 !!end
5288
5289 !!test
5290 Multiple list tags generated by templates
5291 !!input
5292 {{echo|<li>}}a
5293 {{echo|<li>}}b
5294 {{echo|<li>}}c
5295 !!result
5296 <li>a
5297 <li>b
5298 <li>c</li>
5299 </li>
5300 </li>
5301
5302 !!end
5303
5304 !!test
5305 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5306 !!input
5307 *a
5308 <!--This line will NOT split the list-->
5309 *b
5310 <!--This line will NOT split the list either-->
5311 *c
5312 <!--foo--> <!--This line with more than 1 comment will split the list-->
5313 *d
5314 !!result
5315 <ul><li>a
5316 </li><li>b
5317 </li><li>c
5318 </li></ul>
5319 <ul><li>d
5320 </li></ul>
5321
5322 !!end
5323
5324 !!test
5325 Test the li-hack
5326 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5327 !!options
5328 parsoid=wt2html,wt2wt
5329 !!input
5330 * foo
5331 * <li>li-hack
5332 * {{echo|<li>templated li-hack}}
5333 * <!--foo--> <li> unsupported li-hack with preceding comments
5334
5335 <ul>
5336 <li><li>not a li-hack
5337 </li>
5338 </ul>
5339 !!result
5340 <ul><li> foo</li>
5341 <li>li-hack</li>
5342 <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>
5343 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5344
5345 <ul>
5346 <li></li><li>not a li-hack
5347 </li>
5348 </ul>
5349 !!end
5350
5351 !! test
5352 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5353 !! options
5354 parsoid
5355 !! input
5356 # foo
5357 ## bar
5358 * foo
5359 ** bar
5360 : foo
5361 :: bar
5362 !! result
5363 <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>
5364 !! end
5365
5366
5367 ###
5368 ### Magic Words
5369 ###
5370
5371 !! test
5372 Magic Word: {{CURRENTDAY}}
5373 !! input
5374 {{CURRENTDAY}}
5375 !! result
5376 <p>1
5377 </p>
5378 !! end
5379
5380 !! test
5381 Magic Word: {{CURRENTDAY2}}
5382 !! input
5383 {{CURRENTDAY2}}
5384 !! result
5385 <p>01
5386 </p>
5387 !! end
5388
5389 !! test
5390 Magic Word: {{CURRENTDAYNAME}}
5391 !! input
5392 {{CURRENTDAYNAME}}
5393 !! result
5394 <p>Thursday
5395 </p>
5396 !! end
5397
5398 !! test
5399 Magic Word: {{CURRENTDOW}}
5400 !! input
5401 {{CURRENTDOW}}
5402 !! result
5403 <p>4
5404 </p>
5405 !! end
5406
5407 !! test
5408 Magic Word: {{CURRENTMONTH}}
5409 !! input
5410 {{CURRENTMONTH}}
5411 !! result
5412 <p>01
5413 </p>
5414 !! end
5415
5416 !! test
5417 Magic Word: {{CURRENTMONTHABBREV}}
5418 !! input
5419 {{CURRENTMONTHABBREV}}
5420 !! result
5421 <p>Jan
5422 </p>
5423 !! end
5424
5425 !! test
5426 Magic Word: {{CURRENTMONTHNAME}}
5427 !! input
5428 {{CURRENTMONTHNAME}}
5429 !! result
5430 <p>January
5431 </p>
5432 !! end
5433
5434 !! test
5435 Magic Word: {{CURRENTMONTHNAMEGEN}}
5436 !! input
5437 {{CURRENTMONTHNAMEGEN}}
5438 !! result
5439 <p>January
5440 </p>
5441 !! end
5442
5443 !! test
5444 Magic Word: {{CURRENTTIME}}
5445 !! input
5446 {{CURRENTTIME}}
5447 !! result
5448 <p>00:02
5449 </p>
5450 !! end
5451
5452 !! test
5453 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5454 !! input
5455 {{CURRENTWEEK}}
5456 !! result
5457 <p>1
5458 </p>
5459 !! end
5460
5461 !! test
5462 Magic Word: {{CURRENTYEAR}}
5463 !! input
5464 {{CURRENTYEAR}}
5465 !! result
5466 <p>1970
5467 </p>
5468 !! end
5469
5470 !! test
5471 Magic Word: {{FULLPAGENAME}}
5472 !! options
5473 title=[[User:Ævar Arnfjörð Bjarmason]]
5474 !! input
5475 {{FULLPAGENAME}}
5476 !! result
5477 <p>User:Ævar Arnfjörð Bjarmason
5478 </p>
5479 !! end
5480
5481 !! test
5482 Magic Word: {{FULLPAGENAMEE}}
5483 !! options
5484 title=[[User:Ævar Arnfjörð Bjarmason]]
5485 !! input
5486 {{FULLPAGENAMEE}}
5487 !! result
5488 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5489 </p>
5490 !! end
5491
5492 !! test
5493 Magic Word: {{NAMESPACE}}
5494 !! options
5495 title=[[User:Ævar Arnfjörð Bjarmason]]
5496 !! input
5497 {{NAMESPACE}}
5498 !! result
5499 <p>User
5500 </p>
5501 !! end
5502
5503 !! test
5504 Magic Word: {{NAMESPACEE}}
5505 !! options
5506 title=[[User:Ævar Arnfjörð Bjarmason]]
5507 !! input
5508 {{NAMESPACEE}}
5509 !! result
5510 <p>User
5511 </p>
5512 !! end
5513
5514 !! test
5515 Magic Word: {{NAMESPACENUMBER}}
5516 !! options
5517 title=[[User:Ævar Arnfjörð Bjarmason]]
5518 !! input
5519 {{NAMESPACENUMBER}}
5520 !! result
5521 <p>2
5522 </p>
5523 !! end
5524
5525 !! test
5526 Magic Word: {{NUMBEROFFILES}}
5527 !! input
5528 {{NUMBEROFFILES}}
5529 !! result
5530 <p>4
5531 </p>
5532 !! end
5533
5534 !! test
5535 Magic Word: {{PAGENAME}}
5536 !! options
5537 title=[[User:Ævar Arnfjörð Bjarmason]]
5538 !! input
5539 {{PAGENAME}}
5540 !! result
5541 <p>Ævar Arnfjörð Bjarmason
5542 </p>
5543 !! end
5544
5545 !! test
5546 Magic Word: {{PAGENAME}} with metacharacters
5547 !! options
5548 title=[['foo & bar = baz']]
5549 !! input
5550 ''{{PAGENAME}}''
5551 !! result
5552 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5553 </p>
5554 !! end
5555
5556 !! test
5557 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5558 !! options
5559 title=[[*RFC 1234 http://example.com/]]
5560 !! input
5561 {{PAGENAME}}
5562 !! result
5563 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5564 </p>
5565 !! end
5566
5567 !! test
5568 Magic Word: {{PAGENAMEE}}
5569 !! options
5570 title=[[User:Ævar Arnfjörð Bjarmason]]
5571 !! input
5572 {{PAGENAMEE}}
5573 !! result
5574 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5575 </p>
5576 !! end
5577
5578 !! test
5579 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5580 !! options
5581 title=[[*RFC 1234 http://example.com/]]
5582 !! input
5583 {{PAGENAMEE}}
5584 !! result
5585 <p>&#42;RFC_1234_http&#58;//example.com/
5586 </p>
5587 !! end
5588
5589 !! test
5590 Magic Word: {{REVISIONID}}
5591 !! input
5592 {{REVISIONID}}
5593 !! result
5594 <p>1337
5595 </p>
5596 !! end
5597
5598 !! test
5599 Magic Word: {{SCRIPTPATH}}
5600 !! input
5601 {{SCRIPTPATH}}
5602 !! result
5603 <p>/
5604 </p>
5605 !! end
5606
5607 !! test
5608 Magic Word: {{SERVER}}
5609 !! input
5610 {{SERVER}}
5611 !! result
5612 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5613 </p>
5614 !! end
5615
5616 !! test
5617 Magic Word: {{SERVERNAME}}
5618 !! input
5619 {{SERVERNAME}}
5620 !! result
5621 <p>example.org
5622 </p>
5623 !! end
5624
5625 !! test
5626 Magic Word: {{SITENAME}}
5627 !! input
5628 {{SITENAME}}
5629 !! result
5630 <p>MediaWiki
5631 </p>
5632 !! end
5633
5634 !! test
5635 Case-sensitive magic words, when cased differently, should just be template transclusions
5636 !! input
5637 {{CurrentMonth}}
5638 {{currentday}}
5639 {{cURreNTweEK}}
5640 {{currentHour}}
5641 !! result
5642 <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>
5643 <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>
5644 <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>
5645 <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>
5646 </p>
5647 !! end
5648
5649 !! test
5650 Case-insensitive magic words should still work with weird casing.
5651 !! input
5652 {{sErVeRNaMe}}
5653 {{LCFirst:AOEU}}
5654 {{ucFIRST:aoeu}}
5655 {{SERver}}
5656 !! result
5657 <p>example.org
5658 aOEU
5659 Aoeu
5660 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5661 </p>
5662 !! end
5663
5664 !! test
5665 Namespace 1 {{ns:1}}
5666 !! input
5667 {{ns:1}}
5668 !! result
5669 <p>Talk
5670 </p>
5671 !! end
5672
5673 !! test
5674 Namespace 1 {{ns:01}}
5675 !! input
5676 {{ns:01}}
5677 !! result
5678 <p>Talk
5679 </p>
5680 !! end
5681
5682 !! test
5683 Namespace 0 {{ns:0}} (bug 4783)
5684 !! input
5685 {{ns:0}}
5686 !! result
5687
5688 !! end
5689
5690 !! test
5691 Namespace 0 {{ns:00}} (bug 4783)
5692 !! input
5693 {{ns:00}}
5694 !! result
5695
5696 !! end
5697
5698 !! test
5699 Namespace -1 {{ns:-1}}
5700 !! input
5701 {{ns:-1}}
5702 !! result
5703 <p>Special
5704 </p>
5705 !! end
5706
5707 !! test
5708 Namespace User {{ns:User}}
5709 !! input
5710 {{ns:User}}
5711 !! result
5712 <p>User
5713 </p>
5714 !! end
5715
5716 !! test
5717 Namespace User talk {{ns:User_talk}}
5718 !! input
5719 {{ns:User_talk}}
5720 !! result
5721 <p>User talk
5722 </p>
5723 !! end
5724
5725 !! test
5726 Namespace User talk {{ns:uSeR tAlK}}
5727 !! input
5728 {{ns:uSeR tAlK}}
5729 !! result
5730 <p>User talk
5731 </p>
5732 !! end
5733
5734 !! test
5735 Namespace File {{ns:File}}
5736 !! input
5737 {{ns:File}}
5738 !! result
5739 <p>File
5740 </p>
5741 !! end
5742
5743 !! test
5744 Namespace File {{ns:Image}}
5745 !! input
5746 {{ns:Image}}
5747 !! result
5748 <p>File
5749 </p>
5750 !! end
5751
5752 !! test
5753 Namespace (lang=de) Benutzer {{ns:User}}
5754 !! options
5755 language=de
5756 !! input
5757 {{ns:User}}
5758 !! result
5759 <p>Benutzer
5760 </p>
5761 !! end
5762
5763 !! test
5764 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5765 !! options
5766 language=de
5767 !! input
5768 {{ns:3}}
5769 !! result
5770 <p>Benutzer Diskussion
5771 </p>
5772 !! end
5773
5774
5775 !! test
5776 Urlencode
5777 !! input
5778 {{urlencode:hi world?!}}
5779 {{urlencode:hi world?!|WIKI}}
5780 {{urlencode:hi world?!|PATH}}
5781 {{urlencode:hi world?!|QUERY}}
5782 !! result
5783 <p>hi+world%3F%21
5784 hi_world%3F!
5785 hi%20world%3F%21
5786 hi+world%3F%21
5787 </p>
5788 !! end
5789
5790 ###
5791 ### Magic links
5792 ###
5793 !! test
5794 Magic links: internal link to RFC (bug 479)
5795 !! input
5796 [[RFC 123]]
5797 !! result
5798 <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>
5799 </p>
5800 !! end
5801
5802 !! test
5803 Magic links: RFC (bug 479)
5804 !! input
5805 RFC 822
5806 !! result
5807 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5808 </p>
5809 !! end
5810
5811 !! test
5812 Magic links: ISBN (bug 1937)
5813 !! input
5814 ISBN 0-306-40615-2
5815 !! result
5816 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5817 </p>
5818 !! end
5819
5820 !! test
5821 Magic links: PMID incorrectly converts space to underscore
5822 !! input
5823 PMID 1234
5824 !! result
5825 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5826 </p>
5827 !! end
5828
5829 ###
5830 ### Templates
5831 ####
5832
5833 !! test
5834 Nonexistent template
5835 !! input
5836 {{thistemplatedoesnotexist}}
5837 !! result
5838 <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>
5839 </p>
5840 !! end
5841
5842 !! test
5843 Template with invalid target containing tags
5844 !! input
5845 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5846 !! result
5847 <p>{{a<b>b</b>|foo|a=b|a = b}}
5848 </p>
5849 !! end
5850
5851 !! test
5852 Template with invalid target containing unclosed tag
5853 !! input
5854 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5855 !! result
5856 <p>{{a<b>|foo|a=b|a = b}}</b>
5857 </p>
5858 !! end
5859
5860 !! article
5861 Template:test
5862 !! text
5863 This is a test template
5864 !! endarticle
5865
5866 !! test
5867 Simple template
5868 !! input
5869 {{test}}
5870 !! result
5871 <p>This is a test template
5872 </p>
5873 !! end
5874
5875 !! test
5876 Template with explicit namespace
5877 !! input
5878 {{Template:test}}
5879 !! result
5880 <p>This is a test template
5881 </p>
5882 !! end
5883
5884
5885 !! article
5886 Template:paramtest
5887 !! text
5888 This is a test template with parameter {{{param}}}
5889 !! endarticle
5890
5891 !! test
5892 Template parameter
5893 !! input
5894 {{paramtest|param=foo}}
5895 !! result
5896 <p>This is a test template with parameter foo
5897 </p>
5898 !! end
5899
5900 !! article
5901 Template:paramtestnum
5902 !! text
5903 [[{{{1}}}|{{{2}}}]]
5904 !! endarticle
5905
5906 !! test
5907 Template unnamed parameter
5908 !! input
5909 {{paramtestnum|Main Page|the main page}}
5910 !! result
5911 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5912 </p>
5913 !! end
5914
5915 !! article
5916 Template:templatesimple
5917 !! text
5918 (test)
5919 !! endarticle
5920
5921 !! article
5922 Template:templateredirect
5923 !! text
5924 #redirect [[Template:templatesimple]]
5925 !! endarticle
5926
5927 !! article
5928 Template:templateasargtestnum
5929 !! text
5930 {{{{{1}}}}}
5931 !! endarticle
5932
5933 !! article
5934 Template:templateasargtest
5935 !! text
5936 {{template{{{templ}}}}}
5937 !! endarticle
5938
5939 !! article
5940 Template:templateasargtest2
5941 !! text
5942 {{{{{templ}}}}}
5943 !! endarticle
5944
5945 !! test
5946 Template with template name as unnamed argument
5947 !! input
5948 {{templateasargtestnum|templatesimple}}
5949 !! result
5950 <p>(test)
5951 </p>
5952 !! end
5953
5954 !! test
5955 Template with template name as argument
5956 !! input
5957 {{templateasargtest|templ=simple}}
5958 !! result
5959 <p>(test)
5960 </p>
5961 !! end
5962
5963 !! test
5964 Template with template name as argument (2)
5965 !! input
5966 {{templateasargtest2|templ=templatesimple}}
5967 !! result
5968 <p>(test)
5969 </p>
5970 !! end
5971
5972 !! article
5973 Template:templateasargtestdefault
5974 !! text
5975 {{{{{templ|templatesimple}}}}}
5976 !! endarticle
5977
5978 !! article
5979 Template:templa
5980 !! text
5981 '''templ'''
5982 !! endarticle
5983
5984 !! test
5985 Template with default value
5986 !! input
5987 {{templateasargtestdefault}}
5988 !! result
5989 <p>(test)
5990 </p>
5991 !! end
5992
5993 !! test
5994 Template with default value (value set)
5995 !! input
5996 {{templateasargtestdefault|templ=templa}}
5997 !! result
5998 <p><b>templ</b>
5999 </p>
6000 !! end
6001
6002 !! test
6003 Template redirect
6004 !! input
6005 {{templateredirect}}
6006 !! result
6007 <p>(test)
6008 </p>
6009 !! end
6010
6011 !! test
6012 Template with argument in separate line
6013 !! input
6014 {{ templateasargtest |
6015 templ = simple }}
6016 !! result
6017 <p>(test)
6018 </p>
6019 !! end
6020
6021 !! test
6022 Template with complex template as argument
6023 !! input
6024 {{paramtest|
6025 param ={{ templateasargtest |
6026 templ = simple }}}}
6027 !! result
6028 <p>This is a test template with parameter (test)
6029 </p>
6030 !! end
6031
6032 !! test
6033 Template with thumb image (with link in description)
6034 !! input
6035 {{paramtest|
6036 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6037 !! result
6038 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>
6039
6040 !! end
6041
6042 !! article
6043 Template:complextemplate
6044 !! text
6045 {{{1}}} {{paramtest|
6046 param ={{{param}}}}}
6047 !! endarticle
6048
6049 !! test
6050 Template with complex arguments
6051 !! input
6052 {{complextemplate|
6053 param ={{ templateasargtest |
6054 templ = simple }}|[[Template:complextemplate|link]]}}
6055 !! result
6056 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6057 </p>
6058 !! end
6059
6060 !! test
6061 BUG 553: link with two variables in a piped link
6062 !! input
6063 {|
6064 |[[{{{1}}}|{{{2}}}]]
6065 |}
6066 !! result
6067 <table>
6068 <tr>
6069 <td>[[{{{1}}}|{{{2}}}]]
6070 </td></tr></table>
6071
6072 !! end
6073
6074 !! test
6075 Magic variable as template parameter
6076 !! input
6077 {{paramtest|param={{SITENAME}}}}
6078 !! result
6079 <p>This is a test template with parameter MediaWiki
6080 </p>
6081 !! end
6082
6083 !! article
6084 Template:linktest
6085 !! text
6086 [[{{{param}}}|link]]
6087 !! endarticle
6088
6089 !! test
6090 Template parameter as link source
6091 !! input
6092 {{linktest|param=Main Page}}
6093 !! result
6094 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6095 </p>
6096 !! end
6097
6098 !!test
6099 Template-generated attribute string (k='v')
6100 !!input
6101 <span {{attr_str|id|v1}}>bar</span>
6102 !!result
6103 <p><span id="v1">bar</span>
6104 </p>
6105 !!end
6106
6107 !!article
6108 Template:paramtest2
6109 !! text
6110 including another template, {{paramtest|param={{{arg}}}}}
6111 !! endarticle
6112
6113 !! test
6114 Template passing argument to another template
6115 !! input
6116 {{paramtest2|arg='hmm'}}
6117 !! result
6118 <p>including another template, This is a test template with parameter 'hmm'
6119 </p>
6120 !! end
6121
6122 !! article
6123 Template:Linktest2
6124 !! text
6125 Main Page
6126 !! endarticle
6127
6128 !! test
6129 Template as link source
6130 !! input
6131 [[{{linktest2}}]]
6132
6133 [[{{linktest2}}|Main Page]]
6134
6135 [[{{linktest2}}]]Page
6136 !! result
6137 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6138 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6139 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6140 </p>
6141 !! end
6142
6143
6144 !! article
6145 Template:loop1
6146 !! text
6147 {{loop2}}
6148 !! endarticle
6149
6150 !! article
6151 Template:loop2
6152 !! text
6153 {{loop1}}
6154 !! endarticle
6155
6156 !! test
6157 Template infinite loop
6158 !! input
6159 {{loop1}}
6160 !! result
6161 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6162 </p>
6163 !! end
6164
6165 !! test
6166 Template from main namespace
6167 !! input
6168 {{:Main Page}}
6169 !! result
6170 <p>blah blah
6171 </p>
6172 !! end
6173
6174 !! article
6175 Template:table
6176 !! text
6177 {|
6178 | 1 || 2
6179 |-
6180 | 3 || 4
6181 |}
6182 !! endarticle
6183
6184 !! test
6185 BUG 529: Template with table, not included at beginning of line
6186 !! input
6187 foo {{table}}
6188 !! result
6189 <p>foo
6190 </p>
6191 <table>
6192 <tr>
6193 <td> 1 </td>
6194 <td> 2
6195 </td></tr>
6196 <tr>
6197 <td> 3 </td>
6198 <td> 4
6199 </td></tr></table>
6200
6201 !! end
6202
6203 !! test
6204 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6205 !! input
6206 foo
6207 {{table}}
6208 !! result
6209 <p>foo
6210 </p>
6211 <table>
6212 <tr>
6213 <td> 1 </td>
6214 <td> 2
6215 </td></tr>
6216 <tr>
6217 <td> 3 </td>
6218 <td> 4
6219 </td></tr></table>
6220
6221 !! end
6222
6223 !! test
6224 BUG 41: Template parameters shown as broken links
6225 !! input
6226 {{{parameter}}}
6227 !! result
6228 <p>{{{parameter}}}
6229 </p>
6230 !! end
6231
6232 !! test
6233 Template with targets containing wikilinks
6234 !! input
6235 {{[[foo]]}}
6236
6237 {{[[{{echo|foo}}]]}}
6238
6239 {{{{echo|[[foo}}]]}}
6240 !! result
6241 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6242 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6243 </p><p>{{[[foo}}]]
6244 </p>
6245 !! end
6246
6247 !! article
6248 Template:MSGNW test
6249 !! text
6250 ''None'' of '''this''' should be
6251 * interpreted
6252 but rather passed unmodified
6253 {{test}}
6254 !! endarticle
6255
6256 # hmm, fix this or just deprecate msgnw and document its behavior?
6257 !! test
6258 msgnw keyword
6259 !! options
6260 disabled
6261 !! input
6262 {{msgnw:MSGNW test}}
6263 !! result
6264 <p>''None'' of '''this''' should be
6265 * interpreted
6266 but rather passed unmodified
6267 {{test}}
6268 </p>
6269 !! end
6270
6271 !! test
6272 int keyword
6273 !! input
6274 {{int:youhavenewmessages|lots of money|not!}}
6275 !! result
6276 <p>You have lots of money (not!).
6277 </p>
6278 !! end
6279
6280 !! article
6281 Template:Includes
6282 !! text
6283 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6284 !! endarticle
6285
6286 !! test
6287 <includeonly> and <noinclude> being included
6288 !! input
6289 {{Includes}}
6290 !! result
6291 <p>Foobar
6292 </p>
6293 !! end
6294
6295 !! article
6296 Template:Includes2
6297 !! text
6298 <onlyinclude>Foo</onlyinclude>bar
6299 !! endarticle
6300
6301 !! test
6302 <onlyinclude> being included
6303 !! input
6304 {{Includes2}}
6305 !! result
6306 <p>Foo
6307 </p>
6308 !! end
6309
6310
6311 !! article
6312 Template:Includes3
6313 !! text
6314 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6315 !! endarticle
6316
6317 !! test
6318 <onlyinclude> and <includeonly> being included
6319 !! input
6320 {{Includes3}}
6321 !! result
6322 <p>Foo
6323 </p>
6324 !! end
6325
6326 !! test
6327 <includeonly> and <noinclude> on a page
6328 !! input
6329 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6330 !! result
6331 <p>Foozar
6332 </p>
6333 !! end
6334
6335 !! test
6336 Un-closed <noinclude>
6337 !! input
6338 <noinclude>
6339 !! result
6340 !! end
6341
6342 !! test
6343 <onlyinclude> on a page
6344 !! input
6345 <onlyinclude>Foo</onlyinclude>bar
6346 !! result
6347 <p>Foobar
6348 </p>
6349 !! end
6350
6351 !! test
6352 Un-closed <onlyinclude>
6353 !! input
6354 <onlyinclude>
6355 !! result
6356 !! end
6357
6358 !!test
6359 Self-closed noinclude, includeonly, onlyinclude tags
6360 !!input
6361 <noinclude />
6362 <includeonly />
6363 <onlyinclude />
6364 !!result
6365 <p><br />
6366 </p>
6367 !!end
6368
6369 !!test
6370 Unbalanced includeonly and noinclude tags
6371 !!input
6372 {|
6373 |a</noinclude>
6374 |b</noinclude></noinclude>
6375 |c</noinclude></includeonly>
6376 |d</includeonly></includeonly>
6377 |}
6378 !!result
6379 <table>
6380 <tr>
6381 <td>a
6382 </td>
6383 <td>b
6384 </td>
6385 <td>c&lt;/includeonly&gt;
6386 </td>
6387 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6388 </td></tr></table>
6389
6390 !!end
6391
6392 !! article
6393 Template:Includeonly section
6394 !! text
6395 <includeonly>
6396 ==Includeonly section==
6397 </includeonly>
6398 ==Section T-1==
6399 !!endarticle
6400
6401 !! test
6402 Bug 6563: Edit link generation for section shown by <includeonly>
6403 !! input
6404 {{includeonly section}}
6405 !! result
6406 <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>
6407 <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>
6408
6409 !! end
6410
6411 # Uses same input as the contents of [[Template:Includeonly section]]
6412 !! test
6413 Bug 6563: Section extraction for section shown by <includeonly>
6414 !! options
6415 section=T-2
6416 !! input
6417 <includeonly>
6418 ==Includeonly section==
6419 </includeonly>
6420 ==Section T-2==
6421 !! result
6422 ==Section T-2==
6423 !! end
6424
6425 !! test
6426 Bug 6563: Edit link generation for section suppressed by <includeonly>
6427 !! input
6428 <includeonly>
6429 ==Includeonly section==
6430 </includeonly>
6431 ==Section 1==
6432 !! result
6433 <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>
6434
6435 !! end
6436
6437 !! test
6438 Bug 6563: Section extraction for section suppressed by <includeonly>
6439 !! options
6440 section=1
6441 !! input
6442 <includeonly>
6443 ==Includeonly section==
6444 </includeonly>
6445 ==Section 1==
6446 !! result
6447 ==Section 1==
6448 !! end
6449
6450 !! test
6451 Un-closed <includeonly>
6452 !! input
6453 <includeonly>
6454 !! result
6455 !! end
6456
6457 ###
6458 ### <includeonly> and <noinclude> in attributes
6459 ###
6460 !!test
6461 0. includeonly around the entire attribute
6462 !!input
6463 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6464 !!result
6465 <p><span id="v2">bar</span>
6466 </p>
6467 !!end
6468
6469 !!test
6470 1. includeonly in html attr key
6471 !!input
6472 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6473 !!result
6474 <p><span id="foo">bar</span>
6475 </p>
6476 !!end
6477
6478 !!test
6479 2. includeonly in html attr value
6480 !!input
6481 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6482 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6483 !!result
6484 <p><span id="v1">bar</span>
6485 <span id="v1">bar</span>
6486 </p>
6487 !!end
6488
6489 !!test
6490 3. includeonly in part of an attr value
6491 !!input
6492 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6493 !!result
6494 <p><span style="color:red;">bar</span>
6495 </p>
6496 !!end
6497
6498 ###
6499 ### Testing parsing of templates where a template arg
6500 ### has the same name as the template itself.
6501 ###
6502
6503 !! article
6504 Template:quote
6505 !! text
6506 {{{quote|{{{1}}}}}}
6507 !! endarticle
6508
6509 !!test
6510 Templates: Template Name/Arg clash: 1. Use of positional param
6511 !!input
6512 {{quote|foo}}
6513 !!result
6514 <p>foo
6515 </p>
6516 !!end
6517
6518 !!test
6519 Templates: Template Name/Arg clash: 2. Use of named param
6520 !!input
6521 {{quote|quote=foo}}
6522 !!result
6523 <p>foo
6524 </p>
6525 !!end
6526
6527 !!test
6528 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6529 !!input
6530 {{quote|quote}}
6531 !!result
6532 <p>quote
6533 </p>
6534 !!end
6535
6536 ###
6537 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6538 ###
6539
6540 !!test
6541 Templates: 1. Simple use
6542 !!input
6543 {{echo|Foo}}
6544 !!result
6545 <p>Foo
6546 </p>
6547 !!end
6548
6549 !!test
6550 Templates: 2. Inside a block tag
6551 !!input
6552 <div>{{echo|Foo}}</div>
6553 !!result
6554 <div>Foo</div>
6555
6556 !!end
6557
6558 !!test
6559 Templates: P-wrapping: 1a. Templates on consecutive lines
6560 !!input
6561 {{echo|Foo}}
6562 {{echo|bar}}
6563 !!result
6564 <p>Foo
6565 bar
6566 </p>
6567 !!end
6568
6569 !!test
6570 Templates: P-wrapping: 1b. Templates on consecutive lines
6571 !!input
6572 Foo
6573
6574 {{echo|bar}}
6575 {{echo|baz}}
6576 !!result
6577 <p>Foo
6578 </p><p>bar
6579 baz
6580 </p>
6581 !!end
6582
6583 !!test
6584 Templates: P-wrapping: 1c. Templates on consecutive lines
6585 !!input
6586 {{echo|Foo}}
6587 {{echo|bar}} <div>baz</div>
6588 !!result
6589 <p>Foo
6590 </p>
6591 bar <div>baz</div>
6592
6593 !!end
6594
6595 !!test
6596 Templates: P-wrapping: 1d. Template preceded by comment-only line
6597 !!options
6598 parsoid=wt2html,wt2wt
6599 !!input
6600 <!-- foo -->
6601 {{echo|Bar}}
6602 !!result
6603 <!-- foo -->
6604 <p typeof="mw:Transclusion">Bar
6605 </p>
6606 !!end
6607
6608 !!test
6609 Templates: Inline Text: 1. Multiple tmeplate uses
6610 !!input
6611 {{echo|Foo}}bar{{echo|baz}}
6612 !!result
6613 <p>Foobarbaz
6614 </p>
6615 !!end
6616
6617 !!test
6618 Templates: Inline Text: 2. Back-to-back template uses
6619 !!input
6620 {{echo|Foo}}{{echo|bar}}
6621 !!result
6622 <p>Foobar
6623 </p>
6624 !!end
6625
6626 !!test
6627 Templates: Block Tags: 1. Multiple template uses
6628 !!input
6629 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6630 !!result
6631 <div>Foo</div><div>bar</div><div>baz</div>
6632
6633 !!end
6634
6635 !!test
6636 Templates: Block Tags: 2. Back-to-back template uses
6637 !!input
6638 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6639 !!result
6640 <div>Foo</div><div>bar</div>
6641
6642 !!end
6643
6644 !!test
6645 Templates: Links: 1. Simple example
6646 !!input
6647 {{echo|[[Foo|bar]]}}
6648 !!result
6649 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6650 </p>
6651 !!end
6652
6653 !!test
6654 Templates: Links: 2. Generation of link href
6655 !!input
6656 [[{{echo|Foo}}|bar]]
6657 !!result
6658 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6659 </p>
6660 !!end
6661
6662 !!test
6663 Templates: Links: 3. Generation of part of a link href
6664 !!input
6665 [[Fo{{echo|o}}|bar]]
6666
6667 [[Foo{{echo|bar}}]]
6668
6669 [[Foo{{echo|bar}}baz]]
6670
6671 [[Foo{{echo|bar}}|bar]]
6672
6673 [[:Foo{{echo|bar}}]]
6674
6675 [[:Foo{{echo|bar}}|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><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6679 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6680 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6681 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6682 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6683 </p>
6684 !!end
6685
6686 !!test
6687 Templates: Links: 4. Multiple templates generating link href
6688 !!input
6689 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6690 !!result
6691 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6692 </p>
6693 !!end
6694
6695 !!test
6696 Templates: Links: 5. Generation of link text
6697 !!input
6698 [[Foo|{{echo|bar}}]]
6699 !!result
6700 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6701 </p>
6702 !!end
6703
6704 !!test
6705 Templates: Links: 5. Nested templates (only outermost template should be marked)
6706 !!input
6707 {{echo|[[{{echo|Foo}}|bar]]}}
6708 !!result
6709 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6710 </p>
6711 !!end
6712
6713 !!test
6714 Templates: HTML Tag: 1. Generation of HTML attr. key
6715 !!input
6716 <div {{echo|style}}="color:red;">foo</div>
6717 !!result
6718 <div style="color:red;">foo</div>
6719
6720 !!end
6721
6722 !!test
6723 Templates: HTML Tag: 2. Generation of HTML attr. value
6724 !!input
6725 <div style={{echo|'color:red;'}}>foo</div>
6726 !!result
6727 <div style="color:red;">foo</div>
6728
6729 !!end
6730
6731 !!test
6732 Templates: HTML Tag: 3. Generation of HTML attr key and value
6733 !!input
6734 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6735 !!result
6736 <div style="color:red;">foo</div>
6737
6738 !!end
6739
6740 !!test
6741 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6742 !!input
6743 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6744 !!result
6745 <div title="This is a long title with just one piece templated">foo</div>
6746
6747 !!end
6748
6749 !!test
6750 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6751 !!input
6752 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6753 !!result
6754 <div title="This is a long title with just one piece templated">foo</div>
6755
6756 !!end
6757
6758 !!test
6759 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6760 !!input
6761 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6762 !!result
6763 <div title="This is a long title with just one piece templated">foo</div>
6764
6765 !!end
6766
6767 !!test
6768 Templates: HTML Tag: 7. Generation of partial attribute key string
6769 !!input
6770 <div st{{echo|yle}}="color:red;">foo</div>
6771 !!result
6772 <div style="color:red;">foo</div>
6773
6774 !!end
6775
6776 !!test
6777 Templates: HTML Tables: 1. Generating start of a HTML table
6778 !!input
6779 {{echo|<table><tr><td>foo</td>}}</tr></table>
6780 !!result
6781 <table><tr><td>foo</td></tr></table>
6782
6783 !!end
6784
6785 !!test
6786 Templates: HTML Tables: 2a. Generating middle of a HTML table
6787 !!input
6788 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6789 !!result
6790 <table><tr><td>foo</td></tr></table>
6791
6792 !!end
6793
6794 !!test
6795 Templates: HTML Tables: 2b. Generating middle of a HTML table
6796 !!input
6797 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6798 !!result
6799 <table><tr><td>foo</td></tr></table>
6800
6801 !!end
6802
6803 !!test
6804 Templates: HTML Tables: 3. Generating end of a HTML table
6805 !!input
6806 <table><tr>{{echo|<td>foo</td></tr></table>}}
6807 !!result
6808 <table><tr><td>foo</td></tr></table>
6809
6810 !!end
6811
6812 !!test
6813 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6814 !!input
6815 {{echo|<table>}}<tr><td>foo</td></tr></table>
6816 !!result
6817 <table><tr><td>foo</td></tr></table>
6818
6819 !!end
6820
6821 !!test
6822 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6823 !!input
6824 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6825 !!result
6826 <table><tr><td>foo</td></tr></table>
6827
6828 !!end
6829
6830 !!test
6831 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6832 !!input
6833 <table><tr>{{echo|<td>}}foo</td></tr></table>
6834 !!result
6835 <table><tr><td>foo</td></tr></table>
6836
6837 !!end
6838
6839 !!test
6840 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6841 !!input
6842 <table><tr><td>foo{{echo|</td>}}</tr></table>
6843 !!result
6844 <table><tr><td>foo</td></tr></table>
6845
6846 !!end
6847
6848 !!test
6849 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6850 !!input
6851 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6852 !!result
6853 <table><tr><td>foo</td></tr></table>
6854
6855 !!end
6856
6857 !!test
6858 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6859 !!input
6860 <table><tr><td>foo</td></tr>{{echo|</table>}}
6861 !!result
6862 <table><tr><td>foo</td></tr></table>
6863
6864 !!end
6865
6866 !!test
6867 Templates: HTML Tables: 5. Proper fostering of categories from inside
6868 !!options
6869 parsoid=wt2html,wt2wt
6870 !!input
6871 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6872 <!--Two categories (Bug 50330)-->
6873 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6874 !!result
6875 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6876 <!--Two categories (Bug 50330)-->
6877 <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>
6878 !!end
6879
6880 !!test
6881 Templates: Wiki Tables: 1a. Fostering of entire template content
6882 !!input
6883 {|
6884 {{echo|a}}
6885 |}
6886 !!result
6887 <table>
6888 a
6889 <tr><td></td></tr></table>
6890
6891 !!end
6892
6893 !!test
6894 Templates: Wiki Tables: 1b. Fostering of entire template content
6895 !!input
6896 {|
6897 {{echo|<div>}}
6898 foo
6899 {{echo|</div>}}
6900 |}
6901 !!result
6902 <table>
6903 <div>
6904 <p>foo
6905 </p>
6906 </div>
6907 <tr><td></td></tr></table>
6908
6909 !!end
6910
6911 !!test
6912 Templates: Wiki Tables: 2. Fostering of partial template content
6913 !!input
6914 {|
6915 {{echo|a
6916 <div>b</div>}}
6917 |}
6918 !!result
6919 <table>
6920 a
6921 <div>b</div>
6922 <tr><td></td></tr></table>
6923
6924 !!end
6925
6926 !!test
6927 Templates: Wiki Tables: 3. td-content via multiple templates
6928 !!input
6929 {|
6930 {{echo|{{pipe}}a}}{{echo|b}}
6931 |}
6932 !!result
6933 <table>
6934 <tr>
6935 <td>ab
6936 </td></tr></table>
6937
6938 !!end
6939
6940 !!test
6941 Templates: Wiki Tables: 4. Templated tags, no content
6942 !!input
6943 {{tbl-start}}
6944 {{tbl-end}}
6945 !!result
6946 <table>
6947 <tr><td></td></tr></table>
6948
6949 !!end
6950
6951 !!test
6952 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6953 !!input
6954 {{tbl-start}}
6955 |foo
6956 {{tbl-end}}
6957 !!result
6958 <table>
6959 <tr>
6960 <td>foo
6961 </td></tr></table>
6962
6963 !!end
6964
6965 !!test
6966 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6967 !!input
6968 {{tbl-start}}
6969 {{!}}foo
6970 {{tbl-end}}
6971 !!result
6972 <table>
6973 <tr>
6974 <td>foo
6975 </td></tr></table>
6976
6977 !!end
6978
6979 !!test
6980 Templates: Lists: Multi-line list-items via templates
6981 !!input
6982 *{{echo|a {{nonexistent|
6983 unused}}}}
6984 *{{echo|b {{nonexistent|
6985 unused}}}}
6986 !!result
6987 <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>
6988 </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>
6989 </li></ul>
6990
6991 !!end
6992
6993 !!test
6994 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6995 !!input
6996 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6997 !!result
6998 <p><i>ab</i>c<i>d</i>e
6999 </p>
7000 !!end
7001
7002 !!test
7003 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7004 (PHP parser generates misnested html)
7005 !! options
7006 parsoid=wt2html,wt2wt
7007 !!input
7008 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7009 !!result
7010 <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>
7011 !!end
7012
7013 !!test
7014 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7015 (PHP parser generates misnested html)
7016 !! options
7017 parsoid=wt2html,wt2wt
7018 !!input
7019 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7020 !!result
7021 <div typeof="mw:Transclusion"><i>a</i></div>
7022 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7023 <div typeof="mw:Transclusion">e</div>
7024 !!end
7025
7026 !!test
7027 Templates: Ugly nesting: 4. Divs opened/closed across templates
7028 !!input
7029 a<div>b{{echo|c</div>d}}e
7030 !!result
7031 a<div>bc</div>de
7032
7033 !!end
7034
7035 !!test
7036 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7037 (Parsoid-centric)
7038 !! options
7039 parsoid
7040 !!input
7041 {|
7042 |{{echo|foo</table>}}
7043 |bar
7044 |}
7045 !!result
7046 <table typeof="mw:Transclusion">
7047 <tbody>
7048 <tr>
7049 <td>foo</td></tr></tbody></table><span>bar</span>
7050 !!end
7051
7052 !!test
7053 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7054 (Parsoid-centric)
7055 !! options
7056 parsoid
7057 !!input
7058 <table>
7059 <tr>
7060 <td>
7061 <table>
7062 <tr>
7063 <td>1. {{echo|foo </table>}}</td>
7064 <td> bar </td>
7065 <td>2. {{echo|baz </table>}}</td>
7066 </tr>
7067 <tr>
7068 <td>abc</td>
7069 </tr>
7070 </table>
7071 </td>
7072 </tr>
7073 <tr>
7074 <td>xyz</td>
7075 </tr>
7076 </table>
7077 !!result
7078 <table about="#mwt1" typeof="mw:Transclusion">
7079 <tbody><tr >
7080 <td >
7081 <table >
7082 <tbody><tr >
7083 <td >1. foo </td></tr></tbody></table></td>
7084 <td > bar </td>
7085 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7086 </span><span about="#mwt1">
7087
7088 abc</span><span about="#mwt1">
7089 </span><span about="#mwt1">
7090 </span><span about="#mwt1">
7091 </span><span about="#mwt1">
7092 </span><span about="#mwt1">
7093
7094 xyz</span><span about="#mwt1">
7095 </span><span about="#mwt1">
7096 </span>
7097 !!end
7098
7099 !! test
7100 Templates: Ugly templates: 3. newline-only template parameter
7101 !! input
7102 foo {{echo|
7103 }}
7104 !! result
7105 <p>foo
7106 </p>
7107 !! end
7108
7109 # This looks like a bug: a single newline triggers p/br for some reason.
7110 !! test
7111 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7112 !! input
7113 {{echo|
7114 }}
7115 !! result
7116 <p><br />
7117 </p>
7118 !! end
7119
7120
7121 !!test
7122 Parser Functions: 1. Simple example
7123 !!input
7124 {{uc:foo}}
7125 !!result
7126 <p>FOO
7127 </p>
7128 !!end
7129
7130 !!test
7131 Parser Functions: 2. Nested use (only outermost should be marked up)
7132 !!input
7133 {{uc:{{lc:FOO}}}}
7134 !!result
7135 <p>FOO
7136 </p>
7137 !!end
7138
7139 ###
7140 ### Pre-save transform tests
7141 ###
7142 !! test
7143 pre-save transform: subst:
7144 !! options
7145 PST
7146 !! input
7147 {{subst:test}}
7148 !! result
7149 This is a test template
7150 !! end
7151
7152 !! test
7153 pre-save transform: normal template
7154 !! options
7155 PST
7156 !! input
7157 {{test}}
7158 !! result
7159 {{test}}
7160 !! end
7161
7162 !! test
7163 pre-save transform: nonexistent template
7164 !! options
7165 PST
7166 !! input
7167 {{thistemplatedoesnotexist}}
7168 !! result
7169 {{thistemplatedoesnotexist}}
7170 !! end
7171
7172
7173 !! test
7174 pre-save transform: subst magic variables
7175 !! options
7176 PST
7177 !! input
7178 {{subst:SITENAME}}
7179 !! result
7180 MediaWiki
7181 !! end
7182
7183 # This is bug 89, which I fixed. -- wtm
7184 !! test
7185 pre-save transform: subst: templates with parameters
7186 !! options
7187 pst
7188 !! input
7189 {{subst:paramtest|param="something else"}}
7190 !! result
7191 This is a test template with parameter "something else"
7192 !! end
7193
7194 !! article
7195 Template:nowikitest
7196 !! text
7197 <nowiki>'''not wiki'''</nowiki>
7198 !! endarticle
7199
7200 !! test
7201 pre-save transform: nowiki in subst (bug 1188)
7202 !! options
7203 pst
7204 !! input
7205 {{subst:nowikitest}}
7206 !! result
7207 <nowiki>'''not wiki'''</nowiki>
7208 !! end
7209
7210
7211 !! article
7212 Template:commenttest
7213 !! text
7214 This template has <!-- a comment --> in it.
7215 !! endarticle
7216
7217 !! test
7218 pre-save transform: comment in subst (bug 1936)
7219 !! options
7220 pst
7221 !! input
7222 {{subst:commenttest}}
7223 !! result
7224 This template has <!-- a comment --> in it.
7225 !! end
7226
7227 !! test
7228 pre-save transform: unclosed tag
7229 !! options
7230 pst noxml
7231 !! input
7232 <nowiki>'''not wiki'''
7233 !! result
7234 <nowiki>'''not wiki'''
7235 !! end
7236
7237 !! test
7238 pre-save transform: mixed tag case
7239 !! options
7240 pst noxml
7241 !! input
7242 <NOwiki>'''not wiki'''</noWIKI>
7243 !! result
7244 <NOwiki>'''not wiki'''</noWIKI>
7245 !! end
7246
7247 !! test
7248 pre-save transform: unclosed comment in <nowiki>
7249 !! options
7250 pst noxml
7251 !! input
7252 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7253 !! result
7254 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7255 !!end
7256
7257 # Leading @ in this template definition works around a limitation
7258 # in parsoid's parserTests which otherwise strips the <span> from the
7259 # result (confusing it for a template wrapper)
7260 !! article
7261 Template:dangerous
7262 !!text
7263 @<span onmouseover="alert('crap')">Oh no</span>
7264 !!endarticle
7265
7266 !!test
7267 (confirming safety of fix for subst bug 1936)
7268 !! input
7269 {{Template:dangerous}}
7270 !! result
7271 <p>@<span>Oh no</span>
7272 </p>
7273 !! end
7274
7275 !! test
7276 pre-save transform: comment containing gallery (bug 5024)
7277 !! options
7278 pst
7279 !! input
7280 <!-- <gallery>data</gallery> -->
7281 !!result
7282 <!-- <gallery>data</gallery> -->
7283 !!end
7284
7285 !! test
7286 pre-save transform: comment containing extension
7287 !! options
7288 pst
7289 !! input
7290 <!-- <tag>data</tag> -->
7291 !!result
7292 <!-- <tag>data</tag> -->
7293 !!end
7294
7295 !! test
7296 pre-save transform: comment containing nowiki
7297 !! options
7298 pst
7299 !! input
7300 <!-- <nowiki>data</nowiki> -->
7301 !!result
7302 <!-- <nowiki>data</nowiki> -->
7303 !!end
7304
7305 !! test
7306 pre-save transform: <noinclude> in subst (bug 3298)
7307 !! options
7308 pst
7309 !! input
7310 {{subst:Includes}}
7311 !! result
7312 Foobar
7313 !! end
7314
7315 !! test
7316 pre-save transform: <onlyinclude> in subst (bug 3298)
7317 !! options
7318 pst
7319 !! input
7320 {{subst:Includes2}}
7321 !! result
7322 Foo
7323 !! end
7324
7325 !! article
7326 Template:SubstTest
7327 !!text
7328 {{<includeonly>subst:</includeonly>Includes}}
7329 !! endarticle
7330
7331 !! article
7332 Template:SafeSubstTest
7333 !! text
7334 {{<includeonly>safesubst:</includeonly>Includes}}
7335 !! endarticle
7336
7337 !! test
7338 bug 22297: safesubst: works during PST
7339 !! options
7340 pst
7341 !! input
7342 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7343 !! result
7344 FoobarFoobar
7345 !! end
7346
7347 !! test
7348 bug 22297: safesubst: works during normal parse
7349 !! input
7350 {{SafeSubstTest}}
7351 !! result
7352 <p>Foobar
7353 </p>
7354 !! end
7355
7356 !! test:
7357 subst: does not work during normal parse
7358 !! input
7359 {{SubstTest}}
7360 !! result
7361 <p>{{subst:Includes}}
7362 </p>
7363 !! end
7364
7365 !! test
7366 pre-save transform: context links ("pipe trick")
7367 !! options
7368 pst
7369 !! input
7370 [[Article (context)|]]
7371 [[Bar:Article|]]
7372 [[:Bar:Article|]]
7373 [[Bar:Article (context)|]]
7374 [[:Bar:Article (context)|]]
7375 [[|Article]]
7376 [[|Article (context)]]
7377 [[Bar:X (Y) Z|]]
7378 [[:Bar:X (Y) Z|]]
7379 !! result
7380 [[Article (context)|Article]]
7381 [[Bar:Article|Article]]
7382 [[:Bar:Article|Article]]
7383 [[Bar:Article (context)|Article]]
7384 [[:Bar:Article (context)|Article]]
7385 [[Article]]
7386 [[Article (context)]]
7387 [[Bar:X (Y) Z|X (Y) Z]]
7388 [[:Bar:X (Y) Z|X (Y) Z]]
7389 !! end
7390
7391 !! test
7392 pre-save transform: context links ("pipe trick") with interwiki prefix
7393 !! options
7394 pst
7395 !! input
7396 [[interwiki:Article|]]
7397 [[:interwiki:Article|]]
7398 [[interwiki:Bar:Article|]]
7399 [[:interwiki:Bar:Article|]]
7400 !! result
7401 [[interwiki:Article|Article]]
7402 [[:interwiki:Article|Article]]
7403 [[interwiki:Bar:Article|Bar:Article]]
7404 [[:interwiki:Bar:Article|Bar:Article]]
7405 !! end
7406
7407 !! test
7408 pre-save transform: context links ("pipe trick") with parens in title
7409 !! options
7410 pst title=[[Somearticle (context)]]
7411 !! input
7412 [[|Article]]
7413 !! result
7414 [[Article (context)|Article]]
7415 !! end
7416
7417 !! test
7418 pre-save transform: context links ("pipe trick") with comma in title
7419 !! options
7420 pst title=[[Someplace, Somewhere]]
7421 !! input
7422 [[|Otherplace]]
7423 [[Otherplace, Elsewhere|]]
7424 [[Otherplace, Elsewhere, Anywhere|]]
7425 !! result
7426 [[Otherplace, Somewhere|Otherplace]]
7427 [[Otherplace, Elsewhere|Otherplace]]
7428 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7429 !! end
7430
7431 !! test
7432 pre-save transform: context links ("pipe trick") with parens and comma
7433 !! options
7434 pst title=[[Someplace (IGNORED), Somewhere]]
7435 !! input
7436 [[|Otherplace]]
7437 [[Otherplace (place), Elsewhere|]]
7438 !! result
7439 [[Otherplace, Somewhere|Otherplace]]
7440 [[Otherplace (place), Elsewhere|Otherplace]]
7441 !! end
7442
7443 !! test
7444 pre-save transform: context links ("pipe trick") with comma and parens
7445 !! options
7446 pst title=[[Who, me? (context)]]
7447 !! input
7448 [[|Yes, you.]]
7449 [[Me, Myself, and I (1937 song)|]]
7450 !! result
7451 [[Yes, you. (context)|Yes, you.]]
7452 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7453 !! end
7454
7455 !! test
7456 pre-save transform: context links ("pipe trick") with namespace
7457 !! options
7458 pst title=[[Ns:Somearticle]]
7459 !! input
7460 [[|Article]]
7461 !! result
7462 [[Ns:Article|Article]]
7463 !! end
7464
7465 !! test
7466 pre-save transform: context links ("pipe trick") with namespace and parens
7467 !! options
7468 pst title=[[Ns:Somearticle (context)]]
7469 !! input
7470 [[|Article]]
7471 !! result
7472 [[Ns:Article (context)|Article]]
7473 !! end
7474
7475 !! test
7476 pre-save transform: context links ("pipe trick") with namespace and comma
7477 !! options
7478 pst title=[[Ns:Somearticle, Context, Whatever]]
7479 !! input
7480 [[|Article]]
7481 !! result
7482 [[Ns:Article, Context, Whatever|Article]]
7483 !! end
7484
7485 !! test
7486 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7487 !! options
7488 pst title=[[Ns:Somearticle, Context (context)]]
7489 !! input
7490 [[|Article]]
7491 !! result
7492 [[Ns:Article (context)|Article]]
7493 !! end
7494
7495 !! test
7496 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7497 !! options
7498 pst title=[[Ns:Somearticle (IGNORED), Context]]
7499 !! input
7500 [[|Article]]
7501 !! result
7502 [[Ns:Article, Context|Article]]
7503 !! end
7504
7505 !! test
7506 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7507 !! options
7508 pst
7509 !! input
7510 [[Article(context)|]]
7511 [[Bar:Article(context)|]]
7512 [[:Bar:Article(context)|]]
7513 [[|Article(context)]]
7514 [[Bar:X(Y)Z|]]
7515 [[:Bar:X(Y)Z|]]
7516 !! result
7517 [[Article(context)|Article]]
7518 [[Bar:Article(context)|Article]]
7519 [[:Bar:Article(context)|Article]]
7520 [[Article(context)]]
7521 [[Bar:X(Y)Z|X(Y)Z]]
7522 [[:Bar:X(Y)Z|X(Y)Z]]
7523 !! end
7524
7525 !! test
7526 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7527 !! options
7528 pst
7529 !! input
7530 [[Article (context)|]]
7531 [[Bar:Article (context)|]]
7532 [[:Bar:Article (context)|]]
7533 [[|Article (context)]]
7534 [[Bar:X (Y) Z|]]
7535 [[:Bar:X (Y) Z|]]
7536 !! result
7537 [[Article (context)|Article]]
7538 [[Bar:Article (context)|Article]]
7539 [[:Bar:Article (context)|Article]]
7540 [[Article (context)]]
7541 [[Bar:X (Y) Z|X (Y) Z]]
7542 [[:Bar:X (Y) Z|X (Y) Z]]
7543 !! end
7544
7545 !! test
7546 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7547 !! options
7548 pst
7549 !! input
7550 [[Article(context)|]]
7551 [[Bar:Article(context)|]]
7552 [[:Bar:Article(context)|]]
7553 [[|Article(context)]]
7554 [[Bar:X(Y)Z|]]
7555 [[:Bar:X(Y)Z|]]
7556 !! result
7557 [[Article(context)|Article]]
7558 [[Bar:Article(context)|Article]]
7559 [[:Bar:Article(context)|Article]]
7560 [[Article(context)]]
7561 [[Bar:X(Y)Z|X(Y)Z]]
7562 [[:Bar:X(Y)Z|X(Y)Z]]
7563 !! end
7564
7565 !! test
7566 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7567 !! options
7568 pst
7569 !! input
7570 [[Article (context), context|]]
7571 [[Article (context),context|]]
7572 [[Bar:Article (context), context|]]
7573 [[Bar:Article (context),context|]]
7574 [[:Bar:Article (context), context|]]
7575 [[:Bar:Article (context),context|]]
7576 !! result
7577 [[Article (context), context|Article]]
7578 [[Article (context),context|Article]]
7579 [[Bar:Article (context), context|Article]]
7580 [[Bar:Article (context),context|Article]]
7581 [[:Bar:Article (context), context|Article]]
7582 [[:Bar:Article (context),context|Article]]
7583 !! end
7584
7585 !! test
7586 pre-save transform: trim trailing empty lines
7587 !! options
7588 pst
7589 !! input
7590 Empty lines are trimmed
7591
7592
7593
7594
7595 !! result
7596 Empty lines are trimmed
7597 !! end
7598
7599 !! test
7600 pre-save transform: Signature expansion
7601 !! options
7602 pst
7603 !! input
7604 * ~~~
7605 * <noinclude>~~~</noinclude>
7606 * <includeonly>~~~</includeonly>
7607 * <onlyinclude>~~~</onlyinclude>
7608 !! result
7609 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7610 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7611 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7612 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7613 !! end
7614
7615
7616 !! test
7617 pre-save transform: Signature expansion in nowiki tags (bug 93)
7618 !! options
7619 pst disabled
7620 !! input
7621 Shall not expand:
7622
7623 <nowiki>~~~~</nowiki>
7624
7625 <includeonly><nowiki>~~~~</nowiki></includeonly>
7626
7627 <noinclude><nowiki>~~~~</nowiki></noinclude>
7628
7629 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7630
7631 {{subst:Foo}} shall be converted to FOO
7632
7633 As well as inside noinclude/onlyinclude
7634 <noinclude>{{subst:Foo}}</noinclude>
7635 <onlyinclude>{{subst:Foo}}</onlyinclude>
7636
7637 But not inside includeonly
7638 <includeonly>{{subst:Foo}}</includeonly>
7639 !! result
7640 Shall not expand:
7641
7642 <nowiki>~~~~</nowiki>
7643
7644 <includeonly><nowiki>~~~~</nowiki></includeonly>
7645
7646 <noinclude><nowiki>~~~~</nowiki></noinclude>
7647
7648 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7649
7650 FOO shall be converted to FOO
7651
7652 As well as inside noinclude/onlyinclude
7653 <noinclude>FOO</noinclude>
7654 <onlyinclude>FOO</onlyinclude>
7655
7656 But not inside includeonly
7657 <includeonly>{{subst:Foo}}</includeonly>
7658 !! end
7659
7660 ###
7661 ### Message transform tests
7662 ###
7663 !! test
7664 message transform: magic variables
7665 !! options
7666 msg
7667 !! input
7668 {{SITENAME}}
7669 !! result
7670 MediaWiki
7671 !! end
7672
7673 !! test
7674 message transform: should not transform wiki markup
7675 !! options
7676 msg
7677 !! input
7678 ''test''
7679 !! result
7680 ''test''
7681 !! end
7682
7683 !! test
7684 message transform: <noinclude> in transcluded template (bug 4926)
7685 !! options
7686 msg
7687 !! input
7688 {{Includes}}
7689 !! result
7690 Foobar
7691 !! end
7692
7693 !! test
7694 message transform: <onlyinclude> in transcluded template (bug 4926)
7695 !! options
7696 msg
7697 !! input
7698 {{Includes2}}
7699 !! result
7700 Foo
7701 !! end
7702
7703 !! test
7704 {{#special:}} page name, known
7705 !! options
7706 msg
7707 !! input
7708 {{#special:Recentchanges}}
7709 !! result
7710 Special:RecentChanges
7711 !! end
7712
7713 !! test
7714 {{#special:}} page name with subpage, known
7715 !! options
7716 msg
7717 !! input
7718 {{#special:Recentchanges/param}}
7719 !! result
7720 Special:RecentChanges/param
7721 !! end
7722
7723 !! test
7724 {{#special:}} page name, unknown
7725 !! options
7726 msg
7727 !! input
7728 {{#special:foobar nonexistent}}
7729 !! result
7730 Special:Foobar nonexistent
7731 !! end
7732
7733 !! test
7734 {{#speciale:}} page name, known
7735 !! options
7736 msg
7737 !! input
7738 {{#speciale:Recentchanges}}
7739 !! result
7740 Special:RecentChanges
7741 !! end
7742
7743 !! test
7744 {{#speciale:}} page name with subpage, known
7745 !! options
7746 msg
7747 !! input
7748 {{#speciale:Recentchanges/param}}
7749 !! result
7750 Special:RecentChanges/param
7751 !! end
7752
7753 !! test
7754 {{#speciale:}} page name, unknown
7755 !! options
7756 msg
7757 !! input
7758 {{#speciale:foobar nonexistent}}
7759 !! result
7760 Special:Foobar_nonexistent
7761 !! end
7762
7763 ###
7764 ### Images
7765 ###
7766 !! test
7767 Simple image
7768 !! input
7769 [[Image:foobar.jpg]]
7770 !! result
7771 <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>
7772 </p>
7773 !! end
7774
7775 !! test
7776 Right-aligned image
7777 !! input
7778 [[Image:foobar.jpg|right]]
7779 !! result
7780 <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>
7781
7782 !! end
7783
7784 !! test
7785 Simple image (using File: namespace, now canonical)
7786 !! input
7787 [[File:foobar.jpg]]
7788 !! result
7789 <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>
7790 </p>
7791 !! end
7792
7793 !! test
7794 Image with caption
7795 !! input
7796 [[Image:foobar.jpg|right|Caption text]]
7797 !! result
7798 <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>
7799
7800 !! end
7801
7802 !! test
7803 Image with empty attribute
7804 !! input
7805 [[Image:foobar.jpg|right||Caption text]]
7806 !! result
7807 <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>
7808
7809 !! end
7810
7811 !! test
7812 Image with link tails
7813 !! input
7814 123[[Image:foobar.jpg]]456
7815 123[[Image:foobar.jpg|right]]456
7816 123[[Image:foobar.jpg|thumb]]456
7817 !! result
7818 <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
7819 </p>
7820 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
7821 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
7822
7823 !! end
7824
7825 !! test
7826 Image with multiple captions -- only last one is accepted
7827 !! input
7828 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7829 !! result
7830 <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>
7831
7832 !! end
7833
7834 !! test
7835 Image with width attribute at different positions
7836 !! input
7837 [[Image:foobar.jpg|200px|right|Caption]]
7838 [[Image:foobar.jpg|right|200px|Caption]]
7839 [[Image:foobar.jpg|right|Caption|200px]]
7840 !! result
7841 <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>
7842 <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>
7843 <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>
7844
7845 !! end
7846
7847 !! test
7848 Image with link parameter, wiki target
7849 !! input
7850 [[Image:foobar.jpg|link=Target page]]
7851 !! result
7852 <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>
7853 </p>
7854 !! end
7855
7856 !! test
7857 Image with link parameter, URL target
7858 !! input
7859 [[Image:foobar.jpg|link=http://example.com/]]
7860 !! result
7861 <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>
7862 </p>
7863 !! end
7864
7865 !! test
7866 Image with link parameter, wgExternalLinkTarget
7867 !! input
7868 [[Image:foobar.jpg|link=http://example.com/]]
7869 !! config
7870 wgExternalLinkTarget='foobar'
7871 !! result
7872 <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>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Image with link parameter, wgNoFollowLinks set to false
7878 !! input
7879 [[Image:foobar.jpg|link=http://example.com/]]
7880 !! config
7881 wgNoFollowLinks=false
7882 !! result
7883 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7884 </p>
7885 !! end
7886
7887 !! test
7888 Image with link parameter, wgNoFollowDomainExceptions
7889 !! input
7890 [[Image:foobar.jpg|link=http://example.com/]]
7891 !! config
7892 wgNoFollowDomainExceptions='example.com'
7893 !! result
7894 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7895 </p>
7896 !! end
7897
7898 !! test
7899 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7900 !! input
7901 [[Image:foobar.jpg|link=http://example.com/|Title]]
7902 !! config
7903 wgExternalLinkTarget='foobar'
7904 !! result
7905 <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>
7906 </p>
7907 !! end
7908
7909 !! test
7910 Image with empty link parameter
7911 !! input
7912 [[Image:foobar.jpg|link=]]
7913 !! result
7914 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7915 </p>
7916 !! end
7917
7918 !! test
7919 Image with link parameter (wiki target) and unnamed parameter
7920 !! input
7921 [[Image:foobar.jpg|link=Target page|Title]]
7922 !! result
7923 <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>
7924 </p>
7925 !! end
7926
7927 !! test
7928 Image with link parameter (URL target) and unnamed parameter
7929 !! input
7930 [[Image:foobar.jpg|link=http://example.com/|Title]]
7931 !! result
7932 <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>
7933 </p>
7934 !! end
7935
7936 !! test
7937 Thumbnail image with link parameter
7938 !! options
7939 php
7940 !! input
7941 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7942 !! result
7943 <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>
7944
7945 !! end
7946
7947 !! test
7948 Manually-specified thumbnail image
7949 !! options
7950 php
7951 !! input
7952 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7953 !! result
7954 <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>
7955
7956 !! end
7957
7958 !! test
7959 Manually-specified thumbnail image with explicit link to wiki page
7960 !! options
7961 php
7962 !! input
7963 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7964 !! result
7965 <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>
7966
7967 !! end
7968
7969 !! test
7970 Manually-specified thumbnail image with explicit link to url
7971 !! options
7972 php
7973 !! input
7974 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7975 !! result
7976 <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>
7977
7978 !! end
7979
7980 !! test
7981 Manually-specified thumbnail image with explicit no link
7982 !! options
7983 php
7984 !! input
7985 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7986 !! result
7987 <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>
7988
7989 !! end
7990
7991 !! test
7992 Manually-specified thumbnail image with explicit link and alt text
7993 !! options
7994 php
7995 !! input
7996 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7997 !! result
7998 <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>
7999
8000 !! end
8001
8002 !! test
8003 Image with frame and link
8004 !! input
8005 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8006 !! result
8007 <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>
8008
8009 !! end
8010
8011 !! test
8012 Image with frame and link and explicit alt
8013 !! input
8014 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8015 !! result
8016 <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>
8017
8018 !! end
8019
8020 !! test
8021 Image with wiki markup in implicit alt
8022 !! input
8023 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8024 !! result
8025 <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>
8026 </p>
8027 !! end
8028
8029 !! test
8030 Image with wiki markup in explicit alt
8031 !! input
8032 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8033 !! result
8034 <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>
8035 </p>
8036 !! end
8037
8038 !! test
8039 Link to image page- image page normally doesn't exists, hence edit link
8040 Add test with existing image page
8041 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8042 !! input
8043 [[:Image:test]]
8044 !! result
8045 <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>
8046 </p>
8047 !! end
8048
8049 !! test
8050 bug 18784 Link to non-existent image page with caption should use caption as link text
8051 !! input
8052 [[:Image:test|caption]]
8053 !! result
8054 <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>
8055 </p>
8056 !! end
8057
8058 !! test
8059 Frameless image caption with a free URL
8060 !! input
8061 [[Image:foobar.jpg|http://example.com]]
8062 !! result
8063 <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>
8064 </p>
8065 !! end
8066
8067 !! test
8068 Thumbnail image caption with a free URL
8069 !! input
8070 [[Image:foobar.jpg|thumb|http://example.com]]
8071 !! result
8072 <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>
8073
8074 !! end
8075
8076 !! test
8077 Thumbnail image caption with a free URL and explicit alt
8078 !! input
8079 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8080 !! result
8081 <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>
8082
8083 !! end
8084
8085 !! test
8086 SVG thumbnails with no language set
8087 !! options
8088 !! input
8089 [[File:Foobar.svg|thumb|width=200]]
8090 !! result
8091 <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>
8092
8093 !! end
8094
8095 !! test
8096 SVG thumbnails with language de
8097 !! options
8098 !! input
8099 [[File:Foobar.svg|thumb|width=200|lang=de]]
8100 !! result
8101 <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>
8102
8103 !! end
8104
8105 !! test
8106 SVG thumbnails with invalid language code
8107 !! options
8108 !! input
8109 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8110 !! result
8111 <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>
8112
8113 !! end
8114
8115 !! test
8116 BUG 1887: A ISBN with a thumbnail
8117 !! input
8118 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8119 !! result
8120 <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>
8121
8122 !! end
8123
8124 !! test
8125 BUG 1887: A RFC with a thumbnail
8126 !! input
8127 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8128 !! result
8129 <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>
8130
8131 !! end
8132
8133 !! test
8134 BUG 1887: A mailto link with a thumbnail
8135 !! input
8136 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8137 !! result
8138 <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>
8139
8140 !! end
8141
8142 # Pending resolution to bug 368
8143 !! test
8144 BUG 648: Frameless image caption with a link
8145 !! input
8146 [[Image:foobar.jpg|text with a [[link]] in it]]
8147 !! result
8148 <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>
8149 </p>
8150 !! end
8151
8152 !! test
8153 BUG 648: Frameless image caption with a link (suffix)
8154 !! input
8155 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8156 !! result
8157 <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>
8158 </p>
8159 !! end
8160
8161 !! test
8162 BUG 648: Frameless image caption with an interwiki link
8163 !! input
8164 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8165 !! result
8166 <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>
8167 </p>
8168 !! end
8169
8170 !! test
8171 BUG 648: Frameless image caption with a piped interwiki link
8172 !! input
8173 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8174 !! result
8175 <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>
8176 </p>
8177 !! end
8178
8179 !! test
8180 Escape HTML special chars in image alt text
8181 !! input
8182 [[Image:foobar.jpg|& < > "]]
8183 !! result
8184 <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>
8185 </p>
8186 !! end
8187
8188 !! test
8189 BUG 499: Alt text should have &#1234;, not &amp;1234;
8190 !! input
8191 [[Image:foobar.jpg|&#9792;]]
8192 !! result
8193 <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>
8194 </p>
8195 !! end
8196
8197 !! test
8198 Broken image caption with link
8199 !! input
8200 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8201 !! result
8202 <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.
8203 </p>
8204 !! end
8205
8206 !! test
8207 Image caption containing another image
8208 !! input
8209 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8210 !! result
8211 <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>
8212
8213 !! end
8214
8215 !! test
8216 Image caption containing a newline
8217 !! input
8218 [[Image:Foobar.jpg|This
8219 *is some text]]
8220 !! result
8221 <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>
8222 </p>
8223 !!end
8224
8225 !!test
8226 Parsoid: Image caption containing leading space
8227 (The leading space should not trigger nowiki escaping in wt2wt mode)
8228 !! input
8229 [[Image:Foobar.jpg|thumb| bar]]
8230 !! result
8231 <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>
8232
8233 !!end
8234
8235 !! test
8236 Bug 3090: External links other than http: in image captions
8237 !! input
8238 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8239 !! result
8240 <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>
8241
8242 !! end
8243
8244 !! test
8245 Custom class
8246 !! input
8247 [[Image:foobar.jpg|a|class=b]]
8248 !! result
8249 <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>
8250 </p>
8251 !! end
8252
8253 !! test
8254 Localized image handling (1).
8255 !! options
8256 language=es
8257 !! input
8258 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8259 !! result
8260 <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>
8261
8262 !! end
8263
8264 !! test
8265 Localized image handling (2).
8266 !! options
8267 language=es
8268 !! input
8269 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8270 !! result
8271 <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>
8272
8273 !! end
8274
8275 !! test
8276 "border", "frameless" and "class" attributes on an image.
8277 !! input
8278 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8279 !! result
8280 <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>
8281 </p>
8282 !! end
8283
8284 !! article
8285 File:Barfoo.jpg
8286 !! text
8287 #REDIRECT [[File:Barfoo.jpg]]
8288 !! endarticle
8289
8290 !! test
8291 Redirected image
8292 !! input
8293 [[Image:Barfoo.jpg]]
8294 !! result
8295 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8296 </p>
8297 !! end
8298
8299 !! test
8300 Missing image with uploads disabled
8301 !! options
8302 wgEnableUploads=0
8303 !! input
8304 [[Image:Foobaz.jpg]]
8305 !! result
8306 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8307 </p>
8308 !! end
8309
8310 # Parsoid-specific testing for images
8311 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8312 # Currently imperfect due to a flaw in the Parsoid testrunner
8313 # Work in progress
8314
8315 !! test
8316 Parsoid-specific image handling - simple image
8317 !! options
8318 parsoid
8319 !! input
8320 [[Image:Foobar.jpg]]
8321 !! result
8322 <p>
8323 <span class="mw-default-size" typeof="mw:Image">
8324 <a href="File:Foobar.jpg">
8325 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8326 </a>
8327 </span>
8328 </p>
8329 !! end
8330
8331 !! test
8332 Parsoid-specific image handling - simple image without link
8333 !! options
8334 parsoid
8335 !! input
8336 [[Image:Foobar.jpg|link=]]
8337 !! result
8338 <p>
8339 <span class="mw-default-size" typeof="mw:Image">
8340 <span>
8341 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8342 </span>
8343 </span>
8344 </p>
8345 !! end
8346
8347 !! test
8348 Parsoid-specific image handling - simple image with specific link
8349 !! options
8350 parsoid
8351 !! input
8352 [[Image:Foobar.jpg|link=Main Page]]
8353 !! result
8354 <p>
8355 <span class="mw-default-size" typeof="mw:Image">
8356 <a href="Main_Page">
8357 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8358 </a>
8359 </span>
8360 </p>
8361 !! end
8362
8363 !! test
8364 Parsoid-specific image handling - simple image with size and middle alignment
8365 !! options
8366 parsoid
8367 !! input
8368 [[Image:Foobar.jpg|50px|middle]]
8369 !! result
8370 <p>
8371 <span class="mw-valign-middle" typeof="mw:Image">
8372 <a href="File:Foobar.jpg">
8373 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8374 </a>
8375 </span>
8376 </p>
8377 !! end
8378
8379 !! test
8380 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8381 !! options
8382 parsoid
8383 !! input
8384 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8385 !! result
8386 <p>
8387 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8388 <a href="File:Foobar.jpg">
8389 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8390 </a>
8391 </span>
8392 </p>
8393 !! end
8394
8395 !! test
8396 Parsoid-specific image handling - simple image with border and size spec
8397 !! options
8398 parsoid
8399 !! input
8400 [[Image:Foobar.jpg|50px|border|caption]]
8401 !! result
8402 <p>
8403 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8404 <a href="File:Foobar.jpg">
8405 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8406 </a>
8407 </span>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8413 !! options
8414 parsoid
8415 !! input
8416 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8417 !! result
8418 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8419 <a href="File:Foobar.jpg">
8420 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8421 </a>
8422 <figcaption>caption content</figcaption>
8423 </figure>
8424 !! end
8425
8426 !! test
8427 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8428 !! options
8429 parsoid
8430 !! input
8431 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8432 !! result
8433 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8434 <a href="File:Foobar.jpg">
8435 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8436 </a>
8437 <figcaption>caption</figcaption>
8438 </figure>
8439 !! end
8440
8441 !! test
8442 Parsoid-specific image handling - framed image with specific size and caption
8443 !! options
8444 parsoid
8445 !! input
8446 [[Image:Foobar.jpg|500x50px|frame|caption]]
8447 !! result
8448 <figure typeof="mw:Image/Frame">
8449 <a href="File:Foobar.jpg">
8450 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8451 </a>
8452 <figcaption>caption</figcaption>
8453 </figure>
8454 !! end
8455
8456 !! test
8457 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8458 !! options
8459 parsoid
8460 !! input
8461 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8462 !! result
8463 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8464 <a href="File:Foobar.jpg">
8465 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8466 </a>
8467 <figcaption>caption</figcaption>
8468 </figure>
8469 !! end
8470
8471 !! test
8472 Parsoid-specific image handling - frameless image with specific size, border, and caption
8473 !! options
8474 parsoid
8475 !! input
8476 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8477 !! result
8478 <p>
8479 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8480 <a href="File:Foobar.jpg">
8481 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8482 </a>
8483 </p>
8484 !! end
8485
8486 #!! test
8487 #Parsoid-specific image handling - simple image with a formatted caption
8488 #!! options
8489 #parsoid
8490 #!! input
8491 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8492 #!! result
8493 #<p>
8494 #<span typeof="mw:Image">
8495 #<a class="mw-default-size" href="Image:Foobar.jpg">
8496 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8497 #</a>
8498 #<span>abc</span>
8499 #</span>
8500 #</p>
8501
8502
8503 ###
8504 ### Subpages
8505 ###
8506 !! article
8507 Subpage test/subpage
8508 !! text
8509 foo
8510 !! endarticle
8511
8512 !! test
8513 Subpage link
8514 !! options
8515 subpage title=[[Subpage test]]
8516 !! input
8517 [[/subpage]]
8518 !! result
8519 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8520 </p>
8521 !! end
8522
8523 !! test
8524 Subpage noslash link
8525 !! options
8526 subpage title=[[Subpage test]]
8527 !!input
8528 [[/subpage/]]
8529 !! result
8530 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8531 </p>
8532 !! end
8533
8534 # TODO: make this PHP-parser compatible!
8535 !! test
8536 Relative subpage noslash link
8537 !! options
8538 parsoid=wt2wt,wt2html,html2html
8539 subpage title=[[Subpage test/1/2/3/4]]
8540 !!input
8541 [[../../subpage/]]
8542
8543 [[../../subpage]]
8544 !! result
8545 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8546 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8547 !! end
8548
8549 # TODO: make this PHP-parser compatible!
8550 !! test
8551 Parsoid: dot-slash prefixed wikilinks
8552 !! options
8553 parsoid=wt2wt,wt2html,html2html
8554 !!input
8555 [[./foo]]
8556
8557 [[././bar]]
8558
8559 [[././baz/]]
8560 !! result
8561 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8562 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8563 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8564 !! end
8565
8566 !! test
8567 Disabled subpages
8568 !! input
8569 [[/subpage]]
8570 !! result
8571 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8572 </p>
8573 !! end
8574
8575 !! test
8576 BUG 561: {{/Subpage}}
8577 !! options
8578 subpage title=[[Page]]
8579 !! input
8580 {{/Subpage}}
8581 !! result
8582 <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>
8583 </p>
8584 !! end
8585
8586 ###
8587 ### Categories
8588 ###
8589 !! article
8590 Category:MediaWiki User's Guide
8591 !! text
8592 blah
8593 !! endarticle
8594
8595 !! test
8596 Link to category
8597 !! input
8598 [[:Category:MediaWiki User's Guide]]
8599 !! result
8600 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8601 </p>
8602 !! end
8603
8604 !! test
8605 Simple category
8606 !! options
8607 cat
8608 !! input
8609 [[Category:MediaWiki User's Guide]]
8610 !! result
8611 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8612 !! end
8613
8614 !! test
8615 PAGESINCATEGORY invalid title fatal (r33546 fix)
8616 !! input
8617 {{PAGESINCATEGORY:<bogus>}}
8618 !! result
8619 <p>0
8620 </p>
8621 !! end
8622
8623 !! test
8624 Category with different sort key
8625 !! options
8626 cat
8627 !! input
8628 [[Category:MediaWiki User's Guide|Foo]]
8629 !! result
8630 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8631 !! end
8632
8633 !! test
8634 Category with identical sort key
8635 !! options
8636 cat
8637 !! input
8638 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8639 !! result
8640 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8641 !! end
8642
8643 !! test
8644 Category with empty sort key
8645 !! options
8646 cat
8647 pst
8648 !! input
8649 [[Category:MediaWiki User's Guide|]]
8650 !! result
8651 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8652 !! end
8653
8654 !! test
8655 Category with empty sort key and parentheses
8656 !! options
8657 cat
8658 pst
8659 !! input
8660 [[Category:Foo (bar)|]]
8661 !! result
8662 [[Category:Foo (bar)|Foo]]
8663 !! end
8664
8665 !! test
8666 Category with link tail
8667 !! options
8668 cat
8669 pst
8670 !! input
8671 123[[Category:Foo]]456
8672 !! result
8673 123[[Category:Foo]]456
8674 !! end
8675
8676 !! test
8677 Category with template
8678 !! options
8679 cat
8680 pst
8681 !! input
8682 [[Category:{{echo|Foo}}]]
8683 !! result
8684 [[Category:{{echo|Foo}}]]
8685 !! end
8686
8687 !! test
8688 Category with template in sort key
8689 !! options
8690 cat
8691 pst
8692 !! input
8693 [[Category:Foo|{{echo|Bar}}]]
8694 !! result
8695 [[Category:Foo|{{echo|Bar}}]]
8696 !! end
8697
8698 !! test
8699 Category with template in sort key and title
8700 !! options
8701 cat
8702 pst
8703 !! input
8704 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8705 !! result
8706 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8707 !! end
8708
8709 !! test
8710 Category / paragraph interactions
8711 !! input
8712 Foo [[Category:Baz]] Bar
8713
8714 Foo [[Category:Baz]]
8715 Bar
8716
8717 Foo
8718 [[Category:Baz]]
8719 Bar
8720
8721 Foo
8722 [[Category:Baz]] Bar
8723
8724 Foo
8725 [[Category:Baz]]
8726 [[Category:Baz]]
8727 [[Category:Baz]]
8728 Bar
8729
8730 [[Category:Baz]]
8731 [[Category:Baz]]
8732 [[Category:Baz]]
8733
8734 [[Category:Baz]]
8735 {{echo|[[Category:Baz]]}}
8736 [[Category:Baz]]
8737 !! result
8738 <p>Foo Bar
8739 </p><p>Foo
8740 Bar
8741 </p><p>Foo
8742 Bar
8743 </p><p>Foo Bar
8744 </p><p>Foo
8745 Bar
8746 </p>
8747 !! end
8748
8749 !! test
8750 Parsoid: Serialize link to category page with colon escape
8751 !! options
8752 parsoid
8753 !! input
8754
8755 [[:Category:Foo]]
8756 [[:Category:Foo|Bar]]
8757 !! result
8758 <p>
8759 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8760 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8761 </p>
8762 !! end
8763
8764 !! test
8765 Parsoid: Serialize link to file page with colon escape
8766 !! options
8767 parsoid
8768 !! input
8769
8770 [[:File:Foo.png]]
8771 [[:File:Foo.png|Bar]]
8772 !! result
8773 <p>
8774 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8775 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8776 </p>
8777 !! end
8778
8779 !! test
8780 Parsoid: Serialize a genuine category link without colon escape
8781 !! options
8782 parsoid
8783 !! input
8784 [[Category:Foo]]
8785 [[Category:Foo|Bar]]
8786 !! result
8787 <link rel="mw:WikiLink/Category" href="Category:Foo">
8788 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8789 !! end
8790
8791 ###
8792 ### Inter-language links
8793 ###
8794 !! test
8795 Inter-language links
8796 !! options
8797 ill
8798 !! input
8799 [[es:Alimento]]
8800 [[fr:Nourriture]]
8801 [[zh:&#39135;&#21697;]]
8802 !! result
8803 es:Alimento fr:Nourriture zh:食品
8804 !! end
8805
8806 !! test
8807 Duplicate interlanguage links (bug 24502)
8808 !! options
8809 ill
8810 !! input
8811 [[es:1]]
8812 [[es:2]]
8813 [[fr:1]]
8814 [[fr:2]]
8815 !! result
8816 es:1 fr:1
8817 !! end
8818
8819 ###
8820 ### Sections
8821 ###
8822 !! test
8823 Basic section headings
8824 !! input
8825 == Headline 1 ==
8826 Some text
8827
8828 ==Headline 2==
8829 More
8830 ===Smaller headline===
8831 Blah blah
8832 !! result
8833 <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>
8834 <p>Some text
8835 </p>
8836 <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>
8837 <p>More
8838 </p>
8839 <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>
8840 <p>Blah blah
8841 </p>
8842 !! end
8843
8844 !! test
8845 Section headings with TOC
8846 !! input
8847 == Headline 1 ==
8848 === Subheadline 1 ===
8849 ===== Skipping a level =====
8850 ====== Skipping a level ======
8851
8852 == Headline 2 ==
8853 Some text
8854 ===Another headline===
8855 !! result
8856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8857 <ul>
8858 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8859 <ul>
8860 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8861 <ul>
8862 <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>
8863 <ul>
8864 <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>
8865 </ul>
8866 </li>
8867 </ul>
8868 </li>
8869 </ul>
8870 </li>
8871 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8872 <ul>
8873 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8874 </ul>
8875 </li>
8876 </ul>
8877 </div>
8878 <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>
8879 <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>
8880 <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>
8881 <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>
8882 <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>
8883 <p>Some text
8884 </p>
8885 <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>
8886
8887 !! end
8888
8889 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8890 !! test
8891 Handling of sections up to level 6 and beyond
8892 !! input
8893 = Level 1 Heading=
8894 == Level 2 Heading==
8895 === Level 3 Heading===
8896 ==== Level 4 Heading====
8897 ===== Level 5 Heading=====
8898 ====== Level 6 Heading======
8899 ======= Level 7 Heading=======
8900 ======== Level 8 Heading========
8901 ========= Level 9 Heading=========
8902 ========== Level 10 Heading==========
8903 !! result
8904 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8905 <ul>
8906 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8907 <ul>
8908 <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>
8909 <ul>
8910 <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>
8911 <ul>
8912 <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>
8913 <ul>
8914 <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>
8915 <ul>
8916 <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>
8917 <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>
8918 <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>
8919 <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>
8920 <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>
8921 </ul>
8922 </li>
8923 </ul>
8924 </li>
8925 </ul>
8926 </li>
8927 </ul>
8928 </li>
8929 </ul>
8930 </li>
8931 </ul>
8932 </div>
8933 <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>
8934 <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>
8935 <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>
8936 <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>
8937 <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>
8938 <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>
8939 <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>
8940 <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>
8941 <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>
8942 <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>
8943
8944 !! end
8945
8946 !! test
8947 TOC regression (bug 9764)
8948 !! input
8949 == title 1 ==
8950 === title 1.1 ===
8951 ==== title 1.1.1 ====
8952 === title 1.2 ===
8953 == title 2 ==
8954 === title 2.1 ===
8955 !! result
8956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8957 <ul>
8958 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8959 <ul>
8960 <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>
8961 <ul>
8962 <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>
8963 </ul>
8964 </li>
8965 <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>
8966 </ul>
8967 </li>
8968 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8969 <ul>
8970 <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>
8971 </ul>
8972 </li>
8973 </ul>
8974 </div>
8975 <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>
8976 <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>
8977 <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>
8978 <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>
8979 <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>
8980 <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>
8981
8982 !! end
8983
8984 !! test
8985 TOC with wgMaxTocLevel=3 (bug 6204)
8986 !! options
8987 wgMaxTocLevel=3
8988 !! input
8989 == title 1 ==
8990 === title 1.1 ===
8991 ==== title 1.1.1 ====
8992 === title 1.2 ===
8993 == title 2 ==
8994 === title 2.1 ===
8995 !! result
8996 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8997 <ul>
8998 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8999 <ul>
9000 <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>
9001 <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>
9002 </ul>
9003 </li>
9004 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9005 <ul>
9006 <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>
9007 </ul>
9008 </li>
9009 </ul>
9010 </div>
9011 <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>
9012 <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>
9013 <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>
9014 <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>
9015 <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>
9016 <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>
9017
9018 !! end
9019
9020 !! test
9021 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9022 !! options
9023 wgMaxTocLevel=3
9024 !! input
9025 ==Section 1==
9026 ===Section 1.1===
9027 ====Section 1.1.1====
9028 ====Section 1.1.1.1====
9029 ==Section 2==
9030 !! result
9031 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9032 <ul>
9033 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9034 <ul>
9035 <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>
9036 </ul>
9037 </li>
9038 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9039 </ul>
9040 </div>
9041 <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>
9042 <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>
9043 <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>
9044 <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>
9045 <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>
9046
9047 !! end
9048
9049
9050 !! test
9051 Resolving duplicate section names
9052 !! input
9053 == Foo bar ==
9054 == Foo bar ==
9055 !! result
9056 <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>
9057 <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>
9058
9059 !! end
9060
9061 !! test
9062 Resolving duplicate section names with differing case (bug 10721)
9063 !! input
9064 == Foo bar ==
9065 == Foo Bar ==
9066 !! result
9067 <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>
9068 <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>
9069
9070 !! end
9071
9072 !! article
9073 Template:sections
9074 !! text
9075 ===Section 1===
9076 ==Section 2==
9077 !! endarticle
9078
9079 !! test
9080 Template with sections, __NOTOC__
9081 !! input
9082 __NOTOC__
9083 ==Section 0==
9084 {{sections}}
9085 ==Section 4==
9086 !! result
9087 <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>
9088 <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>
9089 <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>
9090 <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>
9091
9092 !! end
9093
9094 !! test
9095 __NOEDITSECTION__ keyword
9096 !! input
9097 __NOEDITSECTION__
9098 ==Section 1==
9099 ==Section 2==
9100 !! result
9101 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9102 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9103
9104 !! end
9105
9106 !! test
9107 Link inside a section heading
9108 !! input
9109 ==Section with a [[Main Page|link]] in it==
9110 !! result
9111 <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>
9112
9113 !! end
9114
9115 !! test
9116 TOC regression (bug 12077)
9117 !! input
9118 __TOC__
9119 == title 1 ==
9120 === title 1.1 ===
9121 == title 2 ==
9122 !! result
9123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9124 <ul>
9125 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9126 <ul>
9127 <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>
9128 </ul>
9129 </li>
9130 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9131 </ul>
9132 </div>
9133 <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>
9134 <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>
9135 <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>
9136
9137 !! end
9138
9139 !! test
9140 BUG 1219 URL next to image (good)
9141 !! input
9142 http://example.com [[Image:foobar.jpg]]
9143 !! result
9144 <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>
9145 </p>
9146 !!end
9147
9148 !! test
9149 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9150 !! input
9151 ===
9152 The line above must have a trailing space!
9153 === <!--
9154 --> <!-- -->
9155 But just in case it doesn't...
9156 !! result
9157 <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>
9158 <p>The line above must have a trailing space!
9159 </p>
9160 <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>
9161 <p>But just in case it doesn't...
9162 </p>
9163 !! end
9164
9165 !! test
9166 Header with special characters (bug 25462)
9167 !! input
9168 The tooltips shall not show entities to the user (ie. be double escaped)
9169
9170 == text > text ==
9171 section 1
9172
9173 == text < text ==
9174 section 2
9175
9176 == text & text ==
9177 section 3
9178
9179 == text ' text ==
9180 section 4
9181
9182 == text " text ==
9183 section 5
9184 !! result
9185 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9186 </p>
9187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9188 <ul>
9189 <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>
9190 <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>
9191 <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>
9192 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9193 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9194 </ul>
9195 </div>
9196 <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>
9197 <p>section 1
9198 </p>
9199 <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>
9200 <p>section 2
9201 </p>
9202 <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>
9203 <p>section 3
9204 </p>
9205 <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>
9206 <p>section 4
9207 </p>
9208 <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>
9209 <p>section 5
9210 </p>
9211 !! end
9212
9213 !! test
9214 Headers with excess '=' characters
9215 (Are similar tests necessary beyond the 1st level?)
9216 !! input
9217 =foo==
9218 ==foo=
9219 =''italic'' heading==
9220 ==''italic'' heading=
9221 !! result
9222 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9223 <ul>
9224 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9225 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9226 <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>
9227 <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>
9228 </ul>
9229 </div>
9230 <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>
9231 <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>
9232 <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>
9233 <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>
9234
9235 !! end
9236
9237 !! test
9238 HTML headers vs TOC (bug 23393)
9239 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9240 !! input
9241 <h1>Header 1</h1>
9242 == Header 1.1 ==
9243 == Header 1.2 ==
9244
9245 <h1>Header 2
9246 </h1>
9247 == Header 2.1 ==
9248 == Header 2.2 ==
9249 __NOEDITSECTION__
9250 !! result
9251 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9252 <ul>
9253 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9254 <ul>
9255 <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>
9256 <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>
9257 </ul>
9258 </li>
9259 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9260 <ul>
9261 <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>
9262 <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>
9263 </ul>
9264 </li>
9265 </ul>
9266 </div>
9267 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9268 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9269 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9270 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9271 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9272 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9273
9274 !! end
9275
9276 !! test
9277 BUG 1219 URL next to image (broken)
9278 !! input
9279 http://example.com[[Image:foobar.jpg]]
9280 !! result
9281 <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>
9282 </p>
9283 !!end
9284
9285 !! test
9286 Bug 1186 news: in the middle of text
9287 !! input
9288 http://en.wikinews.org/wiki/Wikinews:Workplace
9289 !! result
9290 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9291 </p>
9292 !!end
9293
9294
9295 !! test
9296 Namespaced link must have a title
9297 !! input
9298 [[Project:]]
9299 !! result
9300 <p>[[Project:]]
9301 </p>
9302 !!end
9303
9304 !! test
9305 Namespaced link must have a title (bad fragment version)
9306 !! input
9307 [[Project:#fragment]]
9308 !! result
9309 <p>[[Project:#fragment]]
9310 </p>
9311 !!end
9312
9313
9314 ###
9315 ### HTML tags and HTML attributes
9316 ###
9317
9318 !! test
9319 div with no attributes
9320 !! input
9321 <div>HTML rocks</div>
9322 !! result
9323 <div>HTML rocks</div>
9324
9325 !! end
9326
9327 !! test
9328 div with double-quoted attribute
9329 !! input
9330 <div id="rock">HTML rocks</div>
9331 !! result
9332 <div id="rock">HTML rocks</div>
9333
9334 !! end
9335
9336 !! test
9337 div with single-quoted attribute
9338 !! input
9339 <div id='rock'>HTML rocks</div>
9340 !! result
9341 <div id="rock">HTML rocks</div>
9342
9343 !! end
9344
9345 !! test
9346 div with unquoted attribute
9347 !! input
9348 <div id=rock>HTML rocks</div>
9349 !! result
9350 <div id="rock">HTML rocks</div>
9351
9352 !! end
9353
9354 !! test
9355 div with illegal double attributes
9356 !! input
9357 <div id="a" id="b">HTML rocks</div>
9358 !! result
9359 <div id="b">HTML rocks</div>
9360
9361 !!end
9362
9363 # FIXME: produce empty string instead of "class" in the PHP parser, following
9364 # the HTML5 spec.
9365 !! test
9366 div with empty attribute value, space before equals
9367 !! options
9368 parsoid
9369 !! input
9370 <div class =>HTML rocks</div>
9371 !! result
9372 <div class="">HTML rocks</div>
9373
9374 !! end
9375
9376 # The PHP parser escapes the opening brace to &#123; for some reason, so
9377 # disabled this test for it.
9378 !! test
9379 div with braces in attribute value
9380 !! options
9381 parsoid
9382 !! input
9383 <div title="{}">Foo</div>
9384 !! result
9385 <div title="{}">Foo</div>
9386 !! end
9387
9388 # This it very inconsistent in the PHP parser: it returns
9389 # class="class" if there is a space between the name and the equal sign (see
9390 # 'div with empty attribute value, space before equals'), but strips the
9391 # attribute completely if the space is missing. We hope that not much content
9392 # depends on this, so are implementing the behavior below in Parsoid for
9393 # consistencies' sake. Disabled for the PHP parser.
9394 # FIXME: fix this behavior in the PHP parser?
9395 !! test
9396 div with empty attribute value, no space before equals
9397 !! options
9398 parsoid
9399 !! input
9400 <div class=>HTML rocks</div>
9401 !! result
9402 <div class="">HTML rocks</div>
9403
9404 !! end
9405
9406 !! test
9407 HTML multiple attributes correction
9408 !! input
9409 <p class="error" class="awesome">Awesome!</p>
9410 !! result
9411 <p class="awesome">Awesome!</p>
9412
9413 !!end
9414
9415 !! test
9416 Table multiple attributes correction
9417 !! input
9418 {|
9419 !+ class="error" class="awesome"| status
9420 |}
9421 !! result
9422 <table>
9423 <tr>
9424 <th class="awesome"> status
9425 </th></tr></table>
9426
9427 !!end
9428
9429 !! test
9430 DIV IN UPPERCASE
9431 !! input
9432 <DIV ID="x">HTML ROCKS</DIV>
9433 !! result
9434 <div id="x">HTML ROCKS</div>
9435
9436 !!end
9437
9438 !! test
9439 Non-ASCII pseudo-tags are rendered as text
9440 !! input
9441 <khyô>
9442 !! result
9443 <p>&lt;khyô&gt;
9444 </p>
9445 !! end
9446
9447 !! test
9448 Pseudo-tag with URL 'name' renders as url link
9449 !! input
9450 <http://example.com/>
9451 !! result
9452 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9453 </p>
9454 !! end
9455
9456 !! test
9457 text with amp in the middle of nowhere
9458 !! input
9459 Remember AT&T?
9460 !!result
9461 <p>Remember AT&amp;T?
9462 </p>
9463 !! end
9464
9465 !! test
9466 text with character entity: eacute
9467 !! input
9468 I always thought &eacute; was a cute letter.
9469 !! result
9470 <p>I always thought &#233; was a cute letter.
9471 </p>
9472 !! end
9473
9474 !! test
9475 text with entity-escaped character entity-like string: eacute
9476 !! input
9477 I always thought &amp;eacute; was a cute letter.
9478 !! result
9479 <p>I always thought &amp;eacute; was a cute letter.
9480 </p>
9481 !! end
9482
9483 !! test
9484 text with undefined character entity: xacute
9485 !! input
9486 I always thought &xacute; was a cute letter.
9487 !! result
9488 <p>I always thought &amp;xacute; was a cute letter.
9489 </p>
9490 !! end
9491
9492
9493 ###
9494 ### Media links
9495 ###
9496
9497 !! test
9498 Media link
9499 !! input
9500 [[Media:Foobar.jpg]]
9501 !! result
9502 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9503 </p>
9504 !! end
9505
9506 !! test
9507 Media link with text
9508 !! input
9509 [[Media:Foobar.jpg|A neat file to look at]]
9510 !! result
9511 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9512 </p>
9513 !! end
9514
9515 # FIXME: this is still bad HTML tag nesting
9516 !! test
9517 Media link with nasty text
9518 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9519 !! input
9520 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9521 !! result
9522 <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>
9523
9524 !! end
9525
9526 !! test
9527 Media link to nonexistent file (bug 1702)
9528 !! input
9529 [[Media:No such.jpg]]
9530 !! result
9531 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9532 </p>
9533 !! end
9534
9535 !! test
9536 Image link to nonexistent file (bug 1850 - good)
9537 !! input
9538 [[Image:No such.jpg]]
9539 !! result
9540 <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>
9541 </p>
9542 !! end
9543
9544 !! test
9545 :Image link to nonexistent file (bug 1850 - bad)
9546 !! input
9547 [[:Image:No such.jpg]]
9548 !! result
9549 <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>
9550 </p>
9551 !! end
9552
9553
9554
9555 !! test
9556 Character reference normalization in link text (bug 1938)
9557 !! input
9558 [[Main Page|this&that]]
9559 !! result
9560 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9561 </p>
9562 !!end
9563
9564 !! article
9565 אַ
9566 !! text
9567 Test for unicode normalization
9568
9569 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9570 !! endarticle
9571
9572 !! test
9573 (bug 19451) Links should refer to the normalized form.
9574 !! input
9575 [[&#xFB2E;]]
9576 [[&#x5d0;&#x5b7;]]
9577 [[&#x5d0;ַ]]
9578 [[א&#x5b7;]]
9579 [[אַ]]
9580 !! result
9581 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9582 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9583 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9584 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9585 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9586 </p>
9587 !! end
9588
9589 !! test
9590 Empty attribute crash test (bug 2067)
9591 !! input
9592 <font color="">foo</font>
9593 !! result
9594 <p><font color="">foo</font>
9595 </p>
9596 !! end
9597
9598 !! test
9599 Empty attribute crash test single-quotes (bug 2067)
9600 !! input
9601 <font color=''>foo</font>
9602 !! result
9603 <p><font color="">foo</font>
9604 </p>
9605 !! end
9606
9607 !! test
9608 Attribute test: equals, then nothing
9609 !! input
9610 <font color=>foo</font>
9611 !! result
9612 <p><font>foo</font>
9613 </p>
9614 !! end
9615
9616 !! test
9617 Attribute test: unquoted value
9618 !! input
9619 <font color=x>foo</font>
9620 !! result
9621 <p><font color="x">foo</font>
9622 </p>
9623 !! end
9624
9625 !! test
9626 Attribute test: unquoted but illegal value (hash)
9627 !! input
9628 <font color=#x>foo</font>
9629 !! result
9630 <p><font color="#x">foo</font>
9631 </p>
9632 !! end
9633
9634 !! test
9635 Attribute test: no value
9636 !! input
9637 <font color>foo</font>
9638 !! result
9639 <p><font color="color">foo</font>
9640 </p>
9641 !! end
9642
9643 !! test
9644 Bug 2095: link with three closing brackets
9645 !! input
9646 [[Main Page]]]
9647 !! result
9648 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9649 </p>
9650 !! end
9651
9652 !! test
9653 Bug 2095: link with pipe and three closing brackets
9654 !! input
9655 [[Main Page|link]]]
9656 !! result
9657 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9658 </p>
9659 !! end
9660
9661 !! test
9662 Bug 2095: link with pipe and three closing brackets, version 2
9663 !! input
9664 [[Main Page|[http://example.com/]]]
9665 !! result
9666 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9667 </p>
9668 !! end
9669
9670
9671 ###
9672 ### Safety
9673 ###
9674
9675 !! article
9676 Template:Dangerous attribute
9677 !! text
9678 " onmouseover="alert(document.cookie)
9679 !! endarticle
9680
9681 !! article
9682 Template:Dangerous style attribute
9683 !! text
9684 border-size: expression(alert(document.cookie))
9685 !! endarticle
9686
9687 !! article
9688 Template:Div style
9689 !! text
9690 <div style="float: right; {{{1}}}">Magic div</div>
9691 !! endarticle
9692
9693 !! test
9694 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9695 !! input
9696 <div title="{{test}}"></div>
9697 !! result
9698 <div title="This is a test template"></div>
9699
9700 !! end
9701
9702 !! test
9703 Bug 2304: HTML attribute safety (dangerous template; 2309)
9704 !! input
9705 <div title="{{dangerous attribute}}"></div>
9706 !! result
9707 <div title=""></div>
9708
9709 !! end
9710
9711 !! test
9712 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9713 !! input
9714 <div style="{{dangerous style attribute}}"></div>
9715 !! result
9716 <div style="/* insecure input */"></div>
9717
9718 !! end
9719
9720 !! test
9721 Bug 2304: HTML attribute safety (safe parameter; 2309)
9722 !! input
9723 {{div style|width: 200px}}
9724 !! result
9725 <div style="float: right; width: 200px">Magic div</div>
9726
9727 !! end
9728
9729 !! test
9730 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9731 !! input
9732 {{div style|width: expression(alert(document.cookie))}}
9733 !! result
9734 <div style="/* insecure input */">Magic div</div>
9735
9736 !! end
9737
9738 !! test
9739 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9740 !! input
9741 {{div style|"><script>alert(document.cookie)</script>}}
9742 !! result
9743 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9744
9745 !! end
9746
9747 !! test
9748 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9749 !! input
9750 {{div style|" ><script>alert(document.cookie)</script>}}
9751 !! result
9752 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9753
9754 !! end
9755
9756 !! test
9757 Bug 2304: HTML attribute safety (link)
9758 !! input
9759 <div title="[[Main Page]]"></div>
9760 !! result
9761 <div title="&#91;&#91;Main Page]]"></div>
9762
9763 !! end
9764
9765 !! test
9766 Bug 2304: HTML attribute safety (italics)
9767 !! input
9768 <div title="''foobar''"></div>
9769 !! result
9770 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9771
9772 !! end
9773
9774 !! test
9775 Bug 2304: HTML attribute safety (bold)
9776 !! input
9777 <div title="'''foobar'''"></div>
9778 !! result
9779 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9780
9781 !! end
9782
9783
9784 !! test
9785 Bug 2304: HTML attribute safety (ISBN)
9786 !! input
9787 <div title="ISBN 1234567890"></div>
9788 !! result
9789 <div title="&#73;SBN 1234567890"></div>
9790
9791 !! end
9792
9793 !! test
9794 Bug 2304: HTML attribute safety (RFC)
9795 !! input
9796 <div title="RFC 1234"></div>
9797 !! result
9798 <div title="&#82;FC 1234"></div>
9799
9800 !! end
9801
9802 !! test
9803 Bug 2304: HTML attribute safety (PMID)
9804 !! input
9805 <div title="PMID 1234567890"></div>
9806 !! result
9807 <div title="&#80;MID 1234567890"></div>
9808
9809 !! end
9810
9811 !! test
9812 Bug 2304: HTML attribute safety (web link)
9813 !! input
9814 <div title="http://example.com/"></div>
9815 !! result
9816 <div title="http&#58;//example.com/"></div>
9817
9818 !! end
9819
9820 !! test
9821 Bug 2304: HTML attribute safety (named web link)
9822 !! input
9823 <div title="[http://example.com/ link]"></div>
9824 !! result
9825 <div title="&#91;http&#58;//example.com/ link]"></div>
9826
9827 !! end
9828
9829 !! test
9830 Bug 3244: HTML attribute safety (extension; safe)
9831 !! input
9832 <div style="<nowiki>background:blue</nowiki>"></div>
9833 !! result
9834 <div style="background:blue"></div>
9835
9836 !! end
9837
9838 !! test
9839 Bug 3244: HTML attribute safety (extension; unsafe)
9840 !! input
9841 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9842 !! result
9843 <div style="/* insecure input */"></div>
9844
9845 !! end
9846
9847 # More MSIE fun discovered by Tom Gilder
9848
9849 !! test
9850 MSIE CSS safety test: spurious slash
9851 !! input
9852 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9853 !! result
9854 <div style="/* insecure input */">evil</div>
9855
9856 !! end
9857
9858 !! test
9859 MSIE CSS safety test: hex code
9860 !! input
9861 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9862 !! result
9863 <div style="/* insecure input */">evil</div>
9864
9865 !! end
9866
9867 !! test
9868 MSIE CSS safety test: comment in url
9869 !! input
9870 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9871 !! result
9872 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9873
9874 !! end
9875
9876 !! test
9877 MSIE CSS safety test: comment in expression
9878 !! input
9879 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9880 !! result
9881 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9882
9883 !! end
9884
9885
9886 !! test
9887 Table attribute legitimate extension
9888 !! input
9889 {|
9890 !+ style="<nowiki>color:blue</nowiki>"| status
9891 |}
9892 !! result
9893 <table>
9894 <tr>
9895 <th style="color:blue"> status
9896 </th></tr></table>
9897
9898 !!end
9899
9900 !! test
9901 Table attribute safety
9902 !! input
9903 {|
9904 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9905 |}
9906 !! result
9907 <table>
9908 <tr>
9909 <th style="/* insecure input */"> status
9910 </th></tr></table>
9911
9912 !! end
9913
9914 !! test
9915 CSS line continuation 1
9916 !! input
9917 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9918 !! result
9919 <div style="/* insecure input */"></div>
9920
9921 !! end
9922
9923 !! test
9924 CSS line continuation 2
9925 !! input
9926 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9927 !! result
9928 <div style="/* insecure input */"></div>
9929
9930 !! end
9931
9932 !! article
9933 Template:Identity
9934 !! text
9935 {{{1}}}
9936 !! endarticle
9937
9938 !! test
9939 Expansion of multi-line templates in attribute values (bug 6255)
9940 !! input
9941 <div style="background: {{identity|#00FF00}}">-</div>
9942 !! result
9943 <div style="background: #00FF00">-</div>
9944
9945 !! end
9946
9947
9948 !! test
9949 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9950 !! input
9951 <div style="background:
9952 #00FF00">-</div>
9953 !! result
9954 <div style="background: #00FF00">-</div>
9955
9956 !! end
9957
9958 !! test
9959 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9960 !! input
9961 <div style="background: &#10;#00FF00">-</div>
9962 !! result
9963 <div style="background: &#10;#00FF00">-</div>
9964
9965 !! end
9966
9967 ###
9968 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9969 ###
9970 !! test
9971 Parser hook: empty input
9972 !! input
9973 <tag></tag>
9974 !! result
9975 <pre>
9976 ''
9977 array (
9978 )
9979 </pre>
9980
9981 !! end
9982
9983 !! test
9984 Parser hook: empty input using terminated empty elements
9985 !! input
9986 <tag/>
9987 !! result
9988 <pre>
9989 NULL
9990 array (
9991 )
9992 </pre>
9993
9994 !! end
9995
9996 !! test
9997 Parser hook: empty input using terminated empty elements (space before)
9998 !! input
9999 <tag />
10000 !! result
10001 <pre>
10002 NULL
10003 array (
10004 )
10005 </pre>
10006
10007 !! end
10008
10009 !! test
10010 Parser hook: basic input
10011 !! input
10012 <tag>input</tag>
10013 !! result
10014 <pre>
10015 'input'
10016 array (
10017 )
10018 </pre>
10019
10020 !! end
10021
10022
10023 !! test
10024 Parser hook: case insensitive
10025 !! input
10026 <TAG>input</TAG>
10027 !! result
10028 <pre>
10029 'input'
10030 array (
10031 )
10032 </pre>
10033
10034 !! end
10035
10036
10037 !! test
10038 Parser hook: case insensitive, redux
10039 !! input
10040 <TaG>input</TAg>
10041 !! result
10042 <pre>
10043 'input'
10044 array (
10045 )
10046 </pre>
10047
10048 !! end
10049
10050 !! test
10051 Parser hook: nested tags
10052 !! options
10053 noxml
10054 !! input
10055 <tag><tag></tag></tag>
10056 !! result
10057 <pre>
10058 '<tag>'
10059 array (
10060 )
10061 </pre>&lt;/tag&gt;
10062
10063 !! end
10064
10065 !! test
10066 Parser hook: basic arguments
10067 !! input
10068 <tag width=200 height = "100" depth = '50' square></tag>
10069 !! result
10070 <pre>
10071 ''
10072 array (
10073 'width' => '200',
10074 'height' => '100',
10075 'depth' => '50',
10076 'square' => 'square',
10077 )
10078 </pre>
10079
10080 !! end
10081
10082 !! test
10083 Parser hook: argument containing a forward slash (bug 5344)
10084 !! input
10085 <tag filename='/tmp/bla'></tag>
10086 !! result
10087 <pre>
10088 ''
10089 array (
10090 'filename' => '/tmp/bla',
10091 )
10092 </pre>
10093
10094 !! end
10095
10096 !! test
10097 Parser hook: empty input using terminated empty elements (bug 2374)
10098 !! input
10099 <tag foo=bar/>text
10100 !! result
10101 <pre>
10102 NULL
10103 array (
10104 'foo' => 'bar',
10105 )
10106 </pre>text
10107
10108 !! end
10109
10110 # </tag> should be output literally since there is no matching tag that begins it
10111 !! test
10112 Parser hook: basic arguments using terminated empty elements (bug 2374)
10113 !! input
10114 <tag width=200 height = "100" depth = '50' square/>
10115 other stuff
10116 </tag>
10117 !! result
10118 <pre>
10119 NULL
10120 array (
10121 'width' => '200',
10122 'height' => '100',
10123 'depth' => '50',
10124 'square' => 'square',
10125 )
10126 </pre>
10127 <p>other stuff
10128 &lt;/tag&gt;
10129 </p>
10130 !! end
10131
10132 ###
10133 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10134 ###
10135
10136 !! test
10137 Parser hook: static parser hook not inside a comment
10138 !! input
10139 <statictag>hello, world</statictag>
10140 <statictag action=flush/>
10141 !! result
10142 <p>hello, world
10143 </p>
10144 !! end
10145
10146
10147 !! test
10148 Parser hook: static parser hook inside a comment
10149 !! input
10150 <!-- <statictag>hello, world</statictag> -->
10151 <statictag action=flush/>
10152 !! result
10153 <p><br />
10154 </p>
10155 !! end
10156
10157 # Nested template calls; this case was broken by Parser.php rev 1.506,
10158 # since reverted.
10159
10160 !! article
10161 Template:One-parameter
10162 !! text
10163 (My parameter is: {{{1}}})
10164 !! endarticle
10165
10166 !! article
10167 Template:Map-one-parameter
10168 !! text
10169 {{{{{1}}}|{{{2}}}}}
10170 !! endarticle
10171
10172 !! test
10173 Nested template calls
10174 !! input
10175 {{Map-one-parameter|One-parameter|param}}
10176 !! result
10177 <p>(My parameter is: param)
10178 </p>
10179 !! end
10180
10181
10182 ###
10183 ### Sanitizer
10184 ###
10185 !! test
10186 Sanitizer: Closing of open tags
10187 !! input
10188 <s></s><table></table>
10189 !! result
10190 <s></s><table></table>
10191
10192 !! end
10193
10194 !! test
10195 Sanitizer: Closing of open but not closed tags
10196 !! input
10197 <s>foo
10198 !! result
10199 <p><s>foo</s>
10200 </p>
10201 !! end
10202
10203 !! test
10204 Sanitizer: Closing of closed but not open tags
10205 !! input
10206 </s>
10207 !! result
10208 <p>&lt;/s&gt;
10209 </p>
10210 !! end
10211
10212 !! test
10213 Sanitizer: Closing of closed but not open table tags
10214 !! input
10215 Table not started</td></tr></table>
10216 !! result
10217 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10218 </p>
10219 !! end
10220
10221 !! test
10222 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10223 !! input
10224 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10225 !! result
10226 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10227 </p>
10228 !! end
10229
10230 !! test
10231 Sanitizer: Validating the contents of the id attribute (bug 4515)
10232 !! options
10233 disabled
10234 !! input
10235 <br id=9 />
10236 !! result
10237 Something, but definitely not <br id="9" />...
10238 !! end
10239
10240 !! test
10241 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10242 !! options
10243 disabled
10244 !! input
10245 <br id="foo" /><br id="foo" />
10246 !! result
10247 Something need to be done. foo-2 ?
10248 !! end
10249
10250 !! test
10251 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10252 !! input
10253 <div itemscope>
10254 <meta itemprop="hello" content="world">
10255 <meta http-equiv="refresh" content="5">
10256 <meta itemprop="hello" http-equiv="refresh" content="5">
10257 <link itemprop="hello" href="{{SERVER}}">
10258 <link rel="stylesheet" href="{{SERVER}}">
10259 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10260 </div>
10261 !! result
10262 <div itemscope="itemscope">
10263 <p> <meta itemprop="hello" content="world" />
10264 &lt;meta http-equiv="refresh" content="5"&gt;
10265 <meta itemprop="hello" content="5" />
10266 </p>
10267 <link itemprop="hello" href="http&#58;//example.org" />
10268 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10269 <link itemprop="hello" href="http&#58;//example.org" />
10270 </div>
10271
10272 !! end
10273
10274 !! test
10275 Language converter: output gets cut off unexpectedly (bug 5757)
10276 !! options
10277 language=zh
10278 !! input
10279 this bit is safe: }-
10280
10281 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10282
10283 then we get cut off here: }-
10284
10285 all additional text is vanished
10286 !! result
10287 <p>this bit is safe: }-
10288 </p><p>but if we add a conversion instance: xxx
10289 </p><p>then we get cut off here: }-
10290 </p><p>all additional text is vanished
10291 </p>
10292 !! end
10293
10294 !! test
10295 Self closed html pairs (bug 5487)
10296 !! options
10297 !! input
10298 <center><font id="bug" />Centered text</center>
10299 <div><font id="bug2" />In div text</div>
10300 !! result
10301 <center>&lt;font id="bug" /&gt;Centered text</center>
10302 <div>&lt;font id="bug2" /&gt;In div text</div>
10303
10304 !! end
10305
10306 #
10307 #
10308 #
10309
10310 !! test
10311 Punctuation: nbsp before exclamation
10312 !! input
10313 C'est grave !
10314 !! result
10315 <p>C'est grave&#160;!
10316 </p>
10317 !! end
10318
10319 !! test
10320 Punctuation: CSS !important (bug 11874)
10321 !! input
10322 <div style="width:50% !important">important</div>
10323 !! result
10324 <div style="width:50% !important">important</div>
10325
10326 !!end
10327
10328 !! test
10329 Punctuation: CSS ! important (bug 11874; with space after)
10330 !! input
10331 <div style="width:50% ! important">important</div>
10332 !! result
10333 <div style="width:50% ! important">important</div>
10334
10335 !!end
10336
10337
10338 !! test
10339 HTML bullet list, closed tags (bug 5497)
10340 !! input
10341 <ul>
10342 <li>One</li>
10343 <li>Two</li>
10344 </ul>
10345 !! result
10346 <ul>
10347 <li>One</li>
10348 <li>Two</li>
10349 </ul>
10350
10351 !! end
10352
10353 !! test
10354 HTML bullet list, unclosed tags (bug 5497)
10355 !! options
10356 disabled
10357 !! input
10358 <ul>
10359 <li>One
10360 <li>Two
10361 </ul>
10362 !! result
10363 <ul>
10364 <li>One
10365 </li><li>Two
10366 </li></ul>
10367
10368 !! end
10369
10370 !! test
10371 HTML ordered list, closed tags (bug 5497)
10372 !! input
10373 <ol>
10374 <li>One</li>
10375 <li>Two</li>
10376 </ol>
10377 !! result
10378 <ol>
10379 <li>One</li>
10380 <li>Two</li>
10381 </ol>
10382
10383 !! end
10384
10385 !! test
10386 HTML ordered list, unclosed tags (bug 5497)
10387 !! options
10388 disabled
10389 !! input
10390 <ol>
10391 <li>One
10392 <li>Two
10393 </ol>
10394 !! result
10395 <ol>
10396 <li>One
10397 </li><li>Two
10398 </li></ol>
10399
10400 !! end
10401
10402 !! test
10403 HTML nested bullet list, closed tags (bug 5497)
10404 !! input
10405 <ul>
10406 <li>One</li>
10407 <li>Two:
10408 <ul>
10409 <li>Sub-one</li>
10410 <li>Sub-two</li>
10411 </ul>
10412 </li>
10413 </ul>
10414 !! result
10415 <ul>
10416 <li>One</li>
10417 <li>Two:
10418 <ul>
10419 <li>Sub-one</li>
10420 <li>Sub-two</li>
10421 </ul>
10422 </li>
10423 </ul>
10424
10425 !! end
10426
10427 !! test
10428 HTML nested bullet list, open tags (bug 5497)
10429 !! options
10430 disabled
10431 !! input
10432 <ul>
10433 <li>One
10434 <li>Two:
10435 <ul>
10436 <li>Sub-one
10437 <li>Sub-two
10438 </ul>
10439 </ul>
10440 !! result
10441 <ul>
10442 <li>One
10443 </li><li>Two:
10444 <ul>
10445 <li>Sub-one
10446 </li><li>Sub-two
10447 </li></ul>
10448 </li></ul>
10449
10450 !! end
10451
10452 !! test
10453 HTML nested ordered list, closed tags (bug 5497)
10454 !! input
10455 <ol>
10456 <li>One</li>
10457 <li>Two:
10458 <ol>
10459 <li>Sub-one</li>
10460 <li>Sub-two</li>
10461 </ol>
10462 </li>
10463 </ol>
10464 !! result
10465 <ol>
10466 <li>One</li>
10467 <li>Two:
10468 <ol>
10469 <li>Sub-one</li>
10470 <li>Sub-two</li>
10471 </ol>
10472 </li>
10473 </ol>
10474
10475 !! end
10476
10477 !! test
10478 HTML nested ordered list, open tags (bug 5497)
10479 !! options
10480 disabled
10481 !! input
10482 <ol>
10483 <li>One
10484 <li>Two:
10485 <ol>
10486 <li>Sub-one
10487 <li>Sub-two
10488 </ol>
10489 </ol>
10490 !! result
10491 <ol>
10492 <li>One
10493 </li><li>Two:
10494 <ol>
10495 <li>Sub-one
10496 </li><li>Sub-two
10497 </li></ol>
10498 </li></ol>
10499
10500 !! end
10501
10502 !! test
10503 HTML ordered list item with parameters oddity
10504 !! input
10505 <ol><li id="fragment">One</li></ol>
10506 !! result
10507 <ol><li id="fragment">One</li></ol>
10508
10509 !! end
10510
10511 !!test
10512 bug 5918: autonumbering
10513 !! input
10514 [http://first/] [http://second] [ftp://ftp]
10515
10516 ftp://inlineftp
10517
10518 [mailto:enclosed@mail.tld With target]
10519
10520 [mailto:enclosed@mail.tld]
10521
10522 mailto:inline@mail.tld
10523 !! result
10524 <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>
10525 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10526 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10527 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10528 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10529 </p>
10530 !! end
10531
10532
10533 #
10534 # Security and HTML correctness
10535 # From Nick Jenkins' fuzz testing
10536 #
10537
10538 !! test
10539 Fuzz testing: Parser13
10540 !! input
10541 {|
10542 | http://a|
10543 !! result
10544 <table>
10545 <tr>
10546 <td>
10547 </td>
10548 </tr>
10549 </table>
10550
10551 !! end
10552
10553 !! test
10554 Fuzz testing: Parser14
10555 !! input
10556 == onmouseover= ==
10557 http://__TOC__
10558 !! result
10559 <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>
10560 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10561 <ul>
10562 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10563 </ul>
10564 </div>
10565
10566 !! end
10567
10568 !! test
10569 Fuzz testing: Parser14-table
10570 !! input
10571 ==a==
10572 {| STYLE=__TOC__
10573 !! result
10574 <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>
10575 <table style="&#95;_TOC&#95;_">
10576 <tr><td></td></tr>
10577 </table>
10578
10579 !! end
10580
10581 # Known to produce bogus xml (extra </td>)
10582 !! test
10583 Fuzz testing: Parser16
10584 !! options
10585 noxml
10586 !! input
10587 {|
10588 !https://||||||
10589 !! result
10590 <table>
10591 <tr>
10592 <th>https://</th>
10593 <th></th>
10594 <th></th>
10595 <th>
10596 </td>
10597 </tr>
10598 </table>
10599
10600 !! end
10601
10602 !! test
10603 Fuzz testing: Parser21
10604 !! input
10605 {|
10606 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10607 |
10608 !! result
10609 <table>
10610 <tr>
10611 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10612 </th>
10613 <td>
10614 </td>
10615 </tr>
10616 </table>
10617
10618 !! end
10619
10620 !! test
10621 Fuzz testing: Parser22
10622 !! input
10623 http://===r:::https://b
10624
10625 {|
10626 !!result
10627 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10628 </p>
10629 <table>
10630 <tr><td></td></tr>
10631 </table>
10632
10633 !! end
10634
10635 # Known to produce bad XML for now
10636 !! test
10637 Fuzz testing: Parser24
10638 !! options
10639 noxml
10640 !! input
10641 {|
10642 {{{|
10643 <u CLASS=
10644 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10645 <br style="onmouseover='alert(document.cookie);' " />
10646
10647 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10648 |
10649 !! result
10650 <table>
10651 {{{|
10652 <u class="&#124;">}}}} &gt;
10653 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10654
10655 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10656 <tr>
10657 <td></u>
10658 </td>
10659 </tr>
10660 </table>
10661
10662 !! end
10663
10664 # Note: the current result listed for this is not what the original one was,
10665 # but the original bug was JavaScript injection, which is fixed in any case.
10666 # It's not clear that the original result listed was any more correct than the
10667 # current one. Original result:
10668 # <p>{{{|
10669 # </p>
10670 # <li class="&#124;&#124;">
10671 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10672 !!test
10673 Fuzz testing: Parser25 (bug 6055)
10674 !! input
10675 {{{
10676 |
10677 <LI CLASS=||
10678 >
10679 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10680 !! result
10681 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10682 </p>
10683 !! end
10684
10685 !!test
10686 Fuzz testing: URL adjacent extension (with space, clean)
10687 !! options
10688 !! input
10689 http://example.com <nowiki>junk</nowiki>
10690 !! result
10691 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10692 </p>
10693 !!end
10694
10695 !!test
10696 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10697 !! options
10698 !! input
10699 http://example.com<nowiki>junk</nowiki>
10700 !! result
10701 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10702 </p>
10703 !!end
10704
10705 !!test
10706 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10707 !! options
10708 !! input
10709 http://example.com<pre>junk</pre>
10710 !! result
10711 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10712
10713 !!end
10714
10715 !!test
10716 Fuzz testing: image with bogus manual thumbnail
10717 !!input
10718 [[Image:foobar.jpg|thumbnail= ]]
10719 !!result
10720 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10721
10722 !!end
10723
10724 !! test
10725 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10726 !! input
10727 <pre dir="&#10;"></pre>
10728 !! result
10729 <pre dir="&#10;"></pre>
10730
10731 !! end
10732
10733 !! test
10734 Parsing optional HTML elements (Bug 6171)
10735 !! options
10736 !! input
10737 <table>
10738 <tr>
10739 <td> Some tabular data</td>
10740 <td> More tabular data ...
10741 <td> And yet som tabular data</td>
10742 </tr>
10743 </table>
10744 !! result
10745 <table>
10746 <tr>
10747 <td> Some tabular data</td>
10748 <td> More tabular data ...
10749 </td><td> And yet som tabular data</td>
10750 </tr>
10751 </table>
10752
10753 !! end
10754
10755 !! test
10756 Correct handling of <td>, <tr> (Bug 6171)
10757 !! options
10758 !! input
10759 <table>
10760 <tr>
10761 <td> Some tabular data</td>
10762 <td> More tabular data ...</td>
10763 <td> And yet som tabular data</td>
10764 </tr>
10765 </table>
10766 !! result
10767 <table>
10768 <tr>
10769 <td> Some tabular data</td>
10770 <td> More tabular data ...</td>
10771 <td> And yet som tabular data</td>
10772 </tr>
10773 </table>
10774
10775 !! end
10776
10777
10778 !! test
10779 Parsing crashing regression (fr:JavaScript)
10780 !! input
10781 </body></x>
10782 !! result
10783 <p>&lt;/body&gt;&lt;/x&gt;
10784 </p>
10785 !! end
10786
10787 !! test
10788 Inline wiki vs wiki block nesting
10789 !! input
10790 '''Bold paragraph
10791
10792 New wiki paragraph
10793 !! result
10794 <p><b>Bold paragraph</b>
10795 </p><p>New wiki paragraph
10796 </p>
10797 !! end
10798
10799 !! test
10800 Inline HTML vs wiki block nesting
10801 !! options
10802 disabled
10803 !! input
10804 <b>Bold paragraph
10805
10806 New wiki paragraph
10807 !! result
10808 <p><b>Bold paragraph</b>
10809 </p><p>New wiki paragraph
10810 </p>
10811 !! end
10812
10813 # Original result was this:
10814 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10815 # </p>
10816 # While that might be marginally more intuitive, maybe, the six-apostrophe
10817 # construct is clearly pathological and the result stated here (which is what
10818 # the parser actually does) is about as reasonable as anything.
10819 !!test
10820 Mixing markup for italics and bold
10821 !! options
10822 !! input
10823 '''bold''''''bold''bolditalics'''''
10824 !! result
10825 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10826 </p>
10827 !! end
10828
10829
10830 !! article
10831 Xyzzyx
10832 !! text
10833 Article for special page transclusion test
10834 !! endarticle
10835
10836 !! test
10837 Special page transclusion
10838 !! options
10839 !! input
10840 {{Special:Prefixindex/Xyzzyx}}
10841 !! result
10842 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10843
10844 !! end
10845
10846 !! test
10847 Special page transclusion twice (bug 5021)
10848 !! options
10849 !! input
10850 {{Special:Prefixindex/Xyzzyx}}
10851 {{Special:Prefixindex/Xyzzyx}}
10852 !! result
10853 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10854 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10855
10856 !! end
10857
10858 !! test
10859 Transclusion of default MediaWiki message
10860 !! input
10861 {{MediaWiki:Mainpage}}
10862 !!result
10863 <p>Main Page
10864 </p>
10865 !! end
10866
10867 !! test
10868 Transclusion of nonexistent MediaWiki message
10869 !! input
10870 {{MediaWiki:Mainpagexxx}}
10871 !!result
10872 <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>
10873 </p>
10874 !! end
10875
10876 !! test
10877 Transclusion of MediaWiki message with underscore
10878 !! input
10879 {{MediaWiki:history_short}}
10880 !! result
10881 <p>History
10882 </p>
10883 !! end
10884
10885 !! test
10886 Transclusion of MediaWiki message with space
10887 !! input
10888 {{MediaWiki:history short}}
10889 !! result
10890 <p>History
10891 </p>
10892 !! end
10893
10894 !! test
10895 Invalid header with following text
10896 !! input
10897 = x = y
10898 !! result
10899 <p>= x = y
10900 </p>
10901 !! end
10902
10903
10904 !! test
10905 Section extraction test (section 0)
10906 !! options
10907 section=0
10908 !! input
10909 start
10910 ==a==
10911 ===aa===
10912 ====aaa====
10913 ==b==
10914 ===ba===
10915 ===bb===
10916 ====bba====
10917 ===bc===
10918 ==c==
10919 ===ca===
10920 !! result
10921 start
10922 !! end
10923
10924 !! test
10925 Section extraction test (section 1)
10926 !! options
10927 section=1
10928 !! input
10929 start
10930 ==a==
10931 ===aa===
10932 ====aaa====
10933 ==b==
10934 ===ba===
10935 ===bb===
10936 ====bba====
10937 ===bc===
10938 ==c==
10939 ===ca===
10940 !! result
10941 ==a==
10942 ===aa===
10943 ====aaa====
10944 !! end
10945
10946 !! test
10947 Section extraction test (section 2)
10948 !! options
10949 section=2
10950 !! input
10951 start
10952 ==a==
10953 ===aa===
10954 ====aaa====
10955 ==b==
10956 ===ba===
10957 ===bb===
10958 ====bba====
10959 ===bc===
10960 ==c==
10961 ===ca===
10962 !! result
10963 ===aa===
10964 ====aaa====
10965 !! end
10966
10967 !! test
10968 Section extraction test (section 3)
10969 !! options
10970 section=3
10971 !! input
10972 start
10973 ==a==
10974 ===aa===
10975 ====aaa====
10976 ==b==
10977 ===ba===
10978 ===bb===
10979 ====bba====
10980 ===bc===
10981 ==c==
10982 ===ca===
10983 !! result
10984 ====aaa====
10985 !! end
10986
10987 !! test
10988 Section extraction test (section 4)
10989 !! options
10990 section=4
10991 !! input
10992 start
10993 ==a==
10994 ===aa===
10995 ====aaa====
10996 ==b==
10997 ===ba===
10998 ===bb===
10999 ====bba====
11000 ===bc===
11001 ==c==
11002 ===ca===
11003 !! result
11004 ==b==
11005 ===ba===
11006 ===bb===
11007 ====bba====
11008 ===bc===
11009 !! end
11010
11011 !! test
11012 Section extraction test (section 5)
11013 !! options
11014 section=5
11015 !! input
11016 start
11017 ==a==
11018 ===aa===
11019 ====aaa====
11020 ==b==
11021 ===ba===
11022 ===bb===
11023 ====bba====
11024 ===bc===
11025 ==c==
11026 ===ca===
11027 !! result
11028 ===ba===
11029 !! end
11030
11031 !! test
11032 Section extraction test (section 6)
11033 !! options
11034 section=6
11035 !! input
11036 start
11037 ==a==
11038 ===aa===
11039 ====aaa====
11040 ==b==
11041 ===ba===
11042 ===bb===
11043 ====bba====
11044 ===bc===
11045 ==c==
11046 ===ca===
11047 !! result
11048 ===bb===
11049 ====bba====
11050 !! end
11051
11052 !! test
11053 Section extraction test (section 7)
11054 !! options
11055 section=7
11056 !! input
11057 start
11058 ==a==
11059 ===aa===
11060 ====aaa====
11061 ==b==
11062 ===ba===
11063 ===bb===
11064 ====bba====
11065 ===bc===
11066 ==c==
11067 ===ca===
11068 !! result
11069 ====bba====
11070 !! end
11071
11072 !! test
11073 Section extraction test (section 8)
11074 !! options
11075 section=8
11076 !! input
11077 start
11078 ==a==
11079 ===aa===
11080 ====aaa====
11081 ==b==
11082 ===ba===
11083 ===bb===
11084 ====bba====
11085 ===bc===
11086 ==c==
11087 ===ca===
11088 !! result
11089 ===bc===
11090 !! end
11091
11092 !! test
11093 Section extraction test (section 9)
11094 !! options
11095 section=9
11096 !! input
11097 start
11098 ==a==
11099 ===aa===
11100 ====aaa====
11101 ==b==
11102 ===ba===
11103 ===bb===
11104 ====bba====
11105 ===bc===
11106 ==c==
11107 ===ca===
11108 !! result
11109 ==c==
11110 ===ca===
11111 !! end
11112
11113 !! test
11114 Section extraction test (section 10)
11115 !! options
11116 section=10
11117 !! input
11118 start
11119 ==a==
11120 ===aa===
11121 ====aaa====
11122 ==b==
11123 ===ba===
11124 ===bb===
11125 ====bba====
11126 ===bc===
11127 ==c==
11128 ===ca===
11129 !! result
11130 ===ca===
11131 !! end
11132
11133 !! test
11134 Section extraction test (nonexistent section 11)
11135 !! options
11136 section=11
11137 !! input
11138 start
11139 ==a==
11140 ===aa===
11141 ====aaa====
11142 ==b==
11143 ===ba===
11144 ===bb===
11145 ====bba====
11146 ===bc===
11147 ==c==
11148 ===ca===
11149 !! result
11150 !! end
11151
11152 !! test
11153 Section extraction test with bogus heading (section 1)
11154 !! options
11155 section=1
11156 !! input
11157 ==a==
11158 ==bogus== not a legal section
11159 ==b==
11160 !! result
11161 ==a==
11162 ==bogus== not a legal section
11163 !! end
11164
11165 !! test
11166 Section extraction test with bogus heading (section 2)
11167 !! options
11168 section=2
11169 !! input
11170 ==a==
11171 ==bogus== not a legal section
11172 ==b==
11173 !! result
11174 ==b==
11175 !! end
11176
11177 !! test
11178 Section extraction test with comment after heading (section 1)
11179 !! options
11180 section=1
11181 !! input
11182 ==a==
11183 ==b== <!-- -->
11184 ==c==
11185 !! result
11186 ==a==
11187 !! end
11188
11189 !! test
11190 Section extraction test with comment after heading (section 2)
11191 !! options
11192 section=2
11193 !! input
11194 ==a==
11195 ==b== <!-- -->
11196 ==c==
11197 !! result
11198 ==b== <!-- -->
11199 !! end
11200
11201 !! test
11202 Section extraction test with bogus <nowiki> heading (section 1)
11203 !! options
11204 section=1
11205 !! input
11206 ==a==
11207 ==bogus== <nowiki>not a legal section</nowiki>
11208 ==b==
11209 !! result
11210 ==a==
11211 ==bogus== <nowiki>not a legal section</nowiki>
11212 !! end
11213
11214 !! test
11215 Section extraction test with bogus <nowiki> heading (section 2)
11216 !! options
11217 section=2
11218 !! input
11219 ==a==
11220 ==bogus== <nowiki>not a legal section</nowiki>
11221 ==b==
11222 !! result
11223 ==b==
11224 !! end
11225
11226
11227 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11228 # instead of respecting commented sections
11229 !! test
11230 Section extraction prefixed by comment (section 1)
11231 !! options
11232 section=1
11233 !! input
11234 <!-- -->==sec1==
11235 ==sec2==
11236 !!result
11237 ==sec2==
11238 !!end
11239
11240 !! test
11241 Section extraction prefixed by comment (section 2)
11242 !! options
11243 section=2
11244 !! input
11245 <!-- -->==sec1==
11246 ==sec2==
11247 !!result
11248
11249 !!end
11250
11251
11252 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11253 # instead of respecting HTML-style headings
11254 !! test
11255 Section extraction, mixed wiki and html (section 1)
11256 !! options
11257 section=1
11258 !! input
11259 <h2>unmarked</h2>
11260 unmarked
11261 ==1==
11262 one
11263 ==2==
11264 two
11265 !! result
11266 ==1==
11267 one
11268 !! end
11269
11270 !! test
11271 Section extraction, mixed wiki and html (section 2)
11272 !! options
11273 section=2
11274 !! input
11275 <h2>unmarked</h2>
11276 unmarked
11277 ==1==
11278 one
11279 ==2==
11280 two
11281 !! result
11282 ==2==
11283 two
11284 !! end
11285
11286
11287 # Formerly testing for bug 3342
11288 !! test
11289 Section extraction, heading surrounded by <noinclude>
11290 !! options
11291 section=1
11292 !! input
11293 <noinclude>==unmarked==</noinclude>
11294 ==marked==
11295 !! result
11296 ==marked==
11297 !!end
11298
11299 # Test behavior of bug 19910
11300 !! test
11301 Sectiion with all-equals
11302 !! options
11303 section=2
11304 !! input
11305 ===
11306 The line above must have a trailing space
11307 === <!--
11308 --> <!-- -->
11309 But just in case it doesn't...
11310 !! result
11311 === <!--
11312 --> <!-- -->
11313 But just in case it doesn't...
11314 !! end
11315
11316 !! test
11317 Section replacement test (section 0)
11318 !! options
11319 replace=0,"xxx"
11320 !! input
11321 start
11322 ==a==
11323 ===aa===
11324 ====aaa====
11325 ==b==
11326 ===ba===
11327 ===bb===
11328 ====bba====
11329 ===bc===
11330 ==c==
11331 ===ca===
11332 !! result
11333 xxx
11334
11335 ==a==
11336 ===aa===
11337 ====aaa====
11338 ==b==
11339 ===ba===
11340 ===bb===
11341 ====bba====
11342 ===bc===
11343 ==c==
11344 ===ca===
11345 !! end
11346
11347 !! test
11348 Section replacement test (section 1)
11349 !! options
11350 replace=1,"xxx"
11351 !! input
11352 start
11353 ==a==
11354 ===aa===
11355 ====aaa====
11356 ==b==
11357 ===ba===
11358 ===bb===
11359 ====bba====
11360 ===bc===
11361 ==c==
11362 ===ca===
11363 !! result
11364 start
11365 xxx
11366
11367 ==b==
11368 ===ba===
11369 ===bb===
11370 ====bba====
11371 ===bc===
11372 ==c==
11373 ===ca===
11374 !! end
11375
11376 !! test
11377 Section replacement test (section 2)
11378 !! options
11379 replace=2,"xxx"
11380 !! input
11381 start
11382 ==a==
11383 ===aa===
11384 ====aaa====
11385 ==b==
11386 ===ba===
11387 ===bb===
11388 ====bba====
11389 ===bc===
11390 ==c==
11391 ===ca===
11392 !! result
11393 start
11394 ==a==
11395 xxx
11396
11397 ==b==
11398 ===ba===
11399 ===bb===
11400 ====bba====
11401 ===bc===
11402 ==c==
11403 ===ca===
11404 !! end
11405
11406 !! test
11407 Section replacement test (section 3)
11408 !! options
11409 replace=3,"xxx"
11410 !! input
11411 start
11412 ==a==
11413 ===aa===
11414 ====aaa====
11415 ==b==
11416 ===ba===
11417 ===bb===
11418 ====bba====
11419 ===bc===
11420 ==c==
11421 ===ca===
11422 !! result
11423 start
11424 ==a==
11425 ===aa===
11426 xxx
11427
11428 ==b==
11429 ===ba===
11430 ===bb===
11431 ====bba====
11432 ===bc===
11433 ==c==
11434 ===ca===
11435 !! end
11436
11437 !! test
11438 Section replacement test (section 4)
11439 !! options
11440 replace=4,"xxx"
11441 !! input
11442 start
11443 ==a==
11444 ===aa===
11445 ====aaa====
11446 ==b==
11447 ===ba===
11448 ===bb===
11449 ====bba====
11450 ===bc===
11451 ==c==
11452 ===ca===
11453 !! result
11454 start
11455 ==a==
11456 ===aa===
11457 ====aaa====
11458 xxx
11459
11460 ==c==
11461 ===ca===
11462 !! end
11463
11464 !! test
11465 Section replacement test (section 5)
11466 !! options
11467 replace=5,"xxx"
11468 !! input
11469 start
11470 ==a==
11471 ===aa===
11472 ====aaa====
11473 ==b==
11474 ===ba===
11475 ===bb===
11476 ====bba====
11477 ===bc===
11478 ==c==
11479 ===ca===
11480 !! result
11481 start
11482 ==a==
11483 ===aa===
11484 ====aaa====
11485 ==b==
11486 xxx
11487
11488 ===bb===
11489 ====bba====
11490 ===bc===
11491 ==c==
11492 ===ca===
11493 !! end
11494
11495 !! test
11496 Section replacement test (section 6)
11497 !! options
11498 replace=6,"xxx"
11499 !! input
11500 start
11501 ==a==
11502 ===aa===
11503 ====aaa====
11504 ==b==
11505 ===ba===
11506 ===bb===
11507 ====bba====
11508 ===bc===
11509 ==c==
11510 ===ca===
11511 !! result
11512 start
11513 ==a==
11514 ===aa===
11515 ====aaa====
11516 ==b==
11517 ===ba===
11518 xxx
11519
11520 ===bc===
11521 ==c==
11522 ===ca===
11523 !! end
11524
11525 !! test
11526 Section replacement test (section 7)
11527 !! options
11528 replace=7,"xxx"
11529 !! input
11530 start
11531 ==a==
11532 ===aa===
11533 ====aaa====
11534 ==b==
11535 ===ba===
11536 ===bb===
11537 ====bba====
11538 ===bc===
11539 ==c==
11540 ===ca===
11541 !! result
11542 start
11543 ==a==
11544 ===aa===
11545 ====aaa====
11546 ==b==
11547 ===ba===
11548 ===bb===
11549 xxx
11550
11551 ===bc===
11552 ==c==
11553 ===ca===
11554 !! end
11555
11556 !! test
11557 Section replacement test (section 8)
11558 !! options
11559 replace=8,"xxx"
11560 !! input
11561 start
11562 ==a==
11563 ===aa===
11564 ====aaa====
11565 ==b==
11566 ===ba===
11567 ===bb===
11568 ====bba====
11569 ===bc===
11570 ==c==
11571 ===ca===
11572 !! result
11573 start
11574 ==a==
11575 ===aa===
11576 ====aaa====
11577 ==b==
11578 ===ba===
11579 ===bb===
11580 ====bba====
11581 xxx
11582
11583 ==c==
11584 ===ca===
11585 !!end
11586
11587 !! test
11588 Section replacement test (section 9)
11589 !! options
11590 replace=9,"xxx"
11591 !! input
11592 start
11593 ==a==
11594 ===aa===
11595 ====aaa====
11596 ==b==
11597 ===ba===
11598 ===bb===
11599 ====bba====
11600 ===bc===
11601 ==c==
11602 ===ca===
11603 !! result
11604 start
11605 ==a==
11606 ===aa===
11607 ====aaa====
11608 ==b==
11609 ===ba===
11610 ===bb===
11611 ====bba====
11612 ===bc===
11613 xxx
11614 !! end
11615
11616 !! test
11617 Section replacement test (section 10)
11618 !! options
11619 replace=10,"xxx"
11620 !! input
11621 start
11622 ==a==
11623 ===aa===
11624 ====aaa====
11625 ==b==
11626 ===ba===
11627 ===bb===
11628 ====bba====
11629 ===bc===
11630 ==c==
11631 ===ca===
11632 !! result
11633 start
11634 ==a==
11635 ===aa===
11636 ====aaa====
11637 ==b==
11638 ===ba===
11639 ===bb===
11640 ====bba====
11641 ===bc===
11642 ==c==
11643 xxx
11644 !! end
11645
11646 !! test
11647 Section replacement test with initial whitespace (bug 13728)
11648 !! options
11649 replace=2,"xxx"
11650 !! input
11651 Preformatted initial line
11652 ==a==
11653 ===a===
11654 !! result
11655 Preformatted initial line
11656 ==a==
11657 xxx
11658 !! end
11659
11660
11661 !! test
11662 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11663 !! options
11664 section=1
11665 !! input
11666 ==a==
11667 a
11668 !! result
11669 ==a==
11670 a
11671 !! end
11672
11673 !! test
11674 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11675 !! options
11676 section=1
11677 !! input
11678 ==a==
11679 a
11680 !! result
11681 ==a==
11682 a
11683 !! end
11684
11685
11686 !! test
11687 Section extraction, <pre> around bogus header (bug 10309)
11688 !! options
11689 noxml section=2
11690 !! input
11691 == Section One ==
11692 <pre>
11693 =======
11694 </pre>
11695
11696 == Section Two ==
11697 stuff
11698 !! result
11699 == Section Two ==
11700 stuff
11701 !! end
11702
11703 !! test
11704 Section replacement, <pre> around bogus header (bug 10309)
11705 !! options
11706 noxml replace=2,"xxx"
11707 !! input
11708 == Section One ==
11709 <pre>
11710 =======
11711 </pre>
11712
11713 == Section Two ==
11714 stuff
11715 !! result
11716 == Section One ==
11717 <pre>
11718 =======
11719 </pre>
11720
11721 xxx
11722 !! end
11723
11724
11725
11726 !! test
11727 Handling of &#x0A; in URLs
11728 !! input
11729 **irc://&#x0A;a
11730 !! result
11731 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11732 </li></ul>
11733 </li></ul>
11734
11735 !!end
11736
11737 !! test
11738 5 quotes, code coverage +1 line (php)
11739 !! options
11740 php
11741 !! input
11742 '''''
11743 !! result
11744 !! end
11745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11746 !! test
11747 5 quotes, code coverage +1 line (parsoid)
11748 !! options
11749 parsoid
11750 !! input
11751 '''''
11752 !! result
11753 <p><i><b></b></i></p>
11754 !! end
11755
11756 !! test
11757 Special:Search page linking.
11758 !! input
11759 {{Special:search}}
11760 !! result
11761 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11762 </p>
11763 !! end
11764
11765 !! test
11766 Say the magic word
11767 !! input
11768 * {{PAGENAME}}
11769 * {{BASEPAGENAME}}
11770 * {{SUBPAGENAME}}
11771 * {{SUBPAGENAMEE}}
11772 * {{ROOTPAGENAME}}
11773 * {{ROOTPAGENAMEE}}
11774 * {{BASEPAGENAME}}
11775 * {{BASEPAGENAMEE}}
11776 * {{TALKPAGENAME}}
11777 * {{TALKPAGENAMEE}}
11778 * {{SUBJECTPAGENAME}}
11779 * {{SUBJECTPAGENAMEE}}
11780 * {{NAMESPACEE}}
11781 * {{NAMESPACE}}
11782 * {{TALKSPACE}}
11783 * {{TALKSPACEE}}
11784 * {{SUBJECTSPACE}}
11785 * {{SUBJECTSPACEE}}
11786 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11787 !! result
11788 <ul><li> Parser test
11789 </li><li> Parser test
11790 </li><li> Parser test
11791 </li><li> Parser_test
11792 </li><li> Parser test
11793 </li><li> Parser_test
11794 </li><li> Parser test
11795 </li><li> Parser_test
11796 </li><li> Talk:Parser test
11797 </li><li> Talk:Parser_test
11798 </li><li> Parser test
11799 </li><li> Parser_test
11800 </li><li>
11801 </li><li>
11802 </li><li> Talk
11803 </li><li> Talk
11804 </li><li>
11805 </li><li>
11806 </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>
11807 </li></ul>
11808
11809 !! end
11810 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11811
11812 !! test
11813 Gallery
11814 !! input
11815 <gallery>
11816 image1.png |
11817 image2.gif|||||
11818
11819 image3|
11820 image4 |300px| centre
11821 image5.svg| http://///////
11822 [[x|xx]]]]
11823 * image6
11824 </gallery>
11825 !! result
11826 <ul class="gallery">
11827 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11828 <div style="height: 150px;">Image1.png</div>
11829 <div class="gallerytext">
11830 </div>
11831 </div></li>
11832 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11833 <div style="height: 150px;">Image2.gif</div>
11834 <div class="gallerytext">
11835 <p>||||
11836 </p>
11837 </div>
11838 </div></li>
11839 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11840 <div style="height: 150px;">Image3</div>
11841 <div class="gallerytext">
11842 </div>
11843 </div></li>
11844 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11845 <div style="height: 150px;">Image4</div>
11846 <div class="gallerytext">
11847 <p>300px| centre
11848 </p>
11849 </div>
11850 </div></li>
11851 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11852 <div style="height: 150px;">Image5.svg</div>
11853 <div class="gallerytext">
11854 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11855 </p>
11856 </div>
11857 </div></li>
11858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11859 <div style="height: 150px;">* image6</div>
11860 <div class="gallerytext">
11861 </div>
11862 </div></li>
11863 </ul>
11864
11865 !! end
11866
11867 !! test
11868 Gallery (with options)
11869 !! input
11870 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11871 File:Nonexistant.jpg|caption
11872 File:Nonexistant.jpg
11873 image:foobar.jpg|some '''caption''' [[Main Page]]
11874 image:foobar.jpg
11875 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11876 </gallery>
11877 !! result
11878 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11879 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11880 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11881 <div style="height: 70px;">Nonexistant.jpg</div>
11882 <div class="gallerytext">
11883 <p>caption
11884 </p>
11885 </div>
11886 </div></li>
11887 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11888 <div style="height: 70px;">Nonexistant.jpg</div>
11889 <div class="gallerytext">
11890 </div>
11891 </div></li>
11892 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11893 <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>
11894 <div class="gallerytext">
11895 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11896 </p>
11897 </div>
11898 </div></li>
11899 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11900 <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>
11901 <div class="gallerytext">
11902 </div>
11903 </div></li>
11904 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11905 <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>
11906 <div class="gallerytext">
11907 <p>Blabla|blabla.
11908 </p>
11909 </div>
11910 </div></li>
11911 </ul>
11912
11913 !! end
11914
11915 !! test
11916 Gallery with wikitext inside caption
11917 !! input
11918 <gallery>
11919 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11920 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11921 </gallery>
11922 !! result
11923 <ul class="gallery">
11924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11925 <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>
11926 <div class="gallerytext">
11927 <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>
11928 </p>
11929 </div>
11930 </div></li>
11931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11932 <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>
11933 <div class="gallerytext">
11934 <p>This is a test template
11935 </p>
11936 </div>
11937 </div></li>
11938 </ul>
11939
11940 !! end
11941
11942 !! test
11943 gallery (with showfilename option)
11944 !! input
11945 <gallery showfilename>
11946 File:Nonexistant.jpg|caption
11947 File:Nonexistant.jpg
11948 image:foobar.jpg|some '''caption''' [[Main Page]]
11949 File:Foobar.jpg
11950 </gallery>
11951 !! result
11952 <ul class="gallery">
11953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11954 <div style="height: 150px;">Nonexistant.jpg</div>
11955 <div class="gallerytext">
11956 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11957 caption
11958 </p>
11959 </div>
11960 </div></li>
11961 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11962 <div style="height: 150px;">Nonexistant.jpg</div>
11963 <div class="gallerytext">
11964 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11965 </p>
11966 </div>
11967 </div></li>
11968 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11969 <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>
11970 <div class="gallerytext">
11971 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11972 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11973 </p>
11974 </div>
11975 </div></li>
11976 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11977 <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>
11978 <div class="gallerytext">
11979 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11980 </p>
11981 </div>
11982 </div></li>
11983 </ul>
11984
11985 !! end
11986
11987 !! test
11988 Gallery (with namespace-less filenames)
11989 !! input
11990 <gallery>
11991 File:Nonexistant.jpg
11992 Nonexistant.jpg
11993 image:foobar.jpg
11994 foobar.jpg
11995 </gallery>
11996 !! result
11997 <ul class="gallery">
11998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11999 <div style="height: 150px;">Nonexistant.jpg</div>
12000 <div class="gallerytext">
12001 </div>
12002 </div></li>
12003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12004 <div style="height: 150px;">Nonexistant.jpg</div>
12005 <div class="gallerytext">
12006 </div>
12007 </div></li>
12008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12009 <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>
12010 <div class="gallerytext">
12011 </div>
12012 </div></li>
12013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12014 <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>
12015 <div class="gallerytext">
12016 </div>
12017 </div></li>
12018 </ul>
12019
12020 !! end
12021
12022 !! test
12023 HTML Hex character encoding (spells the word "JavaScript")
12024 !! input
12025 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12026 !! result
12027 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12028 </p>
12029 !! end
12030
12031 !! test
12032 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12033 !! input
12034 &#xsee;&#XSEE;
12035 !! result
12036 <p>&amp;#xsee;&amp;#XSEE;
12037 </p>
12038 !! end
12039
12040 !! test
12041 HTML Hex character encoding mixed case
12042 !! input
12043 &#xEE;&#Xee;
12044 !! result
12045 <p>&#xee;&#xee;
12046 </p>
12047 !! end
12048
12049 !! test
12050 __FORCETOC__ override
12051 !! input
12052 __NEWSECTIONLINK__
12053 __FORCETOC__
12054 !! result
12055 <p><br />
12056 </p>
12057 !! end
12058
12059 !! test
12060 ISBN code coverage
12061 !! input
12062 ISBN 978-0-1234-56&#x20;789
12063 !! result
12064 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12065 </p>
12066 !! end
12067
12068 !! test
12069 ISBN followed by 5 spaces
12070 !! input
12071 ISBN
12072 !! result
12073 <p>ISBN
12074 </p>
12075 !! end
12076
12077 !! test
12078 Double ISBN
12079 !! input
12080 ISBN ISBN 1234567890
12081 !! result
12082 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12083 </p>
12084 !! end
12085
12086 !! test
12087 Bug 22905: <abbr> followed by ISBN followed by </a>
12088 !! input
12089 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12090 !! result
12091 <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>
12092 </p>
12093 !! end
12094
12095 !! test
12096 Double RFC
12097 !! input
12098 RFC RFC 1234
12099 !! result
12100 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12101 </p>
12102 !! end
12103
12104 !! test
12105 Double RFC with a wiki link
12106 !! input
12107 RFC [[RFC 1234]]
12108 !! result
12109 <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>
12110 </p>
12111 !! end
12112
12113 !! test
12114 RFC code coverage
12115 !! input
12116 RFC 983&#x20;987
12117 !! result
12118 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12119 </p>
12120 !! end
12121
12122 !! test
12123 Centre-aligned image
12124 !! input
12125 [[Image:foobar.jpg|centre]]
12126 !! result
12127 <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>
12128
12129 !!end
12130
12131 !! test
12132 None-aligned image
12133 !! input
12134 [[Image:foobar.jpg|none]]
12135 !! result
12136 <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>
12137
12138 !!end
12139
12140 !! test
12141 Width + Height sized image (using px) (height is ignored)
12142 !! input
12143 [[Image:foobar.jpg|640x480px]]
12144 !! result
12145 <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>
12146 </p>
12147 !!end
12148
12149 !! test
12150 Width-sized image (using px, no following whitespace)
12151 !! input
12152 [[Image:foobar.jpg|640px]]
12153 !! result
12154 <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>
12155 </p>
12156 !!end
12157
12158 !! test
12159 Width-sized image (using px, with following whitespace - test regression from r39467)
12160 !! input
12161 [[Image:foobar.jpg|640px ]]
12162 !! result
12163 <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>
12164 </p>
12165 !!end
12166
12167 !! test
12168 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12169 !! input
12170 [[Image:foobar.jpg| 640px]]
12171 !! result
12172 <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>
12173 </p>
12174 !!end
12175
12176 !! test
12177 Another italics / bold test
12178 !! input
12179 ''' ''x'
12180 !! result
12181 <pre>'<i> </i>x'
12182 </pre>
12183 !!end
12184
12185 # Note the results may be incorrect, as parserTest output included this:
12186 # XML error: Mismatched tag at byte 6120:
12187 # ...<dd> </dt></dl> </dd...
12188 !! test
12189 dt/dd/dl test
12190 !! options
12191 disabled
12192 !! input
12193 :;;;::
12194 !! result
12195 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12196 </dd></dl>
12197 </dd></dl>
12198 </dt></dl>
12199 </dt></dl>
12200 </dt></dl>
12201 </dd></dl>
12202
12203 !!end
12204
12205
12206 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12207 !! test
12208 Images with the "|" character in the comment
12209 !! input
12210 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12211 !! result
12212 <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>
12213
12214 !!end
12215
12216 !! test
12217 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12218 !! input
12219 <html><script>alert(1);</script></html>
12220 !! result
12221 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12222 </p>
12223 !! end
12224
12225 !! test
12226 HTML with raw HTML ($wgRawHtml==true)
12227 !! options
12228 rawhtml
12229 !! input
12230 <html><script>alert(1);</script></html>
12231 !! result
12232 <p><script>alert(1);</script>
12233 </p>
12234 !! end
12235
12236 !! test
12237 Parents of subpages, one level up
12238 !! options
12239 subpage title=[[Subpage test/L1/L2/L3]]
12240 !! input
12241 [[../|L2]]
12242 !! result
12243 <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>
12244 </p>
12245 !! end
12246
12247
12248 !! test
12249 Parents of subpages, one level up, not named
12250 !! options
12251 subpage title=[[Subpage test/L1/L2/L3]]
12252 !! input
12253 [[../]]
12254 !! result
12255 <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>
12256 </p>
12257 !! end
12258
12259
12260
12261 !! test
12262 Parents of subpages, two levels up
12263 !! options
12264 subpage title=[[Subpage test/L1/L2/L3]]
12265 !! input
12266 [[../../|L1]]2
12267
12268 [[../../|L1]]l
12269 !! result
12270 <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
12271 </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>
12272 </p>
12273 !! end
12274
12275 !! test
12276 Parents of subpages, two levels up, without trailing slash or name.
12277 !! options
12278 subpage title=[[Subpage test/L1/L2/L3]]
12279 !! input
12280 [[../..]]
12281 !! result
12282 <p>[[../..]]
12283 </p>
12284 !! end
12285
12286 !! test
12287 Parents of subpages, two levels up, with lots of extra trailing slashes.
12288 !! options
12289 subpage title=[[Subpage test/L1/L2/L3]]
12290 !! input
12291 [[../../////]]
12292 !! result
12293 <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>
12294 </p>
12295 !! end
12296
12297 !! article
12298 Subpage test/L1/L2/L3Sibling
12299 !! text
12300 Sibling article
12301 !! endarticle
12302
12303 !! test
12304 Transclusion of a sibling page (one level up)
12305 !! options
12306 subpage title=[[Subpage test/L1/L2/L3]]
12307 !! input
12308 {{../L3Sibling}}
12309 !! result
12310 <p>Sibling article
12311 </p>
12312 !! end
12313
12314 !! test
12315 Transclusion of a child page
12316 !! options
12317 subpage title=[[Subpage test/L1/L2]]
12318 !! input
12319 {{/L3Sibling}}
12320 !! result
12321 <p>Sibling article
12322 </p>
12323 !! end
12324
12325 !! test
12326 Non-transclusion because of too many up levels
12327 !! options
12328 subpage title=[[Subpage test/L1/L2/L3]]
12329 !! input
12330 {{../../../../More than parent}}
12331 !! result
12332 <p>{{../../../../More than parent}}
12333 </p>
12334 !! end
12335
12336 !! test
12337 Definition list code coverage
12338 !! input
12339 ; title : def
12340 ; title : def
12341 ;title: def
12342 !! result
12343 <dl><dt> title &#160;</dt><dd> def
12344 </dd><dt> title&#160;</dt><dd> def
12345 </dd><dt>title</dt><dd> def
12346 </dd></dl>
12347
12348 !! end
12349
12350 !! test
12351 Don't fall for the self-closing div
12352 !! input
12353 <div>hello world</div/>
12354 !! result
12355 <div>hello world</div>
12356
12357 !! end
12358
12359 !! test
12360 MSGNW magic word
12361 !! input
12362 {{MSGNW:msg}}
12363 !! result
12364 <p>&#91;&#91;:Template:Msg&#93;&#93;
12365 </p>
12366 !! end
12367
12368 !! test
12369 RAW magic word
12370 !! input
12371 {{RAW:QUERTY}}
12372 !! result
12373 <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>
12374 </p>
12375 !! end
12376
12377 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12378 !! test
12379 Always escape literal '>' in output, not just after '<'
12380 !! input
12381 ><>
12382 !! result
12383 <p>&gt;&lt;&gt;
12384 </p>
12385 !! end
12386
12387 !! test
12388 Template caching
12389 !! input
12390 {{Test}}
12391 {{Test}}
12392 !! result
12393 <p>This is a test template
12394 This is a test template
12395 </p>
12396 !! end
12397
12398
12399 !! article
12400 MediaWiki:Fake
12401 !! text
12402 ==header==
12403 !! endarticle
12404
12405 !! test
12406 Inclusion of !userCanEdit() content
12407 !! input
12408 {{MediaWiki:Fake}}
12409 !! result
12410 <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>
12411
12412 !! end
12413
12414
12415 !! test
12416 Out-of-order TOC heading levels
12417 !! input
12418 ==2==
12419 ======6======
12420 ===3===
12421 =1=
12422 =====5=====
12423 ==2==
12424 !! result
12425 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12426 <ul>
12427 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12428 <ul>
12429 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12430 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12431 </ul>
12432 </li>
12433 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12434 <ul>
12435 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12436 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12437 </ul>
12438 </li>
12439 </ul>
12440 </div>
12441 <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>
12442 <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>
12443 <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>
12444 <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>
12445 <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>
12446 <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>
12447
12448 !! end
12449
12450
12451 !! test
12452 ISBN with a dummy number
12453 !! input
12454 ISBN ---
12455 !! result
12456 <p>ISBN ---
12457 </p>
12458 !! end
12459
12460
12461 !! test
12462 ISBN with space-delimited number
12463 !! input
12464 ISBN 92 9017 032 8
12465 !! result
12466 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12467 </p>
12468 !! end
12469
12470
12471 !! test
12472 ISBN with multiple spaces, no number
12473 !! input
12474 ISBN foo
12475 !! result
12476 <p>ISBN foo
12477 </p>
12478 !! end
12479
12480
12481 !! test
12482 ISBN length
12483 !! input
12484 ISBN 123456789
12485
12486 ISBN 1234567890
12487
12488 ISBN 12345678901
12489 !! result
12490 <p>ISBN 123456789
12491 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12492 </p><p>ISBN 12345678901
12493 </p>
12494 !! end
12495
12496
12497 !! test
12498 ISBN with trailing year (bug 8110)
12499 !! input
12500 ISBN 1-234-56789-0 - 2006
12501
12502 ISBN 1 234 56789 0 - 2006
12503 !! result
12504 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12505 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12506 </p>
12507 !! end
12508
12509
12510 !! test
12511 anchorencode
12512 !! input
12513 {{anchorencode:foo bar©#%n}}
12514 !! result
12515 <p>foo_bar.C2.A9.23.25n
12516 </p>
12517 !! end
12518
12519 !! test
12520 anchorencode trims spaces
12521 !! input
12522 {{anchorencode: __pretty__please__}}
12523 !! result
12524 <p>pretty_please
12525 </p>
12526 !! end
12527
12528 !! test
12529 anchorencode deals with links
12530 !! input
12531 {{anchorencode: [[hello|world]] [[hi]]}}
12532 !! result
12533 <p>world_hi
12534 </p>
12535 !! end
12536
12537 !! test
12538 anchorencode deals with templates
12539 !! input
12540 {{anchorencode: {{Foo}} }}
12541 !! result
12542 <p>FOO
12543 </p>
12544 !! end
12545
12546 !! test
12547 anchorencode encodes like the TOC generator: (bug 18431)
12548 !! input
12549 === _ +:.3A%3A&&amp;]] ===
12550 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12551 __NOEDITSECTION__
12552 !! result
12553 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12554 <p>.2B:.3A.253A.26.26.5D.5D
12555 </p>
12556 !! end
12557
12558 # Expected output in the following test is not necessarily expected (there
12559 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12560 # only testing for well-formedness.
12561 !! test
12562 Bug 6200: blockquotes and paragraph formatting
12563 !! input
12564 <blockquote>
12565 foo
12566 </blockquote>
12567
12568 bar
12569
12570 baz
12571 !! result
12572 <blockquote>
12573 foo
12574 </blockquote>
12575 <p>bar
12576 </p>
12577 <pre>baz
12578 </pre>
12579 !! end
12580
12581 !! test
12582 Bug 8293: Use of center tag ruins paragraph formatting
12583 !! input
12584 <center>
12585 foo
12586 </center>
12587
12588 bar
12589
12590 baz
12591 !! result
12592 <center>
12593 <p>foo
12594 </p>
12595 </center>
12596 <p>bar
12597 </p>
12598 <pre>baz
12599 </pre>
12600 !! end
12601
12602 !!test
12603 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12604 !!options
12605 php
12606 !!input
12607 <span><s>x</span></s>
12608 !!result
12609 <p><span><s>x&lt;/span&gt;</s></span>
12610 </p>
12611 !!end
12612
12613 !!test
12614 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12615 !!options
12616 parsoid
12617 !!input
12618 <span><s>x</span></s>
12619 !!result
12620 <p><span><s>x</s></span><s></s>
12621 </p>
12622 !!end
12623
12624 ###
12625 ### Language variants related tests
12626 ###
12627 !! test
12628 Self-link in language variants
12629 !! options
12630 title=[[Dunav]] language=sr
12631 !! input
12632 Both [[Dunav]] and [[Дунав]] are names for this river.
12633 !! result
12634 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12635 </p>
12636 !!end
12637
12638 !! article
12639 Дуна
12640 !! text
12641 content
12642 !! endarticle
12643
12644 !! test
12645 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12646 !! options
12647 title=[[Duna]] language=sr
12648 !! input
12649 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12650 !! result
12651 <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.
12652 </p>
12653 !! end
12654
12655 !! test
12656 Link to pages in language variants
12657 !! options
12658 language=sr
12659 !! input
12660 Main Page can be written as [[Маин Паге]]
12661 !! result
12662 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12663 </p>
12664 !!end
12665
12666
12667 !! test
12668 Multiple links to pages in language variants
12669 !! options
12670 language=sr
12671 !! input
12672 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12673 !! result
12674 <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>.
12675 </p>
12676 !!end
12677
12678
12679 !! test
12680 Simple template in language variants
12681 !! options
12682 language=sr
12683 !! input
12684 {{тест}}
12685 !! result
12686 <p>This is a test template
12687 </p>
12688 !! end
12689
12690
12691 !! test
12692 Template with explicit namespace in language variants
12693 !! options
12694 language=sr
12695 !! input
12696 {{Template:тест}}
12697 !! result
12698 <p>This is a test template
12699 </p>
12700 !! end
12701
12702
12703 !! test
12704 Basic test for template parameter in language variants
12705 !! options
12706 language=sr
12707 !! input
12708 {{парамтест|param=foo}}
12709 !! result
12710 <p>This is a test template with parameter foo
12711 </p>
12712 !! end
12713
12714
12715 !! test
12716 Simple category in language variants
12717 !! options
12718 language=sr cat
12719 !! input
12720 [[Category:МедиаWики Усер'с Гуиде]]
12721 !! result
12722 <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>
12723 !! end
12724
12725
12726 !! article
12727 Category:分类
12728 !! text
12729 blah
12730 !! endarticle
12731
12732 !! article
12733 Category:分類
12734 !! text
12735 blah
12736 !! endarticle
12737
12738 !! test
12739 Don't convert blue categorylinks to another variant (bug 33210)
12740 !! options
12741 language=zh cat
12742 !! input
12743 [[A]][[Category:分类]]
12744 !! result
12745 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12746 !! end
12747
12748
12749 !! test
12750 Stripping -{}- tags (language variants)
12751 !! options
12752 language=sr
12753 !! input
12754 Latin proverb: -{Ne nuntium necare}-
12755 !! result
12756 <p>Latin proverb: Ne nuntium necare
12757 </p>
12758 !! end
12759
12760
12761 !! test
12762 Prevent conversion with -{}- tags (language variants)
12763 !! options
12764 language=sr variant=sr-ec
12765 !! input
12766 Latinski: -{Ne nuntium necare}-
12767 !! result
12768 <p>Латински: Ne nuntium necare
12769 </p>
12770 !! end
12771
12772
12773 !! test
12774 Prevent conversion of text with -{}- tags (language variants)
12775 !! options
12776 language=sr variant=sr-ec
12777 !! input
12778 Latinski: -{Ne nuntium necare}-
12779 !! result
12780 <p>Латински: Ne nuntium necare
12781 </p>
12782 !! end
12783
12784
12785 !! test
12786 Prevent conversion of links with -{}- tags (language variants)
12787 !! options
12788 language=sr variant=sr-ec
12789 !! input
12790 -{[[Main Page]]}-
12791 !! result
12792 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12793 </p>
12794 !! end
12795
12796
12797 !! test
12798 -{}- tags within headlines (within html for parserConvert())
12799 !! options
12800 language=sr variant=sr-ec
12801 !! input
12802 == -{Naslov}- ==
12803 !! result
12804 <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>
12805
12806 !! end
12807
12808
12809 !! test
12810 Explicit definition of language variant alternatives
12811 !! options
12812 language=zh variant=zh-tw
12813 !! input
12814 -{zh:China;zh-tw:Taiwan}-, not China
12815 !! result
12816 <p>Taiwan, not China
12817 </p>
12818 !! end
12819
12820
12821 !! test
12822 Conversion around HTML tags
12823 !! options
12824 language=sr variant=sr-ec
12825 !! input
12826 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12827 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12828 !! result
12829 <p>
12830 <span title="ЛаCтин">ски</span>
12831 </p>
12832 !! end
12833
12834
12835 !! test
12836 Explicit session-wise language variant mapping (A flag and - flag)
12837 !! options
12838 language=zh variant=zh-tw
12839 !! input
12840 Taiwan is not China.
12841 But -{A|zh:China;zh-tw:Taiwan}- is China,
12842 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12843 and -{China}- is China.
12844 !! result
12845 <p>Taiwan is not China.
12846 But Taiwan is Taiwan,
12847 (This should be stripped!)
12848 and China is China.
12849 </p>
12850 !! end
12851
12852 !! test
12853 Explicit session-wise language variant mapping (H flag for hide)
12854 !! options
12855 language=zh variant=zh-tw
12856 !! input
12857 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12858 Taiwan is China.
12859 !! result
12860 <p>(This should be stripped!)
12861 Taiwan is Taiwan.
12862 </p>
12863 !! end
12864
12865 !! test
12866 Adding explicit conversion rule for title (T flag)
12867 !! options
12868 language=zh variant=zh-tw showtitle
12869 !! input
12870 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12871 !! result
12872 Taiwan
12873 <p>Should be stripped!
12874 </p>
12875 !! end
12876
12877 !! test
12878 Testing that changing the language variant here in the tests actually works
12879 !! options
12880 language=zh variant=zh showtitle
12881 !! input
12882 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12883 !! result
12884 China
12885 <p>Should be stripped!
12886 </p>
12887 !! end
12888
12889 !! test
12890 Recursive conversion of alt and title attrs shouldn't clear converter state
12891 !! options
12892 language=zh variant=zh-cn showtitle
12893 !! input
12894 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12895 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12896 !! result
12897 China
12898 <p>
12899 Should be stripped<span title="Exclamation">!</span>
12900 </p>
12901 !! end
12902
12903 !! test
12904 Bug 24072: more test on conversion rule for title
12905 !! options
12906 language=zh variant=zh-tw showtitle
12907 !! input
12908 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12909 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12910 !! result
12911 Taiwan
12912 <p>This should be stripped!
12913 This won't take interferes with the title rule.
12914 </p>
12915 !! end
12916
12917 !! test
12918 Partly disable title conversion if variant == main language code
12919 !! options
12920 language=zh variant=zh title=[[ZH]] showtitle
12921 !! input
12922 -{T|zh-cn:CN;zh-tw:TW}-
12923 !! result
12924 ZH
12925 <p>
12926 </p>
12927 !! end
12928
12929 !! test
12930 Partly disable title conversion if variant == main language code, more
12931 !! options
12932 language=zh variant=zh title=[[ZH]] showtitle
12933 !! input
12934 -{T|TW}-
12935 !! result
12936 ZH
12937 <p>
12938 </p>
12939 !! end
12940
12941 !! test
12942 Raw output of variant escape tags (R flag)
12943 !! options
12944 language=zh variant=zh-tw
12945 !! input
12946 Raw: -{R|zh:China;zh-tw:Taiwan}-
12947 !! result
12948 <p>Raw: zh:China;zh-tw:Taiwan
12949 </p>
12950 !! end
12951
12952 !! test
12953 Nested using of manual convert syntax
12954 !! options
12955 language=zh variant=zh-hk
12956 !! input
12957 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12958 !! result
12959 <p>Nested: Hello Hong Kong!
12960 </p>
12961 !! end
12962
12963 !! test
12964 Proper conversion of text in external links
12965 !! options
12966 language=sr variant=sr-ec
12967 !! input
12968 http://www.google.com
12969 gopher://www.google.com
12970 [http://www.google.com http://www.google.com]
12971 [gopher://www.google.com gopher://www.google.com]
12972 [https://www.google.com irc://www.google.com]
12973 [ftp://www.google.com www.google.com/ftp://dir]
12974 [//www.google.com www.google.com]
12975 !! result
12976 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12977 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12978 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12979 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12980 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12981 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12982 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12983 </p>
12984 !! end
12985
12986 !! test
12987 Do not convert roman numbers to language variants
12988 !! options
12989 language=sr variant=sr-ec
12990 !! input
12991 Fridrih IV je car.
12992 !! result
12993 <p>Фридрих IV је цар.
12994 </p>
12995 !! end
12996
12997 !! test
12998 Unclosed language converter markup "-{"
12999 !! options
13000 language=sr
13001 !! input
13002 -{T|hello
13003 !! result
13004 <p>-{T|hello
13005 </p>
13006 !! end
13007
13008 !! test
13009 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13010 !! options
13011 language=sr
13012 !! input
13013 -{R|=&gt;}-
13014 !! result
13015 <p>=&gt;
13016 </p>
13017 !!end
13018
13019 !!article
13020 Template:Bullet
13021 !!text
13022 * Bar
13023 !!endarticle
13024
13025 !! test
13026 Bug 529: Uncovered bullet
13027 !! input
13028 * Foo {{bullet}}
13029 !! result
13030 <ul><li> Foo
13031 </li><li> Bar
13032 </li></ul>
13033
13034 !! end
13035
13036 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13037 # Templates in Wikipedia rely on this behavior, as tidy has always been
13038 # enabled there. These tests are normally run *without* tidy, so specify the
13039 # full output here.
13040 # To test realistic parsing behavior, apply a tidy-like transformation to both
13041 # the expected output and your parser's output.
13042 !! test
13043 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13044 !! input
13045 ******* Foo {{bullet}}
13046 !! result
13047 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13048 </li></ul>
13049 </li></ul>
13050 </li></ul>
13051 </li></ul>
13052 </li></ul>
13053 </li></ul>
13054 </li><li> Bar
13055 </li></ul>
13056
13057 !! end
13058
13059 !! test
13060 Bug 529: Uncovered table already at line-start
13061 !! input
13062 x
13063
13064 {{table}}
13065 y
13066 !! result
13067 <p>x
13068 </p>
13069 <table>
13070 <tr>
13071 <td> 1 </td>
13072 <td> 2
13073 </td></tr>
13074 <tr>
13075 <td> 3 </td>
13076 <td> 4
13077 </td></tr></table>
13078 <p>y
13079 </p>
13080 !! end
13081
13082 !! test
13083 Bug 529: Uncovered bullet in parser function result
13084 !! input
13085 * Foo {{lc:{{bullet}} }}
13086 !! result
13087 <ul><li> Foo
13088 </li><li> bar
13089 </li></ul>
13090
13091 !! end
13092
13093 !! test
13094 Bug 5678: Double-parsed template argument
13095 !! input
13096 {{lc:{{{1}}}|hello}}
13097 !! result
13098 <p>{{{1}}}
13099 </p>
13100 !! end
13101
13102 !! test
13103 Bug 5678: Double-parsed template invocation
13104 !! input
13105 {{lc:{{paramtest {{!}} param = hello }} }}
13106 !! result
13107 <p>{{paramtest | param = hello }}
13108 </p>
13109 !! end
13110
13111 !! test
13112 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13113 !! options
13114 language=cs
13115 title=[[Main Page]]
13116 !! input
13117 {{PRVNÍVELKÉ:ěščř}}
13118 {{prvnívelké:ěščř}}
13119 {{PRVNÍMALÉ:ěščř}}
13120 {{prvnímalé:ěščř}}
13121 {{MALÁ:ěščř}}
13122 {{malá:ěščř}}
13123 {{VELKÁ:ěščř}}
13124 {{velká:ěščř}}
13125 !! result
13126 <p>Ěščř
13127 Ěščř
13128 ěščř
13129 ěščř
13130 ěščř
13131 ěščř
13132 ĚŠČŘ
13133 ĚŠČŘ
13134 </p>
13135 !! end
13136
13137 !! test
13138 Morwen/13: Unclosed link followed by heading
13139 !! input
13140 [[link
13141 ==heading==
13142 !! result
13143 <p>[[link
13144 </p>
13145 <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>
13146
13147 !! end
13148
13149 !! test
13150 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13151 !! input
13152 {{foo|
13153 =heading=
13154 !! result
13155 <p>{{foo|
13156 </p>
13157 <h1><span class="mw-headline" id="heading">heading</span></h1>
13158
13159 !! end
13160
13161 !! test
13162 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13163 !! input
13164 {{foo|
13165 ==heading==
13166 !! result
13167 <p>{{foo|
13168 </p>
13169 <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>
13170
13171 !! end
13172
13173 !! test
13174 Tildes in comments
13175 !! options
13176 pst
13177 !! input
13178 <!-- ~~~~ -->
13179 !! result
13180 <!-- ~~~~ -->
13181 !! end
13182
13183 !! test
13184 Paragraphs inside divs (no extra line breaks)
13185 !! input
13186 <div>Line one
13187
13188 Line two</div>
13189 !! result
13190 <div>Line one
13191 Line two</div>
13192
13193 !! end
13194
13195 !! test
13196 Paragraphs inside divs (extra line break on open)
13197 !! input
13198 <div>
13199 Line one
13200
13201 Line two</div>
13202 !! result
13203 <div>
13204 <p>Line one
13205 </p>
13206 Line two</div>
13207
13208 !! end
13209
13210 !! test
13211 Paragraphs inside divs (extra line break on close)
13212 !! input
13213 <div>Line one
13214
13215 Line two
13216 </div>
13217 !! result
13218 <div>Line one
13219 <p>Line two
13220 </p>
13221 </div>
13222
13223 !! end
13224
13225 !! test
13226 Paragraphs inside divs (extra line break on open and close)
13227 !! input
13228 <div>
13229 Line one
13230
13231 Line two
13232 </div>
13233 !! result
13234 <div>
13235 <p>Line one
13236 </p><p>Line two
13237 </p>
13238 </div>
13239
13240 !! end
13241
13242 !! test
13243 Nesting tags, paragraphs on lines which begin with <div>
13244 !! options
13245 disabled
13246 !! input
13247 <div></div><strong>A
13248 B</strong>
13249 !! result
13250 <div></div>
13251 <p><strong>A
13252 B</strong>
13253 </p>
13254 !! end
13255
13256 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13257 !! test
13258 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13259 !! options
13260 disabled
13261 !! input
13262 <blockquote>Line one
13263
13264 Line two</blockquote>
13265 !! result
13266 <blockquote>Line one
13267 Line two</blockquote>
13268
13269 !! end
13270
13271 !! test
13272 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13273 !! options
13274 disabled
13275 !! input
13276 <blockquote>
13277 Line one
13278
13279 Line two</blockquote>
13280 !! result
13281 <blockquote>
13282 <p>Line one
13283 </p>
13284 Line two</blockquote>
13285
13286 !! end
13287
13288 !! test
13289 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13290 !! options
13291 disabled
13292 !! input
13293 <blockquote>Line one
13294
13295 Line two
13296 </blockquote>
13297 !! result
13298 <blockquote>Line one
13299 <p>Line two
13300 </p>
13301 </blockquote>
13302
13303 !! end
13304
13305 !! test
13306 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13307 !! options
13308 disabled
13309 !! input
13310 <blockquote>
13311 Line one
13312
13313 Line two
13314 </blockquote>
13315 !! result
13316 <blockquote>
13317 <p>Line one
13318 </p><p>Line two
13319 </p>
13320 </blockquote>
13321
13322 !! end
13323
13324 !! test
13325 Paragraphs inside blockquotes/divs (no extra line breaks)
13326 !! input
13327 <blockquote><div>Line one
13328
13329 Line two</div></blockquote>
13330 !! result
13331 <blockquote><div>Line one
13332 Line two</div></blockquote>
13333
13334 !! end
13335
13336 !! test
13337 Paragraphs inside blockquotes/divs (extra line break on open)
13338 !! input
13339 <blockquote><div>
13340 Line one
13341
13342 Line two</div></blockquote>
13343 !! result
13344 <blockquote><div>
13345 <p>Line one
13346 </p>
13347 Line two</div></blockquote>
13348
13349 !! end
13350
13351 !! test
13352 Paragraphs inside blockquotes/divs (extra line break on close)
13353 !! input
13354 <blockquote><div>Line one
13355
13356 Line two
13357 </div></blockquote>
13358 !! result
13359 <blockquote><div>Line one
13360 <p>Line two
13361 </p>
13362 </div></blockquote>
13363
13364 !! end
13365
13366 !! test
13367 Paragraphs inside blockquotes/divs (extra line break on open and close)
13368 !! input
13369 <blockquote><div>
13370 Line one
13371
13372 Line two
13373 </div></blockquote>
13374 !! result
13375 <blockquote><div>
13376 <p>Line one
13377 </p><p>Line two
13378 </p>
13379 </div></blockquote>
13380
13381 !! end
13382
13383 !! test
13384 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13385 !! options
13386 wgLinkHolderBatchSize=0
13387 !! input
13388 [[meatball:1]]
13389 [[meatball:2]]
13390 [[meatball:3]]
13391 !! result
13392 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13393 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13394 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13395 </p>
13396 !! end
13397
13398 !! test
13399 Free external link invading image caption
13400 !! input
13401 [[Image:Foobar.jpg|thumb|http://x|hello]]
13402 !! result
13403 <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>
13404
13405 !! end
13406
13407 !! test
13408 Bug 15196: localised external link numbers
13409 !! options
13410 language=fa
13411 !! input
13412 [http://en.wikipedia.org/]
13413 !! result
13414 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13415 </p>
13416 !! end
13417
13418 !! test
13419 Multibyte character in padleft
13420 !! input
13421 {{padleft:-Hello|7|Æ}}
13422 !! result
13423 <p>Æ-Hello
13424 </p>
13425 !! end
13426
13427 !! test
13428 Multibyte character in padright
13429 !! input
13430 {{padright:Hello-|7|Æ}}
13431 !! result
13432 <p>Hello-Æ
13433 </p>
13434 !! end
13435
13436 !!test
13437 formatdate parser function
13438 !!input
13439 {{#formatdate:2009-03-24}}
13440 !! result
13441 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13442 </p>
13443 !! end
13444
13445 !!test
13446 formatdate parser function, with default format
13447 !!input
13448 {{#formatdate:2009-03-24|mdy}}
13449 !! result
13450 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13451 </p>
13452 !! end
13453
13454 !! test
13455 Spacing of numbers in formatted dates
13456 !! input
13457 {{#formatdate:January 15}}
13458 !! result
13459 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13460 </p>
13461 !! end
13462
13463 !! test
13464 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
13465 !! options
13466 language=nl title=[[MediaWiki:Common.css]]
13467 !! input
13468 {{#formatdate:2009-03-24|dmy}}
13469 !! result
13470 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13471 </p>
13472 !! end
13473
13474 #
13475 #
13476 #
13477
13478 #
13479 # Edit comments
13480 #
13481
13482 !! test
13483 Edit comment with link
13484 !! options
13485 comment
13486 !! input
13487 I like the [[Main Page]] a lot
13488 !! result
13489 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13490 !!end
13491
13492 !! test
13493 Edit comment with link and link text
13494 !! options
13495 comment
13496 !! input
13497 I like the [[Main Page|best pages]] a lot
13498 !! result
13499 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13500 !!end
13501
13502 !! test
13503 Edit comment with link and link text with suffix
13504 !! options
13505 comment
13506 !! input
13507 I like the [[Main Page|best page]]s a lot
13508 !! result
13509 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13510 !!end
13511
13512 !! test
13513 Edit comment with section link (non-local, eg in history list)
13514 !! options
13515 comment title=[[Main Page]]
13516 !! input
13517 /* External links */ removed bogus entries
13518 !! result
13519 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13520 !!end
13521
13522 !! test
13523 Edit comment with section link and text before it (non-local, eg in history list)
13524 !! options
13525 comment title=[[Main Page]]
13526 !! input
13527 pre-comment text /* External links */ removed bogus entries
13528 !! result
13529 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>
13530 !!end
13531
13532 !! test
13533 Edit comment with section link (local, eg in diff view)
13534 !! options
13535 comment local title=[[Main Page]]
13536 !! input
13537 /* External links */ removed bogus entries
13538 !! result
13539 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13540 !!end
13541
13542 !! test
13543 Edit comment with subpage link (bug 14080)
13544 !! options
13545 comment
13546 subpage
13547 title=[[Subpage test]]
13548 !! input
13549 Poked at a [[/subpage]] here...
13550 !! result
13551 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13552 !!end
13553
13554 !! test
13555 Edit comment with subpage link and link text (bug 14080)
13556 !! options
13557 comment
13558 subpage
13559 title=[[Subpage test]]
13560 !! input
13561 Poked at a [[/subpage|neat little page]] here...
13562 !! result
13563 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13564 !!end
13565
13566 !! test
13567 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13568 !! options
13569 comment
13570 title=[[Subpage test]]
13571 !! input
13572 Poked at a [[/subpage]] here...
13573 !! result
13574 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...
13575 !!end
13576
13577 !! test
13578 Edit comment with bare anchor link (local, as on diff)
13579 !! options
13580 comment
13581 local
13582 title=[[Main Page]]
13583 !!input
13584 [[#section]]
13585 !! result
13586 <a href="#section">#section</a>
13587 !! end
13588
13589 !! test
13590 Edit comment with bare anchor link (non-local, as on history)
13591 !! options
13592 comment
13593 title=[[Main Page]]
13594 !!input
13595 [[#section]]
13596 !! result
13597 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13598 !! end
13599
13600 !! test
13601 Anchor starting with underscore
13602 !!input
13603 [[#_ref|One]]
13604 !! result
13605 <p><a href="#_ref">One</a>
13606 </p>
13607 !! end
13608
13609 !! test
13610 Id starting with underscore
13611 !!input
13612 <div id="_ref"></div>
13613 !! result
13614 <div id="_ref"></div>
13615
13616 !! end
13617
13618 !! test
13619 Space normalisation on autocomment (bug 22784)
13620 !! options
13621 comment
13622 title=[[Main Page]]
13623 !!input
13624 /* __hello__world__ */
13625 !! result
13626 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13627 !! end
13628
13629 !! test
13630 percent-encoding and + signs in comments (Bug 26410)
13631 !! options
13632 comment
13633 !!input
13634 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13635 !! result
13636 <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>
13637 !! end
13638
13639 !! test
13640 Bad images - basic functionality
13641 !! options
13642 disabled
13643 !! input
13644 [[File:Bad.jpg]]
13645 !! result
13646 !! end
13647
13648 !! test
13649 Bad images - bug 16039: text after bad image disappears
13650 !! options
13651 disabled
13652 !! input
13653 Foo bar
13654 [[File:Bad.jpg]]
13655 Bar foo
13656 !! result
13657 <p>Foo bar
13658 </p><p>Bar foo
13659 </p>
13660 !! end
13661
13662 !! test
13663 Verify that displaytitle works (bug #22501) no displaytitle
13664 !! options
13665 showtitle
13666 !! config
13667 wgAllowDisplayTitle=true
13668 wgRestrictDisplayTitle=false
13669 !! input
13670 this is not the the title
13671 !! result
13672 Parser test
13673 <p>this is not the the title
13674 </p>
13675 !! end
13676
13677 !! test
13678 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13679 !! options
13680 showtitle
13681 title=[[Screen]]
13682 !! config
13683 wgAllowDisplayTitle=true
13684 wgRestrictDisplayTitle=false
13685 !! input
13686 this is not the the title
13687 {{DISPLAYTITLE:whatever}}
13688 !! result
13689 whatever
13690 <p>this is not the the title
13691 </p>
13692 !! end
13693
13694 !! test
13695 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13696 !! options
13697 showtitle
13698 title=[[Screen]]
13699 !! config
13700 wgAllowDisplayTitle=true
13701 wgRestrictDisplayTitle=true
13702 !! input
13703 this is not the the title
13704 {{DISPLAYTITLE:whatever}}
13705 !! result
13706 Screen
13707 <p>this is not the the title
13708 </p>
13709 !! end
13710
13711 !! test
13712 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13713 !! options
13714 showtitle
13715 title=[[Screen]]
13716 !! config
13717 wgAllowDisplayTitle=true
13718 wgRestrictDisplayTitle=true
13719 !! input
13720 this is not the the title
13721 {{DISPLAYTITLE:screen}}
13722 !! result
13723 screen
13724 <p>this is not the the title
13725 </p>
13726 !! end
13727
13728 !! test
13729 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13730 !! options
13731 showtitle
13732 title=[[Screen]]
13733 !! config
13734 wgAllowDisplayTitle=false
13735 !! input
13736 this is not the the title
13737 {{DISPLAYTITLE:screen}}
13738 !! result
13739 Screen
13740 <p>this is not the the title
13741 <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>
13742 </p>
13743 !! end
13744
13745 !! test
13746 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13747 !! options
13748 showtitle
13749 title=[[Screen]]
13750 !! config
13751 wgAllowDisplayTitle=false
13752 !! input
13753 this is not the the title
13754 !! result
13755 Screen
13756 <p>this is not the the title
13757 </p>
13758 !! end
13759
13760 !! test
13761 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13762 !! options
13763 showtitle
13764 title=[[Screen]]
13765 !! config
13766 wgAllowDisplayTitle=true
13767 wgRestrictDisplayTitle=true
13768 !! input
13769 this is not the the title
13770 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13771 !! result
13772 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13773 <p>this is not the the title
13774 </p>
13775 !! end
13776
13777 !! test
13778 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13779 !! options
13780 showtitle
13781 title=[[Screen]]
13782 !! config
13783 wgAllowDisplayTitle=true
13784 wgRestrictDisplayTitle=true
13785 !! input
13786 this is not the the title
13787 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13788 !! result
13789 <span style="color: red;">s</span>creen
13790 <p>this is not the the title
13791 </p>
13792 !! end
13793
13794 !! test
13795 preload: check <noinclude> and <includeonly>
13796 !! options
13797 preload
13798 !! input
13799 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13800 !! result
13801 Hello kind world.
13802 !! end
13803
13804 !! test
13805 preload: check <onlyinclude>
13806 !! options
13807 preload
13808 !! input
13809 Goodbye <onlyinclude>Hello world</onlyinclude>
13810 !! result
13811 Hello world
13812 !! end
13813
13814 !! test
13815 preload: can pass tags through if we want to
13816 !! options
13817 preload
13818 !! input
13819 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13820 !! result
13821 <includeonly>Hello world</includeonly>
13822 !! end
13823
13824 !! test
13825 preload: check that it doesn't try to do tricks
13826 !! options
13827 preload
13828 !! input
13829 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13830 !! result
13831 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13832 !! end
13833
13834 !! test
13835 Play a bit with r67090 and bug 3158
13836 !! options
13837 disabled
13838 !! input
13839 <div style="width:50% !important">&nbsp;</div>
13840 <div style="width:50%&nbsp;!important">&nbsp;</div>
13841 <div style="width:50%&#160;!important">&nbsp;</div>
13842 <div style="border : solid;">&nbsp;</div>
13843 !! result
13844 <div style="width:50% !important">&nbsp;</div>
13845 <div style="width:50% !important">&nbsp;</div>
13846 <div style="width:50% !important">&nbsp;</div>
13847 <div style="border&#160;: solid;">&nbsp;</div>
13848
13849 !! end
13850
13851 !! test
13852 HTML5 data attributes
13853 !! input
13854 <span data-foo="bar">Baz</span>
13855 <p data-abc-def_hij="">Quuz</p>
13856 !! result
13857 <p><span data-foo="bar">Baz</span>
13858 </p>
13859 <p data-abc-def_hij="">Quuz</p>
13860
13861 !! end
13862
13863 !! test
13864 percent-encoding and + signs in internal links (Bug 26410)
13865 !! input
13866 [[User:+%]] [[Page+title%]]
13867 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13868 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13869 [[%33%45]] [[%33%45+]]
13870 !! result
13871 <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>
13872 <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>
13873 <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>
13874 <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>
13875 </p>
13876 !! end
13877
13878 !! test
13879 Special characters in embedded file links (bug 27679)
13880 !! input
13881 [[File:Contains & ampersand.jpg]]
13882 [[File:Does not exist.jpg|Title with & ampersand]]
13883 !! result
13884 <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>
13885 <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>
13886 </p>
13887 !! end
13888
13889
13890 !! test
13891 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13892 !! input
13893 Text&apos;s been normalized?
13894 !! result
13895 <p>Text&#39;s been normalized?
13896 </p>
13897 !! end
13898
13899 !! test
13900 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13901 !! input
13902 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13903 !! result
13904 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13905 </p>
13906 !! end
13907
13908 !! test
13909 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13910 !! input
13911 [http://www.example.org/ ideograms]
13912 !! result
13913 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13914 </p>
13915 !! end
13916
13917 !! test
13918 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13919 !! input
13920 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13921 !! result
13922 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13923 </p>
13924 !! end
13925
13926 !! article
13927 Mediawiki:loop1
13928 !! text
13929 {{Identical|A}}
13930 !! endarticle
13931
13932 !! article
13933 Mediawiki:loop2
13934 !! text
13935 {{Identical|B}}
13936 !! endarticle
13937
13938 !! article
13939 Template:Identical
13940 !! text
13941 {{int:loop1}}
13942 {{int:loop2}}
13943 !! endarticle
13944
13945 !! test
13946 Bug 31098 Template which includes system messages which includes the template
13947 !! input
13948 {{Identical}}
13949 !! result
13950 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13951 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13952 </p>
13953 !! end
13954
13955 !! test
13956 Bug31490 Turkish: ucfirst 'blah'
13957 !! options
13958 language=tr
13959 !! input
13960 {{ucfirst:blah}}
13961 !! result
13962 <p>Blah
13963 </p>
13964 !! end
13965
13966 !! test
13967 Bug31490 Turkish: ucfirst 'ix'
13968 !! options
13969 language=tr
13970 !! input
13971 {{ucfirst:ix}}
13972 !! result
13973 <p>İx
13974 </p>
13975 !! end
13976
13977 !! test
13978 Bug31490 Turkish: lcfirst 'BLAH'
13979 !! options
13980 language=tr
13981 !! input
13982 {{lcfirst:BLAH}}
13983 !! result
13984 <p>bLAH
13985 </p>
13986 !! end
13987
13988 !! test
13989 Bug31490 Turkish: ucfırst (with a dotless i)
13990 !! options
13991 language=tr
13992 !! input
13993 {{ucfırst:blah}}
13994 !! result
13995 <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>
13996 </p>
13997 !! end
13998
13999 !! test
14000 Bug31490 ucfırst (with a dotless i) with English language
14001 !! options
14002 language=en
14003 !! input
14004 {{ucfırst:blah}}
14005 !! result
14006 <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>
14007 </p>
14008 !! end
14009
14010 !! test
14011 Bug 26375: TOC with italics
14012 !! options
14013 title=[[Main Page]]
14014 !! input
14015 __TOC__
14016 == ''Lost'' episodes ==
14017 !! result
14018 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14019 <ul>
14020 <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>
14021 </ul>
14022 </div>
14023 <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>
14024
14025 !! end
14026
14027 !! test
14028 Bug 26375: TOC with bold
14029 !! options
14030 title=[[Main Page]]
14031 !! input
14032 __TOC__
14033 == '''should be bold''' then normal text ==
14034 !! result
14035 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14036 <ul>
14037 <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>
14038 </ul>
14039 </div>
14040 <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>
14041
14042 !! end
14043
14044 !! test
14045 Bug 33845: Headings become cursive in TOC when they contain an image
14046 !! options
14047 title=[[Main Page]]
14048 !! input
14049 __TOC__
14050 == Image [[Image:foobar.jpg]] ==
14051 !! result
14052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14053 <ul>
14054 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14055 </ul>
14056 </div>
14057 <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>
14058
14059 !! end
14060
14061 !! test
14062 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14063 !! options
14064 title=[[Main Page]]
14065 !! input
14066 __TOC__
14067 == <blockquote>Quote</blockquote> ==
14068 !! result
14069 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14070 <ul>
14071 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14072 </ul>
14073 </div>
14074 <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>
14075
14076 !! end
14077
14078 !! test
14079 Unclosed tags in TOC
14080 !! options
14081 title=[[Main Page]]
14082 !! input
14083 __TOC__
14084 == Proof: 2 < 3 ==
14085 <small>Hanc marginis exiguitas non caperet.</small>
14086 QED
14087 !! result
14088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14089 <ul>
14090 <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>
14091 </ul>
14092 </div>
14093 <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>
14094 <p><small>Hanc marginis exiguitas non caperet.</small>
14095 QED
14096 </p>
14097 !! end
14098
14099 !! test
14100 Multiple tags in TOC
14101 !! input
14102 __TOC__
14103 == <i>Foo</i> <b>Bar</b> ==
14104
14105 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14106 !! result
14107 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14108 <ul>
14109 <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>
14110 <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>
14111 </ul>
14112 </div>
14113 <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>
14114 <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>
14115
14116 !! end
14117
14118 !! test
14119 Tags with parameters in TOC
14120 !! input
14121 __TOC__
14122 == <sup class="in-h2">Hello</sup> ==
14123
14124 == <sup class="a > b">Evilbye</sup> ==
14125 !! result
14126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14127 <ul>
14128 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14129 <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>
14130 </ul>
14131 </div>
14132 <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>
14133 <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>
14134
14135 !! end
14136
14137 !! test
14138 span tags with directionality in TOC
14139 !! input
14140 __TOC__
14141 == <span dir="ltr">C++</span> ==
14142
14143 == <span dir="rtl">זבנג!</span> ==
14144
14145 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14146
14147 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14148
14149 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14150 !! result
14151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14152 <ul>
14153 <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>
14154 <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>
14155 <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>
14156 <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>
14157 <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>
14158 </ul>
14159 </div>
14160 <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>
14161 <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>
14162 <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>
14163 <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>
14164 <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>
14165
14166 !! end
14167
14168 !! article
14169 MediaWiki:Bug32057
14170 !! text
14171 == {{int:headline_sample}} ==
14172 !! endarticle
14173
14174 !! test
14175 Bug 32057: Title needed when expanding <h> nodes.
14176 !! options
14177 title=[[Main Page]]
14178 !! input
14179 {{int:Bug32057}}
14180 !! result
14181 <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>
14182
14183 !! end
14184
14185 !! test
14186 Strip marker in urlencode
14187 !! input
14188 {{urlencode:x<nowiki/>y}}
14189 {{urlencode:x<nowiki/>y|wiki}}
14190 {{urlencode:x<nowiki/>y|path}}
14191 !! result
14192 <p>xy
14193 xy
14194 xy
14195 </p>
14196 !! end
14197
14198 !! test
14199 Strip marker in lc
14200 !! input
14201 {{lc:x<nowiki/>y}}
14202 !! result
14203 <p>xy
14204 </p>
14205 !! end
14206
14207 !! test
14208 Strip marker in uc
14209 !! input
14210 {{uc:x<nowiki/>y}}
14211 !! result
14212 <p>XY
14213 </p>
14214 !! end
14215
14216 !! test
14217 Strip marker in formatNum
14218 !! input
14219 {{formatnum:1<nowiki/>2}}
14220 {{formatnum:1<nowiki/>2|R}}
14221 !! result
14222 <p>12
14223 12
14224 </p>
14225 !! end
14226
14227 !! test
14228 Check noCommafy in formatNum
14229 !! options
14230 language=be-tarask
14231 !! input
14232 {{formatnum:123456.78}}
14233 {{formatnum:123456.78|NOSEP}}
14234 !! result
14235 <p>123 456,78
14236 123456.78
14237 </p>
14238 !! end
14239
14240 !! test
14241 Strip marker in grammar
14242 !! options
14243 language=fi
14244 !! input
14245 {{grammar:elative|foo<nowiki/>bar}}
14246 !! result
14247 <p>foobarista
14248 </p>
14249 !! end
14250
14251 !! test
14252 Strip marker in padleft
14253 !! input
14254 {{padleft:|2|x<nowiki/>y}}
14255 !! result
14256 <p>xy
14257 </p>
14258 !! end
14259
14260 !! test
14261 Strip marker in padright
14262 !! input
14263 {{padright:|2|x<nowiki/>y}}
14264 !! result
14265 <p>xy
14266 </p>
14267 !! end
14268
14269 !! test
14270 Strip marker in anchorencode
14271 !! input
14272 {{anchorencode:x<nowiki/>y}}
14273 !! result
14274 <p>xy
14275 </p>
14276 !! end
14277
14278 !! test
14279 nowiki inside link inside heading (bug 18295)
14280 !! input
14281 ==[[foo|x<nowiki>y</nowiki>z]]==
14282 !! result
14283 <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>
14284
14285 !! end
14286
14287 !! test
14288 new support for bdi element (bug 31817)
14289 !! input
14290 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14291 !! result
14292 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14293
14294 !!end
14295
14296 !! test
14297 Ignore pipe between table row attributes
14298 !! input
14299 {|
14300 | quux
14301 |- id=foo | style='color: red'
14302 | bar
14303 |}
14304 !! result
14305 <table>
14306 <tr>
14307 <td> quux
14308 </td></tr>
14309 <tr id="foo" style="color: red">
14310 <td> bar
14311 </td></tr></table>
14312
14313 !! end
14314
14315 !!test
14316 Gallery override link with WikiLink (bug 34852)
14317 !! input
14318 <gallery>
14319 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14320 </gallery>
14321 !! result
14322 <ul class="gallery">
14323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14324 <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>
14325 <div class="gallerytext">
14326 <p>caption
14327 </p>
14328 </div>
14329 </div></li>
14330 </ul>
14331
14332 !! end
14333
14334 !!test
14335 Gallery override link with absolute external link (bug 34852)
14336 !! input
14337 <gallery>
14338 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14339 </gallery>
14340 !! result
14341 <ul class="gallery">
14342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14343 <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>
14344 <div class="gallerytext">
14345 <p>caption
14346 </p>
14347 </div>
14348 </div></li>
14349 </ul>
14350
14351 !! end
14352
14353 !!test
14354 Gallery override link with malicious javascript (bug 34852)
14355 !! input
14356 <gallery>
14357 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14358 </gallery>
14359 !! result
14360 <ul class="gallery">
14361 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14362 <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>
14363 <div class="gallerytext">
14364 <p>caption
14365 </p>
14366 </div>
14367 </div></li>
14368 </ul>
14369
14370 !! end
14371
14372 !!test
14373 Gallery with invalid title as link (bug 43964)
14374 !! input
14375 <gallery>
14376 File:foobar.jpg|link=<
14377 </gallery>
14378 !! result
14379 <ul class="gallery">
14380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14381 <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>
14382 <div class="gallerytext">
14383 </div>
14384 </div></li>
14385 </ul>
14386
14387 !! end
14388
14389 !!test
14390 Language parser function
14391 !! input
14392 {{#language:ar}}
14393 !! result
14394 <p>العربية
14395 </p>
14396 !! end
14397
14398 !!test
14399 Padleft and padright as substr
14400 !! input
14401 {{padleft:|3|abcde}}
14402 {{padright:|3|abcde}}
14403 !! result
14404 <p>abc
14405 abc
14406 </p>
14407 !! end
14408
14409 !!test
14410 Special parser function
14411 !! input
14412 {{#special:RandomPage}}
14413 {{#special:BaDtItLe}}
14414 {{#special:Foobar}}
14415 !! result
14416 <p>Special:Random
14417 Special:Badtitle
14418 Special:Foobar
14419 </p>
14420 !! end
14421
14422 !!test
14423 Bug 34939 - Case insensitive link parsing ([HttP://])
14424 !! input
14425 [HttP://MediaWiki.Org/]
14426 !! result
14427 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14428 </p>
14429 !! end
14430
14431 !!test
14432 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14433 !! input
14434 [HttP://MediaWiki.Org/ MediaWiki]
14435 !! result
14436 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14437 </p>
14438 !! end
14439
14440 !!test
14441 Bug 34939 - Case insensitive link parsing (HttP://)
14442 !! input
14443 HttP://MediaWiki.Org/
14444 !! result
14445 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14446 </p>
14447 !! end
14448
14449
14450 ###
14451 ### Parsoids-specific tests
14452 ### Parsoid-PHP parser incompatibilities
14453 ###
14454 !!test
14455 1. SOL-sensitive wikitext tokens as template-args
14456 !!options
14457 parsoid=wt2html,wt2wt
14458 !!input
14459 {{echo|*a}}
14460 {{echo|#a}}
14461 {{echo|:a}}
14462 !!result
14463 <span about="#mwt1" typeof="mw:Transclusion">
14464 </span><ul about="#mwt1"><li>a</li></ul>
14465 <span about="#mwt2" typeof="mw:Transclusion">
14466 </span><ol about="#mwt2"><li>a</li></ol>
14467 <span about="#mwt3" typeof="mw:Transclusion">
14468 </span><dl about="#mwt3"><dd>a</dd></dl>
14469 !!end
14470
14471 #### ----------------------------------------------------------------
14472 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14473 #### tags. Parsoid's output for these tags differs from that of the
14474 #### PHP parser.
14475 #### ----------------------------------------------------------------
14476
14477 !!test
14478 Ref: 1. ref-location should be replaced with an index span
14479 !!options
14480 parsoid
14481 !!input
14482 A <ref>foo</ref>
14483 B <ref name="x">foo</ref>
14484 C <ref name="y" />
14485 !!result
14486 <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>
14487 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>
14488 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>
14489 !!end
14490
14491 !!test
14492 Ref: 2. ref-tags with identical names should all get the same index
14493 !!options
14494 parsoid
14495 !!input
14496 A <ref name="x">foo</ref>
14497 B <ref name="x" />
14498 !!result
14499 <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>
14500 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>
14501 !!end
14502
14503 !!test
14504 Ref: 3. spaces in ref-names should be ignored
14505 !!options
14506 parsoid
14507 !!input
14508 A <ref name="x">foo</ref>
14509 B <ref name=" x " />
14510 C <ref name= x />
14511 !!result
14512 <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>
14513 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>
14514 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>
14515 !!end
14516
14517 !!test
14518 Ref: 4. 'constructor' should be accepted as a valid ref-name
14519 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14520 !!options
14521 parsoid
14522 !!input
14523 A <ref name="constructor">foo</ref>
14524 !!result
14525 <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>
14526 !!end
14527
14528 !!test
14529 Ref: 5. body should accept generic wikitext
14530 !!options
14531 parsoid
14532 !!input
14533 A <ref>
14534 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14535 </ref>
14536
14537 <references />
14538 !!result
14539 <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>
14540
14541 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14542 <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>
14543 </li></ol>
14544 !!end
14545
14546 !!test
14547 Ref: 6. indent-pres should not be output in ref-body
14548 !!options
14549 parsoid
14550 !!input
14551 A <ref>
14552 foo
14553 bar
14554 baz
14555 </ref>
14556
14557 <references />
14558 !!result
14559 <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>
14560
14561 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14562 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14563 bar
14564 baz
14565 </li></ol>
14566 !!end
14567
14568 !!test
14569 Ref: 6. No p-wrapping in ref-body
14570 !!options
14571 parsoid
14572 !!input
14573 A <ref>
14574 foo
14575
14576 bar
14577
14578
14579 baz
14580
14581
14582
14583 booz
14584 </ref>
14585
14586 <references />
14587 !!result
14588 <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>
14589
14590 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14591 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14592
14593 bar
14594
14595
14596 baz
14597
14598
14599
14600 booz
14601 </li></ol>
14602 !!end
14603
14604 !!test
14605 Ref: 8. transclusion wikitext has lower precedence
14606 !!options
14607 parsoid
14608 !!input
14609 A <ref> foo {{echo|</ref> B C}}
14610
14611 <references />
14612 !!result
14613 <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>
14614
14615 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14616 <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>
14617 !!end
14618
14619 !!test
14620 Ref: 9. unclosed comments should not leak out of ref-body
14621 !!options
14622 parsoid
14623 !!input
14624 A <ref> foo <!--</ref> B C
14625
14626 <references />
14627 !!result
14628 <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>
14629
14630 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14631 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14632 !!end
14633
14634 !!test
14635 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14636 !!options
14637 parsoid
14638 !!input
14639 A <ref> <b> foo </ref> B C
14640
14641 <references />
14642 !!result
14643 <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>
14644
14645 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14646 <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>
14647 !!end
14648
14649 !!test
14650 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14651 !!options
14652 parsoid
14653 !!input
14654 A <ref>foo</ref> B
14655 C <ref>bar</ref> D
14656 !!result
14657 <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
14658 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>
14659 !!end
14660
14661 !!test
14662 Ref: 12. ref-tags act as trailing newline migration barrier
14663 !!options
14664 parsoid
14665 !!input
14666 <!--the newline at the end of this line moves out of the p-tag-->a
14667
14668 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14669 <ref />
14670
14671 c
14672 !!result
14673 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14674
14675
14676 <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>
14677 <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>
14678
14679
14680 <p>c</p>
14681 !!end
14682
14683 !!test
14684 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14685 !!options
14686 parsoid
14687 !!input
14688 <ref>foo</ref> A
14689 <ref>bar
14690 </ref> B
14691 !!result
14692 <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
14693 <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>
14694 !!end
14695
14696 !!test
14697 Ref: 14. A nested ref-tag should be emitted as plain text
14698 !!options
14699 parsoid
14700 !!input
14701 <ref>foo <ref>bar</ref> baz</ref>
14702
14703 <references />
14704 !!result
14705 <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>
14706
14707 <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>
14708 !!end
14709
14710 !!test
14711 Ref: 15. ref-tags with identical names should get identical indexes
14712 !!options
14713 parsoid
14714 !!input
14715 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14716 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14717
14718 <references />
14719 !!result
14720 <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>
14721 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>
14722
14723 <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>
14724 !!end
14725
14726 !!test
14727 References: 1. references tag without any refs should be handled properly
14728 !!options
14729 parsoid
14730 !!input
14731 <references />
14732 !!result
14733 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14734 !!end
14735
14736 !!test
14737 References: 2. references tag with group only outputs references from that group
14738 !!options
14739 parsoid
14740 !!input
14741 A <ref group="a">foo</ref>
14742 B <ref group="b">bar</ref>
14743
14744 <references group='a' />
14745 !!result
14746 <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>
14747 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>
14748
14749 <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>
14750 !!end
14751
14752 !!test
14753 References: 3. ref list should be cleared after processing references
14754 !!options
14755 parsoid
14756 !!input
14757 A <ref>foo</ref>
14758
14759 <references />
14760
14761 B <ref>bar</ref>
14762
14763 <references />
14764 !!result
14765 <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>
14766
14767 <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>
14768
14769 <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>
14770
14771 <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>
14772 !!end
14773
14774 !!test
14775 References: 4. only referenced group should be cleared after processing references
14776 !!options
14777 parsoid
14778 !!input
14779 A <ref group="a">afoo</ref>
14780 B <ref>bfoo</ref>
14781
14782 <references group="a"/>
14783
14784 C <ref>cfoo</ref>
14785
14786 <references />
14787 !!result
14788 <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>
14789 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>
14790
14791 <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>
14792
14793 <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>
14794
14795 <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>
14796 !!end
14797
14798 !!test
14799 References: 5. ref tags in references should be processed while ignoring all other content
14800 !!options
14801 parsoid
14802 !!input
14803 A <ref name="a" />
14804 B <ref name="b">bar</ref>
14805
14806 <references>
14807 <ref name="a">foo</ref>
14808 This should just get lost.
14809 </references>
14810 !!result
14811 <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>
14812 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>
14813
14814 <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>
14815 !!end
14816
14817 !!test
14818 References: 6. <references /> from a transclusion
14819 !!options
14820 parsoid
14821 !!input
14822 {{echo|<references />}}
14823 !!result
14824 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14825 !!end
14826
14827 #### ----------------------------------------------------------------
14828 #### The following section of tests are primarily to test
14829 #### wikitext escaping capabilities of Parsoid. Given that
14830 #### escaping can be done any number of ways, the wikitext (input)
14831 #### is always adjusted to reflect how Parsoid adds nowiki
14832 #### escape tags.
14833 ####
14834 #### We are marking several tests as parsoid-only since the
14835 #### HTML in the result section is different from what the
14836 #### PHP parser generates for it.
14837 #### ----------------------------------------------------------------
14838
14839
14840 #### --------------- Headings ---------------
14841 #### 0. Unnested
14842 #### 1. Nested inside html <h1>=foo=</h1>
14843 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14844 #### 3. Nested inside html with wikitext split by html tags
14845 #### 4. No escape needed
14846 #### 5. Empty headings <h1></h1>
14847 #### 6. Heading chars in SOL context
14848 #### ----------------------------------------
14849 !! test
14850 Headings: 0. Unnested
14851 !! options
14852 parsoid
14853 !! input
14854 <nowiki>=foo=</nowiki>
14855
14856 <nowiki> =foo= </nowiki>
14857 <!--cmt-->
14858 <nowiki>=foo=</nowiki>
14859
14860 =foo''a''<nowiki>=</nowiki>
14861 !! result
14862 <p><span typeof="mw:Nowiki">=foo=</span></p>
14863
14864 <p><span typeof="mw:Nowiki"> =foo= </span>
14865 <!--cmt-->
14866 <span typeof="mw:Nowiki">=foo=</span></p>
14867
14868 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14869 !!end
14870
14871 !! test
14872 Headings: 1. Nested inside html
14873 !! options
14874 parsoid
14875 !! input
14876 =<nowiki>=foo=</nowiki>=
14877
14878 ==<nowiki>=foo=</nowiki>==
14879
14880 ===<nowiki>=foo=</nowiki>===
14881
14882 ====<nowiki>=foo=</nowiki>====
14883
14884 =====<nowiki>=foo=</nowiki>=====
14885
14886 ======<nowiki>=foo=</nowiki>======
14887 !! result
14888 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14889 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14890 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14891 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14892 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14893 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14894 !!end
14895
14896 !! test
14897 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14898 !! options
14899 parsoid
14900 !! input
14901 =foo=
14902 <nowiki>*bar</nowiki>
14903
14904 =foo=
14905 =bar
14906
14907 =foo=
14908 <nowiki>=bar=</nowiki>
14909 !! result
14910 <h1>foo</h1>*bar
14911 <h1>foo</h1>=bar
14912 <h1>foo</h1>=bar=
14913 !!end
14914
14915 !! test
14916 Headings: 3. Nested inside html with wikitext split by html tags
14917 !! options
14918 parsoid
14919 !! input
14920 =='''bold'''<nowiki>foo=</nowiki>=
14921 !! result
14922 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14923 !!end
14924
14925 !! test
14926 Headings: 4a. No escaping needed (testing just h1 and h2)
14927 !! options
14928 parsoid
14929 !! input
14930 ==foo=
14931
14932 =foo==
14933
14934 = =foo= =
14935
14936 ==foo= bar=
14937
14938 ===foo==
14939
14940 ==foo===
14941
14942 =''=''foo==
14943
14944 =<nowiki>=</nowiki>=
14945 !! result
14946 <h1>=foo</h1>
14947 <h1>foo=</h1>
14948 <h1> =foo= </h1>
14949 <h1>=foo= bar</h1>
14950 <h2>=foo</h2>
14951 <h2>foo=</h2>
14952 <h1><i>=</i>foo=</h1>
14953 <h1><span typeof="mw:Nowiki">=</span></h1>
14954 !!end
14955
14956 !! test
14957 Headings: 4b. No escaping needed (inside p-tags)
14958 !! options
14959 parsoid
14960 !! input
14961 ===
14962 =foo= x
14963 =foo= <s></s>
14964 !! result
14965 <p>===
14966 =foo= x
14967 =foo= <s></s>
14968 </p>
14969 !!end
14970
14971 !! test
14972 Headings: 5. Empty headings
14973 !! options
14974 parsoid
14975 !! input
14976 =<nowiki/>=
14977
14978 ==<nowiki/>==
14979
14980 ===<nowiki/>===
14981
14982 ====<nowiki/>====
14983
14984 =====<nowiki/>=====
14985
14986 ======<nowiki/>======
14987 !! result
14988 <h1></h1>
14989 <h2></h2>
14990 <h3></h3>
14991 <h4></h4>
14992 <h5></h5>
14993 <h6></h6>
14994 !!end
14995
14996 !! test
14997 Headings: 6a. Heading chars in SOL context (with trailing spaces)
14998 !! options
14999 parsoid
15000 !! input
15001 <nowiki>=a=</nowiki>
15002
15003 <nowiki>=a= </nowiki>
15004
15005 <nowiki>=a= </nowiki>
15006
15007 <nowiki>=a= </nowiki>
15008 !! result
15009 <p>=a=</p>
15010 <p>=a= </p>
15011 <p>=a= </p>
15012 <p>=a= </p>
15013 !!end
15014
15015 !! test
15016 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15017 !! options
15018 parsoid
15019 !! input
15020 <nowiki>=a=
15021 b</nowiki>
15022
15023 <nowiki>=a=
15024 b</nowiki>
15025
15026 <nowiki>=a=
15027 b</nowiki>
15028
15029 <nowiki>=a=
15030 b</nowiki>
15031 !! result
15032 <p>=a=
15033 b</p>
15034 <p>=a=
15035 b</p>
15036 <p>=a=
15037 b</p>
15038 <p>=a=
15039 b</p>
15040 </p>
15041 !!end
15042
15043 !! test
15044 Headings: 6c. Heading chars in SOL context (leading newline break)
15045 !! options
15046 parsoid
15047 !! input
15048 <nowiki>a
15049 =b=</nowiki>
15050 !! result
15051 <p>a
15052 =b=</p>
15053 !!end
15054
15055 !! test
15056 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15057 !! options
15058 parsoid
15059 !! input
15060 <!--c0--><nowiki>=a=</nowiki>
15061 <!--c1-->
15062 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15063 !! result
15064 <p><!--c0-->=a=</p>
15065 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15066 !!end
15067
15068 !! test
15069 Headings: 6d. Heading chars in SOL context (No escaping needed)
15070 !! options
15071 parsoid=html2wt
15072 !! input
15073 =a=<div>b</div>
15074 !! result
15075 =a=<div>b</div>
15076 !!end
15077
15078 #### --------------- Lists ---------------
15079 #### 0. Outside nests (*foo, etc.)
15080 #### 1. Nested inside html <ul><li>*foo</li></ul>
15081 #### 2. Inside definition lists
15082 #### 3. Only bullets at start should be escaped
15083 #### 4. No escapes needed
15084 #### 5. No unnecessary escapes
15085 #### 6. Escape bullets in SOL position
15086 #### 7. Escape bullets in a multi-line context
15087 #### ----------------------------------------
15088
15089 !! test
15090 Lists: 0. Outside nests
15091 !! input
15092 <nowiki>*foo</nowiki>
15093
15094 <nowiki>#foo</nowiki>
15095 !! result
15096 <p>*foo
15097 </p><p>#foo
15098 </p>
15099 !!end
15100
15101 !! test
15102 Lists: 1. Nested inside html
15103 !! input
15104 *<nowiki>*foo</nowiki>
15105
15106 *<nowiki>#foo</nowiki>
15107
15108 *<nowiki>:foo</nowiki>
15109
15110 *<nowiki>;foo</nowiki>
15111
15112 #<nowiki>*foo</nowiki>
15113
15114 #<nowiki>#foo</nowiki>
15115
15116 #<nowiki>:foo</nowiki>
15117
15118 #<nowiki>;foo</nowiki>
15119 !! result
15120 <ul><li>*foo
15121 </li></ul>
15122 <ul><li>#foo
15123 </li></ul>
15124 <ul><li>:foo
15125 </li></ul>
15126 <ul><li>;foo
15127 </li></ul>
15128 <ol><li>*foo
15129 </li></ol>
15130 <ol><li>#foo
15131 </li></ol>
15132 <ol><li>:foo
15133 </li></ol>
15134 <ol><li>;foo
15135 </li></ol>
15136
15137 !!end
15138
15139 !! test
15140 Lists: 2. Inside definition lists
15141 !! input
15142 ;<nowiki>;foo</nowiki>
15143
15144 ;<nowiki>:foo</nowiki>
15145
15146 ;<nowiki>:foo</nowiki>
15147 :bar
15148
15149 :<nowiki>:foo</nowiki>
15150 !! result
15151 <dl><dt>;foo
15152 </dt></dl>
15153 <dl><dt>:foo
15154 </dt></dl>
15155 <dl><dt>:foo
15156 </dt><dd>bar
15157 </dd></dl>
15158 <dl><dd>:foo
15159 </dd></dl>
15160
15161 !!end
15162
15163 !! test
15164 Lists: 3. Only bullets at start of text should be escaped
15165 !! input
15166 *<nowiki>*foo*bar</nowiki>
15167
15168 *<nowiki>*foo</nowiki>''it''*bar
15169 !! result
15170 <ul><li>*foo*bar
15171 </li></ul>
15172 <ul><li>*foo<i>it</i>*bar
15173 </li></ul>
15174
15175 !!end
15176
15177 !! test
15178 Lists: 4. No escapes needed
15179 !! options
15180 parsoid
15181 !! input
15182 *foo*bar
15183
15184 *''foo''*bar
15185
15186 *[[Foo]]: bar
15187 !! result
15188 <ul><li>foo*bar
15189 </li></ul>
15190 <ul><li><i>foo</i>*bar
15191 </li></ul>
15192 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15193 </li></ul>
15194 !!end
15195
15196 !! test
15197 Lists: 5. No unnecessary escapes
15198 !! input
15199 * bar <span><nowiki>[[foo]]</nowiki></span>
15200
15201 *=bar <span><nowiki>[[foo]]</nowiki></span>
15202
15203 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15204
15205 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15206
15207 *=bar <span>foo]]</span>=
15208
15209 * <s></s>: a
15210 !! result
15211 <ul><li> bar <span>[[foo]]</span>
15212 </li></ul>
15213 <ul><li>=bar <span>[[foo]]</span>
15214 </li></ul>
15215 <ul><li>[[bar <span>[[foo]]</span>
15216 </li></ul>
15217 <ul><li>]]bar <span>[[foo]]</span>
15218 </li></ul>
15219 <ul><li>=bar <span>foo]]</span>=
15220 </li></ul>
15221 <ul><li> <s></s>: a
15222 </li></ul>
15223
15224 !!end
15225
15226 !! test
15227 Lists: 6. Escape bullets in SOL position
15228 !! options
15229 parsoid
15230 !! input
15231 <!--cmt--><nowiki>*foo</nowiki>
15232 !! result
15233 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15234 !!end
15235
15236 !! test
15237 Lists: 7. Escape bullets in a multi-line context
15238 !! input
15239 <nowiki>a
15240 *b</nowiki>
15241 !! result
15242 <p>a
15243 *b
15244 </p>
15245 !!end
15246
15247 #### --------------- HRs ---------------
15248 #### 1. Single line
15249 #### -----------------------------------
15250
15251 !! test
15252 HRs: 1. Single line
15253 !! options
15254 parsoid
15255 !! input
15256 ----<nowiki>----</nowiki>
15257 ----=foo=
15258 ----*foo
15259 !! result
15260 <hr><span typeof="mw:Nowiki">----</span>
15261 <hr>=foo=
15262 <hr>*foo
15263 !! end
15264
15265 #### --------------- Tables ---------------
15266 #### 1a. Simple example
15267 #### 1b. No escaping needed (!foo)
15268 #### 1c. No escaping needed (|foo)
15269 #### 1d. No escaping needed (|}foo)
15270 ####
15271 #### 2a. Nested in td (<td>foo|bar</td>)
15272 #### 2b. Nested in td (<td>foo||bar</td>)
15273 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15274 ####
15275 #### 3a. Nested in th (<th>foo!bar</th>)
15276 #### 3b. Nested in th (<th>foo!!bar</th>)
15277 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15278 ####
15279 #### 4a. Escape -
15280 #### 4b. Escape +
15281 #### 4c. No escaping needed
15282 #### --------------------------------------
15283
15284 !! test
15285 Tables: 1a. Simple example
15286 !! input
15287 <nowiki>{|
15288 |}</nowiki>
15289 !! result
15290 <p>{|
15291 |}
15292 </p>
15293 !! end
15294
15295 !! test
15296 Tables: 1b. No escaping needed
15297 !! input
15298 !foo
15299 !! result
15300 <p>!foo
15301 </p>
15302 !! end
15303
15304 !! test
15305 Tables: 1c. No escaping needed
15306 !! input
15307 |foo
15308 !! result
15309 <p>|foo
15310 </p>
15311 !! end
15312
15313 !! test
15314 Tables: 1d. No escaping needed
15315 !! input
15316 |}foo
15317 !! result
15318 <p>|}foo
15319 </p>
15320 !! end
15321
15322 !! test
15323 Tables: 2a. Nested in td
15324 !! options
15325 parsoid
15326 !! input
15327 {|
15328 |<nowiki>foo|bar</nowiki>
15329 |}
15330 !! result
15331 <table><tbody><tr>
15332 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15333 !! end
15334
15335 !! test
15336 Tables: 2b. Nested in td
15337 !! options
15338 parsoid
15339 !! input
15340 {|
15341 |<nowiki>foo||bar</nowiki>
15342 |''it''<nowiki>foo||bar</nowiki>
15343 |}
15344 !! result
15345 <table><tbody><tr>
15346 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15347 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15348 !! end
15349
15350 !! test
15351 Tables: 2c. Nested in td -- no escaping needed
15352 !! options
15353 parsoid
15354 !! input
15355 {|
15356 |foo!!bar
15357 |}
15358 !! result
15359 <table><tbody><tr><td>foo!!bar
15360 </td></tr></tbody></table>
15361
15362 !! end
15363
15364 !! test
15365 Tables: 3a. Nested in th
15366 !! options
15367 parsoid
15368 !! input
15369 {|
15370 !foo!bar
15371 |}
15372 !! result
15373 <table><tbody><tr><th>foo!bar
15374 </th></tr></tbody></table>
15375
15376 !! end
15377
15378 !! test
15379 Tables: 3b. Nested in th
15380 !! options
15381 parsoid
15382 !! input
15383 {|
15384 !<nowiki>foo!!bar</nowiki>
15385 |}
15386 !! result
15387 <table>
15388 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15389 </tbody></table>
15390 !! end
15391
15392 !! test
15393 Tables: 3c. Nested in th -- no escaping needed
15394 !! options
15395 parsoid
15396 !! input
15397 {|
15398 !<nowiki>foo||bar</nowiki>
15399 |}
15400 !! result
15401 <table><tbody><tr>
15402 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15403 !! end
15404
15405 !! test
15406 Tables: 4a. Escape -
15407 !! options
15408 parsoid
15409 !! input
15410 {|
15411 |-
15412 !-bar
15413 |-
15414 |<nowiki>-bar</nowiki>
15415 |}
15416 !! result
15417 <table><tbody>
15418 <tr><th>-bar</th></tr>
15419 <tr>
15420 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15421 !! end
15422
15423 !! test
15424 Tables: 4b. Escape +
15425 !! options
15426 parsoid
15427 !! input
15428 {|
15429 |-
15430 !+bar
15431 |-
15432 |<nowiki>+bar</nowiki>
15433 |}
15434 !! result
15435 <table><tbody>
15436 <tr><th>+bar</th></tr>
15437 <tr>
15438 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15439 !! end
15440
15441 !! test
15442 Tables: 4c. No escaping needed
15443 !! options
15444 parsoid
15445 !! input
15446 {|
15447 |-
15448 |foo-bar
15449 |foo+bar
15450 |-
15451 |''foo''-bar
15452 |''foo''+bar
15453 |}
15454 !! result
15455 <table><tbody>
15456 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15457 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15458 </tbody></table>
15459 !! end
15460
15461 ### SSS FIXME: Disabled right now because accurate html2wt
15462 ### on this snippet requires data-parsoid flags that we've
15463 ### stripped out of these tests. We should scheme how we
15464 ### we want to handle these kind of tests that require
15465 ### data-parsoid flags for accurate html2wt serialization
15466
15467 !! test
15468 Tables: 4d. No escaping needed
15469 !! options
15470 disabled
15471 !! input
15472 {|
15473 ||+1
15474 ||-2
15475 |}
15476 !! result
15477 <table>
15478 <tr>
15479 <td>+1
15480 </td>
15481 <td>-2
15482 </td></tr></table>
15483
15484 !! end
15485
15486 #### --------------- Links ----------------
15487 #### 1. Quote marks in link text
15488 #### 2. Wikilinks: Escapes needed
15489 #### 3. Wikilinks: No escapes needed
15490 #### 4. Extlinks: Escapes needed
15491 #### 5. Extlinks: No escapes needed
15492 #### --------------------------------------
15493 !! test
15494 Links 1. Quote marks in link text
15495 !! options
15496 parsoid
15497 !! input
15498 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15499 !! result
15500 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15501 !! end
15502
15503 !! test
15504 Links 2. WikiLinks: Escapes needed
15505 !! options
15506 parsoid
15507 !! input
15508 [[Foo|<nowiki>[Foobar]</nowiki>]]
15509 [[Foo|<nowiki>Foobar]</nowiki>]]
15510 [[Foo|x [Foobar] x]]
15511 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15512 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15513 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15514 [[Foo|<nowiki>|Bar</nowiki>]]
15515 [[Foo|<nowiki>]]bar</nowiki>]]
15516 [[Foo|<nowiki>[[bar</nowiki>]]
15517 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15518 !! result
15519 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15520 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15521 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15522 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15523 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15524 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15525 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15526 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15527 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15528 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15529 !! end
15530
15531 !! test
15532 Links 3. WikiLinks: No escapes needed
15533 !! options
15534 parsoid
15535 !! input
15536 [[Foo|[Foobar]]
15537 [[Foo|foo|bar]]
15538 !! result
15539 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15540 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15541 !! end
15542
15543 !! test
15544 Links 4. ExtLinks: Escapes needed
15545 !! options
15546 parsoid
15547 !! input
15548 [http://google.com <nowiki>[google]</nowiki>]
15549 [http://google.com <nowiki>google]</nowiki>]
15550 !! result
15551 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15552 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15553 !! end
15554
15555 !! test
15556 Links 5. ExtLinks: No escapes needed
15557 !! options
15558 parsoid
15559 !! input
15560 [http://google.com [google]
15561 !! result
15562 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15563 !! end
15564
15565 #### --------------- Quotes ---------------
15566 #### 1. Quotes inside <b> and <i>
15567 #### 2. Link fragments separated by <i> and <b> tags
15568 #### 3. Link fragments inside <i> and <b>
15569 #### --------------------------------------
15570 !! test
15571 1. Quotes inside <b> and <i>
15572 !! input
15573 ''<nowiki>'foo'</nowiki>''
15574 ''<nowiki>''foo''</nowiki>''
15575 ''<nowiki>'''foo'''</nowiki>''
15576 ''foo''<nowiki>'s</nowiki>
15577 '''<nowiki>'foo'</nowiki>'''
15578 '''<nowiki>''foo''</nowiki>'''
15579 '''<nowiki>'''foo'''</nowiki>'''
15580 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15581 '''foo'''<nowiki>'s</nowiki>
15582 !! result
15583 <p><i>'foo'</i>
15584 <i>''foo''</i>
15585 <i>'''foo'''</i>
15586 <i>foo</i>'s
15587 <b>'foo'</b>
15588 <b>''foo''</b>
15589 <b>'''foo'''</b>
15590 <b>foo'<i>bar'</i>baz</b>
15591 <b>foo</b>'s
15592 </p>
15593 !! end
15594
15595 !! test
15596 2. Link fragments separated by <i> and <b> tags
15597 !! input
15598 [[''foo''<nowiki>hello]]</nowiki>
15599
15600 [['''foo'''<nowiki>hello]]</nowiki>
15601 !! result
15602 <p>[[<i>foo</i>hello]]
15603 </p><p>[[<b>foo</b>hello]]
15604 </p>
15605 !! end
15606
15607 !! test
15608 2. Link fragments inside <i> and <b>
15609 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15610 this is one of the shortcomings of this format)
15611 !! input
15612 ''[[foo''<nowiki>]]</nowiki>
15613
15614 '''[[foo'''<nowiki>]]</nowiki>
15615 !! result
15616 <p><i>[[foo</i>]]
15617 </p><p><b>[[foo</b>]]
15618 </p>
15619 !! end
15620
15621 #### ----------- Paragraphs ---------------
15622 #### 1. No unnecessary escapes
15623 #### --------------------------------------
15624
15625 !! test
15626 1. No unnecessary escapes
15627 !! input
15628 bar <span><nowiki>[[foo]]</nowiki></span>
15629
15630 =bar <span><nowiki>[[foo]]</nowiki></span>
15631
15632 [[bar <span><nowiki>[[foo]]</nowiki></span>
15633
15634 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15635
15636 =bar <span>foo]]</span><nowiki>=</nowiki>
15637 !! result
15638 <p>bar <span>[[foo]]</span>
15639 </p><p>=bar <span>[[foo]]</span>
15640 </p><p>[[bar <span>[[foo]]</span>
15641 </p><p>]]bar <span>[[foo]]</span>
15642 </p><p>=bar <span>foo]]</span>=
15643 </p>
15644 !!end
15645
15646 #### ----------------------- PRE --------------------------
15647 #### 1. Leading whitespace in SOL context should be escaped
15648 #### ------------------------------------------------------
15649 !! test
15650 1. Leading whitespace in SOL context should be escaped
15651 !! options
15652 parsoid
15653 !! input
15654 <nowiki> a</nowiki>
15655
15656 <nowiki> a</nowiki>
15657
15658 <nowiki> a(tab)</nowiki>
15659
15660 <nowiki> a</nowiki>
15661 <!--cmt-->
15662 <nowiki> a</nowiki>
15663
15664 <nowiki>a
15665 b</nowiki>
15666
15667 <nowiki>a
15668 b</nowiki>
15669
15670 <nowiki>a
15671 b</nowiki>
15672 !! result
15673 <p> a</p>
15674 <p> a</p>
15675 <p> a(tab)</p>
15676 <p> a</p>
15677 <p><!--cmt--> a</p>
15678 <p>a
15679 b</p>
15680 <p>a
15681 b</p>
15682 <p>a
15683 b</p>
15684 !! end
15685
15686 #### --------------- HTML tags ---------------
15687 #### 1. a tags
15688 #### 2. other tags
15689 #### 3. multi-line html tag
15690 #### -----------------------------------------
15691 !! test
15692 1. a tags
15693 !! options
15694 parsoid
15695 !! input
15696 <a href="http://google.com">google</a>
15697 !! result
15698 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15699 !! end
15700
15701 !! test
15702 2. other tags
15703 !! input
15704 <nowiki><div>foo</div>
15705 <div style="color:red">foo</div></nowiki>
15706 !! result
15707 <p>&lt;div&gt;foo&lt;/div&gt;
15708 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15709 </p>
15710 !! end
15711
15712 !! test
15713 3. multi-line html tag
15714 !! input
15715 <nowiki><div
15716 >foo</div
15717 ></nowiki>
15718 !! result
15719 <p>&lt;div
15720 &gt;foo&lt;/div
15721 &gt;
15722 </p>
15723 !! end
15724
15725 !! test
15726 4. extension tags
15727 !! input
15728 <nowiki><ref>foo</ref></nowiki>
15729 !! result
15730 <p>&lt;ref&gt;foo&lt;/ref&gt;
15731 </p>
15732 !! end
15733
15734 #### --------------- Others ---------------
15735 !! test
15736 Escaping nowikis
15737 !! input
15738 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15739 !! result
15740 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15741 </p>
15742 !! end
15743 !! test
15744
15745 Tag-like HTML structures are passed through as text
15746 !! input
15747 <x y>
15748
15749 <x.y>
15750
15751 <x-y>
15752
15753 1>2
15754
15755 x<y
15756
15757 a>b
15758
15759 1<d e>f
15760 !! result
15761 <p>&lt;x y&gt;
15762 </p><p>&lt;x.y&gt;
15763 </p><p>&lt;x-y&gt;
15764 </p><p>1&gt;2
15765 </p><p>x&lt;y
15766 </p><p>a&gt;b
15767 </p><p>1&lt;d e&gt;f
15768 </p>
15769 !! end
15770
15771
15772 # This fails in the PHP parser (see bug 40670,
15773 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15774 !! test
15775 Tag names followed by punctuation should not be recognized as tags
15776 !! options
15777 parsoid
15778 !! input
15779 <s.ome> text
15780 !! result
15781 <p>&lt;s.ome&gt; text
15782 </p>
15783 !! end
15784
15785 !! test
15786 HTML tag with necessary entities in attributes
15787 !! input
15788 <span title="&amp;amp;">foo</span>
15789 !! result
15790 <p><span title="&amp;amp;">foo</span>
15791 </p>
15792 !! end
15793
15794 !! test
15795 HTML tag with 'unnecessary' entity encoding in attributes
15796 !! input
15797 <span title="&amp;">foo</span>
15798 !! result
15799 <p><span title="&amp;">foo</span>
15800 </p>
15801 !! end
15802
15803 !! test
15804 HTML tag with broken attribute value quoting
15805 !! input
15806 <span title="Hello world>Foo</span>
15807 !! result
15808 <p><span>Foo</span>
15809 </p>
15810 !! end
15811
15812 !! test
15813 Parsoid-only: HTML tag with broken attribute value quoting
15814 !! options
15815 parsoid
15816 !! input
15817 <span title="Hello world>Foo</span>
15818 !! result
15819 <p><span title="Hello world">Foo</span>
15820 </p>
15821 !! end
15822
15823 !! test
15824 Table with broken attribute value quoting
15825 !! input
15826 {|
15827 | title="Hello world|Foo
15828 |}
15829 !! result
15830 <table>
15831 <tr>
15832 <td>Foo
15833 </td></tr></table>
15834
15835 !! end
15836
15837 !! test
15838 Table with broken attribute value quoting on consecutive lines
15839 !! input
15840 {|
15841 | title="Hello world|Foo
15842 | style="color:red|Bar
15843 |}
15844 !! result
15845 <table>
15846 <tr>
15847 <td>Foo
15848 </td>
15849 <td>Bar
15850 </td></tr></table>
15851
15852 !! end
15853
15854 !! test
15855 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15856 !! options
15857 parsoid
15858 !! input
15859 {|
15860 | title="Hello world|Foo
15861 | style="color:red|Bar
15862 |}
15863 !! result
15864 <table><tbody>
15865 <tr>
15866 <td title="Hello world">Foo
15867 </td><td style="color: red">Bar
15868 </td></tr></tbody></table>
15869
15870 !! end
15871
15872 !! test
15873 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15874 !! options
15875 parsoid
15876 !! input
15877 {{}}
15878 !! result
15879 {{}}
15880 !! end
15881
15882 !! test
15883 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15884 !! options
15885 parsoid
15886 !! input
15887 }}{{
15888 !! result
15889 }}{{
15890 !! end
15891
15892 !!test
15893 Accept empty td cell attribute
15894 !!input
15895 {|
15896 | align="center" | foo || |
15897 |}
15898 !!result
15899 <table>
15900 <tr>
15901 <td align="center"> foo </td>
15902 <td>
15903 </td></tr></table>
15904
15905 !!end
15906
15907 !!test
15908 Non-empty attributes in th-cells
15909 !!input
15910 {|
15911 ! Foo !! style="color: red" | Bar
15912 |}
15913 !!result
15914 <table>
15915 <tr>
15916 <th> Foo </th>
15917 <th style="color: red"> Bar
15918 </th></tr></table>
15919
15920 !!end
15921
15922 !!test
15923 Accept empty attributes in th-cells
15924 !!input
15925 {|
15926 !| foo !!| bar
15927 |}
15928 !!result
15929 <table>
15930 <tr>
15931 <th> foo </th>
15932 <th> bar
15933 </th></tr></table>
15934
15935 !!end
15936
15937 !!test
15938 Empty table rows go away
15939 !!input
15940 {|
15941 | Hello
15942 | there
15943 |- class="foo"
15944 |-
15945 |}
15946 !! result
15947 <table>
15948 <tr>
15949 <td> Hello
15950 </td>
15951 <td> there
15952 </td></tr>
15953
15954 </table>
15955
15956 !! end
15957
15958 ###
15959 ### Parsoid-centric tests for testing RTing of inter-element separators
15960 ### Edge cases not tested by existing parser tests and specific to
15961 ### Parsoid-specific serialization strategies.
15962 ###
15963
15964 !!test
15965 RT-ed inter-element separators should be valid separators
15966 !!input
15967 {|
15968 |- [[foo]]
15969 |}
15970 !!result
15971 <table>
15972
15973 </table>
15974
15975 !!end
15976
15977 !!test
15978 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15979 (Parsoid-only since PHP parser relies on Tidy for correct output)
15980 !!options
15981 parsoid
15982 !!input
15983 {|
15984 |<small>foo
15985 bar
15986 |}
15987
15988 {|
15989 |<small>foo<small>
15990 |}
15991 !!result
15992 !!end
15993
15994 !!test
15995 Empty TD followed by TD with tpl-generated attribute
15996 !!input
15997 {|
15998 |-
15999 |
16000 |{{echo|style='color:red'}}|foo
16001 |}
16002 !!result
16003 <table>
16004
16005 <tr>
16006 <td>
16007 </td>
16008 <td>foo
16009 </td></tr></table>
16010
16011 !!end
16012
16013 !!test
16014 Indented table with an empty td
16015 !!input
16016 {|
16017 |-
16018 |
16019 |foo
16020 |}
16021 !!result
16022 <table>
16023
16024 <tr>
16025 <td>
16026 </td>
16027 <td>foo
16028 </td></tr></table>
16029
16030 !!end
16031
16032 !!test
16033 Empty TR followed by a template-generated TR
16034 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16035 !!options
16036 parsoid=wt2html,wt2wt
16037 !!input
16038 {|
16039 |-
16040 {{echo|<tr><td>foo</td></tr>}}
16041 |}
16042 !!result
16043 <table>
16044 <tbody>
16045 <tr></tr>
16046 <tr typeof="mw:Transclusion">
16047 <td>foo</td></tr></tbody></table>
16048 !!end
16049
16050 ## PHP and parsoid output differ for this, and since this is primarily
16051 ## for testing Parsoid's serializer, marking this Parsoid only
16052 !!test
16053 Empty TR followed by mixed-ws-comment line should RT correctly
16054 !!options
16055 parsoid
16056 !!input
16057 {|
16058 |-
16059 <!--c-->
16060 |-
16061 <!--c--> <!--d-->
16062 |}
16063 !!result
16064 <table>
16065 <tbody>
16066 <tr>
16067 <td> <!--c--></td></tr>
16068 <tr>
16069 <td><!--c--> <!--d--></td></tr>
16070 </tbody></table>
16071
16072 !!end
16073
16074 !!test
16075 Multi-line image caption generated by templates with/without trailing newlines
16076 !!options
16077 parsoid
16078 !!input
16079 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16080 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16081 !!result
16082 <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>
16083 <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>
16084
16085 !!end
16086
16087 ## PHP emits broken html for this, and since this is primarily
16088 ## a Parsoid serializer test, marking this Parsoid only
16089 !!test
16090 Improperly nested inline or quotes tags with whitespace in between
16091 !!options
16092 parsoid
16093 !!input
16094 <span> <s>x</span> </s>
16095 ''' ''x''' ''
16096 !!result
16097 <p><span> <s>x</s></span><s> </s>
16098 <b> <i>x</i></b><i> </i>
16099 </p>
16100 !!end
16101
16102 # -----------------------------------------------------------------
16103 # The following section of tests are primarily to spec requirements
16104 # around serialization of new/edited content.
16105 #
16106 # All these tests are marked Parsoid html2wt and html2html only
16107 # ----------------------------------------------------------------
16108
16109 !! test
16110 Image: Modifying size of an image
16111 !! options
16112 parsoid=html2wt
16113 !! input
16114 [[Image:Wiki.png|230x230px]]
16115 !! result
16116 <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>
16117 !!end
16118
16119 !! test
16120 Image: New block level image should have \n before and after
16121 !! options
16122 parsoid=html2wt
16123 !! input
16124 123
16125 [[File:Wiki.png|right|thumb|150x150px]]
16126 456
16127 !! result
16128 <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>
16129 !!end
16130
16131 !! test
16132 Lists: Add space after bullets
16133 !! options
16134 parsoid=html2wt
16135 !! input
16136
16137 * foo
16138 * bar
16139 * <span> baz</span>
16140 !! result
16141 <ul>
16142 <li>foo</li>
16143 <li> bar</li>
16144 <li><span> baz</span></li>
16145 </ul>
16146 !! end
16147
16148 TODO:
16149 more images
16150 more tables
16151 character entities
16152 and much more
16153 Try for 100% code coverage