Merge "Remove list of functions added in wgExtensionFunctions"
[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 ## XHTML tidiness
4797 ###
4798
4799 !! test
4800 <br> to <br />
4801 !! input
4802 1<br>2<br />3
4803 !! result
4804 <p>1<br />2<br />3
4805 </p>
4806 !! end
4807
4808 !! test
4809 Broken br tag sanitization
4810 !! input
4811 </br>
4812 !! result
4813 <p>&lt;/br&gt;
4814 </p>
4815 !! end
4816
4817 !! test
4818 Incorrecly removing closing slashes from correctly formed XHTML
4819 !! input
4820 <br style="clear:both;" />
4821 !! result
4822 <p><br style="clear:both;" />
4823 </p>
4824 !! end
4825
4826 !! test
4827 Failing to transform badly formed HTML into correct XHTML
4828 !! input
4829 <br style="clear: left;">
4830 <br style="clear: right;">
4831 <br style="clear: both;">
4832 !! result
4833 <p><br style="clear: left;" />
4834 <br style="clear: right;" />
4835 <br style="clear: both;" />
4836 </p>
4837 !!end
4838
4839 !! test
4840 Handling html with a div self-closing tag
4841 !! input
4842 <div title />
4843 <div title/>
4844 <div title/ >
4845 <div title=bar />
4846 <div title=bar/>
4847 <div title=bar/ >
4848 !! result
4849 <p>&lt;div title /&gt;
4850 &lt;div title/&gt;
4851 </p>
4852 <div>
4853 <p>&lt;div title=bar /&gt;
4854 &lt;div title=bar/&gt;
4855 </p>
4856 <div title="bar/"></div>
4857 </div>
4858
4859 !! end
4860
4861 !! test
4862 Handling html with a br self-closing tag
4863 !! input
4864 <br title />
4865 <br title/>
4866 <br title/ >
4867 <br title=bar />
4868 <br title=bar/>
4869 <br title=bar/ >
4870 !! result
4871 <p><br title="title" />
4872 <br title="title" />
4873 <br />
4874 <br title="bar" />
4875 <br title="bar" />
4876 <br title="bar/" />
4877 </p>
4878 !! end
4879
4880 !! test
4881 Horizontal ruler (should it add that extra space?)
4882 !! input
4883 <hr>
4884 <hr >
4885 foo <hr
4886 > bar
4887 !! result
4888 <hr />
4889 <hr />
4890 foo <hr /> bar
4891
4892 !! end
4893
4894 !! test
4895 Horizontal ruler -- 4+ dashes render hr
4896 !! input
4897 ----
4898 !! result
4899 <hr />
4900
4901 !! end
4902
4903 !! test
4904 Horizontal ruler -- eats additional dashes on the same line
4905 !! input
4906 ---------
4907 !! result
4908 <hr />
4909
4910 !! end
4911
4912 !! test
4913 Horizontal ruler -- does not collapse dashes on consecutive lines
4914 !! input
4915 ----
4916 ----
4917 !! result
4918 <hr />
4919 <hr />
4920
4921 !! end
4922
4923 !! test
4924 Horizontal ruler -- <4 dashes render as plain text
4925 !! input
4926 ---
4927 !! result
4928 <p>---
4929 </p>
4930 !! end
4931
4932 !! test
4933 Horizontal ruler -- Supports content following dashes on same line
4934 !! input
4935 ---- Foo
4936 !! result
4937 <hr /> Foo
4938
4939 !! end
4940
4941 ###
4942 ### Block-level elements
4943 ###
4944 !! test
4945 Common list
4946 !! input
4947 *Common list
4948 * item 2
4949 *item 3
4950 !! result
4951 <ul><li>Common list
4952 </li><li> item 2
4953 </li><li>item 3
4954 </li></ul>
4955
4956 !! end
4957
4958 !! test
4959 Numbered list
4960 !! input
4961 #Numbered list
4962 #item 2
4963 # item 3
4964 !! result
4965 <ol><li>Numbered list
4966 </li><li>item 2
4967 </li><li> item 3
4968 </li></ol>
4969
4970 !! end
4971
4972 !! test
4973 Mixed list
4974 !! input
4975 *Mixed list
4976 *# with numbers
4977 ** and bullets
4978 *# and numbers
4979 *bullets again
4980 **bullet level 2
4981 ***bullet level 3
4982 ***#Number on level 4
4983 **bullet level 2
4984 **#Number on level 3
4985 **#Number on level 3
4986 *#number level 2
4987 *Level 1
4988 *** Level 3
4989 #** Level 3, but ordered
4990 !! result
4991 <ul><li>Mixed list
4992 <ol><li> with numbers
4993 </li></ol>
4994 <ul><li> and bullets
4995 </li></ul>
4996 <ol><li> and numbers
4997 </li></ol>
4998 </li><li>bullets again
4999 <ul><li>bullet level 2
5000 <ul><li>bullet level 3
5001 <ol><li>Number on level 4
5002 </li></ol>
5003 </li></ul>
5004 </li><li>bullet level 2
5005 <ol><li>Number on level 3
5006 </li><li>Number on level 3
5007 </li></ol>
5008 </li></ul>
5009 <ol><li>number level 2
5010 </li></ol>
5011 </li><li>Level 1
5012 <ul><li><ul><li> Level 3
5013 </li></ul>
5014 </li></ul>
5015 </li></ul>
5016 <ol><li><ul><li><ul><li> Level 3, but ordered
5017 </li></ul>
5018 </li></ul>
5019 </li></ol>
5020
5021 !! end
5022
5023 !! test
5024 Nested lists 1
5025 !! input
5026 *foo
5027 **bar
5028 !! result
5029 <ul><li>foo
5030 <ul><li>bar
5031 </li></ul>
5032 </li></ul>
5033
5034 !! end
5035
5036 !! test
5037 Nested lists 2
5038 !! input
5039 **foo
5040 *bar
5041 !! result
5042 <ul><li><ul><li>foo
5043 </li></ul>
5044 </li><li>bar
5045 </li></ul>
5046
5047 !! end
5048
5049 !! test
5050 Nested lists 3 (first element empty)
5051 !! input
5052 *
5053 **bar
5054 !! result
5055 <ul><li>
5056 <ul><li>bar
5057 </li></ul>
5058 </li></ul>
5059
5060 !! end
5061
5062 !! test
5063 Nested lists 4 (first element empty)
5064 !! input
5065 **
5066 *bar
5067 !! result
5068 <ul><li><ul><li>
5069 </li></ul>
5070 </li><li>bar
5071 </li></ul>
5072
5073 !! end
5074
5075 !! test
5076 Nested lists 5 (both elements empty)
5077 !! input
5078 **
5079 *
5080 !! result
5081 <ul><li><ul><li>
5082 </li></ul>
5083 </li><li>
5084 </li></ul>
5085
5086 !! end
5087
5088 !! test
5089 Nested lists 6 (both elements empty)
5090 !! input
5091 *
5092 **
5093 !! result
5094 <ul><li>
5095 <ul><li>
5096 </li></ul>
5097 </li></ul>
5098
5099 !! end
5100
5101 !! test
5102 Nested lists 7 (skip initial nesting levels)
5103 !! input
5104 *** foo
5105 !! result
5106 <ul><li><ul><li><ul><li> foo
5107 </li></ul>
5108 </li></ul>
5109 </li></ul>
5110
5111 !! end
5112
5113 !! test
5114 Nested lists 8 (multiple nesting transitions)
5115 !! input
5116 * foo
5117 *** bar
5118 ** baz
5119 * boo
5120 !! result
5121 <ul><li> foo
5122 <ul><li><ul><li> bar
5123 </li></ul>
5124 </li><li> baz
5125 </li></ul>
5126 </li><li> boo
5127 </li></ul>
5128
5129 !! end
5130
5131 !! test
5132 1. Lists with start-of-line-transparent tokens before bullets: Comments
5133 !! input
5134 *foo
5135 *<!--cmt-->bar
5136 <!--cmt-->*baz
5137 !! result
5138 <ul><li>foo
5139 </li><li>bar
5140 </li><li>baz
5141 </li></ul>
5142
5143 !! end
5144
5145 !! test
5146 2. Lists with start-of-line-transparent tokens before bullets: Template close
5147 !! input
5148 *foo {{echo|bar
5149 }}*baz
5150 !! result
5151 <ul><li>foo bar
5152 </li><li>baz
5153 </li></ul>
5154
5155 !! end
5156
5157 !! test
5158 Unbalanced closing block tags break a list
5159 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5160 !! options
5161 parsoid
5162 !! input
5163 <div>
5164 *a</div><div>
5165 *b</div>
5166 !! result
5167 <div>
5168 <ul><li>a
5169 </li></ul></div><div>
5170 <ul><li>b
5171 </li></ul></div>
5172 !! end
5173
5174 !! test
5175 Unbalanced closing non-block tags don't break a list
5176 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5177 !! options
5178 parsoid
5179 !! input
5180 <span>
5181 *a</span><span>
5182 *b</span>
5183 !! result
5184 <p><span></span>
5185 </p>
5186 <ul><li>a<span></span>
5187 </li><li>b
5188 </li></ul>
5189 !! end
5190
5191 !! test
5192 Unclosed formatting tags that straddle lists are closed and reopened
5193 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5194 !! options
5195 parsoid
5196 !! input
5197 # <s> a
5198 # b </s>
5199 !! result
5200 <ol><li> <s> a </s>
5201 </li><li> <s> b </s>
5202 </li></ol>
5203 !! end
5204
5205 !!test
5206 List embedded in a non-block tag
5207 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5208 !! options
5209 parsoid
5210 !!input
5211 <small>
5212 * foo
5213 </small>
5214 !!result
5215 <p><small></small></p>
5216 <small>
5217 <ul>
5218 <li> foo</li>
5219 </ul>
5220 </small>
5221 <p><small></small></p>
5222 !!end
5223
5224 !! test
5225 List items are not parsed correctly following a <pre> block (bug 785)
5226 !! input
5227 * <pre>foo</pre>
5228 * <pre>bar</pre>
5229 * zar
5230 !! result
5231 <ul><li> <pre>foo</pre>
5232 </li><li> <pre>bar</pre>
5233 </li><li> zar
5234 </li></ul>
5235
5236 !! end
5237
5238 !! test
5239 List items from template
5240 !! input
5241
5242 {{inner list}}
5243 * item 2
5244
5245 * item 0
5246 {{inner list}}
5247 * item 2
5248
5249 * item 0
5250 * notSOL{{inner list}}
5251 * item 2
5252 !! result
5253 <ul><li> item 1
5254 </li><li> item 2
5255 </li></ul>
5256 <ul><li> item 0
5257 </li><li> item 1
5258 </li><li> item 2
5259 </li></ul>
5260 <ul><li> item 0
5261 </li><li> notSOL
5262 </li><li> item 1
5263 </li><li> item 2
5264 </li></ul>
5265
5266 !! end
5267
5268 !! test
5269 List interrupted by empty line or heading
5270 !! input
5271 * foo
5272
5273 ** bar
5274 == A heading ==
5275 * Another list item
5276 !! result
5277 <ul><li> foo
5278 </li></ul>
5279 <ul><li><ul><li> bar
5280 </li></ul>
5281 </li></ul>
5282 <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>
5283 <ul><li> Another list item
5284 </li></ul>
5285
5286 !!end
5287
5288 !!test
5289 Multiple list tags generated by templates
5290 !!input
5291 {{echo|<li>}}a
5292 {{echo|<li>}}b
5293 {{echo|<li>}}c
5294 !!result
5295 <li>a
5296 <li>b
5297 <li>c</li>
5298 </li>
5299 </li>
5300
5301 !!end
5302
5303 !!test
5304 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5305 !!input
5306 *a
5307 <!--This line will NOT split the list-->
5308 *b
5309 <!--This line will NOT split the list either-->
5310 *c
5311 <!--foo--> <!--This line with more than 1 comment will split the list-->
5312 *d
5313 !!result
5314 <ul><li>a
5315 </li><li>b
5316 </li><li>c
5317 </li></ul>
5318 <ul><li>d
5319 </li></ul>
5320
5321 !!end
5322
5323 !!test
5324 Test the li-hack
5325 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5326 !!options
5327 parsoid=wt2html,wt2wt
5328 !!input
5329 * foo
5330 * <li>li-hack
5331 * {{echo|<li>templated li-hack}}
5332 * <!--foo--> <li> unsupported li-hack with preceding comments
5333
5334 <ul>
5335 <li><li>not a li-hack
5336 </li>
5337 </ul>
5338 !!result
5339 <ul><li> foo</li>
5340 <li>li-hack</li>
5341 <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>
5342 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5343
5344 <ul>
5345 <li></li><li>not a li-hack
5346 </li>
5347 </ul>
5348 !!end
5349
5350 !! test
5351 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5352 !! options
5353 parsoid
5354 !! input
5355 # foo
5356 ## bar
5357 * foo
5358 ** bar
5359 : foo
5360 :: bar
5361 !! result
5362 <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>
5363 !! end
5364
5365
5366 ###
5367 ### Magic Words
5368 ###
5369
5370 !! test
5371 Magic Word: {{CURRENTDAY}}
5372 !! input
5373 {{CURRENTDAY}}
5374 !! result
5375 <p>1
5376 </p>
5377 !! end
5378
5379 !! test
5380 Magic Word: {{CURRENTDAY2}}
5381 !! input
5382 {{CURRENTDAY2}}
5383 !! result
5384 <p>01
5385 </p>
5386 !! end
5387
5388 !! test
5389 Magic Word: {{CURRENTDAYNAME}}
5390 !! input
5391 {{CURRENTDAYNAME}}
5392 !! result
5393 <p>Thursday
5394 </p>
5395 !! end
5396
5397 !! test
5398 Magic Word: {{CURRENTDOW}}
5399 !! input
5400 {{CURRENTDOW}}
5401 !! result
5402 <p>4
5403 </p>
5404 !! end
5405
5406 !! test
5407 Magic Word: {{CURRENTMONTH}}
5408 !! input
5409 {{CURRENTMONTH}}
5410 !! result
5411 <p>01
5412 </p>
5413 !! end
5414
5415 !! test
5416 Magic Word: {{CURRENTMONTHABBREV}}
5417 !! input
5418 {{CURRENTMONTHABBREV}}
5419 !! result
5420 <p>Jan
5421 </p>
5422 !! end
5423
5424 !! test
5425 Magic Word: {{CURRENTMONTHNAME}}
5426 !! input
5427 {{CURRENTMONTHNAME}}
5428 !! result
5429 <p>January
5430 </p>
5431 !! end
5432
5433 !! test
5434 Magic Word: {{CURRENTMONTHNAMEGEN}}
5435 !! input
5436 {{CURRENTMONTHNAMEGEN}}
5437 !! result
5438 <p>January
5439 </p>
5440 !! end
5441
5442 !! test
5443 Magic Word: {{CURRENTTIME}}
5444 !! input
5445 {{CURRENTTIME}}
5446 !! result
5447 <p>00:02
5448 </p>
5449 !! end
5450
5451 !! test
5452 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5453 !! input
5454 {{CURRENTWEEK}}
5455 !! result
5456 <p>1
5457 </p>
5458 !! end
5459
5460 !! test
5461 Magic Word: {{CURRENTYEAR}}
5462 !! input
5463 {{CURRENTYEAR}}
5464 !! result
5465 <p>1970
5466 </p>
5467 !! end
5468
5469 !! test
5470 Magic Word: {{FULLPAGENAME}}
5471 !! options
5472 title=[[User:Ævar Arnfjörð Bjarmason]]
5473 !! input
5474 {{FULLPAGENAME}}
5475 !! result
5476 <p>User:Ævar Arnfjörð Bjarmason
5477 </p>
5478 !! end
5479
5480 !! test
5481 Magic Word: {{FULLPAGENAMEE}}
5482 !! options
5483 title=[[User:Ævar Arnfjörð Bjarmason]]
5484 !! input
5485 {{FULLPAGENAMEE}}
5486 !! result
5487 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5488 </p>
5489 !! end
5490
5491 !! test
5492 Magic Word: {{NAMESPACE}}
5493 !! options
5494 title=[[User:Ævar Arnfjörð Bjarmason]]
5495 !! input
5496 {{NAMESPACE}}
5497 !! result
5498 <p>User
5499 </p>
5500 !! end
5501
5502 !! test
5503 Magic Word: {{NAMESPACEE}}
5504 !! options
5505 title=[[User:Ævar Arnfjörð Bjarmason]]
5506 !! input
5507 {{NAMESPACEE}}
5508 !! result
5509 <p>User
5510 </p>
5511 !! end
5512
5513 !! test
5514 Magic Word: {{NAMESPACENUMBER}}
5515 !! options
5516 title=[[User:Ævar Arnfjörð Bjarmason]]
5517 !! input
5518 {{NAMESPACENUMBER}}
5519 !! result
5520 <p>2
5521 </p>
5522 !! end
5523
5524 !! test
5525 Magic Word: {{NUMBEROFFILES}}
5526 !! input
5527 {{NUMBEROFFILES}}
5528 !! result
5529 <p>4
5530 </p>
5531 !! end
5532
5533 !! test
5534 Magic Word: {{PAGENAME}}
5535 !! options
5536 title=[[User:Ævar Arnfjörð Bjarmason]]
5537 !! input
5538 {{PAGENAME}}
5539 !! result
5540 <p>Ævar Arnfjörð Bjarmason
5541 </p>
5542 !! end
5543
5544 !! test
5545 Magic Word: {{PAGENAME}} with metacharacters
5546 !! options
5547 title=[['foo & bar = baz']]
5548 !! input
5549 ''{{PAGENAME}}''
5550 !! result
5551 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5552 </p>
5553 !! end
5554
5555 !! test
5556 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5557 !! options
5558 title=[[*RFC 1234 http://example.com/]]
5559 !! input
5560 {{PAGENAME}}
5561 !! result
5562 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5563 </p>
5564 !! end
5565
5566 !! test
5567 Magic Word: {{PAGENAMEE}}
5568 !! options
5569 title=[[User:Ævar Arnfjörð Bjarmason]]
5570 !! input
5571 {{PAGENAMEE}}
5572 !! result
5573 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5574 </p>
5575 !! end
5576
5577 !! test
5578 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5579 !! options
5580 title=[[*RFC 1234 http://example.com/]]
5581 !! input
5582 {{PAGENAMEE}}
5583 !! result
5584 <p>&#42;RFC_1234_http&#58;//example.com/
5585 </p>
5586 !! end
5587
5588 !! test
5589 Magic Word: {{REVISIONID}}
5590 !! input
5591 {{REVISIONID}}
5592 !! result
5593 <p>1337
5594 </p>
5595 !! end
5596
5597 !! test
5598 Magic Word: {{SCRIPTPATH}}
5599 !! input
5600 {{SCRIPTPATH}}
5601 !! result
5602 <p>/
5603 </p>
5604 !! end
5605
5606 !! test
5607 Magic Word: {{SERVER}}
5608 !! input
5609 {{SERVER}}
5610 !! result
5611 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5612 </p>
5613 !! end
5614
5615 !! test
5616 Magic Word: {{SERVERNAME}}
5617 !! input
5618 {{SERVERNAME}}
5619 !! result
5620 <p>example.org
5621 </p>
5622 !! end
5623
5624 !! test
5625 Magic Word: {{SITENAME}}
5626 !! input
5627 {{SITENAME}}
5628 !! result
5629 <p>MediaWiki
5630 </p>
5631 !! end
5632
5633 !! test
5634 Case-sensitive magic words, when cased differently, should just be template transclusions
5635 !! input
5636 {{CurrentMonth}}
5637 {{currentday}}
5638 {{cURreNTweEK}}
5639 {{currentHour}}
5640 !! result
5641 <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>
5642 <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>
5643 <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>
5644 <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>
5645 </p>
5646 !! end
5647
5648 !! test
5649 Case-insensitive magic words should still work with weird casing.
5650 !! input
5651 {{sErVeRNaMe}}
5652 {{LCFirst:AOEU}}
5653 {{ucFIRST:aoeu}}
5654 {{SERver}}
5655 !! result
5656 <p>example.org
5657 aOEU
5658 Aoeu
5659 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5660 </p>
5661 !! end
5662
5663 !! test
5664 Namespace 1 {{ns:1}}
5665 !! input
5666 {{ns:1}}
5667 !! result
5668 <p>Talk
5669 </p>
5670 !! end
5671
5672 !! test
5673 Namespace 1 {{ns:01}}
5674 !! input
5675 {{ns:01}}
5676 !! result
5677 <p>Talk
5678 </p>
5679 !! end
5680
5681 !! test
5682 Namespace 0 {{ns:0}} (bug 4783)
5683 !! input
5684 {{ns:0}}
5685 !! result
5686
5687 !! end
5688
5689 !! test
5690 Namespace 0 {{ns:00}} (bug 4783)
5691 !! input
5692 {{ns:00}}
5693 !! result
5694
5695 !! end
5696
5697 !! test
5698 Namespace -1 {{ns:-1}}
5699 !! input
5700 {{ns:-1}}
5701 !! result
5702 <p>Special
5703 </p>
5704 !! end
5705
5706 !! test
5707 Namespace User {{ns:User}}
5708 !! input
5709 {{ns:User}}
5710 !! result
5711 <p>User
5712 </p>
5713 !! end
5714
5715 !! test
5716 Namespace User talk {{ns:User_talk}}
5717 !! input
5718 {{ns:User_talk}}
5719 !! result
5720 <p>User talk
5721 </p>
5722 !! end
5723
5724 !! test
5725 Namespace User talk {{ns:uSeR tAlK}}
5726 !! input
5727 {{ns:uSeR tAlK}}
5728 !! result
5729 <p>User talk
5730 </p>
5731 !! end
5732
5733 !! test
5734 Namespace File {{ns:File}}
5735 !! input
5736 {{ns:File}}
5737 !! result
5738 <p>File
5739 </p>
5740 !! end
5741
5742 !! test
5743 Namespace File {{ns:Image}}
5744 !! input
5745 {{ns:Image}}
5746 !! result
5747 <p>File
5748 </p>
5749 !! end
5750
5751 !! test
5752 Namespace (lang=de) Benutzer {{ns:User}}
5753 !! options
5754 language=de
5755 !! input
5756 {{ns:User}}
5757 !! result
5758 <p>Benutzer
5759 </p>
5760 !! end
5761
5762 !! test
5763 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5764 !! options
5765 language=de
5766 !! input
5767 {{ns:3}}
5768 !! result
5769 <p>Benutzer Diskussion
5770 </p>
5771 !! end
5772
5773
5774 !! test
5775 Urlencode
5776 !! input
5777 {{urlencode:hi world?!}}
5778 {{urlencode:hi world?!|WIKI}}
5779 {{urlencode:hi world?!|PATH}}
5780 {{urlencode:hi world?!|QUERY}}
5781 !! result
5782 <p>hi+world%3F%21
5783 hi_world%3F!
5784 hi%20world%3F%21
5785 hi+world%3F%21
5786 </p>
5787 !! end
5788
5789 ###
5790 ### Magic links
5791 ###
5792 !! test
5793 Magic links: internal link to RFC (bug 479)
5794 !! input
5795 [[RFC 123]]
5796 !! result
5797 <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>
5798 </p>
5799 !! end
5800
5801 !! test
5802 Magic links: RFC (bug 479)
5803 !! input
5804 RFC 822
5805 !! result
5806 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5807 </p>
5808 !! end
5809
5810 !! test
5811 Magic links: ISBN (bug 1937)
5812 !! input
5813 ISBN 0-306-40615-2
5814 !! result
5815 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5816 </p>
5817 !! end
5818
5819 !! test
5820 Magic links: PMID incorrectly converts space to underscore
5821 !! input
5822 PMID 1234
5823 !! result
5824 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5825 </p>
5826 !! end
5827
5828 ###
5829 ### Templates
5830 ####
5831
5832 !! test
5833 Nonexistent template
5834 !! input
5835 {{thistemplatedoesnotexist}}
5836 !! result
5837 <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>
5838 </p>
5839 !! end
5840
5841 !! test
5842 Template with invalid target containing tags
5843 !! input
5844 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5845 !! result
5846 <p>{{a<b>b</b>|foo|a=b|a = b}}
5847 </p>
5848 !! end
5849
5850 !! test
5851 Template with invalid target containing unclosed tag
5852 !! input
5853 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5854 !! result
5855 <p>{{a<b>|foo|a=b|a = b}}</b>
5856 </p>
5857 !! end
5858
5859 !! article
5860 Template:test
5861 !! text
5862 This is a test template
5863 !! endarticle
5864
5865 !! test
5866 Simple template
5867 !! input
5868 {{test}}
5869 !! result
5870 <p>This is a test template
5871 </p>
5872 !! end
5873
5874 !! test
5875 Template with explicit namespace
5876 !! input
5877 {{Template:test}}
5878 !! result
5879 <p>This is a test template
5880 </p>
5881 !! end
5882
5883
5884 !! article
5885 Template:paramtest
5886 !! text
5887 This is a test template with parameter {{{param}}}
5888 !! endarticle
5889
5890 !! test
5891 Template parameter
5892 !! input
5893 {{paramtest|param=foo}}
5894 !! result
5895 <p>This is a test template with parameter foo
5896 </p>
5897 !! end
5898
5899 !! article
5900 Template:paramtestnum
5901 !! text
5902 [[{{{1}}}|{{{2}}}]]
5903 !! endarticle
5904
5905 !! test
5906 Template unnamed parameter
5907 !! input
5908 {{paramtestnum|Main Page|the main page}}
5909 !! result
5910 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5911 </p>
5912 !! end
5913
5914 !! article
5915 Template:templatesimple
5916 !! text
5917 (test)
5918 !! endarticle
5919
5920 !! article
5921 Template:templateredirect
5922 !! text
5923 #redirect [[Template:templatesimple]]
5924 !! endarticle
5925
5926 !! article
5927 Template:templateasargtestnum
5928 !! text
5929 {{{{{1}}}}}
5930 !! endarticle
5931
5932 !! article
5933 Template:templateasargtest
5934 !! text
5935 {{template{{{templ}}}}}
5936 !! endarticle
5937
5938 !! article
5939 Template:templateasargtest2
5940 !! text
5941 {{{{{templ}}}}}
5942 !! endarticle
5943
5944 !! test
5945 Template with template name as unnamed argument
5946 !! input
5947 {{templateasargtestnum|templatesimple}}
5948 !! result
5949 <p>(test)
5950 </p>
5951 !! end
5952
5953 !! test
5954 Template with template name as argument
5955 !! input
5956 {{templateasargtest|templ=simple}}
5957 !! result
5958 <p>(test)
5959 </p>
5960 !! end
5961
5962 !! test
5963 Template with template name as argument (2)
5964 !! input
5965 {{templateasargtest2|templ=templatesimple}}
5966 !! result
5967 <p>(test)
5968 </p>
5969 !! end
5970
5971 !! article
5972 Template:templateasargtestdefault
5973 !! text
5974 {{{{{templ|templatesimple}}}}}
5975 !! endarticle
5976
5977 !! article
5978 Template:templa
5979 !! text
5980 '''templ'''
5981 !! endarticle
5982
5983 !! test
5984 Template with default value
5985 !! input
5986 {{templateasargtestdefault}}
5987 !! result
5988 <p>(test)
5989 </p>
5990 !! end
5991
5992 !! test
5993 Template with default value (value set)
5994 !! input
5995 {{templateasargtestdefault|templ=templa}}
5996 !! result
5997 <p><b>templ</b>
5998 </p>
5999 !! end
6000
6001 !! test
6002 Template redirect
6003 !! input
6004 {{templateredirect}}
6005 !! result
6006 <p>(test)
6007 </p>
6008 !! end
6009
6010 !! test
6011 Template with argument in separate line
6012 !! input
6013 {{ templateasargtest |
6014 templ = simple }}
6015 !! result
6016 <p>(test)
6017 </p>
6018 !! end
6019
6020 !! test
6021 Template with complex template as argument
6022 !! input
6023 {{paramtest|
6024 param ={{ templateasargtest |
6025 templ = simple }}}}
6026 !! result
6027 <p>This is a test template with parameter (test)
6028 </p>
6029 !! end
6030
6031 !! test
6032 Template with thumb image (with link in description)
6033 !! input
6034 {{paramtest|
6035 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6036 !! result
6037 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>
6038
6039 !! end
6040
6041 !! article
6042 Template:complextemplate
6043 !! text
6044 {{{1}}} {{paramtest|
6045 param ={{{param}}}}}
6046 !! endarticle
6047
6048 !! test
6049 Template with complex arguments
6050 !! input
6051 {{complextemplate|
6052 param ={{ templateasargtest |
6053 templ = simple }}|[[Template:complextemplate|link]]}}
6054 !! result
6055 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6056 </p>
6057 !! end
6058
6059 !! test
6060 BUG 553: link with two variables in a piped link
6061 !! input
6062 {|
6063 |[[{{{1}}}|{{{2}}}]]
6064 |}
6065 !! result
6066 <table>
6067 <tr>
6068 <td>[[{{{1}}}|{{{2}}}]]
6069 </td></tr></table>
6070
6071 !! end
6072
6073 !! test
6074 Magic variable as template parameter
6075 !! input
6076 {{paramtest|param={{SITENAME}}}}
6077 !! result
6078 <p>This is a test template with parameter MediaWiki
6079 </p>
6080 !! end
6081
6082 !! article
6083 Template:linktest
6084 !! text
6085 [[{{{param}}}|link]]
6086 !! endarticle
6087
6088 !! test
6089 Template parameter as link source
6090 !! input
6091 {{linktest|param=Main Page}}
6092 !! result
6093 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6094 </p>
6095 !! end
6096
6097 !!test
6098 Template-generated attribute string (k='v')
6099 !!input
6100 <span {{attr_str|id|v1}}>bar</span>
6101 !!result
6102 <p><span id="v1">bar</span>
6103 </p>
6104 !!end
6105
6106 !!article
6107 Template:paramtest2
6108 !! text
6109 including another template, {{paramtest|param={{{arg}}}}}
6110 !! endarticle
6111
6112 !! test
6113 Template passing argument to another template
6114 !! input
6115 {{paramtest2|arg='hmm'}}
6116 !! result
6117 <p>including another template, This is a test template with parameter 'hmm'
6118 </p>
6119 !! end
6120
6121 !! article
6122 Template:Linktest2
6123 !! text
6124 Main Page
6125 !! endarticle
6126
6127 !! test
6128 Template as link source
6129 !! input
6130 [[{{linktest2}}]]
6131
6132 [[{{linktest2}}|Main Page]]
6133
6134 [[{{linktest2}}]]Page
6135 !! result
6136 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6137 </p><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>Page
6139 </p>
6140 !! end
6141
6142
6143 !! article
6144 Template:loop1
6145 !! text
6146 {{loop2}}
6147 !! endarticle
6148
6149 !! article
6150 Template:loop2
6151 !! text
6152 {{loop1}}
6153 !! endarticle
6154
6155 !! test
6156 Template infinite loop
6157 !! input
6158 {{loop1}}
6159 !! result
6160 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6161 </p>
6162 !! end
6163
6164 !! test
6165 Template from main namespace
6166 !! input
6167 {{:Main Page}}
6168 !! result
6169 <p>blah blah
6170 </p>
6171 !! end
6172
6173 !! article
6174 Template:table
6175 !! text
6176 {|
6177 | 1 || 2
6178 |-
6179 | 3 || 4
6180 |}
6181 !! endarticle
6182
6183 !! test
6184 BUG 529: Template with table, not included at beginning of line
6185 !! input
6186 foo {{table}}
6187 !! result
6188 <p>foo
6189 </p>
6190 <table>
6191 <tr>
6192 <td> 1 </td>
6193 <td> 2
6194 </td></tr>
6195 <tr>
6196 <td> 3 </td>
6197 <td> 4
6198 </td></tr></table>
6199
6200 !! end
6201
6202 !! test
6203 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6204 !! input
6205 foo
6206 {{table}}
6207 !! result
6208 <p>foo
6209 </p>
6210 <table>
6211 <tr>
6212 <td> 1 </td>
6213 <td> 2
6214 </td></tr>
6215 <tr>
6216 <td> 3 </td>
6217 <td> 4
6218 </td></tr></table>
6219
6220 !! end
6221
6222 !! test
6223 BUG 41: Template parameters shown as broken links
6224 !! input
6225 {{{parameter}}}
6226 !! result
6227 <p>{{{parameter}}}
6228 </p>
6229 !! end
6230
6231 !! test
6232 Template with targets containing wikilinks
6233 !! input
6234 {{[[foo]]}}
6235
6236 {{[[{{echo|foo}}]]}}
6237
6238 {{{{echo|[[foo}}]]}}
6239 !! result
6240 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6241 </p><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>{{[[foo}}]]
6243 </p>
6244 !! end
6245
6246 !! article
6247 Template:MSGNW test
6248 !! text
6249 ''None'' of '''this''' should be
6250 * interpreted
6251 but rather passed unmodified
6252 {{test}}
6253 !! endarticle
6254
6255 # hmm, fix this or just deprecate msgnw and document its behavior?
6256 !! test
6257 msgnw keyword
6258 !! options
6259 disabled
6260 !! input
6261 {{msgnw:MSGNW test}}
6262 !! result
6263 <p>''None'' of '''this''' should be
6264 * interpreted
6265 but rather passed unmodified
6266 {{test}}
6267 </p>
6268 !! end
6269
6270 !! test
6271 int keyword
6272 !! input
6273 {{int:youhavenewmessages|lots of money|not!}}
6274 !! result
6275 <p>You have lots of money (not!).
6276 </p>
6277 !! end
6278
6279 !! article
6280 Template:Includes
6281 !! text
6282 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6283 !! endarticle
6284
6285 !! test
6286 <includeonly> and <noinclude> being included
6287 !! input
6288 {{Includes}}
6289 !! result
6290 <p>Foobar
6291 </p>
6292 !! end
6293
6294 !! article
6295 Template:Includes2
6296 !! text
6297 <onlyinclude>Foo</onlyinclude>bar
6298 !! endarticle
6299
6300 !! test
6301 <onlyinclude> being included
6302 !! input
6303 {{Includes2}}
6304 !! result
6305 <p>Foo
6306 </p>
6307 !! end
6308
6309
6310 !! article
6311 Template:Includes3
6312 !! text
6313 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6314 !! endarticle
6315
6316 !! test
6317 <onlyinclude> and <includeonly> being included
6318 !! input
6319 {{Includes3}}
6320 !! result
6321 <p>Foo
6322 </p>
6323 !! end
6324
6325 !! test
6326 <includeonly> and <noinclude> on a page
6327 !! input
6328 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6329 !! result
6330 <p>Foozar
6331 </p>
6332 !! end
6333
6334 !! test
6335 Un-closed <noinclude>
6336 !! input
6337 <noinclude>
6338 !! result
6339 !! end
6340
6341 !! test
6342 <onlyinclude> on a page
6343 !! input
6344 <onlyinclude>Foo</onlyinclude>bar
6345 !! result
6346 <p>Foobar
6347 </p>
6348 !! end
6349
6350 !! test
6351 Un-closed <onlyinclude>
6352 !! input
6353 <onlyinclude>
6354 !! result
6355 !! end
6356
6357 !!test
6358 Self-closed noinclude, includeonly, onlyinclude tags
6359 !!input
6360 <noinclude />
6361 <includeonly />
6362 <onlyinclude />
6363 !!result
6364 <p><br />
6365 </p>
6366 !!end
6367
6368 !!test
6369 Unbalanced includeonly and noinclude tags
6370 !!input
6371 {|
6372 |a</noinclude>
6373 |b</noinclude></noinclude>
6374 |c</noinclude></includeonly>
6375 |d</includeonly></includeonly>
6376 |}
6377 !!result
6378 <table>
6379 <tr>
6380 <td>a
6381 </td>
6382 <td>b
6383 </td>
6384 <td>c&lt;/includeonly&gt;
6385 </td>
6386 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6387 </td></tr></table>
6388
6389 !!end
6390
6391 !! article
6392 Template:Includeonly section
6393 !! text
6394 <includeonly>
6395 ==Includeonly section==
6396 </includeonly>
6397 ==Section T-1==
6398 !!endarticle
6399
6400 !! test
6401 Bug 6563: Edit link generation for section shown by <includeonly>
6402 !! input
6403 {{includeonly section}}
6404 !! result
6405 <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>
6406 <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>
6407
6408 !! end
6409
6410 # Uses same input as the contents of [[Template:Includeonly section]]
6411 !! test
6412 Bug 6563: Section extraction for section shown by <includeonly>
6413 !! options
6414 section=T-2
6415 !! input
6416 <includeonly>
6417 ==Includeonly section==
6418 </includeonly>
6419 ==Section T-2==
6420 !! result
6421 ==Section T-2==
6422 !! end
6423
6424 !! test
6425 Bug 6563: Edit link generation for section suppressed by <includeonly>
6426 !! input
6427 <includeonly>
6428 ==Includeonly section==
6429 </includeonly>
6430 ==Section 1==
6431 !! result
6432 <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>
6433
6434 !! end
6435
6436 !! test
6437 Bug 6563: Section extraction for section suppressed by <includeonly>
6438 !! options
6439 section=1
6440 !! input
6441 <includeonly>
6442 ==Includeonly section==
6443 </includeonly>
6444 ==Section 1==
6445 !! result
6446 ==Section 1==
6447 !! end
6448
6449 !! test
6450 Un-closed <includeonly>
6451 !! input
6452 <includeonly>
6453 !! result
6454 !! end
6455
6456 ###
6457 ### <includeonly> and <noinclude> in attributes
6458 ###
6459 !!test
6460 0. includeonly around the entire attribute
6461 !!input
6462 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6463 !!result
6464 <p><span id="v2">bar</span>
6465 </p>
6466 !!end
6467
6468 !!test
6469 1. includeonly in html attr key
6470 !!input
6471 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6472 !!result
6473 <p><span id="foo">bar</span>
6474 </p>
6475 !!end
6476
6477 !!test
6478 2. includeonly in html attr value
6479 !!input
6480 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6481 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6482 !!result
6483 <p><span id="v1">bar</span>
6484 <span id="v1">bar</span>
6485 </p>
6486 !!end
6487
6488 !!test
6489 3. includeonly in part of an attr value
6490 !!input
6491 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6492 !!result
6493 <p><span style="color:red;">bar</span>
6494 </p>
6495 !!end
6496
6497 ###
6498 ### Testing parsing of templates where a template arg
6499 ### has the same name as the template itself.
6500 ###
6501
6502 !! article
6503 Template:quote
6504 !! text
6505 {{{quote|{{{1}}}}}}
6506 !! endarticle
6507
6508 !!test
6509 Templates: Template Name/Arg clash: 1. Use of positional param
6510 !!input
6511 {{quote|foo}}
6512 !!result
6513 <p>foo
6514 </p>
6515 !!end
6516
6517 !!test
6518 Templates: Template Name/Arg clash: 2. Use of named param
6519 !!input
6520 {{quote|quote=foo}}
6521 !!result
6522 <p>foo
6523 </p>
6524 !!end
6525
6526 !!test
6527 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6528 !!input
6529 {{quote|quote}}
6530 !!result
6531 <p>quote
6532 </p>
6533 !!end
6534
6535 ###
6536 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6537 ###
6538
6539 !!test
6540 Templates: 1. Simple use
6541 !!input
6542 {{echo|Foo}}
6543 !!result
6544 <p>Foo
6545 </p>
6546 !!end
6547
6548 !!test
6549 Templates: 2. Inside a block tag
6550 !!input
6551 <div>{{echo|Foo}}</div>
6552 !!result
6553 <div>Foo</div>
6554
6555 !!end
6556
6557 !!test
6558 Templates: P-wrapping: 1a. Templates on consecutive lines
6559 !!input
6560 {{echo|Foo}}
6561 {{echo|bar}}
6562 !!result
6563 <p>Foo
6564 bar
6565 </p>
6566 !!end
6567
6568 !!test
6569 Templates: P-wrapping: 1b. Templates on consecutive lines
6570 !!input
6571 Foo
6572
6573 {{echo|bar}}
6574 {{echo|baz}}
6575 !!result
6576 <p>Foo
6577 </p><p>bar
6578 baz
6579 </p>
6580 !!end
6581
6582 !!test
6583 Templates: P-wrapping: 1c. Templates on consecutive lines
6584 !!input
6585 {{echo|Foo}}
6586 {{echo|bar}} <div>baz</div>
6587 !!result
6588 <p>Foo
6589 </p>
6590 bar <div>baz</div>
6591
6592 !!end
6593
6594 !!test
6595 Templates: P-wrapping: 1d. Template preceded by comment-only line
6596 !!options
6597 parsoid=wt2html,wt2wt
6598 !!input
6599 <!-- foo -->
6600 {{echo|Bar}}
6601 !!result
6602 <!-- foo -->
6603 <p typeof="mw:Transclusion">Bar
6604 </p>
6605 !!end
6606
6607 !!test
6608 Templates: Inline Text: 1. Multiple tmeplate uses
6609 !!input
6610 {{echo|Foo}}bar{{echo|baz}}
6611 !!result
6612 <p>Foobarbaz
6613 </p>
6614 !!end
6615
6616 !!test
6617 Templates: Inline Text: 2. Back-to-back template uses
6618 !!input
6619 {{echo|Foo}}{{echo|bar}}
6620 !!result
6621 <p>Foobar
6622 </p>
6623 !!end
6624
6625 !!test
6626 Templates: Block Tags: 1. Multiple template uses
6627 !!input
6628 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6629 !!result
6630 <div>Foo</div><div>bar</div><div>baz</div>
6631
6632 !!end
6633
6634 !!test
6635 Templates: Block Tags: 2. Back-to-back template uses
6636 !!input
6637 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6638 !!result
6639 <div>Foo</div><div>bar</div>
6640
6641 !!end
6642
6643 !!test
6644 Templates: Links: 1. Simple example
6645 !!input
6646 {{echo|[[Foo|bar]]}}
6647 !!result
6648 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6649 </p>
6650 !!end
6651
6652 !!test
6653 Templates: Links: 2. Generation of link href
6654 !!input
6655 [[{{echo|Foo}}|bar]]
6656 !!result
6657 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6658 </p>
6659 !!end
6660
6661 !!test
6662 Templates: Links: 3. Generation of part of a link href
6663 !!input
6664 [[Fo{{echo|o}}|bar]]
6665
6666 [[Foo{{echo|bar}}]]
6667
6668 [[Foo{{echo|bar}}baz]]
6669
6670 [[Foo{{echo|bar}}|bar]]
6671
6672 [[:Foo{{echo|bar}}]]
6673
6674 [[:Foo{{echo|bar}}|bar]]
6675 !!result
6676 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6677 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6678 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6679 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6680 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6681 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6682 </p>
6683 !!end
6684
6685 !!test
6686 Templates: Links: 4. Multiple templates generating link href
6687 !!input
6688 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6689 !!result
6690 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6691 </p>
6692 !!end
6693
6694 !!test
6695 Templates: Links: 5. Generation of link text
6696 !!input
6697 [[Foo|{{echo|bar}}]]
6698 !!result
6699 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6700 </p>
6701 !!end
6702
6703 !!test
6704 Templates: Links: 5. Nested templates (only outermost template should be marked)
6705 !!input
6706 {{echo|[[{{echo|Foo}}|bar]]}}
6707 !!result
6708 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6709 </p>
6710 !!end
6711
6712 !!test
6713 Templates: HTML Tag: 1. Generation of HTML attr. key
6714 !!input
6715 <div {{echo|style}}="color:red;">foo</div>
6716 !!result
6717 <div style="color:red;">foo</div>
6718
6719 !!end
6720
6721 !!test
6722 Templates: HTML Tag: 2. Generation of HTML attr. value
6723 !!input
6724 <div style={{echo|'color:red;'}}>foo</div>
6725 !!result
6726 <div style="color:red;">foo</div>
6727
6728 !!end
6729
6730 !!test
6731 Templates: HTML Tag: 3. Generation of HTML attr key and value
6732 !!input
6733 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6734 !!result
6735 <div style="color:red;">foo</div>
6736
6737 !!end
6738
6739 !!test
6740 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6741 !!input
6742 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6743 !!result
6744 <div title="This is a long title with just one piece templated">foo</div>
6745
6746 !!end
6747
6748 !!test
6749 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6750 !!input
6751 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6752 !!result
6753 <div title="This is a long title with just one piece templated">foo</div>
6754
6755 !!end
6756
6757 !!test
6758 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6759 !!input
6760 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6761 !!result
6762 <div title="This is a long title with just one piece templated">foo</div>
6763
6764 !!end
6765
6766 !!test
6767 Templates: HTML Tag: 7. Generation of partial attribute key string
6768 !!input
6769 <div st{{echo|yle}}="color:red;">foo</div>
6770 !!result
6771 <div style="color:red;">foo</div>
6772
6773 !!end
6774
6775 !!test
6776 Templates: HTML Tables: 1. Generating start of a HTML table
6777 !!input
6778 {{echo|<table><tr><td>foo</td>}}</tr></table>
6779 !!result
6780 <table><tr><td>foo</td></tr></table>
6781
6782 !!end
6783
6784 !!test
6785 Templates: HTML Tables: 2a. Generating middle of a HTML table
6786 !!input
6787 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6788 !!result
6789 <table><tr><td>foo</td></tr></table>
6790
6791 !!end
6792
6793 !!test
6794 Templates: HTML Tables: 2b. Generating middle of a HTML table
6795 !!input
6796 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6797 !!result
6798 <table><tr><td>foo</td></tr></table>
6799
6800 !!end
6801
6802 !!test
6803 Templates: HTML Tables: 3. Generating end of a HTML table
6804 !!input
6805 <table><tr>{{echo|<td>foo</td></tr></table>}}
6806 !!result
6807 <table><tr><td>foo</td></tr></table>
6808
6809 !!end
6810
6811 !!test
6812 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6813 !!input
6814 {{echo|<table>}}<tr><td>foo</td></tr></table>
6815 !!result
6816 <table><tr><td>foo</td></tr></table>
6817
6818 !!end
6819
6820 !!test
6821 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6822 !!input
6823 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6824 !!result
6825 <table><tr><td>foo</td></tr></table>
6826
6827 !!end
6828
6829 !!test
6830 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6831 !!input
6832 <table><tr>{{echo|<td>}}foo</td></tr></table>
6833 !!result
6834 <table><tr><td>foo</td></tr></table>
6835
6836 !!end
6837
6838 !!test
6839 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6840 !!input
6841 <table><tr><td>foo{{echo|</td>}}</tr></table>
6842 !!result
6843 <table><tr><td>foo</td></tr></table>
6844
6845 !!end
6846
6847 !!test
6848 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6849 !!input
6850 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6851 !!result
6852 <table><tr><td>foo</td></tr></table>
6853
6854 !!end
6855
6856 !!test
6857 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6858 !!input
6859 <table><tr><td>foo</td></tr>{{echo|</table>}}
6860 !!result
6861 <table><tr><td>foo</td></tr></table>
6862
6863 !!end
6864
6865 !!test
6866 Templates: HTML Tables: 5. Proper fostering of categories from inside
6867 !!options
6868 parsoid=wt2html,wt2wt
6869 !!input
6870 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6871 <!--Two categories (Bug 50330)-->
6872 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6873 !!result
6874 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6875 <!--Two categories (Bug 50330)-->
6876 <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>
6877 !!end
6878
6879 !!test
6880 Templates: Wiki Tables: 1a. Fostering of entire template content
6881 !!input
6882 {|
6883 {{echo|a}}
6884 |}
6885 !!result
6886 <table>
6887 a
6888 <tr><td></td></tr></table>
6889
6890 !!end
6891
6892 !!test
6893 Templates: Wiki Tables: 1b. Fostering of entire template content
6894 !!input
6895 {|
6896 {{echo|<div>}}
6897 foo
6898 {{echo|</div>}}
6899 |}
6900 !!result
6901 <table>
6902 <div>
6903 <p>foo
6904 </p>
6905 </div>
6906 <tr><td></td></tr></table>
6907
6908 !!end
6909
6910 !!test
6911 Templates: Wiki Tables: 2. Fostering of partial template content
6912 !!input
6913 {|
6914 {{echo|a
6915 <div>b</div>}}
6916 |}
6917 !!result
6918 <table>
6919 a
6920 <div>b</div>
6921 <tr><td></td></tr></table>
6922
6923 !!end
6924
6925 !!test
6926 Templates: Wiki Tables: 3. td-content via multiple templates
6927 !!input
6928 {|
6929 {{echo|{{pipe}}a}}{{echo|b}}
6930 |}
6931 !!result
6932 <table>
6933 <tr>
6934 <td>ab
6935 </td></tr></table>
6936
6937 !!end
6938
6939 !!test
6940 Templates: Wiki Tables: 4. Templated tags, no content
6941 !!input
6942 {{tbl-start}}
6943 {{tbl-end}}
6944 !!result
6945 <table>
6946 <tr><td></td></tr></table>
6947
6948 !!end
6949
6950 !!test
6951 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6952 !!input
6953 {{tbl-start}}
6954 |foo
6955 {{tbl-end}}
6956 !!result
6957 <table>
6958 <tr>
6959 <td>foo
6960 </td></tr></table>
6961
6962 !!end
6963
6964 !!test
6965 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6966 !!input
6967 {{tbl-start}}
6968 {{!}}foo
6969 {{tbl-end}}
6970 !!result
6971 <table>
6972 <tr>
6973 <td>foo
6974 </td></tr></table>
6975
6976 !!end
6977
6978 !!test
6979 Templates: Lists: Multi-line list-items via templates
6980 !!input
6981 *{{echo|a {{nonexistent|
6982 unused}}}}
6983 *{{echo|b {{nonexistent|
6984 unused}}}}
6985 !!result
6986 <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>
6987 </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>
6988 </li></ul>
6989
6990 !!end
6991
6992 !!test
6993 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6994 !!input
6995 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6996 !!result
6997 <p><i>ab</i>c<i>d</i>e
6998 </p>
6999 !!end
7000
7001 !!test
7002 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7003 (PHP parser generates misnested html)
7004 !! options
7005 parsoid=wt2html,wt2wt
7006 !!input
7007 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7008 !!result
7009 <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>
7010 !!end
7011
7012 !!test
7013 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7014 (PHP parser generates misnested html)
7015 !! options
7016 parsoid=wt2html,wt2wt
7017 !!input
7018 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7019 !!result
7020 <div typeof="mw:Transclusion"><i>a</i></div>
7021 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7022 <div typeof="mw:Transclusion">e</div>
7023 !!end
7024
7025 !!test
7026 Templates: Ugly nesting: 4. Divs opened/closed across templates
7027 !!input
7028 a<div>b{{echo|c</div>d}}e
7029 !!result
7030 a<div>bc</div>de
7031
7032 !!end
7033
7034 !!test
7035 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7036 (Parsoid-centric)
7037 !! options
7038 parsoid
7039 !!input
7040 {|
7041 |{{echo|foo</table>}}
7042 |bar
7043 |}
7044 !!result
7045 <table typeof="mw:Transclusion">
7046 <tbody>
7047 <tr>
7048 <td>foo</td></tr></tbody></table><span>bar</span>
7049 !!end
7050
7051 !!test
7052 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7053 (Parsoid-centric)
7054 !! options
7055 parsoid
7056 !!input
7057 <table>
7058 <tr>
7059 <td>
7060 <table>
7061 <tr>
7062 <td>1. {{echo|foo </table>}}</td>
7063 <td> bar </td>
7064 <td>2. {{echo|baz </table>}}</td>
7065 </tr>
7066 <tr>
7067 <td>abc</td>
7068 </tr>
7069 </table>
7070 </td>
7071 </tr>
7072 <tr>
7073 <td>xyz</td>
7074 </tr>
7075 </table>
7076 !!result
7077 <table about="#mwt1" typeof="mw:Transclusion">
7078 <tbody><tr >
7079 <td >
7080 <table >
7081 <tbody><tr >
7082 <td >1. foo </td></tr></tbody></table></td>
7083 <td > bar </td>
7084 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7085 </span><span about="#mwt1">
7086
7087 abc</span><span about="#mwt1">
7088 </span><span about="#mwt1">
7089 </span><span about="#mwt1">
7090 </span><span about="#mwt1">
7091 </span><span about="#mwt1">
7092
7093 xyz</span><span about="#mwt1">
7094 </span><span about="#mwt1">
7095 </span>
7096 !!end
7097
7098 !! test
7099 Templates: Ugly templates: 3. newline-only template parameter
7100 !! input
7101 foo {{echo|
7102 }}
7103 !! result
7104 <p>foo
7105 </p>
7106 !! end
7107
7108 # This looks like a bug: a single newline triggers p/br for some reason.
7109 !! test
7110 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7111 !! input
7112 {{echo|
7113 }}
7114 !! result
7115 <p><br />
7116 </p>
7117 !! end
7118
7119
7120 !!test
7121 Parser Functions: 1. Simple example
7122 !!input
7123 {{uc:foo}}
7124 !!result
7125 <p>FOO
7126 </p>
7127 !!end
7128
7129 !!test
7130 Parser Functions: 2. Nested use (only outermost should be marked up)
7131 !!input
7132 {{uc:{{lc:FOO}}}}
7133 !!result
7134 <p>FOO
7135 </p>
7136 !!end
7137
7138 ###
7139 ### Pre-save transform tests
7140 ###
7141 !! test
7142 pre-save transform: subst:
7143 !! options
7144 PST
7145 !! input
7146 {{subst:test}}
7147 !! result
7148 This is a test template
7149 !! end
7150
7151 !! test
7152 pre-save transform: normal template
7153 !! options
7154 PST
7155 !! input
7156 {{test}}
7157 !! result
7158 {{test}}
7159 !! end
7160
7161 !! test
7162 pre-save transform: nonexistent template
7163 !! options
7164 PST
7165 !! input
7166 {{thistemplatedoesnotexist}}
7167 !! result
7168 {{thistemplatedoesnotexist}}
7169 !! end
7170
7171
7172 !! test
7173 pre-save transform: subst magic variables
7174 !! options
7175 PST
7176 !! input
7177 {{subst:SITENAME}}
7178 !! result
7179 MediaWiki
7180 !! end
7181
7182 # This is bug 89, which I fixed. -- wtm
7183 !! test
7184 pre-save transform: subst: templates with parameters
7185 !! options
7186 pst
7187 !! input
7188 {{subst:paramtest|param="something else"}}
7189 !! result
7190 This is a test template with parameter "something else"
7191 !! end
7192
7193 !! article
7194 Template:nowikitest
7195 !! text
7196 <nowiki>'''not wiki'''</nowiki>
7197 !! endarticle
7198
7199 !! test
7200 pre-save transform: nowiki in subst (bug 1188)
7201 !! options
7202 pst
7203 !! input
7204 {{subst:nowikitest}}
7205 !! result
7206 <nowiki>'''not wiki'''</nowiki>
7207 !! end
7208
7209
7210 !! article
7211 Template:commenttest
7212 !! text
7213 This template has <!-- a comment --> in it.
7214 !! endarticle
7215
7216 !! test
7217 pre-save transform: comment in subst (bug 1936)
7218 !! options
7219 pst
7220 !! input
7221 {{subst:commenttest}}
7222 !! result
7223 This template has <!-- a comment --> in it.
7224 !! end
7225
7226 !! test
7227 pre-save transform: unclosed tag
7228 !! options
7229 pst noxml
7230 !! input
7231 <nowiki>'''not wiki'''
7232 !! result
7233 <nowiki>'''not wiki'''
7234 !! end
7235
7236 !! test
7237 pre-save transform: mixed tag case
7238 !! options
7239 pst noxml
7240 !! input
7241 <NOwiki>'''not wiki'''</noWIKI>
7242 !! result
7243 <NOwiki>'''not wiki'''</noWIKI>
7244 !! end
7245
7246 !! test
7247 pre-save transform: unclosed comment in <nowiki>
7248 !! options
7249 pst noxml
7250 !! input
7251 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7252 !! result
7253 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7254 !!end
7255
7256 # Leading @ in this template definition works around a limitation
7257 # in parsoid's parserTests which otherwise strips the <span> from the
7258 # result (confusing it for a template wrapper)
7259 !! article
7260 Template:dangerous
7261 !!text
7262 @<span onmouseover="alert('crap')">Oh no</span>
7263 !!endarticle
7264
7265 !!test
7266 (confirming safety of fix for subst bug 1936)
7267 !! input
7268 {{Template:dangerous}}
7269 !! result
7270 <p>@<span>Oh no</span>
7271 </p>
7272 !! end
7273
7274 !! test
7275 pre-save transform: comment containing gallery (bug 5024)
7276 !! options
7277 pst
7278 !! input
7279 <!-- <gallery>data</gallery> -->
7280 !!result
7281 <!-- <gallery>data</gallery> -->
7282 !!end
7283
7284 !! test
7285 pre-save transform: comment containing extension
7286 !! options
7287 pst
7288 !! input
7289 <!-- <tag>data</tag> -->
7290 !!result
7291 <!-- <tag>data</tag> -->
7292 !!end
7293
7294 !! test
7295 pre-save transform: comment containing nowiki
7296 !! options
7297 pst
7298 !! input
7299 <!-- <nowiki>data</nowiki> -->
7300 !!result
7301 <!-- <nowiki>data</nowiki> -->
7302 !!end
7303
7304 !! test
7305 pre-save transform: <noinclude> in subst (bug 3298)
7306 !! options
7307 pst
7308 !! input
7309 {{subst:Includes}}
7310 !! result
7311 Foobar
7312 !! end
7313
7314 !! test
7315 pre-save transform: <onlyinclude> in subst (bug 3298)
7316 !! options
7317 pst
7318 !! input
7319 {{subst:Includes2}}
7320 !! result
7321 Foo
7322 !! end
7323
7324 !! article
7325 Template:SubstTest
7326 !!text
7327 {{<includeonly>subst:</includeonly>Includes}}
7328 !! endarticle
7329
7330 !! article
7331 Template:SafeSubstTest
7332 !! text
7333 {{<includeonly>safesubst:</includeonly>Includes}}
7334 !! endarticle
7335
7336 !! test
7337 bug 22297: safesubst: works during PST
7338 !! options
7339 pst
7340 !! input
7341 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7342 !! result
7343 FoobarFoobar
7344 !! end
7345
7346 !! test
7347 bug 22297: safesubst: works during normal parse
7348 !! input
7349 {{SafeSubstTest}}
7350 !! result
7351 <p>Foobar
7352 </p>
7353 !! end
7354
7355 !! test:
7356 subst: does not work during normal parse
7357 !! input
7358 {{SubstTest}}
7359 !! result
7360 <p>{{subst:Includes}}
7361 </p>
7362 !! end
7363
7364 !! test
7365 pre-save transform: context links ("pipe trick")
7366 !! options
7367 pst
7368 !! input
7369 [[Article (context)|]]
7370 [[Bar:Article|]]
7371 [[:Bar:Article|]]
7372 [[Bar:Article (context)|]]
7373 [[:Bar:Article (context)|]]
7374 [[|Article]]
7375 [[|Article (context)]]
7376 [[Bar:X (Y) Z|]]
7377 [[:Bar:X (Y) Z|]]
7378 !! result
7379 [[Article (context)|Article]]
7380 [[Bar:Article|Article]]
7381 [[:Bar:Article|Article]]
7382 [[Bar:Article (context)|Article]]
7383 [[:Bar:Article (context)|Article]]
7384 [[Article]]
7385 [[Article (context)]]
7386 [[Bar:X (Y) Z|X (Y) Z]]
7387 [[:Bar:X (Y) Z|X (Y) Z]]
7388 !! end
7389
7390 !! test
7391 pre-save transform: context links ("pipe trick") with interwiki prefix
7392 !! options
7393 pst
7394 !! input
7395 [[interwiki:Article|]]
7396 [[:interwiki:Article|]]
7397 [[interwiki:Bar:Article|]]
7398 [[:interwiki:Bar:Article|]]
7399 !! result
7400 [[interwiki:Article|Article]]
7401 [[:interwiki:Article|Article]]
7402 [[interwiki:Bar:Article|Bar:Article]]
7403 [[:interwiki:Bar:Article|Bar:Article]]
7404 !! end
7405
7406 !! test
7407 pre-save transform: context links ("pipe trick") with parens in title
7408 !! options
7409 pst title=[[Somearticle (context)]]
7410 !! input
7411 [[|Article]]
7412 !! result
7413 [[Article (context)|Article]]
7414 !! end
7415
7416 !! test
7417 pre-save transform: context links ("pipe trick") with comma in title
7418 !! options
7419 pst title=[[Someplace, Somewhere]]
7420 !! input
7421 [[|Otherplace]]
7422 [[Otherplace, Elsewhere|]]
7423 [[Otherplace, Elsewhere, Anywhere|]]
7424 !! result
7425 [[Otherplace, Somewhere|Otherplace]]
7426 [[Otherplace, Elsewhere|Otherplace]]
7427 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7428 !! end
7429
7430 !! test
7431 pre-save transform: context links ("pipe trick") with parens and comma
7432 !! options
7433 pst title=[[Someplace (IGNORED), Somewhere]]
7434 !! input
7435 [[|Otherplace]]
7436 [[Otherplace (place), Elsewhere|]]
7437 !! result
7438 [[Otherplace, Somewhere|Otherplace]]
7439 [[Otherplace (place), Elsewhere|Otherplace]]
7440 !! end
7441
7442 !! test
7443 pre-save transform: context links ("pipe trick") with comma and parens
7444 !! options
7445 pst title=[[Who, me? (context)]]
7446 !! input
7447 [[|Yes, you.]]
7448 [[Me, Myself, and I (1937 song)|]]
7449 !! result
7450 [[Yes, you. (context)|Yes, you.]]
7451 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7452 !! end
7453
7454 !! test
7455 pre-save transform: context links ("pipe trick") with namespace
7456 !! options
7457 pst title=[[Ns:Somearticle]]
7458 !! input
7459 [[|Article]]
7460 !! result
7461 [[Ns:Article|Article]]
7462 !! end
7463
7464 !! test
7465 pre-save transform: context links ("pipe trick") with namespace and parens
7466 !! options
7467 pst title=[[Ns:Somearticle (context)]]
7468 !! input
7469 [[|Article]]
7470 !! result
7471 [[Ns:Article (context)|Article]]
7472 !! end
7473
7474 !! test
7475 pre-save transform: context links ("pipe trick") with namespace and comma
7476 !! options
7477 pst title=[[Ns:Somearticle, Context, Whatever]]
7478 !! input
7479 [[|Article]]
7480 !! result
7481 [[Ns:Article, Context, Whatever|Article]]
7482 !! end
7483
7484 !! test
7485 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7486 !! options
7487 pst title=[[Ns:Somearticle, Context (context)]]
7488 !! input
7489 [[|Article]]
7490 !! result
7491 [[Ns:Article (context)|Article]]
7492 !! end
7493
7494 !! test
7495 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7496 !! options
7497 pst title=[[Ns:Somearticle (IGNORED), Context]]
7498 !! input
7499 [[|Article]]
7500 !! result
7501 [[Ns:Article, Context|Article]]
7502 !! end
7503
7504 !! test
7505 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7506 !! options
7507 pst
7508 !! input
7509 [[Article(context)|]]
7510 [[Bar:Article(context)|]]
7511 [[:Bar:Article(context)|]]
7512 [[|Article(context)]]
7513 [[Bar:X(Y)Z|]]
7514 [[:Bar:X(Y)Z|]]
7515 !! result
7516 [[Article(context)|Article]]
7517 [[Bar:Article(context)|Article]]
7518 [[:Bar:Article(context)|Article]]
7519 [[Article(context)]]
7520 [[Bar:X(Y)Z|X(Y)Z]]
7521 [[:Bar:X(Y)Z|X(Y)Z]]
7522 !! end
7523
7524 !! test
7525 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7526 !! options
7527 pst
7528 !! input
7529 [[Article (context)|]]
7530 [[Bar:Article (context)|]]
7531 [[:Bar:Article (context)|]]
7532 [[|Article (context)]]
7533 [[Bar:X (Y) Z|]]
7534 [[:Bar:X (Y) Z|]]
7535 !! result
7536 [[Article (context)|Article]]
7537 [[Bar:Article (context)|Article]]
7538 [[:Bar:Article (context)|Article]]
7539 [[Article (context)]]
7540 [[Bar:X (Y) Z|X (Y) Z]]
7541 [[:Bar:X (Y) Z|X (Y) Z]]
7542 !! end
7543
7544 !! test
7545 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7546 !! options
7547 pst
7548 !! input
7549 [[Article(context)|]]
7550 [[Bar:Article(context)|]]
7551 [[:Bar:Article(context)|]]
7552 [[|Article(context)]]
7553 [[Bar:X(Y)Z|]]
7554 [[:Bar:X(Y)Z|]]
7555 !! result
7556 [[Article(context)|Article]]
7557 [[Bar:Article(context)|Article]]
7558 [[:Bar:Article(context)|Article]]
7559 [[Article(context)]]
7560 [[Bar:X(Y)Z|X(Y)Z]]
7561 [[:Bar:X(Y)Z|X(Y)Z]]
7562 !! end
7563
7564 !! test
7565 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7566 !! options
7567 pst
7568 !! input
7569 [[Article (context), context|]]
7570 [[Article (context),context|]]
7571 [[Bar:Article (context), context|]]
7572 [[Bar:Article (context),context|]]
7573 [[:Bar:Article (context), context|]]
7574 [[:Bar:Article (context),context|]]
7575 !! result
7576 [[Article (context), context|Article]]
7577 [[Article (context),context|Article]]
7578 [[Bar:Article (context), context|Article]]
7579 [[Bar:Article (context),context|Article]]
7580 [[:Bar:Article (context), context|Article]]
7581 [[:Bar:Article (context),context|Article]]
7582 !! end
7583
7584 !! test
7585 pre-save transform: trim trailing empty lines
7586 !! options
7587 pst
7588 !! input
7589 Empty lines are trimmed
7590
7591
7592
7593
7594 !! result
7595 Empty lines are trimmed
7596 !! end
7597
7598 !! test
7599 pre-save transform: Signature expansion
7600 !! options
7601 pst
7602 !! input
7603 * ~~~
7604 * <noinclude>~~~</noinclude>
7605 * <includeonly>~~~</includeonly>
7606 * <onlyinclude>~~~</onlyinclude>
7607 !! result
7608 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7609 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7610 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7611 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7612 !! end
7613
7614
7615 !! test
7616 pre-save transform: Signature expansion in nowiki tags (bug 93)
7617 !! options
7618 pst disabled
7619 !! input
7620 Shall not expand:
7621
7622 <nowiki>~~~~</nowiki>
7623
7624 <includeonly><nowiki>~~~~</nowiki></includeonly>
7625
7626 <noinclude><nowiki>~~~~</nowiki></noinclude>
7627
7628 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7629
7630 {{subst:Foo}} shall be converted to FOO
7631
7632 As well as inside noinclude/onlyinclude
7633 <noinclude>{{subst:Foo}}</noinclude>
7634 <onlyinclude>{{subst:Foo}}</onlyinclude>
7635
7636 But not inside includeonly
7637 <includeonly>{{subst:Foo}}</includeonly>
7638 !! result
7639 Shall not expand:
7640
7641 <nowiki>~~~~</nowiki>
7642
7643 <includeonly><nowiki>~~~~</nowiki></includeonly>
7644
7645 <noinclude><nowiki>~~~~</nowiki></noinclude>
7646
7647 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7648
7649 FOO shall be converted to FOO
7650
7651 As well as inside noinclude/onlyinclude
7652 <noinclude>FOO</noinclude>
7653 <onlyinclude>FOO</onlyinclude>
7654
7655 But not inside includeonly
7656 <includeonly>{{subst:Foo}}</includeonly>
7657 !! end
7658
7659 ###
7660 ### Message transform tests
7661 ###
7662 !! test
7663 message transform: magic variables
7664 !! options
7665 msg
7666 !! input
7667 {{SITENAME}}
7668 !! result
7669 MediaWiki
7670 !! end
7671
7672 !! test
7673 message transform: should not transform wiki markup
7674 !! options
7675 msg
7676 !! input
7677 ''test''
7678 !! result
7679 ''test''
7680 !! end
7681
7682 !! test
7683 message transform: <noinclude> in transcluded template (bug 4926)
7684 !! options
7685 msg
7686 !! input
7687 {{Includes}}
7688 !! result
7689 Foobar
7690 !! end
7691
7692 !! test
7693 message transform: <onlyinclude> in transcluded template (bug 4926)
7694 !! options
7695 msg
7696 !! input
7697 {{Includes2}}
7698 !! result
7699 Foo
7700 !! end
7701
7702 !! test
7703 {{#special:}} page name, known
7704 !! options
7705 msg
7706 !! input
7707 {{#special:Recentchanges}}
7708 !! result
7709 Special:RecentChanges
7710 !! end
7711
7712 !! test
7713 {{#special:}} page name with subpage, known
7714 !! options
7715 msg
7716 !! input
7717 {{#special:Recentchanges/param}}
7718 !! result
7719 Special:RecentChanges/param
7720 !! end
7721
7722 !! test
7723 {{#special:}} page name, unknown
7724 !! options
7725 msg
7726 !! input
7727 {{#special:foobar nonexistent}}
7728 !! result
7729 Special:Foobar nonexistent
7730 !! end
7731
7732 !! test
7733 {{#speciale:}} page name, known
7734 !! options
7735 msg
7736 !! input
7737 {{#speciale:Recentchanges}}
7738 !! result
7739 Special:RecentChanges
7740 !! end
7741
7742 !! test
7743 {{#speciale:}} page name with subpage, known
7744 !! options
7745 msg
7746 !! input
7747 {{#speciale:Recentchanges/param}}
7748 !! result
7749 Special:RecentChanges/param
7750 !! end
7751
7752 !! test
7753 {{#speciale:}} page name, unknown
7754 !! options
7755 msg
7756 !! input
7757 {{#speciale:foobar nonexistent}}
7758 !! result
7759 Special:Foobar_nonexistent
7760 !! end
7761
7762 ###
7763 ### Images
7764 ###
7765 !! test
7766 Simple image
7767 !! input
7768 [[Image:foobar.jpg]]
7769 !! result
7770 <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>
7771 </p>
7772 !! end
7773
7774 !! test
7775 Right-aligned image
7776 !! input
7777 [[Image:foobar.jpg|right]]
7778 !! result
7779 <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>
7780
7781 !! end
7782
7783 !! test
7784 Simple image (using File: namespace, now canonical)
7785 !! input
7786 [[File:foobar.jpg]]
7787 !! result
7788 <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>
7789 </p>
7790 !! end
7791
7792 !! test
7793 Image with caption
7794 !! input
7795 [[Image:foobar.jpg|right|Caption text]]
7796 !! result
7797 <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>
7798
7799 !! end
7800
7801 !! test
7802 Image with empty attribute
7803 !! input
7804 [[Image:foobar.jpg|right||Caption text]]
7805 !! result
7806 <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>
7807
7808 !! end
7809
7810 !! test
7811 Image with link tails
7812 !! input
7813 123[[Image:foobar.jpg]]456
7814 123[[Image:foobar.jpg|right]]456
7815 123[[Image:foobar.jpg|thumb]]456
7816 !! result
7817 <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
7818 </p>
7819 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
7820 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
7821
7822 !! end
7823
7824 !! test
7825 Image with multiple captions -- only last one is accepted
7826 !! input
7827 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7828 !! result
7829 <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>
7830
7831 !! end
7832
7833 !! test
7834 Image with width attribute at different positions
7835 !! input
7836 [[Image:foobar.jpg|200px|right|Caption]]
7837 [[Image:foobar.jpg|right|200px|Caption]]
7838 [[Image:foobar.jpg|right|Caption|200px]]
7839 !! result
7840 <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>
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
7844 !! end
7845
7846 !! test
7847 Image with link parameter, wiki target
7848 !! input
7849 [[Image:foobar.jpg|link=Target page]]
7850 !! result
7851 <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>
7852 </p>
7853 !! end
7854
7855 !! test
7856 Image with link parameter, URL target
7857 !! input
7858 [[Image:foobar.jpg|link=http://example.com/]]
7859 !! result
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Image with link parameter, wgExternalLinkTarget
7866 !! input
7867 [[Image:foobar.jpg|link=http://example.com/]]
7868 !! config
7869 wgExternalLinkTarget='foobar'
7870 !! result
7871 <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>
7872 </p>
7873 !! end
7874
7875 !! test
7876 Image with link parameter, wgNoFollowLinks set to false
7877 !! input
7878 [[Image:foobar.jpg|link=http://example.com/]]
7879 !! config
7880 wgNoFollowLinks=false
7881 !! result
7882 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7883 </p>
7884 !! end
7885
7886 !! test
7887 Image with link parameter, wgNoFollowDomainExceptions
7888 !! input
7889 [[Image:foobar.jpg|link=http://example.com/]]
7890 !! config
7891 wgNoFollowDomainExceptions='example.com'
7892 !! result
7893 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7894 </p>
7895 !! end
7896
7897 !! test
7898 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7899 !! input
7900 [[Image:foobar.jpg|link=http://example.com/|Title]]
7901 !! config
7902 wgExternalLinkTarget='foobar'
7903 !! result
7904 <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>
7905 </p>
7906 !! end
7907
7908 !! test
7909 Image with empty link parameter
7910 !! input
7911 [[Image:foobar.jpg|link=]]
7912 !! result
7913 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7914 </p>
7915 !! end
7916
7917 !! test
7918 Image with link parameter (wiki target) and unnamed parameter
7919 !! input
7920 [[Image:foobar.jpg|link=Target page|Title]]
7921 !! result
7922 <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>
7923 </p>
7924 !! end
7925
7926 !! test
7927 Image with link parameter (URL target) and unnamed parameter
7928 !! input
7929 [[Image:foobar.jpg|link=http://example.com/|Title]]
7930 !! result
7931 <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>
7932 </p>
7933 !! end
7934
7935 !! test
7936 Thumbnail image with link parameter
7937 !! options
7938 php
7939 !! input
7940 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7941 !! result
7942 <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>
7943
7944 !! end
7945
7946 !! test
7947 Manually-specified thumbnail image
7948 !! options
7949 php
7950 !! input
7951 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7952 !! result
7953 <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>
7954
7955 !! end
7956
7957 !! test
7958 Manually-specified thumbnail image with explicit link to wiki page
7959 !! options
7960 php
7961 !! input
7962 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7963 !! result
7964 <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>
7965
7966 !! end
7967
7968 !! test
7969 Manually-specified thumbnail image with explicit link to url
7970 !! options
7971 php
7972 !! input
7973 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7974 !! result
7975 <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>
7976
7977 !! end
7978
7979 !! test
7980 Manually-specified thumbnail image with explicit no link
7981 !! options
7982 php
7983 !! input
7984 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7985 !! result
7986 <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>
7987
7988 !! end
7989
7990 !! test
7991 Manually-specified thumbnail image with explicit link and alt text
7992 !! options
7993 php
7994 !! input
7995 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7996 !! result
7997 <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>
7998
7999 !! end
8000
8001 !! test
8002 Image with frame and link
8003 !! input
8004 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8005 !! result
8006 <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>
8007
8008 !! end
8009
8010 !! test
8011 Image with frame and link and explicit alt
8012 !! input
8013 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8014 !! result
8015 <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>
8016
8017 !! end
8018
8019 !! test
8020 Image with wiki markup in implicit alt
8021 !! input
8022 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8023 !! result
8024 <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>
8025 </p>
8026 !! end
8027
8028 !! test
8029 Image with wiki markup in explicit alt
8030 !! input
8031 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8032 !! result
8033 <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>
8034 </p>
8035 !! end
8036
8037 !! test
8038 Link to image page- image page normally doesn't exists, hence edit link
8039 Add test with existing image page
8040 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8041 !! input
8042 [[:Image:test]]
8043 !! result
8044 <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>
8045 </p>
8046 !! end
8047
8048 !! test
8049 bug 18784 Link to non-existent image page with caption should use caption as link text
8050 !! input
8051 [[:Image:test|caption]]
8052 !! result
8053 <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>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Frameless image caption with a free URL
8059 !! input
8060 [[Image:foobar.jpg|http://example.com]]
8061 !! result
8062 <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>
8063 </p>
8064 !! end
8065
8066 !! test
8067 Thumbnail image caption with a free URL
8068 !! input
8069 [[Image:foobar.jpg|thumb|http://example.com]]
8070 !! result
8071 <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>
8072
8073 !! end
8074
8075 !! test
8076 Thumbnail image caption with a free URL and explicit alt
8077 !! input
8078 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8079 !! result
8080 <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>
8081
8082 !! end
8083
8084 !! test
8085 SVG thumbnails with no language set
8086 !! options
8087 !! input
8088 [[File:Foobar.svg|thumb|width=200]]
8089 !! result
8090 <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>
8091
8092 !! end
8093
8094 !! test
8095 SVG thumbnails with language de
8096 !! options
8097 !! input
8098 [[File:Foobar.svg|thumb|width=200|lang=de]]
8099 !! result
8100 <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>
8101
8102 !! end
8103
8104 !! test
8105 SVG thumbnails with invalid language code
8106 !! options
8107 !! input
8108 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8109 !! result
8110 <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>
8111
8112 !! end
8113 !! test
8114 BUG 1887: A ISBN with a thumbnail
8115 !! input
8116 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8117 !! result
8118 <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>
8119
8120 !! end
8121
8122 !! test
8123 BUG 1887: A RFC with a thumbnail
8124 !! input
8125 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8126 !! result
8127 <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>
8128
8129 !! end
8130
8131 !! test
8132 BUG 1887: A mailto link with a thumbnail
8133 !! input
8134 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8135 !! result
8136 <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>
8137
8138 !! end
8139
8140 # Pending resolution to bug 368
8141 !! test
8142 BUG 648: Frameless image caption with a link
8143 !! input
8144 [[Image:foobar.jpg|text with a [[link]] in it]]
8145 !! result
8146 <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>
8147 </p>
8148 !! end
8149
8150 !! test
8151 BUG 648: Frameless image caption with a link (suffix)
8152 !! input
8153 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8154 !! result
8155 <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>
8156 </p>
8157 !! end
8158
8159 !! test
8160 BUG 648: Frameless image caption with an interwiki link
8161 !! input
8162 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8163 !! result
8164 <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>
8165 </p>
8166 !! end
8167
8168 !! test
8169 BUG 648: Frameless image caption with a piped interwiki link
8170 !! input
8171 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8172 !! result
8173 <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>
8174 </p>
8175 !! end
8176
8177 !! test
8178 Escape HTML special chars in image alt text
8179 !! input
8180 [[Image:foobar.jpg|& < > "]]
8181 !! result
8182 <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>
8183 </p>
8184 !! end
8185
8186 !! test
8187 BUG 499: Alt text should have &#1234;, not &amp;1234;
8188 !! input
8189 [[Image:foobar.jpg|&#9792;]]
8190 !! result
8191 <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>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Broken image caption with link
8197 !! input
8198 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8199 !! result
8200 <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.
8201 </p>
8202 !! end
8203
8204 !! test
8205 Image caption containing another image
8206 !! input
8207 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8208 !! result
8209 <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>
8210
8211 !! end
8212
8213 !! test
8214 Image caption containing a newline
8215 !! input
8216 [[Image:Foobar.jpg|This
8217 *is some text]]
8218 !! result
8219 <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>
8220 </p>
8221 !!end
8222
8223 !!test
8224 Parsoid: Image caption containing leading space
8225 (The leading space should not trigger nowiki escaping in wt2wt mode)
8226 !! input
8227 [[Image:Foobar.jpg|thumb| bar]]
8228 !! result
8229 <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>
8230
8231 !!end
8232
8233 !! test
8234 Bug 3090: External links other than http: in image captions
8235 !! input
8236 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8237 !! result
8238 <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>
8239
8240 !! end
8241
8242 !! test
8243 Custom class
8244 !! input
8245 [[Image:foobar.jpg|a|class=b]]
8246 !! result
8247 <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>
8248 </p>
8249 !! end
8250
8251 !! test
8252 Localized image handling (1).
8253 !! options
8254 language=es
8255 !! input
8256 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8257 !! result
8258 <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>
8259
8260 !! end
8261
8262 !! test
8263 Localized image handling (2).
8264 !! options
8265 language=es
8266 !! input
8267 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8268 !! result
8269 <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>
8270
8271 !! end
8272
8273 !! test
8274 "border", "frameless" and "class" attributes on an image.
8275 !! input
8276 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8277 !! result
8278 <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>
8279 </p>
8280 !! end
8281
8282 !! article
8283 File:Barfoo.jpg
8284 !! text
8285 #REDIRECT [[File:Barfoo.jpg]]
8286 !! endarticle
8287
8288 !! test
8289 Redirected image
8290 !! input
8291 [[Image:Barfoo.jpg]]
8292 !! result
8293 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8294 </p>
8295 !! end
8296
8297 !! test
8298 Missing image with uploads disabled
8299 !! options
8300 wgEnableUploads=0
8301 !! input
8302 [[Image:Foobaz.jpg]]
8303 !! result
8304 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8305 </p>
8306 !! end
8307
8308 # Parsoid-specific testing for images
8309 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8310 # Currently imperfect due to a flaw in the Parsoid testrunner
8311 # Work in progress
8312
8313 !! test
8314 Parsoid-specific image handling - simple image
8315 !! options
8316 parsoid
8317 !! input
8318 [[Image:Foobar.jpg]]
8319 !! result
8320 <p>
8321 <span class="mw-default-size" typeof="mw:Image">
8322 <a href="File:Foobar.jpg">
8323 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8324 </a>
8325 </span>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Parsoid-specific image handling - simple image without link
8331 !! options
8332 parsoid
8333 !! input
8334 [[Image:Foobar.jpg|link=]]
8335 !! result
8336 <p>
8337 <span class="mw-default-size" typeof="mw:Image">
8338 <span>
8339 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8340 </span>
8341 </span>
8342 </p>
8343 !! end
8344
8345 !! test
8346 Parsoid-specific image handling - simple image with specific link
8347 !! options
8348 parsoid
8349 !! input
8350 [[Image:Foobar.jpg|link=Main Page]]
8351 !! result
8352 <p>
8353 <span class="mw-default-size" typeof="mw:Image">
8354 <a href="Main_Page">
8355 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8356 </a>
8357 </span>
8358 </p>
8359 !! end
8360
8361 !! test
8362 Parsoid-specific image handling - simple image with size and middle alignment
8363 !! options
8364 parsoid
8365 !! input
8366 [[Image:Foobar.jpg|50px|middle]]
8367 !! result
8368 <p>
8369 <span class="mw-valign-middle" typeof="mw:Image">
8370 <a href="File:Foobar.jpg">
8371 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8372 </a>
8373 </span>
8374 </p>
8375 !! end
8376
8377 !! test
8378 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8379 !! options
8380 parsoid
8381 !! input
8382 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8383 !! result
8384 <p>
8385 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8386 <a href="File:Foobar.jpg">
8387 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8388 </a>
8389 </span>
8390 </p>
8391 !! end
8392
8393 !! test
8394 Parsoid-specific image handling - simple image with border and size spec
8395 !! options
8396 parsoid
8397 !! input
8398 [[Image:Foobar.jpg|50px|border|caption]]
8399 !! result
8400 <p>
8401 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8402 <a href="File:Foobar.jpg">
8403 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8404 </a>
8405 </span>
8406 </p>
8407 !! end
8408
8409 !! test
8410 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8411 !! options
8412 parsoid
8413 !! input
8414 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8415 !! result
8416 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8417 <a href="File:Foobar.jpg">
8418 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8419 </a>
8420 <figcaption>caption content</figcaption>
8421 </figure>
8422 !! end
8423
8424 !! test
8425 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8426 !! options
8427 parsoid
8428 !! input
8429 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8430 !! result
8431 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8432 <a href="File:Foobar.jpg">
8433 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8434 </a>
8435 <figcaption>caption</figcaption>
8436 </figure>
8437 !! end
8438
8439 !! test
8440 Parsoid-specific image handling - framed image with specific size and caption
8441 !! options
8442 parsoid
8443 !! input
8444 [[Image:Foobar.jpg|500x50px|frame|caption]]
8445 !! result
8446 <figure typeof="mw:Image/Frame">
8447 <a href="File:Foobar.jpg">
8448 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8449 </a>
8450 <figcaption>caption</figcaption>
8451 </figure>
8452 !! end
8453
8454 !! test
8455 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8456 !! options
8457 parsoid
8458 !! input
8459 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8460 !! result
8461 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8462 <a href="File:Foobar.jpg">
8463 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8464 </a>
8465 <figcaption>caption</figcaption>
8466 </figure>
8467 !! end
8468
8469 !! test
8470 Parsoid-specific image handling - frameless image with specific size, border, and caption
8471 !! options
8472 parsoid
8473 !! input
8474 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8475 !! result
8476 <p>
8477 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8478 <a href="File:Foobar.jpg">
8479 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8480 </a>
8481 </p>
8482 !! end
8483
8484 #!! test
8485 #Parsoid-specific image handling - simple image with a formatted caption
8486 #!! options
8487 #parsoid
8488 #!! input
8489 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8490 #!! result
8491 #<p>
8492 #<span typeof="mw:Image">
8493 #<a class="mw-default-size" href="Image:Foobar.jpg">
8494 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8495 #</a>
8496 #<span>abc</span>
8497 #</span>
8498 #</p>
8499
8500 ###
8501 ### Subpages
8502 ###
8503 !! article
8504 Subpage test/subpage
8505 !! text
8506 foo
8507 !! endarticle
8508
8509 !! test
8510 Subpage link
8511 !! options
8512 subpage title=[[Subpage test]]
8513 !! input
8514 [[/subpage]]
8515 !! result
8516 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Subpage noslash link
8522 !! options
8523 subpage title=[[Subpage test]]
8524 !!input
8525 [[/subpage/]]
8526 !! result
8527 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8528 </p>
8529 !! end
8530
8531 # TODO: make this PHP-parser compatible!
8532 !! test
8533 Relative subpage noslash link
8534 !! options
8535 parsoid=wt2wt,wt2html,html2html
8536 subpage title=[[Subpage test/1/2/3/4]]
8537 !!input
8538 [[../../subpage/]]
8539
8540 [[../../subpage]]
8541 !! result
8542 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8543 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8544 !! end
8545
8546 # TODO: make this PHP-parser compatible!
8547 !! test
8548 Parsoid: dot-slash prefixed wikilinks
8549 !! options
8550 parsoid=wt2wt,wt2html,html2html
8551 !!input
8552 [[./foo]]
8553
8554 [[././bar]]
8555
8556 [[././baz/]]
8557 !! result
8558 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8559 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8560 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8561 !! end
8562
8563 !! test
8564 Disabled subpages
8565 !! input
8566 [[/subpage]]
8567 !! result
8568 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8569 </p>
8570 !! end
8571
8572 !! test
8573 BUG 561: {{/Subpage}}
8574 !! options
8575 subpage title=[[Page]]
8576 !! input
8577 {{/Subpage}}
8578 !! result
8579 <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>
8580 </p>
8581 !! end
8582
8583 ###
8584 ### Categories
8585 ###
8586 !! article
8587 Category:MediaWiki User's Guide
8588 !! text
8589 blah
8590 !! endarticle
8591
8592 !! test
8593 Link to category
8594 !! input
8595 [[:Category:MediaWiki User's Guide]]
8596 !! result
8597 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8598 </p>
8599 !! end
8600
8601 !! test
8602 Simple category
8603 !! options
8604 cat
8605 !! input
8606 [[Category:MediaWiki User's Guide]]
8607 !! result
8608 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8609 !! end
8610
8611 !! test
8612 PAGESINCATEGORY invalid title fatal (r33546 fix)
8613 !! input
8614 {{PAGESINCATEGORY:<bogus>}}
8615 !! result
8616 <p>0
8617 </p>
8618 !! end
8619
8620 !! test
8621 Category with different sort key
8622 !! options
8623 cat
8624 !! input
8625 [[Category:MediaWiki User's Guide|Foo]]
8626 !! result
8627 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8628 !! end
8629
8630 !! test
8631 Category with identical sort key
8632 !! options
8633 cat
8634 !! input
8635 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8636 !! result
8637 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8638 !! end
8639
8640 !! test
8641 Category with empty sort key
8642 !! options
8643 cat
8644 pst
8645 !! input
8646 [[Category:MediaWiki User's Guide|]]
8647 !! result
8648 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8649 !! end
8650
8651 !! test
8652 Category with empty sort key and parentheses
8653 !! options
8654 cat
8655 pst
8656 !! input
8657 [[Category:Foo (bar)|]]
8658 !! result
8659 [[Category:Foo (bar)|Foo]]
8660 !! end
8661
8662 !! test
8663 Category with link tail
8664 !! options
8665 cat
8666 pst
8667 !! input
8668 123[[Category:Foo]]456
8669 !! result
8670 123[[Category:Foo]]456
8671 !! end
8672
8673 !! test
8674 Category with template
8675 !! options
8676 cat
8677 pst
8678 !! input
8679 [[Category:{{echo|Foo}}]]
8680 !! result
8681 [[Category:{{echo|Foo}}]]
8682 !! end
8683
8684 !! test
8685 Category with template in sort key
8686 !! options
8687 cat
8688 pst
8689 !! input
8690 [[Category:Foo|{{echo|Bar}}]]
8691 !! result
8692 [[Category:Foo|{{echo|Bar}}]]
8693 !! end
8694
8695 !! test
8696 Category with template in sort key and title
8697 !! options
8698 cat
8699 pst
8700 !! input
8701 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8702 !! result
8703 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8704 !! end
8705
8706 !! test
8707 Category / paragraph interactions
8708 !! input
8709 Foo [[Category:Baz]] Bar
8710
8711 Foo [[Category:Baz]]
8712 Bar
8713
8714 Foo
8715 [[Category:Baz]]
8716 Bar
8717
8718 Foo
8719 [[Category:Baz]] Bar
8720
8721 Foo
8722 [[Category:Baz]]
8723 [[Category:Baz]]
8724 [[Category:Baz]]
8725 Bar
8726
8727 [[Category:Baz]]
8728 [[Category:Baz]]
8729 [[Category:Baz]]
8730
8731 [[Category:Baz]]
8732 {{echo|[[Category:Baz]]}}
8733 [[Category:Baz]]
8734 !! result
8735 <p>Foo Bar
8736 </p><p>Foo
8737 Bar
8738 </p><p>Foo
8739 Bar
8740 </p><p>Foo Bar
8741 </p><p>Foo
8742 Bar
8743 </p>
8744 !! end
8745
8746 !! test
8747 Parsoid: Serialize link to category page with colon escape
8748 !! options
8749 parsoid
8750 !! input
8751
8752 [[:Category:Foo]]
8753 [[:Category:Foo|Bar]]
8754 !! result
8755 <p>
8756 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8757 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8758 </p>
8759 !! end
8760
8761 !! test
8762 Parsoid: Serialize link to file page with colon escape
8763 !! options
8764 parsoid
8765 !! input
8766
8767 [[:File:Foo.png]]
8768 [[:File:Foo.png|Bar]]
8769 !! result
8770 <p>
8771 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8772 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8773 </p>
8774 !! end
8775
8776 !! test
8777 Parsoid: Serialize a genuine category link without colon escape
8778 !! options
8779 parsoid
8780 !! input
8781 [[Category:Foo]]
8782 [[Category:Foo|Bar]]
8783 !! result
8784 <link rel="mw:WikiLink/Category" href="Category:Foo">
8785 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8786 !! end
8787 ###
8788 ### Inter-language links
8789 ###
8790 !! test
8791 Inter-language links
8792 !! options
8793 ill
8794 !! input
8795 [[es:Alimento]]
8796 [[fr:Nourriture]]
8797 [[zh:&#39135;&#21697;]]
8798 !! result
8799 es:Alimento fr:Nourriture zh:食品
8800 !! end
8801
8802 !! test
8803 Duplicate interlanguage links (bug 24502)
8804 !! options
8805 ill
8806 !! input
8807 [[es:1]]
8808 [[es:2]]
8809 [[fr:1]]
8810 [[fr:2]]
8811 !! result
8812 es:1 fr:1
8813 !! end
8814
8815 ###
8816 ### Sections
8817 ###
8818 !! test
8819 Basic section headings
8820 !! input
8821 == Headline 1 ==
8822 Some text
8823
8824 ==Headline 2==
8825 More
8826 ===Smaller headline===
8827 Blah blah
8828 !! result
8829 <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>
8830 <p>Some text
8831 </p>
8832 <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>
8833 <p>More
8834 </p>
8835 <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>
8836 <p>Blah blah
8837 </p>
8838 !! end
8839
8840 !! test
8841 Section headings with TOC
8842 !! input
8843 == Headline 1 ==
8844 === Subheadline 1 ===
8845 ===== Skipping a level =====
8846 ====== Skipping a level ======
8847
8848 == Headline 2 ==
8849 Some text
8850 ===Another headline===
8851 !! result
8852 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8853 <ul>
8854 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8855 <ul>
8856 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8857 <ul>
8858 <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>
8859 <ul>
8860 <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>
8861 </ul>
8862 </li>
8863 </ul>
8864 </li>
8865 </ul>
8866 </li>
8867 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8868 <ul>
8869 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8870 </ul>
8871 </li>
8872 </ul>
8873 </div>
8874 <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>
8875 <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>
8876 <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>
8877 <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>
8878 <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>
8879 <p>Some text
8880 </p>
8881 <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>
8882
8883 !! end
8884
8885 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8886 !! test
8887 Handling of sections up to level 6 and beyond
8888 !! input
8889 = Level 1 Heading=
8890 == Level 2 Heading==
8891 === Level 3 Heading===
8892 ==== Level 4 Heading====
8893 ===== Level 5 Heading=====
8894 ====== Level 6 Heading======
8895 ======= Level 7 Heading=======
8896 ======== Level 8 Heading========
8897 ========= Level 9 Heading=========
8898 ========== Level 10 Heading==========
8899 !! result
8900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8901 <ul>
8902 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8903 <ul>
8904 <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>
8905 <ul>
8906 <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>
8907 <ul>
8908 <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>
8909 <ul>
8910 <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>
8911 <ul>
8912 <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>
8913 <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>
8914 <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>
8915 <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>
8916 <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>
8917 </ul>
8918 </li>
8919 </ul>
8920 </li>
8921 </ul>
8922 </li>
8923 </ul>
8924 </li>
8925 </ul>
8926 </li>
8927 </ul>
8928 </div>
8929 <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>
8930 <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>
8931 <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>
8932 <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>
8933 <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>
8934 <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>
8935 <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>
8936 <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>
8937 <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>
8938 <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>
8939
8940 !! end
8941
8942 !! test
8943 TOC regression (bug 9764)
8944 !! input
8945 == title 1 ==
8946 === title 1.1 ===
8947 ==== title 1.1.1 ====
8948 === title 1.2 ===
8949 == title 2 ==
8950 === title 2.1 ===
8951 !! result
8952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8953 <ul>
8954 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8955 <ul>
8956 <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>
8957 <ul>
8958 <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>
8959 </ul>
8960 </li>
8961 <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>
8962 </ul>
8963 </li>
8964 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8965 <ul>
8966 <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>
8967 </ul>
8968 </li>
8969 </ul>
8970 </div>
8971 <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>
8972 <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>
8973 <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>
8974 <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>
8975 <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>
8976 <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>
8977
8978 !! end
8979
8980 !! test
8981 TOC with wgMaxTocLevel=3 (bug 6204)
8982 !! options
8983 wgMaxTocLevel=3
8984 !! input
8985 == title 1 ==
8986 === title 1.1 ===
8987 ==== title 1.1.1 ====
8988 === title 1.2 ===
8989 == title 2 ==
8990 === title 2.1 ===
8991 !! result
8992 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8993 <ul>
8994 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8995 <ul>
8996 <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>
8997 <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>
8998 </ul>
8999 </li>
9000 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9001 <ul>
9002 <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>
9003 </ul>
9004 </li>
9005 </ul>
9006 </div>
9007 <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>
9008 <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>
9009 <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>
9010 <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>
9011 <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>
9012 <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>
9013
9014 !! end
9015
9016 !! test
9017 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9018 !! options
9019 wgMaxTocLevel=3
9020 !! input
9021 ==Section 1==
9022 ===Section 1.1===
9023 ====Section 1.1.1====
9024 ====Section 1.1.1.1====
9025 ==Section 2==
9026 !! result
9027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9028 <ul>
9029 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9030 <ul>
9031 <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>
9032 </ul>
9033 </li>
9034 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9035 </ul>
9036 </div>
9037 <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>
9038 <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>
9039 <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>
9040 <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>
9041 <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>
9042
9043 !! end
9044
9045
9046 !! test
9047 Resolving duplicate section names
9048 !! input
9049 == Foo bar ==
9050 == Foo bar ==
9051 !! result
9052 <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>
9053 <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>
9054
9055 !! end
9056
9057 !! test
9058 Resolving duplicate section names with differing case (bug 10721)
9059 !! input
9060 == Foo bar ==
9061 == Foo Bar ==
9062 !! result
9063 <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>
9064 <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>
9065
9066 !! end
9067
9068 !! article
9069 Template:sections
9070 !! text
9071 ===Section 1===
9072 ==Section 2==
9073 !! endarticle
9074
9075 !! test
9076 Template with sections, __NOTOC__
9077 !! input
9078 __NOTOC__
9079 ==Section 0==
9080 {{sections}}
9081 ==Section 4==
9082 !! result
9083 <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>
9084 <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>
9085 <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>
9086 <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>
9087
9088 !! end
9089
9090 !! test
9091 __NOEDITSECTION__ keyword
9092 !! input
9093 __NOEDITSECTION__
9094 ==Section 1==
9095 ==Section 2==
9096 !! result
9097 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9098 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9099
9100 !! end
9101
9102 !! test
9103 Link inside a section heading
9104 !! input
9105 ==Section with a [[Main Page|link]] in it==
9106 !! result
9107 <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>
9108
9109 !! end
9110
9111 !! test
9112 TOC regression (bug 12077)
9113 !! input
9114 __TOC__
9115 == title 1 ==
9116 === title 1.1 ===
9117 == title 2 ==
9118 !! result
9119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9120 <ul>
9121 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9122 <ul>
9123 <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>
9124 </ul>
9125 </li>
9126 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9127 </ul>
9128 </div>
9129 <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>
9130 <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>
9131 <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>
9132
9133 !! end
9134
9135 !! test
9136 BUG 1219 URL next to image (good)
9137 !! input
9138 http://example.com [[Image:foobar.jpg]]
9139 !! result
9140 <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>
9141 </p>
9142 !!end
9143
9144 !! test
9145 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9146 !! input
9147 ===
9148 The line above must have a trailing space!
9149 === <!--
9150 --> <!-- -->
9151 But just in case it doesn't...
9152 !! result
9153 <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>
9154 <p>The line above must have a trailing space!
9155 </p>
9156 <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>
9157 <p>But just in case it doesn't...
9158 </p>
9159 !! end
9160
9161 !! test
9162 Header with special characters (bug 25462)
9163 !! input
9164 The tooltips shall not show entities to the user (ie. be double escaped)
9165
9166 == text > text ==
9167 section 1
9168
9169 == text < text ==
9170 section 2
9171
9172 == text & text ==
9173 section 3
9174
9175 == text ' text ==
9176 section 4
9177
9178 == text " text ==
9179 section 5
9180 !! result
9181 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9182 </p>
9183 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9184 <ul>
9185 <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>
9186 <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>
9187 <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>
9188 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9189 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9190 </ul>
9191 </div>
9192 <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>
9193 <p>section 1
9194 </p>
9195 <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>
9196 <p>section 2
9197 </p>
9198 <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>
9199 <p>section 3
9200 </p>
9201 <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>
9202 <p>section 4
9203 </p>
9204 <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>
9205 <p>section 5
9206 </p>
9207 !! end
9208
9209 !! test
9210 Headers with excess '=' characters
9211 (Are similar tests necessary beyond the 1st level?)
9212 !! input
9213 =foo==
9214 ==foo=
9215 =''italic'' heading==
9216 ==''italic'' heading=
9217 !! result
9218 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9219 <ul>
9220 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9221 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9222 <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>
9223 <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>
9224 </ul>
9225 </div>
9226 <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>
9227 <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>
9228 <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>
9229 <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>
9230
9231 !! end
9232
9233 !! test
9234 HTML headers vs TOC (bug 23393)
9235 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9236 !! input
9237 <h1>Header 1</h1>
9238 == Header 1.1 ==
9239 == Header 1.2 ==
9240
9241 <h1>Header 2
9242 </h1>
9243 == Header 2.1 ==
9244 == Header 2.2 ==
9245 __NOEDITSECTION__
9246 !! result
9247 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9248 <ul>
9249 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9250 <ul>
9251 <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>
9252 <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>
9253 </ul>
9254 </li>
9255 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9256 <ul>
9257 <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>
9258 <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>
9259 </ul>
9260 </li>
9261 </ul>
9262 </div>
9263 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9264 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9265 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9266 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9267 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9268 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9269
9270 !! end
9271
9272 !! test
9273 BUG 1219 URL next to image (broken)
9274 !! input
9275 http://example.com[[Image:foobar.jpg]]
9276 !! result
9277 <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>
9278 </p>
9279 !!end
9280
9281 !! test
9282 Bug 1186 news: in the middle of text
9283 !! input
9284 http://en.wikinews.org/wiki/Wikinews:Workplace
9285 !! result
9286 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9287 </p>
9288 !!end
9289
9290
9291 !! test
9292 Namespaced link must have a title
9293 !! input
9294 [[Project:]]
9295 !! result
9296 <p>[[Project:]]
9297 </p>
9298 !!end
9299
9300 !! test
9301 Namespaced link must have a title (bad fragment version)
9302 !! input
9303 [[Project:#fragment]]
9304 !! result
9305 <p>[[Project:#fragment]]
9306 </p>
9307 !!end
9308
9309
9310 ###
9311 ### HTML tags and HTML attributes
9312 ###
9313
9314 !! test
9315 div with no attributes
9316 !! input
9317 <div>HTML rocks</div>
9318 !! result
9319 <div>HTML rocks</div>
9320
9321 !! end
9322
9323 !! test
9324 div with double-quoted attribute
9325 !! input
9326 <div id="rock">HTML rocks</div>
9327 !! result
9328 <div id="rock">HTML rocks</div>
9329
9330 !! end
9331
9332 !! test
9333 div with single-quoted attribute
9334 !! input
9335 <div id='rock'>HTML rocks</div>
9336 !! result
9337 <div id="rock">HTML rocks</div>
9338
9339 !! end
9340
9341 !! test
9342 div with unquoted attribute
9343 !! input
9344 <div id=rock>HTML rocks</div>
9345 !! result
9346 <div id="rock">HTML rocks</div>
9347
9348 !! end
9349
9350 !! test
9351 div with illegal double attributes
9352 !! input
9353 <div id="a" id="b">HTML rocks</div>
9354 !! result
9355 <div id="b">HTML rocks</div>
9356
9357 !!end
9358
9359 # FIXME: produce empty string instead of "class" in the PHP parser, following
9360 # the HTML5 spec.
9361 !! test
9362 div with empty attribute value, space before equals
9363 !! options
9364 parsoid
9365 !! input
9366 <div class =>HTML rocks</div>
9367 !! result
9368 <div class="">HTML rocks</div>
9369
9370 !! end
9371
9372 # The PHP parser escapes the opening brace to &#123; for some reason, so
9373 # disabled this test for it.
9374 !! test
9375 div with braces in attribute value
9376 !! options
9377 parsoid
9378 !! input
9379 <div title="{}">Foo</div>
9380 !! result
9381 <div title="{}">Foo</div>
9382 !! end
9383
9384 # This it very inconsistent in the PHP parser: it returns
9385 # class="class" if there is a space between the name and the equal sign (see
9386 # 'div with empty attribute value, space before equals'), but strips the
9387 # attribute completely if the space is missing. We hope that not much content
9388 # depends on this, so are implementing the behavior below in Parsoid for
9389 # consistencies' sake. Disabled for the PHP parser.
9390 # FIXME: fix this behavior in the PHP parser?
9391 !! test
9392 div with empty attribute value, no space before equals
9393 !! options
9394 parsoid
9395 !! input
9396 <div class=>HTML rocks</div>
9397 !! result
9398 <div class="">HTML rocks</div>
9399
9400 !! end
9401
9402 !! test
9403 HTML multiple attributes correction
9404 !! input
9405 <p class="error" class="awesome">Awesome!</p>
9406 !! result
9407 <p class="awesome">Awesome!</p>
9408
9409 !!end
9410
9411 !! test
9412 Table multiple attributes correction
9413 !! input
9414 {|
9415 !+ class="error" class="awesome"| status
9416 |}
9417 !! result
9418 <table>
9419 <tr>
9420 <th class="awesome"> status
9421 </th></tr></table>
9422
9423 !!end
9424
9425 !! test
9426 DIV IN UPPERCASE
9427 !! input
9428 <DIV ID="x">HTML ROCKS</DIV>
9429 !! result
9430 <div id="x">HTML ROCKS</div>
9431
9432 !!end
9433
9434 !! test
9435 Non-ASCII pseudo-tags are rendered as text
9436 !! input
9437 <khyô>
9438 !! result
9439 <p>&lt;khyô&gt;
9440 </p>
9441 !! end
9442
9443 !! test
9444 Pseudo-tag with URL 'name' renders as url link
9445 !! input
9446 <http://example.com/>
9447 !! result
9448 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9449 </p>
9450 !! end
9451
9452 !! test
9453 text with amp in the middle of nowhere
9454 !! input
9455 Remember AT&T?
9456 !!result
9457 <p>Remember AT&amp;T?
9458 </p>
9459 !! end
9460
9461 !! test
9462 text with character entity: eacute
9463 !! input
9464 I always thought &eacute; was a cute letter.
9465 !! result
9466 <p>I always thought &#233; was a cute letter.
9467 </p>
9468 !! end
9469
9470 !! test
9471 text with entity-escaped character entity-like string: eacute
9472 !! input
9473 I always thought &amp;eacute; was a cute letter.
9474 !! result
9475 <p>I always thought &amp;eacute; was a cute letter.
9476 </p>
9477 !! end
9478
9479 !! test
9480 text with undefined character entity: xacute
9481 !! input
9482 I always thought &xacute; was a cute letter.
9483 !! result
9484 <p>I always thought &amp;xacute; was a cute letter.
9485 </p>
9486 !! end
9487
9488
9489 ###
9490 ### Media links
9491 ###
9492
9493 !! test
9494 Media link
9495 !! input
9496 [[Media:Foobar.jpg]]
9497 !! result
9498 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9499 </p>
9500 !! end
9501
9502 !! test
9503 Media link with text
9504 !! input
9505 [[Media:Foobar.jpg|A neat file to look at]]
9506 !! result
9507 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9508 </p>
9509 !! end
9510
9511 # FIXME: this is still bad HTML tag nesting
9512 !! test
9513 Media link with nasty text
9514 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9515 !! input
9516 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9517 !! result
9518 <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>
9519
9520 !! end
9521
9522 !! test
9523 Media link to nonexistent file (bug 1702)
9524 !! input
9525 [[Media:No such.jpg]]
9526 !! result
9527 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9528 </p>
9529 !! end
9530
9531 !! test
9532 Image link to nonexistent file (bug 1850 - good)
9533 !! input
9534 [[Image:No such.jpg]]
9535 !! result
9536 <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>
9537 </p>
9538 !! end
9539
9540 !! test
9541 :Image link to nonexistent file (bug 1850 - bad)
9542 !! input
9543 [[:Image:No such.jpg]]
9544 !! result
9545 <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>
9546 </p>
9547 !! end
9548
9549
9550
9551 !! test
9552 Character reference normalization in link text (bug 1938)
9553 !! input
9554 [[Main Page|this&that]]
9555 !! result
9556 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9557 </p>
9558 !!end
9559
9560 !! article
9561 אַ
9562 !! text
9563 Test for unicode normalization
9564
9565 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9566 !! endarticle
9567
9568 !! test
9569 (bug 19451) Links should refer to the normalized form.
9570 !! input
9571 [[&#xFB2E;]]
9572 [[&#x5d0;&#x5b7;]]
9573 [[&#x5d0;ַ]]
9574 [[א&#x5b7;]]
9575 [[אַ]]
9576 !! result
9577 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9578 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9579 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9580 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9581 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9582 </p>
9583 !! end
9584
9585 !! test
9586 Empty attribute crash test (bug 2067)
9587 !! input
9588 <font color="">foo</font>
9589 !! result
9590 <p><font color="">foo</font>
9591 </p>
9592 !! end
9593
9594 !! test
9595 Empty attribute crash test single-quotes (bug 2067)
9596 !! input
9597 <font color=''>foo</font>
9598 !! result
9599 <p><font color="">foo</font>
9600 </p>
9601 !! end
9602
9603 !! test
9604 Attribute test: equals, then nothing
9605 !! input
9606 <font color=>foo</font>
9607 !! result
9608 <p><font>foo</font>
9609 </p>
9610 !! end
9611
9612 !! test
9613 Attribute test: unquoted value
9614 !! input
9615 <font color=x>foo</font>
9616 !! result
9617 <p><font color="x">foo</font>
9618 </p>
9619 !! end
9620
9621 !! test
9622 Attribute test: unquoted but illegal value (hash)
9623 !! input
9624 <font color=#x>foo</font>
9625 !! result
9626 <p><font color="#x">foo</font>
9627 </p>
9628 !! end
9629
9630 !! test
9631 Attribute test: no value
9632 !! input
9633 <font color>foo</font>
9634 !! result
9635 <p><font color="color">foo</font>
9636 </p>
9637 !! end
9638
9639 !! test
9640 Bug 2095: link with three closing brackets
9641 !! input
9642 [[Main Page]]]
9643 !! result
9644 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9645 </p>
9646 !! end
9647
9648 !! test
9649 Bug 2095: link with pipe and three closing brackets
9650 !! input
9651 [[Main Page|link]]]
9652 !! result
9653 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9654 </p>
9655 !! end
9656
9657 !! test
9658 Bug 2095: link with pipe and three closing brackets, version 2
9659 !! input
9660 [[Main Page|[http://example.com/]]]
9661 !! result
9662 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9663 </p>
9664 !! end
9665
9666
9667 ###
9668 ### Safety
9669 ###
9670
9671 !! article
9672 Template:Dangerous attribute
9673 !! text
9674 " onmouseover="alert(document.cookie)
9675 !! endarticle
9676
9677 !! article
9678 Template:Dangerous style attribute
9679 !! text
9680 border-size: expression(alert(document.cookie))
9681 !! endarticle
9682
9683 !! article
9684 Template:Div style
9685 !! text
9686 <div style="float: right; {{{1}}}">Magic div</div>
9687 !! endarticle
9688
9689 !! test
9690 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9691 !! input
9692 <div title="{{test}}"></div>
9693 !! result
9694 <div title="This is a test template"></div>
9695
9696 !! end
9697
9698 !! test
9699 Bug 2304: HTML attribute safety (dangerous template; 2309)
9700 !! input
9701 <div title="{{dangerous attribute}}"></div>
9702 !! result
9703 <div title=""></div>
9704
9705 !! end
9706
9707 !! test
9708 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9709 !! input
9710 <div style="{{dangerous style attribute}}"></div>
9711 !! result
9712 <div style="/* insecure input */"></div>
9713
9714 !! end
9715
9716 !! test
9717 Bug 2304: HTML attribute safety (safe parameter; 2309)
9718 !! input
9719 {{div style|width: 200px}}
9720 !! result
9721 <div style="float: right; width: 200px">Magic div</div>
9722
9723 !! end
9724
9725 !! test
9726 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9727 !! input
9728 {{div style|width: expression(alert(document.cookie))}}
9729 !! result
9730 <div style="/* insecure input */">Magic div</div>
9731
9732 !! end
9733
9734 !! test
9735 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9736 !! input
9737 {{div style|"><script>alert(document.cookie)</script>}}
9738 !! result
9739 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9740
9741 !! end
9742
9743 !! test
9744 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9745 !! input
9746 {{div style|" ><script>alert(document.cookie)</script>}}
9747 !! result
9748 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9749
9750 !! end
9751
9752 !! test
9753 Bug 2304: HTML attribute safety (link)
9754 !! input
9755 <div title="[[Main Page]]"></div>
9756 !! result
9757 <div title="&#91;&#91;Main Page]]"></div>
9758
9759 !! end
9760
9761 !! test
9762 Bug 2304: HTML attribute safety (italics)
9763 !! input
9764 <div title="''foobar''"></div>
9765 !! result
9766 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9767
9768 !! end
9769
9770 !! test
9771 Bug 2304: HTML attribute safety (bold)
9772 !! input
9773 <div title="'''foobar'''"></div>
9774 !! result
9775 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9776
9777 !! end
9778
9779
9780 !! test
9781 Bug 2304: HTML attribute safety (ISBN)
9782 !! input
9783 <div title="ISBN 1234567890"></div>
9784 !! result
9785 <div title="&#73;SBN 1234567890"></div>
9786
9787 !! end
9788
9789 !! test
9790 Bug 2304: HTML attribute safety (RFC)
9791 !! input
9792 <div title="RFC 1234"></div>
9793 !! result
9794 <div title="&#82;FC 1234"></div>
9795
9796 !! end
9797
9798 !! test
9799 Bug 2304: HTML attribute safety (PMID)
9800 !! input
9801 <div title="PMID 1234567890"></div>
9802 !! result
9803 <div title="&#80;MID 1234567890"></div>
9804
9805 !! end
9806
9807 !! test
9808 Bug 2304: HTML attribute safety (web link)
9809 !! input
9810 <div title="http://example.com/"></div>
9811 !! result
9812 <div title="http&#58;//example.com/"></div>
9813
9814 !! end
9815
9816 !! test
9817 Bug 2304: HTML attribute safety (named web link)
9818 !! input
9819 <div title="[http://example.com/ link]"></div>
9820 !! result
9821 <div title="&#91;http&#58;//example.com/ link]"></div>
9822
9823 !! end
9824
9825 !! test
9826 Bug 3244: HTML attribute safety (extension; safe)
9827 !! input
9828 <div style="<nowiki>background:blue</nowiki>"></div>
9829 !! result
9830 <div style="background:blue"></div>
9831
9832 !! end
9833
9834 !! test
9835 Bug 3244: HTML attribute safety (extension; unsafe)
9836 !! input
9837 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9838 !! result
9839 <div style="/* insecure input */"></div>
9840
9841 !! end
9842
9843 # More MSIE fun discovered by Tom Gilder
9844
9845 !! test
9846 MSIE CSS safety test: spurious slash
9847 !! input
9848 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9849 !! result
9850 <div style="/* insecure input */">evil</div>
9851
9852 !! end
9853
9854 !! test
9855 MSIE CSS safety test: hex code
9856 !! input
9857 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9858 !! result
9859 <div style="/* insecure input */">evil</div>
9860
9861 !! end
9862
9863 !! test
9864 MSIE CSS safety test: comment in url
9865 !! input
9866 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9867 !! result
9868 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9869
9870 !! end
9871
9872 !! test
9873 MSIE CSS safety test: comment in expression
9874 !! input
9875 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9876 !! result
9877 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9878
9879 !! end
9880
9881
9882 !! test
9883 Table attribute legitimate extension
9884 !! input
9885 {|
9886 !+ style="<nowiki>color:blue</nowiki>"| status
9887 |}
9888 !! result
9889 <table>
9890 <tr>
9891 <th style="color:blue"> status
9892 </th></tr></table>
9893
9894 !!end
9895
9896 !! test
9897 Table attribute safety
9898 !! input
9899 {|
9900 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9901 |}
9902 !! result
9903 <table>
9904 <tr>
9905 <th style="/* insecure input */"> status
9906 </th></tr></table>
9907
9908 !! end
9909
9910 !! test
9911 CSS line continuation 1
9912 !! input
9913 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9914 !! result
9915 <div style="/* insecure input */"></div>
9916
9917 !! end
9918
9919 !! test
9920 CSS line continuation 2
9921 !! input
9922 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9923 !! result
9924 <div style="/* insecure input */"></div>
9925
9926 !! end
9927
9928 !! article
9929 Template:Identity
9930 !! text
9931 {{{1}}}
9932 !! endarticle
9933
9934 !! test
9935 Expansion of multi-line templates in attribute values (bug 6255)
9936 !! input
9937 <div style="background: {{identity|#00FF00}}">-</div>
9938 !! result
9939 <div style="background: #00FF00">-</div>
9940
9941 !! end
9942
9943
9944 !! test
9945 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9946 !! input
9947 <div style="background:
9948 #00FF00">-</div>
9949 !! result
9950 <div style="background: #00FF00">-</div>
9951
9952 !! end
9953
9954 !! test
9955 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9956 !! input
9957 <div style="background: &#10;#00FF00">-</div>
9958 !! result
9959 <div style="background: &#10;#00FF00">-</div>
9960
9961 !! end
9962
9963 ###
9964 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9965 ###
9966 !! test
9967 Parser hook: empty input
9968 !! input
9969 <tag></tag>
9970 !! result
9971 <pre>
9972 ''
9973 array (
9974 )
9975 </pre>
9976
9977 !! end
9978
9979 !! test
9980 Parser hook: empty input using terminated empty elements
9981 !! input
9982 <tag/>
9983 !! result
9984 <pre>
9985 NULL
9986 array (
9987 )
9988 </pre>
9989
9990 !! end
9991
9992 !! test
9993 Parser hook: empty input using terminated empty elements (space before)
9994 !! input
9995 <tag />
9996 !! result
9997 <pre>
9998 NULL
9999 array (
10000 )
10001 </pre>
10002
10003 !! end
10004
10005 !! test
10006 Parser hook: basic input
10007 !! input
10008 <tag>input</tag>
10009 !! result
10010 <pre>
10011 'input'
10012 array (
10013 )
10014 </pre>
10015
10016 !! end
10017
10018
10019 !! test
10020 Parser hook: case insensitive
10021 !! input
10022 <TAG>input</TAG>
10023 !! result
10024 <pre>
10025 'input'
10026 array (
10027 )
10028 </pre>
10029
10030 !! end
10031
10032
10033 !! test
10034 Parser hook: case insensitive, redux
10035 !! input
10036 <TaG>input</TAg>
10037 !! result
10038 <pre>
10039 'input'
10040 array (
10041 )
10042 </pre>
10043
10044 !! end
10045
10046 !! test
10047 Parser hook: nested tags
10048 !! options
10049 noxml
10050 !! input
10051 <tag><tag></tag></tag>
10052 !! result
10053 <pre>
10054 '<tag>'
10055 array (
10056 )
10057 </pre>&lt;/tag&gt;
10058
10059 !! end
10060
10061 !! test
10062 Parser hook: basic arguments
10063 !! input
10064 <tag width=200 height = "100" depth = '50' square></tag>
10065 !! result
10066 <pre>
10067 ''
10068 array (
10069 'width' => '200',
10070 'height' => '100',
10071 'depth' => '50',
10072 'square' => 'square',
10073 )
10074 </pre>
10075
10076 !! end
10077
10078 !! test
10079 Parser hook: argument containing a forward slash (bug 5344)
10080 !! input
10081 <tag filename='/tmp/bla'></tag>
10082 !! result
10083 <pre>
10084 ''
10085 array (
10086 'filename' => '/tmp/bla',
10087 )
10088 </pre>
10089
10090 !! end
10091
10092 !! test
10093 Parser hook: empty input using terminated empty elements (bug 2374)
10094 !! input
10095 <tag foo=bar/>text
10096 !! result
10097 <pre>
10098 NULL
10099 array (
10100 'foo' => 'bar',
10101 )
10102 </pre>text
10103
10104 !! end
10105
10106 # </tag> should be output literally since there is no matching tag that begins it
10107 !! test
10108 Parser hook: basic arguments using terminated empty elements (bug 2374)
10109 !! input
10110 <tag width=200 height = "100" depth = '50' square/>
10111 other stuff
10112 </tag>
10113 !! result
10114 <pre>
10115 NULL
10116 array (
10117 'width' => '200',
10118 'height' => '100',
10119 'depth' => '50',
10120 'square' => 'square',
10121 )
10122 </pre>
10123 <p>other stuff
10124 &lt;/tag&gt;
10125 </p>
10126 !! end
10127
10128 ###
10129 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10130 ###
10131
10132 !! test
10133 Parser hook: static parser hook not inside a comment
10134 !! input
10135 <statictag>hello, world</statictag>
10136 <statictag action=flush/>
10137 !! result
10138 <p>hello, world
10139 </p>
10140 !! end
10141
10142
10143 !! test
10144 Parser hook: static parser hook inside a comment
10145 !! input
10146 <!-- <statictag>hello, world</statictag> -->
10147 <statictag action=flush/>
10148 !! result
10149 <p><br />
10150 </p>
10151 !! end
10152
10153 # Nested template calls; this case was broken by Parser.php rev 1.506,
10154 # since reverted.
10155
10156 !! article
10157 Template:One-parameter
10158 !! text
10159 (My parameter is: {{{1}}})
10160 !! endarticle
10161
10162 !! article
10163 Template:Map-one-parameter
10164 !! text
10165 {{{{{1}}}|{{{2}}}}}
10166 !! endarticle
10167
10168 !! test
10169 Nested template calls
10170 !! input
10171 {{Map-one-parameter|One-parameter|param}}
10172 !! result
10173 <p>(My parameter is: param)
10174 </p>
10175 !! end
10176
10177
10178 ###
10179 ### Sanitizer
10180 ###
10181 !! test
10182 Sanitizer: Closing of open tags
10183 !! input
10184 <s></s><table></table>
10185 !! result
10186 <s></s><table></table>
10187
10188 !! end
10189
10190 !! test
10191 Sanitizer: Closing of open but not closed tags
10192 !! input
10193 <s>foo
10194 !! result
10195 <p><s>foo</s>
10196 </p>
10197 !! end
10198
10199 !! test
10200 Sanitizer: Closing of closed but not open tags
10201 !! input
10202 </s>
10203 !! result
10204 <p>&lt;/s&gt;
10205 </p>
10206 !! end
10207
10208 !! test
10209 Sanitizer: Closing of closed but not open table tags
10210 !! input
10211 Table not started</td></tr></table>
10212 !! result
10213 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10214 </p>
10215 !! end
10216
10217 !! test
10218 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10219 !! input
10220 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10221 !! result
10222 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10223 </p>
10224 !! end
10225
10226 !! test
10227 Sanitizer: Validating the contents of the id attribute (bug 4515)
10228 !! options
10229 disabled
10230 !! input
10231 <br id=9 />
10232 !! result
10233 Something, but definitely not <br id="9" />...
10234 !! end
10235
10236 !! test
10237 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10238 !! options
10239 disabled
10240 !! input
10241 <br id="foo" /><br id="foo" />
10242 !! result
10243 Something need to be done. foo-2 ?
10244 !! end
10245
10246 !! test
10247 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10248 !! input
10249 <div itemscope>
10250 <meta itemprop="hello" content="world">
10251 <meta http-equiv="refresh" content="5">
10252 <meta itemprop="hello" http-equiv="refresh" content="5">
10253 <link itemprop="hello" href="{{SERVER}}">
10254 <link rel="stylesheet" href="{{SERVER}}">
10255 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10256 </div>
10257 !! result
10258 <div itemscope="itemscope">
10259 <p> <meta itemprop="hello" content="world" />
10260 &lt;meta http-equiv="refresh" content="5"&gt;
10261 <meta itemprop="hello" content="5" />
10262 </p>
10263 <link itemprop="hello" href="http&#58;//example.org" />
10264 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10265 <link itemprop="hello" href="http&#58;//example.org" />
10266 </div>
10267
10268 !! end
10269
10270 !! test
10271 Language converter: output gets cut off unexpectedly (bug 5757)
10272 !! options
10273 language=zh
10274 !! input
10275 this bit is safe: }-
10276
10277 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10278
10279 then we get cut off here: }-
10280
10281 all additional text is vanished
10282 !! result
10283 <p>this bit is safe: }-
10284 </p><p>but if we add a conversion instance: xxx
10285 </p><p>then we get cut off here: }-
10286 </p><p>all additional text is vanished
10287 </p>
10288 !! end
10289
10290 !! test
10291 Self closed html pairs (bug 5487)
10292 !! options
10293 !! input
10294 <center><font id="bug" />Centered text</center>
10295 <div><font id="bug2" />In div text</div>
10296 !! result
10297 <center>&lt;font id="bug" /&gt;Centered text</center>
10298 <div>&lt;font id="bug2" /&gt;In div text</div>
10299
10300 !! end
10301
10302 #
10303 #
10304 #
10305
10306 !! test
10307 Punctuation: nbsp before exclamation
10308 !! input
10309 C'est grave !
10310 !! result
10311 <p>C'est grave&#160;!
10312 </p>
10313 !! end
10314
10315 !! test
10316 Punctuation: CSS !important (bug 11874)
10317 !! input
10318 <div style="width:50% !important">important</div>
10319 !! result
10320 <div style="width:50% !important">important</div>
10321
10322 !!end
10323
10324 !! test
10325 Punctuation: CSS ! important (bug 11874; with space after)
10326 !! input
10327 <div style="width:50% ! important">important</div>
10328 !! result
10329 <div style="width:50% ! important">important</div>
10330
10331 !!end
10332
10333
10334 !! test
10335 HTML bullet list, closed tags (bug 5497)
10336 !! input
10337 <ul>
10338 <li>One</li>
10339 <li>Two</li>
10340 </ul>
10341 !! result
10342 <ul>
10343 <li>One</li>
10344 <li>Two</li>
10345 </ul>
10346
10347 !! end
10348
10349 !! test
10350 HTML bullet list, unclosed tags (bug 5497)
10351 !! options
10352 disabled
10353 !! input
10354 <ul>
10355 <li>One
10356 <li>Two
10357 </ul>
10358 !! result
10359 <ul>
10360 <li>One
10361 </li><li>Two
10362 </li></ul>
10363
10364 !! end
10365
10366 !! test
10367 HTML ordered list, closed tags (bug 5497)
10368 !! input
10369 <ol>
10370 <li>One</li>
10371 <li>Two</li>
10372 </ol>
10373 !! result
10374 <ol>
10375 <li>One</li>
10376 <li>Two</li>
10377 </ol>
10378
10379 !! end
10380
10381 !! test
10382 HTML ordered list, unclosed tags (bug 5497)
10383 !! options
10384 disabled
10385 !! input
10386 <ol>
10387 <li>One
10388 <li>Two
10389 </ol>
10390 !! result
10391 <ol>
10392 <li>One
10393 </li><li>Two
10394 </li></ol>
10395
10396 !! end
10397
10398 !! test
10399 HTML nested bullet list, closed tags (bug 5497)
10400 !! input
10401 <ul>
10402 <li>One</li>
10403 <li>Two:
10404 <ul>
10405 <li>Sub-one</li>
10406 <li>Sub-two</li>
10407 </ul>
10408 </li>
10409 </ul>
10410 !! result
10411 <ul>
10412 <li>One</li>
10413 <li>Two:
10414 <ul>
10415 <li>Sub-one</li>
10416 <li>Sub-two</li>
10417 </ul>
10418 </li>
10419 </ul>
10420
10421 !! end
10422
10423 !! test
10424 HTML nested bullet list, open tags (bug 5497)
10425 !! options
10426 disabled
10427 !! input
10428 <ul>
10429 <li>One
10430 <li>Two:
10431 <ul>
10432 <li>Sub-one
10433 <li>Sub-two
10434 </ul>
10435 </ul>
10436 !! result
10437 <ul>
10438 <li>One
10439 </li><li>Two:
10440 <ul>
10441 <li>Sub-one
10442 </li><li>Sub-two
10443 </li></ul>
10444 </li></ul>
10445
10446 !! end
10447
10448 !! test
10449 HTML nested ordered list, closed tags (bug 5497)
10450 !! input
10451 <ol>
10452 <li>One</li>
10453 <li>Two:
10454 <ol>
10455 <li>Sub-one</li>
10456 <li>Sub-two</li>
10457 </ol>
10458 </li>
10459 </ol>
10460 !! result
10461 <ol>
10462 <li>One</li>
10463 <li>Two:
10464 <ol>
10465 <li>Sub-one</li>
10466 <li>Sub-two</li>
10467 </ol>
10468 </li>
10469 </ol>
10470
10471 !! end
10472
10473 !! test
10474 HTML nested ordered list, open tags (bug 5497)
10475 !! options
10476 disabled
10477 !! input
10478 <ol>
10479 <li>One
10480 <li>Two:
10481 <ol>
10482 <li>Sub-one
10483 <li>Sub-two
10484 </ol>
10485 </ol>
10486 !! result
10487 <ol>
10488 <li>One
10489 </li><li>Two:
10490 <ol>
10491 <li>Sub-one
10492 </li><li>Sub-two
10493 </li></ol>
10494 </li></ol>
10495
10496 !! end
10497
10498 !! test
10499 HTML ordered list item with parameters oddity
10500 !! input
10501 <ol><li id="fragment">One</li></ol>
10502 !! result
10503 <ol><li id="fragment">One</li></ol>
10504
10505 !! end
10506
10507 !!test
10508 bug 5918: autonumbering
10509 !! input
10510 [http://first/] [http://second] [ftp://ftp]
10511
10512 ftp://inlineftp
10513
10514 [mailto:enclosed@mail.tld With target]
10515
10516 [mailto:enclosed@mail.tld]
10517
10518 mailto:inline@mail.tld
10519 !! result
10520 <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>
10521 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10522 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10523 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10524 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10525 </p>
10526 !! end
10527
10528
10529 #
10530 # Security and HTML correctness
10531 # From Nick Jenkins' fuzz testing
10532 #
10533
10534 !! test
10535 Fuzz testing: Parser13
10536 !! input
10537 {|
10538 | http://a|
10539 !! result
10540 <table>
10541 <tr>
10542 <td>
10543 </td>
10544 </tr>
10545 </table>
10546
10547 !! end
10548
10549 !! test
10550 Fuzz testing: Parser14
10551 !! input
10552 == onmouseover= ==
10553 http://__TOC__
10554 !! result
10555 <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>
10556 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10557 <ul>
10558 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10559 </ul>
10560 </div>
10561
10562 !! end
10563
10564 !! test
10565 Fuzz testing: Parser14-table
10566 !! input
10567 ==a==
10568 {| STYLE=__TOC__
10569 !! result
10570 <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>
10571 <table style="&#95;_TOC&#95;_">
10572 <tr><td></td></tr>
10573 </table>
10574
10575 !! end
10576
10577 # Known to produce bogus xml (extra </td>)
10578 !! test
10579 Fuzz testing: Parser16
10580 !! options
10581 noxml
10582 !! input
10583 {|
10584 !https://||||||
10585 !! result
10586 <table>
10587 <tr>
10588 <th>https://</th>
10589 <th></th>
10590 <th></th>
10591 <th>
10592 </td>
10593 </tr>
10594 </table>
10595
10596 !! end
10597
10598 !! test
10599 Fuzz testing: Parser21
10600 !! input
10601 {|
10602 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10603 |
10604 !! result
10605 <table>
10606 <tr>
10607 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10608 </th>
10609 <td>
10610 </td>
10611 </tr>
10612 </table>
10613
10614 !! end
10615
10616 !! test
10617 Fuzz testing: Parser22
10618 !! input
10619 http://===r:::https://b
10620
10621 {|
10622 !!result
10623 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10624 </p>
10625 <table>
10626 <tr><td></td></tr>
10627 </table>
10628
10629 !! end
10630
10631 # Known to produce bad XML for now
10632 !! test
10633 Fuzz testing: Parser24
10634 !! options
10635 noxml
10636 !! input
10637 {|
10638 {{{|
10639 <u CLASS=
10640 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10641 <br style="onmouseover='alert(document.cookie);' " />
10642
10643 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10644 |
10645 !! result
10646 <table>
10647 {{{|
10648 <u class="&#124;">}}}} &gt;
10649 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10650
10651 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10652 <tr>
10653 <td></u>
10654 </td>
10655 </tr>
10656 </table>
10657
10658 !! end
10659
10660 # Note: the current result listed for this is not what the original one was,
10661 # but the original bug was JavaScript injection, which is fixed in any case.
10662 # It's not clear that the original result listed was any more correct than the
10663 # current one. Original result:
10664 # <p>{{{|
10665 # </p>
10666 # <li class="&#124;&#124;">
10667 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10668 !!test
10669 Fuzz testing: Parser25 (bug 6055)
10670 !! input
10671 {{{
10672 |
10673 <LI CLASS=||
10674 >
10675 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10676 !! result
10677 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10678 </p>
10679 !! end
10680
10681 !!test
10682 Fuzz testing: URL adjacent extension (with space, clean)
10683 !! options
10684 !! input
10685 http://example.com <nowiki>junk</nowiki>
10686 !! result
10687 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10688 </p>
10689 !!end
10690
10691 !!test
10692 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10693 !! options
10694 !! input
10695 http://example.com<nowiki>junk</nowiki>
10696 !! result
10697 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10698 </p>
10699 !!end
10700
10701 !!test
10702 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10703 !! options
10704 !! input
10705 http://example.com<pre>junk</pre>
10706 !! result
10707 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10708
10709 !!end
10710
10711 !!test
10712 Fuzz testing: image with bogus manual thumbnail
10713 !!input
10714 [[Image:foobar.jpg|thumbnail= ]]
10715 !!result
10716 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10717
10718 !!end
10719
10720 !! test
10721 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10722 !! input
10723 <pre dir="&#10;"></pre>
10724 !! result
10725 <pre dir="&#10;"></pre>
10726
10727 !! end
10728
10729 !! test
10730 Parsing optional HTML elements (Bug 6171)
10731 !! options
10732 !! input
10733 <table>
10734 <tr>
10735 <td> Some tabular data</td>
10736 <td> More tabular data ...
10737 <td> And yet som tabular data</td>
10738 </tr>
10739 </table>
10740 !! result
10741 <table>
10742 <tr>
10743 <td> Some tabular data</td>
10744 <td> More tabular data ...
10745 </td><td> And yet som tabular data</td>
10746 </tr>
10747 </table>
10748
10749 !! end
10750
10751 !! test
10752 Correct handling of <td>, <tr> (Bug 6171)
10753 !! options
10754 !! input
10755 <table>
10756 <tr>
10757 <td> Some tabular data</td>
10758 <td> More tabular data ...</td>
10759 <td> And yet som tabular data</td>
10760 </tr>
10761 </table>
10762 !! result
10763 <table>
10764 <tr>
10765 <td> Some tabular data</td>
10766 <td> More tabular data ...</td>
10767 <td> And yet som tabular data</td>
10768 </tr>
10769 </table>
10770
10771 !! end
10772
10773
10774 !! test
10775 Parsing crashing regression (fr:JavaScript)
10776 !! input
10777 </body></x>
10778 !! result
10779 <p>&lt;/body&gt;&lt;/x&gt;
10780 </p>
10781 !! end
10782
10783 !! test
10784 Inline wiki vs wiki block nesting
10785 !! input
10786 '''Bold paragraph
10787
10788 New wiki paragraph
10789 !! result
10790 <p><b>Bold paragraph</b>
10791 </p><p>New wiki paragraph
10792 </p>
10793 !! end
10794
10795 !! test
10796 Inline HTML vs wiki block nesting
10797 !! options
10798 disabled
10799 !! input
10800 <b>Bold paragraph
10801
10802 New wiki paragraph
10803 !! result
10804 <p><b>Bold paragraph</b>
10805 </p><p>New wiki paragraph
10806 </p>
10807 !! end
10808
10809 # Original result was this:
10810 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10811 # </p>
10812 # While that might be marginally more intuitive, maybe, the six-apostrophe
10813 # construct is clearly pathological and the result stated here (which is what
10814 # the parser actually does) is about as reasonable as anything.
10815 !!test
10816 Mixing markup for italics and bold
10817 !! options
10818 !! input
10819 '''bold''''''bold''bolditalics'''''
10820 !! result
10821 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10822 </p>
10823 !! end
10824
10825
10826 !! article
10827 Xyzzyx
10828 !! text
10829 Article for special page transclusion test
10830 !! endarticle
10831
10832 !! test
10833 Special page transclusion
10834 !! options
10835 !! input
10836 {{Special:Prefixindex/Xyzzyx}}
10837 !! result
10838 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10839
10840 !! end
10841
10842 !! test
10843 Special page transclusion twice (bug 5021)
10844 !! options
10845 !! input
10846 {{Special:Prefixindex/Xyzzyx}}
10847 {{Special:Prefixindex/Xyzzyx}}
10848 !! result
10849 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10850 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10851
10852 !! end
10853
10854 !! test
10855 Transclusion of default MediaWiki message
10856 !! input
10857 {{MediaWiki:Mainpage}}
10858 !!result
10859 <p>Main Page
10860 </p>
10861 !! end
10862
10863 !! test
10864 Transclusion of nonexistent MediaWiki message
10865 !! input
10866 {{MediaWiki:Mainpagexxx}}
10867 !!result
10868 <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>
10869 </p>
10870 !! end
10871
10872 !! test
10873 Transclusion of MediaWiki message with underscore
10874 !! input
10875 {{MediaWiki:history_short}}
10876 !! result
10877 <p>History
10878 </p>
10879 !! end
10880
10881 !! test
10882 Transclusion of MediaWiki message with space
10883 !! input
10884 {{MediaWiki:history short}}
10885 !! result
10886 <p>History
10887 </p>
10888 !! end
10889
10890 !! test
10891 Invalid header with following text
10892 !! input
10893 = x = y
10894 !! result
10895 <p>= x = y
10896 </p>
10897 !! end
10898
10899
10900 !! test
10901 Section extraction test (section 0)
10902 !! options
10903 section=0
10904 !! input
10905 start
10906 ==a==
10907 ===aa===
10908 ====aaa====
10909 ==b==
10910 ===ba===
10911 ===bb===
10912 ====bba====
10913 ===bc===
10914 ==c==
10915 ===ca===
10916 !! result
10917 start
10918 !! end
10919
10920 !! test
10921 Section extraction test (section 1)
10922 !! options
10923 section=1
10924 !! input
10925 start
10926 ==a==
10927 ===aa===
10928 ====aaa====
10929 ==b==
10930 ===ba===
10931 ===bb===
10932 ====bba====
10933 ===bc===
10934 ==c==
10935 ===ca===
10936 !! result
10937 ==a==
10938 ===aa===
10939 ====aaa====
10940 !! end
10941
10942 !! test
10943 Section extraction test (section 2)
10944 !! options
10945 section=2
10946 !! input
10947 start
10948 ==a==
10949 ===aa===
10950 ====aaa====
10951 ==b==
10952 ===ba===
10953 ===bb===
10954 ====bba====
10955 ===bc===
10956 ==c==
10957 ===ca===
10958 !! result
10959 ===aa===
10960 ====aaa====
10961 !! end
10962
10963 !! test
10964 Section extraction test (section 3)
10965 !! options
10966 section=3
10967 !! input
10968 start
10969 ==a==
10970 ===aa===
10971 ====aaa====
10972 ==b==
10973 ===ba===
10974 ===bb===
10975 ====bba====
10976 ===bc===
10977 ==c==
10978 ===ca===
10979 !! result
10980 ====aaa====
10981 !! end
10982
10983 !! test
10984 Section extraction test (section 4)
10985 !! options
10986 section=4
10987 !! input
10988 start
10989 ==a==
10990 ===aa===
10991 ====aaa====
10992 ==b==
10993 ===ba===
10994 ===bb===
10995 ====bba====
10996 ===bc===
10997 ==c==
10998 ===ca===
10999 !! result
11000 ==b==
11001 ===ba===
11002 ===bb===
11003 ====bba====
11004 ===bc===
11005 !! end
11006
11007 !! test
11008 Section extraction test (section 5)
11009 !! options
11010 section=5
11011 !! input
11012 start
11013 ==a==
11014 ===aa===
11015 ====aaa====
11016 ==b==
11017 ===ba===
11018 ===bb===
11019 ====bba====
11020 ===bc===
11021 ==c==
11022 ===ca===
11023 !! result
11024 ===ba===
11025 !! end
11026
11027 !! test
11028 Section extraction test (section 6)
11029 !! options
11030 section=6
11031 !! input
11032 start
11033 ==a==
11034 ===aa===
11035 ====aaa====
11036 ==b==
11037 ===ba===
11038 ===bb===
11039 ====bba====
11040 ===bc===
11041 ==c==
11042 ===ca===
11043 !! result
11044 ===bb===
11045 ====bba====
11046 !! end
11047
11048 !! test
11049 Section extraction test (section 7)
11050 !! options
11051 section=7
11052 !! input
11053 start
11054 ==a==
11055 ===aa===
11056 ====aaa====
11057 ==b==
11058 ===ba===
11059 ===bb===
11060 ====bba====
11061 ===bc===
11062 ==c==
11063 ===ca===
11064 !! result
11065 ====bba====
11066 !! end
11067
11068 !! test
11069 Section extraction test (section 8)
11070 !! options
11071 section=8
11072 !! input
11073 start
11074 ==a==
11075 ===aa===
11076 ====aaa====
11077 ==b==
11078 ===ba===
11079 ===bb===
11080 ====bba====
11081 ===bc===
11082 ==c==
11083 ===ca===
11084 !! result
11085 ===bc===
11086 !! end
11087
11088 !! test
11089 Section extraction test (section 9)
11090 !! options
11091 section=9
11092 !! input
11093 start
11094 ==a==
11095 ===aa===
11096 ====aaa====
11097 ==b==
11098 ===ba===
11099 ===bb===
11100 ====bba====
11101 ===bc===
11102 ==c==
11103 ===ca===
11104 !! result
11105 ==c==
11106 ===ca===
11107 !! end
11108
11109 !! test
11110 Section extraction test (section 10)
11111 !! options
11112 section=10
11113 !! input
11114 start
11115 ==a==
11116 ===aa===
11117 ====aaa====
11118 ==b==
11119 ===ba===
11120 ===bb===
11121 ====bba====
11122 ===bc===
11123 ==c==
11124 ===ca===
11125 !! result
11126 ===ca===
11127 !! end
11128
11129 !! test
11130 Section extraction test (nonexistent section 11)
11131 !! options
11132 section=11
11133 !! input
11134 start
11135 ==a==
11136 ===aa===
11137 ====aaa====
11138 ==b==
11139 ===ba===
11140 ===bb===
11141 ====bba====
11142 ===bc===
11143 ==c==
11144 ===ca===
11145 !! result
11146 !! end
11147
11148 !! test
11149 Section extraction test with bogus heading (section 1)
11150 !! options
11151 section=1
11152 !! input
11153 ==a==
11154 ==bogus== not a legal section
11155 ==b==
11156 !! result
11157 ==a==
11158 ==bogus== not a legal section
11159 !! end
11160
11161 !! test
11162 Section extraction test with bogus heading (section 2)
11163 !! options
11164 section=2
11165 !! input
11166 ==a==
11167 ==bogus== not a legal section
11168 ==b==
11169 !! result
11170 ==b==
11171 !! end
11172
11173 !! test
11174 Section extraction test with comment after heading (section 1)
11175 !! options
11176 section=1
11177 !! input
11178 ==a==
11179 ==b== <!-- -->
11180 ==c==
11181 !! result
11182 ==a==
11183 !! end
11184
11185 !! test
11186 Section extraction test with comment after heading (section 2)
11187 !! options
11188 section=2
11189 !! input
11190 ==a==
11191 ==b== <!-- -->
11192 ==c==
11193 !! result
11194 ==b== <!-- -->
11195 !! end
11196
11197 !! test
11198 Section extraction test with bogus <nowiki> heading (section 1)
11199 !! options
11200 section=1
11201 !! input
11202 ==a==
11203 ==bogus== <nowiki>not a legal section</nowiki>
11204 ==b==
11205 !! result
11206 ==a==
11207 ==bogus== <nowiki>not a legal section</nowiki>
11208 !! end
11209
11210 !! test
11211 Section extraction test with bogus <nowiki> heading (section 2)
11212 !! options
11213 section=2
11214 !! input
11215 ==a==
11216 ==bogus== <nowiki>not a legal section</nowiki>
11217 ==b==
11218 !! result
11219 ==b==
11220 !! end
11221
11222
11223 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11224 # instead of respecting commented sections
11225 !! test
11226 Section extraction prefixed by comment (section 1)
11227 !! options
11228 section=1
11229 !! input
11230 <!-- -->==sec1==
11231 ==sec2==
11232 !!result
11233 ==sec2==
11234 !!end
11235
11236 !! test
11237 Section extraction prefixed by comment (section 2)
11238 !! options
11239 section=2
11240 !! input
11241 <!-- -->==sec1==
11242 ==sec2==
11243 !!result
11244
11245 !!end
11246
11247
11248 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11249 # instead of respecting HTML-style headings
11250 !! test
11251 Section extraction, mixed wiki and html (section 1)
11252 !! options
11253 section=1
11254 !! input
11255 <h2>unmarked</h2>
11256 unmarked
11257 ==1==
11258 one
11259 ==2==
11260 two
11261 !! result
11262 ==1==
11263 one
11264 !! end
11265
11266 !! test
11267 Section extraction, mixed wiki and html (section 2)
11268 !! options
11269 section=2
11270 !! input
11271 <h2>unmarked</h2>
11272 unmarked
11273 ==1==
11274 one
11275 ==2==
11276 two
11277 !! result
11278 ==2==
11279 two
11280 !! end
11281
11282
11283 # Formerly testing for bug 3342
11284 !! test
11285 Section extraction, heading surrounded by <noinclude>
11286 !! options
11287 section=1
11288 !! input
11289 <noinclude>==unmarked==</noinclude>
11290 ==marked==
11291 !! result
11292 ==marked==
11293 !!end
11294
11295 # Test behavior of bug 19910
11296 !! test
11297 Sectiion with all-equals
11298 !! options
11299 section=2
11300 !! input
11301 ===
11302 The line above must have a trailing space
11303 === <!--
11304 --> <!-- -->
11305 But just in case it doesn't...
11306 !! result
11307 === <!--
11308 --> <!-- -->
11309 But just in case it doesn't...
11310 !! end
11311
11312 !! test
11313 Section replacement test (section 0)
11314 !! options
11315 replace=0,"xxx"
11316 !! input
11317 start
11318 ==a==
11319 ===aa===
11320 ====aaa====
11321 ==b==
11322 ===ba===
11323 ===bb===
11324 ====bba====
11325 ===bc===
11326 ==c==
11327 ===ca===
11328 !! result
11329 xxx
11330
11331 ==a==
11332 ===aa===
11333 ====aaa====
11334 ==b==
11335 ===ba===
11336 ===bb===
11337 ====bba====
11338 ===bc===
11339 ==c==
11340 ===ca===
11341 !! end
11342
11343 !! test
11344 Section replacement test (section 1)
11345 !! options
11346 replace=1,"xxx"
11347 !! input
11348 start
11349 ==a==
11350 ===aa===
11351 ====aaa====
11352 ==b==
11353 ===ba===
11354 ===bb===
11355 ====bba====
11356 ===bc===
11357 ==c==
11358 ===ca===
11359 !! result
11360 start
11361 xxx
11362
11363 ==b==
11364 ===ba===
11365 ===bb===
11366 ====bba====
11367 ===bc===
11368 ==c==
11369 ===ca===
11370 !! end
11371
11372 !! test
11373 Section replacement test (section 2)
11374 !! options
11375 replace=2,"xxx"
11376 !! input
11377 start
11378 ==a==
11379 ===aa===
11380 ====aaa====
11381 ==b==
11382 ===ba===
11383 ===bb===
11384 ====bba====
11385 ===bc===
11386 ==c==
11387 ===ca===
11388 !! result
11389 start
11390 ==a==
11391 xxx
11392
11393 ==b==
11394 ===ba===
11395 ===bb===
11396 ====bba====
11397 ===bc===
11398 ==c==
11399 ===ca===
11400 !! end
11401
11402 !! test
11403 Section replacement test (section 3)
11404 !! options
11405 replace=3,"xxx"
11406 !! input
11407 start
11408 ==a==
11409 ===aa===
11410 ====aaa====
11411 ==b==
11412 ===ba===
11413 ===bb===
11414 ====bba====
11415 ===bc===
11416 ==c==
11417 ===ca===
11418 !! result
11419 start
11420 ==a==
11421 ===aa===
11422 xxx
11423
11424 ==b==
11425 ===ba===
11426 ===bb===
11427 ====bba====
11428 ===bc===
11429 ==c==
11430 ===ca===
11431 !! end
11432
11433 !! test
11434 Section replacement test (section 4)
11435 !! options
11436 replace=4,"xxx"
11437 !! input
11438 start
11439 ==a==
11440 ===aa===
11441 ====aaa====
11442 ==b==
11443 ===ba===
11444 ===bb===
11445 ====bba====
11446 ===bc===
11447 ==c==
11448 ===ca===
11449 !! result
11450 start
11451 ==a==
11452 ===aa===
11453 ====aaa====
11454 xxx
11455
11456 ==c==
11457 ===ca===
11458 !! end
11459
11460 !! test
11461 Section replacement test (section 5)
11462 !! options
11463 replace=5,"xxx"
11464 !! input
11465 start
11466 ==a==
11467 ===aa===
11468 ====aaa====
11469 ==b==
11470 ===ba===
11471 ===bb===
11472 ====bba====
11473 ===bc===
11474 ==c==
11475 ===ca===
11476 !! result
11477 start
11478 ==a==
11479 ===aa===
11480 ====aaa====
11481 ==b==
11482 xxx
11483
11484 ===bb===
11485 ====bba====
11486 ===bc===
11487 ==c==
11488 ===ca===
11489 !! end
11490
11491 !! test
11492 Section replacement test (section 6)
11493 !! options
11494 replace=6,"xxx"
11495 !! input
11496 start
11497 ==a==
11498 ===aa===
11499 ====aaa====
11500 ==b==
11501 ===ba===
11502 ===bb===
11503 ====bba====
11504 ===bc===
11505 ==c==
11506 ===ca===
11507 !! result
11508 start
11509 ==a==
11510 ===aa===
11511 ====aaa====
11512 ==b==
11513 ===ba===
11514 xxx
11515
11516 ===bc===
11517 ==c==
11518 ===ca===
11519 !! end
11520
11521 !! test
11522 Section replacement test (section 7)
11523 !! options
11524 replace=7,"xxx"
11525 !! input
11526 start
11527 ==a==
11528 ===aa===
11529 ====aaa====
11530 ==b==
11531 ===ba===
11532 ===bb===
11533 ====bba====
11534 ===bc===
11535 ==c==
11536 ===ca===
11537 !! result
11538 start
11539 ==a==
11540 ===aa===
11541 ====aaa====
11542 ==b==
11543 ===ba===
11544 ===bb===
11545 xxx
11546
11547 ===bc===
11548 ==c==
11549 ===ca===
11550 !! end
11551
11552 !! test
11553 Section replacement test (section 8)
11554 !! options
11555 replace=8,"xxx"
11556 !! input
11557 start
11558 ==a==
11559 ===aa===
11560 ====aaa====
11561 ==b==
11562 ===ba===
11563 ===bb===
11564 ====bba====
11565 ===bc===
11566 ==c==
11567 ===ca===
11568 !! result
11569 start
11570 ==a==
11571 ===aa===
11572 ====aaa====
11573 ==b==
11574 ===ba===
11575 ===bb===
11576 ====bba====
11577 xxx
11578
11579 ==c==
11580 ===ca===
11581 !!end
11582
11583 !! test
11584 Section replacement test (section 9)
11585 !! options
11586 replace=9,"xxx"
11587 !! input
11588 start
11589 ==a==
11590 ===aa===
11591 ====aaa====
11592 ==b==
11593 ===ba===
11594 ===bb===
11595 ====bba====
11596 ===bc===
11597 ==c==
11598 ===ca===
11599 !! result
11600 start
11601 ==a==
11602 ===aa===
11603 ====aaa====
11604 ==b==
11605 ===ba===
11606 ===bb===
11607 ====bba====
11608 ===bc===
11609 xxx
11610 !! end
11611
11612 !! test
11613 Section replacement test (section 10)
11614 !! options
11615 replace=10,"xxx"
11616 !! input
11617 start
11618 ==a==
11619 ===aa===
11620 ====aaa====
11621 ==b==
11622 ===ba===
11623 ===bb===
11624 ====bba====
11625 ===bc===
11626 ==c==
11627 ===ca===
11628 !! result
11629 start
11630 ==a==
11631 ===aa===
11632 ====aaa====
11633 ==b==
11634 ===ba===
11635 ===bb===
11636 ====bba====
11637 ===bc===
11638 ==c==
11639 xxx
11640 !! end
11641
11642 !! test
11643 Section replacement test with initial whitespace (bug 13728)
11644 !! options
11645 replace=2,"xxx"
11646 !! input
11647 Preformatted initial line
11648 ==a==
11649 ===a===
11650 !! result
11651 Preformatted initial line
11652 ==a==
11653 xxx
11654 !! end
11655
11656
11657 !! test
11658 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11659 !! options
11660 section=1
11661 !! input
11662 ==a==
11663 a
11664 !! result
11665 ==a==
11666 a
11667 !! end
11668
11669 !! test
11670 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11671 !! options
11672 section=1
11673 !! input
11674 ==a==
11675 a
11676 !! result
11677 ==a==
11678 a
11679 !! end
11680
11681
11682 !! test
11683 Section extraction, <pre> around bogus header (bug 10309)
11684 !! options
11685 noxml section=2
11686 !! input
11687 == Section One ==
11688 <pre>
11689 =======
11690 </pre>
11691
11692 == Section Two ==
11693 stuff
11694 !! result
11695 == Section Two ==
11696 stuff
11697 !! end
11698
11699 !! test
11700 Section replacement, <pre> around bogus header (bug 10309)
11701 !! options
11702 noxml replace=2,"xxx"
11703 !! input
11704 == Section One ==
11705 <pre>
11706 =======
11707 </pre>
11708
11709 == Section Two ==
11710 stuff
11711 !! result
11712 == Section One ==
11713 <pre>
11714 =======
11715 </pre>
11716
11717 xxx
11718 !! end
11719
11720
11721
11722 !! test
11723 Handling of &#x0A; in URLs
11724 !! input
11725 **irc://&#x0A;a
11726 !! result
11727 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11728 </li></ul>
11729 </li></ul>
11730
11731 !!end
11732
11733 !! test
11734 5 quotes, code coverage +1 line (php)
11735 !! options
11736 php
11737 !! input
11738 '''''
11739 !! result
11740 !! end
11741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11742 !! test
11743 5 quotes, code coverage +1 line (parsoid)
11744 !! options
11745 parsoid
11746 !! input
11747 '''''
11748 !! result
11749 <p><i><b></b></i></p>
11750 !! end
11751
11752 !! test
11753 Special:Search page linking.
11754 !! input
11755 {{Special:search}}
11756 !! result
11757 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11758 </p>
11759 !! end
11760
11761 !! test
11762 Say the magic word
11763 !! input
11764 * {{PAGENAME}}
11765 * {{BASEPAGENAME}}
11766 * {{SUBPAGENAME}}
11767 * {{SUBPAGENAMEE}}
11768 * {{ROOTPAGENAME}}
11769 * {{ROOTPAGENAMEE}}
11770 * {{BASEPAGENAME}}
11771 * {{BASEPAGENAMEE}}
11772 * {{TALKPAGENAME}}
11773 * {{TALKPAGENAMEE}}
11774 * {{SUBJECTPAGENAME}}
11775 * {{SUBJECTPAGENAMEE}}
11776 * {{NAMESPACEE}}
11777 * {{NAMESPACE}}
11778 * {{TALKSPACE}}
11779 * {{TALKSPACEE}}
11780 * {{SUBJECTSPACE}}
11781 * {{SUBJECTSPACEE}}
11782 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11783 !! result
11784 <ul><li> Parser test
11785 </li><li> Parser test
11786 </li><li> Parser test
11787 </li><li> Parser_test
11788 </li><li> Parser test
11789 </li><li> Parser_test
11790 </li><li> Parser test
11791 </li><li> Parser_test
11792 </li><li> Talk:Parser test
11793 </li><li> Talk:Parser_test
11794 </li><li> Parser test
11795 </li><li> Parser_test
11796 </li><li>
11797 </li><li>
11798 </li><li> Talk
11799 </li><li> Talk
11800 </li><li>
11801 </li><li>
11802 </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>
11803 </li></ul>
11804
11805 !! end
11806 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11807
11808 !! test
11809 Gallery
11810 !! input
11811 <gallery>
11812 image1.png |
11813 image2.gif|||||
11814
11815 image3|
11816 image4 |300px| centre
11817 image5.svg| http://///////
11818 [[x|xx]]]]
11819 * image6
11820 </gallery>
11821 !! result
11822 <ul class="gallery">
11823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11824 <div style="height: 150px;">Image1.png</div>
11825 <div class="gallerytext">
11826 </div>
11827 </div></li>
11828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11829 <div style="height: 150px;">Image2.gif</div>
11830 <div class="gallerytext">
11831 <p>||||
11832 </p>
11833 </div>
11834 </div></li>
11835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11836 <div style="height: 150px;">Image3</div>
11837 <div class="gallerytext">
11838 </div>
11839 </div></li>
11840 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11841 <div style="height: 150px;">Image4</div>
11842 <div class="gallerytext">
11843 <p>300px| centre
11844 </p>
11845 </div>
11846 </div></li>
11847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11848 <div style="height: 150px;">Image5.svg</div>
11849 <div class="gallerytext">
11850 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11851 </p>
11852 </div>
11853 </div></li>
11854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11855 <div style="height: 150px;">* image6</div>
11856 <div class="gallerytext">
11857 </div>
11858 </div></li>
11859 </ul>
11860
11861 !! end
11862
11863 !! test
11864 Gallery (with options)
11865 !! input
11866 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11867 File:Nonexistant.jpg|caption
11868 File:Nonexistant.jpg
11869 image:foobar.jpg|some '''caption''' [[Main Page]]
11870 image:foobar.jpg
11871 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11872 </gallery>
11873 !! result
11874 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11875 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11876 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11877 <div style="height: 70px;">Nonexistant.jpg</div>
11878 <div class="gallerytext">
11879 <p>caption
11880 </p>
11881 </div>
11882 </div></li>
11883 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11884 <div style="height: 70px;">Nonexistant.jpg</div>
11885 <div class="gallerytext">
11886 </div>
11887 </div></li>
11888 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11889 <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>
11890 <div class="gallerytext">
11891 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11892 </p>
11893 </div>
11894 </div></li>
11895 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11896 <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>
11897 <div class="gallerytext">
11898 </div>
11899 </div></li>
11900 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11901 <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>
11902 <div class="gallerytext">
11903 <p>Blabla|blabla.
11904 </p>
11905 </div>
11906 </div></li>
11907 </ul>
11908
11909 !! end
11910
11911 !! test
11912 Gallery with wikitext inside caption
11913 !! input
11914 <gallery>
11915 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11916 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11917 </gallery>
11918 !! result
11919 <ul class="gallery">
11920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11921 <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>
11922 <div class="gallerytext">
11923 <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>
11924 </p>
11925 </div>
11926 </div></li>
11927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11928 <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>
11929 <div class="gallerytext">
11930 <p>This is a test template
11931 </p>
11932 </div>
11933 </div></li>
11934 </ul>
11935
11936 !! end
11937
11938 !! test
11939 gallery (with showfilename option)
11940 !! input
11941 <gallery showfilename>
11942 File:Nonexistant.jpg|caption
11943 File:Nonexistant.jpg
11944 image:foobar.jpg|some '''caption''' [[Main Page]]
11945 File:Foobar.jpg
11946 </gallery>
11947 !! result
11948 <ul class="gallery">
11949 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11950 <div style="height: 150px;">Nonexistant.jpg</div>
11951 <div class="gallerytext">
11952 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11953 caption
11954 </p>
11955 </div>
11956 </div></li>
11957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11958 <div style="height: 150px;">Nonexistant.jpg</div>
11959 <div class="gallerytext">
11960 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11961 </p>
11962 </div>
11963 </div></li>
11964 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11965 <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>
11966 <div class="gallerytext">
11967 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11968 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11969 </p>
11970 </div>
11971 </div></li>
11972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11973 <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>
11974 <div class="gallerytext">
11975 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11976 </p>
11977 </div>
11978 </div></li>
11979 </ul>
11980
11981 !! end
11982
11983 !! test
11984 Gallery (with namespace-less filenames)
11985 !! input
11986 <gallery>
11987 File:Nonexistant.jpg
11988 Nonexistant.jpg
11989 image:foobar.jpg
11990 foobar.jpg
11991 </gallery>
11992 !! result
11993 <ul class="gallery">
11994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11995 <div style="height: 150px;">Nonexistant.jpg</div>
11996 <div class="gallerytext">
11997 </div>
11998 </div></li>
11999 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12000 <div style="height: 150px;">Nonexistant.jpg</div>
12001 <div class="gallerytext">
12002 </div>
12003 </div></li>
12004 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12005 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
12006 <div class="gallerytext">
12007 </div>
12008 </div></li>
12009 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12010 <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>
12011 <div class="gallerytext">
12012 </div>
12013 </div></li>
12014 </ul>
12015
12016 !! end
12017
12018 !! test
12019 HTML Hex character encoding (spells the word "JavaScript")
12020 !! input
12021 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12022 !! result
12023 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12024 </p>
12025 !! end
12026
12027 !! test
12028 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12029 !! input
12030 &#xsee;&#XSEE;
12031 !! result
12032 <p>&amp;#xsee;&amp;#XSEE;
12033 </p>
12034 !! end
12035
12036 !! test
12037 HTML Hex character encoding mixed case
12038 !! input
12039 &#xEE;&#Xee;
12040 !! result
12041 <p>&#xee;&#xee;
12042 </p>
12043 !! end
12044
12045 !! test
12046 __FORCETOC__ override
12047 !! input
12048 __NEWSECTIONLINK__
12049 __FORCETOC__
12050 !! result
12051 <p><br />
12052 </p>
12053 !! end
12054
12055 !! test
12056 ISBN code coverage
12057 !! input
12058 ISBN 978-0-1234-56&#x20;789
12059 !! result
12060 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12061 </p>
12062 !! end
12063
12064 !! test
12065 ISBN followed by 5 spaces
12066 !! input
12067 ISBN
12068 !! result
12069 <p>ISBN
12070 </p>
12071 !! end
12072
12073 !! test
12074 Double ISBN
12075 !! input
12076 ISBN ISBN 1234567890
12077 !! result
12078 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12079 </p>
12080 !! end
12081
12082 !! test
12083 Bug 22905: <abbr> followed by ISBN followed by </a>
12084 !! input
12085 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12086 !! result
12087 <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>
12088 </p>
12089 !! end
12090
12091 !! test
12092 Double RFC
12093 !! input
12094 RFC RFC 1234
12095 !! result
12096 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12097 </p>
12098 !! end
12099
12100 !! test
12101 Double RFC with a wiki link
12102 !! input
12103 RFC [[RFC 1234]]
12104 !! result
12105 <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>
12106 </p>
12107 !! end
12108
12109 !! test
12110 RFC code coverage
12111 !! input
12112 RFC 983&#x20;987
12113 !! result
12114 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12115 </p>
12116 !! end
12117
12118 !! test
12119 Centre-aligned image
12120 !! input
12121 [[Image:foobar.jpg|centre]]
12122 !! result
12123 <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>
12124
12125 !!end
12126
12127 !! test
12128 None-aligned image
12129 !! input
12130 [[Image:foobar.jpg|none]]
12131 !! result
12132 <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>
12133
12134 !!end
12135
12136 !! test
12137 Width + Height sized image (using px) (height is ignored)
12138 !! input
12139 [[Image:foobar.jpg|640x480px]]
12140 !! result
12141 <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>
12142 </p>
12143 !!end
12144
12145 !! test
12146 Width-sized image (using px, no following whitespace)
12147 !! input
12148 [[Image:foobar.jpg|640px]]
12149 !! result
12150 <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>
12151 </p>
12152 !!end
12153
12154 !! test
12155 Width-sized image (using px, with following whitespace - test regression from r39467)
12156 !! input
12157 [[Image:foobar.jpg|640px ]]
12158 !! result
12159 <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>
12160 </p>
12161 !!end
12162
12163 !! test
12164 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12165 !! input
12166 [[Image:foobar.jpg| 640px]]
12167 !! result
12168 <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>
12169 </p>
12170 !!end
12171
12172 !! test
12173 Another italics / bold test
12174 !! input
12175 ''' ''x'
12176 !! result
12177 <pre>'<i> </i>x'
12178 </pre>
12179 !!end
12180
12181 # Note the results may be incorrect, as parserTest output included this:
12182 # XML error: Mismatched tag at byte 6120:
12183 # ...<dd> </dt></dl> </dd...
12184 !! test
12185 dt/dd/dl test
12186 !! options
12187 disabled
12188 !! input
12189 :;;;::
12190 !! result
12191 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12192 </dd></dl>
12193 </dd></dl>
12194 </dt></dl>
12195 </dt></dl>
12196 </dt></dl>
12197 </dd></dl>
12198
12199 !!end
12200
12201
12202 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12203 !! test
12204 Images with the "|" character in the comment
12205 !! input
12206 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12207 !! result
12208 <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>
12209
12210 !!end
12211
12212 !! test
12213 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12214 !! input
12215 <html><script>alert(1);</script></html>
12216 !! result
12217 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12218 </p>
12219 !! end
12220
12221 !! test
12222 HTML with raw HTML ($wgRawHtml==true)
12223 !! options
12224 rawhtml
12225 !! input
12226 <html><script>alert(1);</script></html>
12227 !! result
12228 <p><script>alert(1);</script>
12229 </p>
12230 !! end
12231
12232 !! test
12233 Parents of subpages, one level up
12234 !! options
12235 subpage title=[[Subpage test/L1/L2/L3]]
12236 !! input
12237 [[../|L2]]
12238 !! result
12239 <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>
12240 </p>
12241 !! end
12242
12243
12244 !! test
12245 Parents of subpages, one level up, not named
12246 !! options
12247 subpage title=[[Subpage test/L1/L2/L3]]
12248 !! input
12249 [[../]]
12250 !! result
12251 <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>
12252 </p>
12253 !! end
12254
12255
12256
12257 !! test
12258 Parents of subpages, two levels up
12259 !! options
12260 subpage title=[[Subpage test/L1/L2/L3]]
12261 !! input
12262 [[../../|L1]]2
12263
12264 [[../../|L1]]l
12265 !! result
12266 <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
12267 </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>
12268 </p>
12269 !! end
12270
12271 !! test
12272 Parents of subpages, two levels up, without trailing slash or name.
12273 !! options
12274 subpage title=[[Subpage test/L1/L2/L3]]
12275 !! input
12276 [[../..]]
12277 !! result
12278 <p>[[../..]]
12279 </p>
12280 !! end
12281
12282 !! test
12283 Parents of subpages, two levels up, with lots of extra trailing slashes.
12284 !! options
12285 subpage title=[[Subpage test/L1/L2/L3]]
12286 !! input
12287 [[../../////]]
12288 !! result
12289 <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>
12290 </p>
12291 !! end
12292
12293 !! article
12294 Subpage test/L1/L2/L3Sibling
12295 !! text
12296 Sibling article
12297 !! endarticle
12298
12299 !! test
12300 Transclusion of a sibling page (one level up)
12301 !! options
12302 subpage title=[[Subpage test/L1/L2/L3]]
12303 !! input
12304 {{../L3Sibling}}
12305 !! result
12306 <p>Sibling article
12307 </p>
12308 !! end
12309
12310 !! test
12311 Transclusion of a child page
12312 !! options
12313 subpage title=[[Subpage test/L1/L2]]
12314 !! input
12315 {{/L3Sibling}}
12316 !! result
12317 <p>Sibling article
12318 </p>
12319 !! end
12320
12321 !! test
12322 Non-transclusion because of too many up levels
12323 !! options
12324 subpage title=[[Subpage test/L1/L2/L3]]
12325 !! input
12326 {{../../../../More than parent}}
12327 !! result
12328 <p>{{../../../../More than parent}}
12329 </p>
12330 !! end
12331
12332 !! test
12333 Definition list code coverage
12334 !! input
12335 ; title : def
12336 ; title : def
12337 ;title: def
12338 !! result
12339 <dl><dt> title &#160;</dt><dd> def
12340 </dd><dt> title&#160;</dt><dd> def
12341 </dd><dt>title</dt><dd> def
12342 </dd></dl>
12343
12344 !! end
12345
12346 !! test
12347 Don't fall for the self-closing div
12348 !! input
12349 <div>hello world</div/>
12350 !! result
12351 <div>hello world</div>
12352
12353 !! end
12354
12355 !! test
12356 MSGNW magic word
12357 !! input
12358 {{MSGNW:msg}}
12359 !! result
12360 <p>&#91;&#91;:Template:Msg&#93;&#93;
12361 </p>
12362 !! end
12363
12364 !! test
12365 RAW magic word
12366 !! input
12367 {{RAW:QUERTY}}
12368 !! result
12369 <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>
12370 </p>
12371 !! end
12372
12373 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12374 !! test
12375 Always escape literal '>' in output, not just after '<'
12376 !! input
12377 ><>
12378 !! result
12379 <p>&gt;&lt;&gt;
12380 </p>
12381 !! end
12382
12383 !! test
12384 Template caching
12385 !! input
12386 {{Test}}
12387 {{Test}}
12388 !! result
12389 <p>This is a test template
12390 This is a test template
12391 </p>
12392 !! end
12393
12394
12395 !! article
12396 MediaWiki:Fake
12397 !! text
12398 ==header==
12399 !! endarticle
12400
12401 !! test
12402 Inclusion of !userCanEdit() content
12403 !! input
12404 {{MediaWiki:Fake}}
12405 !! result
12406 <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>
12407
12408 !! end
12409
12410
12411 !! test
12412 Out-of-order TOC heading levels
12413 !! input
12414 ==2==
12415 ======6======
12416 ===3===
12417 =1=
12418 =====5=====
12419 ==2==
12420 !! result
12421 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12422 <ul>
12423 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12424 <ul>
12425 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12426 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12427 </ul>
12428 </li>
12429 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12430 <ul>
12431 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12432 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12433 </ul>
12434 </li>
12435 </ul>
12436 </div>
12437 <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>
12438 <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>
12439 <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>
12440 <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>
12441 <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>
12442 <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>
12443
12444 !! end
12445
12446
12447 !! test
12448 ISBN with a dummy number
12449 !! input
12450 ISBN ---
12451 !! result
12452 <p>ISBN ---
12453 </p>
12454 !! end
12455
12456
12457 !! test
12458 ISBN with space-delimited number
12459 !! input
12460 ISBN 92 9017 032 8
12461 !! result
12462 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12463 </p>
12464 !! end
12465
12466
12467 !! test
12468 ISBN with multiple spaces, no number
12469 !! input
12470 ISBN foo
12471 !! result
12472 <p>ISBN foo
12473 </p>
12474 !! end
12475
12476
12477 !! test
12478 ISBN length
12479 !! input
12480 ISBN 123456789
12481
12482 ISBN 1234567890
12483
12484 ISBN 12345678901
12485 !! result
12486 <p>ISBN 123456789
12487 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12488 </p><p>ISBN 12345678901
12489 </p>
12490 !! end
12491
12492
12493 !! test
12494 ISBN with trailing year (bug 8110)
12495 !! input
12496 ISBN 1-234-56789-0 - 2006
12497
12498 ISBN 1 234 56789 0 - 2006
12499 !! result
12500 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12501 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12502 </p>
12503 !! end
12504
12505
12506 !! test
12507 anchorencode
12508 !! input
12509 {{anchorencode:foo bar©#%n}}
12510 !! result
12511 <p>foo_bar.C2.A9.23.25n
12512 </p>
12513 !! end
12514
12515 !! test
12516 anchorencode trims spaces
12517 !! input
12518 {{anchorencode: __pretty__please__}}
12519 !! result
12520 <p>pretty_please
12521 </p>
12522 !! end
12523
12524 !! test
12525 anchorencode deals with links
12526 !! input
12527 {{anchorencode: [[hello|world]] [[hi]]}}
12528 !! result
12529 <p>world_hi
12530 </p>
12531 !! end
12532
12533 !! test
12534 anchorencode deals with templates
12535 !! input
12536 {{anchorencode: {{Foo}} }}
12537 !! result
12538 <p>FOO
12539 </p>
12540 !! end
12541
12542 !! test
12543 anchorencode encodes like the TOC generator: (bug 18431)
12544 !! input
12545 === _ +:.3A%3A&&amp;]] ===
12546 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12547 __NOEDITSECTION__
12548 !! result
12549 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12550 <p>.2B:.3A.253A.26.26.5D.5D
12551 </p>
12552 !! end
12553
12554 # Expected output in the following test is not necessarily expected (there
12555 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12556 # only testing for well-formedness.
12557 !! test
12558 Bug 6200: blockquotes and paragraph formatting
12559 !! input
12560 <blockquote>
12561 foo
12562 </blockquote>
12563
12564 bar
12565
12566 baz
12567 !! result
12568 <blockquote>
12569 foo
12570 </blockquote>
12571 <p>bar
12572 </p>
12573 <pre>baz
12574 </pre>
12575 !! end
12576
12577 !! test
12578 Bug 8293: Use of center tag ruins paragraph formatting
12579 !! input
12580 <center>
12581 foo
12582 </center>
12583
12584 bar
12585
12586 baz
12587 !! result
12588 <center>
12589 <p>foo
12590 </p>
12591 </center>
12592 <p>bar
12593 </p>
12594 <pre>baz
12595 </pre>
12596 !! end
12597
12598 !!test
12599 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12600 !!options
12601 php
12602 !!input
12603 <span><s>x</span></s>
12604 !!result
12605 <p><span><s>x&lt;/span&gt;</s></span>
12606 </p>
12607 !!end
12608
12609 !!test
12610 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12611 !!options
12612 parsoid
12613 !!input
12614 <span><s>x</span></s>
12615 !!result
12616 <p><span><s>x</s></span><s></s>
12617 </p>
12618 !!end
12619
12620 ###
12621 ### Language variants related tests
12622 ###
12623 !! test
12624 Self-link in language variants
12625 !! options
12626 title=[[Dunav]] language=sr
12627 !! input
12628 Both [[Dunav]] and [[Дунав]] are names for this river.
12629 !! result
12630 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12631 </p>
12632 !!end
12633
12634 !! article
12635 Дуна
12636 !! text
12637 content
12638 !! endarticle
12639
12640 !! test
12641 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12642 !! options
12643 title=[[Duna]] language=sr
12644 !! input
12645 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12646 !! result
12647 <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.
12648 </p>
12649 !! end
12650
12651 !! test
12652 Link to pages in language variants
12653 !! options
12654 language=sr
12655 !! input
12656 Main Page can be written as [[Маин Паге]]
12657 !! result
12658 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12659 </p>
12660 !!end
12661
12662
12663 !! test
12664 Multiple links to pages in language variants
12665 !! options
12666 language=sr
12667 !! input
12668 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12669 !! result
12670 <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>.
12671 </p>
12672 !!end
12673
12674
12675 !! test
12676 Simple template in language variants
12677 !! options
12678 language=sr
12679 !! input
12680 {{тест}}
12681 !! result
12682 <p>This is a test template
12683 </p>
12684 !! end
12685
12686
12687 !! test
12688 Template with explicit namespace in language variants
12689 !! options
12690 language=sr
12691 !! input
12692 {{Template:тест}}
12693 !! result
12694 <p>This is a test template
12695 </p>
12696 !! end
12697
12698
12699 !! test
12700 Basic test for template parameter in language variants
12701 !! options
12702 language=sr
12703 !! input
12704 {{парамтест|param=foo}}
12705 !! result
12706 <p>This is a test template with parameter foo
12707 </p>
12708 !! end
12709
12710
12711 !! test
12712 Simple category in language variants
12713 !! options
12714 language=sr cat
12715 !! input
12716 [[Category:МедиаWики Усер'с Гуиде]]
12717 !! result
12718 <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>
12719 !! end
12720
12721
12722 !! article
12723 Category:分类
12724 !! text
12725 blah
12726 !! endarticle
12727
12728 !! article
12729 Category:分類
12730 !! text
12731 blah
12732 !! endarticle
12733
12734 !! test
12735 Don't convert blue categorylinks to another variant (bug 33210)
12736 !! options
12737 language=zh cat
12738 !! input
12739 [[A]][[Category:分类]]
12740 !! result
12741 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12742 !! end
12743
12744
12745 !! test
12746 Stripping -{}- tags (language variants)
12747 !! options
12748 language=sr
12749 !! input
12750 Latin proverb: -{Ne nuntium necare}-
12751 !! result
12752 <p>Latin proverb: Ne nuntium necare
12753 </p>
12754 !! end
12755
12756
12757 !! test
12758 Prevent conversion with -{}- tags (language variants)
12759 !! options
12760 language=sr variant=sr-ec
12761 !! input
12762 Latinski: -{Ne nuntium necare}-
12763 !! result
12764 <p>Латински: Ne nuntium necare
12765 </p>
12766 !! end
12767
12768
12769 !! test
12770 Prevent conversion of text with -{}- tags (language variants)
12771 !! options
12772 language=sr variant=sr-ec
12773 !! input
12774 Latinski: -{Ne nuntium necare}-
12775 !! result
12776 <p>Латински: Ne nuntium necare
12777 </p>
12778 !! end
12779
12780
12781 !! test
12782 Prevent conversion of links with -{}- tags (language variants)
12783 !! options
12784 language=sr variant=sr-ec
12785 !! input
12786 -{[[Main Page]]}-
12787 !! result
12788 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12789 </p>
12790 !! end
12791
12792
12793 !! test
12794 -{}- tags within headlines (within html for parserConvert())
12795 !! options
12796 language=sr variant=sr-ec
12797 !! input
12798 == -{Naslov}- ==
12799 !! result
12800 <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>
12801
12802 !! end
12803
12804
12805 !! test
12806 Explicit definition of language variant alternatives
12807 !! options
12808 language=zh variant=zh-tw
12809 !! input
12810 -{zh:China;zh-tw:Taiwan}-, not China
12811 !! result
12812 <p>Taiwan, not China
12813 </p>
12814 !! end
12815
12816
12817 !! test
12818 Conversion around HTML tags
12819 !! options
12820 language=sr variant=sr-ec
12821 !! input
12822 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12823 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12824 !! result
12825 <p>
12826 <span title="ЛаCтин">ски</span>
12827 </p>
12828 !! end
12829
12830
12831 !! test
12832 Explicit session-wise language variant mapping (A flag and - flag)
12833 !! options
12834 language=zh variant=zh-tw
12835 !! input
12836 Taiwan is not China.
12837 But -{A|zh:China;zh-tw:Taiwan}- is China,
12838 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12839 and -{China}- is China.
12840 !! result
12841 <p>Taiwan is not China.
12842 But Taiwan is Taiwan,
12843 (This should be stripped!)
12844 and China is China.
12845 </p>
12846 !! end
12847
12848 !! test
12849 Explicit session-wise language variant mapping (H flag for hide)
12850 !! options
12851 language=zh variant=zh-tw
12852 !! input
12853 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12854 Taiwan is China.
12855 !! result
12856 <p>(This should be stripped!)
12857 Taiwan is Taiwan.
12858 </p>
12859 !! end
12860
12861 !! test
12862 Adding explicit conversion rule for title (T flag)
12863 !! options
12864 language=zh variant=zh-tw showtitle
12865 !! input
12866 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12867 !! result
12868 Taiwan
12869 <p>Should be stripped!
12870 </p>
12871 !! end
12872
12873 !! test
12874 Testing that changing the language variant here in the tests actually works
12875 !! options
12876 language=zh variant=zh showtitle
12877 !! input
12878 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12879 !! result
12880 China
12881 <p>Should be stripped!
12882 </p>
12883 !! end
12884
12885 !! test
12886 Recursive conversion of alt and title attrs shouldn't clear converter state
12887 !! options
12888 language=zh variant=zh-cn showtitle
12889 !! input
12890 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12891 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12892 !! result
12893 China
12894 <p>
12895 Should be stripped<span title="Exclamation">!</span>
12896 </p>
12897 !! end
12898
12899 !! test
12900 Bug 24072: more test on conversion rule for title
12901 !! options
12902 language=zh variant=zh-tw showtitle
12903 !! input
12904 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12905 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12906 !! result
12907 Taiwan
12908 <p>This should be stripped!
12909 This won't take interferes with the title rule.
12910 </p>
12911 !! end
12912
12913 !! test
12914 Partly disable title conversion if variant == main language code
12915 !! options
12916 language=zh variant=zh title=[[ZH]] showtitle
12917 !! input
12918 -{T|zh-cn:CN;zh-tw:TW}-
12919 !! result
12920 ZH
12921 <p>
12922 </p>
12923 !! end
12924
12925 !! test
12926 Partly disable title conversion if variant == main language code, more
12927 !! options
12928 language=zh variant=zh title=[[ZH]] showtitle
12929 !! input
12930 -{T|TW}-
12931 !! result
12932 ZH
12933 <p>
12934 </p>
12935 !! end
12936
12937 !! test
12938 Raw output of variant escape tags (R flag)
12939 !! options
12940 language=zh variant=zh-tw
12941 !! input
12942 Raw: -{R|zh:China;zh-tw:Taiwan}-
12943 !! result
12944 <p>Raw: zh:China;zh-tw:Taiwan
12945 </p>
12946 !! end
12947
12948 !! test
12949 Nested using of manual convert syntax
12950 !! options
12951 language=zh variant=zh-hk
12952 !! input
12953 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12954 !! result
12955 <p>Nested: Hello Hong Kong!
12956 </p>
12957 !! end
12958
12959 !! test
12960 Proper conversion of text in external links
12961 !! options
12962 language=sr variant=sr-ec
12963 !! input
12964 http://www.google.com
12965 gopher://www.google.com
12966 [http://www.google.com http://www.google.com]
12967 [gopher://www.google.com gopher://www.google.com]
12968 [https://www.google.com irc://www.google.com]
12969 [ftp://www.google.com www.google.com/ftp://dir]
12970 [//www.google.com www.google.com]
12971 !! result
12972 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12973 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12974 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12975 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12976 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12977 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12978 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12979 </p>
12980 !! end
12981
12982 !! test
12983 Do not convert roman numbers to language variants
12984 !! options
12985 language=sr variant=sr-ec
12986 !! input
12987 Fridrih IV je car.
12988 !! result
12989 <p>Фридрих IV је цар.
12990 </p>
12991 !! end
12992
12993 !! test
12994 Unclosed language converter markup "-{"
12995 !! options
12996 language=sr
12997 !! input
12998 -{T|hello
12999 !! result
13000 <p>-{T|hello
13001 </p>
13002 !! end
13003
13004 !! test
13005 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13006 !! options
13007 language=sr
13008 !! input
13009 -{R|=&gt;}-
13010 !! result
13011 <p>=&gt;
13012 </p>
13013 !!end
13014
13015 !!article
13016 Template:Bullet
13017 !!text
13018 * Bar
13019 !!endarticle
13020
13021 !! test
13022 Bug 529: Uncovered bullet
13023 !! input
13024 * Foo {{bullet}}
13025 !! result
13026 <ul><li> Foo
13027 </li><li> Bar
13028 </li></ul>
13029
13030 !! end
13031
13032 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13033 # Templates in Wikipedia rely on this behavior, as tidy has always been
13034 # enabled there. These tests are normally run *without* tidy, so specify the
13035 # full output here.
13036 # To test realistic parsing behavior, apply a tidy-like transformation to both
13037 # the expected output and your parser's output.
13038 !! test
13039 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13040 !! input
13041 ******* Foo {{bullet}}
13042 !! result
13043 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13044 </li></ul>
13045 </li></ul>
13046 </li></ul>
13047 </li></ul>
13048 </li></ul>
13049 </li></ul>
13050 </li><li> Bar
13051 </li></ul>
13052
13053 !! end
13054
13055 !! test
13056 Bug 529: Uncovered table already at line-start
13057 !! input
13058 x
13059
13060 {{table}}
13061 y
13062 !! result
13063 <p>x
13064 </p>
13065 <table>
13066 <tr>
13067 <td> 1 </td>
13068 <td> 2
13069 </td></tr>
13070 <tr>
13071 <td> 3 </td>
13072 <td> 4
13073 </td></tr></table>
13074 <p>y
13075 </p>
13076 !! end
13077
13078 !! test
13079 Bug 529: Uncovered bullet in parser function result
13080 !! input
13081 * Foo {{lc:{{bullet}} }}
13082 !! result
13083 <ul><li> Foo
13084 </li><li> bar
13085 </li></ul>
13086
13087 !! end
13088
13089 !! test
13090 Bug 5678: Double-parsed template argument
13091 !! input
13092 {{lc:{{{1}}}|hello}}
13093 !! result
13094 <p>{{{1}}}
13095 </p>
13096 !! end
13097
13098 !! test
13099 Bug 5678: Double-parsed template invocation
13100 !! input
13101 {{lc:{{paramtest {{!}} param = hello }} }}
13102 !! result
13103 <p>{{paramtest | param = hello }}
13104 </p>
13105 !! end
13106
13107 !! test
13108 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13109 !! options
13110 language=cs
13111 title=[[Main Page]]
13112 !! input
13113 {{PRVNÍVELKÉ:ěščř}}
13114 {{prvnívelké:ěščř}}
13115 {{PRVNÍMALÉ:ěščř}}
13116 {{prvnímalé:ěščř}}
13117 {{MALÁ:ěščř}}
13118 {{malá:ěščř}}
13119 {{VELKÁ:ěščř}}
13120 {{velká:ěščř}}
13121 !! result
13122 <p>Ěščř
13123 Ěščř
13124 ěščř
13125 ěščř
13126 ěščř
13127 ěščř
13128 ĚŠČŘ
13129 ĚŠČŘ
13130 </p>
13131 !! end
13132
13133 !! test
13134 Morwen/13: Unclosed link followed by heading
13135 !! input
13136 [[link
13137 ==heading==
13138 !! result
13139 <p>[[link
13140 </p>
13141 <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>
13142
13143 !! end
13144
13145 !! test
13146 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13147 !! input
13148 {{foo|
13149 =heading=
13150 !! result
13151 <p>{{foo|
13152 </p>
13153 <h1><span class="mw-headline" id="heading">heading</span></h1>
13154
13155 !! end
13156
13157 !! test
13158 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13159 !! input
13160 {{foo|
13161 ==heading==
13162 !! result
13163 <p>{{foo|
13164 </p>
13165 <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>
13166
13167 !! end
13168
13169 !! test
13170 Tildes in comments
13171 !! options
13172 pst
13173 !! input
13174 <!-- ~~~~ -->
13175 !! result
13176 <!-- ~~~~ -->
13177 !! end
13178
13179 !! test
13180 Paragraphs inside divs (no extra line breaks)
13181 !! input
13182 <div>Line one
13183
13184 Line two</div>
13185 !! result
13186 <div>Line one
13187 Line two</div>
13188
13189 !! end
13190
13191 !! test
13192 Paragraphs inside divs (extra line break on open)
13193 !! input
13194 <div>
13195 Line one
13196
13197 Line two</div>
13198 !! result
13199 <div>
13200 <p>Line one
13201 </p>
13202 Line two</div>
13203
13204 !! end
13205
13206 !! test
13207 Paragraphs inside divs (extra line break on close)
13208 !! input
13209 <div>Line one
13210
13211 Line two
13212 </div>
13213 !! result
13214 <div>Line one
13215 <p>Line two
13216 </p>
13217 </div>
13218
13219 !! end
13220
13221 !! test
13222 Paragraphs inside divs (extra line break on open and close)
13223 !! input
13224 <div>
13225 Line one
13226
13227 Line two
13228 </div>
13229 !! result
13230 <div>
13231 <p>Line one
13232 </p><p>Line two
13233 </p>
13234 </div>
13235
13236 !! end
13237
13238 !! test
13239 Nesting tags, paragraphs on lines which begin with <div>
13240 !! options
13241 disabled
13242 !! input
13243 <div></div><strong>A
13244 B</strong>
13245 !! result
13246 <div></div>
13247 <p><strong>A
13248 B</strong>
13249 </p>
13250 !! end
13251
13252 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13253 !! test
13254 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13255 !! options
13256 disabled
13257 !! input
13258 <blockquote>Line one
13259
13260 Line two</blockquote>
13261 !! result
13262 <blockquote>Line one
13263 Line two</blockquote>
13264
13265 !! end
13266
13267 !! test
13268 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13269 !! options
13270 disabled
13271 !! input
13272 <blockquote>
13273 Line one
13274
13275 Line two</blockquote>
13276 !! result
13277 <blockquote>
13278 <p>Line one
13279 </p>
13280 Line two</blockquote>
13281
13282 !! end
13283
13284 !! test
13285 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13286 !! options
13287 disabled
13288 !! input
13289 <blockquote>Line one
13290
13291 Line two
13292 </blockquote>
13293 !! result
13294 <blockquote>Line one
13295 <p>Line two
13296 </p>
13297 </blockquote>
13298
13299 !! end
13300
13301 !! test
13302 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13303 !! options
13304 disabled
13305 !! input
13306 <blockquote>
13307 Line one
13308
13309 Line two
13310 </blockquote>
13311 !! result
13312 <blockquote>
13313 <p>Line one
13314 </p><p>Line two
13315 </p>
13316 </blockquote>
13317
13318 !! end
13319
13320 !! test
13321 Paragraphs inside blockquotes/divs (no extra line breaks)
13322 !! input
13323 <blockquote><div>Line one
13324
13325 Line two</div></blockquote>
13326 !! result
13327 <blockquote><div>Line one
13328 Line two</div></blockquote>
13329
13330 !! end
13331
13332 !! test
13333 Paragraphs inside blockquotes/divs (extra line break on open)
13334 !! input
13335 <blockquote><div>
13336 Line one
13337
13338 Line two</div></blockquote>
13339 !! result
13340 <blockquote><div>
13341 <p>Line one
13342 </p>
13343 Line two</div></blockquote>
13344
13345 !! end
13346
13347 !! test
13348 Paragraphs inside blockquotes/divs (extra line break on close)
13349 !! input
13350 <blockquote><div>Line one
13351
13352 Line two
13353 </div></blockquote>
13354 !! result
13355 <blockquote><div>Line one
13356 <p>Line two
13357 </p>
13358 </div></blockquote>
13359
13360 !! end
13361
13362 !! test
13363 Paragraphs inside blockquotes/divs (extra line break on open and close)
13364 !! input
13365 <blockquote><div>
13366 Line one
13367
13368 Line two
13369 </div></blockquote>
13370 !! result
13371 <blockquote><div>
13372 <p>Line one
13373 </p><p>Line two
13374 </p>
13375 </div></blockquote>
13376
13377 !! end
13378
13379 !! test
13380 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13381 !! options
13382 wgLinkHolderBatchSize=0
13383 !! input
13384 [[meatball:1]]
13385 [[meatball:2]]
13386 [[meatball:3]]
13387 !! result
13388 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13389 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13390 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13391 </p>
13392 !! end
13393
13394 !! test
13395 Free external link invading image caption
13396 !! input
13397 [[Image:Foobar.jpg|thumb|http://x|hello]]
13398 !! result
13399 <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>
13400
13401 !! end
13402
13403 !! test
13404 Bug 15196: localised external link numbers
13405 !! options
13406 language=fa
13407 !! input
13408 [http://en.wikipedia.org/]
13409 !! result
13410 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13411 </p>
13412 !! end
13413
13414 !! test
13415 Multibyte character in padleft
13416 !! input
13417 {{padleft:-Hello|7|Æ}}
13418 !! result
13419 <p>Æ-Hello
13420 </p>
13421 !! end
13422
13423 !! test
13424 Multibyte character in padright
13425 !! input
13426 {{padright:Hello-|7|Æ}}
13427 !! result
13428 <p>Hello-Æ
13429 </p>
13430 !! end
13431
13432 !!test
13433 formatdate parser function
13434 !!input
13435 {{#formatdate:2009-03-24}}
13436 !! result
13437 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13438 </p>
13439 !! end
13440
13441 !!test
13442 formatdate parser function, with default format
13443 !!input
13444 {{#formatdate:2009-03-24|mdy}}
13445 !! result
13446 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13447 </p>
13448 !! end
13449
13450 !! test
13451 Spacing of numbers in formatted dates
13452 !! input
13453 {{#formatdate:January 15}}
13454 !! result
13455 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13456 </p>
13457 !! end
13458
13459 !! test
13460 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
13461 !! options
13462 language=nl title=[[MediaWiki:Common.css]]
13463 !! input
13464 {{#formatdate:2009-03-24|dmy}}
13465 !! result
13466 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13467 </p>
13468 !! end
13469
13470 #
13471 #
13472 #
13473
13474 #
13475 # Edit comments
13476 #
13477
13478 !! test
13479 Edit comment with link
13480 !! options
13481 comment
13482 !! input
13483 I like the [[Main Page]] a lot
13484 !! result
13485 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13486 !!end
13487
13488 !! test
13489 Edit comment with link and link text
13490 !! options
13491 comment
13492 !! input
13493 I like the [[Main Page|best pages]] a lot
13494 !! result
13495 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13496 !!end
13497
13498 !! test
13499 Edit comment with link and link text with suffix
13500 !! options
13501 comment
13502 !! input
13503 I like the [[Main Page|best page]]s a lot
13504 !! result
13505 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13506 !!end
13507
13508 !! test
13509 Edit comment with section link (non-local, eg in history list)
13510 !! options
13511 comment title=[[Main Page]]
13512 !! input
13513 /* External links */ removed bogus entries
13514 !! result
13515 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13516 !!end
13517
13518 !! test
13519 Edit comment with section link and text before it (non-local, eg in history list)
13520 !! options
13521 comment title=[[Main Page]]
13522 !! input
13523 pre-comment text /* External links */ removed bogus entries
13524 !! result
13525 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>
13526 !!end
13527
13528 !! test
13529 Edit comment with section link (local, eg in diff view)
13530 !! options
13531 comment local title=[[Main Page]]
13532 !! input
13533 /* External links */ removed bogus entries
13534 !! result
13535 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13536 !!end
13537
13538 !! test
13539 Edit comment with subpage link (bug 14080)
13540 !! options
13541 comment
13542 subpage
13543 title=[[Subpage test]]
13544 !! input
13545 Poked at a [[/subpage]] here...
13546 !! result
13547 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13548 !!end
13549
13550 !! test
13551 Edit comment with subpage link and link text (bug 14080)
13552 !! options
13553 comment
13554 subpage
13555 title=[[Subpage test]]
13556 !! input
13557 Poked at a [[/subpage|neat little page]] here...
13558 !! result
13559 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13560 !!end
13561
13562 !! test
13563 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13564 !! options
13565 comment
13566 title=[[Subpage test]]
13567 !! input
13568 Poked at a [[/subpage]] here...
13569 !! result
13570 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...
13571 !!end
13572
13573 !! test
13574 Edit comment with bare anchor link (local, as on diff)
13575 !! options
13576 comment
13577 local
13578 title=[[Main Page]]
13579 !!input
13580 [[#section]]
13581 !! result
13582 <a href="#section">#section</a>
13583 !! end
13584
13585 !! test
13586 Edit comment with bare anchor link (non-local, as on history)
13587 !! options
13588 comment
13589 title=[[Main Page]]
13590 !!input
13591 [[#section]]
13592 !! result
13593 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13594 !! end
13595
13596 !! test
13597 Anchor starting with underscore
13598 !!input
13599 [[#_ref|One]]
13600 !! result
13601 <p><a href="#_ref">One</a>
13602 </p>
13603 !! end
13604
13605 !! test
13606 Id starting with underscore
13607 !!input
13608 <div id="_ref"></div>
13609 !! result
13610 <div id="_ref"></div>
13611
13612 !! end
13613
13614 !! test
13615 Space normalisation on autocomment (bug 22784)
13616 !! options
13617 comment
13618 title=[[Main Page]]
13619 !!input
13620 /* __hello__world__ */
13621 !! result
13622 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13623 !! end
13624
13625 !! test
13626 percent-encoding and + signs in comments (Bug 26410)
13627 !! options
13628 comment
13629 !!input
13630 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13631 !! result
13632 <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>
13633 !! end
13634
13635 !! test
13636 Bad images - basic functionality
13637 !! options
13638 disabled
13639 !! input
13640 [[File:Bad.jpg]]
13641 !! result
13642 !! end
13643
13644 !! test
13645 Bad images - bug 16039: text after bad image disappears
13646 !! options
13647 disabled
13648 !! input
13649 Foo bar
13650 [[File:Bad.jpg]]
13651 Bar foo
13652 !! result
13653 <p>Foo bar
13654 </p><p>Bar foo
13655 </p>
13656 !! end
13657
13658 !! test
13659 Verify that displaytitle works (bug #22501) no displaytitle
13660 !! options
13661 showtitle
13662 !! config
13663 wgAllowDisplayTitle=true
13664 wgRestrictDisplayTitle=false
13665 !! input
13666 this is not the the title
13667 !! result
13668 Parser test
13669 <p>this is not the the title
13670 </p>
13671 !! end
13672
13673 !! test
13674 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13675 !! options
13676 showtitle
13677 title=[[Screen]]
13678 !! config
13679 wgAllowDisplayTitle=true
13680 wgRestrictDisplayTitle=false
13681 !! input
13682 this is not the the title
13683 {{DISPLAYTITLE:whatever}}
13684 !! result
13685 whatever
13686 <p>this is not the the title
13687 </p>
13688 !! end
13689
13690 !! test
13691 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13692 !! options
13693 showtitle
13694 title=[[Screen]]
13695 !! config
13696 wgAllowDisplayTitle=true
13697 wgRestrictDisplayTitle=true
13698 !! input
13699 this is not the the title
13700 {{DISPLAYTITLE:whatever}}
13701 !! result
13702 Screen
13703 <p>this is not the the title
13704 </p>
13705 !! end
13706
13707 !! test
13708 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13709 !! options
13710 showtitle
13711 title=[[Screen]]
13712 !! config
13713 wgAllowDisplayTitle=true
13714 wgRestrictDisplayTitle=true
13715 !! input
13716 this is not the the title
13717 {{DISPLAYTITLE:screen}}
13718 !! result
13719 screen
13720 <p>this is not the the title
13721 </p>
13722 !! end
13723
13724 !! test
13725 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13726 !! options
13727 showtitle
13728 title=[[Screen]]
13729 !! config
13730 wgAllowDisplayTitle=false
13731 !! input
13732 this is not the the title
13733 {{DISPLAYTITLE:screen}}
13734 !! result
13735 Screen
13736 <p>this is not the the title
13737 <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>
13738 </p>
13739 !! end
13740
13741 !! test
13742 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13743 !! options
13744 showtitle
13745 title=[[Screen]]
13746 !! config
13747 wgAllowDisplayTitle=false
13748 !! input
13749 this is not the the title
13750 !! result
13751 Screen
13752 <p>this is not the the title
13753 </p>
13754 !! end
13755
13756 !! test
13757 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13758 !! options
13759 showtitle
13760 title=[[Screen]]
13761 !! config
13762 wgAllowDisplayTitle=true
13763 wgRestrictDisplayTitle=true
13764 !! input
13765 this is not the the title
13766 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13767 !! result
13768 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13769 <p>this is not the the title
13770 </p>
13771 !! end
13772
13773 !! test
13774 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13775 !! options
13776 showtitle
13777 title=[[Screen]]
13778 !! config
13779 wgAllowDisplayTitle=true
13780 wgRestrictDisplayTitle=true
13781 !! input
13782 this is not the the title
13783 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13784 !! result
13785 <span style="color: red;">s</span>creen
13786 <p>this is not the the title
13787 </p>
13788 !! end
13789
13790 !! test
13791 preload: check <noinclude> and <includeonly>
13792 !! options
13793 preload
13794 !! input
13795 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13796 !! result
13797 Hello kind world.
13798 !! end
13799
13800 !! test
13801 preload: check <onlyinclude>
13802 !! options
13803 preload
13804 !! input
13805 Goodbye <onlyinclude>Hello world</onlyinclude>
13806 !! result
13807 Hello world
13808 !! end
13809
13810 !! test
13811 preload: can pass tags through if we want to
13812 !! options
13813 preload
13814 !! input
13815 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13816 !! result
13817 <includeonly>Hello world</includeonly>
13818 !! end
13819
13820 !! test
13821 preload: check that it doesn't try to do tricks
13822 !! options
13823 preload
13824 !! input
13825 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13826 !! result
13827 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13828 !! end
13829
13830 !! test
13831 Play a bit with r67090 and bug 3158
13832 !! options
13833 disabled
13834 !! input
13835 <div style="width:50% !important">&nbsp;</div>
13836 <div style="width:50%&nbsp;!important">&nbsp;</div>
13837 <div style="width:50%&#160;!important">&nbsp;</div>
13838 <div style="border : solid;">&nbsp;</div>
13839 !! result
13840 <div style="width:50% !important">&nbsp;</div>
13841 <div style="width:50% !important">&nbsp;</div>
13842 <div style="width:50% !important">&nbsp;</div>
13843 <div style="border&#160;: solid;">&nbsp;</div>
13844
13845 !! end
13846
13847 !! test
13848 HTML5 data attributes
13849 !! input
13850 <span data-foo="bar">Baz</span>
13851 <p data-abc-def_hij="">Quuz</p>
13852 !! result
13853 <p><span data-foo="bar">Baz</span>
13854 </p>
13855 <p data-abc-def_hij="">Quuz</p>
13856
13857 !! end
13858
13859 !! test
13860 percent-encoding and + signs in internal links (Bug 26410)
13861 !! input
13862 [[User:+%]] [[Page+title%]]
13863 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13864 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13865 [[%33%45]] [[%33%45+]]
13866 !! result
13867 <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>
13868 <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>
13869 <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>
13870 <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>
13871 </p>
13872 !! end
13873
13874 !! test
13875 Special characters in embedded file links (bug 27679)
13876 !! input
13877 [[File:Contains & ampersand.jpg]]
13878 [[File:Does not exist.jpg|Title with & ampersand]]
13879 !! result
13880 <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>
13881 <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>
13882 </p>
13883 !! end
13884
13885
13886 !! test
13887 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13888 !! input
13889 Text&apos;s been normalized?
13890 !! result
13891 <p>Text&#39;s been normalized?
13892 </p>
13893 !! end
13894
13895 !! test
13896 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13897 !! input
13898 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13899 !! result
13900 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13901 </p>
13902 !! end
13903
13904 !! test
13905 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13906 !! input
13907 [http://www.example.org/ ideograms]
13908 !! result
13909 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13910 </p>
13911 !! end
13912
13913 !! test
13914 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13915 !! input
13916 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13917 !! result
13918 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13919 </p>
13920 !! end
13921
13922 !! article
13923 Mediawiki:loop1
13924 !! text
13925 {{Identical|A}}
13926 !! endarticle
13927
13928 !! article
13929 Mediawiki:loop2
13930 !! text
13931 {{Identical|B}}
13932 !! endarticle
13933
13934 !! article
13935 Template:Identical
13936 !! text
13937 {{int:loop1}}
13938 {{int:loop2}}
13939 !! endarticle
13940
13941 !! test
13942 Bug 31098 Template which includes system messages which includes the template
13943 !! input
13944 {{Identical}}
13945 !! result
13946 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13947 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13948 </p>
13949 !! end
13950
13951 !! test
13952 Bug31490 Turkish: ucfirst 'blah'
13953 !! options
13954 language=tr
13955 !! input
13956 {{ucfirst:blah}}
13957 !! result
13958 <p>Blah
13959 </p>
13960 !! end
13961
13962 !! test
13963 Bug31490 Turkish: ucfirst 'ix'
13964 !! options
13965 language=tr
13966 !! input
13967 {{ucfirst:ix}}
13968 !! result
13969 <p>İx
13970 </p>
13971 !! end
13972
13973 !! test
13974 Bug31490 Turkish: lcfirst 'BLAH'
13975 !! options
13976 language=tr
13977 !! input
13978 {{lcfirst:BLAH}}
13979 !! result
13980 <p>bLAH
13981 </p>
13982 !! end
13983
13984 !! test
13985 Bug31490 Turkish: ucfırst (with a dotless i)
13986 !! options
13987 language=tr
13988 !! input
13989 {{ucfırst:blah}}
13990 !! result
13991 <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>
13992 </p>
13993 !! end
13994
13995 !! test
13996 Bug31490 ucfırst (with a dotless i) with English language
13997 !! options
13998 language=en
13999 !! input
14000 {{ucfırst:blah}}
14001 !! result
14002 <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>
14003 </p>
14004 !! end
14005
14006 !! test
14007 Bug 26375: TOC with italics
14008 !! options
14009 title=[[Main Page]]
14010 !! input
14011 __TOC__
14012 == ''Lost'' episodes ==
14013 !! result
14014 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14015 <ul>
14016 <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>
14017 </ul>
14018 </div>
14019 <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>
14020
14021 !! end
14022
14023 !! test
14024 Bug 26375: TOC with bold
14025 !! options
14026 title=[[Main Page]]
14027 !! input
14028 __TOC__
14029 == '''should be bold''' then normal text ==
14030 !! result
14031 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14032 <ul>
14033 <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>
14034 </ul>
14035 </div>
14036 <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>
14037
14038 !! end
14039
14040 !! test
14041 Bug 33845: Headings become cursive in TOC when they contain an image
14042 !! options
14043 title=[[Main Page]]
14044 !! input
14045 __TOC__
14046 == Image [[Image:foobar.jpg]] ==
14047 !! result
14048 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14049 <ul>
14050 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14051 </ul>
14052 </div>
14053 <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>
14054
14055 !! end
14056
14057 !! test
14058 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14059 !! options
14060 title=[[Main Page]]
14061 !! input
14062 __TOC__
14063 == <blockquote>Quote</blockquote> ==
14064 !! result
14065 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14066 <ul>
14067 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14068 </ul>
14069 </div>
14070 <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>
14071
14072 !! end
14073
14074 !! test
14075 Unclosed tags in TOC
14076 !! options
14077 title=[[Main Page]]
14078 !! input
14079 __TOC__
14080 == Proof: 2 < 3 ==
14081 <small>Hanc marginis exiguitas non caperet.</small>
14082 QED
14083 !! result
14084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14085 <ul>
14086 <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>
14087 </ul>
14088 </div>
14089 <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>
14090 <p><small>Hanc marginis exiguitas non caperet.</small>
14091 QED
14092 </p>
14093 !! end
14094
14095 !! test
14096 Multiple tags in TOC
14097 !! input
14098 __TOC__
14099 == <i>Foo</i> <b>Bar</b> ==
14100
14101 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14102 !! result
14103 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14104 <ul>
14105 <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>
14106 <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>
14107 </ul>
14108 </div>
14109 <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>
14110 <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>
14111
14112 !! end
14113
14114 !! test
14115 Tags with parameters in TOC
14116 !! input
14117 __TOC__
14118 == <sup class="in-h2">Hello</sup> ==
14119
14120 == <sup class="a > b">Evilbye</sup> ==
14121 !! result
14122 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14123 <ul>
14124 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14125 <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>
14126 </ul>
14127 </div>
14128 <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>
14129 <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>
14130
14131 !! end
14132
14133 !! test
14134 span tags with directionality in TOC
14135 !! input
14136 __TOC__
14137 == <span dir="ltr">C++</span> ==
14138
14139 == <span dir="rtl">זבנג!</span> ==
14140
14141 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14142
14143 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14144
14145 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14146 !! result
14147 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14148 <ul>
14149 <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>
14150 <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>
14151 <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>
14152 <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>
14153 <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>
14154 </ul>
14155 </div>
14156 <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>
14157 <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>
14158 <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>
14159 <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>
14160 <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>
14161
14162 !! end
14163
14164 !! article
14165 MediaWiki:Bug32057
14166 !! text
14167 == {{int:headline_sample}} ==
14168 !! endarticle
14169
14170 !! test
14171 Bug 32057: Title needed when expanding <h> nodes.
14172 !! options
14173 title=[[Main Page]]
14174 !! input
14175 {{int:Bug32057}}
14176 !! result
14177 <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>
14178
14179 !! end
14180
14181 !! test
14182 Strip marker in urlencode
14183 !! input
14184 {{urlencode:x<nowiki/>y}}
14185 {{urlencode:x<nowiki/>y|wiki}}
14186 {{urlencode:x<nowiki/>y|path}}
14187 !! result
14188 <p>xy
14189 xy
14190 xy
14191 </p>
14192 !! end
14193
14194 !! test
14195 Strip marker in lc
14196 !! input
14197 {{lc:x<nowiki/>y}}
14198 !! result
14199 <p>xy
14200 </p>
14201 !! end
14202
14203 !! test
14204 Strip marker in uc
14205 !! input
14206 {{uc:x<nowiki/>y}}
14207 !! result
14208 <p>XY
14209 </p>
14210 !! end
14211
14212 !! test
14213 Strip marker in formatNum
14214 !! input
14215 {{formatnum:1<nowiki/>2}}
14216 {{formatnum:1<nowiki/>2|R}}
14217 !! result
14218 <p>12
14219 12
14220 </p>
14221 !! end
14222
14223 !! test
14224 Check noCommafy in formatNum
14225 !! options
14226 language=be-tarask
14227 !! input
14228 {{formatnum:123456.78}}
14229 {{formatnum:123456.78|NOSEP}}
14230 !! result
14231 <p>123 456,78
14232 123456.78
14233 </p>
14234 !! end
14235
14236 !! test
14237 Strip marker in grammar
14238 !! options
14239 language=fi
14240 !! input
14241 {{grammar:elative|foo<nowiki/>bar}}
14242 !! result
14243 <p>foobarista
14244 </p>
14245 !! end
14246
14247 !! test
14248 Strip marker in padleft
14249 !! input
14250 {{padleft:|2|x<nowiki/>y}}
14251 !! result
14252 <p>xy
14253 </p>
14254 !! end
14255
14256 !! test
14257 Strip marker in padright
14258 !! input
14259 {{padright:|2|x<nowiki/>y}}
14260 !! result
14261 <p>xy
14262 </p>
14263 !! end
14264
14265 !! test
14266 Strip marker in anchorencode
14267 !! input
14268 {{anchorencode:x<nowiki/>y}}
14269 !! result
14270 <p>xy
14271 </p>
14272 !! end
14273
14274 !! test
14275 nowiki inside link inside heading (bug 18295)
14276 !! input
14277 ==[[foo|x<nowiki>y</nowiki>z]]==
14278 !! result
14279 <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>
14280
14281 !! end
14282
14283 !! test
14284 new support for bdi element (bug 31817)
14285 !! input
14286 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14287 !! result
14288 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14289
14290 !!end
14291
14292 !! test
14293 Ignore pipe between table row attributes
14294 !! input
14295 {|
14296 | quux
14297 |- id=foo | style='color: red'
14298 | bar
14299 |}
14300 !! result
14301 <table>
14302 <tr>
14303 <td> quux
14304 </td></tr>
14305 <tr id="foo" style="color: red">
14306 <td> bar
14307 </td></tr></table>
14308
14309 !! end
14310
14311 !!test
14312 Gallery override link with WikiLink (bug 34852)
14313 !! input
14314 <gallery>
14315 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14316 </gallery>
14317 !! result
14318 <ul class="gallery">
14319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14320 <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>
14321 <div class="gallerytext">
14322 <p>caption
14323 </p>
14324 </div>
14325 </div></li>
14326 </ul>
14327
14328 !! end
14329
14330 !!test
14331 Gallery override link with absolute external link (bug 34852)
14332 !! input
14333 <gallery>
14334 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14335 </gallery>
14336 !! result
14337 <ul class="gallery">
14338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14339 <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>
14340 <div class="gallerytext">
14341 <p>caption
14342 </p>
14343 </div>
14344 </div></li>
14345 </ul>
14346
14347 !! end
14348
14349 !!test
14350 Gallery override link with malicious javascript (bug 34852)
14351 !! input
14352 <gallery>
14353 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14354 </gallery>
14355 !! result
14356 <ul class="gallery">
14357 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14358 <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>
14359 <div class="gallerytext">
14360 <p>caption
14361 </p>
14362 </div>
14363 </div></li>
14364 </ul>
14365
14366 !! end
14367
14368 !!test
14369 Gallery with invalid title as link (bug 43964)
14370 !! input
14371 <gallery>
14372 File:foobar.jpg|link=<
14373 </gallery>
14374 !! result
14375 <ul class="gallery">
14376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14377 <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>
14378 <div class="gallerytext">
14379 </div>
14380 </div></li>
14381 </ul>
14382
14383 !! end
14384
14385 !!test
14386 Language parser function
14387 !! input
14388 {{#language:ar}}
14389 !! result
14390 <p>العربية
14391 </p>
14392 !! end
14393
14394 !!test
14395 Padleft and padright as substr
14396 !! input
14397 {{padleft:|3|abcde}}
14398 {{padright:|3|abcde}}
14399 !! result
14400 <p>abc
14401 abc
14402 </p>
14403 !! end
14404
14405 !!test
14406 Special parser function
14407 !! input
14408 {{#special:RandomPage}}
14409 {{#special:BaDtItLe}}
14410 {{#special:Foobar}}
14411 !! result
14412 <p>Special:Random
14413 Special:Badtitle
14414 Special:Foobar
14415 </p>
14416 !! end
14417
14418 !!test
14419 Bug 34939 - Case insensitive link parsing ([HttP://])
14420 !! input
14421 [HttP://MediaWiki.Org/]
14422 !! result
14423 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14424 </p>
14425 !! end
14426
14427 !!test
14428 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14429 !! input
14430 [HttP://MediaWiki.Org/ MediaWiki]
14431 !! result
14432 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14433 </p>
14434 !! end
14435
14436 !!test
14437 Bug 34939 - Case insensitive link parsing (HttP://)
14438 !! input
14439 HttP://MediaWiki.Org/
14440 !! result
14441 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14442 </p>
14443 !! end
14444
14445 ###
14446 ### Parsoids-specific tests
14447 ### Parsoid-PHP parser incompatibilities
14448 ###
14449 !!test
14450 1. SOL-sensitive wikitext tokens as template-args
14451 !!options
14452 parsoid=wt2html,wt2wt
14453 !!input
14454 {{echo|*a}}
14455 {{echo|#a}}
14456 {{echo|:a}}
14457 !!result
14458 <span about="#mwt1" typeof="mw:Transclusion">
14459 </span><ul about="#mwt1"><li>a</li></ul>
14460 <span about="#mwt2" typeof="mw:Transclusion">
14461 </span><ol about="#mwt2"><li>a</li></ol>
14462 <span about="#mwt3" typeof="mw:Transclusion">
14463 </span><dl about="#mwt3"><dd>a</dd></dl>
14464 !!end
14465
14466 #### ----------------------------------------------------------------
14467 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14468 #### tags. Parsoid's output for these tags differs from that of the
14469 #### PHP parser.
14470 #### ----------------------------------------------------------------
14471
14472 !!test
14473 Ref: 1. ref-location should be replaced with an index span
14474 !!options
14475 parsoid
14476 !!input
14477 A <ref>foo</ref>
14478 B <ref name="x">foo</ref>
14479 C <ref name="y" />
14480 !!result
14481 <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>
14482 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>
14483 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>
14484 !!end
14485
14486 !!test
14487 Ref: 2. ref-tags with identical names should all get the same index
14488 !!options
14489 parsoid
14490 !!input
14491 A <ref name="x">foo</ref>
14492 B <ref name="x" />
14493 !!result
14494 <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>
14495 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>
14496 !!end
14497
14498 !!test
14499 Ref: 3. spaces in ref-names should be ignored
14500 !!options
14501 parsoid
14502 !!input
14503 A <ref name="x">foo</ref>
14504 B <ref name=" x " />
14505 C <ref name= x />
14506 !!result
14507 <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>
14508 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>
14509 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>
14510 !!end
14511
14512 !!test
14513 Ref: 4. 'constructor' should be accepted as a valid ref-name
14514 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14515 !!options
14516 parsoid
14517 !!input
14518 A <ref name="constructor">foo</ref>
14519 !!result
14520 <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>
14521 !!end
14522
14523 !!test
14524 Ref: 5. body should accept generic wikitext
14525 !!options
14526 parsoid
14527 !!input
14528 A <ref>
14529 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14530 </ref>
14531
14532 <references />
14533 !!result
14534 <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>
14535
14536 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14537 <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>
14538 </li></ol>
14539 !!end
14540
14541 !!test
14542 Ref: 6. indent-pres should not be output in ref-body
14543 !!options
14544 parsoid
14545 !!input
14546 A <ref>
14547 foo
14548 bar
14549 baz
14550 </ref>
14551
14552 <references />
14553 !!result
14554 <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>
14555
14556 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14557 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14558 bar
14559 baz
14560 </li></ol>
14561 !!end
14562
14563 !!test
14564 Ref: 6. No p-wrapping in ref-body
14565 !!options
14566 parsoid
14567 !!input
14568 A <ref>
14569 foo
14570
14571 bar
14572
14573
14574 baz
14575
14576
14577
14578 booz
14579 </ref>
14580
14581 <references />
14582 !!result
14583 <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>
14584
14585 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14586 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14587
14588 bar
14589
14590
14591 baz
14592
14593
14594
14595 booz
14596 </li></ol>
14597 !!end
14598
14599 !!test
14600 Ref: 8. transclusion wikitext has lower precedence
14601 !!options
14602 parsoid
14603 !!input
14604 A <ref> foo {{echo|</ref> B C}}
14605
14606 <references />
14607 !!result
14608 <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>
14609
14610 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14611 <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>
14612 !!end
14613
14614 !!test
14615 Ref: 9. unclosed comments should not leak out of ref-body
14616 !!options
14617 parsoid
14618 !!input
14619 A <ref> foo <!--</ref> B C
14620
14621 <references />
14622 !!result
14623 <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>
14624
14625 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14626 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14627 !!end
14628
14629 !!test
14630 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14631 !!options
14632 parsoid
14633 !!input
14634 A <ref> <b> foo </ref> B C
14635
14636 <references />
14637 !!result
14638 <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>
14639
14640 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14641 <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>
14642 !!end
14643
14644 !!test
14645 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14646 !!options
14647 parsoid
14648 !!input
14649 A <ref>foo</ref> B
14650 C <ref>bar</ref> D
14651 !!result
14652 <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
14653 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>
14654 !!end
14655
14656 !!test
14657 Ref: 12. ref-tags act as trailing newline migration barrier
14658 !!options
14659 parsoid
14660 !!input
14661 <!--the newline at the end of this line moves out of the p-tag-->a
14662
14663 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14664 <ref />
14665
14666 c
14667 !!result
14668 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14669
14670
14671 <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>
14672 <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>
14673
14674
14675 <p>c</p>
14676 !!end
14677
14678 !!test
14679 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14680 !!options
14681 parsoid
14682 !!input
14683 <ref>foo</ref> A
14684 <ref>bar
14685 </ref> B
14686 !!result
14687 <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
14688 <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>
14689 !!end
14690
14691 !!test
14692 Ref: 14. A nested ref-tag should be emitted as plain text
14693 !!options
14694 parsoid
14695 !!input
14696 <ref>foo <ref>bar</ref> baz</ref>
14697
14698 <references />
14699 !!result
14700 <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>
14701
14702 <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>
14703 !!end
14704
14705 !!test
14706 Ref: 15. ref-tags with identical names should get identical indexes
14707 !!options
14708 parsoid
14709 !!input
14710 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14711 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14712
14713 <references />
14714 !!result
14715 <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>
14716 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>
14717
14718 <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>
14719 !!end
14720
14721 !!test
14722 References: 1. references tag without any refs should be handled properly
14723 !!options
14724 parsoid
14725 !!input
14726 <references />
14727 !!result
14728 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14729 !!end
14730
14731 !!test
14732 References: 2. references tag with group only outputs references from that group
14733 !!options
14734 parsoid
14735 !!input
14736 A <ref group="a">foo</ref>
14737 B <ref group="b">bar</ref>
14738
14739 <references group='a' />
14740 !!result
14741 <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>
14742 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>
14743
14744 <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>
14745 !!end
14746
14747 !!test
14748 References: 3. ref list should be cleared after processing references
14749 !!options
14750 parsoid
14751 !!input
14752 A <ref>foo</ref>
14753
14754 <references />
14755
14756 B <ref>bar</ref>
14757
14758 <references />
14759 !!result
14760 <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>
14761
14762 <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>
14763
14764 <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>
14765
14766 <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>
14767 !!end
14768
14769 !!test
14770 References: 4. only referenced group should be cleared after processing references
14771 !!options
14772 parsoid
14773 !!input
14774 A <ref group="a">afoo</ref>
14775 B <ref>bfoo</ref>
14776
14777 <references group="a"/>
14778
14779 C <ref>cfoo</ref>
14780
14781 <references />
14782 !!result
14783 <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>
14784 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>
14785
14786 <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>
14787
14788 <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>
14789
14790 <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>
14791 !!end
14792
14793 !!test
14794 References: 5. ref tags in references should be processed while ignoring all other content
14795 !!options
14796 parsoid
14797 !!input
14798 A <ref name="a" />
14799 B <ref name="b">bar</ref>
14800
14801 <references>
14802 <ref name="a">foo</ref>
14803 This should just get lost.
14804 </references>
14805 !!result
14806 <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>
14807 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>
14808
14809 <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>
14810 !!end
14811
14812 !!test
14813 References: 6. <references /> from a transclusion
14814 !!options
14815 parsoid
14816 !!input
14817 {{echo|<references />}}
14818 !!result
14819 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14820 !!end
14821
14822 #### ----------------------------------------------------------------
14823 #### The following section of tests are primarily to test
14824 #### wikitext escaping capabilities of Parsoid. Given that
14825 #### escaping can be done any number of ways, the wikitext (input)
14826 #### is always adjusted to reflect how Parsoid adds nowiki
14827 #### escape tags.
14828 ####
14829 #### We are marking several tests as parsoid-only since the
14830 #### HTML in the result section is different from what the
14831 #### PHP parser generates for it.
14832 #### ----------------------------------------------------------------
14833
14834
14835 #### --------------- Headings ---------------
14836 #### 0. Unnested
14837 #### 1. Nested inside html <h1>=foo=</h1>
14838 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14839 #### 3. Nested inside html with wikitext split by html tags
14840 #### 4. No escape needed
14841 #### 5. Empty headings <h1></h1>
14842 #### 6. Heading chars in SOL context
14843 #### ----------------------------------------
14844 !! test
14845 Headings: 0. Unnested
14846 !! options
14847 parsoid
14848 !! input
14849 <nowiki>=foo=</nowiki>
14850
14851 <nowiki> =foo= </nowiki>
14852 <!--cmt-->
14853 <nowiki>=foo=</nowiki>
14854
14855 =foo''a''<nowiki>=</nowiki>
14856 !! result
14857 <p><span typeof="mw:Nowiki">=foo=</span></p>
14858
14859 <p><span typeof="mw:Nowiki"> =foo= </span>
14860 <!--cmt-->
14861 <span typeof="mw:Nowiki">=foo=</span></p>
14862
14863 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14864 !!end
14865
14866 !! test
14867 Headings: 1. Nested inside html
14868 !! options
14869 parsoid
14870 !! input
14871 =<nowiki>=foo=</nowiki>=
14872 ==<nowiki>=foo=</nowiki>==
14873 ===<nowiki>=foo=</nowiki>===
14874 ====<nowiki>=foo=</nowiki>====
14875 =====<nowiki>=foo=</nowiki>=====
14876 ======<nowiki>=foo=</nowiki>======
14877 !! result
14878 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14879 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14880 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14881 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14882 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14883 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14884 !!end
14885
14886 !! test
14887 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14888 !! options
14889 parsoid
14890 !! input
14891 =foo=
14892 <nowiki>*bar</nowiki>
14893 =foo=
14894 =bar
14895 =foo=
14896 <nowiki>=bar=</nowiki>
14897 !! result
14898 <h1>foo</h1>*bar
14899 <h1>foo</h1>=bar
14900 <h1>foo</h1>=bar=
14901 !!end
14902
14903 !! test
14904 Headings: 3. Nested inside html with wikitext split by html tags
14905 !! options
14906 parsoid
14907 !! input
14908 =='''bold'''<nowiki>foo=</nowiki>=
14909 !! result
14910 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14911 !!end
14912
14913 !! test
14914 Headings: 4a. No escaping needed (testing just h1 and h2)
14915 !! options
14916 parsoid
14917 !! input
14918 ==foo=
14919 =foo==
14920 = =foo= =
14921 ==foo= bar=
14922 ===foo==
14923 ==foo===
14924 =''=''foo==
14925 =<nowiki>=</nowiki>=
14926 !! result
14927 <h1>=foo</h1>
14928 <h1>foo=</h1>
14929 <h1> =foo= </h1>
14930 <h1>=foo= bar</h1>
14931 <h2>=foo</h2>
14932 <h2>foo=</h2>
14933 <h1><i>=</i>foo=</h1>
14934 <h1><span typeof="mw:Nowiki">=</span></h1>
14935 !!end
14936
14937 !! test
14938 Headings: 4b. No escaping needed (inside p-tags)
14939 !! options
14940 parsoid
14941 !! input
14942 ===
14943 =foo= x
14944 =foo= <s></s>
14945 !! result
14946 <p>===
14947 =foo= x
14948 =foo= <s></s>
14949 </p>
14950 !!end
14951
14952 !! test
14953 Headings: 5. Empty headings
14954 !! options
14955 parsoid
14956 !! input
14957 =<nowiki/>=
14958 ==<nowiki/>==
14959 ===<nowiki/>===
14960 ====<nowiki/>====
14961 =====<nowiki/>=====
14962 ======<nowiki/>======
14963 !! result
14964 <h1></h1>
14965 <h2></h2>
14966 <h3></h3>
14967 <h4></h4>
14968 <h5></h5>
14969 <h6></h6>
14970 !!end
14971
14972 !! test
14973 Headings: 6a. Heading chars in SOL context (with trailing spaces)
14974 !! options
14975 parsoid
14976 !! input
14977 <nowiki>=a=</nowiki>
14978
14979 <nowiki>=a= </nowiki>
14980
14981 <nowiki>=a= </nowiki>
14982
14983 <nowiki>=a= </nowiki>
14984 !! result
14985 <p>=a=</p>
14986 <p>=a= </p>
14987 <p>=a= </p>
14988 <p>=a= </p>
14989 !!end
14990
14991 !! test
14992 Headings: 6b. Heading chars in SOL context (with trailing newlines)
14993 !! options
14994 parsoid
14995 !! input
14996 <nowiki>=a=
14997 b</nowiki>
14998
14999 <nowiki>=a=
15000 b</nowiki>
15001
15002 <nowiki>=a=
15003 b</nowiki>
15004
15005 <nowiki>=a=
15006 b</nowiki>
15007 !! result
15008 <p>=a=
15009 b</p>
15010 <p>=a=
15011 b</p>
15012 <p>=a=
15013 b</p>
15014 <p>=a=
15015 b</p>
15016 </p>
15017 !!end
15018
15019 !! test
15020 Headings: 6c. Heading chars in SOL context (leading newline break)
15021 !! options
15022 parsoid
15023 !! input
15024 <nowiki>a
15025 =b=</nowiki>
15026 !! result
15027 <p>a
15028 =b=</p>
15029 !!end
15030
15031 !! test
15032 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15033 !! options
15034 parsoid
15035 !! input
15036 <!--c0--><nowiki>=a=</nowiki>
15037 <!--c1-->
15038 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15039 !! result
15040 <p><!--c0-->=a=</p>
15041 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15042 !!end
15043
15044 !! test
15045 Headings: 6d. Heading chars in SOL context (No escaping needed)
15046 !! options
15047 parsoid=html2wt
15048 !! input
15049 =a=<div>b</div>
15050 !! result
15051 =a=<div>b</div>
15052 !!end
15053
15054 #### --------------- Lists ---------------
15055 #### 0. Outside nests (*foo, etc.)
15056 #### 1. Nested inside html <ul><li>*foo</li></ul>
15057 #### 2. Inside definition lists
15058 #### 3. Only bullets at start should be escaped
15059 #### 4. No escapes needed
15060 #### 5. No unnecessary escapes
15061 #### 6. Escape bullets in SOL position
15062 #### 7. Escape bullets in a multi-line context
15063 #### ----------------------------------------
15064
15065 !! test
15066 Lists: 0. Outside nests
15067 !! input
15068 <nowiki>*foo</nowiki>
15069
15070 <nowiki>#foo</nowiki>
15071 !! result
15072 <p>*foo
15073 </p><p>#foo
15074 </p>
15075 !!end
15076
15077 !! test
15078 Lists: 1. Nested inside html
15079 !! input
15080 *<nowiki>*foo</nowiki>
15081
15082 *<nowiki>#foo</nowiki>
15083
15084 *<nowiki>:foo</nowiki>
15085
15086 *<nowiki>;foo</nowiki>
15087
15088 #<nowiki>*foo</nowiki>
15089
15090 #<nowiki>#foo</nowiki>
15091
15092 #<nowiki>:foo</nowiki>
15093
15094 #<nowiki>;foo</nowiki>
15095 !! result
15096 <ul><li>*foo
15097 </li></ul>
15098 <ul><li>#foo
15099 </li></ul>
15100 <ul><li>:foo
15101 </li></ul>
15102 <ul><li>;foo
15103 </li></ul>
15104 <ol><li>*foo
15105 </li></ol>
15106 <ol><li>#foo
15107 </li></ol>
15108 <ol><li>:foo
15109 </li></ol>
15110 <ol><li>;foo
15111 </li></ol>
15112
15113 !!end
15114
15115 !! test
15116 Lists: 2. Inside definition lists
15117 !! input
15118 ;<nowiki>;foo</nowiki>
15119
15120 ;<nowiki>:foo</nowiki>
15121
15122 ;<nowiki>:foo</nowiki>
15123 :bar
15124
15125 :<nowiki>:foo</nowiki>
15126 !! result
15127 <dl><dt>;foo
15128 </dt></dl>
15129 <dl><dt>:foo
15130 </dt></dl>
15131 <dl><dt>:foo
15132 </dt><dd>bar
15133 </dd></dl>
15134 <dl><dd>:foo
15135 </dd></dl>
15136
15137 !!end
15138
15139 !! test
15140 Lists: 3. Only bullets at start of text should be escaped
15141 !! input
15142 *<nowiki>*foo*bar</nowiki>
15143
15144 *<nowiki>*foo</nowiki>''it''*bar
15145 !! result
15146 <ul><li>*foo*bar
15147 </li></ul>
15148 <ul><li>*foo<i>it</i>*bar
15149 </li></ul>
15150
15151 !!end
15152
15153 !! test
15154 Lists: 4. No escapes needed
15155 !! options
15156 parsoid
15157 !! input
15158 *foo*bar
15159
15160 *''foo''*bar
15161
15162 *[[Foo]]: bar
15163 !! result
15164 <ul><li>foo*bar
15165 </li></ul>
15166 <ul><li><i>foo</i>*bar
15167 </li></ul>
15168 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15169 </li></ul>
15170 !!end
15171
15172 !! test
15173 Lists: 5. No unnecessary escapes
15174 !! input
15175 * bar <span><nowiki>[[foo]]</nowiki></span>
15176
15177 *=bar <span><nowiki>[[foo]]</nowiki></span>
15178
15179 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15180
15181 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15182
15183 *=bar <span>foo]]</span>=
15184
15185 * <s></s>: a
15186 !! result
15187 <ul><li> bar <span>[[foo]]</span>
15188 </li></ul>
15189 <ul><li>=bar <span>[[foo]]</span>
15190 </li></ul>
15191 <ul><li>[[bar <span>[[foo]]</span>
15192 </li></ul>
15193 <ul><li>]]bar <span>[[foo]]</span>
15194 </li></ul>
15195 <ul><li>=bar <span>foo]]</span>=
15196 </li></ul>
15197 <ul><li> <s></s>: a
15198 </li></ul>
15199
15200 !!end
15201
15202 !! test
15203 Lists: 6. Escape bullets in SOL position
15204 !! options
15205 parsoid
15206 !! input
15207 <!--cmt--><nowiki>*foo</nowiki>
15208 !! result
15209 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15210 !!end
15211
15212 !! test
15213 Lists: 7. Escape bullets in a multi-line context
15214 !! input
15215 <nowiki>a
15216 *b</nowiki>
15217 !! result
15218 <p>a
15219 *b
15220 </p>
15221 !!end
15222
15223 #### --------------- HRs ---------------
15224 #### 1. Single line
15225 #### -----------------------------------
15226
15227 !! test
15228 HRs: 1. Single line
15229 !! options
15230 parsoid
15231 !! input
15232 ----<nowiki>----</nowiki>
15233 ----=foo=
15234 ----*foo
15235 !! result
15236 <hr><span typeof="mw:Nowiki">----</span>
15237 <hr>=foo=
15238 <hr>*foo
15239 !! end
15240
15241 #### --------------- Tables ---------------
15242 #### 1a. Simple example
15243 #### 1b. No escaping needed (!foo)
15244 #### 1c. No escaping needed (|foo)
15245 #### 1d. No escaping needed (|}foo)
15246 ####
15247 #### 2a. Nested in td (<td>foo|bar</td>)
15248 #### 2b. Nested in td (<td>foo||bar</td>)
15249 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15250 ####
15251 #### 3a. Nested in th (<th>foo!bar</th>)
15252 #### 3b. Nested in th (<th>foo!!bar</th>)
15253 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15254 ####
15255 #### 4a. Escape -
15256 #### 4b. Escape +
15257 #### 4c. No escaping needed
15258 #### --------------------------------------
15259
15260 !! test
15261 Tables: 1a. Simple example
15262 !! input
15263 <nowiki>{|
15264 |}</nowiki>
15265 !! result
15266 <p>{|
15267 |}
15268 </p>
15269 !! end
15270
15271 !! test
15272 Tables: 1b. No escaping needed
15273 !! input
15274 !foo
15275 !! result
15276 <p>!foo
15277 </p>
15278 !! end
15279
15280 !! test
15281 Tables: 1c. No escaping needed
15282 !! input
15283 |foo
15284 !! result
15285 <p>|foo
15286 </p>
15287 !! end
15288
15289 !! test
15290 Tables: 1d. No escaping needed
15291 !! input
15292 |}foo
15293 !! result
15294 <p>|}foo
15295 </p>
15296 !! end
15297
15298 !! test
15299 Tables: 2a. Nested in td
15300 !! options
15301 parsoid
15302 !! input
15303 {|
15304 |<nowiki>foo|bar</nowiki>
15305 |}
15306 !! result
15307 <table><tbody><tr>
15308 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15309 !! end
15310
15311 !! test
15312 Tables: 2b. Nested in td
15313 !! options
15314 parsoid
15315 !! input
15316 {|
15317 |<nowiki>foo||bar</nowiki>
15318 |''it''<nowiki>foo||bar</nowiki>
15319 |}
15320 !! result
15321 <table><tbody><tr>
15322 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15323 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15324 !! end
15325
15326 !! test
15327 Tables: 2c. Nested in td -- no escaping needed
15328 !! options
15329 parsoid
15330 !! input
15331 {|
15332 |foo!!bar
15333 |}
15334 !! result
15335 <table><tbody><tr><td>foo!!bar
15336 </td></tr></tbody></table>
15337
15338 !! end
15339
15340 !! test
15341 Tables: 3a. Nested in th
15342 !! options
15343 parsoid
15344 !! input
15345 {|
15346 !foo!bar
15347 |}
15348 !! result
15349 <table><tbody><tr><th>foo!bar
15350 </th></tr></tbody></table>
15351
15352 !! end
15353
15354 !! test
15355 Tables: 3b. Nested in th
15356 !! options
15357 parsoid
15358 !! input
15359 {|
15360 !<nowiki>foo!!bar</nowiki>
15361 |}
15362 !! result
15363 <table>
15364 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15365 </tbody></table>
15366 !! end
15367
15368 !! test
15369 Tables: 3c. Nested in th -- no escaping needed
15370 !! options
15371 parsoid
15372 !! input
15373 {|
15374 !<nowiki>foo||bar</nowiki>
15375 |}
15376 !! result
15377 <table><tbody><tr>
15378 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15379 !! end
15380
15381 !! test
15382 Tables: 4a. Escape -
15383 !! options
15384 parsoid
15385 !! input
15386 {|
15387 |-
15388 !-bar
15389 |-
15390 |<nowiki>-bar</nowiki>
15391 |}
15392 !! result
15393 <table><tbody>
15394 <tr><th>-bar</th></tr>
15395 <tr>
15396 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15397 !! end
15398
15399 !! test
15400 Tables: 4b. Escape +
15401 !! options
15402 parsoid
15403 !! input
15404 {|
15405 |-
15406 !+bar
15407 |-
15408 |<nowiki>+bar</nowiki>
15409 |}
15410 !! result
15411 <table><tbody>
15412 <tr><th>+bar</th></tr>
15413 <tr>
15414 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15415 !! end
15416
15417 !! test
15418 Tables: 4c. No escaping needed
15419 !! options
15420 parsoid
15421 !! input
15422 {|
15423 |-
15424 |foo-bar
15425 |foo+bar
15426 |-
15427 |''foo''-bar
15428 |''foo''+bar
15429 |}
15430 !! result
15431 <table><tbody>
15432 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15433 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15434 </tbody></table>
15435 !! end
15436
15437 ### SSS FIXME: Disabled right now because accurate html2wt
15438 ### on this snippet requires data-parsoid flags that we've
15439 ### stripped out of these tests. We should scheme how we
15440 ### we want to handle these kind of tests that require
15441 ### data-parsoid flags for accurate html2wt serialization
15442
15443 !! test
15444 Tables: 4d. No escaping needed
15445 !! options
15446 disabled
15447 !! input
15448 {|
15449 ||+1
15450 ||-2
15451 |}
15452 !! result
15453 <table>
15454 <tr>
15455 <td>+1
15456 </td>
15457 <td>-2
15458 </td></tr></table>
15459
15460 !! end
15461
15462 #### --------------- Links ----------------
15463 #### 1. Quote marks in link text
15464 #### 2. Wikilinks: Escapes needed
15465 #### 3. Wikilinks: No escapes needed
15466 #### 4. Extlinks: Escapes needed
15467 #### 5. Extlinks: No escapes needed
15468 #### --------------------------------------
15469 !! test
15470 Links 1. Quote marks in link text
15471 !! options
15472 parsoid
15473 !! input
15474 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15475 !! result
15476 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15477 !! end
15478
15479 !! test
15480 Links 2. WikiLinks: Escapes needed
15481 !! options
15482 parsoid
15483 !! input
15484 [[Foo|<nowiki>[Foobar]</nowiki>]]
15485 [[Foo|<nowiki>Foobar]</nowiki>]]
15486 [[Foo|x [Foobar] x]]
15487 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15488 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15489 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15490 [[Foo|<nowiki>|Bar</nowiki>]]
15491 [[Foo|<nowiki>]]bar</nowiki>]]
15492 [[Foo|<nowiki>[[bar</nowiki>]]
15493 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15494 !! result
15495 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15496 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15497 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15498 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15499 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15500 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15501 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15502 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15503 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15504 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15505 !! end
15506
15507 !! test
15508 Links 3. WikiLinks: No escapes needed
15509 !! options
15510 parsoid
15511 !! input
15512 [[Foo|[Foobar]]
15513 [[Foo|foo|bar]]
15514 !! result
15515 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15516 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15517 !! end
15518
15519 !! test
15520 Links 4. ExtLinks: Escapes needed
15521 !! options
15522 parsoid
15523 !! input
15524 [http://google.com <nowiki>[google]</nowiki>]
15525 [http://google.com <nowiki>google]</nowiki>]
15526 !! result
15527 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15528 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15529 !! end
15530
15531 !! test
15532 Links 5. ExtLinks: No escapes needed
15533 !! options
15534 parsoid
15535 !! input
15536 [http://google.com [google]
15537 !! result
15538 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15539 !! end
15540
15541 #### --------------- Quotes ---------------
15542 #### 1. Quotes inside <b> and <i>
15543 #### 2. Link fragments separated by <i> and <b> tags
15544 #### 3. Link fragments inside <i> and <b>
15545 #### --------------------------------------
15546 !! test
15547 1. Quotes inside <b> and <i>
15548 !! input
15549 ''<nowiki>'foo'</nowiki>''
15550 ''<nowiki>''foo''</nowiki>''
15551 ''<nowiki>'''foo'''</nowiki>''
15552 ''foo''<nowiki>'s</nowiki>
15553 '''<nowiki>'foo'</nowiki>'''
15554 '''<nowiki>''foo''</nowiki>'''
15555 '''<nowiki>'''foo'''</nowiki>'''
15556 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15557 '''foo'''<nowiki>'s</nowiki>
15558 !! result
15559 <p><i>'foo'</i>
15560 <i>''foo''</i>
15561 <i>'''foo'''</i>
15562 <i>foo</i>'s
15563 <b>'foo'</b>
15564 <b>''foo''</b>
15565 <b>'''foo'''</b>
15566 <b>foo'<i>bar'</i>baz</b>
15567 <b>foo</b>'s
15568 </p>
15569 !! end
15570
15571 !! test
15572 2. Link fragments separated by <i> and <b> tags
15573 !! input
15574 [[''foo''<nowiki>hello]]</nowiki>
15575
15576 [['''foo'''<nowiki>hello]]</nowiki>
15577 !! result
15578 <p>[[<i>foo</i>hello]]
15579 </p><p>[[<b>foo</b>hello]]
15580 </p>
15581 !! end
15582
15583 !! test
15584 2. Link fragments inside <i> and <b>
15585 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15586 this is one of the shortcomings of this format)
15587 !! input
15588 ''[[foo''<nowiki>]]</nowiki>
15589
15590 '''[[foo'''<nowiki>]]</nowiki>
15591 !! result
15592 <p><i>[[foo</i>]]
15593 </p><p><b>[[foo</b>]]
15594 </p>
15595 !! end
15596
15597 #### ----------- Paragraphs ---------------
15598 #### 1. No unnecessary escapes
15599 #### --------------------------------------
15600
15601 !! test
15602 1. No unnecessary escapes
15603 !! input
15604 bar <span><nowiki>[[foo]]</nowiki></span>
15605
15606 =bar <span><nowiki>[[foo]]</nowiki></span>
15607
15608 [[bar <span><nowiki>[[foo]]</nowiki></span>
15609
15610 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15611
15612 =bar <span>foo]]</span><nowiki>=</nowiki>
15613 !! result
15614 <p>bar <span>[[foo]]</span>
15615 </p><p>=bar <span>[[foo]]</span>
15616 </p><p>[[bar <span>[[foo]]</span>
15617 </p><p>]]bar <span>[[foo]]</span>
15618 </p><p>=bar <span>foo]]</span>=
15619 </p>
15620 !!end
15621
15622 #### ----------------------- PRE --------------------------
15623 #### 1. Leading whitespace in SOL context should be escaped
15624 #### ------------------------------------------------------
15625 !! test
15626 1. Leading whitespace in SOL context should be escaped
15627 !! options
15628 parsoid
15629 !! input
15630 <nowiki> a</nowiki>
15631
15632 <nowiki> a</nowiki>
15633
15634 <nowiki> a(tab)</nowiki>
15635
15636 <nowiki> a</nowiki>
15637 <!--cmt-->
15638 <nowiki> a</nowiki>
15639
15640 <nowiki>a
15641 b</nowiki>
15642
15643 <nowiki>a
15644 b</nowiki>
15645
15646 <nowiki>a
15647 b</nowiki>
15648 !! result
15649 <p> a</p>
15650 <p> a</p>
15651 <p> a(tab)</p>
15652 <p> a</p>
15653 <p><!--cmt--> a</p>
15654 <p>a
15655 b</p>
15656 <p>a
15657 b</p>
15658 <p>a
15659 b</p>
15660 !! end
15661
15662 #### --------------- HTML tags ---------------
15663 #### 1. a tags
15664 #### 2. other tags
15665 #### 3. multi-line html tag
15666 #### -----------------------------------------
15667 !! test
15668 1. a tags
15669 !! options
15670 parsoid
15671 !! input
15672 <a href="http://google.com">google</a>
15673 !! result
15674 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15675 !! end
15676
15677 !! test
15678 2. other tags
15679 !! input
15680 <nowiki><div>foo</div>
15681 <div style="color:red">foo</div></nowiki>
15682 !! result
15683 <p>&lt;div&gt;foo&lt;/div&gt;
15684 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15685 </p>
15686 !! end
15687
15688 !! test
15689 3. multi-line html tag
15690 !! input
15691 <nowiki><div
15692 >foo</div
15693 ></nowiki>
15694 !! result
15695 <p>&lt;div
15696 &gt;foo&lt;/div
15697 &gt;
15698 </p>
15699 !! end
15700
15701 !! test
15702 4. extension tags
15703 !! input
15704 <nowiki><ref>foo</ref></nowiki>
15705 !! result
15706 <p>&lt;ref&gt;foo&lt;/ref&gt;
15707 </p>
15708 !! end
15709
15710 #### --------------- Others ---------------
15711 !! test
15712 Escaping nowikis
15713 !! input
15714 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15715 !! result
15716 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15717 </p>
15718 !! end
15719 !! test
15720
15721 Tag-like HTML structures are passed through as text
15722 !! input
15723 <x y>
15724
15725 <x.y>
15726
15727 <x-y>
15728
15729 1>2
15730
15731 x<y
15732
15733 a>b
15734
15735 1<d e>f
15736 !! result
15737 <p>&lt;x y&gt;
15738 </p><p>&lt;x.y&gt;
15739 </p><p>&lt;x-y&gt;
15740 </p><p>1&gt;2
15741 </p><p>x&lt;y
15742 </p><p>a&gt;b
15743 </p><p>1&lt;d e&gt;f
15744 </p>
15745 !! end
15746
15747
15748 # This fails in the PHP parser (see bug 40670,
15749 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15750 !! test
15751 Tag names followed by punctuation should not be recognized as tags
15752 !! options
15753 parsoid
15754 !! input
15755 <s.ome> text
15756 !! result
15757 <p>&lt;s.ome&gt; text
15758 </p>
15759 !! end
15760
15761 !! test
15762 HTML tag with necessary entities in attributes
15763 !! input
15764 <span title="&amp;amp;">foo</span>
15765 !! result
15766 <p><span title="&amp;amp;">foo</span>
15767 </p>
15768 !! end
15769
15770 !! test
15771 HTML tag with 'unnecessary' entity encoding in attributes
15772 !! input
15773 <span title="&amp;">foo</span>
15774 !! result
15775 <p><span title="&amp;">foo</span>
15776 </p>
15777 !! end
15778
15779 !! test
15780 HTML tag with broken attribute value quoting
15781 !! input
15782 <span title="Hello world>Foo</span>
15783 !! result
15784 <p><span>Foo</span>
15785 </p>
15786 !! end
15787
15788 !! test
15789 Parsoid-only: HTML tag with broken attribute value quoting
15790 !! options
15791 parsoid
15792 !! input
15793 <span title="Hello world>Foo</span>
15794 !! result
15795 <p><span title="Hello world">Foo</span>
15796 </p>
15797 !! end
15798
15799 !! test
15800 Table with broken attribute value quoting
15801 !! input
15802 {|
15803 | title="Hello world|Foo
15804 |}
15805 !! result
15806 <table>
15807 <tr>
15808 <td>Foo
15809 </td></tr></table>
15810
15811 !! end
15812
15813 !! test
15814 Table with broken attribute value quoting on consecutive lines
15815 !! input
15816 {|
15817 | title="Hello world|Foo
15818 | style="color:red|Bar
15819 |}
15820 !! result
15821 <table>
15822 <tr>
15823 <td>Foo
15824 </td>
15825 <td>Bar
15826 </td></tr></table>
15827
15828 !! end
15829
15830 !! test
15831 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15832 !! options
15833 parsoid
15834 !! input
15835 {|
15836 | title="Hello world|Foo
15837 | style="color:red|Bar
15838 |}
15839 !! result
15840 <table><tbody>
15841 <tr>
15842 <td title="Hello world">Foo
15843 </td><td style="color: red">Bar
15844 </td></tr></tbody></table>
15845
15846 !! end
15847
15848 !! test
15849 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15850 !! options
15851 parsoid
15852 !! input
15853 {{}}
15854 !! result
15855 {{}}
15856 !! end
15857
15858 !! test
15859 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15860 !! options
15861 parsoid
15862 !! input
15863 }}{{
15864 !! result
15865 }}{{
15866 !! end
15867
15868 !!test
15869 Accept empty td cell attribute
15870 !!input
15871 {|
15872 | align="center" | foo || |
15873 |}
15874 !!result
15875 <table>
15876 <tr>
15877 <td align="center"> foo </td>
15878 <td>
15879 </td></tr></table>
15880
15881 !!end
15882
15883 !!test
15884 Non-empty attributes in th-cells
15885 !!input
15886 {|
15887 ! Foo !! style="color: red" | Bar
15888 |}
15889 !!result
15890 <table>
15891 <tr>
15892 <th> Foo </th>
15893 <th style="color: red"> Bar
15894 </th></tr></table>
15895
15896 !!end
15897
15898 !!test
15899 Accept empty attributes in th-cells
15900 !!input
15901 {|
15902 !| foo !!| bar
15903 |}
15904 !!result
15905 <table>
15906 <tr>
15907 <th> foo </th>
15908 <th> bar
15909 </th></tr></table>
15910
15911 !!end
15912
15913 !!test
15914 Empty table rows go away
15915 !!input
15916 {|
15917 | Hello
15918 | there
15919 |- class="foo"
15920 |-
15921 |}
15922 !! result
15923 <table>
15924 <tr>
15925 <td> Hello
15926 </td>
15927 <td> there
15928 </td></tr>
15929
15930 </table>
15931
15932 !! end
15933
15934 ###
15935 ### Parsoid-centric tests for testing RTing of inter-element separators
15936 ### Edge cases not tested by existing parser tests and specific to
15937 ### Parsoid-specific serialization strategies.
15938 ###
15939
15940 !!test
15941 RT-ed inter-element separators should be valid separators
15942 !!input
15943 {|
15944 |- [[foo]]
15945 |}
15946 !!result
15947 <table>
15948
15949 </table>
15950
15951 !!end
15952
15953 !!test
15954 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15955 (Parsoid-only since PHP parser relies on Tidy for correct output)
15956 !!options
15957 parsoid
15958 !!input
15959 {|
15960 |<small>foo
15961 bar
15962 |}
15963
15964 {|
15965 |<small>foo<small>
15966 |}
15967 !!result
15968 !!end
15969
15970 !!test
15971 Empty TD followed by TD with tpl-generated attribute
15972 !!input
15973 {|
15974 |-
15975 |
15976 |{{echo|style='color:red'}}|foo
15977 |}
15978 !!result
15979 <table>
15980
15981 <tr>
15982 <td>
15983 </td>
15984 <td>foo
15985 </td></tr></table>
15986
15987 !!end
15988
15989 !!test
15990 Indented table with an empty td
15991 !!input
15992 {|
15993 |-
15994 |
15995 |foo
15996 |}
15997 !!result
15998 <table>
15999
16000 <tr>
16001 <td>
16002 </td>
16003 <td>foo
16004 </td></tr></table>
16005
16006 !!end
16007
16008 !!test
16009 Empty TR followed by a template-generated TR
16010 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16011 !!options
16012 parsoid=wt2html,wt2wt
16013 !!input
16014 {|
16015 |-
16016 {{echo|<tr><td>foo</td></tr>}}
16017 |}
16018 !!result
16019 <table>
16020 <tbody>
16021 <tr></tr>
16022 <tr typeof="mw:Transclusion">
16023 <td>foo</td></tr></tbody></table>
16024 !!end
16025
16026 ## PHP and parsoid output differ for this, and since this is primarily
16027 ## for testing Parsoid's serializer, marking this Parsoid only
16028 !!test
16029 Empty TR followed by mixed-ws-comment line should RT correctly
16030 !!options
16031 parsoid
16032 !!input
16033 {|
16034 |-
16035 <!--c-->
16036 |-
16037 <!--c--> <!--d-->
16038 |}
16039 !!result
16040 <table>
16041 <tbody>
16042 <tr>
16043 <td> <!--c--></td></tr>
16044 <tr>
16045 <td><!--c--> <!--d--></td></tr>
16046 </tbody></table>
16047
16048 !!end
16049
16050 !!test
16051 Multi-line image caption generated by templates with/without trailing newlines
16052 !!options
16053 parsoid
16054 !!input
16055 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16056 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16057 !!result
16058 <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>
16059 <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>
16060
16061 !!end
16062
16063 ## PHP emits broken html for this, and since this is primarily
16064 ## a Parsoid serializer test, marking this Parsoid only
16065 !!test
16066 Improperly nested inline or quotes tags with whitespace in between
16067 !!options
16068 parsoid
16069 !!input
16070 <span> <s>x</span> </s>
16071 ''' ''x''' ''
16072 !!result
16073 <p><span> <s>x</s></span><s> </s>
16074 <b> <i>x</i></b><i> </i>
16075 </p>
16076 !!end
16077
16078 # -----------------------------------------------------------------
16079 # The following section of tests are primarily to spec requirements
16080 # around serialization of new/edited content.
16081 #
16082 # All these tests are marked Parsoid html2wt and html2html only
16083 # ----------------------------------------------------------------
16084
16085 !! test
16086 Image: Modifying size of an image
16087 !! options
16088 parsoid=html2wt
16089 !! input
16090 [[Image:Wiki.png|230x230px]]
16091 !! result
16092 <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>
16093 !!end
16094
16095 !! test
16096 Image: New block level image should have \n before and after
16097 !! options
16098 parsoid=html2wt
16099 !! input
16100 123
16101 [[File:Wiki.png|right|thumb|150x150px]]
16102 456
16103 !! result
16104 <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>
16105 !!end
16106
16107 !! test
16108 Lists: Add space after bullets
16109 !! options
16110 parsoid=html2wt
16111 !! input
16112
16113 * foo
16114 * bar
16115 * <span> baz</span>
16116 !! result
16117 <ul>
16118 <li>foo</li>
16119 <li> bar</li>
16120 <li><span> baz</span></li>
16121 </ul>
16122 !! end
16123
16124 TODO:
16125 more images
16126 more tables
16127 character entities
16128 and much more
16129 Try for 100% code coverage