Merge "add and use updateExternalDBGroups function, fixes #49641"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Extra newlines: More paragraphs with indented comment
308 !! input
309 a
310
311 <!--boo-->
312
313 b
314 !!result
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 !!end
320
321 !! test
322 Extra newlines followed by heading
323 !! input
324 a
325
326
327
328 =b=
329 [[a]]
330
331
332 =b=
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
342
343 !! end
344
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
348 =b=
349
350
351
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p>
357 !! end
358
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
368
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
378
379 !! end
380
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
416
417 !! end
418
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
426 </p>
427 !! end
428
429 ###
430 ### 2-quote opening sequence tests
431 ###
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
450
451
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
460
461
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
465 php
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
483
484
485 ###
486 ### 3-quote opening sequence tests
487 ###
488
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
497
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
517
518
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
522 php
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
540
541
542 ###
543 ### 4-quote opening sequence tests
544 ###
545
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
554
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
574
575
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
579 php
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
597
598
599 ###
600 ### 5-quote opening sequence tests
601 ###
602
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
606 php
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
634
635
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
644
645
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
654
655 ###
656 ### multiple quote sequences in a line
657 ###
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
691 php
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
714 php
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
732
733 ###
734 ### other quote tests
735 ###
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
744
745
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
764
765
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
774 php
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
792
793
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
812
813 !! test
814 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
815 (Requires tidy for PHP parser output to be fixed up)
816 !! options
817 parsoid=wt2html,wt2wt
818 !! input
819 {|
820 !''a!!''b
821 |''a||''b
822 |}
823 !! result
824 <table>
825 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
826 <td><i>a</i></td><td><i>b</i></td></tr>
827 </tbody></table>
828 !! end
829
830 ###
831 ### Non-html5 tags
832 ###
833
834 !! test
835 Non-html5 tags should be accepted
836 !! input
837 <center>''foo''</center>
838 <big>''foo''</big>
839 <font>''foo''</font>
840 <strike>''foo''</strike>
841 <tt>''foo''</tt>
842 !! result
843 <center><i>foo</i></center>
844 <p><big><i>foo</i></big>
845 <font><i>foo</i></font>
846 <strike><i>foo</i></strike>
847 <tt><i>foo</i></tt>
848 </p>
849 !! end
850
851 ###
852 ### <nowiki> test cases
853 ###
854
855 !! test
856 <nowiki> unordered list
857 !! input
858 <nowiki>* This is not an unordered list item.</nowiki>
859 !! result
860 <p>* This is not an unordered list item.
861 </p>
862 !! end
863
864 !! test
865 <nowiki> spacing
866 !! input
867 <nowiki>Lorem ipsum dolor
868
869 sed abit.
870 sed nullum.
871
872 :and a colon
873 </nowiki>
874 !! result
875 <p>Lorem ipsum dolor
876
877 sed abit.
878 sed nullum.
879
880 :and a colon
881
882 </p>
883 !! end
884
885 !! test
886 nowiki 3
887 !! input
888 :There is not nowiki.
889 :There is <nowiki>nowiki</nowiki>.
890
891 #There is not nowiki.
892 #There is <nowiki>nowiki</nowiki>.
893
894 *There is not nowiki.
895 *There is <nowiki>nowiki</nowiki>.
896 !! result
897 <dl><dd>There is not nowiki.
898 </dd><dd>There is nowiki.
899 </dd></dl>
900 <ol><li>There is not nowiki.
901 </li><li>There is nowiki.
902 </li></ol>
903 <ul><li>There is not nowiki.
904 </li><li>There is nowiki.
905 </li></ul>
906
907 !! end
908
909 !! test
910 Entities inside <nowiki>
911 !! input
912 <nowiki>&lt;</nowiki>
913 !! result
914 <p>&lt;
915 </p>
916 !! end
917
918 !! test
919 Entities inside template parameters
920 !! options
921 parsoid
922 !! input
923 {{echo|&ndash;}}
924 !! result
925 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
926 </p>
927 !! end
928
929 ###
930 ### Comments
931 ###
932 !! test
933 Comments and Indent-Pre
934 !! input
935 <!-- comment 1 --> asdf
936
937 <!-- comment 1 --> asdf
938 <!-- comment 2 -->
939
940 <!-- comment 1 --> asdf
941 <!-- comment 2 -->xyz
942
943 <!-- comment 1 --> asdf
944 <!-- comment 2 --> xyz
945 !! result
946 <pre>asdf
947 </pre>
948 <pre>asdf
949 </pre>
950 <pre>asdf
951 </pre>
952 <p>xyz
953 </p>
954 <pre>asdf
955 xyz
956 </pre>
957 !! end
958
959 !! test
960 Comment test 2a
961 !! input
962 asdf
963 <!-- comment 1 -->
964 jkl
965 !! result
966 <p>asdf
967 jkl
968 </p>
969 !! end
970
971 !! test
972 Comment test 2b
973 !! input
974 asdf
975 <!-- comment 1 -->
976
977 jkl
978 !! result
979 <p>asdf
980 </p><p>jkl
981 </p>
982 !! end
983
984 !! test
985 Comment test 3
986 !! input
987 asdf
988 <!-- comment 1 -->
989 <!-- comment 2 -->
990 jkl
991 !! result
992 <p>asdf
993 jkl
994 </p>
995 !! end
996
997 !! test
998 Comment test 4
999 !! input
1000 asdf<!-- comment 1 -->jkl
1001 !! result
1002 <p>asdfjkl
1003 </p>
1004 !! end
1005
1006 !! test
1007 Comment spacing
1008 !! input
1009 a
1010 <!-- foo --> b <!-- bar -->
1011 c
1012 !! result
1013 <p>a
1014 </p>
1015 <pre> b
1016 </pre>
1017 <p>c
1018 </p>
1019 !! end
1020
1021 !! test
1022 Comment whitespace
1023 !! input
1024 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1025 !! result
1026
1027 !! end
1028
1029 !! test
1030 Comment semantics and delimiters
1031 !! input
1032 <!-- --><!----><!-----><!------>
1033 !! result
1034
1035 !! end
1036
1037 !! test
1038 Comment semantics and delimiters, redux
1039 !! input
1040 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1041 -- foo -- funky huh? ... -->
1042 !! result
1043
1044 !! end
1045
1046 !! test
1047 Comment semantics and delimiters: directors cut
1048 !! input
1049 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1050 everything starting with < followed by !-- until the first -- and > we see,
1051 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1052 -->-->
1053 !! result
1054 <p>--&gt;
1055 </p>
1056 !! end
1057
1058 !! test
1059 Comment semantics: nesting
1060 !! input
1061 <!--<!-- no, we're not going to do anything fancy here -->-->
1062 !! result
1063 <p>--&gt;
1064 </p>
1065 !! end
1066
1067 !! test
1068 Comment semantics: unclosed comment at end
1069 !! input
1070 <!--This comment will run out to the end of the document
1071 !! result
1072
1073 !! end
1074
1075 !! test
1076 Comment in template title
1077 !! input
1078 {{f<!---->oo}}
1079 !! result
1080 <p>FOO
1081 </p>
1082 !! end
1083
1084 !! test
1085 Comment on its own line post-expand
1086 !! input
1087 a
1088 {{blank}}<!---->
1089 b
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment on its own line post-expand with non-significant whitespace
1098 !! input
1099 a
1100 {{blank}} <!---->
1101 b
1102 !! result
1103 <p>a
1104 </p><p>b
1105 </p>
1106 !! end
1107
1108 ###
1109 ### paragraph wraping tests
1110 ###
1111 !! test
1112 No block tags
1113 !! input
1114 a
1115
1116 b
1117 !! result
1118 <p>a
1119 </p><p>b
1120 </p>
1121 !! end
1122 !! test
1123 Block tag on one line
1124 !! input
1125 a <div>foo</div>
1126
1127 b
1128 !! result
1129 a <div>foo</div>
1130 <p>b
1131 </p>
1132 !! end
1133
1134 !! test
1135 Block tag on both lines
1136 !! input
1137 a <div>foo</div>
1138
1139 b <div>foo</div>
1140 !! result
1141 a <div>foo</div>
1142 b <div>foo</div>
1143
1144 !! end
1145
1146 !! test
1147 Multiple lines without block tags
1148 !! input
1149 <div>foo</div> a
1150 b
1151 c
1152 d<!--foo--> e
1153 x <div>foo</div> z
1154 !! result
1155 <div>foo</div> a
1156 <p>b
1157 c
1158 d e
1159 </p>
1160 x <div>foo</div> z
1161
1162 !! end
1163
1164 !! test
1165 Empty lines between lines with block tags
1166 !! input
1167 <div></div>
1168
1169
1170 <div></div>a
1171
1172 b
1173 <div>a</div>b
1174
1175 <div>b</div>d
1176
1177
1178 <div>e</div>
1179 !! result
1180 <div></div>
1181 <p><br />
1182 </p>
1183 <div></div>a
1184 <p>b
1185 </p>
1186 <div>a</div>b
1187 <div>b</div>d
1188 <p><br />
1189 </p>
1190 <div>e</div>
1191
1192 !! end
1193
1194 ###
1195 ### Preformatted text
1196 ###
1197 !! test
1198 Preformatted text
1199 !! input
1200 This is some
1201 Preformatted text
1202 With ''italic''
1203 And '''bold'''
1204 And a [[Main Page|link]]
1205 !! result
1206 <pre>This is some
1207 Preformatted text
1208 With <i>italic</i>
1209 And <b>bold</b>
1210 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1211 </pre>
1212 !! end
1213
1214 !! test
1215 Ident preformatting with inline content
1216 !! input
1217 a
1218 ''b''
1219 !! result
1220 <pre>a
1221 <i>b</i>
1222 </pre>
1223 !! end
1224
1225 !! test
1226 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1227 !! input
1228 <pre><nowiki>
1229 <b>
1230 <cite>
1231 <em>
1232 </nowiki></pre>
1233 !! result
1234 <pre>
1235 &lt;b&gt;
1236 &lt;cite&gt;
1237 &lt;em&gt;
1238 </pre>
1239
1240 !! end
1241
1242 !! test
1243 Regression with preformatted in <center>
1244 !! input
1245 <center>
1246 Blah
1247 </center>
1248 !! result
1249 <center>
1250 <pre>Blah
1251 </pre>
1252 </center>
1253
1254 !! end
1255
1256 # Expected output in the following test is not really expected (there should be
1257 # <pre> in the output) -- it's only testing for well-formedness.
1258 !! test
1259 Bug 6200: Preformatted in <blockquote>
1260 !! input
1261 <blockquote>
1262 Blah
1263 </blockquote>
1264 !! result
1265 <blockquote>
1266 Blah
1267 </blockquote>
1268
1269 !! end
1270
1271 !! test
1272 <pre> with attributes (bug 3202)
1273 !! input
1274 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1275 !! result
1276 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1277
1278 !! end
1279
1280 !! test
1281 <pre> with width attribute (bug 3202)
1282 !! input
1283 <pre width="8">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8">Narrow screen goodies</pre>
1286
1287 !! end
1288
1289 !! test
1290 <pre> with forbidden attribute (bug 3202)
1291 !! input
1292 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1293 !! result
1294 <pre width="8">Narrow screen goodies</pre>
1295
1296 !! end
1297
1298 !! test
1299 Entities inside <pre>
1300 !! input
1301 <pre>&lt;</pre>
1302 !! result
1303 <pre>&lt;</pre>
1304
1305 !! end
1306
1307 !! test
1308 <pre> with forbidden attribute values (bug 3202)
1309 !! input
1310 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1311 !! result
1312 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1313
1314 !! end
1315
1316 !! test
1317 <nowiki> inside <pre> (bug 13238)
1318 !! input
1319 <pre>
1320 <nowiki>
1321 </pre>
1322 <pre>
1323 <nowiki></nowiki>
1324 </pre>
1325 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <pre>
1331
1332 </pre>
1333 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1334
1335 !! end
1336
1337 !! test
1338 <nowiki> and <pre> preference (first one wins)
1339 !! input
1340 <pre>
1341 <nowiki>
1342 </pre>
1343 </nowiki>
1344 </pre>
1345
1346 <nowiki>
1347 <pre>
1348 <nowiki>
1349 </pre>
1350 </nowiki>
1351 </pre>
1352
1353 !! result
1354 <pre>
1355 &lt;nowiki&gt;
1356 </pre>
1357 <p>&lt;/nowiki&gt;
1358 &lt;/pre&gt;
1359 </p><p>
1360 &lt;pre&gt;
1361 &lt;nowiki&gt;
1362 &lt;/pre&gt;
1363
1364 &lt;/pre&gt;
1365 </p>
1366 !! end
1367
1368 !! test
1369 </pre> inside nowiki
1370 !! input
1371 <nowiki></pre></nowiki>
1372 !! result
1373 <p>&lt;/pre&gt;
1374 </p>
1375 !! end
1376
1377 !!test
1378 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1379 !!input
1380 {{echo|}}
1381 !!result
1382
1383 !!end
1384
1385 !!test
1386 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1387 !!input
1388 {{echo|
1389 foo}}
1390 !!result
1391 <p>foo
1392 </p>
1393 !!end
1394
1395 !! test
1396 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1397 !! input
1398 {{echo|a
1399 b}}
1400 !!result
1401 <pre>a
1402 </pre>
1403 <p>b
1404 </p>
1405 !!end
1406
1407 !! test
1408 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1409 !! input
1410 {{echo|a
1411 b
1412 c
1413 d
1414 e
1415 }}
1416 !!result
1417 <pre>a
1418 </pre>
1419 <p>b
1420 c
1421 </p>
1422 <pre>d
1423 </pre>
1424 <p>e
1425 </p>
1426 !!end
1427
1428 !!test
1429 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1430 !!input
1431 {{echo| foo}}
1432
1433 {{echo| foo}}{{echo| bar}}
1434
1435 {{echo| foo}}
1436 {{echo| bar}}
1437
1438 {{echo|<!--cmt--> foo}}
1439
1440 <!--cmt-->{{echo| foo}}
1441
1442 {{echo|{{echo| }}bar}}
1443 !!result
1444 <pre>foo
1445 </pre>
1446 <pre>foo bar
1447 </pre>
1448 <pre>foo
1449 bar
1450 </pre>
1451 <pre>foo
1452 </pre>
1453 <pre>foo
1454 </pre>
1455 <pre>bar
1456 </pre>
1457 !!end
1458
1459 !! test
1460 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1461 !! input
1462 {{echo| }}a
1463
1464 {{echo|
1465 }}a
1466
1467 {{echo|
1468 b}}
1469
1470 {{echo|a
1471 }}b
1472
1473 {{echo|a
1474 }} b
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p><br />
1479 </p>
1480 <pre>a
1481 </pre>
1482 <p><br />
1483 </p>
1484 <pre>b
1485 </pre>
1486 <p>a
1487 </p>
1488 <pre>b
1489 </pre>
1490 <p>a
1491 </p>
1492 <pre>b
1493 </pre>
1494 !!end
1495
1496 !! test
1497 Templates: Single-line variant of parameter whitespace stripping test
1498 !! input
1499 {{echo| a}}
1500
1501 {{echo|1= a}}
1502
1503 {{echo|{{echo| a}}}}
1504
1505 {{echo|1={{echo| a}}}}
1506 !! result
1507 <pre>a
1508 </pre>
1509 <p>a
1510 </p>
1511 <pre>a
1512 </pre>
1513 <p>a
1514 </p>
1515 !! end
1516
1517 !! test
1518 Templates: Strip whitespace from named parameters, but not positional ones
1519 !! input
1520 {{echo|
1521 foo}}
1522
1523 {{echo|
1524 * foo}}
1525
1526 {{echo| 1 =
1527 foo}}
1528
1529 {{echo| 1 =
1530 * foo}}
1531 !! result
1532 <pre>foo
1533 </pre>
1534 <p><br />
1535 </p>
1536 <ul><li> foo
1537 </li></ul>
1538 <p>foo
1539 </p>
1540 <ul><li> foo
1541 </li></ul>
1542
1543 !! end
1544
1545 !! test
1546 Templates: Dont strip whitespace from whitespace/comment-only arguments
1547 !! input
1548 {{echo| }}
1549 {{echo|<!--cmt-->}}
1550 {{echo| <!--cmt--> }}
1551 !! result
1552 <p><br />
1553 </p>
1554 !! end
1555
1556 !! test
1557 Templates: Parsoid parameter escaping test 1
1558 !! options
1559 parsoid
1560 !! input
1561 {{echo|[foo]|{{echo|[bar]}}}}
1562 !! result
1563 <p about="#mwt1" typeof="mw:Transclusion"
1564 data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[foo]&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1565 !! end
1566
1567 !! test
1568 Parsoid: Pipes in external links in template parameter
1569 !! options
1570 parsoid
1571 !! input
1572 {{echo|[{{echo|http://example.com}} link]}}
1573 !! result
1574 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1575 !! end
1576
1577 !! test
1578 Parsoid: pipe in transclusion parameter
1579 !! options
1580 parsoid
1581 !! input
1582 {{echo|http://foo.com/a&#124;b}}
1583 !! result
1584 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1585 typeof="mw:Transclusion"
1586 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1587 !! end
1588
1589 !! test
1590 Parsoid: Pipe in external link target and content in template parameter
1591 !! options
1592 parsoid=html2wt,wt2wt
1593 !! input
1594 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1595 !! result
1596 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1597 typeof="mw:Transclusion"
1598 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1599 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1600 !! end
1601
1602 !! test
1603 Templates: Dont escape already nowiki-escaped text in template parameters
1604 !! options
1605 parsoid=html2wt,wt2wt
1606 !! input
1607 {{echo|foo<nowiki>|</nowiki>bar}}
1608 !! result
1609 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'>foo<span typeof="mw:Nowiki" data-parsoid="{}">|</span>bar</p>
1610 !! end
1611
1612 ###
1613 ### Parsoid-centric tests for testing RT edge cases for pre
1614 ###
1615
1616 !!test
1617 1a. Indent-Pre and Comments
1618 !!input
1619 a
1620 <!--a-->
1621 c
1622 !!result
1623 <pre>a
1624 </pre>
1625 <p>c
1626 </p>
1627 !!end
1628
1629 !!test
1630 1b. Indent-Pre and Comments
1631 !!input
1632 a
1633 <!--a-->
1634 c
1635 !!result
1636 <pre>a
1637 </pre>
1638 <p>c
1639 </p>
1640 !!end
1641
1642 !!test
1643 1c. Indent-Pre and Comments
1644 !!input
1645 <!--a--> a
1646
1647 <!--a--> a
1648 !!result
1649 <pre> a
1650 </pre>
1651 <pre> a
1652 </pre>
1653 !!end
1654
1655 !!test
1656 2a. Indent-Pre and tables
1657 !!input
1658 {|
1659 |-
1660 !h1!!h2
1661 |foo||bar
1662 |}
1663 !!result
1664 <table>
1665
1666 <tr>
1667 <th>h1</th>
1668 <th>h2
1669 </th>
1670 <td>foo</td>
1671 <td>bar
1672 </td></tr></table>
1673
1674 !!end
1675
1676 !!test
1677 2b. Indent-Pre and tables
1678 !!input
1679 {|
1680 |-
1681 |foo
1682 |}
1683 !!result
1684 <table>
1685
1686 <tr>
1687 <td>foo
1688 </td></tr></table>
1689
1690 !!end
1691
1692 !!test
1693 2c. Indent-Pre and tables (bug 42252)
1694 !!input
1695 {|
1696 |+ foo
1697 ! | bar
1698 |}
1699 !!result
1700 <table>
1701 <caption> foo
1702 </caption>
1703 <tr>
1704 <th> bar
1705 </th></tr></table>
1706
1707 !!end
1708
1709 !!test
1710 3a. Indent-Pre and block tags (single-line html)
1711 !!input
1712 <p> foo </p>
1713 <div> foo </div>
1714 <span> foo </span>
1715 !!result
1716 <p> foo </p>
1717 <div> foo </div>
1718 <pre><span> foo </span>
1719 </pre>
1720 !!end
1721
1722 !!test
1723 3b. Indent-Pre and block tags (pre-content on separate line)
1724 !!input
1725 <p>
1726 foo
1727 </p>
1728
1729 <div>
1730 foo
1731 </div>
1732
1733 <center>
1734 foo
1735 </center>
1736
1737 <blockquote>
1738 foo
1739 </blockquote>
1740
1741 <table><tr><td>
1742 foo
1743 </td></tr></table>
1744
1745 <ul><li>
1746 foo
1747 </li></ul>
1748
1749 !!result
1750 <p>
1751 foo
1752 </p>
1753 <div>
1754 <pre>foo
1755 </pre>
1756 </div>
1757 <center>
1758 <pre>foo
1759 </pre>
1760 </center>
1761 <blockquote>
1762 foo
1763 </blockquote>
1764 <table><tr><td>
1765 <pre>foo
1766 </pre>
1767 </td></tr></table>
1768 <ul><li>
1769 foo
1770 </li></ul>
1771
1772 !!end
1773
1774 !!test
1775 4. Multiple spaces at start-of-line
1776 !!input
1777 <p> foo </p>
1778 foo
1779 {|
1780 |foo
1781 |}
1782 !!result
1783 <p> foo </p>
1784 <pre> foo
1785 </pre>
1786 <table>
1787 <tr>
1788 <td>foo
1789 </td></tr></table>
1790
1791 !!end
1792
1793 !! test
1794 5. White-space in indent-pre
1795 NOTE: the white-space char on 2nd line is significant
1796 !! input
1797 a<br/>
1798
1799 b
1800 !! result
1801 <pre>a<br />
1802
1803 b
1804 </pre>
1805 !! end
1806
1807 ###
1808 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1809 ###
1810
1811 !!test
1812 HTML-pre: 1. embedded newlines
1813 !!input
1814 <pre>foo</pre>
1815
1816 <pre>
1817 foo
1818 </pre>
1819
1820 <pre>
1821
1822 foo
1823 </pre>
1824
1825 <pre>
1826
1827
1828 foo
1829 </pre>
1830 !!result
1831 <pre>foo</pre>
1832 <pre>
1833 foo
1834 </pre>
1835 <pre>
1836
1837 foo
1838 </pre>
1839 <pre>
1840
1841
1842 foo
1843 </pre>
1844
1845 !!end
1846
1847 !!test
1848 HTML-pre: 2: indented text
1849 !!input
1850 <pre>
1851 foo
1852 </pre>
1853 !!result
1854 <pre>
1855 foo
1856 </pre>
1857
1858 !!end
1859
1860 !!test
1861 HTML-pre: 3: other wikitext
1862 !!input
1863 <pre>
1864 * foo
1865 # bar
1866 = no-h =
1867 '' no-italic ''
1868 [[ NoLink ]]
1869 </pre>
1870 !!result
1871 <pre>
1872 * foo
1873 # bar
1874 = no-h =
1875 '' no-italic ''
1876 [[ NoLink ]]
1877 </pre>
1878
1879 !!end
1880
1881 ###
1882 ### Definition lists
1883 ###
1884 !! test
1885 Simple definition
1886 !! input
1887 ; name : Definition
1888 !! result
1889 <dl><dt> name&#160;</dt><dd> Definition
1890 </dd></dl>
1891
1892 !! end
1893
1894 !! test
1895 Definition list for indentation only
1896 !! input
1897 : Indented text
1898 !! result
1899 <dl><dd> Indented text
1900 </dd></dl>
1901
1902 !! end
1903
1904 !! test
1905 Definition list with no space
1906 !! input
1907 ;name:Definition
1908 !! result
1909 <dl><dt>name</dt><dd>Definition
1910 </dd></dl>
1911
1912 !!end
1913
1914 !! test
1915 Definition list with URL link
1916 !! input
1917 ; http://example.com/ : definition
1918 !! result
1919 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1920 </dd></dl>
1921
1922 !! end
1923
1924 !! test
1925 Definition list with bracketed URL link
1926 !! input
1927 ;[http://www.example.com/ Example]:Something about it
1928 !! result
1929 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1930 </dd></dl>
1931
1932 !! end
1933
1934 !! test
1935 Definition list with wikilink containing colon
1936 !! input
1937 ; [[Help:FAQ]]: The least-read page on Wikipedia
1938 !! result
1939 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1940 </dd></dl>
1941
1942 !! end
1943
1944 # At Brion's and JeLuF's insistence... :)
1945 !! test
1946 Definition list with news link containing colon
1947 !! input
1948 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1949 !! result
1950 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1951 </dd></dl>
1952
1953 !! end
1954
1955 !! test
1956 Malformed definition list with colon
1957 !! input
1958 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1959 !! result
1960 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1961 </dt></dl>
1962
1963 !! end
1964
1965 !! test
1966 Definition lists: colon in external link text
1967 !! input
1968 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1969 !! result
1970 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1971 </dd></dl>
1972
1973 !! end
1974
1975 !! test
1976 Definition lists: colon in HTML attribute
1977 !! input
1978 ;<b style="display: inline">bold</b>
1979 !! result
1980 <dl><dt><b style="display: inline">bold</b>
1981 </dt></dl>
1982
1983 !! end
1984
1985 !! test
1986 Definition lists: self-closed tag
1987 !! input
1988 ;one<br/>two : two-line fun
1989 !! result
1990 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1991 </dd></dl>
1992
1993 !! end
1994
1995 !! test
1996 Bug 11748: Literal closing tags
1997 !! input
1998 <dl>
1999 <dt>test 1</dt>
2000 <dd>test test test test test</dd>
2001 <dt>test 2</dt>
2002 <dd>test test test test test</dd>
2003 </dl>
2004 !! result
2005 <dl>
2006 <dt>test 1</dt>
2007 <dd>test test test test test</dd>
2008 <dt>test 2</dt>
2009 <dd>test test test test test</dd>
2010 </dl>
2011
2012 !! end
2013
2014 !! test
2015 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2016 !! input
2017 <ul><li>
2018 ; term : description
2019 * unordered
2020 </li>
2021 </ul>
2022 !! result
2023 <ul><li>
2024 <dl><dt> term&#160;</dt><dd> description
2025 </dd></dl>
2026 <ul><li> unordered
2027 </li></ul>
2028 </li>
2029 </ul>
2030
2031 !! end
2032
2033 !! test
2034
2035 Definition list with empty definition and following paragraph
2036 !! input
2037 ; term:
2038 Paragraph text
2039 !! result
2040 <dl><dt> term</dt><dd>
2041 </dd></dl>
2042 <p>Paragraph text
2043 </p>
2044 !! end
2045
2046 !! test
2047 Nested definition lists using html syntax
2048 !! input
2049 <dl><dd>
2050 <dl>
2051 <dd>Foo</dd>
2052 </dl>
2053 </dd></dl>
2054 !! result
2055 <dl><dd>
2056 <dl>
2057 <dd>Foo</dd>
2058 </dl>
2059 </dd></dl>
2060
2061 !! end
2062
2063 !! test
2064 Definition Lists: No nesting: Multiple dd's
2065 !! input
2066 ;x
2067 :a
2068 :b
2069 !! result
2070 <dl><dt>x
2071 </dt><dd>a
2072 </dd><dd>b
2073 </dd></dl>
2074
2075 !! end
2076
2077 !! test
2078 Definition Lists: Indentation: Regular
2079 !! input
2080 :i1
2081 ::i2
2082 :::i3
2083 !! result
2084 <dl><dd>i1
2085 <dl><dd>i2
2086 <dl><dd>i3
2087 </dd></dl>
2088 </dd></dl>
2089 </dd></dl>
2090
2091 !! end
2092
2093 !! test
2094 Definition Lists: Indentation: Missing 1st level
2095 !! input
2096 ::i2
2097 :::i3
2098 !! result
2099 <dl><dd><dl><dd>i2
2100 <dl><dd>i3
2101 </dd></dl>
2102 </dd></dl>
2103 </dd></dl>
2104
2105 !! end
2106
2107 !! test
2108 Definition Lists: Indentation: Multi-level indent
2109 !! input
2110 :::i3
2111 !! result
2112 <dl><dd><dl><dd><dl><dd>i3
2113 </dd></dl>
2114 </dd></dl>
2115 </dd></dl>
2116
2117 !! end
2118
2119 !! test
2120 Definition Lists: Hacky use to indent tables
2121 !! input
2122 ::{|
2123 |foo
2124 |bar
2125 |}
2126 this text
2127 should be left alone
2128 !! result
2129 <dl><dd><dl><dd><table>
2130 <tr>
2131 <td>foo
2132 </td>
2133 <td>bar
2134 </td></tr></table></dd></dl></dd></dl>
2135 <p>this text
2136 should be left alone
2137 </p>
2138 !! end
2139 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2140 ## as an empty dt item. It also ignores all but the last ";" when followed
2141 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2142 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2143 ## ";"s.
2144 ##
2145 ## Ex: ";;t2 ::d2" is transformed into:
2146 ##
2147 ## <dl>
2148 ## <dt>t2 </dt>
2149 ## <dd>
2150 ## <dl>
2151 ## <dt></dt>
2152 ## <dd>d2</dd>
2153 ## </dl>
2154 ## </dd>
2155 ## </dl>
2156 ##
2157 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2158 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2159 ##
2160 ## <dl>
2161 ## <dt>
2162 ## <dl>
2163 ## <dt>t2 </dt>
2164 ## <dd>:d2</dd>
2165 ## </dl>
2166 ## </dt>
2167 ## </dl>
2168 ##
2169 ## All Parsoid only definition list tests have this difference.
2170 ##
2171 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2172 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2173
2174 !! test
2175 Table / list interaction: indented table with lists in table contents
2176 !! input
2177 :{|
2178 |-
2179 | a
2180 * b
2181 |-
2182 | c
2183 * d
2184 |}
2185 !! result
2186 <dl><dd><table>
2187
2188 <tr>
2189 <td> a
2190 <ul><li> b
2191 </li></ul>
2192 </td></tr>
2193 <tr>
2194 <td> c
2195 <ul><li> d
2196 </li></ul>
2197 </td></tr></table></dd></dl>
2198
2199 !! end
2200
2201 !!test
2202 Table / list interaction: lists nested in tables nested in indented lists
2203 !!input
2204 :{|
2205 |
2206 :a
2207 :b
2208 |
2209 *c
2210 *d
2211 |}
2212
2213 *e
2214 *f
2215 !!result
2216 <dl><dd><table>
2217 <tr>
2218 <td>
2219 <dl><dd>a
2220 </dd><dd>b
2221 </dd></dl>
2222 </td>
2223 <td>
2224 <ul><li>c
2225 </li><li>d
2226 </li></ul>
2227 </td></tr></table></dd></dl>
2228 <ul><li>e
2229 </li><li>f
2230 </li></ul>
2231
2232 !!end
2233
2234 !! test
2235 Definition Lists: Nesting: Multi-level (Parsoid only)
2236 !! options
2237 parsoid
2238 !! input
2239 ;t1 :d1
2240 ;;t2 ::d2
2241 ;;;t3 :::d3
2242 !! result
2243 <dl>
2244 <dt>t1 </dt>
2245 <dd>d1</dd>
2246 <dt>
2247 <dl>
2248 <dt>t2 </dt>
2249 <dd>:d2</dd>
2250 <dt>
2251 <dl>
2252 <dt>t3 </dt>
2253 <dd>::d3</dd>
2254 </dl>
2255 </dt>
2256 </dl>
2257 </dt>
2258 </dl>
2259
2260
2261 !! end
2262
2263
2264 !! test
2265 Definition Lists: Nesting: Test 2 (Parsoid only)
2266 !! options
2267 parsoid
2268 !! input
2269 ;t1
2270 ::d2
2271 !! result
2272 <dl>
2273 <dt>t1</dt>
2274 <dd>
2275 <dl>
2276 <dd>d2</dd>
2277 </dl>
2278 </dd>
2279 </dl>
2280
2281 !! end
2282
2283
2284 !! test
2285 Definition Lists: Nesting: Test 3 (Parsoid only)
2286 !! options
2287 parsoid
2288 !! input
2289 :;t1
2290 ::::d2
2291 !! result
2292 <dl>
2293 <dd>
2294 <dl>
2295 <dt>t1</dt>
2296 <dd>
2297 <dl>
2298 <dd>
2299 <dl>
2300 <dd>d2</dd>
2301 </dl>
2302 </dd>
2303 </dl>
2304 </dd>
2305 </dl>
2306 </dd>
2307 </dl>
2308
2309 !! end
2310
2311
2312 !! test
2313 Definition Lists: Nesting: Test 4
2314 !! input
2315 ::;t3
2316 :::d3
2317 !! result
2318 <dl><dd><dl><dd><dl><dt>t3
2319 </dt><dd>d3
2320 </dd></dl>
2321 </dd></dl>
2322 </dd></dl>
2323
2324 !! end
2325
2326
2327 ## The Parsoid team believes the following three test exposes a
2328 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2329 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2330 !! test
2331 Definition Lists: Mixed Lists: Test 1 (php)
2332 !! options
2333 php
2334 !! input
2335 :;* foo
2336 ::* bar
2337 :; baz
2338 !! result
2339 <dl><dd><dl><dt><ul><li> foo
2340 </li><li> bar
2341 </li></ul>
2342 </dt></dl>
2343 <dl><dt> baz
2344 </dt></dl>
2345 </dd></dl>
2346
2347 !! end
2348 !! test
2349 Definition Lists: Mixed Lists: Test 1 (parsoid)
2350 !! options
2351 parsoid
2352 !! input
2353 :;* foo
2354 ::* bar
2355 :; baz
2356 !! result
2357 <dl><dd><dl><dt><ul><li> foo
2358 </li></ul></dt><dd><ul><li> bar
2359 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2360 !! end
2361
2362 !! test
2363 Definition Lists: Mixed Lists: Test 2
2364 !! input
2365 *: d1
2366 *: d2
2367 !! result
2368 <ul><li><dl><dd> d1
2369 </dd><dd> d2
2370 </dd></dl>
2371 </li></ul>
2372
2373 !! end
2374
2375
2376 !! test
2377 Definition Lists: Mixed Lists: Test 3
2378 !! input
2379 *::: d1
2380 *::: d2
2381 !! result
2382 <ul><li><dl><dd><dl><dd><dl><dd> d1
2383 </dd><dd> d2
2384 </dd></dl>
2385 </dd></dl>
2386 </dd></dl>
2387 </li></ul>
2388
2389 !! end
2390
2391
2392 !! test
2393 Definition Lists: Mixed Lists: Test 4
2394 !! input
2395 *;d1 :d2
2396 *;d3 :d4
2397 !! result
2398 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2399 </dd><dt>d3&#160;</dt><dd>d4
2400 </dd></dl>
2401 </li></ul>
2402
2403 !! end
2404
2405
2406 !! test
2407 Definition Lists: Mixed Lists: Test 5
2408 !! input
2409 *:d1
2410 *:: d2
2411 !! result
2412 <ul><li><dl><dd>d1
2413 <dl><dd> d2
2414 </dd></dl>
2415 </dd></dl>
2416 </li></ul>
2417
2418 !! end
2419
2420
2421 !! test
2422 Definition Lists: Mixed Lists: Test 6
2423 !! input
2424 #*:d1
2425 #*::: d3
2426 !! result
2427 <ol><li><ul><li><dl><dd>d1
2428 <dl><dd><dl><dd> d3
2429 </dd></dl>
2430 </dd></dl>
2431 </dd></dl>
2432 </li></ul>
2433 </li></ol>
2434
2435 !! end
2436
2437
2438 !! test
2439 Definition Lists: Mixed Lists: Test 7
2440 !! input
2441 :* d1
2442 :* d2
2443 !! result
2444 <dl><dd><ul><li> d1
2445 </li><li> d2
2446 </li></ul>
2447 </dd></dl>
2448
2449 !! end
2450
2451
2452 !! test
2453 Definition Lists: Mixed Lists: Test 8
2454 !! input
2455 :* d1
2456 ::* d2
2457 !! result
2458 <dl><dd><ul><li> d1
2459 </li></ul>
2460 <dl><dd><ul><li> d2
2461 </li></ul>
2462 </dd></dl>
2463 </dd></dl>
2464
2465 !! end
2466
2467
2468 !! test
2469 Definition Lists: Mixed Lists: Test 9
2470 !! input
2471 *;foo :bar
2472 !! result
2473 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2474 </dd></dl>
2475 </li></ul>
2476
2477 !! end
2478
2479
2480 !! test
2481 Definition Lists: Mixed Lists: Test 10
2482 !! input
2483 *#;foo :bar
2484 !! result
2485 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2486 </dd></dl>
2487 </li></ol>
2488 </li></ul>
2489
2490 !! end
2491
2492 # The Parsoid team disagrees with the PHP parser's seemingly-random
2493 # rules regarding dd/dt on the next two tests. Parsoid is more
2494 # consistent, and recognizes the shared nesting and keeps the
2495 # still-open tags around until the nesting is complete.
2496
2497 !! test
2498 Definition Lists: Mixed Lists: Test 11 (php)
2499 !! options
2500 php
2501 !! input
2502 *#*#;*;;foo :bar
2503 *#*#;boo :baz
2504 !! result
2505 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2506 </dt></dl>
2507 </dd></dl>
2508 </li></ul>
2509 </dd></dl>
2510 <dl><dt>boo&#160;</dt><dd>baz
2511 </dd></dl>
2512 </li></ol>
2513 </li></ul>
2514 </li></ol>
2515 </li></ul>
2516
2517 !! end
2518 !! test
2519 Definition Lists: Mixed Lists: Test 11 (parsoid)
2520 !! options
2521 parsoid
2522 !! input
2523 *#*#;*;;foo :bar
2524 *#*#;boo :baz
2525 !! result
2526 <ul>
2527 <li>
2528 <ol>
2529 <li>
2530 <ul>
2531 <li>
2532 <ol>
2533 <li>
2534 <dl>
2535 <dt>
2536 <ul>
2537 <li>
2538 <dl>
2539 <dt>
2540 <dl>
2541 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2542 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2543 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2544 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2545 !! end
2546
2547
2548 !! test
2549 Definition Lists: Weird Ones: Test 1 (php)
2550 !! options
2551 php
2552 !! input
2553 *#;*::;; foo : bar (who uses this?)
2554 !! result
2555 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2556 </dt></dl>
2557 </dd></dl>
2558 </dd></dl>
2559 </dd></dl>
2560 </li></ul>
2561 </dd></dl>
2562 </li></ol>
2563 </li></ul>
2564
2565 !! end
2566 !! test
2567 Definition Lists: Weird Ones: Test 1 (parsoid)
2568 !! options
2569 parsoid
2570 !! input
2571 *#;*::;; foo : bar (who uses this?)
2572 !! result
2573 <ul>
2574 <li>
2575 <ol>
2576 <li>
2577 <dl>
2578 <dt>
2579 <ul>
2580 <li>
2581 <dl>
2582 <dd>
2583 <dl>
2584 <dd>
2585 <dl>
2586 <dt>
2587 <dl>
2588 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2589 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2590 !! end
2591
2592 ###
2593 ### External links
2594 ###
2595 !! test
2596 External links: non-bracketed
2597 !! input
2598 Non-bracketed: http://example.com
2599 !! result
2600 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2601 </p>
2602 !! end
2603
2604 !! test
2605 External links: numbered
2606 !! input
2607 Numbered: [http://example.com]
2608 Numbered: [http://example.net]
2609 Numbered: [http://example.com]
2610 !! result
2611 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2612 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2613 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2614 </p>
2615 !!end
2616
2617 !! test
2618 External links: specified text
2619 !! input
2620 Specified text: [http://example.com link]
2621 !! result
2622 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2623 </p>
2624 !!end
2625
2626 !! test
2627 External links: trail
2628 !! input
2629 Linktrails should not work for external links: [http://example.com link]s
2630 !! result
2631 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2632 </p>
2633 !! end
2634
2635 !! test
2636 External links: dollar sign in URL
2637 !! input
2638 http://example.com/1$2345
2639 !! result
2640 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2641 </p>
2642 !! end
2643
2644 !! test
2645 External links: dollar sign in URL (named)
2646 !! input
2647 [http://example.com/1$2345]
2648 !! result
2649 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2650 </p>
2651 !!end
2652
2653 !! test
2654 External links: open square bracket forbidden in URL (bug 4377)
2655 !! input
2656 http://example.com/1[2345
2657 !! result
2658 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2659 </p>
2660 !! end
2661
2662 !! test
2663 External links: open square bracket forbidden in URL (named) (bug 4377)
2664 !! input
2665 [http://example.com/1[2345]
2666 !! result
2667 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2668 </p>
2669 !!end
2670
2671 !! test
2672 External links: nowiki in URL link text (bug 6230)
2673 !!input
2674 [http://example.com/ <nowiki>''example site''</nowiki>]
2675 !! result
2676 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2677 </p>
2678 !! end
2679
2680 !! test
2681 External links: newline forbidden in text (bug 6230 regression check)
2682 !! input
2683 [http://example.com/ first
2684 second]
2685 !! result
2686 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2687 second]
2688 </p>
2689 !!end
2690
2691 !! test
2692 External links: Pipe char between url and text
2693 !! input
2694 [http://example.com | link]
2695 !! result
2696 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2697 </p>
2698 !!end
2699
2700 !! test
2701 External links: protocol-relative URL in brackets
2702 !! input
2703 [//example.com/ Test]
2704 !! result
2705 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2706 </p>
2707 !! end
2708
2709 !! test
2710 External links: protocol-relative URL in brackets without text
2711 !! input
2712 [//example.com]
2713 !! result
2714 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2715 </p>
2716 !! end
2717
2718 !! test
2719 External links: protocol-relative URL in free text is left alone
2720 !! input
2721 //example.com/Foo
2722 !! result
2723 <p>//example.com/Foo
2724 </p>
2725 !!end
2726
2727 !! test
2728 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2729 !! input
2730 foo//example.com/Foo
2731 !! result
2732 <p>foo//example.com/Foo
2733 </p>
2734 !! end
2735
2736 !! test
2737 External image
2738 !! input
2739 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2740 !! result
2741 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2742 </p>
2743 !! end
2744
2745 !! test
2746 External image from https
2747 !! input
2748 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2749 !! result
2750 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2751 </p>
2752 !! end
2753
2754 !! test
2755 Link to non-http image, no img tag
2756 !! input
2757 Link to non-http image, no img tag: ftp://example.com/test.jpg
2758 !! result
2759 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2760 </p>
2761 !! end
2762
2763 !! test
2764 External links: terminating separator
2765 !! input
2766 Terminating separator: http://example.com/thing,
2767 !! result
2768 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2769 </p>
2770 !! end
2771
2772 !! test
2773 External links: intervening separator
2774 !! input
2775 Intervening separator: http://example.com/1,2,3
2776 !! result
2777 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2778 </p>
2779 !! end
2780
2781 !! test
2782 External links: old bug with URL in query
2783 !! input
2784 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2785 !! result
2786 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2787 </p>
2788 !! end
2789
2790 !! test
2791 External links: old URL-in-URL bug, mixed protocols
2792 !! input
2793 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2794 !! result
2795 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2796 </p>
2797 !!end
2798
2799 !! test
2800 External links: URL in text
2801 !! input
2802 URL in text: [http://example.com http://example.com]
2803 !! result
2804 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2805 </p>
2806 !! end
2807
2808 !! test
2809 External links: Clickable images
2810 !! input
2811 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2812 !! result
2813 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2814 </p>
2815 !!end
2816
2817 !! test
2818 External links: raw ampersand
2819 !! input
2820 Old &amp; use: http://x&y
2821 !! result
2822 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2823 </p>
2824 !! end
2825
2826 !! test
2827 External links: encoded ampersand
2828 !! input
2829 Old &amp; use: http://x&amp;y
2830 !! result
2831 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2832 </p>
2833 !! end
2834
2835 !! test
2836 External links: encoded equals (bug 6102)
2837 !! input
2838 http://example.com/?foo&#61;bar
2839 !! result
2840 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: [raw ampersand]
2846 !! input
2847 Old &amp; use: [http://x&y]
2848 !! result
2849 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2850 </p>
2851 !! end
2852
2853 !! test
2854 External links: [encoded ampersand]
2855 !! input
2856 Old &amp; use: [http://x&amp;y]
2857 !! result
2858 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2859 </p>
2860 !! end
2861
2862 !! test
2863 External links: [encoded equals] (bug 6102)
2864 !! input
2865 [http://example.com/?foo&#61;bar]
2866 !! result
2867 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2868 </p>
2869 !! end
2870
2871 !! test
2872 External links: [IDN ignored character reference in hostname; strip it right off]
2873 !! input
2874 [http://e&zwnj;xample.com/]
2875 !! result
2876 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2877 </p>
2878 !! end
2879
2880 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2881 # Where an external link could easily circumvent the sanitization of the text of
2882 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2883 # test demands a higher standard. That's a bit strange.
2884 #
2885 # Example:
2886 #
2887 # http://e‌xample.com -> [http://example.com|http://example.com]
2888 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2889 #
2890 # The first example is sanitized, but the second is not. Any security benefits
2891 # from this production are trivial to circumvent. Either remove this test and
2892 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2893 # the test accordingly.
2894 #
2895 # All our love,
2896 # The Parsoid team.
2897 !! test
2898 External links: IDN ignored character reference in hostname; strip it right off
2899 !! input
2900 http://e&zwnj;xample.com/
2901 !! result
2902 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2903 </p>
2904 !! end
2905
2906 !! test
2907 External links: www.jpeg.org (bug 554)
2908 !! input
2909 http://www.jpeg.org
2910 !!result
2911 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2912 </p>
2913 !! end
2914
2915 !! test
2916 External links: URL within URL (original bug 2)
2917 !! input
2918 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2919 !! result
2920 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2921 </p>
2922 !! end
2923
2924 !! test
2925 BUG 361: URL inside bracketed URL
2926 !! input
2927 [http://www.example.com/foo http://www.example.com/bar]
2928 !! result
2929 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2930 </p>
2931 !! end
2932
2933 !! test
2934 BUG 361: URL within URL, not bracketed
2935 !! input
2936 http://www.example.com/foo?=http://www.example.com/bar
2937 !! result
2938 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2939 </p>
2940 !! end
2941
2942 !! test
2943 BUG 289: ">"-token in URL-tail
2944 !! input
2945 http://www.example.com/<hello>
2946 !! result
2947 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2948 </p>
2949 !!end
2950
2951 !! test
2952 BUG 289: literal ">"-token in URL-tail
2953 !! input
2954 http://www.example.com/<b>html</b>
2955 !! result
2956 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2957 </p>
2958 !!end
2959
2960 !! test
2961 BUG 289: ">"-token in bracketed URL
2962 !! input
2963 [http://www.example.com/<hello> stuff]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2966 </p>
2967 !!end
2968
2969 !! test
2970 BUG 289: literal ">"-token in bracketed URL
2971 !! input
2972 [http://www.example.com/<b>html</b> stuff]
2973 !! result
2974 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2975 </p>
2976 !!end
2977
2978 !! test
2979 BUG 289: literal double quote at end of URL
2980 !! input
2981 http://www.example.com/"hello"
2982 !! result
2983 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2984 </p>
2985 !!end
2986
2987 !! test
2988 BUG 289: literal double quote in bracketed URL
2989 !! input
2990 [http://www.example.com/"hello" stuff]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2993 </p>
2994 !!end
2995
2996 !! test
2997 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2998 !! input
2999 [http://www.example.com test]
3000 !! result
3001 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3002 </p>
3003 !! end
3004
3005 !! test
3006 External links: link text with spaces
3007 !! input
3008 [http://www.example.com a b c]
3009 [http://www.example.com ''a'' ''b'']
3010 !! result
3011 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3012 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3013 </p>
3014 !! end
3015
3016 !! test
3017 External links: wiki links within external link (Bug 3695)
3018 !! input
3019 [http://example.com [[wikilink]] embedded in ext link]
3020 !! result
3021 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
3022 </p>
3023 !! end
3024
3025 !! test
3026 BUG 787: Links with one slash after the url protocol are invalid
3027 !! input
3028 http:/example.com
3029
3030 [http:/example.com title]
3031 !! result
3032 <p>http:/example.com
3033 </p><p>[http:/example.com title]
3034 </p>
3035 !! end
3036
3037 !! test
3038 Bracketed external links with template-generated invalid target
3039 !! input
3040 [{{echo|http:/example.com}} title]
3041 !! result
3042 <p>[http:/example.com title]
3043 </p>
3044 !! end
3045
3046 !! test
3047 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3048 !! input
3049 ''[http://example.com text'']
3050 [http://example.com '''text]'''
3051 ''Something [http://example.com in italic'']
3052 ''Something [http://example.com mixed''''', even bold]'''
3053 '''''Now [http://example.com both''''']
3054 !! result
3055 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3056 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3057 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3058 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3059 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3060 </p>
3061 !! end
3062
3063
3064 !! test
3065 Bug 4781: %26 in URL
3066 !! input
3067 http://www.example.com/?title=AT%26T
3068 !! result
3069 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3070 </p>
3071 !! end
3072
3073 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3074 # % is actually legal in HTML5. Any change in output would need testing though.
3075 !! test
3076 Bug 4781, 5267: %25 in URL
3077 !! input
3078 http://www.example.com/?title=100%25_Bran
3079 !! result
3080 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
3081 </p>
3082 !! end
3083
3084 !! test
3085 Bug 4781, 5267: %28, %29 in URL
3086 !! input
3087 http://www.example.com/?title=Ben-Hur_%281959_film%29
3088 !! result
3089 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
3090 </p>
3091 !! end
3092
3093
3094 !! test
3095 Bug 4781: %26 in autonumber URL
3096 !! input
3097 [http://www.example.com/?title=AT%26T]
3098 !! result
3099 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3100 </p>
3101 !! end
3102
3103 !! test
3104 Bug 4781, 5267: %26 in autonumber URL
3105 !! input
3106 [http://www.example.com/?title=100%25_Bran]
3107 !! result
3108 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3109 </p>
3110 !! end
3111
3112 !! test
3113 Bug 4781, 5267: %28, %29 in autonumber URL
3114 !! input
3115 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3116 !! result
3117 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3118 </p>
3119 !! end
3120
3121
3122 !! test
3123 Bug 4781: %26 in bracketed URL
3124 !! input
3125 [http://www.example.com/?title=AT%26T link]
3126 !! result
3127 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3128 </p>
3129 !! end
3130
3131 !! test
3132 Bug 4781, 5267: %26 in bracketed URL
3133 !! input
3134 [http://www.example.com/?title=100%25_Bran link]
3135 !! result
3136 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3137 </p>
3138 !! end
3139
3140 !! test
3141 Bug 4781, 5267: %28, %29 in bracketed URL
3142 !! input
3143 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3144 !! result
3145 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3146 </p>
3147 !! end
3148
3149 !! test
3150 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3151 !! input
3152 Some [http://example.com/ pretty ''italics'' and stuff]!
3153 !! result
3154 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3155 </p>
3156 !! end
3157
3158 !! test
3159 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3160 !! input
3161 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3162 !! result
3163 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3164 </p>
3165 !! end
3166
3167 !! test
3168 External link containing double-single-quotes with no space separating the url from text in italics
3169 !! input
3170 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3171 !! result
3172 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3173 </p>
3174 !! end
3175
3176 !! test
3177 External link with comments in link text
3178 !! input
3179 [http://www.google.com Google <!-- comment -->]
3180 !! result
3181 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3182 </p>
3183 !! end
3184
3185 !! test
3186 URL-encoding in URL functions (single parameter)
3187 !! input
3188 {{localurl:Some page|amp=&}}
3189 !! result
3190 <p>/index.php?title=Some_page&amp;amp=&amp;
3191 </p>
3192 !! end
3193
3194 !! test
3195 URL-encoding in URL functions (multiple parameters)
3196 !! input
3197 {{localurl:Some page|q=?&amp=&}}
3198 !! result
3199 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3200 </p>
3201 !! end
3202
3203 !! test
3204 Brackets in urls
3205 !! input
3206 http://example.com/index.php?foozoid%5B%5D=bar
3207
3208 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3209 !! result
3210 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3211 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3212 </p>
3213 !! end
3214
3215 !! test
3216 IPv6 urls (bug 21261)
3217 !! options
3218 disabled
3219 !! input
3220 http://[2404:130:0:1000::187:2]/index.php
3221 !! result
3222 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3223 </p>
3224 !! end
3225
3226 !! test
3227 Non-extlinks in brackets
3228 !! input
3229 [foo]
3230 [foo bar]
3231 [foo ''bar'']
3232 [fool's] errand
3233 [fool's errand]
3234 [{{echo|foo}}]
3235 [{{echo|foo}} bar]
3236 [{{echo|foo}} ''bar'']
3237 [{{echo|foo}}l's] errand
3238 [{{echo|foo}}l's errand]
3239 [url={{echo|foo}}]
3240 [url=http://example.com]
3241 !! result
3242 <p>[foo]
3243 [foo bar]
3244 [foo <i>bar</i>]
3245 [fool's] errand
3246 [fool's errand]
3247 [foo]
3248 [foo bar]
3249 [foo <i>bar</i>]
3250 [fool's] errand
3251 [fool's errand]
3252 [url=foo]
3253 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3254 </p>
3255 !! end
3256
3257 !! test
3258 Parsoid: Percent encoding in external links
3259 !! options
3260 parsoid
3261 !! input
3262 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3263 !! result
3264 <p><a rel="mw:ExtLink"
3265 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3266 !! end
3267
3268 !! test
3269 Parsoid: use url link syntax for links where the content is equal the link
3270 target
3271 !! options
3272 parsoid
3273 !! input
3274 http://example.com
3275 !! result
3276 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3277 !! end
3278
3279 ###
3280 ### Quotes
3281 ###
3282
3283 !! test
3284 Quotes
3285 !! input
3286 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3287
3288 Normal text. '''''Bold italic text.''''' Normal text.
3289 !!result
3290 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3291 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3292 </p>
3293 !! end
3294
3295
3296 !! test
3297 Unclosed and unmatched quotes (php)
3298 !! options
3299 php
3300 !! input
3301 '''''Bold italic text '''with bold deactivated''' in between.'''''
3302
3303 '''''Bold italic text ''with italic deactivated'' in between.'''''
3304
3305 '''Bold text..
3306
3307 ..spanning two paragraphs (should not work).'''
3308
3309 '''Bold tag left open
3310
3311 ''Italic tag left open
3312
3313 Normal text.
3314
3315 <!-- Unmatching number of opening, closing tags: -->
3316 '''This year''''s election ''should'' beat '''last year''''s.
3317
3318 ''Tom'''s car is bigger than ''Susan'''s.
3319
3320 Plain ''italic'''s plain
3321 !! result
3322 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3323 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3324 </p><p><b>Bold text..</b>
3325 </p><p>..spanning two paragraphs (should not work).
3326 </p><p><b>Bold tag left open</b>
3327 </p><p><i>Italic tag left open</i>
3328 </p><p>Normal text.
3329 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3330 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3331 </p><p>Plain <i>italic'</i>s plain
3332 </p>
3333 !! end
3334 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3335 # parser strips. The wikitext contains just the first half of the bold
3336 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3337 # differently than the PHP parser.)
3338 !! test
3339 Unclosed and unmatched quotes (parsoid)
3340 !! options
3341 parsoid
3342 !! input
3343 '''''Bold italic text '''with bold deactivated''' in between.'''''
3344
3345 '''''Bold italic text ''with italic deactivated'' in between.'''''
3346
3347 '''Bold text..
3348
3349 ..spanning two paragraphs (should not work).'''
3350
3351 '''Bold tag left open
3352
3353 ''Italic tag left open
3354
3355 Normal text.
3356
3357 <!-- Unmatching number of opening, closing tags: -->
3358 '''This year''''s election ''should'' beat '''last year''''s.
3359
3360 ''Tom'''s car is bigger than ''Susan'''s.
3361
3362 Plain ''italic'''s plain
3363 !! result
3364 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3365 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3366 </p><p><b>Bold text..</b>
3367 </p><p>..spanning two paragraphs (should not work).<b></b>
3368 </p><p><b>Bold tag left open</b>
3369 </p><p><i>Italic tag left open</i>
3370 </p><p>Normal text.
3371 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3372 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3373 </p><p>Plain <i>italic'</i>s plain
3374 </p>
3375 !! end
3376
3377 ###
3378 ### Tables
3379 ###
3380 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3381 ###
3382
3383 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3384 # is the bare minimum required by the spec, see:
3385 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3386 !! test
3387 A table with no data. (php)
3388 !! options
3389 php
3390 !! input
3391 {||}
3392 !! result
3393 !! end
3394 # Parsoid team replies: empty table tags are legal in HTML5
3395 !! test
3396 A table with no data. (parsoid)
3397 !! options
3398 parsoid
3399 !! input
3400 {||}
3401 !! result
3402 <table></table>
3403 !! end
3404
3405 # A table with nothing but a caption is invalid XHTML, we might want to render
3406 # this as <p>caption</p>
3407 !! test
3408 A table with nothing but a caption (php)
3409 !! options
3410 php
3411 !! input
3412 {|
3413 |+ caption
3414 |}
3415 !! result
3416 <table>
3417 <caption> caption
3418 </caption><tr><td></td></tr></table>
3419
3420 !! end
3421 # Parsoid team replies: table with only a caption is legal in HTML5
3422 !! test
3423 A table with nothing but a caption (parsoid)
3424 !! options
3425 parsoid
3426 !! input
3427 {|
3428 |+ caption
3429 |}
3430 !! result
3431 <table><caption> caption</caption></table>
3432 !! end
3433
3434 !! test
3435 A table with caption with default-spaced attributes and a table row
3436 !! input
3437 {|
3438 |+ style="color: red;" | caption1
3439 |-
3440 | foo
3441 |}
3442 !! result
3443 <table>
3444 <caption style="color: red;"> caption1
3445 </caption>
3446 <tr>
3447 <td> foo
3448 </td></tr></table>
3449
3450 !! end
3451
3452 !! test
3453 A table with captions with non-default spaced attributes and a table row
3454 !! input
3455 {|
3456 |+style="color: red;"|caption2
3457 |+ style="color: red;"| caption3
3458 |-
3459 | foo
3460 |}
3461 !! result
3462 <table>
3463 <caption style="color: red;">caption2
3464 </caption>
3465 <caption style="color: red;"> caption3
3466 </caption>
3467 <tr>
3468 <td> foo
3469 </td></tr></table>
3470
3471 !! end
3472
3473 !! test
3474 Table td-cell syntax variations
3475 !! input
3476 {|
3477 | foo bar foo | baz
3478 | foo bar foo || baz
3479 | style='color:red;' | baz
3480 | style='color:red;' || baz
3481 |}
3482 !! result
3483 <table>
3484 <tr>
3485 <td> baz
3486 </td>
3487 <td> foo bar foo </td>
3488 <td> baz
3489 </td>
3490 <td style="color:red;"> baz
3491 </td>
3492 <td> style='color:red;' </td>
3493 <td> baz
3494 </td></tr></table>
3495
3496 !! end
3497
3498 !! test
3499 Simple table
3500 !! input
3501 {|
3502 | 1 || 2
3503 |-
3504 | 3 || 4
3505 |}
3506 !! result
3507 <table>
3508 <tr>
3509 <td> 1 </td>
3510 <td> 2
3511 </td></tr>
3512 <tr>
3513 <td> 3 </td>
3514 <td> 4
3515 </td></tr></table>
3516
3517 !! end
3518
3519 !! test
3520 Simple table but with multiple dashes for row wikitext
3521 !! input
3522 {|
3523 | foo
3524 |-----
3525 | bar
3526 |}
3527 !! result
3528 <table>
3529 <tr>
3530 <td> foo
3531 </td></tr>
3532 <tr>
3533 <td> bar
3534 </td></tr></table>
3535
3536 !! end
3537 !! test
3538 Multiplication table
3539 !! input
3540 {| border="1" cellpadding="2"
3541 |+Multiplication table
3542 |-
3543 ! &times; !! 1 !! 2 !! 3
3544 |-
3545 ! 1
3546 | 1 || 2 || 3
3547 |-
3548 ! 2
3549 | 2 || 4 || 6
3550 |-
3551 ! 3
3552 | 3 || 6 || 9
3553 |-
3554 ! 4
3555 | 4 || 8 || 12
3556 |-
3557 ! 5
3558 | 5 || 10 || 15
3559 |}
3560 !! result
3561 <table border="1" cellpadding="2">
3562 <caption>Multiplication table
3563 </caption>
3564 <tr>
3565 <th> &#215; </th>
3566 <th> 1 </th>
3567 <th> 2 </th>
3568 <th> 3
3569 </th></tr>
3570 <tr>
3571 <th> 1
3572 </th>
3573 <td> 1 </td>
3574 <td> 2 </td>
3575 <td> 3
3576 </td></tr>
3577 <tr>
3578 <th> 2
3579 </th>
3580 <td> 2 </td>
3581 <td> 4 </td>
3582 <td> 6
3583 </td></tr>
3584 <tr>
3585 <th> 3
3586 </th>
3587 <td> 3 </td>
3588 <td> 6 </td>
3589 <td> 9
3590 </td></tr>
3591 <tr>
3592 <th> 4
3593 </th>
3594 <td> 4 </td>
3595 <td> 8 </td>
3596 <td> 12
3597 </td></tr>
3598 <tr>
3599 <th> 5
3600 </th>
3601 <td> 5 </td>
3602 <td> 10 </td>
3603 <td> 15
3604 </td></tr></table>
3605
3606 !! end
3607
3608 !! test
3609 Accept "||" in table headings
3610 !! input
3611 {|
3612 !h1 || h2
3613 |}
3614 !! result
3615 <table>
3616 <tr>
3617 <th>h1 </th>
3618 <th> h2
3619 </th></tr></table>
3620
3621 !! end
3622
3623 !! test
3624 Accept "||" in indented table headings
3625 !! input
3626 :{|
3627 !h1 || h2
3628 |}
3629 !! result
3630 <dl><dd><table>
3631 <tr>
3632 <th>h1 </th>
3633 <th> h2
3634 </th></tr></table></dd></dl>
3635
3636 !! end
3637
3638 !! test
3639 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3640 !! input
3641 {|
3642 !| h1
3643 || a
3644 |}
3645 !! result
3646 <table>
3647 <tr>
3648 <th> h1
3649 </th>
3650 <td> a
3651 </td></tr></table>
3652
3653 !! end
3654
3655 !!test
3656 Accept "| !" at start of line in tables (ignore !-attribute)
3657 !!input
3658 {|
3659 |-
3660 | !style="color:red" | bar
3661 |}
3662 !!result
3663 <table>
3664
3665 <tr>
3666 <td> bar
3667 </td></tr></table>
3668
3669 !!end
3670
3671 !!test
3672 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3673 !!input
3674 {|
3675 |-
3676 |style='color:red;'|+1
3677 |style='color:blue;'|-1
3678 |-
3679 | 1 || 2 || 3
3680 | 1 ||+2 ||-3
3681 |-
3682 | +1
3683 | -1
3684 |}
3685 !!result
3686 <table>
3687
3688 <tr>
3689 <td style="color:red;">+1
3690 </td>
3691 <td style="color:blue;">-1
3692 </td></tr>
3693 <tr>
3694 <td> 1 </td>
3695 <td> 2 </td>
3696 <td> 3
3697 </td>
3698 <td> 1 </td>
3699 <td>+2 </td>
3700 <td>-3
3701 </td></tr>
3702 <tr>
3703 <td> +1
3704 </td>
3705 <td> -1
3706 </td></tr></table>
3707
3708 !!end
3709
3710 !! test
3711 Table rowspan
3712 !! input
3713 {| border=1
3714 | Cell 1, row 1
3715 |rowspan=2| Cell 2, row 1 (and 2)
3716 | Cell 3, row 1
3717 |-
3718 | Cell 1, row 2
3719 | Cell 3, row 2
3720 |}
3721 !! result
3722 <table border="1">
3723 <tr>
3724 <td> Cell 1, row 1
3725 </td>
3726 <td rowspan="2"> Cell 2, row 1 (and 2)
3727 </td>
3728 <td> Cell 3, row 1
3729 </td></tr>
3730 <tr>
3731 <td> Cell 1, row 2
3732 </td>
3733 <td> Cell 3, row 2
3734 </td></tr></table>
3735
3736 !! end
3737
3738 !! test
3739 Nested table
3740 !! input
3741 {| border=1
3742 | &alpha;
3743 |
3744 {| bgcolor=#ABCDEF border=2
3745 |nested
3746 |-
3747 |table
3748 |}
3749 |the original table again
3750 |}
3751 !! result
3752 <table border="1">
3753 <tr>
3754 <td> &#945;
3755 </td>
3756 <td>
3757 <table bgcolor="#ABCDEF" border="2">
3758 <tr>
3759 <td>nested
3760 </td></tr>
3761 <tr>
3762 <td>table
3763 </td></tr></table>
3764 </td>
3765 <td>the original table again
3766 </td></tr></table>
3767
3768 !! end
3769
3770 !! test
3771 Invalid attributes in table cell (bug 1830)
3772 !! input
3773 {|
3774 |Cell:|broken
3775 |}
3776 !! result
3777 <table>
3778 <tr>
3779 <td>broken
3780 </td></tr></table>
3781
3782 !! end
3783
3784
3785 !! test
3786 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3787 !! input
3788 {|
3789 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3790 !! result
3791 <table>
3792 <tr>
3793 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3794 <td>]" onmouseover="alert(document.cookie)"&gt;test
3795 </td>
3796 </tr>
3797 </table>
3798
3799 !! end
3800
3801
3802 !! test
3803 Indented table markup mixed with indented pre content (proposed in bug 6200)
3804 !! input
3805 <table>
3806 <tr>
3807 <td>
3808 Text that should be rendered preformatted
3809 </td>
3810 </tr>
3811 </table>
3812 !! result
3813 <table>
3814 <tr>
3815 <td>
3816 <pre>Text that should be rendered preformatted
3817 </pre>
3818 </td>
3819 </tr>
3820 </table>
3821
3822 !! end
3823
3824 !! test
3825 Template-generated table cell attributes and cell content
3826 !! input
3827 {|
3828 |{{table_attribs}}
3829 |}
3830 !! result
3831 <table>
3832 <tr>
3833 <td style="color: red"> Foo
3834 </td></tr></table>
3835
3836 !! end
3837
3838 !! test
3839 Table with row followed by newlines and table heading
3840 !! input
3841 {|
3842 |-
3843
3844 ! foo
3845 |}
3846 !! result
3847 <table>
3848
3849
3850 <tr>
3851 <th> foo
3852 </th></tr></table>
3853
3854 !! end
3855
3856 !! test
3857 Table with empty line following the start tag
3858 !! input
3859 {|
3860
3861 |-
3862 | foo
3863 |}
3864 !! result
3865 <table>
3866
3867
3868 <tr>
3869 <td> foo
3870 </td></tr></table>
3871
3872 !! end
3873
3874 # FIXME: Preserve the attribute properly (with an empty string as value) in
3875 # the PHP parser. Parsoid implements the behavior below.
3876 !! test
3877 Table attributes with empty value
3878 !! options
3879 parsoid
3880 !! input
3881 {|
3882 | style=| hello
3883 |}
3884 !! result
3885 <table>
3886 <tbody>
3887 <tr>
3888 <td style=""> hello
3889 </td></tr></tbody></table>
3890
3891 !! end
3892
3893 !! test
3894 Wikitext table with a lot of comments
3895 !! input
3896 {|
3897 <!-- c0 -->
3898 | foo
3899 <!-- c1 -->
3900 |- <!-- c2 -->
3901 <!-- c3 -->
3902 |<!-- c4 -->
3903 <!-- c5 -->
3904 |}
3905 !! result
3906 <table>
3907 <tr>
3908 <td> foo
3909 </td></tr>
3910 <tr>
3911 <td>
3912 </td></tr></table>
3913
3914 !! end
3915
3916 !! test
3917 Wikitext table with double-line table cell
3918 !! input
3919 {|
3920 |a
3921 b
3922 |}
3923 !! result
3924 <table>
3925 <tr>
3926 <td>a
3927 <p>b
3928 </p>
3929 </td></tr></table>
3930
3931 !! end
3932
3933 !! test
3934 Table cell with a single comment
3935 !! input
3936 {|
3937 | <!-- c1 -->
3938 | a
3939 |}
3940 !! result
3941 <table>
3942 <tr>
3943 <td>
3944 </td>
3945 <td> a
3946 </td></tr></table>
3947
3948 !! end
3949
3950 # The expected HTML structure in this test is debatable. The PHP parser does
3951 # not parse this kind of table at all. The main focus for Parsoid is on
3952 # round-tripping, so this output is ok for now. TODO: revisit!
3953 !! test
3954 Wikitext table with html-syntax row (Parsoid)
3955 !! options
3956 parsoid
3957 !! input
3958 {|
3959 |-
3960 <td>foo</td>
3961 |}
3962 !! result
3963 <table>
3964 <tbody>
3965 <tr>
3966 <td>foo</td></tr></tbody></table>
3967 !! end
3968
3969 !! test
3970 Implicit <td> after a |-
3971 (PHP parser relies on Tidy to add the missing <td> tags)
3972 !! options
3973 parsoid=wt2html,wt2wt
3974 !! input
3975 {|
3976 |-
3977 a
3978 |}
3979 !! result
3980 <table>
3981 <tr><td>a</td></tr>
3982 </table>
3983 !! end
3984
3985 !! test
3986 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
3987 (PHP parser relies on Tidy to add the missing <td> tags)
3988 !! options
3989 parsoid=wt2html,wt2wt
3990 !! input
3991 {|
3992 |-
3993 |
3994 a
3995 |-
3996 b
3997 |}
3998 !! result
3999 <table>
4000 <tbody>
4001 <tr><td><pre>a</pre></td></tr>
4002 <tr><td> b</td></tr>
4003 </tbody>
4004 </table>
4005 !! end
4006
4007 !! test
4008 Lists should be recognized in an implicit <td> context
4009 (PHP parser relies on Tidy to add the missing <td> tags)
4010 !! options
4011 parsoid=wt2html,wt2wt
4012 !! input
4013 {|
4014 |-
4015 *a
4016 |}
4017 !! result
4018 <table>
4019 <tr>
4020 <td><ul><li>a</li></ul></td>
4021 </tr>
4022 </table>
4023 !! end
4024
4025 ###
4026 ### Internal links
4027 ###
4028 !! test
4029 Plain link, capitalized
4030 !! input
4031 [[Main Page]]
4032 !! result
4033 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4034 </p>
4035 !! end
4036
4037 !! test
4038 Plain link, uncapitalized
4039 !! input
4040 [[main Page]]
4041 !! result
4042 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4043 </p>
4044 !! end
4045
4046 !! test
4047 Piped link
4048 !! input
4049 [[Main Page|The Main Page]]
4050 !! result
4051 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4052 </p>
4053 !! end
4054
4055 !! test
4056 Piped link with comment in link text
4057 !! input
4058 [[Main Page|The Main<!--front--> Page]]
4059 !! result
4060 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4061 </p>
4062 !! end
4063
4064 !! test
4065 Broken link
4066 !! input
4067 [[Zigzagzogzagzig]]
4068 !! result
4069 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4070 </p>
4071 !! end
4072
4073 !! test
4074 Broken link with fragment
4075 !! input
4076 [[Zigzagzogzagzig#zug]]
4077 !! result
4078 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4079 </p>
4080 !! end
4081
4082 !! test
4083 Special page link with fragment
4084 !! input
4085 [[Special:Version#anchor]]
4086 !! result
4087 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4088 </p>
4089 !! end
4090
4091 !! test
4092 Nonexistent special page link with fragment
4093 !! input
4094 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4095 !! result
4096 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4097 </p>
4098 !! end
4099
4100 !! test
4101 Link with prefix
4102 !! input
4103 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4104 !! result
4105 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4106 </p>
4107 !! end
4108
4109 !! test
4110 Link with suffix
4111 !! input
4112 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4113 !! result
4114 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
4115 </p>
4116 !! end
4117
4118 !! article
4119 prefixed article
4120 !! text
4121 Some text
4122 !! endarticle
4123
4124 !! test
4125 Bug 43661: Piped links with identical prefixes
4126 !! input
4127 [[prefixed article|prefixed articles with spaces]]
4128
4129 [[prefixed article|prefixed articlesaoeu]]
4130
4131 [[Main Page|Main Page test]]
4132 !! result
4133 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4134 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4135 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4136 </p>
4137 !! end
4138
4139
4140 !! test
4141 Link with HTML entity in suffix / tail
4142 !! input
4143 [[Main Page]]&quot;, [[Main Page]]&#97;
4144 !! result
4145 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
4146 </p>
4147 !! end
4148
4149 !! test
4150 Link with 3 brackets
4151 !! input
4152 [[[main page]]]
4153 !! result
4154 <p>[[[main page]]]
4155 </p>
4156 !! end
4157
4158 !! test
4159 Piped link with 3 brackets
4160 !! input
4161 [[[main page|the main page]]]
4162 !! result
4163 <p>[[[main page|the main page]]]
4164 </p>
4165 !! end
4166
4167 !! test
4168 Link with multiple pipes
4169 !! input
4170 [[Main Page|The|Main|Page]]
4171 !! result
4172 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4173 </p>
4174 !! end
4175
4176 !! test
4177 Link to namespaces
4178 !! input
4179 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4180 !! result
4181 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
4182 </p>
4183 !! end
4184
4185 !! test
4186 Piped link to namespace
4187 !! input
4188 [[Meta:Disclaimers|The disclaimers]]
4189 !! result
4190 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
4191 </p>
4192 !! end
4193
4194 !! test
4195 Link containing }
4196 !! input
4197 [[Usually caused by a typo (oops}]]
4198 !! result
4199 <p>[[Usually caused by a typo (oops}]]
4200 </p>
4201 !! end
4202
4203 !! test
4204 Link containing % (not as a hex sequence)
4205 !! input
4206 [[7% Solution]]
4207 !! result
4208 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
4209 </p>
4210 !! end
4211
4212 !! test
4213 Link containing % as a single hex sequence interpreted to char
4214 !! input
4215 [[7%25 Solution]]
4216 !! result
4217 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
4218 </p>
4219 !!end
4220
4221 !! test
4222 Link containing % as a double hex sequence interpreted to hex sequence
4223 !! input
4224 [[7%2525 Solution]]
4225 !! result
4226 <p>[[7%2525 Solution]]
4227 </p>
4228 !!end
4229
4230 !! test
4231 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4232 Example for such a section: == < ==
4233 !! input
4234 [[%23%3c]][[%23%3e]]
4235 !! result
4236 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4237 </p>
4238 !! end
4239
4240 !! test
4241 Link containing "<#" and ">#" as a hex sequences
4242 !! input
4243 [[%3c%23]][[%3e%23]]
4244 !! result
4245 <p>[[%3c%23]][[%3e%23]]
4246 </p>
4247 !! end
4248
4249 !! test
4250 Link containing an equals sign
4251 !! input
4252 [[Special:BookSources/isbn=4-00-026157-6]]
4253 !! result
4254 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4255 </p>
4256 !! end
4257
4258 !! article
4259 Foo~bar
4260 !! text
4261 Just a test of an article title containing a tilde.
4262 !! endarticle
4263
4264 # note that links containing signatures, like [[Foo~~~~]], are
4265 # massaged by the pre-save transform (PST) and so the tildes are never
4266 # seen by the parser.
4267 !! test
4268 Link containing a tilde
4269 !! input
4270 [[Foo~bar]]
4271 !! result
4272 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4273 </p>
4274 !! end
4275
4276 !! test
4277 Link containing double-single-quotes '' (bug 4598)
4278 !! input
4279 [[Lista d''e paise d''o munno]]
4280 !! result
4281 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4287 !! input
4288 Some [[Link|pretty ''italics'' and stuff]]!
4289 !! result
4290 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4291 </p>
4292 !! end
4293
4294 !! test
4295 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4296 !! input
4297 ''Some [[Link|pretty ''italics'' and stuff]]!
4298 !! result
4299 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Link with double quotes in title part (literal) and alternate part (interpreted)
4305 !! input
4306 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4307
4308 [[''Pentecoste'']]
4309
4310 [[''Pentecoste''|Pentecoste]]
4311
4312 [[''Pentecoste''|''Pentecoste'']]
4313 !! result
4314 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4315 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4316 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4317 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4318 </p>
4319 !! end
4320
4321 !! test
4322 Broken image links with HTML captions (bug 39700)
4323 !! input
4324 [[File:Nonexistent|<script></script>]]
4325 [[File:Nonexistent|100px|<script></script>]]
4326 [[File:Nonexistent|&lt;]]
4327 [[File:Nonexistent|a<i>b</i>c]]
4328 !! result
4329 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4330 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4331 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4332 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Plain link to URL
4338 !! input
4339 [[http://www.example.com]]
4340 !! result
4341 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4342 </p>
4343 !! end
4344
4345 !! test
4346 Plain link to URL with link text
4347 !! input
4348 [[http://www.example.com Link text]]
4349 !! result
4350 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4351 </p>
4352 !! end
4353
4354 !! test
4355 Plain link to protocol-relative URL
4356 !! input
4357 [[//www.example.com]]
4358 !! result
4359 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4360 </p>
4361 !! end
4362
4363 !! test
4364 Plain link to protocol-relative URL with link text
4365 !! input
4366 [[//www.example.com Link text]]
4367 !! result
4368 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4369 </p>
4370 !! end
4371
4372 !! test
4373 Plain link to page with question mark in title
4374 !! input
4375 [[A?b]]
4376
4377 [[A?b|Baz]]
4378 !! result
4379 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4380 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4381 </p>
4382 !! end
4383
4384
4385 # I'm fairly sure the expected result here is wrong.
4386 # We want these to be URL links, not pseudo-pages with URLs for titles....
4387 # However the current output is also pretty screwy.
4388 #
4389 # ----
4390 # I'm changing it to match the current output--it arguably makes more
4391 # sense in the light of the test above. Old expected result was:
4392 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4393 #</p>
4394 # But I think this test is bordering on "garbage in, garbage out" anyway.
4395 # -- wtm
4396 !! test
4397 Piped link to URL
4398 !! input
4399 Piped link to URL: [[http://www.example.com|an example URL]]
4400 !! result
4401 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4402 </p>
4403 !! end
4404
4405 !! test
4406 BUG 2: [[page|http://url/]] should link to page, not http://url/
4407 !! input
4408 [[Main Page|http://url/]]
4409 !! result
4410 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4411 </p>
4412 !! end
4413
4414 !! test
4415 BUG 337: Escaped self-links should be bold
4416 !! options
4417 title=[[Bug462]]
4418 !! input
4419 [[Bu&#103;462]] [[Bug462]]
4420 !! result
4421 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4422 </p>
4423 !! end
4424
4425 !! test
4426 Self-link to section should not be bold
4427 !! options
4428 title=[[Main Page]]
4429 !! input
4430 [[Main Page#section]]
4431 !! result
4432 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4433 </p>
4434 !! end
4435
4436 !! article
4437 00
4438 !! text
4439 This is 00.
4440 !! endarticle
4441
4442 !!test
4443 Self-link to numeric title
4444 !!options
4445 title=[[0]]
4446 !!input
4447 [[0]]
4448 !!result
4449 <p><strong class="selflink">0</strong>
4450 </p>
4451 !!end
4452
4453 !!test
4454 Link to numeric-equivalent title
4455 !!options
4456 title=[[0]]
4457 !!input
4458 [[00]]
4459 !!result
4460 <p><a href="/wiki/00" title="00">00</a>
4461 </p>
4462 !!end
4463
4464 !! test
4465 <nowiki> inside a link
4466 !! input
4467 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4468 !! result
4469 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4470 </p>
4471 !! end
4472
4473 !! test
4474 Non-breaking spaces in title
4475 !! input
4476 [[&nbsp; Main &nbsp; Page &nbsp;]]
4477 !! result
4478 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4484 !! options
4485 language=ca
4486 !! input
4487 '''[[Main Page]]'''
4488 !! result
4489 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4490 </p>
4491 !! end
4492
4493 !! test
4494 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4495 !! options
4496 language=ca
4497 !! input
4498 ''[[Main Page]]''
4499 !! result
4500 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4501 </p>
4502 !! end
4503
4504 !! test
4505 Internal link with en linktrail: no apostrophes (bug 27473)
4506 !! options
4507 language=en
4508 !! input
4509 [[Something]]'nice
4510 !! result
4511 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4512 </p>
4513 !! end
4514
4515 !! test
4516 Internal link with ca linktrail with apostrophes (bug 27473)
4517 !! options
4518 language=ca
4519 !! input
4520 [[Something]]'nice
4521 !! result
4522 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4523 </p>
4524 !! end
4525
4526 !! test
4527 Internal link with kaa linktrail with apostrophes (bug 27473)
4528 !! options
4529 language=kaa
4530 !! input
4531 [[Something]]'nice
4532 !! result
4533 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4534 </p>
4535 !! end
4536
4537 !! article
4538 Söfnuður
4539 !! text
4540 Test.
4541 !! endarticle
4542
4543 !! test
4544 Internal link with is link prefix
4545 !! options
4546 language=is
4547 !! input
4548 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4549 !! result
4550 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4551 </p>
4552 !! end
4553
4554 !! article
4555 Mótmælendatrú
4556 !! text
4557 Test.
4558 !! endarticle
4559
4560 !! test
4561 Internal link with is link trail and link prefix
4562 !! options
4563 language=is
4564 !! input
4565 [[mótmælendatrú|xxx]]ar
4566 [[mótmælendatrú]]ar
4567 mótmælenda[[söfnuður]]
4568 mótmælenda[[söfnuður|söfnuðir]]
4569 mótmælenda[[söfnuður|söfnuðir]]xxx
4570 !! result
4571 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4572 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4573 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4574 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4575 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4576 </p>
4577 !! end
4578
4579 !! test
4580 Parsoid link trail escaping
4581 !! options
4582 parsoid=html2wt,html2html
4583 !! input
4584 [[apple]]<nowiki/>s
4585 !! result
4586 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4587 !! end
4588
4589 !! test
4590 Parsoid link prefix escaping
4591 !! options
4592 language=is
4593 parsoid=html2wt,html2html
4594 !! input
4595 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4596 !! result
4597 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4598 !! end
4599
4600 !! test
4601 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4602 !! input
4603 [[Foo| bar]]
4604
4605 [[Foo| ''bar'']]
4606
4607 [http://wp.org foo]
4608
4609 [http://wp.org ''foo'']
4610 !! result
4611 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4612 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4613 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4614 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4615 </p>
4616 !! end
4617
4618 ###
4619 ### Interwiki links (see maintenance/interwiki.sql)
4620 ###
4621
4622 !! test
4623 Inline interwiki link
4624 !! input
4625 [[MeatBall:SoftSecurity]]
4626 !! result
4627 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4628 </p>
4629 !! end
4630
4631 !! test
4632 Inline interwiki link with empty title (bug 2372)
4633 !! input
4634 [[MeatBall:]]
4635 !! result
4636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4637 </p>
4638 !! end
4639
4640 !! test
4641 Interwiki link encoding conversion (bug 1636)
4642 !! input
4643 *[[Wikipedia:ro:Olteni&#0355;a]]
4644 *[[Wikipedia:ro:Olteni&#355;a]]
4645 !! result
4646 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4647 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4648 </li></ul>
4649
4650 !! end
4651
4652 !! test
4653 Interwiki link with fragment (bug 2130)
4654 !! input
4655 [[MeatBall:SoftSecurity#foo]]
4656 !! result
4657 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4658 </p>
4659 !! end
4660
4661 !! test
4662 Interlanguage link
4663 !! input
4664 Blah blah blah
4665 [[zh:Chinese]]
4666 !!result
4667 <p>Blah blah blah
4668 </p>
4669 !! end
4670
4671 !! test
4672 Double interlanguage link
4673 !! input
4674 Blah blah blah
4675 [[es:Spanish]]
4676 [[zh:Chinese]]
4677 !!result
4678 <p>Blah blah blah
4679 </p>
4680 !! end
4681
4682 !! test
4683 Interlanguage link, with prefix links
4684 !! options
4685 language=ln
4686 !! input
4687 Blah blah blah
4688 [[zh:Chinese]]
4689 !!result
4690 <p>Blah blah blah
4691 </p>
4692 !! end
4693
4694 !! test
4695 Double interlanguage link, with prefix links (bug 8897)
4696 !! options
4697 language=ln
4698 !! input
4699 Blah blah blah
4700 [[es:Spanish]]
4701 [[zh:Chinese]]
4702 !!result
4703 <p>Blah blah blah
4704 </p>
4705 !! end
4706
4707 !! test
4708 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4709 !! options
4710 language=ln
4711 !! input
4712 [[WW&nbsp;II]]
4713 !!result
4714 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4715 </p>
4716 !! end
4717
4718 !! test
4719 Parsoid: handle constructor well
4720 !! options
4721 parsoid
4722 !! input
4723 [[constructor]]
4724
4725 [[constructor:foo]]
4726 !! result
4727 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
4728
4729
4730 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
4731 !! end
4732
4733 ##
4734 ## Redirects, Parsoid-only
4735 ##
4736 !! test
4737 Simple redirect to page
4738 !! options
4739 parsoid
4740 !! input
4741 #REDIRECT [[Main Page]]
4742 !! result
4743 <link rel="mw:PageProp/redirect" href="./Main_Page">
4744 !! end
4745
4746 !! test
4747 Redirect to category
4748 !! options
4749 parsoid=wt2html
4750 !! input
4751 #REDIRECT [[Category:Foo]]
4752 !! result
4753 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4754 !! end
4755
4756 !! test
4757 Redirect to category page
4758 !! options
4759 parsoid=wt2html,html2html
4760 !! input
4761 #REDIRECT [[:Category:Foo]]
4762 !! result
4763 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4764 !! end
4765
4766 !! test
4767 Redirect to image page
4768 !! options
4769 parsoid
4770 !! input
4771 #REDIRECT [[File:Wiki.png]]
4772 !! result
4773 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4774 !! end
4775
4776 !! test
4777 Redirect to language
4778 !! options
4779 parsoid
4780 !! input
4781 #REDIRECT [[en:File:Wiki.png]]
4782 !! result
4783 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4784 !! end
4785
4786 !! test
4787 Redirect to interwiki
4788 !! options
4789 parsoid
4790 !! input
4791 #REDIRECT [[meatball:File:Wiki.png]]
4792 !! result
4793 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4794 !! end
4795
4796 ##
4797 ## XHTML tidiness
4798 ###
4799
4800 !! test
4801 <br> to <br />
4802 !! input
4803 1<br>2<br />3
4804 !! result
4805 <p>1<br />2<br />3
4806 </p>
4807 !! end
4808
4809 !! test
4810 Broken br tag sanitization
4811 !! options
4812 php
4813 !! input
4814 </br>
4815 !! result
4816 <p>&lt;/br&gt;
4817 </p>
4818 !! end
4819
4820 # TODO: Fix html2html mode (bug 51055)!
4821 !! test
4822 Parsoid: Broken br tag recognition
4823 !! options
4824 parsoid=wt2html
4825 !! input
4826 </br>
4827 !! result
4828 <p><br></p>
4829 !! end
4830
4831 !! test
4832 Incorrecly removing closing slashes from correctly formed XHTML
4833 !! input
4834 <br style="clear:both;" />
4835 !! result
4836 <p><br style="clear:both;" />
4837 </p>
4838 !! end
4839
4840 !! test
4841 Failing to transform badly formed HTML into correct XHTML
4842 !! input
4843 <br style="clear: left;">
4844 <br style="clear: right;">
4845 <br style="clear: both;">
4846 !! result
4847 <p><br style="clear: left;" />
4848 <br style="clear: right;" />
4849 <br style="clear: both;" />
4850 </p>
4851 !!end
4852
4853 !! test
4854 Handling html with a div self-closing tag
4855 !! input
4856 <div title />
4857 <div title/>
4858 <div title/ >
4859 <div title=bar />
4860 <div title=bar/>
4861 <div title=bar/ >
4862 !! result
4863 <p>&lt;div title /&gt;
4864 &lt;div title/&gt;
4865 </p>
4866 <div>
4867 <p>&lt;div title=bar /&gt;
4868 &lt;div title=bar/&gt;
4869 </p>
4870 <div title="bar/"></div>
4871 </div>
4872
4873 !! end
4874
4875 !! test
4876 Handling html with a br self-closing tag
4877 !! input
4878 <br title />
4879 <br title/>
4880 <br title/ >
4881 <br title=bar />
4882 <br title=bar/>
4883 <br title=bar/ >
4884 !! result
4885 <p><br title="title" />
4886 <br title="title" />
4887 <br />
4888 <br title="bar" />
4889 <br title="bar" />
4890 <br title="bar/" />
4891 </p>
4892 !! end
4893
4894 !! test
4895 Horizontal ruler (should it add that extra space?)
4896 !! input
4897 <hr>
4898 <hr >
4899 foo <hr
4900 > bar
4901 !! result
4902 <hr />
4903 <hr />
4904 foo <hr /> bar
4905
4906 !! end
4907
4908 !! test
4909 Horizontal ruler -- 4+ dashes render hr
4910 !! input
4911 ----
4912 !! result
4913 <hr />
4914
4915 !! end
4916
4917 !! test
4918 Horizontal ruler -- eats additional dashes on the same line
4919 !! input
4920 ---------
4921 !! result
4922 <hr />
4923
4924 !! end
4925
4926 !! test
4927 Horizontal ruler -- does not collapse dashes on consecutive lines
4928 !! input
4929 ----
4930 ----
4931 !! result
4932 <hr />
4933 <hr />
4934
4935 !! end
4936
4937 !! test
4938 Horizontal ruler -- <4 dashes render as plain text
4939 !! input
4940 ---
4941 !! result
4942 <p>---
4943 </p>
4944 !! end
4945
4946 !! test
4947 Horizontal ruler -- Supports content following dashes on same line
4948 !! input
4949 ---- Foo
4950 !! result
4951 <hr /> Foo
4952
4953 !! end
4954
4955 ###
4956 ### Block-level elements
4957 ###
4958 !! test
4959 Common list
4960 !! input
4961 *Common list
4962 * item 2
4963 *item 3
4964 !! result
4965 <ul><li>Common list
4966 </li><li> item 2
4967 </li><li>item 3
4968 </li></ul>
4969
4970 !! end
4971
4972 !! test
4973 Numbered list
4974 !! input
4975 #Numbered list
4976 #item 2
4977 # item 3
4978 !! result
4979 <ol><li>Numbered list
4980 </li><li>item 2
4981 </li><li> item 3
4982 </li></ol>
4983
4984 !! end
4985
4986 !! test
4987 Mixed list
4988 !! input
4989 *Mixed list
4990 *# with numbers
4991 ** and bullets
4992 *# and numbers
4993 *bullets again
4994 **bullet level 2
4995 ***bullet level 3
4996 ***#Number on level 4
4997 **bullet level 2
4998 **#Number on level 3
4999 **#Number on level 3
5000 *#number level 2
5001 *Level 1
5002 *** Level 3
5003 #** Level 3, but ordered
5004 !! result
5005 <ul><li>Mixed list
5006 <ol><li> with numbers
5007 </li></ol>
5008 <ul><li> and bullets
5009 </li></ul>
5010 <ol><li> and numbers
5011 </li></ol>
5012 </li><li>bullets again
5013 <ul><li>bullet level 2
5014 <ul><li>bullet level 3
5015 <ol><li>Number on level 4
5016 </li></ol>
5017 </li></ul>
5018 </li><li>bullet level 2
5019 <ol><li>Number on level 3
5020 </li><li>Number on level 3
5021 </li></ol>
5022 </li></ul>
5023 <ol><li>number level 2
5024 </li></ol>
5025 </li><li>Level 1
5026 <ul><li><ul><li> Level 3
5027 </li></ul>
5028 </li></ul>
5029 </li></ul>
5030 <ol><li><ul><li><ul><li> Level 3, but ordered
5031 </li></ul>
5032 </li></ul>
5033 </li></ol>
5034
5035 !! end
5036
5037 !! test
5038 Nested lists 1
5039 !! input
5040 *foo
5041 **bar
5042 !! result
5043 <ul><li>foo
5044 <ul><li>bar
5045 </li></ul>
5046 </li></ul>
5047
5048 !! end
5049
5050 !! test
5051 Nested lists 2
5052 !! input
5053 **foo
5054 *bar
5055 !! result
5056 <ul><li><ul><li>foo
5057 </li></ul>
5058 </li><li>bar
5059 </li></ul>
5060
5061 !! end
5062
5063 !! test
5064 Nested lists 3 (first element empty)
5065 !! input
5066 *
5067 **bar
5068 !! result
5069 <ul><li>
5070 <ul><li>bar
5071 </li></ul>
5072 </li></ul>
5073
5074 !! end
5075
5076 !! test
5077 Nested lists 4 (first element empty)
5078 !! input
5079 **
5080 *bar
5081 !! result
5082 <ul><li><ul><li>
5083 </li></ul>
5084 </li><li>bar
5085 </li></ul>
5086
5087 !! end
5088
5089 !! test
5090 Nested lists 5 (both elements empty)
5091 !! input
5092 **
5093 *
5094 !! result
5095 <ul><li><ul><li>
5096 </li></ul>
5097 </li><li>
5098 </li></ul>
5099
5100 !! end
5101
5102 !! test
5103 Nested lists 6 (both elements empty)
5104 !! input
5105 *
5106 **
5107 !! result
5108 <ul><li>
5109 <ul><li>
5110 </li></ul>
5111 </li></ul>
5112
5113 !! end
5114
5115 !! test
5116 Nested lists 7 (skip initial nesting levels)
5117 !! input
5118 *** foo
5119 !! result
5120 <ul><li><ul><li><ul><li> foo
5121 </li></ul>
5122 </li></ul>
5123 </li></ul>
5124
5125 !! end
5126
5127 !! test
5128 Nested lists 8 (multiple nesting transitions)
5129 !! input
5130 * foo
5131 *** bar
5132 ** baz
5133 * boo
5134 !! result
5135 <ul><li> foo
5136 <ul><li><ul><li> bar
5137 </li></ul>
5138 </li><li> baz
5139 </li></ul>
5140 </li><li> boo
5141 </li></ul>
5142
5143 !! end
5144
5145 !! test
5146 1. Lists with start-of-line-transparent tokens before bullets: Comments
5147 !! input
5148 *foo
5149 *<!--cmt-->bar
5150 <!--cmt-->*baz
5151 !! result
5152 <ul><li>foo
5153 </li><li>bar
5154 </li><li>baz
5155 </li></ul>
5156
5157 !! end
5158
5159 !! test
5160 2. Lists with start-of-line-transparent tokens before bullets: Template close
5161 !! input
5162 *foo {{echo|bar
5163 }}*baz
5164 !! result
5165 <ul><li>foo bar
5166 </li><li>baz
5167 </li></ul>
5168
5169 !! end
5170
5171 !! test
5172 Unbalanced closing block tags break a list
5173 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5174 !! options
5175 parsoid
5176 !! input
5177 <div>
5178 *a</div><div>
5179 *b</div>
5180 !! result
5181 <div>
5182 <ul><li>a
5183 </li></ul></div><div>
5184 <ul><li>b
5185 </li></ul></div>
5186 !! end
5187
5188 !! test
5189 Unbalanced closing non-block tags don't break a list
5190 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5191 !! options
5192 parsoid
5193 !! input
5194 <span>
5195 *a</span><span>
5196 *b</span>
5197 !! result
5198 <p><span></span>
5199 </p>
5200 <ul><li>a<span></span>
5201 </li><li>b
5202 </li></ul>
5203 !! end
5204
5205 !! test
5206 Unclosed formatting tags that straddle lists are closed and reopened
5207 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5208 !! options
5209 parsoid
5210 !! input
5211 # <s> a
5212 # b </s>
5213 !! result
5214 <ol><li> <s> a </s>
5215 </li><li> <s> b </s>
5216 </li></ol>
5217 !! end
5218
5219 !!test
5220 List embedded in a non-block tag
5221 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5222 !! options
5223 parsoid
5224 !!input
5225 <small>
5226 * foo
5227 </small>
5228 !!result
5229 <p><small></small></p>
5230 <small>
5231 <ul>
5232 <li> foo</li>
5233 </ul>
5234 </small>
5235 <p><small></small></p>
5236 !!end
5237
5238 !! test
5239 List items are not parsed correctly following a <pre> block (bug 785)
5240 !! input
5241 * <pre>foo</pre>
5242 * <pre>bar</pre>
5243 * zar
5244 !! result
5245 <ul><li> <pre>foo</pre>
5246 </li><li> <pre>bar</pre>
5247 </li><li> zar
5248 </li></ul>
5249
5250 !! end
5251
5252 !! test
5253 List items from template
5254 !! input
5255
5256 {{inner list}}
5257 * item 2
5258
5259 * item 0
5260 {{inner list}}
5261 * item 2
5262
5263 * item 0
5264 * notSOL{{inner list}}
5265 * item 2
5266 !! result
5267 <ul><li> item 1
5268 </li><li> item 2
5269 </li></ul>
5270 <ul><li> item 0
5271 </li><li> item 1
5272 </li><li> item 2
5273 </li></ul>
5274 <ul><li> item 0
5275 </li><li> notSOL
5276 </li><li> item 1
5277 </li><li> item 2
5278 </li></ul>
5279
5280 !! end
5281
5282 !! test
5283 List interrupted by empty line or heading
5284 !! input
5285 * foo
5286
5287 ** bar
5288 == A heading ==
5289 * Another list item
5290 !! result
5291 <ul><li> foo
5292 </li></ul>
5293 <ul><li><ul><li> bar
5294 </li></ul>
5295 </li></ul>
5296 <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>
5297 <ul><li> Another list item
5298 </li></ul>
5299
5300 !!end
5301
5302 !!test
5303 Multiple list tags generated by templates
5304 !!input
5305 {{echo|<li>}}a
5306 {{echo|<li>}}b
5307 {{echo|<li>}}c
5308 !!result
5309 <li>a
5310 <li>b
5311 <li>c</li>
5312 </li>
5313 </li>
5314
5315 !!end
5316
5317 !!test
5318 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5319 !!input
5320 *a
5321 <!--This line will NOT split the list-->
5322 *b
5323 <!--This line will NOT split the list either-->
5324 *c
5325 <!--foo--> <!--This line with more than 1 comment will split the list-->
5326 *d
5327 !!result
5328 <ul><li>a
5329 </li><li>b
5330 </li><li>c
5331 </li></ul>
5332 <ul><li>d
5333 </li></ul>
5334
5335 !!end
5336
5337 !!test
5338 Test the li-hack
5339 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5340 !!options
5341 parsoid=wt2html,wt2wt
5342 !!input
5343 * foo
5344 * <li>li-hack
5345 * {{echo|<li>templated li-hack}}
5346 * <!--foo--> <li> unsupported li-hack with preceding comments
5347
5348 <ul>
5349 <li><li>not a li-hack
5350 </li>
5351 </ul>
5352 !!result
5353 <ul><li> foo</li>
5354 <li>li-hack</li>
5355 <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>
5356 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5357
5358 <ul>
5359 <li></li><li>not a li-hack
5360 </li>
5361 </ul>
5362 !!end
5363
5364 !! test
5365 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5366 !! options
5367 parsoid
5368 !! input
5369 # foo
5370 ## bar
5371 * foo
5372 ** bar
5373 : foo
5374 :: bar
5375 !! result
5376 <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>
5377 !! end
5378
5379
5380 ###
5381 ### Magic Words
5382 ###
5383
5384 !! test
5385 Magic Word: {{CURRENTDAY}}
5386 !! input
5387 {{CURRENTDAY}}
5388 !! result
5389 <p>1
5390 </p>
5391 !! end
5392
5393 !! test
5394 Magic Word: {{CURRENTDAY2}}
5395 !! input
5396 {{CURRENTDAY2}}
5397 !! result
5398 <p>01
5399 </p>
5400 !! end
5401
5402 !! test
5403 Magic Word: {{CURRENTDAYNAME}}
5404 !! input
5405 {{CURRENTDAYNAME}}
5406 !! result
5407 <p>Thursday
5408 </p>
5409 !! end
5410
5411 !! test
5412 Magic Word: {{CURRENTDOW}}
5413 !! input
5414 {{CURRENTDOW}}
5415 !! result
5416 <p>4
5417 </p>
5418 !! end
5419
5420 !! test
5421 Magic Word: {{CURRENTMONTH}}
5422 !! input
5423 {{CURRENTMONTH}}
5424 !! result
5425 <p>01
5426 </p>
5427 !! end
5428
5429 !! test
5430 Magic Word: {{CURRENTMONTHABBREV}}
5431 !! input
5432 {{CURRENTMONTHABBREV}}
5433 !! result
5434 <p>Jan
5435 </p>
5436 !! end
5437
5438 !! test
5439 Magic Word: {{CURRENTMONTHNAME}}
5440 !! input
5441 {{CURRENTMONTHNAME}}
5442 !! result
5443 <p>January
5444 </p>
5445 !! end
5446
5447 !! test
5448 Magic Word: {{CURRENTMONTHNAMEGEN}}
5449 !! input
5450 {{CURRENTMONTHNAMEGEN}}
5451 !! result
5452 <p>January
5453 </p>
5454 !! end
5455
5456 !! test
5457 Magic Word: {{CURRENTTIME}}
5458 !! input
5459 {{CURRENTTIME}}
5460 !! result
5461 <p>00:02
5462 </p>
5463 !! end
5464
5465 !! test
5466 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5467 !! input
5468 {{CURRENTWEEK}}
5469 !! result
5470 <p>1
5471 </p>
5472 !! end
5473
5474 !! test
5475 Magic Word: {{CURRENTYEAR}}
5476 !! input
5477 {{CURRENTYEAR}}
5478 !! result
5479 <p>1970
5480 </p>
5481 !! end
5482
5483 !! test
5484 Magic Word: {{FULLPAGENAME}}
5485 !! options
5486 title=[[User:Ævar Arnfjörð Bjarmason]]
5487 !! input
5488 {{FULLPAGENAME}}
5489 !! result
5490 <p>User:Ævar Arnfjörð Bjarmason
5491 </p>
5492 !! end
5493
5494 !! test
5495 Magic Word: {{FULLPAGENAMEE}}
5496 !! options
5497 title=[[User:Ævar Arnfjörð Bjarmason]]
5498 !! input
5499 {{FULLPAGENAMEE}}
5500 !! result
5501 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5502 </p>
5503 !! end
5504
5505 !! test
5506 Magic Word: {{NAMESPACE}}
5507 !! options
5508 title=[[User:Ævar Arnfjörð Bjarmason]]
5509 !! input
5510 {{NAMESPACE}}
5511 !! result
5512 <p>User
5513 </p>
5514 !! end
5515
5516 !! test
5517 Magic Word: {{NAMESPACEE}}
5518 !! options
5519 title=[[User:Ævar Arnfjörð Bjarmason]]
5520 !! input
5521 {{NAMESPACEE}}
5522 !! result
5523 <p>User
5524 </p>
5525 !! end
5526
5527 !! test
5528 Magic Word: {{NAMESPACENUMBER}}
5529 !! options
5530 title=[[User:Ævar Arnfjörð Bjarmason]]
5531 !! input
5532 {{NAMESPACENUMBER}}
5533 !! result
5534 <p>2
5535 </p>
5536 !! end
5537
5538 !! test
5539 Magic Word: {{NUMBEROFFILES}}
5540 !! input
5541 {{NUMBEROFFILES}}
5542 !! result
5543 <p>4
5544 </p>
5545 !! end
5546
5547 !! test
5548 Magic Word: {{PAGENAME}}
5549 !! options
5550 title=[[User:Ævar Arnfjörð Bjarmason]]
5551 !! input
5552 {{PAGENAME}}
5553 !! result
5554 <p>Ævar Arnfjörð Bjarmason
5555 </p>
5556 !! end
5557
5558 !! test
5559 Magic Word: {{PAGENAME}} with metacharacters
5560 !! options
5561 title=[['foo & bar = baz']]
5562 !! input
5563 ''{{PAGENAME}}''
5564 !! result
5565 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5566 </p>
5567 !! end
5568
5569 !! test
5570 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5571 !! options
5572 title=[[*RFC 1234 http://example.com/]]
5573 !! input
5574 {{PAGENAME}}
5575 !! result
5576 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5577 </p>
5578 !! end
5579
5580 !! test
5581 Magic Word: {{PAGENAMEE}}
5582 !! options
5583 title=[[User:Ævar Arnfjörð Bjarmason]]
5584 !! input
5585 {{PAGENAMEE}}
5586 !! result
5587 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5588 </p>
5589 !! end
5590
5591 !! test
5592 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5593 !! options
5594 title=[[*RFC 1234 http://example.com/]]
5595 !! input
5596 {{PAGENAMEE}}
5597 !! result
5598 <p>&#42;RFC_1234_http&#58;//example.com/
5599 </p>
5600 !! end
5601
5602 !! test
5603 Magic Word: {{REVISIONID}}
5604 !! input
5605 {{REVISIONID}}
5606 !! result
5607 <p>1337
5608 </p>
5609 !! end
5610
5611 !! test
5612 Magic Word: {{SCRIPTPATH}}
5613 !! input
5614 {{SCRIPTPATH}}
5615 !! result
5616 <p>/
5617 </p>
5618 !! end
5619
5620 !! test
5621 Magic Word: {{SERVER}}
5622 !! input
5623 {{SERVER}}
5624 !! result
5625 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5626 </p>
5627 !! end
5628
5629 !! test
5630 Magic Word: {{SERVERNAME}}
5631 !! input
5632 {{SERVERNAME}}
5633 !! result
5634 <p>example.org
5635 </p>
5636 !! end
5637
5638 !! test
5639 Magic Word: {{SITENAME}}
5640 !! input
5641 {{SITENAME}}
5642 !! result
5643 <p>MediaWiki
5644 </p>
5645 !! end
5646
5647 !! test
5648 Case-sensitive magic words, when cased differently, should just be template transclusions
5649 !! input
5650 {{CurrentMonth}}
5651 {{currentday}}
5652 {{cURreNTweEK}}
5653 {{currentHour}}
5654 !! result
5655 <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>
5656 <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>
5657 <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>
5658 <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>
5659 </p>
5660 !! end
5661
5662 !! test
5663 Case-insensitive magic words should still work with weird casing.
5664 !! input
5665 {{sErVeRNaMe}}
5666 {{LCFirst:AOEU}}
5667 {{ucFIRST:aoeu}}
5668 {{SERver}}
5669 !! result
5670 <p>example.org
5671 aOEU
5672 Aoeu
5673 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5674 </p>
5675 !! end
5676
5677 !! test
5678 Namespace 1 {{ns:1}}
5679 !! input
5680 {{ns:1}}
5681 !! result
5682 <p>Talk
5683 </p>
5684 !! end
5685
5686 !! test
5687 Namespace 1 {{ns:01}}
5688 !! input
5689 {{ns:01}}
5690 !! result
5691 <p>Talk
5692 </p>
5693 !! end
5694
5695 !! test
5696 Namespace 0 {{ns:0}} (bug 4783)
5697 !! input
5698 {{ns:0}}
5699 !! result
5700
5701 !! end
5702
5703 !! test
5704 Namespace 0 {{ns:00}} (bug 4783)
5705 !! input
5706 {{ns:00}}
5707 !! result
5708
5709 !! end
5710
5711 !! test
5712 Namespace -1 {{ns:-1}}
5713 !! input
5714 {{ns:-1}}
5715 !! result
5716 <p>Special
5717 </p>
5718 !! end
5719
5720 !! test
5721 Namespace User {{ns:User}}
5722 !! input
5723 {{ns:User}}
5724 !! result
5725 <p>User
5726 </p>
5727 !! end
5728
5729 !! test
5730 Namespace User talk {{ns:User_talk}}
5731 !! input
5732 {{ns:User_talk}}
5733 !! result
5734 <p>User talk
5735 </p>
5736 !! end
5737
5738 !! test
5739 Namespace User talk {{ns:uSeR tAlK}}
5740 !! input
5741 {{ns:uSeR tAlK}}
5742 !! result
5743 <p>User talk
5744 </p>
5745 !! end
5746
5747 !! test
5748 Namespace File {{ns:File}}
5749 !! input
5750 {{ns:File}}
5751 !! result
5752 <p>File
5753 </p>
5754 !! end
5755
5756 !! test
5757 Namespace File {{ns:Image}}
5758 !! input
5759 {{ns:Image}}
5760 !! result
5761 <p>File
5762 </p>
5763 !! end
5764
5765 !! test
5766 Namespace (lang=de) Benutzer {{ns:User}}
5767 !! options
5768 language=de
5769 !! input
5770 {{ns:User}}
5771 !! result
5772 <p>Benutzer
5773 </p>
5774 !! end
5775
5776 !! test
5777 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5778 !! options
5779 language=de
5780 !! input
5781 {{ns:3}}
5782 !! result
5783 <p>Benutzer Diskussion
5784 </p>
5785 !! end
5786
5787
5788 !! test
5789 Urlencode
5790 !! input
5791 {{urlencode:hi world?!}}
5792 {{urlencode:hi world?!|WIKI}}
5793 {{urlencode:hi world?!|PATH}}
5794 {{urlencode:hi world?!|QUERY}}
5795 !! result
5796 <p>hi+world%3F%21
5797 hi_world%3F!
5798 hi%20world%3F%21
5799 hi+world%3F%21
5800 </p>
5801 !! end
5802
5803 ###
5804 ### Magic links
5805 ###
5806 !! test
5807 Magic links: internal link to RFC (bug 479)
5808 !! input
5809 [[RFC 123]]
5810 !! result
5811 <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>
5812 </p>
5813 !! end
5814
5815 !! test
5816 Magic links: RFC (bug 479)
5817 !! input
5818 RFC 822
5819 !! result
5820 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5821 </p>
5822 !! end
5823
5824 !! test
5825 Magic links: ISBN (bug 1937)
5826 !! input
5827 ISBN 0-306-40615-2
5828 !! result
5829 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5830 </p>
5831 !! end
5832
5833 !! test
5834 Magic links: PMID incorrectly converts space to underscore
5835 !! input
5836 PMID 1234
5837 !! result
5838 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5839 </p>
5840 !! end
5841
5842 ###
5843 ### Templates
5844 ####
5845
5846 !! test
5847 Nonexistent template
5848 !! input
5849 {{thistemplatedoesnotexist}}
5850 !! result
5851 <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>
5852 </p>
5853 !! end
5854
5855 !! test
5856 Template with invalid target containing tags
5857 !! input
5858 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5859 !! result
5860 <p>{{a<b>b</b>|foo|a=b|a = b}}
5861 </p>
5862 !! end
5863
5864 !! test
5865 Template with invalid target containing unclosed tag
5866 !! input
5867 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5868 !! result
5869 <p>{{a<b>|foo|a=b|a = b}}</b>
5870 </p>
5871 !! end
5872
5873 !! article
5874 Template:test
5875 !! text
5876 This is a test template
5877 !! endarticle
5878
5879 !! test
5880 Simple template
5881 !! input
5882 {{test}}
5883 !! result
5884 <p>This is a test template
5885 </p>
5886 !! end
5887
5888 !! test
5889 Template with explicit namespace
5890 !! input
5891 {{Template:test}}
5892 !! result
5893 <p>This is a test template
5894 </p>
5895 !! end
5896
5897
5898 !! article
5899 Template:paramtest
5900 !! text
5901 This is a test template with parameter {{{param}}}
5902 !! endarticle
5903
5904 !! test
5905 Template parameter
5906 !! input
5907 {{paramtest|param=foo}}
5908 !! result
5909 <p>This is a test template with parameter foo
5910 </p>
5911 !! end
5912
5913 !! article
5914 Template:paramtestnum
5915 !! text
5916 [[{{{1}}}|{{{2}}}]]
5917 !! endarticle
5918
5919 !! test
5920 Template unnamed parameter
5921 !! input
5922 {{paramtestnum|Main Page|the main page}}
5923 !! result
5924 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5925 </p>
5926 !! end
5927
5928 !! article
5929 Template:templatesimple
5930 !! text
5931 (test)
5932 !! endarticle
5933
5934 !! article
5935 Template:templateredirect
5936 !! text
5937 #redirect [[Template:templatesimple]]
5938 !! endarticle
5939
5940 !! article
5941 Template:templateasargtestnum
5942 !! text
5943 {{{{{1}}}}}
5944 !! endarticle
5945
5946 !! article
5947 Template:templateasargtest
5948 !! text
5949 {{template{{{templ}}}}}
5950 !! endarticle
5951
5952 !! article
5953 Template:templateasargtest2
5954 !! text
5955 {{{{{templ}}}}}
5956 !! endarticle
5957
5958 !! test
5959 Template with template name as unnamed argument
5960 !! input
5961 {{templateasargtestnum|templatesimple}}
5962 !! result
5963 <p>(test)
5964 </p>
5965 !! end
5966
5967 !! test
5968 Template with template name as argument
5969 !! input
5970 {{templateasargtest|templ=simple}}
5971 !! result
5972 <p>(test)
5973 </p>
5974 !! end
5975
5976 !! test
5977 Template with template name as argument (2)
5978 !! input
5979 {{templateasargtest2|templ=templatesimple}}
5980 !! result
5981 <p>(test)
5982 </p>
5983 !! end
5984
5985 !! article
5986 Template:templateasargtestdefault
5987 !! text
5988 {{{{{templ|templatesimple}}}}}
5989 !! endarticle
5990
5991 !! article
5992 Template:templa
5993 !! text
5994 '''templ'''
5995 !! endarticle
5996
5997 !! test
5998 Template with default value
5999 !! input
6000 {{templateasargtestdefault}}
6001 !! result
6002 <p>(test)
6003 </p>
6004 !! end
6005
6006 !! test
6007 Template with default value (value set)
6008 !! input
6009 {{templateasargtestdefault|templ=templa}}
6010 !! result
6011 <p><b>templ</b>
6012 </p>
6013 !! end
6014
6015 !! test
6016 Template redirect
6017 !! input
6018 {{templateredirect}}
6019 !! result
6020 <p>(test)
6021 </p>
6022 !! end
6023
6024 !! test
6025 Template with argument in separate line
6026 !! input
6027 {{ templateasargtest |
6028 templ = simple }}
6029 !! result
6030 <p>(test)
6031 </p>
6032 !! end
6033
6034 !! test
6035 Template with complex template as argument
6036 !! input
6037 {{paramtest|
6038 param ={{ templateasargtest |
6039 templ = simple }}}}
6040 !! result
6041 <p>This is a test template with parameter (test)
6042 </p>
6043 !! end
6044
6045 !! test
6046 Template with thumb image (with link in description)
6047 !! input
6048 {{paramtest|
6049 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6050 !! result
6051 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>
6052
6053 !! end
6054
6055 !! article
6056 Template:complextemplate
6057 !! text
6058 {{{1}}} {{paramtest|
6059 param ={{{param}}}}}
6060 !! endarticle
6061
6062 !! test
6063 Template with complex arguments
6064 !! input
6065 {{complextemplate|
6066 param ={{ templateasargtest |
6067 templ = simple }}|[[Template:complextemplate|link]]}}
6068 !! result
6069 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6070 </p>
6071 !! end
6072
6073 !! test
6074 BUG 553: link with two variables in a piped link
6075 !! input
6076 {|
6077 |[[{{{1}}}|{{{2}}}]]
6078 |}
6079 !! result
6080 <table>
6081 <tr>
6082 <td>[[{{{1}}}|{{{2}}}]]
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 Magic variable as template parameter
6089 !! input
6090 {{paramtest|param={{SITENAME}}}}
6091 !! result
6092 <p>This is a test template with parameter MediaWiki
6093 </p>
6094 !! end
6095
6096 !! article
6097 Template:linktest
6098 !! text
6099 [[{{{param}}}|link]]
6100 !! endarticle
6101
6102 !! test
6103 Template parameter as link source
6104 !! input
6105 {{linktest|param=Main Page}}
6106 !! result
6107 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6108 </p>
6109 !! end
6110
6111 !!test
6112 Template-generated attribute string (k='v')
6113 !!input
6114 <span {{attr_str|id|v1}}>bar</span>
6115 !!result
6116 <p><span id="v1">bar</span>
6117 </p>
6118 !!end
6119
6120 !!article
6121 Template:paramtest2
6122 !! text
6123 including another template, {{paramtest|param={{{arg}}}}}
6124 !! endarticle
6125
6126 !! test
6127 Template passing argument to another template
6128 !! input
6129 {{paramtest2|arg='hmm'}}
6130 !! result
6131 <p>including another template, This is a test template with parameter 'hmm'
6132 </p>
6133 !! end
6134
6135 !! article
6136 Template:Linktest2
6137 !! text
6138 Main Page
6139 !! endarticle
6140
6141 !! test
6142 Template as link source
6143 !! input
6144 [[{{linktest2}}]]
6145
6146 [[{{linktest2}}|Main Page]]
6147
6148 [[{{linktest2}}]]Page
6149 !! result
6150 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6151 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6152 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6153 </p>
6154 !! end
6155
6156
6157 !! article
6158 Template:loop1
6159 !! text
6160 {{loop2}}
6161 !! endarticle
6162
6163 !! article
6164 Template:loop2
6165 !! text
6166 {{loop1}}
6167 !! endarticle
6168
6169 !! test
6170 Template infinite loop
6171 !! input
6172 {{loop1}}
6173 !! result
6174 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6175 </p>
6176 !! end
6177
6178 !! test
6179 Template from main namespace
6180 !! input
6181 {{:Main Page}}
6182 !! result
6183 <p>blah blah
6184 </p>
6185 !! end
6186
6187 !! article
6188 Template:table
6189 !! text
6190 {|
6191 | 1 || 2
6192 |-
6193 | 3 || 4
6194 |}
6195 !! endarticle
6196
6197 !! test
6198 BUG 529: Template with table, not included at beginning of line
6199 !! input
6200 foo {{table}}
6201 !! result
6202 <p>foo
6203 </p>
6204 <table>
6205 <tr>
6206 <td> 1 </td>
6207 <td> 2
6208 </td></tr>
6209 <tr>
6210 <td> 3 </td>
6211 <td> 4
6212 </td></tr></table>
6213
6214 !! end
6215
6216 !! test
6217 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6218 !! input
6219 foo
6220 {{table}}
6221 !! result
6222 <p>foo
6223 </p>
6224 <table>
6225 <tr>
6226 <td> 1 </td>
6227 <td> 2
6228 </td></tr>
6229 <tr>
6230 <td> 3 </td>
6231 <td> 4
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 BUG 41: Template parameters shown as broken links
6238 !! input
6239 {{{parameter}}}
6240 !! result
6241 <p>{{{parameter}}}
6242 </p>
6243 !! end
6244
6245 !! test
6246 Template with targets containing wikilinks
6247 !! input
6248 {{[[foo]]}}
6249
6250 {{[[{{echo|foo}}]]}}
6251
6252 {{{{echo|[[foo}}]]}}
6253 !! result
6254 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6255 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6256 </p><p>{{[[foo}}]]
6257 </p>
6258 !! end
6259
6260 !! article
6261 Template:MSGNW test
6262 !! text
6263 ''None'' of '''this''' should be
6264 * interpreted
6265 but rather passed unmodified
6266 {{test}}
6267 !! endarticle
6268
6269 # hmm, fix this or just deprecate msgnw and document its behavior?
6270 !! test
6271 msgnw keyword
6272 !! options
6273 disabled
6274 !! input
6275 {{msgnw:MSGNW test}}
6276 !! result
6277 <p>''None'' of '''this''' should be
6278 * interpreted
6279 but rather passed unmodified
6280 {{test}}
6281 </p>
6282 !! end
6283
6284 !! test
6285 int keyword
6286 !! input
6287 {{int:youhavenewmessages|lots of money|not!}}
6288 !! result
6289 <p>You have lots of money (not!).
6290 </p>
6291 !! end
6292
6293 !! article
6294 Template:Includes
6295 !! text
6296 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6297 !! endarticle
6298
6299 !! test
6300 <includeonly> and <noinclude> being included
6301 !! input
6302 {{Includes}}
6303 !! result
6304 <p>Foobar
6305 </p>
6306 !! end
6307
6308 !! article
6309 Template:Includes2
6310 !! text
6311 <onlyinclude>Foo</onlyinclude>bar
6312 !! endarticle
6313
6314 !! test
6315 <onlyinclude> being included
6316 !! input
6317 {{Includes2}}
6318 !! result
6319 <p>Foo
6320 </p>
6321 !! end
6322
6323
6324 !! article
6325 Template:Includes3
6326 !! text
6327 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6328 !! endarticle
6329
6330 !! test
6331 <onlyinclude> and <includeonly> being included
6332 !! input
6333 {{Includes3}}
6334 !! result
6335 <p>Foo
6336 </p>
6337 !! end
6338
6339 !! test
6340 <includeonly> and <noinclude> on a page
6341 !! input
6342 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6343 !! result
6344 <p>Foozar
6345 </p>
6346 !! end
6347
6348 !! test
6349 Un-closed <noinclude>
6350 !! input
6351 <noinclude>
6352 !! result
6353 !! end
6354
6355 !! test
6356 <onlyinclude> on a page
6357 !! input
6358 <onlyinclude>Foo</onlyinclude>bar
6359 !! result
6360 <p>Foobar
6361 </p>
6362 !! end
6363
6364 !! test
6365 Un-closed <onlyinclude>
6366 !! input
6367 <onlyinclude>
6368 !! result
6369 !! end
6370
6371 !!test
6372 Self-closed noinclude, includeonly, onlyinclude tags
6373 !!input
6374 <noinclude />
6375 <includeonly />
6376 <onlyinclude />
6377 !!result
6378 <p><br />
6379 </p>
6380 !!end
6381
6382 !!test
6383 Unbalanced includeonly and noinclude tags
6384 !!input
6385 {|
6386 |a</noinclude>
6387 |b</noinclude></noinclude>
6388 |c</noinclude></includeonly>
6389 |d</includeonly></includeonly>
6390 |}
6391 !!result
6392 <table>
6393 <tr>
6394 <td>a
6395 </td>
6396 <td>b
6397 </td>
6398 <td>c&lt;/includeonly&gt;
6399 </td>
6400 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6401 </td></tr></table>
6402
6403 !!end
6404
6405 !! article
6406 Template:Includeonly section
6407 !! text
6408 <includeonly>
6409 ==Includeonly section==
6410 </includeonly>
6411 ==Section T-1==
6412 !!endarticle
6413
6414 !! test
6415 Bug 6563: Edit link generation for section shown by <includeonly>
6416 !! input
6417 {{includeonly section}}
6418 !! result
6419 <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>
6420 <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>
6421
6422 !! end
6423
6424 # Uses same input as the contents of [[Template:Includeonly section]]
6425 !! test
6426 Bug 6563: Section extraction for section shown by <includeonly>
6427 !! options
6428 section=T-2
6429 !! input
6430 <includeonly>
6431 ==Includeonly section==
6432 </includeonly>
6433 ==Section T-2==
6434 !! result
6435 ==Section T-2==
6436 !! end
6437
6438 !! test
6439 Bug 6563: Edit link generation for section suppressed by <includeonly>
6440 !! input
6441 <includeonly>
6442 ==Includeonly section==
6443 </includeonly>
6444 ==Section 1==
6445 !! result
6446 <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>
6447
6448 !! end
6449
6450 !! test
6451 Bug 6563: Section extraction for section suppressed by <includeonly>
6452 !! options
6453 section=1
6454 !! input
6455 <includeonly>
6456 ==Includeonly section==
6457 </includeonly>
6458 ==Section 1==
6459 !! result
6460 ==Section 1==
6461 !! end
6462
6463 !! test
6464 Un-closed <includeonly>
6465 !! input
6466 <includeonly>
6467 !! result
6468 !! end
6469
6470 ###
6471 ### <includeonly> and <noinclude> in attributes
6472 ###
6473 !!test
6474 0. includeonly around the entire attribute
6475 !!input
6476 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6477 !!result
6478 <p><span id="v2">bar</span>
6479 </p>
6480 !!end
6481
6482 !!test
6483 1. includeonly in html attr key
6484 !!input
6485 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6486 !!result
6487 <p><span id="foo">bar</span>
6488 </p>
6489 !!end
6490
6491 !!test
6492 2. includeonly in html attr value
6493 !!input
6494 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6495 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6496 !!result
6497 <p><span id="v1">bar</span>
6498 <span id="v1">bar</span>
6499 </p>
6500 !!end
6501
6502 !!test
6503 3. includeonly in part of an attr value
6504 !!input
6505 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6506 !!result
6507 <p><span style="color:red;">bar</span>
6508 </p>
6509 !!end
6510
6511 ###
6512 ### Testing parsing of templates where a template arg
6513 ### has the same name as the template itself.
6514 ###
6515
6516 !! article
6517 Template:quote
6518 !! text
6519 {{{quote|{{{1}}}}}}
6520 !! endarticle
6521
6522 !!test
6523 Templates: Template Name/Arg clash: 1. Use of positional param
6524 !!input
6525 {{quote|foo}}
6526 !!result
6527 <p>foo
6528 </p>
6529 !!end
6530
6531 !!test
6532 Templates: Template Name/Arg clash: 2. Use of named param
6533 !!input
6534 {{quote|quote=foo}}
6535 !!result
6536 <p>foo
6537 </p>
6538 !!end
6539
6540 !!test
6541 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6542 !!input
6543 {{quote|quote}}
6544 !!result
6545 <p>quote
6546 </p>
6547 !!end
6548
6549 ###
6550 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6551 ###
6552
6553 !!test
6554 Templates: 1. Simple use
6555 !!input
6556 {{echo|Foo}}
6557 !!result
6558 <p>Foo
6559 </p>
6560 !!end
6561
6562 !!test
6563 Templates: 2. Inside a block tag
6564 !!input
6565 <div>{{echo|Foo}}</div>
6566 !!result
6567 <div>Foo</div>
6568
6569 !!end
6570
6571 !!test
6572 Templates: P-wrapping: 1a. Templates on consecutive lines
6573 !!input
6574 {{echo|Foo}}
6575 {{echo|bar}}
6576 !!result
6577 <p>Foo
6578 bar
6579 </p>
6580 !!end
6581
6582 !!test
6583 Templates: P-wrapping: 1b. Templates on consecutive lines
6584 !!input
6585 Foo
6586
6587 {{echo|bar}}
6588 {{echo|baz}}
6589 !!result
6590 <p>Foo
6591 </p><p>bar
6592 baz
6593 </p>
6594 !!end
6595
6596 !!test
6597 Templates: P-wrapping: 1c. Templates on consecutive lines
6598 !!input
6599 {{echo|Foo}}
6600 {{echo|bar}} <div>baz</div>
6601 !!result
6602 <p>Foo
6603 </p>
6604 bar <div>baz</div>
6605
6606 !!end
6607
6608 !!test
6609 Templates: P-wrapping: 1d. Template preceded by comment-only line
6610 !!options
6611 parsoid=wt2html,wt2wt
6612 !!input
6613 <!-- foo -->
6614 {{echo|Bar}}
6615 !!result
6616 <!-- foo -->
6617 <p typeof="mw:Transclusion">Bar
6618 </p>
6619 !!end
6620
6621 !!test
6622 Templates: Inline Text: 1. Multiple tmeplate uses
6623 !!input
6624 {{echo|Foo}}bar{{echo|baz}}
6625 !!result
6626 <p>Foobarbaz
6627 </p>
6628 !!end
6629
6630 !!test
6631 Templates: Inline Text: 2. Back-to-back template uses
6632 !!input
6633 {{echo|Foo}}{{echo|bar}}
6634 !!result
6635 <p>Foobar
6636 </p>
6637 !!end
6638
6639 !!test
6640 Templates: Block Tags: 1. Multiple template uses
6641 !!input
6642 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6643 !!result
6644 <div>Foo</div><div>bar</div><div>baz</div>
6645
6646 !!end
6647
6648 !!test
6649 Templates: Block Tags: 2. Back-to-back template uses
6650 !!input
6651 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6652 !!result
6653 <div>Foo</div><div>bar</div>
6654
6655 !!end
6656
6657 !!test
6658 Templates: Links: 1. Simple example
6659 !!input
6660 {{echo|[[Foo|bar]]}}
6661 !!result
6662 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6663 </p>
6664 !!end
6665
6666 !!test
6667 Templates: Links: 2. Generation of link href
6668 !!input
6669 [[{{echo|Foo}}|bar]]
6670 !!result
6671 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6672 </p>
6673 !!end
6674
6675 !!test
6676 Templates: Links: 3. Generation of part of a link href
6677 !!input
6678 [[Fo{{echo|o}}|bar]]
6679
6680 [[Foo{{echo|bar}}]]
6681
6682 [[Foo{{echo|bar}}baz]]
6683
6684 [[Foo{{echo|bar}}|bar]]
6685
6686 [[:Foo{{echo|bar}}]]
6687
6688 [[:Foo{{echo|bar}}|bar]]
6689 !!result
6690 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6691 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6692 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6693 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6694 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6695 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6696 </p>
6697 !!end
6698
6699 !!test
6700 Templates: Links: 4. Multiple templates generating link href
6701 !!input
6702 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6703 !!result
6704 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6705 </p>
6706 !!end
6707
6708 !!test
6709 Templates: Links: 5. Generation of link text
6710 !!input
6711 [[Foo|{{echo|bar}}]]
6712 !!result
6713 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6714 </p>
6715 !!end
6716
6717 !!test
6718 Templates: Links: 5. Nested templates (only outermost template should be marked)
6719 !!input
6720 {{echo|[[{{echo|Foo}}|bar]]}}
6721 !!result
6722 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6723 </p>
6724 !!end
6725
6726 !!test
6727 Templates: HTML Tag: 1. Generation of HTML attr. key
6728 !!input
6729 <div {{echo|style}}="color:red;">foo</div>
6730 !!result
6731 <div style="color:red;">foo</div>
6732
6733 !!end
6734
6735 !!test
6736 Templates: HTML Tag: 2. Generation of HTML attr. value
6737 !!input
6738 <div style={{echo|'color:red;'}}>foo</div>
6739 !!result
6740 <div style="color:red;">foo</div>
6741
6742 !!end
6743
6744 !!test
6745 Templates: HTML Tag: 3. Generation of HTML attr key and value
6746 !!input
6747 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6748 !!result
6749 <div style="color:red;">foo</div>
6750
6751 !!end
6752
6753 !!test
6754 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6755 !!input
6756 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6757 !!result
6758 <div title="This is a long title with just one piece templated">foo</div>
6759
6760 !!end
6761
6762 !!test
6763 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6764 !!input
6765 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6766 !!result
6767 <div title="This is a long title with just one piece templated">foo</div>
6768
6769 !!end
6770
6771 !!test
6772 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6773 !!input
6774 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6775 !!result
6776 <div title="This is a long title with just one piece templated">foo</div>
6777
6778 !!end
6779
6780 !!test
6781 Templates: HTML Tag: 7. Generation of partial attribute key string
6782 !!input
6783 <div st{{echo|yle}}="color:red;">foo</div>
6784 !!result
6785 <div style="color:red;">foo</div>
6786
6787 !!end
6788
6789 !!test
6790 Templates: HTML Tables: 1. Generating start of a HTML table
6791 !!input
6792 {{echo|<table><tr><td>foo</td>}}</tr></table>
6793 !!result
6794 <table><tr><td>foo</td></tr></table>
6795
6796 !!end
6797
6798 !!test
6799 Templates: HTML Tables: 2a. Generating middle of a HTML table
6800 !!input
6801 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6802 !!result
6803 <table><tr><td>foo</td></tr></table>
6804
6805 !!end
6806
6807 !!test
6808 Templates: HTML Tables: 2b. Generating middle of a HTML table
6809 !!input
6810 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6811 !!result
6812 <table><tr><td>foo</td></tr></table>
6813
6814 !!end
6815
6816 !!test
6817 Templates: HTML Tables: 3. Generating end of a HTML table
6818 !!input
6819 <table><tr>{{echo|<td>foo</td></tr></table>}}
6820 !!result
6821 <table><tr><td>foo</td></tr></table>
6822
6823 !!end
6824
6825 !!test
6826 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6827 !!input
6828 {{echo|<table>}}<tr><td>foo</td></tr></table>
6829 !!result
6830 <table><tr><td>foo</td></tr></table>
6831
6832 !!end
6833
6834 !!test
6835 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6836 !!input
6837 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6838 !!result
6839 <table><tr><td>foo</td></tr></table>
6840
6841 !!end
6842
6843 !!test
6844 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6845 !!input
6846 <table><tr>{{echo|<td>}}foo</td></tr></table>
6847 !!result
6848 <table><tr><td>foo</td></tr></table>
6849
6850 !!end
6851
6852 !!test
6853 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6854 !!input
6855 <table><tr><td>foo{{echo|</td>}}</tr></table>
6856 !!result
6857 <table><tr><td>foo</td></tr></table>
6858
6859 !!end
6860
6861 !!test
6862 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6863 !!input
6864 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6865 !!result
6866 <table><tr><td>foo</td></tr></table>
6867
6868 !!end
6869
6870 !!test
6871 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6872 !!input
6873 <table><tr><td>foo</td></tr>{{echo|</table>}}
6874 !!result
6875 <table><tr><td>foo</td></tr></table>
6876
6877 !!end
6878
6879 !!test
6880 Templates: HTML Tables: 5. Proper fostering of categories from inside
6881 !!options
6882 parsoid=wt2html,wt2wt
6883 !!input
6884 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6885 <!--Two categories (Bug 50330)-->
6886 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6887 !!result
6888 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6889 <!--Two categories (Bug 50330)-->
6890 <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>
6891 !!end
6892
6893 !!test
6894 Templates: Wiki Tables: 1a. Fostering of entire template content
6895 !!input
6896 {|
6897 {{echo|a}}
6898 |}
6899 !!result
6900 <table>
6901 a
6902 <tr><td></td></tr></table>
6903
6904 !!end
6905
6906 !!test
6907 Templates: Wiki Tables: 1b. Fostering of entire template content
6908 !!input
6909 {|
6910 {{echo|<div>}}
6911 foo
6912 {{echo|</div>}}
6913 |}
6914 !!result
6915 <table>
6916 <div>
6917 <p>foo
6918 </p>
6919 </div>
6920 <tr><td></td></tr></table>
6921
6922 !!end
6923
6924 !!test
6925 Templates: Wiki Tables: 2. Fostering of partial template content
6926 !!input
6927 {|
6928 {{echo|a
6929 <div>b</div>}}
6930 |}
6931 !!result
6932 <table>
6933 a
6934 <div>b</div>
6935 <tr><td></td></tr></table>
6936
6937 !!end
6938
6939 !!test
6940 Templates: Wiki Tables: 3. td-content via multiple templates
6941 !!input
6942 {|
6943 {{echo|{{pipe}}a}}{{echo|b}}
6944 |}
6945 !!result
6946 <table>
6947 <tr>
6948 <td>ab
6949 </td></tr></table>
6950
6951 !!end
6952
6953 !!test
6954 Templates: Wiki Tables: 4. Templated tags, no content
6955 !!input
6956 {{tbl-start}}
6957 {{tbl-end}}
6958 !!result
6959 <table>
6960 <tr><td></td></tr></table>
6961
6962 !!end
6963
6964 !!test
6965 Templates: Wiki Tables: 5. Templated tags, regular 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: Wiki Tables: 6. Templated tags, templated td-tags
6980 !!input
6981 {{tbl-start}}
6982 {{!}}foo
6983 {{tbl-end}}
6984 !!result
6985 <table>
6986 <tr>
6987 <td>foo
6988 </td></tr></table>
6989
6990 !!end
6991
6992 !!test
6993 Templates: Lists: Multi-line list-items via templates
6994 !!input
6995 *{{echo|a {{nonexistent|
6996 unused}}}}
6997 *{{echo|b {{nonexistent|
6998 unused}}}}
6999 !!result
7000 <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>
7001 </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>
7002 </li></ul>
7003
7004 !!end
7005
7006 !!test
7007 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7008 !!input
7009 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7010 !!result
7011 <p><i>ab</i>c<i>d</i>e
7012 </p>
7013 !!end
7014
7015 !!test
7016 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7017 (PHP parser generates misnested html)
7018 !! options
7019 parsoid=wt2html,wt2wt
7020 !!input
7021 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7022 !!result
7023 <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>
7024 !!end
7025
7026 !!test
7027 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7028 (PHP parser generates misnested html)
7029 !! options
7030 parsoid=wt2html,wt2wt
7031 !!input
7032 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7033 !!result
7034 <div typeof="mw:Transclusion"><i>a</i></div>
7035 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7036 <div typeof="mw:Transclusion">e</div>
7037 !!end
7038
7039 !!test
7040 Templates: Ugly nesting: 4. Divs opened/closed across templates
7041 !!input
7042 a<div>b{{echo|c</div>d}}e
7043 !!result
7044 a<div>bc</div>de
7045
7046 !!end
7047
7048 !!test
7049 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7050 (Parsoid-centric)
7051 !! options
7052 parsoid
7053 !!input
7054 {|
7055 |{{echo|foo</table>}}
7056 |bar
7057 |}
7058 !!result
7059 <table typeof="mw:Transclusion">
7060 <tbody>
7061 <tr>
7062 <td>foo</td></tr></tbody></table><span>bar</span>
7063 !!end
7064
7065 !!test
7066 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7067 (Parsoid-centric)
7068 !! options
7069 parsoid
7070 !!input
7071 <table>
7072 <tr>
7073 <td>
7074 <table>
7075 <tr>
7076 <td>1. {{echo|foo </table>}}</td>
7077 <td> bar </td>
7078 <td>2. {{echo|baz </table>}}</td>
7079 </tr>
7080 <tr>
7081 <td>abc</td>
7082 </tr>
7083 </table>
7084 </td>
7085 </tr>
7086 <tr>
7087 <td>xyz</td>
7088 </tr>
7089 </table>
7090 !!result
7091 <table about="#mwt1" typeof="mw:Transclusion">
7092 <tbody><tr >
7093 <td >
7094 <table >
7095 <tbody><tr >
7096 <td >1. foo </td></tr></tbody></table></td>
7097 <td > bar </td>
7098 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7099 </span><span about="#mwt1">
7100
7101 abc</span><span about="#mwt1">
7102 </span><span about="#mwt1">
7103 </span><span about="#mwt1">
7104 </span><span about="#mwt1">
7105 </span><span about="#mwt1">
7106
7107 xyz</span><span about="#mwt1">
7108 </span><span about="#mwt1">
7109 </span>
7110 !!end
7111
7112 !! test
7113 Templates: Ugly templates: 3. newline-only template parameter
7114 !! input
7115 foo {{echo|
7116 }}
7117 !! result
7118 <p>foo
7119 </p>
7120 !! end
7121
7122 # This looks like a bug: a single newline triggers p/br for some reason.
7123 !! test
7124 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7125 !! input
7126 {{echo|
7127 }}
7128 !! result
7129 <p><br />
7130 </p>
7131 !! end
7132
7133
7134 !!test
7135 Parser Functions: 1. Simple example
7136 !!input
7137 {{uc:foo}}
7138 !!result
7139 <p>FOO
7140 </p>
7141 !!end
7142
7143 !!test
7144 Parser Functions: 2. Nested use (only outermost should be marked up)
7145 !!input
7146 {{uc:{{lc:FOO}}}}
7147 !!result
7148 <p>FOO
7149 </p>
7150 !!end
7151
7152 ###
7153 ### Pre-save transform tests
7154 ###
7155 !! test
7156 pre-save transform: subst:
7157 !! options
7158 PST
7159 !! input
7160 {{subst:test}}
7161 !! result
7162 This is a test template
7163 !! end
7164
7165 !! test
7166 pre-save transform: normal template
7167 !! options
7168 PST
7169 !! input
7170 {{test}}
7171 !! result
7172 {{test}}
7173 !! end
7174
7175 !! test
7176 pre-save transform: nonexistent template
7177 !! options
7178 PST
7179 !! input
7180 {{thistemplatedoesnotexist}}
7181 !! result
7182 {{thistemplatedoesnotexist}}
7183 !! end
7184
7185
7186 !! test
7187 pre-save transform: subst magic variables
7188 !! options
7189 PST
7190 !! input
7191 {{subst:SITENAME}}
7192 !! result
7193 MediaWiki
7194 !! end
7195
7196 # This is bug 89, which I fixed. -- wtm
7197 !! test
7198 pre-save transform: subst: templates with parameters
7199 !! options
7200 pst
7201 !! input
7202 {{subst:paramtest|param="something else"}}
7203 !! result
7204 This is a test template with parameter "something else"
7205 !! end
7206
7207 !! article
7208 Template:nowikitest
7209 !! text
7210 <nowiki>'''not wiki'''</nowiki>
7211 !! endarticle
7212
7213 !! test
7214 pre-save transform: nowiki in subst (bug 1188)
7215 !! options
7216 pst
7217 !! input
7218 {{subst:nowikitest}}
7219 !! result
7220 <nowiki>'''not wiki'''</nowiki>
7221 !! end
7222
7223
7224 !! article
7225 Template:commenttest
7226 !! text
7227 This template has <!-- a comment --> in it.
7228 !! endarticle
7229
7230 !! test
7231 pre-save transform: comment in subst (bug 1936)
7232 !! options
7233 pst
7234 !! input
7235 {{subst:commenttest}}
7236 !! result
7237 This template has <!-- a comment --> in it.
7238 !! end
7239
7240 !! test
7241 pre-save transform: unclosed tag
7242 !! options
7243 pst noxml
7244 !! input
7245 <nowiki>'''not wiki'''
7246 !! result
7247 <nowiki>'''not wiki'''
7248 !! end
7249
7250 !! test
7251 pre-save transform: mixed tag case
7252 !! options
7253 pst noxml
7254 !! input
7255 <NOwiki>'''not wiki'''</noWIKI>
7256 !! result
7257 <NOwiki>'''not wiki'''</noWIKI>
7258 !! end
7259
7260 !! test
7261 pre-save transform: unclosed comment in <nowiki>
7262 !! options
7263 pst noxml
7264 !! input
7265 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7266 !! result
7267 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7268 !!end
7269
7270 # Leading @ in this template definition works around a limitation
7271 # in parsoid's parserTests which otherwise strips the <span> from the
7272 # result (confusing it for a template wrapper)
7273 !! article
7274 Template:dangerous
7275 !!text
7276 @<span onmouseover="alert('crap')">Oh no</span>
7277 !!endarticle
7278
7279 !!test
7280 (confirming safety of fix for subst bug 1936)
7281 !! input
7282 {{Template:dangerous}}
7283 !! result
7284 <p>@<span>Oh no</span>
7285 </p>
7286 !! end
7287
7288 !! test
7289 pre-save transform: comment containing gallery (bug 5024)
7290 !! options
7291 pst
7292 !! input
7293 <!-- <gallery>data</gallery> -->
7294 !!result
7295 <!-- <gallery>data</gallery> -->
7296 !!end
7297
7298 !! test
7299 pre-save transform: comment containing extension
7300 !! options
7301 pst
7302 !! input
7303 <!-- <tag>data</tag> -->
7304 !!result
7305 <!-- <tag>data</tag> -->
7306 !!end
7307
7308 !! test
7309 pre-save transform: comment containing nowiki
7310 !! options
7311 pst
7312 !! input
7313 <!-- <nowiki>data</nowiki> -->
7314 !!result
7315 <!-- <nowiki>data</nowiki> -->
7316 !!end
7317
7318 !! test
7319 pre-save transform: <noinclude> in subst (bug 3298)
7320 !! options
7321 pst
7322 !! input
7323 {{subst:Includes}}
7324 !! result
7325 Foobar
7326 !! end
7327
7328 !! test
7329 pre-save transform: <onlyinclude> in subst (bug 3298)
7330 !! options
7331 pst
7332 !! input
7333 {{subst:Includes2}}
7334 !! result
7335 Foo
7336 !! end
7337
7338 !! article
7339 Template:SubstTest
7340 !!text
7341 {{<includeonly>subst:</includeonly>Includes}}
7342 !! endarticle
7343
7344 !! article
7345 Template:SafeSubstTest
7346 !! text
7347 {{<includeonly>safesubst:</includeonly>Includes}}
7348 !! endarticle
7349
7350 !! test
7351 bug 22297: safesubst: works during PST
7352 !! options
7353 pst
7354 !! input
7355 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7356 !! result
7357 FoobarFoobar
7358 !! end
7359
7360 !! test
7361 bug 22297: safesubst: works during normal parse
7362 !! input
7363 {{SafeSubstTest}}
7364 !! result
7365 <p>Foobar
7366 </p>
7367 !! end
7368
7369 !! test:
7370 subst: does not work during normal parse
7371 !! input
7372 {{SubstTest}}
7373 !! result
7374 <p>{{subst:Includes}}
7375 </p>
7376 !! end
7377
7378 !! test
7379 pre-save transform: context links ("pipe trick")
7380 !! options
7381 pst
7382 !! input
7383 [[Article (context)|]]
7384 [[Bar:Article|]]
7385 [[:Bar:Article|]]
7386 [[Bar:Article (context)|]]
7387 [[:Bar:Article (context)|]]
7388 [[|Article]]
7389 [[|Article (context)]]
7390 [[Bar:X (Y) Z|]]
7391 [[:Bar:X (Y) Z|]]
7392 !! result
7393 [[Article (context)|Article]]
7394 [[Bar:Article|Article]]
7395 [[:Bar:Article|Article]]
7396 [[Bar:Article (context)|Article]]
7397 [[:Bar:Article (context)|Article]]
7398 [[Article]]
7399 [[Article (context)]]
7400 [[Bar:X (Y) Z|X (Y) Z]]
7401 [[:Bar:X (Y) Z|X (Y) Z]]
7402 !! end
7403
7404 !! test
7405 pre-save transform: context links ("pipe trick") with interwiki prefix
7406 !! options
7407 pst
7408 !! input
7409 [[interwiki:Article|]]
7410 [[:interwiki:Article|]]
7411 [[interwiki:Bar:Article|]]
7412 [[:interwiki:Bar:Article|]]
7413 !! result
7414 [[interwiki:Article|Article]]
7415 [[:interwiki:Article|Article]]
7416 [[interwiki:Bar:Article|Bar:Article]]
7417 [[:interwiki:Bar:Article|Bar:Article]]
7418 !! end
7419
7420 !! test
7421 pre-save transform: context links ("pipe trick") with parens in title
7422 !! options
7423 pst title=[[Somearticle (context)]]
7424 !! input
7425 [[|Article]]
7426 !! result
7427 [[Article (context)|Article]]
7428 !! end
7429
7430 !! test
7431 pre-save transform: context links ("pipe trick") with comma in title
7432 !! options
7433 pst title=[[Someplace, Somewhere]]
7434 !! input
7435 [[|Otherplace]]
7436 [[Otherplace, Elsewhere|]]
7437 [[Otherplace, Elsewhere, Anywhere|]]
7438 !! result
7439 [[Otherplace, Somewhere|Otherplace]]
7440 [[Otherplace, Elsewhere|Otherplace]]
7441 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7442 !! end
7443
7444 !! test
7445 pre-save transform: context links ("pipe trick") with parens and comma
7446 !! options
7447 pst title=[[Someplace (IGNORED), Somewhere]]
7448 !! input
7449 [[|Otherplace]]
7450 [[Otherplace (place), Elsewhere|]]
7451 !! result
7452 [[Otherplace, Somewhere|Otherplace]]
7453 [[Otherplace (place), Elsewhere|Otherplace]]
7454 !! end
7455
7456 !! test
7457 pre-save transform: context links ("pipe trick") with comma and parens
7458 !! options
7459 pst title=[[Who, me? (context)]]
7460 !! input
7461 [[|Yes, you.]]
7462 [[Me, Myself, and I (1937 song)|]]
7463 !! result
7464 [[Yes, you. (context)|Yes, you.]]
7465 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7466 !! end
7467
7468 !! test
7469 pre-save transform: context links ("pipe trick") with namespace
7470 !! options
7471 pst title=[[Ns:Somearticle]]
7472 !! input
7473 [[|Article]]
7474 !! result
7475 [[Ns:Article|Article]]
7476 !! end
7477
7478 !! test
7479 pre-save transform: context links ("pipe trick") with namespace and parens
7480 !! options
7481 pst title=[[Ns:Somearticle (context)]]
7482 !! input
7483 [[|Article]]
7484 !! result
7485 [[Ns:Article (context)|Article]]
7486 !! end
7487
7488 !! test
7489 pre-save transform: context links ("pipe trick") with namespace and comma
7490 !! options
7491 pst title=[[Ns:Somearticle, Context, Whatever]]
7492 !! input
7493 [[|Article]]
7494 !! result
7495 [[Ns:Article, Context, Whatever|Article]]
7496 !! end
7497
7498 !! test
7499 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7500 !! options
7501 pst title=[[Ns:Somearticle, Context (context)]]
7502 !! input
7503 [[|Article]]
7504 !! result
7505 [[Ns:Article (context)|Article]]
7506 !! end
7507
7508 !! test
7509 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7510 !! options
7511 pst title=[[Ns:Somearticle (IGNORED), Context]]
7512 !! input
7513 [[|Article]]
7514 !! result
7515 [[Ns:Article, Context|Article]]
7516 !! end
7517
7518 !! test
7519 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7520 !! options
7521 pst
7522 !! input
7523 [[Article(context)|]]
7524 [[Bar:Article(context)|]]
7525 [[:Bar:Article(context)|]]
7526 [[|Article(context)]]
7527 [[Bar:X(Y)Z|]]
7528 [[:Bar:X(Y)Z|]]
7529 !! result
7530 [[Article(context)|Article]]
7531 [[Bar:Article(context)|Article]]
7532 [[:Bar:Article(context)|Article]]
7533 [[Article(context)]]
7534 [[Bar:X(Y)Z|X(Y)Z]]
7535 [[:Bar:X(Y)Z|X(Y)Z]]
7536 !! end
7537
7538 !! test
7539 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7540 !! options
7541 pst
7542 !! input
7543 [[Article (context)|]]
7544 [[Bar:Article (context)|]]
7545 [[:Bar:Article (context)|]]
7546 [[|Article (context)]]
7547 [[Bar:X (Y) Z|]]
7548 [[:Bar:X (Y) Z|]]
7549 !! result
7550 [[Article (context)|Article]]
7551 [[Bar:Article (context)|Article]]
7552 [[:Bar:Article (context)|Article]]
7553 [[Article (context)]]
7554 [[Bar:X (Y) Z|X (Y) Z]]
7555 [[:Bar:X (Y) Z|X (Y) Z]]
7556 !! end
7557
7558 !! test
7559 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7560 !! options
7561 pst
7562 !! input
7563 [[Article(context)|]]
7564 [[Bar:Article(context)|]]
7565 [[:Bar:Article(context)|]]
7566 [[|Article(context)]]
7567 [[Bar:X(Y)Z|]]
7568 [[:Bar:X(Y)Z|]]
7569 !! result
7570 [[Article(context)|Article]]
7571 [[Bar:Article(context)|Article]]
7572 [[:Bar:Article(context)|Article]]
7573 [[Article(context)]]
7574 [[Bar:X(Y)Z|X(Y)Z]]
7575 [[:Bar:X(Y)Z|X(Y)Z]]
7576 !! end
7577
7578 !! test
7579 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7580 !! options
7581 pst
7582 !! input
7583 [[Article (context), context|]]
7584 [[Article (context),context|]]
7585 [[Bar:Article (context), context|]]
7586 [[Bar:Article (context),context|]]
7587 [[:Bar:Article (context), context|]]
7588 [[:Bar:Article (context),context|]]
7589 !! result
7590 [[Article (context), context|Article]]
7591 [[Article (context),context|Article]]
7592 [[Bar:Article (context), context|Article]]
7593 [[Bar:Article (context),context|Article]]
7594 [[:Bar:Article (context), context|Article]]
7595 [[:Bar:Article (context),context|Article]]
7596 !! end
7597
7598 !! test
7599 pre-save transform: trim trailing empty lines
7600 !! options
7601 pst
7602 !! input
7603 Empty lines are trimmed
7604
7605
7606
7607
7608 !! result
7609 Empty lines are trimmed
7610 !! end
7611
7612 !! test
7613 pre-save transform: Signature expansion
7614 !! options
7615 pst
7616 !! input
7617 * ~~~
7618 * <noinclude>~~~</noinclude>
7619 * <includeonly>~~~</includeonly>
7620 * <onlyinclude>~~~</onlyinclude>
7621 !! result
7622 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7623 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7624 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7625 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7626 !! end
7627
7628
7629 !! test
7630 pre-save transform: Signature expansion in nowiki tags (bug 93)
7631 !! options
7632 pst disabled
7633 !! input
7634 Shall not expand:
7635
7636 <nowiki>~~~~</nowiki>
7637
7638 <includeonly><nowiki>~~~~</nowiki></includeonly>
7639
7640 <noinclude><nowiki>~~~~</nowiki></noinclude>
7641
7642 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7643
7644 {{subst:Foo}} shall be converted to FOO
7645
7646 As well as inside noinclude/onlyinclude
7647 <noinclude>{{subst:Foo}}</noinclude>
7648 <onlyinclude>{{subst:Foo}}</onlyinclude>
7649
7650 But not inside includeonly
7651 <includeonly>{{subst:Foo}}</includeonly>
7652 !! result
7653 Shall not expand:
7654
7655 <nowiki>~~~~</nowiki>
7656
7657 <includeonly><nowiki>~~~~</nowiki></includeonly>
7658
7659 <noinclude><nowiki>~~~~</nowiki></noinclude>
7660
7661 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7662
7663 FOO shall be converted to FOO
7664
7665 As well as inside noinclude/onlyinclude
7666 <noinclude>FOO</noinclude>
7667 <onlyinclude>FOO</onlyinclude>
7668
7669 But not inside includeonly
7670 <includeonly>{{subst:Foo}}</includeonly>
7671 !! end
7672
7673 ###
7674 ### Message transform tests
7675 ###
7676 !! test
7677 message transform: magic variables
7678 !! options
7679 msg
7680 !! input
7681 {{SITENAME}}
7682 !! result
7683 MediaWiki
7684 !! end
7685
7686 !! test
7687 message transform: should not transform wiki markup
7688 !! options
7689 msg
7690 !! input
7691 ''test''
7692 !! result
7693 ''test''
7694 !! end
7695
7696 !! test
7697 message transform: <noinclude> in transcluded template (bug 4926)
7698 !! options
7699 msg
7700 !! input
7701 {{Includes}}
7702 !! result
7703 Foobar
7704 !! end
7705
7706 !! test
7707 message transform: <onlyinclude> in transcluded template (bug 4926)
7708 !! options
7709 msg
7710 !! input
7711 {{Includes2}}
7712 !! result
7713 Foo
7714 !! end
7715
7716 !! test
7717 {{#special:}} page name, known
7718 !! options
7719 msg
7720 !! input
7721 {{#special:Recentchanges}}
7722 !! result
7723 Special:RecentChanges
7724 !! end
7725
7726 !! test
7727 {{#special:}} page name with subpage, known
7728 !! options
7729 msg
7730 !! input
7731 {{#special:Recentchanges/param}}
7732 !! result
7733 Special:RecentChanges/param
7734 !! end
7735
7736 !! test
7737 {{#special:}} page name, unknown
7738 !! options
7739 msg
7740 !! input
7741 {{#special:foobar nonexistent}}
7742 !! result
7743 Special:Foobar nonexistent
7744 !! end
7745
7746 !! test
7747 {{#speciale:}} page name, known
7748 !! options
7749 msg
7750 !! input
7751 {{#speciale:Recentchanges}}
7752 !! result
7753 Special:RecentChanges
7754 !! end
7755
7756 !! test
7757 {{#speciale:}} page name with subpage, known
7758 !! options
7759 msg
7760 !! input
7761 {{#speciale:Recentchanges/param}}
7762 !! result
7763 Special:RecentChanges/param
7764 !! end
7765
7766 !! test
7767 {{#speciale:}} page name, unknown
7768 !! options
7769 msg
7770 !! input
7771 {{#speciale:foobar nonexistent}}
7772 !! result
7773 Special:Foobar_nonexistent
7774 !! end
7775
7776 ###
7777 ### Images
7778 ###
7779 !! test
7780 Simple image
7781 !! input
7782 [[Image:foobar.jpg]]
7783 !! result
7784 <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>
7785 </p>
7786 !! end
7787
7788 !! test
7789 Right-aligned image
7790 !! input
7791 [[Image:foobar.jpg|right]]
7792 !! result
7793 <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>
7794
7795 !! end
7796
7797 !! test
7798 Simple image (using File: namespace, now canonical)
7799 !! input
7800 [[File:foobar.jpg]]
7801 !! result
7802 <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>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Image with caption
7808 !! input
7809 [[Image:foobar.jpg|right|Caption text]]
7810 !! result
7811 <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>
7812
7813 !! end
7814
7815 !! test
7816 Image with empty attribute
7817 !! input
7818 [[Image:foobar.jpg|right||Caption text]]
7819 !! result
7820 <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>
7821
7822 !! end
7823
7824 !! test
7825 Image with link tails
7826 !! input
7827 123[[Image:foobar.jpg]]456
7828 123[[Image:foobar.jpg|right]]456
7829 123[[Image:foobar.jpg|thumb]]456
7830 !! result
7831 <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
7832 </p>
7833 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
7834 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
7835
7836 !! end
7837
7838 !! test
7839 Image with multiple captions -- only last one is accepted
7840 !! input
7841 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7842 !! result
7843 <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>
7844
7845 !! end
7846
7847 !! test
7848 Image with width attribute at different positions
7849 !! input
7850 [[Image:foobar.jpg|200px|right|Caption]]
7851 [[Image:foobar.jpg|right|200px|Caption]]
7852 [[Image:foobar.jpg|right|Caption|200px]]
7853 !! result
7854 <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>
7855 <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>
7856 <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>
7857
7858 !! end
7859
7860 !! test
7861 Image with link parameter, wiki target
7862 !! input
7863 [[Image:foobar.jpg|link=Target page]]
7864 !! result
7865 <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>
7866 </p>
7867 !! end
7868
7869 !! test
7870 Image with link parameter, URL target
7871 !! input
7872 [[Image:foobar.jpg|link=http://example.com/]]
7873 !! result
7874 <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>
7875 </p>
7876 !! end
7877
7878 !! test
7879 Image with link parameter, wgExternalLinkTarget
7880 !! input
7881 [[Image:foobar.jpg|link=http://example.com/]]
7882 !! config
7883 wgExternalLinkTarget='foobar'
7884 !! result
7885 <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>
7886 </p>
7887 !! end
7888
7889 !! test
7890 Image with link parameter, wgNoFollowLinks set to false
7891 !! input
7892 [[Image:foobar.jpg|link=http://example.com/]]
7893 !! config
7894 wgNoFollowLinks=false
7895 !! result
7896 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7897 </p>
7898 !! end
7899
7900 !! test
7901 Image with link parameter, wgNoFollowDomainExceptions
7902 !! input
7903 [[Image:foobar.jpg|link=http://example.com/]]
7904 !! config
7905 wgNoFollowDomainExceptions='example.com'
7906 !! result
7907 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7908 </p>
7909 !! end
7910
7911 !! test
7912 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7913 !! input
7914 [[Image:foobar.jpg|link=http://example.com/|Title]]
7915 !! config
7916 wgExternalLinkTarget='foobar'
7917 !! result
7918 <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>
7919 </p>
7920 !! end
7921
7922 !! test
7923 Image with empty link parameter
7924 !! input
7925 [[Image:foobar.jpg|link=]]
7926 !! result
7927 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7928 </p>
7929 !! end
7930
7931 !! test
7932 Image with link parameter (wiki target) and unnamed parameter
7933 !! input
7934 [[Image:foobar.jpg|link=Target page|Title]]
7935 !! result
7936 <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>
7937 </p>
7938 !! end
7939
7940 !! test
7941 Image with link parameter (URL target) and unnamed parameter
7942 !! input
7943 [[Image:foobar.jpg|link=http://example.com/|Title]]
7944 !! result
7945 <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>
7946 </p>
7947 !! end
7948
7949 !! test
7950 Thumbnail image with link parameter
7951 !! options
7952 php
7953 !! input
7954 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7955 !! result
7956 <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>
7957
7958 !! end
7959
7960 !! test
7961 Manually-specified thumbnail image
7962 !! options
7963 php
7964 !! input
7965 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7966 !! result
7967 <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>
7968
7969 !! end
7970
7971 !! test
7972 Manually-specified thumbnail image with explicit link to wiki page
7973 !! options
7974 php
7975 !! input
7976 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7977 !! result
7978 <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>
7979
7980 !! end
7981
7982 !! test
7983 Manually-specified thumbnail image with explicit link to url
7984 !! options
7985 php
7986 !! input
7987 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7988 !! result
7989 <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>
7990
7991 !! end
7992
7993 !! test
7994 Manually-specified thumbnail image with explicit no link
7995 !! options
7996 php
7997 !! input
7998 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7999 !! result
8000 <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>
8001
8002 !! end
8003
8004 !! test
8005 Manually-specified thumbnail image with explicit link and alt text
8006 !! options
8007 php
8008 !! input
8009 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8010 !! result
8011 <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>
8012
8013 !! end
8014
8015 !! test
8016 Image with frame and link
8017 !! input
8018 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8019 !! result
8020 <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>
8021
8022 !! end
8023
8024 !! test
8025 Image with frame and link and explicit alt
8026 !! input
8027 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8028 !! result
8029 <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>
8030
8031 !! end
8032
8033 !! test
8034 Image with wiki markup in implicit alt
8035 !! input
8036 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8037 !! result
8038 <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>
8039 </p>
8040 !! end
8041
8042 !! test
8043 Image with wiki markup in explicit alt
8044 !! input
8045 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8046 !! result
8047 <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>
8048 </p>
8049 !! end
8050
8051 !! test
8052 Link to image page- image page normally doesn't exists, hence edit link
8053 Add test with existing image page
8054 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8055 !! input
8056 [[:Image:test]]
8057 !! result
8058 <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>
8059 </p>
8060 !! end
8061
8062 !! test
8063 bug 18784 Link to non-existent image page with caption should use caption as link text
8064 !! input
8065 [[:Image:test|caption]]
8066 !! result
8067 <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>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Frameless image caption with a free URL
8073 !! input
8074 [[Image:foobar.jpg|http://example.com]]
8075 !! result
8076 <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>
8077 </p>
8078 !! end
8079
8080 !! test
8081 Thumbnail image caption with a free URL
8082 !! input
8083 [[Image:foobar.jpg|thumb|http://example.com]]
8084 !! result
8085 <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>
8086
8087 !! end
8088
8089 !! test
8090 Thumbnail image caption with a free URL and explicit alt
8091 !! input
8092 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8093 !! result
8094 <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>
8095
8096 !! end
8097
8098 !! test
8099 SVG thumbnails with no language set
8100 !! options
8101 !! input
8102 [[File:Foobar.svg|thumb|width=200]]
8103 !! result
8104 <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>
8105
8106 !! end
8107
8108 !! test
8109 SVG thumbnails with language de
8110 !! options
8111 !! input
8112 [[File:Foobar.svg|thumb|width=200|lang=de]]
8113 !! result
8114 <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>
8115
8116 !! end
8117
8118 !! test
8119 SVG thumbnails with invalid language code
8120 !! options
8121 !! input
8122 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8123 !! result
8124 <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>
8125
8126 !! end
8127
8128 !! test
8129 BUG 1887: A ISBN with a thumbnail
8130 !! input
8131 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8132 !! result
8133 <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>
8134
8135 !! end
8136
8137 !! test
8138 BUG 1887: A RFC with a thumbnail
8139 !! input
8140 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8141 !! result
8142 <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>
8143
8144 !! end
8145
8146 !! test
8147 BUG 1887: A mailto link with a thumbnail
8148 !! input
8149 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8150 !! result
8151 <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>
8152
8153 !! end
8154
8155 # Pending resolution to bug 368
8156 !! test
8157 BUG 648: Frameless image caption with a link
8158 !! input
8159 [[Image:foobar.jpg|text with a [[link]] in it]]
8160 !! result
8161 <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>
8162 </p>
8163 !! end
8164
8165 !! test
8166 BUG 648: Frameless image caption with a link (suffix)
8167 !! input
8168 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8169 !! result
8170 <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>
8171 </p>
8172 !! end
8173
8174 !! test
8175 BUG 648: Frameless image caption with an interwiki link
8176 !! input
8177 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8178 !! result
8179 <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>
8180 </p>
8181 !! end
8182
8183 !! test
8184 BUG 648: Frameless image caption with a piped interwiki link
8185 !! input
8186 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8187 !! result
8188 <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>
8189 </p>
8190 !! end
8191
8192 !! test
8193 Escape HTML special chars in image alt text
8194 !! input
8195 [[Image:foobar.jpg|& < > "]]
8196 !! result
8197 <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>
8198 </p>
8199 !! end
8200
8201 !! test
8202 BUG 499: Alt text should have &#1234;, not &amp;1234;
8203 !! input
8204 [[Image:foobar.jpg|&#9792;]]
8205 !! result
8206 <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>
8207 </p>
8208 !! end
8209
8210 !! test
8211 Broken image caption with link
8212 !! input
8213 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8214 !! result
8215 <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.
8216 </p>
8217 !! end
8218
8219 !! test
8220 Image caption containing another image
8221 !! input
8222 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8223 !! result
8224 <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>
8225
8226 !! end
8227
8228 !! test
8229 Image caption containing a newline
8230 !! input
8231 [[Image:Foobar.jpg|This
8232 *is some text]]
8233 !! result
8234 <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>
8235 </p>
8236 !!end
8237
8238 !!test
8239 Parsoid: Image caption containing leading space
8240 (The leading space should not trigger nowiki escaping in wt2wt mode)
8241 !! input
8242 [[Image:Foobar.jpg|thumb| bar]]
8243 !! result
8244 <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>
8245
8246 !!end
8247
8248 !! test
8249 Bug 3090: External links other than http: in image captions
8250 !! input
8251 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8252 !! result
8253 <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>
8254
8255 !! end
8256
8257 !! test
8258 Custom class
8259 !! input
8260 [[Image:foobar.jpg|a|class=b]]
8261 !! result
8262 <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>
8263 </p>
8264 !! end
8265
8266 !! test
8267 Localized image handling (1).
8268 !! options
8269 language=es
8270 !! input
8271 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8272 !! result
8273 <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>
8274
8275 !! end
8276
8277 !! test
8278 Localized image handling (2).
8279 !! options
8280 language=es
8281 !! input
8282 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8283 !! result
8284 <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>
8285
8286 !! end
8287
8288 !! test
8289 "border", "frameless" and "class" attributes on an image.
8290 !! input
8291 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8292 !! result
8293 <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>
8294 </p>
8295 !! end
8296
8297 !! article
8298 File:Barfoo.jpg
8299 !! text
8300 #REDIRECT [[File:Barfoo.jpg]]
8301 !! endarticle
8302
8303 !! test
8304 Redirected image
8305 !! input
8306 [[Image:Barfoo.jpg]]
8307 !! result
8308 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8309 </p>
8310 !! end
8311
8312 !! test
8313 Missing image with uploads disabled
8314 !! options
8315 wgEnableUploads=0
8316 !! input
8317 [[Image:Foobaz.jpg]]
8318 !! result
8319 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8320 </p>
8321 !! end
8322
8323 # Parsoid-specific testing for images
8324 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8325 # Currently imperfect due to a flaw in the Parsoid testrunner
8326 # Work in progress
8327
8328 !! test
8329 Parsoid-specific image handling - simple image
8330 !! options
8331 parsoid
8332 !! input
8333 [[Image:Foobar.jpg]]
8334 !! result
8335 <p>
8336 <span class="mw-default-size" typeof="mw:Image">
8337 <a href="File:Foobar.jpg">
8338 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8339 </a>
8340 </span>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Parsoid-specific image handling - simple image without link
8346 !! options
8347 parsoid
8348 !! input
8349 [[Image:Foobar.jpg|link=]]
8350 !! result
8351 <p>
8352 <span class="mw-default-size" typeof="mw:Image">
8353 <span>
8354 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8355 </span>
8356 </span>
8357 </p>
8358 !! end
8359
8360 !! test
8361 Parsoid-specific image handling - simple image with specific link
8362 !! options
8363 parsoid
8364 !! input
8365 [[Image:Foobar.jpg|link=Main Page]]
8366 !! result
8367 <p>
8368 <span class="mw-default-size" typeof="mw:Image">
8369 <a href="Main_Page">
8370 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8371 </a>
8372 </span>
8373 </p>
8374 !! end
8375
8376 !! test
8377 Parsoid-specific image handling - simple image with size and middle alignment
8378 !! options
8379 parsoid
8380 !! input
8381 [[Image:Foobar.jpg|50px|middle]]
8382 !! result
8383 <p>
8384 <span class="mw-valign-middle" typeof="mw:Image">
8385 <a href="File:Foobar.jpg">
8386 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8387 </a>
8388 </span>
8389 </p>
8390 !! end
8391
8392 !! test
8393 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8394 !! options
8395 parsoid
8396 !! input
8397 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8398 !! result
8399 <p>
8400 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8401 <a href="File:Foobar.jpg">
8402 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8403 </a>
8404 </span>
8405 </p>
8406 !! end
8407
8408 !! test
8409 Parsoid-specific image handling - simple image with border and size spec
8410 !! options
8411 parsoid
8412 !! input
8413 [[Image:Foobar.jpg|50px|border|caption]]
8414 !! result
8415 <p>
8416 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8417 <a href="File:Foobar.jpg">
8418 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8419 </a>
8420 </span>
8421 </p>
8422 !! end
8423
8424 !! test
8425 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8426 !! options
8427 parsoid
8428 !! input
8429 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8430 !! result
8431 <figure class="mw-default-size mw-halign-left mw-valign-baseline" 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/180px-Foobar.jpg" height="21" width="180" />
8434 </a>
8435 <figcaption>caption content</figcaption>
8436 </figure>
8437 !! end
8438
8439 !! test
8440 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8441 !! options
8442 parsoid
8443 !! input
8444 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8445 !! result
8446 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8447 <a href="File:Foobar.jpg">
8448 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8449 </a>
8450 <figcaption>caption</figcaption>
8451 </figure>
8452 !! end
8453
8454 !! test
8455 Parsoid-specific image handling - framed image with specific size and caption
8456 !! options
8457 parsoid
8458 !! input
8459 [[Image:Foobar.jpg|500x50px|frame|caption]]
8460 !! result
8461 <figure 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 - framed image with specific size, halign, valign, and caption
8471 !! options
8472 parsoid
8473 !! input
8474 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8475 !! result
8476 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8477 <a href="File:Foobar.jpg">
8478 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8479 </a>
8480 <figcaption>caption</figcaption>
8481 </figure>
8482 !! end
8483
8484 !! test
8485 Parsoid-specific image handling - frameless image with specific size, border, and caption
8486 !! options
8487 parsoid
8488 !! input
8489 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8490 !! result
8491 <p>
8492 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8493 <a href="File:Foobar.jpg">
8494 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8495 </a>
8496 </p>
8497 !! end
8498
8499 #!! test
8500 #Parsoid-specific image handling - simple image with a formatted caption
8501 #!! options
8502 #parsoid
8503 #!! input
8504 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8505 #!! result
8506 #<p>
8507 #<span typeof="mw:Image">
8508 #<a class="mw-default-size" href="Image:Foobar.jpg">
8509 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8510 #</a>
8511 #<span>abc</span>
8512 #</span>
8513 #</p>
8514
8515
8516 ###
8517 ### Subpages
8518 ###
8519 !! article
8520 Subpage test/subpage
8521 !! text
8522 foo
8523 !! endarticle
8524
8525 !! test
8526 Subpage link
8527 !! options
8528 subpage title=[[Subpage test]]
8529 !! input
8530 [[/subpage]]
8531 !! result
8532 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8533 </p>
8534 !! end
8535
8536 !! test
8537 Subpage noslash link
8538 !! options
8539 subpage title=[[Subpage test]]
8540 !!input
8541 [[/subpage/]]
8542 !! result
8543 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8544 </p>
8545 !! end
8546
8547 # TODO: make this PHP-parser compatible!
8548 !! test
8549 Relative subpage noslash link
8550 !! options
8551 parsoid=wt2wt,wt2html,html2html
8552 subpage title=[[Subpage test/1/2/3/4]]
8553 !!input
8554 [[../../subpage/]]
8555
8556 [[../../subpage]]
8557 !! result
8558 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8559 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8560 !! end
8561
8562 # TODO: make this PHP-parser compatible!
8563 !! test
8564 Parsoid: dot-slash prefixed wikilinks
8565 !! options
8566 parsoid=wt2wt,wt2html,html2html
8567 !!input
8568 [[./foo]]
8569
8570 [[././bar]]
8571
8572 [[././baz/]]
8573 !! result
8574 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8575 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8576 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8577 !! end
8578
8579 !! test
8580 Disabled subpages
8581 !! input
8582 [[/subpage]]
8583 !! result
8584 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8585 </p>
8586 !! end
8587
8588 !! test
8589 BUG 561: {{/Subpage}}
8590 !! options
8591 subpage title=[[Page]]
8592 !! input
8593 {{/Subpage}}
8594 !! result
8595 <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>
8596 </p>
8597 !! end
8598
8599 ###
8600 ### Categories
8601 ###
8602 !! article
8603 Category:MediaWiki User's Guide
8604 !! text
8605 blah
8606 !! endarticle
8607
8608 !! test
8609 Link to category
8610 !! input
8611 [[:Category:MediaWiki User's Guide]]
8612 !! result
8613 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8614 </p>
8615 !! end
8616
8617 !! test
8618 Simple category
8619 !! options
8620 cat
8621 !! input
8622 [[Category:MediaWiki User's Guide]]
8623 !! result
8624 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8625 !! end
8626
8627 !! test
8628 PAGESINCATEGORY invalid title fatal (r33546 fix)
8629 !! input
8630 {{PAGESINCATEGORY:<bogus>}}
8631 !! result
8632 <p>0
8633 </p>
8634 !! end
8635
8636 !! test
8637 Category with different sort key
8638 !! options
8639 cat
8640 !! input
8641 [[Category:MediaWiki User's Guide|Foo]]
8642 !! result
8643 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8644 !! end
8645
8646 !! test
8647 Category with identical sort key
8648 !! options
8649 cat
8650 !! input
8651 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8652 !! result
8653 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8654 !! end
8655
8656 !! test
8657 Category with empty sort key
8658 !! options
8659 cat
8660 pst
8661 !! input
8662 [[Category:MediaWiki User's Guide|]]
8663 !! result
8664 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8665 !! end
8666
8667 !! test
8668 Category with empty sort key and parentheses
8669 !! options
8670 cat
8671 pst
8672 !! input
8673 [[Category:Foo (bar)|]]
8674 !! result
8675 [[Category:Foo (bar)|Foo]]
8676 !! end
8677
8678 !! test
8679 Category with link tail
8680 !! options
8681 cat
8682 pst
8683 !! input
8684 123[[Category:Foo]]456
8685 !! result
8686 123[[Category:Foo]]456
8687 !! end
8688
8689 !! test
8690 Category with template
8691 !! options
8692 cat
8693 pst
8694 !! input
8695 [[Category:{{echo|Foo}}]]
8696 !! result
8697 [[Category:{{echo|Foo}}]]
8698 !! end
8699
8700 !! test
8701 Category with template in sort key
8702 !! options
8703 cat
8704 pst
8705 !! input
8706 [[Category:Foo|{{echo|Bar}}]]
8707 !! result
8708 [[Category:Foo|{{echo|Bar}}]]
8709 !! end
8710
8711 !! test
8712 Category with template in sort key and title
8713 !! options
8714 cat
8715 pst
8716 !! input
8717 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8718 !! result
8719 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8720 !! end
8721
8722 !! test
8723 Category / paragraph interactions
8724 !! input
8725 Foo [[Category:Baz]] Bar
8726
8727 Foo [[Category:Baz]]
8728 Bar
8729
8730 Foo
8731 [[Category:Baz]]
8732 Bar
8733
8734 Foo
8735 [[Category:Baz]] Bar
8736
8737 Foo
8738 [[Category:Baz]]
8739 [[Category:Baz]]
8740 [[Category:Baz]]
8741 Bar
8742
8743 [[Category:Baz]]
8744 [[Category:Baz]]
8745 [[Category:Baz]]
8746
8747 [[Category:Baz]]
8748 {{echo|[[Category:Baz]]}}
8749 [[Category:Baz]]
8750 !! result
8751 <p>Foo Bar
8752 </p><p>Foo
8753 Bar
8754 </p><p>Foo
8755 Bar
8756 </p><p>Foo Bar
8757 </p><p>Foo
8758 Bar
8759 </p>
8760 !! end
8761
8762 !! test
8763 Parsoid: Serialize link to category page with colon escape
8764 !! options
8765 parsoid
8766 !! input
8767
8768 [[:Category:Foo]]
8769 [[:Category:Foo|Bar]]
8770 !! result
8771 <p>
8772 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8773 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8774 </p>
8775 !! end
8776
8777 !! test
8778 Parsoid: Serialize link to file page with colon escape
8779 !! options
8780 parsoid
8781 !! input
8782
8783 [[:File:Foo.png]]
8784 [[:File:Foo.png|Bar]]
8785 !! result
8786 <p>
8787 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8788 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8789 </p>
8790 !! end
8791
8792 !! test
8793 Parsoid: Serialize a genuine category link without colon escape
8794 !! options
8795 parsoid
8796 !! input
8797 [[Category:Foo]]
8798 [[Category:Foo|Bar]]
8799 !! result
8800 <link rel="mw:WikiLink/Category" href="Category:Foo">
8801 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8802 !! end
8803
8804 ###
8805 ### Inter-language links
8806 ###
8807 !! test
8808 Inter-language links
8809 !! options
8810 ill
8811 !! input
8812 [[es:Alimento]]
8813 [[fr:Nourriture]]
8814 [[zh:&#39135;&#21697;]]
8815 !! result
8816 es:Alimento fr:Nourriture zh:食品
8817 !! end
8818
8819 !! test
8820 Duplicate interlanguage links (bug 24502)
8821 !! options
8822 ill
8823 !! input
8824 [[es:1]]
8825 [[es:2]]
8826 [[fr:1]]
8827 [[fr:2]]
8828 !! result
8829 es:1 fr:1
8830 !! end
8831
8832 ###
8833 ### Sections
8834 ###
8835 !! test
8836 Basic section headings
8837 !! input
8838 == Headline 1 ==
8839 Some text
8840
8841 ==Headline 2==
8842 More
8843 ===Smaller headline===
8844 Blah blah
8845 !! result
8846 <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>
8847 <p>Some text
8848 </p>
8849 <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>
8850 <p>More
8851 </p>
8852 <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>
8853 <p>Blah blah
8854 </p>
8855 !! end
8856
8857 !! test
8858 Section headings with TOC
8859 !! input
8860 == Headline 1 ==
8861 === Subheadline 1 ===
8862 ===== Skipping a level =====
8863 ====== Skipping a level ======
8864
8865 == Headline 2 ==
8866 Some text
8867 ===Another headline===
8868 !! result
8869 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8870 <ul>
8871 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8872 <ul>
8873 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8874 <ul>
8875 <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>
8876 <ul>
8877 <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>
8878 </ul>
8879 </li>
8880 </ul>
8881 </li>
8882 </ul>
8883 </li>
8884 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8885 <ul>
8886 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8887 </ul>
8888 </li>
8889 </ul>
8890 </div>
8891 <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>
8892 <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>
8893 <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>
8894 <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>
8895 <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>
8896 <p>Some text
8897 </p>
8898 <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>
8899
8900 !! end
8901
8902 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8903 !! test
8904 Handling of sections up to level 6 and beyond
8905 !! input
8906 = Level 1 Heading=
8907 == Level 2 Heading==
8908 === Level 3 Heading===
8909 ==== Level 4 Heading====
8910 ===== Level 5 Heading=====
8911 ====== Level 6 Heading======
8912 ======= Level 7 Heading=======
8913 ======== Level 8 Heading========
8914 ========= Level 9 Heading=========
8915 ========== Level 10 Heading==========
8916 !! result
8917 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8918 <ul>
8919 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8920 <ul>
8921 <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>
8922 <ul>
8923 <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>
8924 <ul>
8925 <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>
8926 <ul>
8927 <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>
8928 <ul>
8929 <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>
8930 <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>
8931 <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>
8932 <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>
8933 <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>
8934 </ul>
8935 </li>
8936 </ul>
8937 </li>
8938 </ul>
8939 </li>
8940 </ul>
8941 </li>
8942 </ul>
8943 </li>
8944 </ul>
8945 </div>
8946 <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>
8947 <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>
8948 <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>
8949 <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>
8950 <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>
8951 <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>
8952 <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>
8953 <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>
8954 <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>
8955 <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>
8956
8957 !! end
8958
8959 !! test
8960 TOC regression (bug 9764)
8961 !! input
8962 == title 1 ==
8963 === title 1.1 ===
8964 ==== title 1.1.1 ====
8965 === title 1.2 ===
8966 == title 2 ==
8967 === title 2.1 ===
8968 !! result
8969 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8970 <ul>
8971 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8972 <ul>
8973 <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>
8974 <ul>
8975 <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>
8976 </ul>
8977 </li>
8978 <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>
8979 </ul>
8980 </li>
8981 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8982 <ul>
8983 <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>
8984 </ul>
8985 </li>
8986 </ul>
8987 </div>
8988 <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>
8989 <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>
8990 <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>
8991 <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>
8992 <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>
8993 <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>
8994
8995 !! end
8996
8997 !! test
8998 TOC with wgMaxTocLevel=3 (bug 6204)
8999 !! options
9000 wgMaxTocLevel=3
9001 !! input
9002 == title 1 ==
9003 === title 1.1 ===
9004 ==== title 1.1.1 ====
9005 === title 1.2 ===
9006 == title 2 ==
9007 === title 2.1 ===
9008 !! result
9009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9010 <ul>
9011 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9012 <ul>
9013 <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>
9014 <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>
9015 </ul>
9016 </li>
9017 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9018 <ul>
9019 <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>
9020 </ul>
9021 </li>
9022 </ul>
9023 </div>
9024 <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>
9025 <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>
9026 <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>
9027 <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>
9028 <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>
9029 <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>
9030
9031 !! end
9032
9033 !! test
9034 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9035 !! options
9036 wgMaxTocLevel=3
9037 !! input
9038 ==Section 1==
9039 ===Section 1.1===
9040 ====Section 1.1.1====
9041 ====Section 1.1.1.1====
9042 ==Section 2==
9043 !! result
9044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9045 <ul>
9046 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9047 <ul>
9048 <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>
9049 </ul>
9050 </li>
9051 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9052 </ul>
9053 </div>
9054 <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>
9055 <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>
9056 <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>
9057 <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>
9058 <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>
9059
9060 !! end
9061
9062
9063 !! test
9064 Resolving duplicate section names
9065 !! input
9066 == Foo bar ==
9067 == Foo bar ==
9068 !! result
9069 <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>
9070 <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>
9071
9072 !! end
9073
9074 !! test
9075 Resolving duplicate section names with differing case (bug 10721)
9076 !! input
9077 == Foo bar ==
9078 == Foo Bar ==
9079 !! result
9080 <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>
9081 <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>
9082
9083 !! end
9084
9085 !! article
9086 Template:sections
9087 !! text
9088 ===Section 1===
9089 ==Section 2==
9090 !! endarticle
9091
9092 !! test
9093 Template with sections, __NOTOC__
9094 !! input
9095 __NOTOC__
9096 ==Section 0==
9097 {{sections}}
9098 ==Section 4==
9099 !! result
9100 <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>
9101 <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>
9102 <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>
9103 <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>
9104
9105 !! end
9106
9107 !! test
9108 __NOEDITSECTION__ keyword
9109 !! input
9110 __NOEDITSECTION__
9111 ==Section 1==
9112 ==Section 2==
9113 !! result
9114 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9115 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9116
9117 !! end
9118
9119 !! test
9120 Link inside a section heading
9121 !! input
9122 ==Section with a [[Main Page|link]] in it==
9123 !! result
9124 <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>
9125
9126 !! end
9127
9128 !! test
9129 TOC regression (bug 12077)
9130 !! input
9131 __TOC__
9132 == title 1 ==
9133 === title 1.1 ===
9134 == title 2 ==
9135 !! result
9136 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9137 <ul>
9138 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9139 <ul>
9140 <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>
9141 </ul>
9142 </li>
9143 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9144 </ul>
9145 </div>
9146 <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>
9147 <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>
9148 <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>
9149
9150 !! end
9151
9152 !! test
9153 BUG 1219 URL next to image (good)
9154 !! input
9155 http://example.com [[Image:foobar.jpg]]
9156 !! result
9157 <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>
9158 </p>
9159 !!end
9160
9161 !! test
9162 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9163 !! input
9164 ===
9165 The line above must have a trailing space!
9166 === <!--
9167 --> <!-- -->
9168 But just in case it doesn't...
9169 !! result
9170 <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>
9171 <p>The line above must have a trailing space!
9172 </p>
9173 <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>
9174 <p>But just in case it doesn't...
9175 </p>
9176 !! end
9177
9178 !! test
9179 Header with special characters (bug 25462)
9180 !! input
9181 The tooltips shall not show entities to the user (ie. be double escaped)
9182
9183 == text > text ==
9184 section 1
9185
9186 == text < text ==
9187 section 2
9188
9189 == text & text ==
9190 section 3
9191
9192 == text ' text ==
9193 section 4
9194
9195 == text " text ==
9196 section 5
9197 !! result
9198 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9199 </p>
9200 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9201 <ul>
9202 <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>
9203 <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>
9204 <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>
9205 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9206 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9207 </ul>
9208 </div>
9209 <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>
9210 <p>section 1
9211 </p>
9212 <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>
9213 <p>section 2
9214 </p>
9215 <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>
9216 <p>section 3
9217 </p>
9218 <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>
9219 <p>section 4
9220 </p>
9221 <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>
9222 <p>section 5
9223 </p>
9224 !! end
9225
9226 !! test
9227 Headers with excess '=' characters
9228 (Are similar tests necessary beyond the 1st level?)
9229 !! input
9230 =foo==
9231 ==foo=
9232 =''italic'' heading==
9233 ==''italic'' heading=
9234 !! result
9235 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9236 <ul>
9237 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9238 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9239 <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>
9240 <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>
9241 </ul>
9242 </div>
9243 <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>
9244 <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>
9245 <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>
9246 <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>
9247
9248 !! end
9249
9250 !! test
9251 HTML headers vs TOC (bug 23393)
9252 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9253 !! input
9254 <h1>Header 1</h1>
9255 == Header 1.1 ==
9256 == Header 1.2 ==
9257
9258 <h1>Header 2
9259 </h1>
9260 == Header 2.1 ==
9261 == Header 2.2 ==
9262 __NOEDITSECTION__
9263 !! result
9264 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9265 <ul>
9266 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9267 <ul>
9268 <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>
9269 <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>
9270 </ul>
9271 </li>
9272 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9273 <ul>
9274 <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>
9275 <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>
9276 </ul>
9277 </li>
9278 </ul>
9279 </div>
9280 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9281 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9282 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9283 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9284 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9285 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9286
9287 !! end
9288
9289 !! test
9290 BUG 1219 URL next to image (broken)
9291 !! input
9292 http://example.com[[Image:foobar.jpg]]
9293 !! result
9294 <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>
9295 </p>
9296 !!end
9297
9298 !! test
9299 Bug 1186 news: in the middle of text
9300 !! input
9301 http://en.wikinews.org/wiki/Wikinews:Workplace
9302 !! result
9303 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9304 </p>
9305 !!end
9306
9307
9308 !! test
9309 Namespaced link must have a title
9310 !! input
9311 [[Project:]]
9312 !! result
9313 <p>[[Project:]]
9314 </p>
9315 !!end
9316
9317 !! test
9318 Namespaced link must have a title (bad fragment version)
9319 !! input
9320 [[Project:#fragment]]
9321 !! result
9322 <p>[[Project:#fragment]]
9323 </p>
9324 !!end
9325
9326
9327 ###
9328 ### HTML tags and HTML attributes
9329 ###
9330
9331 !! test
9332 div with no attributes
9333 !! input
9334 <div>HTML rocks</div>
9335 !! result
9336 <div>HTML rocks</div>
9337
9338 !! end
9339
9340 !! test
9341 div with double-quoted attribute
9342 !! input
9343 <div id="rock">HTML rocks</div>
9344 !! result
9345 <div id="rock">HTML rocks</div>
9346
9347 !! end
9348
9349 !! test
9350 div with single-quoted attribute
9351 !! input
9352 <div id='rock'>HTML rocks</div>
9353 !! result
9354 <div id="rock">HTML rocks</div>
9355
9356 !! end
9357
9358 !! test
9359 div with unquoted attribute
9360 !! input
9361 <div id=rock>HTML rocks</div>
9362 !! result
9363 <div id="rock">HTML rocks</div>
9364
9365 !! end
9366
9367 !! test
9368 div with illegal double attributes
9369 !! input
9370 <div id="a" id="b">HTML rocks</div>
9371 !! result
9372 <div id="b">HTML rocks</div>
9373
9374 !!end
9375
9376 # FIXME: produce empty string instead of "class" in the PHP parser, following
9377 # the HTML5 spec.
9378 !! test
9379 div with empty attribute value, space before equals
9380 !! options
9381 parsoid
9382 !! input
9383 <div class =>HTML rocks</div>
9384 !! result
9385 <div class="">HTML rocks</div>
9386
9387 !! end
9388
9389 # The PHP parser escapes the opening brace to &#123; for some reason, so
9390 # disabled this test for it.
9391 !! test
9392 div with braces in attribute value
9393 !! options
9394 parsoid
9395 !! input
9396 <div title="{}">Foo</div>
9397 !! result
9398 <div title="{}">Foo</div>
9399 !! end
9400
9401 # This it very inconsistent in the PHP parser: it returns
9402 # class="class" if there is a space between the name and the equal sign (see
9403 # 'div with empty attribute value, space before equals'), but strips the
9404 # attribute completely if the space is missing. We hope that not much content
9405 # depends on this, so are implementing the behavior below in Parsoid for
9406 # consistencies' sake. Disabled for the PHP parser.
9407 # FIXME: fix this behavior in the PHP parser?
9408 !! test
9409 div with empty attribute value, no space before equals
9410 !! options
9411 parsoid
9412 !! input
9413 <div class=>HTML rocks</div>
9414 !! result
9415 <div class="">HTML rocks</div>
9416
9417 !! end
9418
9419 !! test
9420 HTML multiple attributes correction
9421 !! input
9422 <p class="error" class="awesome">Awesome!</p>
9423 !! result
9424 <p class="awesome">Awesome!</p>
9425
9426 !!end
9427
9428 !! test
9429 Table multiple attributes correction
9430 !! input
9431 {|
9432 !+ class="error" class="awesome"| status
9433 |}
9434 !! result
9435 <table>
9436 <tr>
9437 <th class="awesome"> status
9438 </th></tr></table>
9439
9440 !!end
9441
9442 !! test
9443 DIV IN UPPERCASE
9444 !! input
9445 <DIV ID="x">HTML ROCKS</DIV>
9446 !! result
9447 <div id="x">HTML ROCKS</div>
9448
9449 !!end
9450
9451 !! test
9452 Non-ASCII pseudo-tags are rendered as text
9453 !! input
9454 <khyô>
9455 !! result
9456 <p>&lt;khyô&gt;
9457 </p>
9458 !! end
9459
9460 !! test
9461 Pseudo-tag with URL 'name' renders as url link
9462 !! input
9463 <http://example.com/>
9464 !! result
9465 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9466 </p>
9467 !! end
9468
9469 !! test
9470 text with amp in the middle of nowhere
9471 !! input
9472 Remember AT&T?
9473 !!result
9474 <p>Remember AT&amp;T?
9475 </p>
9476 !! end
9477
9478 !! test
9479 text with character entity: eacute
9480 !! input
9481 I always thought &eacute; was a cute letter.
9482 !! result
9483 <p>I always thought &#233; was a cute letter.
9484 </p>
9485 !! end
9486
9487 !! test
9488 text with entity-escaped character entity-like string: eacute
9489 !! input
9490 I always thought &amp;eacute; was a cute letter.
9491 !! result
9492 <p>I always thought &amp;eacute; was a cute letter.
9493 </p>
9494 !! end
9495
9496 !! test
9497 text with undefined character entity: xacute
9498 !! input
9499 I always thought &xacute; was a cute letter.
9500 !! result
9501 <p>I always thought &amp;xacute; was a cute letter.
9502 </p>
9503 !! end
9504
9505
9506 ###
9507 ### Media links
9508 ###
9509
9510 !! test
9511 Media link
9512 !! input
9513 [[Media:Foobar.jpg]]
9514 !! result
9515 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9516 </p>
9517 !! end
9518
9519 !! test
9520 Media link with text
9521 !! input
9522 [[Media:Foobar.jpg|A neat file to look at]]
9523 !! result
9524 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9525 </p>
9526 !! end
9527
9528 # FIXME: this is still bad HTML tag nesting
9529 !! test
9530 Media link with nasty text
9531 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9532 !! input
9533 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9534 !! result
9535 <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>
9536
9537 !! end
9538
9539 !! test
9540 Media link to nonexistent file (bug 1702)
9541 !! input
9542 [[Media:No such.jpg]]
9543 !! result
9544 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9545 </p>
9546 !! end
9547
9548 !! test
9549 Image link to nonexistent file (bug 1850 - good)
9550 !! input
9551 [[Image:No such.jpg]]
9552 !! result
9553 <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>
9554 </p>
9555 !! end
9556
9557 !! test
9558 :Image link to nonexistent file (bug 1850 - bad)
9559 !! input
9560 [[:Image:No such.jpg]]
9561 !! result
9562 <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>
9563 </p>
9564 !! end
9565
9566
9567
9568 !! test
9569 Character reference normalization in link text (bug 1938)
9570 !! input
9571 [[Main Page|this&that]]
9572 !! result
9573 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9574 </p>
9575 !!end
9576
9577 !! article
9578 אַ
9579 !! text
9580 Test for unicode normalization
9581
9582 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9583 !! endarticle
9584
9585 !! test
9586 (bug 19451) Links should refer to the normalized form.
9587 !! input
9588 [[&#xFB2E;]]
9589 [[&#x5d0;&#x5b7;]]
9590 [[&#x5d0;ַ]]
9591 [[א&#x5b7;]]
9592 [[אַ]]
9593 !! result
9594 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9595 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9596 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9597 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9598 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9599 </p>
9600 !! end
9601
9602 !! test
9603 Empty attribute crash test (bug 2067)
9604 !! input
9605 <font color="">foo</font>
9606 !! result
9607 <p><font color="">foo</font>
9608 </p>
9609 !! end
9610
9611 !! test
9612 Empty attribute crash test single-quotes (bug 2067)
9613 !! input
9614 <font color=''>foo</font>
9615 !! result
9616 <p><font color="">foo</font>
9617 </p>
9618 !! end
9619
9620 !! test
9621 Attribute test: equals, then nothing
9622 !! input
9623 <font color=>foo</font>
9624 !! result
9625 <p><font>foo</font>
9626 </p>
9627 !! end
9628
9629 !! test
9630 Attribute test: unquoted value
9631 !! input
9632 <font color=x>foo</font>
9633 !! result
9634 <p><font color="x">foo</font>
9635 </p>
9636 !! end
9637
9638 !! test
9639 Attribute test: unquoted but illegal value (hash)
9640 !! input
9641 <font color=#x>foo</font>
9642 !! result
9643 <p><font color="#x">foo</font>
9644 </p>
9645 !! end
9646
9647 !! test
9648 Attribute test: no value
9649 !! input
9650 <font color>foo</font>
9651 !! result
9652 <p><font color="color">foo</font>
9653 </p>
9654 !! end
9655
9656 !! test
9657 Bug 2095: link with three closing brackets
9658 !! input
9659 [[Main Page]]]
9660 !! result
9661 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9662 </p>
9663 !! end
9664
9665 !! test
9666 Bug 2095: link with pipe and three closing brackets
9667 !! input
9668 [[Main Page|link]]]
9669 !! result
9670 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9671 </p>
9672 !! end
9673
9674 !! test
9675 Bug 2095: link with pipe and three closing brackets, version 2
9676 !! input
9677 [[Main Page|[http://example.com/]]]
9678 !! result
9679 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9680 </p>
9681 !! end
9682
9683
9684 ###
9685 ### Safety
9686 ###
9687
9688 !! article
9689 Template:Dangerous attribute
9690 !! text
9691 " onmouseover="alert(document.cookie)
9692 !! endarticle
9693
9694 !! article
9695 Template:Dangerous style attribute
9696 !! text
9697 border-size: expression(alert(document.cookie))
9698 !! endarticle
9699
9700 !! article
9701 Template:Div style
9702 !! text
9703 <div style="float: right; {{{1}}}">Magic div</div>
9704 !! endarticle
9705
9706 !! test
9707 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9708 !! input
9709 <div title="{{test}}"></div>
9710 !! result
9711 <div title="This is a test template"></div>
9712
9713 !! end
9714
9715 !! test
9716 Bug 2304: HTML attribute safety (dangerous template; 2309)
9717 !! input
9718 <div title="{{dangerous attribute}}"></div>
9719 !! result
9720 <div title=""></div>
9721
9722 !! end
9723
9724 !! test
9725 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9726 !! input
9727 <div style="{{dangerous style attribute}}"></div>
9728 !! result
9729 <div style="/* insecure input */"></div>
9730
9731 !! end
9732
9733 !! test
9734 Bug 2304: HTML attribute safety (safe parameter; 2309)
9735 !! input
9736 {{div style|width: 200px}}
9737 !! result
9738 <div style="float: right; width: 200px">Magic div</div>
9739
9740 !! end
9741
9742 !! test
9743 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9744 !! input
9745 {{div style|width: expression(alert(document.cookie))}}
9746 !! result
9747 <div style="/* insecure input */">Magic div</div>
9748
9749 !! end
9750
9751 !! test
9752 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9753 !! input
9754 {{div style|"><script>alert(document.cookie)</script>}}
9755 !! result
9756 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9757
9758 !! end
9759
9760 !! test
9761 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9762 !! input
9763 {{div style|" ><script>alert(document.cookie)</script>}}
9764 !! result
9765 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9766
9767 !! end
9768
9769 !! test
9770 Bug 2304: HTML attribute safety (link)
9771 !! input
9772 <div title="[[Main Page]]"></div>
9773 !! result
9774 <div title="&#91;&#91;Main Page]]"></div>
9775
9776 !! end
9777
9778 !! test
9779 Bug 2304: HTML attribute safety (italics)
9780 !! input
9781 <div title="''foobar''"></div>
9782 !! result
9783 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9784
9785 !! end
9786
9787 !! test
9788 Bug 2304: HTML attribute safety (bold)
9789 !! input
9790 <div title="'''foobar'''"></div>
9791 !! result
9792 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9793
9794 !! end
9795
9796
9797 !! test
9798 Bug 2304: HTML attribute safety (ISBN)
9799 !! input
9800 <div title="ISBN 1234567890"></div>
9801 !! result
9802 <div title="&#73;SBN 1234567890"></div>
9803
9804 !! end
9805
9806 !! test
9807 Bug 2304: HTML attribute safety (RFC)
9808 !! input
9809 <div title="RFC 1234"></div>
9810 !! result
9811 <div title="&#82;FC 1234"></div>
9812
9813 !! end
9814
9815 !! test
9816 Bug 2304: HTML attribute safety (PMID)
9817 !! input
9818 <div title="PMID 1234567890"></div>
9819 !! result
9820 <div title="&#80;MID 1234567890"></div>
9821
9822 !! end
9823
9824 !! test
9825 Bug 2304: HTML attribute safety (web link)
9826 !! input
9827 <div title="http://example.com/"></div>
9828 !! result
9829 <div title="http&#58;//example.com/"></div>
9830
9831 !! end
9832
9833 !! test
9834 Bug 2304: HTML attribute safety (named web link)
9835 !! input
9836 <div title="[http://example.com/ link]"></div>
9837 !! result
9838 <div title="&#91;http&#58;//example.com/ link]"></div>
9839
9840 !! end
9841
9842 !! test
9843 Bug 3244: HTML attribute safety (extension; safe)
9844 !! input
9845 <div style="<nowiki>background:blue</nowiki>"></div>
9846 !! result
9847 <div style="background:blue"></div>
9848
9849 !! end
9850
9851 !! test
9852 Bug 3244: HTML attribute safety (extension; unsafe)
9853 !! input
9854 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9855 !! result
9856 <div style="/* insecure input */"></div>
9857
9858 !! end
9859
9860 # More MSIE fun discovered by Tom Gilder
9861
9862 !! test
9863 MSIE CSS safety test: spurious slash
9864 !! input
9865 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9866 !! result
9867 <div style="/* insecure input */">evil</div>
9868
9869 !! end
9870
9871 !! test
9872 MSIE CSS safety test: hex code
9873 !! input
9874 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9875 !! result
9876 <div style="/* insecure input */">evil</div>
9877
9878 !! end
9879
9880 !! test
9881 MSIE CSS safety test: comment in url
9882 !! input
9883 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9884 !! result
9885 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9886
9887 !! end
9888
9889 !! test
9890 MSIE CSS safety test: comment in expression
9891 !! input
9892 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9893 !! result
9894 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9895
9896 !! end
9897
9898
9899 !! test
9900 Table attribute legitimate extension
9901 !! input
9902 {|
9903 !+ style="<nowiki>color:blue</nowiki>"| status
9904 |}
9905 !! result
9906 <table>
9907 <tr>
9908 <th style="color:blue"> status
9909 </th></tr></table>
9910
9911 !!end
9912
9913 !! test
9914 Table attribute safety
9915 !! input
9916 {|
9917 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9918 |}
9919 !! result
9920 <table>
9921 <tr>
9922 <th style="/* insecure input */"> status
9923 </th></tr></table>
9924
9925 !! end
9926
9927 !! test
9928 CSS line continuation 1
9929 !! input
9930 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9931 !! result
9932 <div style="/* insecure input */"></div>
9933
9934 !! end
9935
9936 !! test
9937 CSS line continuation 2
9938 !! input
9939 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9940 !! result
9941 <div style="/* insecure input */"></div>
9942
9943 !! end
9944
9945 !! article
9946 Template:Identity
9947 !! text
9948 {{{1}}}
9949 !! endarticle
9950
9951 !! test
9952 Expansion of multi-line templates in attribute values (bug 6255)
9953 !! input
9954 <div style="background: {{identity|#00FF00}}">-</div>
9955 !! result
9956 <div style="background: #00FF00">-</div>
9957
9958 !! end
9959
9960
9961 !! test
9962 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9963 !! input
9964 <div style="background:
9965 #00FF00">-</div>
9966 !! result
9967 <div style="background: #00FF00">-</div>
9968
9969 !! end
9970
9971 !! test
9972 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9973 !! input
9974 <div style="background: &#10;#00FF00">-</div>
9975 !! result
9976 <div style="background: &#10;#00FF00">-</div>
9977
9978 !! end
9979
9980 ###
9981 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9982 ###
9983 !! test
9984 Parser hook: empty input
9985 !! input
9986 <tag></tag>
9987 !! result
9988 <pre>
9989 ''
9990 array (
9991 )
9992 </pre>
9993
9994 !! end
9995
9996 !! test
9997 Parser hook: empty input using terminated empty elements
9998 !! input
9999 <tag/>
10000 !! result
10001 <pre>
10002 NULL
10003 array (
10004 )
10005 </pre>
10006
10007 !! end
10008
10009 !! test
10010 Parser hook: empty input using terminated empty elements (space before)
10011 !! input
10012 <tag />
10013 !! result
10014 <pre>
10015 NULL
10016 array (
10017 )
10018 </pre>
10019
10020 !! end
10021
10022 !! test
10023 Parser hook: basic input
10024 !! input
10025 <tag>input</tag>
10026 !! result
10027 <pre>
10028 'input'
10029 array (
10030 )
10031 </pre>
10032
10033 !! end
10034
10035
10036 !! test
10037 Parser hook: case insensitive
10038 !! input
10039 <TAG>input</TAG>
10040 !! result
10041 <pre>
10042 'input'
10043 array (
10044 )
10045 </pre>
10046
10047 !! end
10048
10049
10050 !! test
10051 Parser hook: case insensitive, redux
10052 !! input
10053 <TaG>input</TAg>
10054 !! result
10055 <pre>
10056 'input'
10057 array (
10058 )
10059 </pre>
10060
10061 !! end
10062
10063 !! test
10064 Parser hook: nested tags
10065 !! options
10066 noxml
10067 !! input
10068 <tag><tag></tag></tag>
10069 !! result
10070 <pre>
10071 '<tag>'
10072 array (
10073 )
10074 </pre>&lt;/tag&gt;
10075
10076 !! end
10077
10078 !! test
10079 Parser hook: basic arguments
10080 !! input
10081 <tag width=200 height = "100" depth = '50' square></tag>
10082 !! result
10083 <pre>
10084 ''
10085 array (
10086 'width' => '200',
10087 'height' => '100',
10088 'depth' => '50',
10089 'square' => 'square',
10090 )
10091 </pre>
10092
10093 !! end
10094
10095 !! test
10096 Parser hook: argument containing a forward slash (bug 5344)
10097 !! input
10098 <tag filename='/tmp/bla'></tag>
10099 !! result
10100 <pre>
10101 ''
10102 array (
10103 'filename' => '/tmp/bla',
10104 )
10105 </pre>
10106
10107 !! end
10108
10109 !! test
10110 Parser hook: empty input using terminated empty elements (bug 2374)
10111 !! input
10112 <tag foo=bar/>text
10113 !! result
10114 <pre>
10115 NULL
10116 array (
10117 'foo' => 'bar',
10118 )
10119 </pre>text
10120
10121 !! end
10122
10123 # </tag> should be output literally since there is no matching tag that begins it
10124 !! test
10125 Parser hook: basic arguments using terminated empty elements (bug 2374)
10126 !! input
10127 <tag width=200 height = "100" depth = '50' square/>
10128 other stuff
10129 </tag>
10130 !! result
10131 <pre>
10132 NULL
10133 array (
10134 'width' => '200',
10135 'height' => '100',
10136 'depth' => '50',
10137 'square' => 'square',
10138 )
10139 </pre>
10140 <p>other stuff
10141 &lt;/tag&gt;
10142 </p>
10143 !! end
10144
10145 ###
10146 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10147 ###
10148
10149 !! test
10150 Parser hook: static parser hook not inside a comment
10151 !! input
10152 <statictag>hello, world</statictag>
10153 <statictag action=flush/>
10154 !! result
10155 <p>hello, world
10156 </p>
10157 !! end
10158
10159
10160 !! test
10161 Parser hook: static parser hook inside a comment
10162 !! input
10163 <!-- <statictag>hello, world</statictag> -->
10164 <statictag action=flush/>
10165 !! result
10166 <p><br />
10167 </p>
10168 !! end
10169
10170 # Nested template calls; this case was broken by Parser.php rev 1.506,
10171 # since reverted.
10172
10173 !! article
10174 Template:One-parameter
10175 !! text
10176 (My parameter is: {{{1}}})
10177 !! endarticle
10178
10179 !! article
10180 Template:Map-one-parameter
10181 !! text
10182 {{{{{1}}}|{{{2}}}}}
10183 !! endarticle
10184
10185 !! test
10186 Nested template calls
10187 !! input
10188 {{Map-one-parameter|One-parameter|param}}
10189 !! result
10190 <p>(My parameter is: param)
10191 </p>
10192 !! end
10193
10194
10195 ###
10196 ### Sanitizer
10197 ###
10198 !! test
10199 Sanitizer: Closing of open tags
10200 !! input
10201 <s></s><table></table>
10202 !! result
10203 <s></s><table></table>
10204
10205 !! end
10206
10207 !! test
10208 Sanitizer: Closing of open but not closed tags
10209 !! input
10210 <s>foo
10211 !! result
10212 <p><s>foo</s>
10213 </p>
10214 !! end
10215
10216 !! test
10217 Sanitizer: Closing of closed but not open tags
10218 !! input
10219 </s>
10220 !! result
10221 <p>&lt;/s&gt;
10222 </p>
10223 !! end
10224
10225 !! test
10226 Sanitizer: Closing of closed but not open table tags
10227 !! input
10228 Table not started</td></tr></table>
10229 !! result
10230 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10231 </p>
10232 !! end
10233
10234 !! test
10235 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10236 !! input
10237 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10238 !! result
10239 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10240 </p>
10241 !! end
10242
10243 !! test
10244 Sanitizer: Validating the contents of the id attribute (bug 4515)
10245 !! options
10246 disabled
10247 !! input
10248 <br id=9 />
10249 !! result
10250 Something, but definitely not <br id="9" />...
10251 !! end
10252
10253 !! test
10254 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10255 !! options
10256 disabled
10257 !! input
10258 <br id="foo" /><br id="foo" />
10259 !! result
10260 Something need to be done. foo-2 ?
10261 !! end
10262
10263 !! test
10264 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10265 !! input
10266 <div itemscope>
10267 <meta itemprop="hello" content="world">
10268 <meta http-equiv="refresh" content="5">
10269 <meta itemprop="hello" http-equiv="refresh" content="5">
10270 <link itemprop="hello" href="{{SERVER}}">
10271 <link rel="stylesheet" href="{{SERVER}}">
10272 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10273 </div>
10274 !! result
10275 <div itemscope="itemscope">
10276 <p> <meta itemprop="hello" content="world" />
10277 &lt;meta http-equiv="refresh" content="5"&gt;
10278 <meta itemprop="hello" content="5" />
10279 </p>
10280 <link itemprop="hello" href="http&#58;//example.org" />
10281 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10282 <link itemprop="hello" href="http&#58;//example.org" />
10283 </div>
10284
10285 !! end
10286
10287 !! test
10288 Language converter: output gets cut off unexpectedly (bug 5757)
10289 !! options
10290 language=zh
10291 !! input
10292 this bit is safe: }-
10293
10294 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10295
10296 then we get cut off here: }-
10297
10298 all additional text is vanished
10299 !! result
10300 <p>this bit is safe: }-
10301 </p><p>but if we add a conversion instance: xxx
10302 </p><p>then we get cut off here: }-
10303 </p><p>all additional text is vanished
10304 </p>
10305 !! end
10306
10307 !! test
10308 Self closed html pairs (bug 5487)
10309 !! options
10310 !! input
10311 <center><font id="bug" />Centered text</center>
10312 <div><font id="bug2" />In div text</div>
10313 !! result
10314 <center>&lt;font id="bug" /&gt;Centered text</center>
10315 <div>&lt;font id="bug2" /&gt;In div text</div>
10316
10317 !! end
10318
10319 #
10320 #
10321 #
10322
10323 !! test
10324 Punctuation: nbsp before exclamation
10325 !! input
10326 C'est grave !
10327 !! result
10328 <p>C'est grave&#160;!
10329 </p>
10330 !! end
10331
10332 !! test
10333 Punctuation: CSS !important (bug 11874)
10334 !! input
10335 <div style="width:50% !important">important</div>
10336 !! result
10337 <div style="width:50% !important">important</div>
10338
10339 !!end
10340
10341 !! test
10342 Punctuation: CSS ! important (bug 11874; with space after)
10343 !! input
10344 <div style="width:50% ! important">important</div>
10345 !! result
10346 <div style="width:50% ! important">important</div>
10347
10348 !!end
10349
10350
10351 !! test
10352 HTML bullet list, closed tags (bug 5497)
10353 !! input
10354 <ul>
10355 <li>One</li>
10356 <li>Two</li>
10357 </ul>
10358 !! result
10359 <ul>
10360 <li>One</li>
10361 <li>Two</li>
10362 </ul>
10363
10364 !! end
10365
10366 !! test
10367 HTML bullet list, unclosed tags (bug 5497)
10368 !! options
10369 disabled
10370 !! input
10371 <ul>
10372 <li>One
10373 <li>Two
10374 </ul>
10375 !! result
10376 <ul>
10377 <li>One
10378 </li><li>Two
10379 </li></ul>
10380
10381 !! end
10382
10383 !! test
10384 HTML ordered list, closed tags (bug 5497)
10385 !! input
10386 <ol>
10387 <li>One</li>
10388 <li>Two</li>
10389 </ol>
10390 !! result
10391 <ol>
10392 <li>One</li>
10393 <li>Two</li>
10394 </ol>
10395
10396 !! end
10397
10398 !! test
10399 HTML ordered list, unclosed tags (bug 5497)
10400 !! options
10401 disabled
10402 !! input
10403 <ol>
10404 <li>One
10405 <li>Two
10406 </ol>
10407 !! result
10408 <ol>
10409 <li>One
10410 </li><li>Two
10411 </li></ol>
10412
10413 !! end
10414
10415 !! test
10416 HTML nested bullet list, closed tags (bug 5497)
10417 !! input
10418 <ul>
10419 <li>One</li>
10420 <li>Two:
10421 <ul>
10422 <li>Sub-one</li>
10423 <li>Sub-two</li>
10424 </ul>
10425 </li>
10426 </ul>
10427 !! result
10428 <ul>
10429 <li>One</li>
10430 <li>Two:
10431 <ul>
10432 <li>Sub-one</li>
10433 <li>Sub-two</li>
10434 </ul>
10435 </li>
10436 </ul>
10437
10438 !! end
10439
10440 !! test
10441 HTML nested bullet list, open tags (bug 5497)
10442 !! options
10443 disabled
10444 !! input
10445 <ul>
10446 <li>One
10447 <li>Two:
10448 <ul>
10449 <li>Sub-one
10450 <li>Sub-two
10451 </ul>
10452 </ul>
10453 !! result
10454 <ul>
10455 <li>One
10456 </li><li>Two:
10457 <ul>
10458 <li>Sub-one
10459 </li><li>Sub-two
10460 </li></ul>
10461 </li></ul>
10462
10463 !! end
10464
10465 !! test
10466 HTML nested ordered list, closed tags (bug 5497)
10467 !! input
10468 <ol>
10469 <li>One</li>
10470 <li>Two:
10471 <ol>
10472 <li>Sub-one</li>
10473 <li>Sub-two</li>
10474 </ol>
10475 </li>
10476 </ol>
10477 !! result
10478 <ol>
10479 <li>One</li>
10480 <li>Two:
10481 <ol>
10482 <li>Sub-one</li>
10483 <li>Sub-two</li>
10484 </ol>
10485 </li>
10486 </ol>
10487
10488 !! end
10489
10490 !! test
10491 HTML nested ordered list, open tags (bug 5497)
10492 !! options
10493 disabled
10494 !! input
10495 <ol>
10496 <li>One
10497 <li>Two:
10498 <ol>
10499 <li>Sub-one
10500 <li>Sub-two
10501 </ol>
10502 </ol>
10503 !! result
10504 <ol>
10505 <li>One
10506 </li><li>Two:
10507 <ol>
10508 <li>Sub-one
10509 </li><li>Sub-two
10510 </li></ol>
10511 </li></ol>
10512
10513 !! end
10514
10515 !! test
10516 HTML ordered list item with parameters oddity
10517 !! input
10518 <ol><li id="fragment">One</li></ol>
10519 !! result
10520 <ol><li id="fragment">One</li></ol>
10521
10522 !! end
10523
10524 !!test
10525 bug 5918: autonumbering
10526 !! input
10527 [http://first/] [http://second] [ftp://ftp]
10528
10529 ftp://inlineftp
10530
10531 [mailto:enclosed@mail.tld With target]
10532
10533 [mailto:enclosed@mail.tld]
10534
10535 mailto:inline@mail.tld
10536 !! result
10537 <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>
10538 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10539 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10540 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10541 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10542 </p>
10543 !! end
10544
10545
10546 #
10547 # Security and HTML correctness
10548 # From Nick Jenkins' fuzz testing
10549 #
10550
10551 !! test
10552 Fuzz testing: Parser13
10553 !! input
10554 {|
10555 | http://a|
10556 !! result
10557 <table>
10558 <tr>
10559 <td>
10560 </td>
10561 </tr>
10562 </table>
10563
10564 !! end
10565
10566 !! test
10567 Fuzz testing: Parser14
10568 !! input
10569 == onmouseover= ==
10570 http://__TOC__
10571 !! result
10572 <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>
10573 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10574 <ul>
10575 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10576 </ul>
10577 </div>
10578
10579 !! end
10580
10581 !! test
10582 Fuzz testing: Parser14-table
10583 !! input
10584 ==a==
10585 {| STYLE=__TOC__
10586 !! result
10587 <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>
10588 <table style="&#95;_TOC&#95;_">
10589 <tr><td></td></tr>
10590 </table>
10591
10592 !! end
10593
10594 # Known to produce bogus xml (extra </td>)
10595 !! test
10596 Fuzz testing: Parser16
10597 !! options
10598 noxml
10599 !! input
10600 {|
10601 !https://||||||
10602 !! result
10603 <table>
10604 <tr>
10605 <th>https://</th>
10606 <th></th>
10607 <th></th>
10608 <th>
10609 </td>
10610 </tr>
10611 </table>
10612
10613 !! end
10614
10615 !! test
10616 Fuzz testing: Parser21
10617 !! input
10618 {|
10619 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10620 |
10621 !! result
10622 <table>
10623 <tr>
10624 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10625 </th>
10626 <td>
10627 </td>
10628 </tr>
10629 </table>
10630
10631 !! end
10632
10633 !! test
10634 Fuzz testing: Parser22
10635 !! input
10636 http://===r:::https://b
10637
10638 {|
10639 !!result
10640 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10641 </p>
10642 <table>
10643 <tr><td></td></tr>
10644 </table>
10645
10646 !! end
10647
10648 # Known to produce bad XML for now
10649 !! test
10650 Fuzz testing: Parser24
10651 !! options
10652 noxml
10653 !! input
10654 {|
10655 {{{|
10656 <u CLASS=
10657 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10658 <br style="onmouseover='alert(document.cookie);' " />
10659
10660 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10661 |
10662 !! result
10663 <table>
10664 {{{|
10665 <u class="&#124;">}}}} &gt;
10666 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10667
10668 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10669 <tr>
10670 <td></u>
10671 </td>
10672 </tr>
10673 </table>
10674
10675 !! end
10676
10677 # Note: the current result listed for this is not what the original one was,
10678 # but the original bug was JavaScript injection, which is fixed in any case.
10679 # It's not clear that the original result listed was any more correct than the
10680 # current one. Original result:
10681 # <p>{{{|
10682 # </p>
10683 # <li class="&#124;&#124;">
10684 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10685 !!test
10686 Fuzz testing: Parser25 (bug 6055)
10687 !! input
10688 {{{
10689 |
10690 <LI CLASS=||
10691 >
10692 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10693 !! result
10694 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10695 </p>
10696 !! end
10697
10698 !!test
10699 Fuzz testing: URL adjacent extension (with space, clean)
10700 !! options
10701 !! input
10702 http://example.com <nowiki>junk</nowiki>
10703 !! result
10704 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10705 </p>
10706 !!end
10707
10708 !!test
10709 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10710 !! options
10711 !! input
10712 http://example.com<nowiki>junk</nowiki>
10713 !! result
10714 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10715 </p>
10716 !!end
10717
10718 !!test
10719 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10720 !! options
10721 !! input
10722 http://example.com<pre>junk</pre>
10723 !! result
10724 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10725
10726 !!end
10727
10728 !!test
10729 Fuzz testing: image with bogus manual thumbnail
10730 !!input
10731 [[Image:foobar.jpg|thumbnail= ]]
10732 !!result
10733 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10734
10735 !!end
10736
10737 !! test
10738 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10739 !! input
10740 <pre dir="&#10;"></pre>
10741 !! result
10742 <pre dir="&#10;"></pre>
10743
10744 !! end
10745
10746 !! test
10747 Parsing optional HTML elements (Bug 6171)
10748 !! options
10749 !! input
10750 <table>
10751 <tr>
10752 <td> Some tabular data</td>
10753 <td> More tabular data ...
10754 <td> And yet som tabular data</td>
10755 </tr>
10756 </table>
10757 !! result
10758 <table>
10759 <tr>
10760 <td> Some tabular data</td>
10761 <td> More tabular data ...
10762 </td><td> And yet som tabular data</td>
10763 </tr>
10764 </table>
10765
10766 !! end
10767
10768 !! test
10769 Correct handling of <td>, <tr> (Bug 6171)
10770 !! options
10771 !! input
10772 <table>
10773 <tr>
10774 <td> Some tabular data</td>
10775 <td> More tabular data ...</td>
10776 <td> And yet som tabular data</td>
10777 </tr>
10778 </table>
10779 !! result
10780 <table>
10781 <tr>
10782 <td> Some tabular data</td>
10783 <td> More tabular data ...</td>
10784 <td> And yet som tabular data</td>
10785 </tr>
10786 </table>
10787
10788 !! end
10789
10790
10791 !! test
10792 Parsing crashing regression (fr:JavaScript)
10793 !! input
10794 </body></x>
10795 !! result
10796 <p>&lt;/body&gt;&lt;/x&gt;
10797 </p>
10798 !! end
10799
10800 !! test
10801 Inline wiki vs wiki block nesting
10802 !! input
10803 '''Bold paragraph
10804
10805 New wiki paragraph
10806 !! result
10807 <p><b>Bold paragraph</b>
10808 </p><p>New wiki paragraph
10809 </p>
10810 !! end
10811
10812 !! test
10813 Inline HTML vs wiki block nesting
10814 !! options
10815 disabled
10816 !! input
10817 <b>Bold paragraph
10818
10819 New wiki paragraph
10820 !! result
10821 <p><b>Bold paragraph</b>
10822 </p><p>New wiki paragraph
10823 </p>
10824 !! end
10825
10826 # Original result was this:
10827 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10828 # </p>
10829 # While that might be marginally more intuitive, maybe, the six-apostrophe
10830 # construct is clearly pathological and the result stated here (which is what
10831 # the parser actually does) is about as reasonable as anything.
10832 !!test
10833 Mixing markup for italics and bold
10834 !! options
10835 !! input
10836 '''bold''''''bold''bolditalics'''''
10837 !! result
10838 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10839 </p>
10840 !! end
10841
10842
10843 !! article
10844 Xyzzyx
10845 !! text
10846 Article for special page transclusion test
10847 !! endarticle
10848
10849 !! test
10850 Special page transclusion
10851 !! options
10852 !! input
10853 {{Special:Prefixindex/Xyzzyx}}
10854 !! result
10855 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10856
10857 !! end
10858
10859 !! test
10860 Special page transclusion twice (bug 5021)
10861 !! options
10862 !! input
10863 {{Special:Prefixindex/Xyzzyx}}
10864 {{Special:Prefixindex/Xyzzyx}}
10865 !! result
10866 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10867 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10868
10869 !! end
10870
10871 !! test
10872 Transclusion of default MediaWiki message
10873 !! input
10874 {{MediaWiki:Mainpage}}
10875 !!result
10876 <p>Main Page
10877 </p>
10878 !! end
10879
10880 !! test
10881 Transclusion of nonexistent MediaWiki message
10882 !! input
10883 {{MediaWiki:Mainpagexxx}}
10884 !!result
10885 <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>
10886 </p>
10887 !! end
10888
10889 !! test
10890 Transclusion of MediaWiki message with underscore
10891 !! input
10892 {{MediaWiki:history_short}}
10893 !! result
10894 <p>History
10895 </p>
10896 !! end
10897
10898 !! test
10899 Transclusion of MediaWiki message with space
10900 !! input
10901 {{MediaWiki:history short}}
10902 !! result
10903 <p>History
10904 </p>
10905 !! end
10906
10907 !! test
10908 Invalid header with following text
10909 !! input
10910 = x = y
10911 !! result
10912 <p>= x = y
10913 </p>
10914 !! end
10915
10916
10917 !! test
10918 Section extraction test (section 0)
10919 !! options
10920 section=0
10921 !! input
10922 start
10923 ==a==
10924 ===aa===
10925 ====aaa====
10926 ==b==
10927 ===ba===
10928 ===bb===
10929 ====bba====
10930 ===bc===
10931 ==c==
10932 ===ca===
10933 !! result
10934 start
10935 !! end
10936
10937 !! test
10938 Section extraction test (section 1)
10939 !! options
10940 section=1
10941 !! input
10942 start
10943 ==a==
10944 ===aa===
10945 ====aaa====
10946 ==b==
10947 ===ba===
10948 ===bb===
10949 ====bba====
10950 ===bc===
10951 ==c==
10952 ===ca===
10953 !! result
10954 ==a==
10955 ===aa===
10956 ====aaa====
10957 !! end
10958
10959 !! test
10960 Section extraction test (section 2)
10961 !! options
10962 section=2
10963 !! input
10964 start
10965 ==a==
10966 ===aa===
10967 ====aaa====
10968 ==b==
10969 ===ba===
10970 ===bb===
10971 ====bba====
10972 ===bc===
10973 ==c==
10974 ===ca===
10975 !! result
10976 ===aa===
10977 ====aaa====
10978 !! end
10979
10980 !! test
10981 Section extraction test (section 3)
10982 !! options
10983 section=3
10984 !! input
10985 start
10986 ==a==
10987 ===aa===
10988 ====aaa====
10989 ==b==
10990 ===ba===
10991 ===bb===
10992 ====bba====
10993 ===bc===
10994 ==c==
10995 ===ca===
10996 !! result
10997 ====aaa====
10998 !! end
10999
11000 !! test
11001 Section extraction test (section 4)
11002 !! options
11003 section=4
11004 !! input
11005 start
11006 ==a==
11007 ===aa===
11008 ====aaa====
11009 ==b==
11010 ===ba===
11011 ===bb===
11012 ====bba====
11013 ===bc===
11014 ==c==
11015 ===ca===
11016 !! result
11017 ==b==
11018 ===ba===
11019 ===bb===
11020 ====bba====
11021 ===bc===
11022 !! end
11023
11024 !! test
11025 Section extraction test (section 5)
11026 !! options
11027 section=5
11028 !! input
11029 start
11030 ==a==
11031 ===aa===
11032 ====aaa====
11033 ==b==
11034 ===ba===
11035 ===bb===
11036 ====bba====
11037 ===bc===
11038 ==c==
11039 ===ca===
11040 !! result
11041 ===ba===
11042 !! end
11043
11044 !! test
11045 Section extraction test (section 6)
11046 !! options
11047 section=6
11048 !! input
11049 start
11050 ==a==
11051 ===aa===
11052 ====aaa====
11053 ==b==
11054 ===ba===
11055 ===bb===
11056 ====bba====
11057 ===bc===
11058 ==c==
11059 ===ca===
11060 !! result
11061 ===bb===
11062 ====bba====
11063 !! end
11064
11065 !! test
11066 Section extraction test (section 7)
11067 !! options
11068 section=7
11069 !! input
11070 start
11071 ==a==
11072 ===aa===
11073 ====aaa====
11074 ==b==
11075 ===ba===
11076 ===bb===
11077 ====bba====
11078 ===bc===
11079 ==c==
11080 ===ca===
11081 !! result
11082 ====bba====
11083 !! end
11084
11085 !! test
11086 Section extraction test (section 8)
11087 !! options
11088 section=8
11089 !! input
11090 start
11091 ==a==
11092 ===aa===
11093 ====aaa====
11094 ==b==
11095 ===ba===
11096 ===bb===
11097 ====bba====
11098 ===bc===
11099 ==c==
11100 ===ca===
11101 !! result
11102 ===bc===
11103 !! end
11104
11105 !! test
11106 Section extraction test (section 9)
11107 !! options
11108 section=9
11109 !! input
11110 start
11111 ==a==
11112 ===aa===
11113 ====aaa====
11114 ==b==
11115 ===ba===
11116 ===bb===
11117 ====bba====
11118 ===bc===
11119 ==c==
11120 ===ca===
11121 !! result
11122 ==c==
11123 ===ca===
11124 !! end
11125
11126 !! test
11127 Section extraction test (section 10)
11128 !! options
11129 section=10
11130 !! input
11131 start
11132 ==a==
11133 ===aa===
11134 ====aaa====
11135 ==b==
11136 ===ba===
11137 ===bb===
11138 ====bba====
11139 ===bc===
11140 ==c==
11141 ===ca===
11142 !! result
11143 ===ca===
11144 !! end
11145
11146 !! test
11147 Section extraction test (nonexistent section 11)
11148 !! options
11149 section=11
11150 !! input
11151 start
11152 ==a==
11153 ===aa===
11154 ====aaa====
11155 ==b==
11156 ===ba===
11157 ===bb===
11158 ====bba====
11159 ===bc===
11160 ==c==
11161 ===ca===
11162 !! result
11163 !! end
11164
11165 !! test
11166 Section extraction test with bogus heading (section 1)
11167 !! options
11168 section=1
11169 !! input
11170 ==a==
11171 ==bogus== not a legal section
11172 ==b==
11173 !! result
11174 ==a==
11175 ==bogus== not a legal section
11176 !! end
11177
11178 !! test
11179 Section extraction test with bogus heading (section 2)
11180 !! options
11181 section=2
11182 !! input
11183 ==a==
11184 ==bogus== not a legal section
11185 ==b==
11186 !! result
11187 ==b==
11188 !! end
11189
11190 !! test
11191 Section extraction test with comment after heading (section 1)
11192 !! options
11193 section=1
11194 !! input
11195 ==a==
11196 ==b== <!-- -->
11197 ==c==
11198 !! result
11199 ==a==
11200 !! end
11201
11202 !! test
11203 Section extraction test with comment after heading (section 2)
11204 !! options
11205 section=2
11206 !! input
11207 ==a==
11208 ==b== <!-- -->
11209 ==c==
11210 !! result
11211 ==b== <!-- -->
11212 !! end
11213
11214 !! test
11215 Section extraction test with bogus <nowiki> heading (section 1)
11216 !! options
11217 section=1
11218 !! input
11219 ==a==
11220 ==bogus== <nowiki>not a legal section</nowiki>
11221 ==b==
11222 !! result
11223 ==a==
11224 ==bogus== <nowiki>not a legal section</nowiki>
11225 !! end
11226
11227 !! test
11228 Section extraction test with bogus <nowiki> heading (section 2)
11229 !! options
11230 section=2
11231 !! input
11232 ==a==
11233 ==bogus== <nowiki>not a legal section</nowiki>
11234 ==b==
11235 !! result
11236 ==b==
11237 !! end
11238
11239
11240 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11241 # instead of respecting commented sections
11242 !! test
11243 Section extraction prefixed by comment (section 1)
11244 !! options
11245 section=1
11246 !! input
11247 <!-- -->==sec1==
11248 ==sec2==
11249 !!result
11250 ==sec2==
11251 !!end
11252
11253 !! test
11254 Section extraction prefixed by comment (section 2)
11255 !! options
11256 section=2
11257 !! input
11258 <!-- -->==sec1==
11259 ==sec2==
11260 !!result
11261
11262 !!end
11263
11264
11265 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11266 # instead of respecting HTML-style headings
11267 !! test
11268 Section extraction, mixed wiki and html (section 1)
11269 !! options
11270 section=1
11271 !! input
11272 <h2>unmarked</h2>
11273 unmarked
11274 ==1==
11275 one
11276 ==2==
11277 two
11278 !! result
11279 ==1==
11280 one
11281 !! end
11282
11283 !! test
11284 Section extraction, mixed wiki and html (section 2)
11285 !! options
11286 section=2
11287 !! input
11288 <h2>unmarked</h2>
11289 unmarked
11290 ==1==
11291 one
11292 ==2==
11293 two
11294 !! result
11295 ==2==
11296 two
11297 !! end
11298
11299
11300 # Formerly testing for bug 3342
11301 !! test
11302 Section extraction, heading surrounded by <noinclude>
11303 !! options
11304 section=1
11305 !! input
11306 <noinclude>==unmarked==</noinclude>
11307 ==marked==
11308 !! result
11309 ==marked==
11310 !!end
11311
11312 # Test behavior of bug 19910
11313 !! test
11314 Sectiion with all-equals
11315 !! options
11316 section=2
11317 !! input
11318 ===
11319 The line above must have a trailing space
11320 === <!--
11321 --> <!-- -->
11322 But just in case it doesn't...
11323 !! result
11324 === <!--
11325 --> <!-- -->
11326 But just in case it doesn't...
11327 !! end
11328
11329 !! test
11330 Section replacement test (section 0)
11331 !! options
11332 replace=0,"xxx"
11333 !! input
11334 start
11335 ==a==
11336 ===aa===
11337 ====aaa====
11338 ==b==
11339 ===ba===
11340 ===bb===
11341 ====bba====
11342 ===bc===
11343 ==c==
11344 ===ca===
11345 !! result
11346 xxx
11347
11348 ==a==
11349 ===aa===
11350 ====aaa====
11351 ==b==
11352 ===ba===
11353 ===bb===
11354 ====bba====
11355 ===bc===
11356 ==c==
11357 ===ca===
11358 !! end
11359
11360 !! test
11361 Section replacement test (section 1)
11362 !! options
11363 replace=1,"xxx"
11364 !! input
11365 start
11366 ==a==
11367 ===aa===
11368 ====aaa====
11369 ==b==
11370 ===ba===
11371 ===bb===
11372 ====bba====
11373 ===bc===
11374 ==c==
11375 ===ca===
11376 !! result
11377 start
11378 xxx
11379
11380 ==b==
11381 ===ba===
11382 ===bb===
11383 ====bba====
11384 ===bc===
11385 ==c==
11386 ===ca===
11387 !! end
11388
11389 !! test
11390 Section replacement test (section 2)
11391 !! options
11392 replace=2,"xxx"
11393 !! input
11394 start
11395 ==a==
11396 ===aa===
11397 ====aaa====
11398 ==b==
11399 ===ba===
11400 ===bb===
11401 ====bba====
11402 ===bc===
11403 ==c==
11404 ===ca===
11405 !! result
11406 start
11407 ==a==
11408 xxx
11409
11410 ==b==
11411 ===ba===
11412 ===bb===
11413 ====bba====
11414 ===bc===
11415 ==c==
11416 ===ca===
11417 !! end
11418
11419 !! test
11420 Section replacement test (section 3)
11421 !! options
11422 replace=3,"xxx"
11423 !! input
11424 start
11425 ==a==
11426 ===aa===
11427 ====aaa====
11428 ==b==
11429 ===ba===
11430 ===bb===
11431 ====bba====
11432 ===bc===
11433 ==c==
11434 ===ca===
11435 !! result
11436 start
11437 ==a==
11438 ===aa===
11439 xxx
11440
11441 ==b==
11442 ===ba===
11443 ===bb===
11444 ====bba====
11445 ===bc===
11446 ==c==
11447 ===ca===
11448 !! end
11449
11450 !! test
11451 Section replacement test (section 4)
11452 !! options
11453 replace=4,"xxx"
11454 !! input
11455 start
11456 ==a==
11457 ===aa===
11458 ====aaa====
11459 ==b==
11460 ===ba===
11461 ===bb===
11462 ====bba====
11463 ===bc===
11464 ==c==
11465 ===ca===
11466 !! result
11467 start
11468 ==a==
11469 ===aa===
11470 ====aaa====
11471 xxx
11472
11473 ==c==
11474 ===ca===
11475 !! end
11476
11477 !! test
11478 Section replacement test (section 5)
11479 !! options
11480 replace=5,"xxx"
11481 !! input
11482 start
11483 ==a==
11484 ===aa===
11485 ====aaa====
11486 ==b==
11487 ===ba===
11488 ===bb===
11489 ====bba====
11490 ===bc===
11491 ==c==
11492 ===ca===
11493 !! result
11494 start
11495 ==a==
11496 ===aa===
11497 ====aaa====
11498 ==b==
11499 xxx
11500
11501 ===bb===
11502 ====bba====
11503 ===bc===
11504 ==c==
11505 ===ca===
11506 !! end
11507
11508 !! test
11509 Section replacement test (section 6)
11510 !! options
11511 replace=6,"xxx"
11512 !! input
11513 start
11514 ==a==
11515 ===aa===
11516 ====aaa====
11517 ==b==
11518 ===ba===
11519 ===bb===
11520 ====bba====
11521 ===bc===
11522 ==c==
11523 ===ca===
11524 !! result
11525 start
11526 ==a==
11527 ===aa===
11528 ====aaa====
11529 ==b==
11530 ===ba===
11531 xxx
11532
11533 ===bc===
11534 ==c==
11535 ===ca===
11536 !! end
11537
11538 !! test
11539 Section replacement test (section 7)
11540 !! options
11541 replace=7,"xxx"
11542 !! input
11543 start
11544 ==a==
11545 ===aa===
11546 ====aaa====
11547 ==b==
11548 ===ba===
11549 ===bb===
11550 ====bba====
11551 ===bc===
11552 ==c==
11553 ===ca===
11554 !! result
11555 start
11556 ==a==
11557 ===aa===
11558 ====aaa====
11559 ==b==
11560 ===ba===
11561 ===bb===
11562 xxx
11563
11564 ===bc===
11565 ==c==
11566 ===ca===
11567 !! end
11568
11569 !! test
11570 Section replacement test (section 8)
11571 !! options
11572 replace=8,"xxx"
11573 !! input
11574 start
11575 ==a==
11576 ===aa===
11577 ====aaa====
11578 ==b==
11579 ===ba===
11580 ===bb===
11581 ====bba====
11582 ===bc===
11583 ==c==
11584 ===ca===
11585 !! result
11586 start
11587 ==a==
11588 ===aa===
11589 ====aaa====
11590 ==b==
11591 ===ba===
11592 ===bb===
11593 ====bba====
11594 xxx
11595
11596 ==c==
11597 ===ca===
11598 !!end
11599
11600 !! test
11601 Section replacement test (section 9)
11602 !! options
11603 replace=9,"xxx"
11604 !! input
11605 start
11606 ==a==
11607 ===aa===
11608 ====aaa====
11609 ==b==
11610 ===ba===
11611 ===bb===
11612 ====bba====
11613 ===bc===
11614 ==c==
11615 ===ca===
11616 !! result
11617 start
11618 ==a==
11619 ===aa===
11620 ====aaa====
11621 ==b==
11622 ===ba===
11623 ===bb===
11624 ====bba====
11625 ===bc===
11626 xxx
11627 !! end
11628
11629 !! test
11630 Section replacement test (section 10)
11631 !! options
11632 replace=10,"xxx"
11633 !! input
11634 start
11635 ==a==
11636 ===aa===
11637 ====aaa====
11638 ==b==
11639 ===ba===
11640 ===bb===
11641 ====bba====
11642 ===bc===
11643 ==c==
11644 ===ca===
11645 !! result
11646 start
11647 ==a==
11648 ===aa===
11649 ====aaa====
11650 ==b==
11651 ===ba===
11652 ===bb===
11653 ====bba====
11654 ===bc===
11655 ==c==
11656 xxx
11657 !! end
11658
11659 !! test
11660 Section replacement test with initial whitespace (bug 13728)
11661 !! options
11662 replace=2,"xxx"
11663 !! input
11664 Preformatted initial line
11665 ==a==
11666 ===a===
11667 !! result
11668 Preformatted initial line
11669 ==a==
11670 xxx
11671 !! end
11672
11673
11674 !! test
11675 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11676 !! options
11677 section=1
11678 !! input
11679 ==a==
11680 a
11681 !! result
11682 ==a==
11683 a
11684 !! end
11685
11686 !! test
11687 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11688 !! options
11689 section=1
11690 !! input
11691 ==a==
11692 a
11693 !! result
11694 ==a==
11695 a
11696 !! end
11697
11698
11699 !! test
11700 Section extraction, <pre> around bogus header (bug 10309)
11701 !! options
11702 noxml section=2
11703 !! input
11704 == Section One ==
11705 <pre>
11706 =======
11707 </pre>
11708
11709 == Section Two ==
11710 stuff
11711 !! result
11712 == Section Two ==
11713 stuff
11714 !! end
11715
11716 !! test
11717 Section replacement, <pre> around bogus header (bug 10309)
11718 !! options
11719 noxml replace=2,"xxx"
11720 !! input
11721 == Section One ==
11722 <pre>
11723 =======
11724 </pre>
11725
11726 == Section Two ==
11727 stuff
11728 !! result
11729 == Section One ==
11730 <pre>
11731 =======
11732 </pre>
11733
11734 xxx
11735 !! end
11736
11737
11738
11739 !! test
11740 Handling of &#x0A; in URLs
11741 !! input
11742 **irc://&#x0A;a
11743 !! result
11744 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11745 </li></ul>
11746 </li></ul>
11747
11748 !!end
11749
11750 !! test
11751 5 quotes, code coverage +1 line (php)
11752 !! options
11753 php
11754 !! input
11755 '''''
11756 !! result
11757 !! end
11758 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11759 !! test
11760 5 quotes, code coverage +1 line (parsoid)
11761 !! options
11762 parsoid
11763 !! input
11764 '''''
11765 !! result
11766 <p><i><b></b></i></p>
11767 !! end
11768
11769 !! test
11770 Special:Search page linking.
11771 !! input
11772 {{Special:search}}
11773 !! result
11774 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11775 </p>
11776 !! end
11777
11778 !! test
11779 Say the magic word
11780 !! input
11781 * {{PAGENAME}}
11782 * {{BASEPAGENAME}}
11783 * {{SUBPAGENAME}}
11784 * {{SUBPAGENAMEE}}
11785 * {{ROOTPAGENAME}}
11786 * {{ROOTPAGENAMEE}}
11787 * {{BASEPAGENAME}}
11788 * {{BASEPAGENAMEE}}
11789 * {{TALKPAGENAME}}
11790 * {{TALKPAGENAMEE}}
11791 * {{SUBJECTPAGENAME}}
11792 * {{SUBJECTPAGENAMEE}}
11793 * {{NAMESPACEE}}
11794 * {{NAMESPACE}}
11795 * {{TALKSPACE}}
11796 * {{TALKSPACEE}}
11797 * {{SUBJECTSPACE}}
11798 * {{SUBJECTSPACEE}}
11799 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11800 !! result
11801 <ul><li> Parser test
11802 </li><li> Parser test
11803 </li><li> Parser test
11804 </li><li> Parser_test
11805 </li><li> Parser test
11806 </li><li> Parser_test
11807 </li><li> Parser test
11808 </li><li> Parser_test
11809 </li><li> Talk:Parser test
11810 </li><li> Talk:Parser_test
11811 </li><li> Parser test
11812 </li><li> Parser_test
11813 </li><li>
11814 </li><li>
11815 </li><li> Talk
11816 </li><li> Talk
11817 </li><li>
11818 </li><li>
11819 </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>
11820 </li></ul>
11821
11822 !! end
11823 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11824
11825 !! test
11826 Gallery
11827 !! input
11828 <gallery>
11829 image1.png |
11830 image2.gif|||||
11831
11832 image3|
11833 image4 |300px| centre
11834 image5.svg| http://///////
11835 [[x|xx]]]]
11836 * image6
11837 </gallery>
11838 !! result
11839 <ul class="gallery">
11840 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11841 <div style="height: 150px;">Image1.png</div>
11842 <div class="gallerytext">
11843 </div>
11844 </div></li>
11845 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11846 <div style="height: 150px;">Image2.gif</div>
11847 <div class="gallerytext">
11848 <p>||||
11849 </p>
11850 </div>
11851 </div></li>
11852 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11853 <div style="height: 150px;">Image3</div>
11854 <div class="gallerytext">
11855 </div>
11856 </div></li>
11857 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11858 <div style="height: 150px;">Image4</div>
11859 <div class="gallerytext">
11860 <p>300px| centre
11861 </p>
11862 </div>
11863 </div></li>
11864 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11865 <div style="height: 150px;">Image5.svg</div>
11866 <div class="gallerytext">
11867 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11868 </p>
11869 </div>
11870 </div></li>
11871 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11872 <div style="height: 150px;">* image6</div>
11873 <div class="gallerytext">
11874 </div>
11875 </div></li>
11876 </ul>
11877
11878 !! end
11879
11880 !! test
11881 Gallery (with options)
11882 !! input
11883 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11884 File:Nonexistant.jpg|caption
11885 File:Nonexistant.jpg
11886 image:foobar.jpg|some '''caption''' [[Main Page]]
11887 image:foobar.jpg
11888 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11889 </gallery>
11890 !! result
11891 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11892 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11893 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11894 <div style="height: 70px;">Nonexistant.jpg</div>
11895 <div class="gallerytext">
11896 <p>caption
11897 </p>
11898 </div>
11899 </div></li>
11900 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11901 <div style="height: 70px;">Nonexistant.jpg</div>
11902 <div class="gallerytext">
11903 </div>
11904 </div></li>
11905 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11906 <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>
11907 <div class="gallerytext">
11908 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11909 </p>
11910 </div>
11911 </div></li>
11912 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11913 <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>
11914 <div class="gallerytext">
11915 </div>
11916 </div></li>
11917 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11918 <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>
11919 <div class="gallerytext">
11920 <p>Blabla|blabla.
11921 </p>
11922 </div>
11923 </div></li>
11924 </ul>
11925
11926 !! end
11927
11928 !! test
11929 Gallery with wikitext inside caption
11930 !! input
11931 <gallery>
11932 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11933 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11934 </gallery>
11935 !! result
11936 <ul class="gallery">
11937 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11938 <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>
11939 <div class="gallerytext">
11940 <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>
11941 </p>
11942 </div>
11943 </div></li>
11944 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11945 <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>
11946 <div class="gallerytext">
11947 <p>This is a test template
11948 </p>
11949 </div>
11950 </div></li>
11951 </ul>
11952
11953 !! end
11954
11955 !! test
11956 gallery (with showfilename option)
11957 !! input
11958 <gallery showfilename>
11959 File:Nonexistant.jpg|caption
11960 File:Nonexistant.jpg
11961 image:foobar.jpg|some '''caption''' [[Main Page]]
11962 File:Foobar.jpg
11963 </gallery>
11964 !! result
11965 <ul class="gallery">
11966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11967 <div style="height: 150px;">Nonexistant.jpg</div>
11968 <div class="gallerytext">
11969 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11970 caption
11971 </p>
11972 </div>
11973 </div></li>
11974 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11975 <div style="height: 150px;">Nonexistant.jpg</div>
11976 <div class="gallerytext">
11977 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11978 </p>
11979 </div>
11980 </div></li>
11981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11982 <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>
11983 <div class="gallerytext">
11984 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11985 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11986 </p>
11987 </div>
11988 </div></li>
11989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11990 <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>
11991 <div class="gallerytext">
11992 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11993 </p>
11994 </div>
11995 </div></li>
11996 </ul>
11997
11998 !! end
11999
12000 !! test
12001 Gallery (with namespace-less filenames)
12002 !! input
12003 <gallery>
12004 File:Nonexistant.jpg
12005 Nonexistant.jpg
12006 image:foobar.jpg
12007 foobar.jpg
12008 </gallery>
12009 !! result
12010 <ul class="gallery">
12011 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12012 <div style="height: 150px;">Nonexistant.jpg</div>
12013 <div class="gallerytext">
12014 </div>
12015 </div></li>
12016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12017 <div style="height: 150px;">Nonexistant.jpg</div>
12018 <div class="gallerytext">
12019 </div>
12020 </div></li>
12021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12022 <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>
12023 <div class="gallerytext">
12024 </div>
12025 </div></li>
12026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12027 <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>
12028 <div class="gallerytext">
12029 </div>
12030 </div></li>
12031 </ul>
12032
12033 !! end
12034
12035 !! test
12036 HTML Hex character encoding (spells the word "JavaScript")
12037 !! input
12038 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12039 !! result
12040 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12041 </p>
12042 !! end
12043
12044 !! test
12045 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12046 !! input
12047 &#xsee;&#XSEE;
12048 !! result
12049 <p>&amp;#xsee;&amp;#XSEE;
12050 </p>
12051 !! end
12052
12053 !! test
12054 HTML Hex character encoding mixed case
12055 !! input
12056 &#xEE;&#Xee;
12057 !! result
12058 <p>&#xee;&#xee;
12059 </p>
12060 !! end
12061
12062 !! test
12063 __FORCETOC__ override
12064 !! input
12065 __NEWSECTIONLINK__
12066 __FORCETOC__
12067 !! result
12068 <p><br />
12069 </p>
12070 !! end
12071
12072 !! test
12073 ISBN code coverage
12074 !! input
12075 ISBN 978-0-1234-56&#x20;789
12076 !! result
12077 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12078 </p>
12079 !! end
12080
12081 !! test
12082 ISBN followed by 5 spaces
12083 !! input
12084 ISBN
12085 !! result
12086 <p>ISBN
12087 </p>
12088 !! end
12089
12090 !! test
12091 Double ISBN
12092 !! input
12093 ISBN ISBN 1234567890
12094 !! result
12095 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12096 </p>
12097 !! end
12098
12099 !! test
12100 Bug 22905: <abbr> followed by ISBN followed by </a>
12101 !! input
12102 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12103 !! result
12104 <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>
12105 </p>
12106 !! end
12107
12108 !! test
12109 Double RFC
12110 !! input
12111 RFC RFC 1234
12112 !! result
12113 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12114 </p>
12115 !! end
12116
12117 !! test
12118 Double RFC with a wiki link
12119 !! input
12120 RFC [[RFC 1234]]
12121 !! result
12122 <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>
12123 </p>
12124 !! end
12125
12126 !! test
12127 RFC code coverage
12128 !! input
12129 RFC 983&#x20;987
12130 !! result
12131 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12132 </p>
12133 !! end
12134
12135 !! test
12136 Centre-aligned image
12137 !! input
12138 [[Image:foobar.jpg|centre]]
12139 !! result
12140 <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>
12141
12142 !!end
12143
12144 !! test
12145 None-aligned image
12146 !! input
12147 [[Image:foobar.jpg|none]]
12148 !! result
12149 <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>
12150
12151 !!end
12152
12153 !! test
12154 Width + Height sized image (using px) (height is ignored)
12155 !! input
12156 [[Image:foobar.jpg|640x480px]]
12157 !! result
12158 <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>
12159 </p>
12160 !!end
12161
12162 !! test
12163 Width-sized image (using px, no following whitespace)
12164 !! input
12165 [[Image:foobar.jpg|640px]]
12166 !! result
12167 <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>
12168 </p>
12169 !!end
12170
12171 !! test
12172 Width-sized image (using px, with following whitespace - test regression from r39467)
12173 !! input
12174 [[Image:foobar.jpg|640px ]]
12175 !! result
12176 <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>
12177 </p>
12178 !!end
12179
12180 !! test
12181 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12182 !! input
12183 [[Image:foobar.jpg| 640px]]
12184 !! result
12185 <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>
12186 </p>
12187 !!end
12188
12189 !! test
12190 Another italics / bold test
12191 !! input
12192 ''' ''x'
12193 !! result
12194 <pre>'<i> </i>x'
12195 </pre>
12196 !!end
12197
12198 # Note the results may be incorrect, as parserTest output included this:
12199 # XML error: Mismatched tag at byte 6120:
12200 # ...<dd> </dt></dl> </dd...
12201 !! test
12202 dt/dd/dl test
12203 !! options
12204 disabled
12205 !! input
12206 :;;;::
12207 !! result
12208 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12209 </dd></dl>
12210 </dd></dl>
12211 </dt></dl>
12212 </dt></dl>
12213 </dt></dl>
12214 </dd></dl>
12215
12216 !!end
12217
12218
12219 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12220 !! test
12221 Images with the "|" character in the comment
12222 !! input
12223 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12224 !! result
12225 <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>
12226
12227 !!end
12228
12229 !! test
12230 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12231 !! input
12232 <html><script>alert(1);</script></html>
12233 !! result
12234 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12235 </p>
12236 !! end
12237
12238 !! test
12239 HTML with raw HTML ($wgRawHtml==true)
12240 !! options
12241 rawhtml
12242 !! input
12243 <html><script>alert(1);</script></html>
12244 !! result
12245 <p><script>alert(1);</script>
12246 </p>
12247 !! end
12248
12249 !! test
12250 Parents of subpages, one level up
12251 !! options
12252 subpage title=[[Subpage test/L1/L2/L3]]
12253 !! input
12254 [[../|L2]]
12255 !! result
12256 <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>
12257 </p>
12258 !! end
12259
12260
12261 !! test
12262 Parents of subpages, one level up, not named
12263 !! options
12264 subpage title=[[Subpage test/L1/L2/L3]]
12265 !! input
12266 [[../]]
12267 !! result
12268 <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>
12269 </p>
12270 !! end
12271
12272
12273
12274 !! test
12275 Parents of subpages, two levels up
12276 !! options
12277 subpage title=[[Subpage test/L1/L2/L3]]
12278 !! input
12279 [[../../|L1]]2
12280
12281 [[../../|L1]]l
12282 !! result
12283 <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
12284 </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>
12285 </p>
12286 !! end
12287
12288 !! test
12289 Parents of subpages, two levels up, without trailing slash or name.
12290 !! options
12291 subpage title=[[Subpage test/L1/L2/L3]]
12292 !! input
12293 [[../..]]
12294 !! result
12295 <p>[[../..]]
12296 </p>
12297 !! end
12298
12299 !! test
12300 Parents of subpages, two levels up, with lots of extra trailing slashes.
12301 !! options
12302 subpage title=[[Subpage test/L1/L2/L3]]
12303 !! input
12304 [[../../////]]
12305 !! result
12306 <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>
12307 </p>
12308 !! end
12309
12310 !! article
12311 Subpage test/L1/L2/L3Sibling
12312 !! text
12313 Sibling article
12314 !! endarticle
12315
12316 !! test
12317 Transclusion of a sibling page (one level up)
12318 !! options
12319 subpage title=[[Subpage test/L1/L2/L3]]
12320 !! input
12321 {{../L3Sibling}}
12322 !! result
12323 <p>Sibling article
12324 </p>
12325 !! end
12326
12327 !! test
12328 Transclusion of a child page
12329 !! options
12330 subpage title=[[Subpage test/L1/L2]]
12331 !! input
12332 {{/L3Sibling}}
12333 !! result
12334 <p>Sibling article
12335 </p>
12336 !! end
12337
12338 !! test
12339 Non-transclusion because of too many up levels
12340 !! options
12341 subpage title=[[Subpage test/L1/L2/L3]]
12342 !! input
12343 {{../../../../More than parent}}
12344 !! result
12345 <p>{{../../../../More than parent}}
12346 </p>
12347 !! end
12348
12349 !! test
12350 Definition list code coverage
12351 !! input
12352 ; title : def
12353 ; title : def
12354 ;title: def
12355 !! result
12356 <dl><dt> title &#160;</dt><dd> def
12357 </dd><dt> title&#160;</dt><dd> def
12358 </dd><dt>title</dt><dd> def
12359 </dd></dl>
12360
12361 !! end
12362
12363 !! test
12364 Don't fall for the self-closing div
12365 !! input
12366 <div>hello world</div/>
12367 !! result
12368 <div>hello world</div>
12369
12370 !! end
12371
12372 !! test
12373 MSGNW magic word
12374 !! input
12375 {{MSGNW:msg}}
12376 !! result
12377 <p>&#91;&#91;:Template:Msg&#93;&#93;
12378 </p>
12379 !! end
12380
12381 !! test
12382 RAW magic word
12383 !! input
12384 {{RAW:QUERTY}}
12385 !! result
12386 <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>
12387 </p>
12388 !! end
12389
12390 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12391 !! test
12392 Always escape literal '>' in output, not just after '<'
12393 !! input
12394 ><>
12395 !! result
12396 <p>&gt;&lt;&gt;
12397 </p>
12398 !! end
12399
12400 !! test
12401 Template caching
12402 !! input
12403 {{Test}}
12404 {{Test}}
12405 !! result
12406 <p>This is a test template
12407 This is a test template
12408 </p>
12409 !! end
12410
12411
12412 !! article
12413 MediaWiki:Fake
12414 !! text
12415 ==header==
12416 !! endarticle
12417
12418 !! test
12419 Inclusion of !userCanEdit() content
12420 !! input
12421 {{MediaWiki:Fake}}
12422 !! result
12423 <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>
12424
12425 !! end
12426
12427
12428 !! test
12429 Out-of-order TOC heading levels
12430 !! input
12431 ==2==
12432 ======6======
12433 ===3===
12434 =1=
12435 =====5=====
12436 ==2==
12437 !! result
12438 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12439 <ul>
12440 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12441 <ul>
12442 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12443 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12444 </ul>
12445 </li>
12446 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12447 <ul>
12448 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12449 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12450 </ul>
12451 </li>
12452 </ul>
12453 </div>
12454 <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>
12455 <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>
12456 <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>
12457 <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>
12458 <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>
12459 <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>
12460
12461 !! end
12462
12463
12464 !! test
12465 ISBN with a dummy number
12466 !! input
12467 ISBN ---
12468 !! result
12469 <p>ISBN ---
12470 </p>
12471 !! end
12472
12473
12474 !! test
12475 ISBN with space-delimited number
12476 !! input
12477 ISBN 92 9017 032 8
12478 !! result
12479 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12480 </p>
12481 !! end
12482
12483
12484 !! test
12485 ISBN with multiple spaces, no number
12486 !! input
12487 ISBN foo
12488 !! result
12489 <p>ISBN foo
12490 </p>
12491 !! end
12492
12493
12494 !! test
12495 ISBN length
12496 !! input
12497 ISBN 123456789
12498
12499 ISBN 1234567890
12500
12501 ISBN 12345678901
12502 !! result
12503 <p>ISBN 123456789
12504 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12505 </p><p>ISBN 12345678901
12506 </p>
12507 !! end
12508
12509
12510 !! test
12511 ISBN with trailing year (bug 8110)
12512 !! input
12513 ISBN 1-234-56789-0 - 2006
12514
12515 ISBN 1 234 56789 0 - 2006
12516 !! result
12517 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12518 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12519 </p>
12520 !! end
12521
12522
12523 !! test
12524 anchorencode
12525 !! input
12526 {{anchorencode:foo bar©#%n}}
12527 !! result
12528 <p>foo_bar.C2.A9.23.25n
12529 </p>
12530 !! end
12531
12532 !! test
12533 anchorencode trims spaces
12534 !! input
12535 {{anchorencode: __pretty__please__}}
12536 !! result
12537 <p>pretty_please
12538 </p>
12539 !! end
12540
12541 !! test
12542 anchorencode deals with links
12543 !! input
12544 {{anchorencode: [[hello|world]] [[hi]]}}
12545 !! result
12546 <p>world_hi
12547 </p>
12548 !! end
12549
12550 !! test
12551 anchorencode deals with templates
12552 !! input
12553 {{anchorencode: {{Foo}} }}
12554 !! result
12555 <p>FOO
12556 </p>
12557 !! end
12558
12559 !! test
12560 anchorencode encodes like the TOC generator: (bug 18431)
12561 !! input
12562 === _ +:.3A%3A&&amp;]] ===
12563 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12564 __NOEDITSECTION__
12565 !! result
12566 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12567 <p>.2B:.3A.253A.26.26.5D.5D
12568 </p>
12569 !! end
12570
12571 # Expected output in the following test is not necessarily expected (there
12572 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12573 # only testing for well-formedness.
12574 !! test
12575 Bug 6200: blockquotes and paragraph formatting
12576 !! input
12577 <blockquote>
12578 foo
12579 </blockquote>
12580
12581 bar
12582
12583 baz
12584 !! result
12585 <blockquote>
12586 foo
12587 </blockquote>
12588 <p>bar
12589 </p>
12590 <pre>baz
12591 </pre>
12592 !! end
12593
12594 !! test
12595 Bug 8293: Use of center tag ruins paragraph formatting
12596 !! input
12597 <center>
12598 foo
12599 </center>
12600
12601 bar
12602
12603 baz
12604 !! result
12605 <center>
12606 <p>foo
12607 </p>
12608 </center>
12609 <p>bar
12610 </p>
12611 <pre>baz
12612 </pre>
12613 !! end
12614
12615 !!test
12616 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12617 !!options
12618 php
12619 !!input
12620 <span><s>x</span></s>
12621 !!result
12622 <p><span><s>x&lt;/span&gt;</s></span>
12623 </p>
12624 !!end
12625
12626 !!test
12627 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12628 !!options
12629 parsoid
12630 !!input
12631 <span><s>x</span></s>
12632 !!result
12633 <p><span><s>x</s></span><s></s>
12634 </p>
12635 !!end
12636
12637 ###
12638 ### Language variants related tests
12639 ###
12640 !! test
12641 Self-link in language variants
12642 !! options
12643 title=[[Dunav]] language=sr
12644 !! input
12645 Both [[Dunav]] and [[Дунав]] are names for this river.
12646 !! result
12647 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12648 </p>
12649 !!end
12650
12651 !! article
12652 Дуна
12653 !! text
12654 content
12655 !! endarticle
12656
12657 !! test
12658 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12659 !! options
12660 title=[[Duna]] language=sr
12661 !! input
12662 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12663 !! result
12664 <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.
12665 </p>
12666 !! end
12667
12668 !! test
12669 Link to pages in language variants
12670 !! options
12671 language=sr
12672 !! input
12673 Main Page can be written as [[Маин Паге]]
12674 !! result
12675 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12676 </p>
12677 !!end
12678
12679
12680 !! test
12681 Multiple links to pages in language variants
12682 !! options
12683 language=sr
12684 !! input
12685 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12686 !! result
12687 <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>.
12688 </p>
12689 !!end
12690
12691
12692 !! test
12693 Simple template in language variants
12694 !! options
12695 language=sr
12696 !! input
12697 {{тест}}
12698 !! result
12699 <p>This is a test template
12700 </p>
12701 !! end
12702
12703
12704 !! test
12705 Template with explicit namespace in language variants
12706 !! options
12707 language=sr
12708 !! input
12709 {{Template:тест}}
12710 !! result
12711 <p>This is a test template
12712 </p>
12713 !! end
12714
12715
12716 !! test
12717 Basic test for template parameter in language variants
12718 !! options
12719 language=sr
12720 !! input
12721 {{парамтест|param=foo}}
12722 !! result
12723 <p>This is a test template with parameter foo
12724 </p>
12725 !! end
12726
12727
12728 !! test
12729 Simple category in language variants
12730 !! options
12731 language=sr cat
12732 !! input
12733 [[Category:МедиаWики Усер'с Гуиде]]
12734 !! result
12735 <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>
12736 !! end
12737
12738
12739 !! article
12740 Category:分类
12741 !! text
12742 blah
12743 !! endarticle
12744
12745 !! article
12746 Category:分類
12747 !! text
12748 blah
12749 !! endarticle
12750
12751 !! test
12752 Don't convert blue categorylinks to another variant (bug 33210)
12753 !! options
12754 language=zh cat
12755 !! input
12756 [[A]][[Category:分类]]
12757 !! result
12758 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12759 !! end
12760
12761
12762 !! test
12763 Stripping -{}- tags (language variants)
12764 !! options
12765 language=sr
12766 !! input
12767 Latin proverb: -{Ne nuntium necare}-
12768 !! result
12769 <p>Latin proverb: Ne nuntium necare
12770 </p>
12771 !! end
12772
12773
12774 !! test
12775 Prevent conversion with -{}- tags (language variants)
12776 !! options
12777 language=sr variant=sr-ec
12778 !! input
12779 Latinski: -{Ne nuntium necare}-
12780 !! result
12781 <p>Латински: Ne nuntium necare
12782 </p>
12783 !! end
12784
12785
12786 !! test
12787 Prevent conversion of text with -{}- tags (language variants)
12788 !! options
12789 language=sr variant=sr-ec
12790 !! input
12791 Latinski: -{Ne nuntium necare}-
12792 !! result
12793 <p>Латински: Ne nuntium necare
12794 </p>
12795 !! end
12796
12797
12798 !! test
12799 Prevent conversion of links with -{}- tags (language variants)
12800 !! options
12801 language=sr variant=sr-ec
12802 !! input
12803 -{[[Main Page]]}-
12804 !! result
12805 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12806 </p>
12807 !! end
12808
12809
12810 !! test
12811 -{}- tags within headlines (within html for parserConvert())
12812 !! options
12813 language=sr variant=sr-ec
12814 !! input
12815 == -{Naslov}- ==
12816 !! result
12817 <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>
12818
12819 !! end
12820
12821
12822 !! test
12823 Explicit definition of language variant alternatives
12824 !! options
12825 language=zh variant=zh-tw
12826 !! input
12827 -{zh:China;zh-tw:Taiwan}-, not China
12828 !! result
12829 <p>Taiwan, not China
12830 </p>
12831 !! end
12832
12833
12834 !! test
12835 Conversion around HTML tags
12836 !! options
12837 language=sr variant=sr-ec
12838 !! input
12839 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12840 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12841 !! result
12842 <p>
12843 <span title="ЛаCтин">ски</span>
12844 </p>
12845 !! end
12846
12847
12848 !! test
12849 Explicit session-wise language variant mapping (A flag and - flag)
12850 !! options
12851 language=zh variant=zh-tw
12852 !! input
12853 Taiwan is not China.
12854 But -{A|zh:China;zh-tw:Taiwan}- is China,
12855 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12856 and -{China}- is China.
12857 !! result
12858 <p>Taiwan is not China.
12859 But Taiwan is Taiwan,
12860 (This should be stripped!)
12861 and China is China.
12862 </p>
12863 !! end
12864
12865 !! test
12866 Explicit session-wise language variant mapping (H flag for hide)
12867 !! options
12868 language=zh variant=zh-tw
12869 !! input
12870 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12871 Taiwan is China.
12872 !! result
12873 <p>(This should be stripped!)
12874 Taiwan is Taiwan.
12875 </p>
12876 !! end
12877
12878 !! test
12879 Adding explicit conversion rule for title (T flag)
12880 !! options
12881 language=zh variant=zh-tw showtitle
12882 !! input
12883 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12884 !! result
12885 Taiwan
12886 <p>Should be stripped!
12887 </p>
12888 !! end
12889
12890 !! test
12891 Testing that changing the language variant here in the tests actually works
12892 !! options
12893 language=zh variant=zh showtitle
12894 !! input
12895 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12896 !! result
12897 China
12898 <p>Should be stripped!
12899 </p>
12900 !! end
12901
12902 !! test
12903 Recursive conversion of alt and title attrs shouldn't clear converter state
12904 !! options
12905 language=zh variant=zh-cn showtitle
12906 !! input
12907 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12908 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12909 !! result
12910 China
12911 <p>
12912 Should be stripped<span title="Exclamation">!</span>
12913 </p>
12914 !! end
12915
12916 !! test
12917 Bug 24072: more test on conversion rule for title
12918 !! options
12919 language=zh variant=zh-tw showtitle
12920 !! input
12921 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12922 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12923 !! result
12924 Taiwan
12925 <p>This should be stripped!
12926 This won't take interferes with the title rule.
12927 </p>
12928 !! end
12929
12930 !! test
12931 Partly disable title conversion if variant == main language code
12932 !! options
12933 language=zh variant=zh title=[[ZH]] showtitle
12934 !! input
12935 -{T|zh-cn:CN;zh-tw:TW}-
12936 !! result
12937 ZH
12938 <p>
12939 </p>
12940 !! end
12941
12942 !! test
12943 Partly disable title conversion if variant == main language code, more
12944 !! options
12945 language=zh variant=zh title=[[ZH]] showtitle
12946 !! input
12947 -{T|TW}-
12948 !! result
12949 ZH
12950 <p>
12951 </p>
12952 !! end
12953
12954 !! test
12955 Raw output of variant escape tags (R flag)
12956 !! options
12957 language=zh variant=zh-tw
12958 !! input
12959 Raw: -{R|zh:China;zh-tw:Taiwan}-
12960 !! result
12961 <p>Raw: zh:China;zh-tw:Taiwan
12962 </p>
12963 !! end
12964
12965 !! test
12966 Nested using of manual convert syntax
12967 !! options
12968 language=zh variant=zh-hk
12969 !! input
12970 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12971 !! result
12972 <p>Nested: Hello Hong Kong!
12973 </p>
12974 !! end
12975
12976 !! test
12977 Proper conversion of text in external links
12978 !! options
12979 language=sr variant=sr-ec
12980 !! input
12981 http://www.google.com
12982 gopher://www.google.com
12983 [http://www.google.com http://www.google.com]
12984 [gopher://www.google.com gopher://www.google.com]
12985 [https://www.google.com irc://www.google.com]
12986 [ftp://www.google.com www.google.com/ftp://dir]
12987 [//www.google.com www.google.com]
12988 !! result
12989 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12990 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12991 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12992 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12993 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12994 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12995 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12996 </p>
12997 !! end
12998
12999 !! test
13000 Do not convert roman numbers to language variants
13001 !! options
13002 language=sr variant=sr-ec
13003 !! input
13004 Fridrih IV je car.
13005 !! result
13006 <p>Фридрих IV је цар.
13007 </p>
13008 !! end
13009
13010 !! test
13011 Unclosed language converter markup "-{"
13012 !! options
13013 language=sr
13014 !! input
13015 -{T|hello
13016 !! result
13017 <p>-{T|hello
13018 </p>
13019 !! end
13020
13021 !! test
13022 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13023 !! options
13024 language=sr
13025 !! input
13026 -{R|=&gt;}-
13027 !! result
13028 <p>=&gt;
13029 </p>
13030 !!end
13031
13032 !!article
13033 Template:Bullet
13034 !!text
13035 * Bar
13036 !!endarticle
13037
13038 !! test
13039 Bug 529: Uncovered bullet
13040 !! input
13041 * Foo {{bullet}}
13042 !! result
13043 <ul><li> Foo
13044 </li><li> Bar
13045 </li></ul>
13046
13047 !! end
13048
13049 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13050 # Templates in Wikipedia rely on this behavior, as tidy has always been
13051 # enabled there. These tests are normally run *without* tidy, so specify the
13052 # full output here.
13053 # To test realistic parsing behavior, apply a tidy-like transformation to both
13054 # the expected output and your parser's output.
13055 !! test
13056 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13057 !! input
13058 ******* Foo {{bullet}}
13059 !! result
13060 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13061 </li></ul>
13062 </li></ul>
13063 </li></ul>
13064 </li></ul>
13065 </li></ul>
13066 </li></ul>
13067 </li><li> Bar
13068 </li></ul>
13069
13070 !! end
13071
13072 !! test
13073 Bug 529: Uncovered table already at line-start
13074 !! input
13075 x
13076
13077 {{table}}
13078 y
13079 !! result
13080 <p>x
13081 </p>
13082 <table>
13083 <tr>
13084 <td> 1 </td>
13085 <td> 2
13086 </td></tr>
13087 <tr>
13088 <td> 3 </td>
13089 <td> 4
13090 </td></tr></table>
13091 <p>y
13092 </p>
13093 !! end
13094
13095 !! test
13096 Bug 529: Uncovered bullet in parser function result
13097 !! input
13098 * Foo {{lc:{{bullet}} }}
13099 !! result
13100 <ul><li> Foo
13101 </li><li> bar
13102 </li></ul>
13103
13104 !! end
13105
13106 !! test
13107 Bug 5678: Double-parsed template argument
13108 !! input
13109 {{lc:{{{1}}}|hello}}
13110 !! result
13111 <p>{{{1}}}
13112 </p>
13113 !! end
13114
13115 !! test
13116 Bug 5678: Double-parsed template invocation
13117 !! input
13118 {{lc:{{paramtest {{!}} param = hello }} }}
13119 !! result
13120 <p>{{paramtest | param = hello }}
13121 </p>
13122 !! end
13123
13124 !! test
13125 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13126 !! options
13127 language=cs
13128 title=[[Main Page]]
13129 !! input
13130 {{PRVNÍVELKÉ:ěščř}}
13131 {{prvnívelké:ěščř}}
13132 {{PRVNÍMALÉ:ěščř}}
13133 {{prvnímalé:ěščř}}
13134 {{MALÁ:ěščř}}
13135 {{malá:ěščř}}
13136 {{VELKÁ:ěščř}}
13137 {{velká:ěščř}}
13138 !! result
13139 <p>Ěščř
13140 Ěščř
13141 ěščř
13142 ěščř
13143 ěščř
13144 ěščř
13145 ĚŠČŘ
13146 ĚŠČŘ
13147 </p>
13148 !! end
13149
13150 !! test
13151 Morwen/13: Unclosed link followed by heading
13152 !! input
13153 [[link
13154 ==heading==
13155 !! result
13156 <p>[[link
13157 </p>
13158 <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>
13159
13160 !! end
13161
13162 !! test
13163 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13164 !! input
13165 {{foo|
13166 =heading=
13167 !! result
13168 <p>{{foo|
13169 </p>
13170 <h1><span class="mw-headline" id="heading">heading</span></h1>
13171
13172 !! end
13173
13174 !! test
13175 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13176 !! input
13177 {{foo|
13178 ==heading==
13179 !! result
13180 <p>{{foo|
13181 </p>
13182 <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>
13183
13184 !! end
13185
13186 !! test
13187 Tildes in comments
13188 !! options
13189 pst
13190 !! input
13191 <!-- ~~~~ -->
13192 !! result
13193 <!-- ~~~~ -->
13194 !! end
13195
13196 !! test
13197 Paragraphs inside divs (no extra line breaks)
13198 !! input
13199 <div>Line one
13200
13201 Line two</div>
13202 !! result
13203 <div>Line one
13204 Line two</div>
13205
13206 !! end
13207
13208 !! test
13209 Paragraphs inside divs (extra line break on open)
13210 !! input
13211 <div>
13212 Line one
13213
13214 Line two</div>
13215 !! result
13216 <div>
13217 <p>Line one
13218 </p>
13219 Line two</div>
13220
13221 !! end
13222
13223 !! test
13224 Paragraphs inside divs (extra line break on close)
13225 !! input
13226 <div>Line one
13227
13228 Line two
13229 </div>
13230 !! result
13231 <div>Line one
13232 <p>Line two
13233 </p>
13234 </div>
13235
13236 !! end
13237
13238 !! test
13239 Paragraphs inside divs (extra line break on open and close)
13240 !! input
13241 <div>
13242 Line one
13243
13244 Line two
13245 </div>
13246 !! result
13247 <div>
13248 <p>Line one
13249 </p><p>Line two
13250 </p>
13251 </div>
13252
13253 !! end
13254
13255 !! test
13256 Nesting tags, paragraphs on lines which begin with <div>
13257 !! options
13258 disabled
13259 !! input
13260 <div></div><strong>A
13261 B</strong>
13262 !! result
13263 <div></div>
13264 <p><strong>A
13265 B</strong>
13266 </p>
13267 !! end
13268
13269 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13270 !! test
13271 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13272 !! options
13273 disabled
13274 !! input
13275 <blockquote>Line one
13276
13277 Line two</blockquote>
13278 !! result
13279 <blockquote>Line one
13280 Line two</blockquote>
13281
13282 !! end
13283
13284 !! test
13285 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13286 !! options
13287 disabled
13288 !! input
13289 <blockquote>
13290 Line one
13291
13292 Line two</blockquote>
13293 !! result
13294 <blockquote>
13295 <p>Line one
13296 </p>
13297 Line two</blockquote>
13298
13299 !! end
13300
13301 !! test
13302 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13303 !! options
13304 disabled
13305 !! input
13306 <blockquote>Line one
13307
13308 Line two
13309 </blockquote>
13310 !! result
13311 <blockquote>Line one
13312 <p>Line two
13313 </p>
13314 </blockquote>
13315
13316 !! end
13317
13318 !! test
13319 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13320 !! options
13321 disabled
13322 !! input
13323 <blockquote>
13324 Line one
13325
13326 Line two
13327 </blockquote>
13328 !! result
13329 <blockquote>
13330 <p>Line one
13331 </p><p>Line two
13332 </p>
13333 </blockquote>
13334
13335 !! end
13336
13337 !! test
13338 Paragraphs inside blockquotes/divs (no extra line breaks)
13339 !! input
13340 <blockquote><div>Line one
13341
13342 Line two</div></blockquote>
13343 !! result
13344 <blockquote><div>Line one
13345 Line two</div></blockquote>
13346
13347 !! end
13348
13349 !! test
13350 Paragraphs inside blockquotes/divs (extra line break on open)
13351 !! input
13352 <blockquote><div>
13353 Line one
13354
13355 Line two</div></blockquote>
13356 !! result
13357 <blockquote><div>
13358 <p>Line one
13359 </p>
13360 Line two</div></blockquote>
13361
13362 !! end
13363
13364 !! test
13365 Paragraphs inside blockquotes/divs (extra line break on close)
13366 !! input
13367 <blockquote><div>Line one
13368
13369 Line two
13370 </div></blockquote>
13371 !! result
13372 <blockquote><div>Line one
13373 <p>Line two
13374 </p>
13375 </div></blockquote>
13376
13377 !! end
13378
13379 !! test
13380 Paragraphs inside blockquotes/divs (extra line break on open and close)
13381 !! input
13382 <blockquote><div>
13383 Line one
13384
13385 Line two
13386 </div></blockquote>
13387 !! result
13388 <blockquote><div>
13389 <p>Line one
13390 </p><p>Line two
13391 </p>
13392 </div></blockquote>
13393
13394 !! end
13395
13396 !! test
13397 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13398 !! options
13399 wgLinkHolderBatchSize=0
13400 !! input
13401 [[meatball:1]]
13402 [[meatball:2]]
13403 [[meatball:3]]
13404 !! result
13405 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13406 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13407 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13408 </p>
13409 !! end
13410
13411 !! test
13412 Free external link invading image caption
13413 !! input
13414 [[Image:Foobar.jpg|thumb|http://x|hello]]
13415 !! result
13416 <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>
13417
13418 !! end
13419
13420 !! test
13421 Bug 15196: localised external link numbers
13422 !! options
13423 language=fa
13424 !! input
13425 [http://en.wikipedia.org/]
13426 !! result
13427 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13428 </p>
13429 !! end
13430
13431 !! test
13432 Multibyte character in padleft
13433 !! input
13434 {{padleft:-Hello|7|Æ}}
13435 !! result
13436 <p>Æ-Hello
13437 </p>
13438 !! end
13439
13440 !! test
13441 Multibyte character in padright
13442 !! input
13443 {{padright:Hello-|7|Æ}}
13444 !! result
13445 <p>Hello-Æ
13446 </p>
13447 !! end
13448
13449 !!test
13450 formatdate parser function
13451 !!input
13452 {{#formatdate:2009-03-24}}
13453 !! result
13454 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13455 </p>
13456 !! end
13457
13458 !!test
13459 formatdate parser function, with default format
13460 !!input
13461 {{#formatdate:2009-03-24|mdy}}
13462 !! result
13463 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13464 </p>
13465 !! end
13466
13467 !! test
13468 Spacing of numbers in formatted dates
13469 !! input
13470 {{#formatdate:January 15}}
13471 !! result
13472 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13473 </p>
13474 !! end
13475
13476 !! test
13477 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
13478 !! options
13479 language=nl title=[[MediaWiki:Common.css]]
13480 !! input
13481 {{#formatdate:2009-03-24|dmy}}
13482 !! result
13483 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13484 </p>
13485 !! end
13486
13487 #
13488 #
13489 #
13490
13491 #
13492 # Edit comments
13493 #
13494
13495 !! test
13496 Edit comment with link
13497 !! options
13498 comment
13499 !! input
13500 I like the [[Main Page]] a lot
13501 !! result
13502 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13503 !!end
13504
13505 !! test
13506 Edit comment with link and link text
13507 !! options
13508 comment
13509 !! input
13510 I like the [[Main Page|best pages]] a lot
13511 !! result
13512 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13513 !!end
13514
13515 !! test
13516 Edit comment with link and link text with suffix
13517 !! options
13518 comment
13519 !! input
13520 I like the [[Main Page|best page]]s a lot
13521 !! result
13522 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13523 !!end
13524
13525 !! test
13526 Edit comment with section link (non-local, eg in history list)
13527 !! options
13528 comment title=[[Main Page]]
13529 !! input
13530 /* External links */ removed bogus entries
13531 !! result
13532 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13533 !!end
13534
13535 !! test
13536 Edit comment with section link and text before it (non-local, eg in history list)
13537 !! options
13538 comment title=[[Main Page]]
13539 !! input
13540 pre-comment text /* External links */ removed bogus entries
13541 !! result
13542 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>
13543 !!end
13544
13545 !! test
13546 Edit comment with section link (local, eg in diff view)
13547 !! options
13548 comment local title=[[Main Page]]
13549 !! input
13550 /* External links */ removed bogus entries
13551 !! result
13552 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13553 !!end
13554
13555 !! test
13556 Edit comment with subpage link (bug 14080)
13557 !! options
13558 comment
13559 subpage
13560 title=[[Subpage test]]
13561 !! input
13562 Poked at a [[/subpage]] here...
13563 !! result
13564 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13565 !!end
13566
13567 !! test
13568 Edit comment with subpage link and link text (bug 14080)
13569 !! options
13570 comment
13571 subpage
13572 title=[[Subpage test]]
13573 !! input
13574 Poked at a [[/subpage|neat little page]] here...
13575 !! result
13576 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13577 !!end
13578
13579 !! test
13580 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13581 !! options
13582 comment
13583 title=[[Subpage test]]
13584 !! input
13585 Poked at a [[/subpage]] here...
13586 !! result
13587 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...
13588 !!end
13589
13590 !! test
13591 Edit comment with bare anchor link (local, as on diff)
13592 !! options
13593 comment
13594 local
13595 title=[[Main Page]]
13596 !!input
13597 [[#section]]
13598 !! result
13599 <a href="#section">#section</a>
13600 !! end
13601
13602 !! test
13603 Edit comment with bare anchor link (non-local, as on history)
13604 !! options
13605 comment
13606 title=[[Main Page]]
13607 !!input
13608 [[#section]]
13609 !! result
13610 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13611 !! end
13612
13613 !! test
13614 Anchor starting with underscore
13615 !!input
13616 [[#_ref|One]]
13617 !! result
13618 <p><a href="#_ref">One</a>
13619 </p>
13620 !! end
13621
13622 !! test
13623 Id starting with underscore
13624 !!input
13625 <div id="_ref"></div>
13626 !! result
13627 <div id="_ref"></div>
13628
13629 !! end
13630
13631 !! test
13632 Space normalisation on autocomment (bug 22784)
13633 !! options
13634 comment
13635 title=[[Main Page]]
13636 !!input
13637 /* __hello__world__ */
13638 !! result
13639 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13640 !! end
13641
13642 !! test
13643 percent-encoding and + signs in comments (Bug 26410)
13644 !! options
13645 comment
13646 !!input
13647 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13648 !! result
13649 <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>
13650 !! end
13651
13652 !! test
13653 Bad images - basic functionality
13654 !! options
13655 disabled
13656 !! input
13657 [[File:Bad.jpg]]
13658 !! result
13659 !! end
13660
13661 !! test
13662 Bad images - bug 16039: text after bad image disappears
13663 !! options
13664 disabled
13665 !! input
13666 Foo bar
13667 [[File:Bad.jpg]]
13668 Bar foo
13669 !! result
13670 <p>Foo bar
13671 </p><p>Bar foo
13672 </p>
13673 !! end
13674
13675 !! test
13676 Verify that displaytitle works (bug #22501) no displaytitle
13677 !! options
13678 showtitle
13679 !! config
13680 wgAllowDisplayTitle=true
13681 wgRestrictDisplayTitle=false
13682 !! input
13683 this is not the the title
13684 !! result
13685 Parser test
13686 <p>this is not the the title
13687 </p>
13688 !! end
13689
13690 !! test
13691 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13692 !! options
13693 showtitle
13694 title=[[Screen]]
13695 !! config
13696 wgAllowDisplayTitle=true
13697 wgRestrictDisplayTitle=false
13698 !! input
13699 this is not the the title
13700 {{DISPLAYTITLE:whatever}}
13701 !! result
13702 whatever
13703 <p>this is not the the title
13704 </p>
13705 !! end
13706
13707 !! test
13708 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
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:whatever}}
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) RestrictDisplayTitle=true matching
13726 !! options
13727 showtitle
13728 title=[[Screen]]
13729 !! config
13730 wgAllowDisplayTitle=true
13731 wgRestrictDisplayTitle=true
13732 !! input
13733 this is not the the title
13734 {{DISPLAYTITLE:screen}}
13735 !! result
13736 screen
13737 <p>this is not the the title
13738 </p>
13739 !! end
13740
13741 !! test
13742 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13743 !! options
13744 showtitle
13745 title=[[Screen]]
13746 !! config
13747 wgAllowDisplayTitle=false
13748 !! input
13749 this is not the the title
13750 {{DISPLAYTITLE:screen}}
13751 !! result
13752 Screen
13753 <p>this is not the the title
13754 <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>
13755 </p>
13756 !! end
13757
13758 !! test
13759 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13760 !! options
13761 showtitle
13762 title=[[Screen]]
13763 !! config
13764 wgAllowDisplayTitle=false
13765 !! input
13766 this is not the the title
13767 !! result
13768 Screen
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) - rejected 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="display: none;">s</span>creen}}
13784 !! result
13785 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13786 <p>this is not the the title
13787 </p>
13788 !! end
13789
13790 !! test
13791 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13792 !! options
13793 showtitle
13794 title=[[Screen]]
13795 !! config
13796 wgAllowDisplayTitle=true
13797 wgRestrictDisplayTitle=true
13798 !! input
13799 this is not the the title
13800 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13801 !! result
13802 <span style="color: red;">s</span>creen
13803 <p>this is not the the title
13804 </p>
13805 !! end
13806
13807 !! test
13808 preload: check <noinclude> and <includeonly>
13809 !! options
13810 preload
13811 !! input
13812 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13813 !! result
13814 Hello kind world.
13815 !! end
13816
13817 !! test
13818 preload: check <onlyinclude>
13819 !! options
13820 preload
13821 !! input
13822 Goodbye <onlyinclude>Hello world</onlyinclude>
13823 !! result
13824 Hello world
13825 !! end
13826
13827 !! test
13828 preload: can pass tags through if we want to
13829 !! options
13830 preload
13831 !! input
13832 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13833 !! result
13834 <includeonly>Hello world</includeonly>
13835 !! end
13836
13837 !! test
13838 preload: check that it doesn't try to do tricks
13839 !! options
13840 preload
13841 !! input
13842 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13843 !! result
13844 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13845 !! end
13846
13847 !! test
13848 Play a bit with r67090 and bug 3158
13849 !! options
13850 disabled
13851 !! input
13852 <div style="width:50% !important">&nbsp;</div>
13853 <div style="width:50%&nbsp;!important">&nbsp;</div>
13854 <div style="width:50%&#160;!important">&nbsp;</div>
13855 <div style="border : solid;">&nbsp;</div>
13856 !! result
13857 <div style="width:50% !important">&nbsp;</div>
13858 <div style="width:50% !important">&nbsp;</div>
13859 <div style="width:50% !important">&nbsp;</div>
13860 <div style="border&#160;: solid;">&nbsp;</div>
13861
13862 !! end
13863
13864 !! test
13865 HTML5 data attributes
13866 !! input
13867 <span data-foo="bar">Baz</span>
13868 <p data-abc-def_hij="">Quuz</p>
13869 !! result
13870 <p><span data-foo="bar">Baz</span>
13871 </p>
13872 <p data-abc-def_hij="">Quuz</p>
13873
13874 !! end
13875
13876 !! test
13877 percent-encoding and + signs in internal links (Bug 26410)
13878 !! input
13879 [[User:+%]] [[Page+title%]]
13880 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13881 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13882 [[%33%45]] [[%33%45+]]
13883 !! result
13884 <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>
13885 <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>
13886 <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>
13887 <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>
13888 </p>
13889 !! end
13890
13891 !! test
13892 Special characters in embedded file links (bug 27679)
13893 !! input
13894 [[File:Contains & ampersand.jpg]]
13895 [[File:Does not exist.jpg|Title with & ampersand]]
13896 !! result
13897 <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>
13898 <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>
13899 </p>
13900 !! end
13901
13902
13903 !! test
13904 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13905 !! input
13906 Text&apos;s been normalized?
13907 !! result
13908 <p>Text&#39;s been normalized?
13909 </p>
13910 !! end
13911
13912 !! test
13913 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13914 !! input
13915 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13916 !! result
13917 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13918 </p>
13919 !! end
13920
13921 !! test
13922 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13923 !! input
13924 [http://www.example.org/ ideograms]
13925 !! result
13926 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13927 </p>
13928 !! end
13929
13930 !! test
13931 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13932 !! input
13933 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13934 !! result
13935 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13936 </p>
13937 !! end
13938
13939 !! article
13940 Mediawiki:loop1
13941 !! text
13942 {{Identical|A}}
13943 !! endarticle
13944
13945 !! article
13946 Mediawiki:loop2
13947 !! text
13948 {{Identical|B}}
13949 !! endarticle
13950
13951 !! article
13952 Template:Identical
13953 !! text
13954 {{int:loop1}}
13955 {{int:loop2}}
13956 !! endarticle
13957
13958 !! test
13959 Bug 31098 Template which includes system messages which includes the template
13960 !! input
13961 {{Identical}}
13962 !! result
13963 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13964 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13965 </p>
13966 !! end
13967
13968 !! test
13969 Bug31490 Turkish: ucfirst 'blah'
13970 !! options
13971 language=tr
13972 !! input
13973 {{ucfirst:blah}}
13974 !! result
13975 <p>Blah
13976 </p>
13977 !! end
13978
13979 !! test
13980 Bug31490 Turkish: ucfirst 'ix'
13981 !! options
13982 language=tr
13983 !! input
13984 {{ucfirst:ix}}
13985 !! result
13986 <p>İx
13987 </p>
13988 !! end
13989
13990 !! test
13991 Bug31490 Turkish: lcfirst 'BLAH'
13992 !! options
13993 language=tr
13994 !! input
13995 {{lcfirst:BLAH}}
13996 !! result
13997 <p>bLAH
13998 </p>
13999 !! end
14000
14001 !! test
14002 Bug31490 Turkish: ucfırst (with a dotless i)
14003 !! options
14004 language=tr
14005 !! input
14006 {{ucfırst:blah}}
14007 !! result
14008 <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>
14009 </p>
14010 !! end
14011
14012 !! test
14013 Bug31490 ucfırst (with a dotless i) with English language
14014 !! options
14015 language=en
14016 !! input
14017 {{ucfırst:blah}}
14018 !! result
14019 <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>
14020 </p>
14021 !! end
14022
14023 !! test
14024 Bug 26375: TOC with italics
14025 !! options
14026 title=[[Main Page]]
14027 !! input
14028 __TOC__
14029 == ''Lost'' episodes ==
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="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
14034 </ul>
14035 </div>
14036 <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>
14037
14038 !! end
14039
14040 !! test
14041 Bug 26375: TOC with bold
14042 !! options
14043 title=[[Main Page]]
14044 !! input
14045 __TOC__
14046 == '''should be bold''' then normal text ==
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="#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>
14051 </ul>
14052 </div>
14053 <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>
14054
14055 !! end
14056
14057 !! test
14058 Bug 33845: Headings become cursive in TOC when they contain an image
14059 !! options
14060 title=[[Main Page]]
14061 !! input
14062 __TOC__
14063 == Image [[Image:foobar.jpg]] ==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14068 </ul>
14069 </div>
14070 <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>
14071
14072 !! end
14073
14074 !! test
14075 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14076 !! options
14077 title=[[Main Page]]
14078 !! input
14079 __TOC__
14080 == <blockquote>Quote</blockquote> ==
14081 !! result
14082 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14083 <ul>
14084 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14085 </ul>
14086 </div>
14087 <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>
14088
14089 !! end
14090
14091 !! test
14092 Unclosed tags in TOC
14093 !! options
14094 title=[[Main Page]]
14095 !! input
14096 __TOC__
14097 == Proof: 2 < 3 ==
14098 <small>Hanc marginis exiguitas non caperet.</small>
14099 QED
14100 !! result
14101 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14102 <ul>
14103 <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>
14104 </ul>
14105 </div>
14106 <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>
14107 <p><small>Hanc marginis exiguitas non caperet.</small>
14108 QED
14109 </p>
14110 !! end
14111
14112 !! test
14113 Multiple tags in TOC
14114 !! input
14115 __TOC__
14116 == <i>Foo</i> <b>Bar</b> ==
14117
14118 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14119 !! result
14120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14121 <ul>
14122 <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>
14123 <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>
14124 </ul>
14125 </div>
14126 <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>
14127 <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>
14128
14129 !! end
14130
14131 !! test
14132 Tags with parameters in TOC
14133 !! input
14134 __TOC__
14135 == <sup class="in-h2">Hello</sup> ==
14136
14137 == <sup class="a > b">Evilbye</sup> ==
14138 !! result
14139 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14140 <ul>
14141 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14142 <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>
14143 </ul>
14144 </div>
14145 <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>
14146 <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>
14147
14148 !! end
14149
14150 !! test
14151 span tags with directionality in TOC
14152 !! input
14153 __TOC__
14154 == <span dir="ltr">C++</span> ==
14155
14156 == <span dir="rtl">זבנג!</span> ==
14157
14158 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14159
14160 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14161
14162 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14163 !! result
14164 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14165 <ul>
14166 <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>
14167 <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>
14168 <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>
14169 <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>
14170 <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>
14171 </ul>
14172 </div>
14173 <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>
14174 <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>
14175 <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>
14176 <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>
14177 <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>
14178
14179 !! end
14180
14181 !! article
14182 MediaWiki:Bug32057
14183 !! text
14184 == {{int:headline_sample}} ==
14185 !! endarticle
14186
14187 !! test
14188 Bug 32057: Title needed when expanding <h> nodes.
14189 !! options
14190 title=[[Main Page]]
14191 !! input
14192 {{int:Bug32057}}
14193 !! result
14194 <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>
14195
14196 !! end
14197
14198 !! test
14199 Strip marker in urlencode
14200 !! input
14201 {{urlencode:x<nowiki/>y}}
14202 {{urlencode:x<nowiki/>y|wiki}}
14203 {{urlencode:x<nowiki/>y|path}}
14204 !! result
14205 <p>xy
14206 xy
14207 xy
14208 </p>
14209 !! end
14210
14211 !! test
14212 Strip marker in lc
14213 !! input
14214 {{lc:x<nowiki/>y}}
14215 !! result
14216 <p>xy
14217 </p>
14218 !! end
14219
14220 !! test
14221 Strip marker in uc
14222 !! input
14223 {{uc:x<nowiki/>y}}
14224 !! result
14225 <p>XY
14226 </p>
14227 !! end
14228
14229 !! test
14230 Strip marker in formatNum
14231 !! input
14232 {{formatnum:1<nowiki/>2}}
14233 {{formatnum:1<nowiki/>2|R}}
14234 !! result
14235 <p>12
14236 12
14237 </p>
14238 !! end
14239
14240 !! test
14241 Check noCommafy in formatNum
14242 !! options
14243 language=be-tarask
14244 !! input
14245 {{formatnum:123456.78}}
14246 {{formatnum:123456.78|NOSEP}}
14247 !! result
14248 <p>123 456,78
14249 123456.78
14250 </p>
14251 !! end
14252
14253 !! test
14254 Strip marker in grammar
14255 !! options
14256 language=fi
14257 !! input
14258 {{grammar:elative|foo<nowiki/>bar}}
14259 !! result
14260 <p>foobarista
14261 </p>
14262 !! end
14263
14264 !! test
14265 Strip marker in padleft
14266 !! input
14267 {{padleft:|2|x<nowiki/>y}}
14268 !! result
14269 <p>xy
14270 </p>
14271 !! end
14272
14273 !! test
14274 Strip marker in padright
14275 !! input
14276 {{padright:|2|x<nowiki/>y}}
14277 !! result
14278 <p>xy
14279 </p>
14280 !! end
14281
14282 !! test
14283 Strip marker in anchorencode
14284 !! input
14285 {{anchorencode:x<nowiki/>y}}
14286 !! result
14287 <p>xy
14288 </p>
14289 !! end
14290
14291 !! test
14292 nowiki inside link inside heading (bug 18295)
14293 !! input
14294 ==[[foo|x<nowiki>y</nowiki>z]]==
14295 !! result
14296 <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>
14297
14298 !! end
14299
14300 !! test
14301 new support for bdi element (bug 31817)
14302 !! input
14303 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14304 !! result
14305 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14306
14307 !!end
14308
14309 !! test
14310 Ignore pipe between table row attributes
14311 !! input
14312 {|
14313 | quux
14314 |- id=foo | style='color: red'
14315 | bar
14316 |}
14317 !! result
14318 <table>
14319 <tr>
14320 <td> quux
14321 </td></tr>
14322 <tr id="foo" style="color: red">
14323 <td> bar
14324 </td></tr></table>
14325
14326 !! end
14327
14328 !!test
14329 Gallery override link with WikiLink (bug 34852)
14330 !! input
14331 <gallery>
14332 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14333 </gallery>
14334 !! result
14335 <ul class="gallery">
14336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14337 <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>
14338 <div class="gallerytext">
14339 <p>caption
14340 </p>
14341 </div>
14342 </div></li>
14343 </ul>
14344
14345 !! end
14346
14347 !!test
14348 Gallery override link with absolute external link (bug 34852)
14349 !! input
14350 <gallery>
14351 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14352 </gallery>
14353 !! result
14354 <ul class="gallery">
14355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14356 <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>
14357 <div class="gallerytext">
14358 <p>caption
14359 </p>
14360 </div>
14361 </div></li>
14362 </ul>
14363
14364 !! end
14365
14366 !!test
14367 Gallery override link with malicious javascript (bug 34852)
14368 !! input
14369 <gallery>
14370 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14371 </gallery>
14372 !! result
14373 <ul class="gallery">
14374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14375 <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>
14376 <div class="gallerytext">
14377 <p>caption
14378 </p>
14379 </div>
14380 </div></li>
14381 </ul>
14382
14383 !! end
14384
14385 !!test
14386 Gallery with invalid title as link (bug 43964)
14387 !! input
14388 <gallery>
14389 File:foobar.jpg|link=<
14390 </gallery>
14391 !! result
14392 <ul class="gallery">
14393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14394 <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>
14395 <div class="gallerytext">
14396 </div>
14397 </div></li>
14398 </ul>
14399
14400 !! end
14401
14402 !!test
14403 Language parser function
14404 !! input
14405 {{#language:ar}}
14406 !! result
14407 <p>العربية
14408 </p>
14409 !! end
14410
14411 !!test
14412 Padleft and padright as substr
14413 !! input
14414 {{padleft:|3|abcde}}
14415 {{padright:|3|abcde}}
14416 !! result
14417 <p>abc
14418 abc
14419 </p>
14420 !! end
14421
14422 !!test
14423 Special parser function
14424 !! input
14425 {{#special:RandomPage}}
14426 {{#special:BaDtItLe}}
14427 {{#special:Foobar}}
14428 !! result
14429 <p>Special:Random
14430 Special:Badtitle
14431 Special:Foobar
14432 </p>
14433 !! end
14434
14435 !!test
14436 Bug 34939 - Case insensitive link parsing ([HttP://])
14437 !! input
14438 [HttP://MediaWiki.Org/]
14439 !! result
14440 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14441 </p>
14442 !! end
14443
14444 !!test
14445 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14446 !! input
14447 [HttP://MediaWiki.Org/ MediaWiki]
14448 !! result
14449 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14450 </p>
14451 !! end
14452
14453 !!test
14454 Bug 34939 - Case insensitive link parsing (HttP://)
14455 !! input
14456 HttP://MediaWiki.Org/
14457 !! result
14458 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14459 </p>
14460 !! end
14461
14462
14463 ###
14464 ### Parsoids-specific tests
14465 ### Parsoid-PHP parser incompatibilities
14466 ###
14467 !!test
14468 1. SOL-sensitive wikitext tokens as template-args
14469 !!options
14470 parsoid=wt2html,wt2wt
14471 !!input
14472 {{echo|*a}}
14473 {{echo|#a}}
14474 {{echo|:a}}
14475 !!result
14476 <span about="#mwt1" typeof="mw:Transclusion">
14477 </span><ul about="#mwt1"><li>a</li></ul>
14478 <span about="#mwt2" typeof="mw:Transclusion">
14479 </span><ol about="#mwt2"><li>a</li></ol>
14480 <span about="#mwt3" typeof="mw:Transclusion">
14481 </span><dl about="#mwt3"><dd>a</dd></dl>
14482 !!end
14483
14484 #### ----------------------------------------------------------------
14485 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14486 #### tags. Parsoid's output for these tags differs from that of the
14487 #### PHP parser.
14488 #### ----------------------------------------------------------------
14489
14490 !!test
14491 Ref: 1. ref-location should be replaced with an index span
14492 !!options
14493 parsoid
14494 !!input
14495 A <ref>foo</ref>
14496 B <ref name="x">foo</ref>
14497 C <ref name="y" />
14498 !!result
14499 <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>
14500 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>
14501 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>
14502 !!end
14503
14504 !!test
14505 Ref: 2. ref-tags with identical names should all get the same index
14506 !!options
14507 parsoid
14508 !!input
14509 A <ref name="x">foo</ref>
14510 B <ref name="x" />
14511 !!result
14512 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14513 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14514 !!end
14515
14516 !!test
14517 Ref: 3. spaces in ref-names should be ignored
14518 !!options
14519 parsoid
14520 !!input
14521 A <ref name="x">foo</ref>
14522 B <ref name=" x " />
14523 C <ref name= x />
14524 !!result
14525 <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>
14526 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>
14527 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>
14528 !!end
14529
14530 !!test
14531 Ref: 4. 'constructor' should be accepted as a valid ref-name
14532 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14533 !!options
14534 parsoid
14535 !!input
14536 A <ref name="constructor">foo</ref>
14537 !!result
14538 <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>
14539 !!end
14540
14541 !!test
14542 Ref: 5. body should accept generic wikitext
14543 !!options
14544 parsoid
14545 !!input
14546 A <ref>
14547 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14548 </ref>
14549
14550 <references />
14551 !!result
14552 <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>
14553
14554 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14555 <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>
14556 </li></ol>
14557 !!end
14558
14559 !!test
14560 Ref: 6. indent-pres should not be output in ref-body
14561 !!options
14562 parsoid
14563 !!input
14564 A <ref>
14565 foo
14566 bar
14567 baz
14568 </ref>
14569
14570 <references />
14571 !!result
14572 <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>
14573
14574 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14575 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14576 bar
14577 baz
14578 </li></ol>
14579 !!end
14580
14581 !!test
14582 Ref: 6. No p-wrapping in ref-body
14583 !!options
14584 parsoid
14585 !!input
14586 A <ref>
14587 foo
14588
14589 bar
14590
14591
14592 baz
14593
14594
14595
14596 booz
14597 </ref>
14598
14599 <references />
14600 !!result
14601 <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>
14602
14603 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14604 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14605
14606 bar
14607
14608
14609 baz
14610
14611
14612
14613 booz
14614 </li></ol>
14615 !!end
14616
14617 !!test
14618 Ref: 8. transclusion wikitext has lower precedence
14619 !!options
14620 parsoid
14621 !!input
14622 A <ref> foo {{echo|</ref> B C}}
14623
14624 <references />
14625 !!result
14626 <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>
14627
14628 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14629 <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>
14630 !!end
14631
14632 !!test
14633 Ref: 9. unclosed comments should not leak out of ref-body
14634 !!options
14635 parsoid
14636 !!input
14637 A <ref> foo <!--</ref> B C
14638
14639 <references />
14640 !!result
14641 <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>
14642
14643 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14644 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14645 !!end
14646
14647 !!test
14648 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14649 !!options
14650 parsoid
14651 !!input
14652 A <ref> <b> foo </ref> B C
14653
14654 <references />
14655 !!result
14656 <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>
14657
14658 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14659 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
14660 !!end
14661
14662 !!test
14663 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14664 !!options
14665 parsoid
14666 !!input
14667 A <ref>foo</ref> B
14668 C <ref>bar</ref> D
14669 !!result
14670 <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
14671 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>
14672 !!end
14673
14674 !!test
14675 Ref: 12. ref-tags act as trailing newline migration barrier
14676 !!options
14677 parsoid
14678 !!input
14679 <!--the newline at the end of this line moves out of the p-tag-->a
14680
14681 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14682 <ref />
14683
14684 c
14685 !!result
14686 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14687
14688
14689 <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>
14690 <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>
14691
14692
14693 <p>c</p>
14694 !!end
14695
14696 !!test
14697 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14698 !!options
14699 parsoid
14700 !!input
14701 <ref>foo</ref> A
14702 <ref>bar
14703 </ref> B
14704 !!result
14705 <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
14706 <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>
14707 !!end
14708
14709 !!test
14710 Ref: 14. A nested ref-tag should be emitted as plain text
14711 !!options
14712 parsoid
14713 !!input
14714 <ref>foo <ref>bar</ref> baz</ref>
14715
14716 <references />
14717 !!result
14718 <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>
14719
14720 <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>
14721 !!end
14722
14723 !!test
14724 Ref: 15. ref-tags with identical names should get identical indexes
14725 !!options
14726 parsoid
14727 !!input
14728 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14729 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14730
14731 <references />
14732 !!result
14733 <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>
14734 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>
14735
14736 <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>
14737 !!end
14738
14739 !!test
14740 References: 1. references tag without any refs should be handled properly
14741 !!options
14742 parsoid
14743 !!input
14744 <references />
14745 !!result
14746 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14747 !!end
14748
14749 !!test
14750 References: 2. references tag with group only outputs references from that group
14751 !!options
14752 parsoid
14753 !!input
14754 A <ref group="a">foo</ref>
14755 B <ref group="b">bar</ref>
14756
14757 <references group='a' />
14758 !!result
14759 <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>
14760 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>
14761
14762 <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>
14763 !!end
14764
14765 !!test
14766 References: 3. ref list should be cleared after processing references
14767 !!options
14768 parsoid
14769 !!input
14770 A <ref>foo</ref>
14771
14772 <references />
14773
14774 B <ref>bar</ref>
14775
14776 <references />
14777 !!result
14778 <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>
14779
14780 <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>
14781
14782 <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>
14783
14784 <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>
14785 !!end
14786
14787 !!test
14788 References: 4. only referenced group should be cleared after processing references
14789 !!options
14790 parsoid
14791 !!input
14792 A <ref group="a">afoo</ref>
14793 B <ref>bfoo</ref>
14794
14795 <references group="a"/>
14796
14797 C <ref>cfoo</ref>
14798
14799 <references />
14800 !!result
14801 <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>
14802 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>
14803
14804 <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>
14805
14806 <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>
14807
14808 <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>
14809 !!end
14810
14811 !!test
14812 References: 5. ref tags in references should be processed while ignoring all other content
14813 !!options
14814 parsoid
14815 !!input
14816 A <ref name="a" />
14817 B <ref name="b">bar</ref>
14818
14819 <references>
14820 <ref name="a">foo</ref>
14821 This should just get lost.
14822 </references>
14823 !!result
14824 <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>
14825 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>
14826
14827 <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>
14828 !!end
14829
14830 !!test
14831 References: 6. <references /> from a transclusion
14832 !!options
14833 parsoid
14834 !!input
14835 {{echo|<references />}}
14836 !!result
14837 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14838 !!end
14839
14840 #### ----------------------------------------------------------------
14841 #### The following section of tests are primarily to test
14842 #### wikitext escaping capabilities of Parsoid. Given that
14843 #### escaping can be done any number of ways, the wikitext (input)
14844 #### is always adjusted to reflect how Parsoid adds nowiki
14845 #### escape tags.
14846 ####
14847 #### We are marking several tests as parsoid-only since the
14848 #### HTML in the result section is different from what the
14849 #### PHP parser generates for it.
14850 #### ----------------------------------------------------------------
14851
14852
14853 #### --------------- Headings ---------------
14854 #### 0. Unnested
14855 #### 1. Nested inside html <h1>=foo=</h1>
14856 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14857 #### 3. Nested inside html with wikitext split by html tags
14858 #### 4. No escape needed
14859 #### 5. Empty headings <h1></h1>
14860 #### 6. Heading chars in SOL context
14861 #### ----------------------------------------
14862 !! test
14863 Headings: 0. Unnested
14864 !! options
14865 parsoid
14866 !! input
14867 <nowiki>=foo=</nowiki>
14868
14869 <nowiki> =foo= </nowiki>
14870 <!--cmt-->
14871 <nowiki>=foo=</nowiki>
14872
14873 =foo''a''<nowiki>=</nowiki>
14874 !! result
14875 <p><span typeof="mw:Nowiki">=foo=</span></p>
14876
14877 <p><span typeof="mw:Nowiki"> =foo= </span>
14878 <!--cmt-->
14879 <span typeof="mw:Nowiki">=foo=</span></p>
14880
14881 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14882 !!end
14883
14884 !! test
14885 Headings: 1. Nested inside html
14886 !! options
14887 parsoid
14888 !! input
14889 =<nowiki>=foo=</nowiki>=
14890
14891 ==<nowiki>=foo=</nowiki>==
14892
14893 ===<nowiki>=foo=</nowiki>===
14894
14895 ====<nowiki>=foo=</nowiki>====
14896
14897 =====<nowiki>=foo=</nowiki>=====
14898
14899 ======<nowiki>=foo=</nowiki>======
14900 !! result
14901 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14902 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14903 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14904 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14905 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14906 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14907 !!end
14908
14909 !! test
14910 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14911 !! options
14912 parsoid
14913 !! input
14914 =foo=
14915 <nowiki>*bar</nowiki>
14916
14917 =foo=
14918 =bar
14919
14920 =foo=
14921 <nowiki>=bar=</nowiki>
14922 !! result
14923 <h1>foo</h1>*bar
14924 <h1>foo</h1>=bar
14925 <h1>foo</h1>=bar=
14926 !!end
14927
14928 !! test
14929 Headings: 3. Nested inside html with wikitext split by html tags
14930 !! options
14931 parsoid
14932 !! input
14933 =='''bold'''<nowiki>foo=</nowiki>=
14934 !! result
14935 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14936 !!end
14937
14938 !! test
14939 Headings: 4a. No escaping needed (testing just h1 and h2)
14940 !! options
14941 parsoid
14942 !! input
14943 ==foo=
14944
14945 =foo==
14946
14947 = =foo= =
14948
14949 ==foo= bar=
14950
14951 ===foo==
14952
14953 ==foo===
14954
14955 =''=''foo==
14956
14957 =<nowiki>=</nowiki>=
14958 !! result
14959 <h1>=foo</h1>
14960 <h1>foo=</h1>
14961 <h1> =foo= </h1>
14962 <h1>=foo= bar</h1>
14963 <h2>=foo</h2>
14964 <h2>foo=</h2>
14965 <h1><i>=</i>foo=</h1>
14966 <h1><span typeof="mw:Nowiki">=</span></h1>
14967 !!end
14968
14969 !! test
14970 Headings: 4b. No escaping needed (inside p-tags)
14971 !! options
14972 parsoid
14973 !! input
14974 ===
14975 =foo= x
14976 =foo= <s></s>
14977 !! result
14978 <p>===
14979 =foo= x
14980 =foo= <s></s>
14981 </p>
14982 !!end
14983
14984 !! test
14985 Headings: 5. Empty headings
14986 !! options
14987 parsoid
14988 !! input
14989 =<nowiki/>=
14990
14991 ==<nowiki/>==
14992
14993 ===<nowiki/>===
14994
14995 ====<nowiki/>====
14996
14997 =====<nowiki/>=====
14998
14999 ======<nowiki/>======
15000 !! result
15001 <h1></h1>
15002 <h2></h2>
15003 <h3></h3>
15004 <h4></h4>
15005 <h5></h5>
15006 <h6></h6>
15007 !!end
15008
15009 !! test
15010 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15011 !! options
15012 parsoid
15013 !! input
15014 <nowiki>=a=</nowiki>
15015
15016 <nowiki>=a= </nowiki>
15017
15018 <nowiki>=a= </nowiki>
15019
15020 <nowiki>=a= </nowiki>
15021 !! result
15022 <p>=a=</p>
15023 <p>=a= </p>
15024 <p>=a= </p>
15025 <p>=a= </p>
15026 !!end
15027
15028 !! test
15029 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15030 !! options
15031 parsoid
15032 !! input
15033 <nowiki>=a=
15034 b</nowiki>
15035
15036 <nowiki>=a=
15037 b</nowiki>
15038
15039 <nowiki>=a=
15040 b</nowiki>
15041
15042 <nowiki>=a=
15043 b</nowiki>
15044 !! result
15045 <p>=a=
15046 b</p>
15047 <p>=a=
15048 b</p>
15049 <p>=a=
15050 b</p>
15051 <p>=a=
15052 b</p>
15053 </p>
15054 !!end
15055
15056 !! test
15057 Headings: 6c. Heading chars in SOL context (leading newline break)
15058 !! options
15059 parsoid
15060 !! input
15061 <nowiki>a
15062 =b=</nowiki>
15063 !! result
15064 <p>a
15065 =b=</p>
15066 !!end
15067
15068 !! test
15069 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15070 !! options
15071 parsoid
15072 !! input
15073 <!--c0--><nowiki>=a=</nowiki>
15074 <!--c1-->
15075 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15076 !! result
15077 <p><!--c0-->=a=</p>
15078 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15079 !!end
15080
15081 !! test
15082 Headings: 6d. Heading chars in SOL context (No escaping needed)
15083 !! options
15084 parsoid=html2wt
15085 !! input
15086 =a=<div>b</div>
15087 !! result
15088 =a=<div>b</div>
15089 !!end
15090
15091 #### --------------- Lists ---------------
15092 #### 0. Outside nests (*foo, etc.)
15093 #### 1. Nested inside html <ul><li>*foo</li></ul>
15094 #### 2. Inside definition lists
15095 #### 3. Only bullets at start should be escaped
15096 #### 4. No escapes needed
15097 #### 5. No unnecessary escapes
15098 #### 6. Escape bullets in SOL position
15099 #### 7. Escape bullets in a multi-line context
15100 #### ----------------------------------------
15101
15102 !! test
15103 Lists: 0. Outside nests
15104 !! input
15105 <nowiki>*foo</nowiki>
15106
15107 <nowiki>#foo</nowiki>
15108 !! result
15109 <p>*foo
15110 </p><p>#foo
15111 </p>
15112 !!end
15113
15114 !! test
15115 Lists: 1. Nested inside html
15116 !! input
15117 *<nowiki>*foo</nowiki>
15118
15119 *<nowiki>#foo</nowiki>
15120
15121 *<nowiki>:foo</nowiki>
15122
15123 *<nowiki>;foo</nowiki>
15124
15125 #<nowiki>*foo</nowiki>
15126
15127 #<nowiki>#foo</nowiki>
15128
15129 #<nowiki>:foo</nowiki>
15130
15131 #<nowiki>;foo</nowiki>
15132 !! result
15133 <ul><li>*foo
15134 </li></ul>
15135 <ul><li>#foo
15136 </li></ul>
15137 <ul><li>:foo
15138 </li></ul>
15139 <ul><li>;foo
15140 </li></ul>
15141 <ol><li>*foo
15142 </li></ol>
15143 <ol><li>#foo
15144 </li></ol>
15145 <ol><li>:foo
15146 </li></ol>
15147 <ol><li>;foo
15148 </li></ol>
15149
15150 !!end
15151
15152 !! test
15153 Lists: 2. Inside definition lists
15154 !! input
15155 ;<nowiki>;foo</nowiki>
15156
15157 ;<nowiki>:foo</nowiki>
15158
15159 ;<nowiki>:foo</nowiki>
15160 :bar
15161
15162 :<nowiki>:foo</nowiki>
15163 !! result
15164 <dl><dt>;foo
15165 </dt></dl>
15166 <dl><dt>:foo
15167 </dt></dl>
15168 <dl><dt>:foo
15169 </dt><dd>bar
15170 </dd></dl>
15171 <dl><dd>:foo
15172 </dd></dl>
15173
15174 !!end
15175
15176 !! test
15177 Lists: 3. Only bullets at start of text should be escaped
15178 !! input
15179 *<nowiki>*foo*bar</nowiki>
15180
15181 *<nowiki>*foo</nowiki>''it''*bar
15182 !! result
15183 <ul><li>*foo*bar
15184 </li></ul>
15185 <ul><li>*foo<i>it</i>*bar
15186 </li></ul>
15187
15188 !!end
15189
15190 !! test
15191 Lists: 4. No escapes needed
15192 !! options
15193 parsoid
15194 !! input
15195 *foo*bar
15196
15197 *''foo''*bar
15198
15199 *[[Foo]]: bar
15200 !! result
15201 <ul><li>foo*bar
15202 </li></ul>
15203 <ul><li><i>foo</i>*bar
15204 </li></ul>
15205 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15206 </li></ul>
15207 !!end
15208
15209 !! test
15210 Lists: 5. No unnecessary escapes
15211 !! input
15212 * bar <span><nowiki>[[foo]]</nowiki></span>
15213
15214 *=bar <span><nowiki>[[foo]]</nowiki></span>
15215
15216 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15217
15218 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15219
15220 *=bar <span>foo]]</span>=
15221
15222 * <s></s>: a
15223 !! result
15224 <ul><li> bar <span>[[foo]]</span>
15225 </li></ul>
15226 <ul><li>=bar <span>[[foo]]</span>
15227 </li></ul>
15228 <ul><li>[[bar <span>[[foo]]</span>
15229 </li></ul>
15230 <ul><li>]]bar <span>[[foo]]</span>
15231 </li></ul>
15232 <ul><li>=bar <span>foo]]</span>=
15233 </li></ul>
15234 <ul><li> <s></s>: a
15235 </li></ul>
15236
15237 !!end
15238
15239 !! test
15240 Lists: 6. Escape bullets in SOL position
15241 !! options
15242 parsoid
15243 !! input
15244 <!--cmt--><nowiki>*foo</nowiki>
15245 !! result
15246 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15247 !!end
15248
15249 !! test
15250 Lists: 7. Escape bullets in a multi-line context
15251 !! input
15252 <nowiki>a
15253 *b</nowiki>
15254 !! result
15255 <p>a
15256 *b
15257 </p>
15258 !!end
15259
15260 #### --------------- HRs ---------------
15261 #### 1. Single line
15262 #### -----------------------------------
15263
15264 !! test
15265 HRs: 1. Single line
15266 !! options
15267 parsoid
15268 !! input
15269 ----<nowiki>----</nowiki>
15270 ----=foo=
15271 ----*foo
15272 !! result
15273 <hr><span typeof="mw:Nowiki">----</span>
15274 <hr>=foo=
15275 <hr>*foo
15276 !! end
15277
15278 #### --------------- Tables ---------------
15279 #### 1a. Simple example
15280 #### 1b. No escaping needed (!foo)
15281 #### 1c. No escaping needed (|foo)
15282 #### 1d. No escaping needed (|}foo)
15283 ####
15284 #### 2a. Nested in td (<td>foo|bar</td>)
15285 #### 2b. Nested in td (<td>foo||bar</td>)
15286 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15287 ####
15288 #### 3a. Nested in th (<th>foo!bar</th>)
15289 #### 3b. Nested in th (<th>foo!!bar</th>)
15290 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15291 ####
15292 #### 4a. Escape -
15293 #### 4b. Escape +
15294 #### 4c. No escaping needed
15295 #### --------------------------------------
15296
15297 !! test
15298 Tables: 1a. Simple example
15299 !! input
15300 <nowiki>{|
15301 |}</nowiki>
15302 !! result
15303 <p>{|
15304 |}
15305 </p>
15306 !! end
15307
15308 !! test
15309 Tables: 1b. No escaping needed
15310 !! input
15311 !foo
15312 !! result
15313 <p>!foo
15314 </p>
15315 !! end
15316
15317 !! test
15318 Tables: 1c. No escaping needed
15319 !! input
15320 |foo
15321 !! result
15322 <p>|foo
15323 </p>
15324 !! end
15325
15326 !! test
15327 Tables: 1d. No escaping needed
15328 !! input
15329 |}foo
15330 !! result
15331 <p>|}foo
15332 </p>
15333 !! end
15334
15335 !! test
15336 Tables: 2a. Nested in td
15337 !! options
15338 parsoid
15339 !! input
15340 {|
15341 |<nowiki>foo|bar</nowiki>
15342 |}
15343 !! result
15344 <table><tbody><tr>
15345 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15346 !! end
15347
15348 !! test
15349 Tables: 2b. Nested in td
15350 !! options
15351 parsoid
15352 !! input
15353 {|
15354 |<nowiki>foo||bar</nowiki>
15355 |''it''<nowiki>foo||bar</nowiki>
15356 |}
15357 !! result
15358 <table><tbody><tr>
15359 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15360 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15361 !! end
15362
15363 !! test
15364 Tables: 2c. Nested in td -- no escaping needed
15365 !! options
15366 parsoid
15367 !! input
15368 {|
15369 |foo!!bar
15370 |}
15371 !! result
15372 <table><tbody><tr><td>foo!!bar
15373 </td></tr></tbody></table>
15374
15375 !! end
15376
15377 !! test
15378 Tables: 3a. Nested in th
15379 !! options
15380 parsoid
15381 !! input
15382 {|
15383 !foo!bar
15384 |}
15385 !! result
15386 <table><tbody><tr><th>foo!bar
15387 </th></tr></tbody></table>
15388
15389 !! end
15390
15391 !! test
15392 Tables: 3b. Nested in th
15393 !! options
15394 parsoid
15395 !! input
15396 {|
15397 !<nowiki>foo!!bar</nowiki>
15398 |}
15399 !! result
15400 <table>
15401 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15402 </tbody></table>
15403 !! end
15404
15405 !! test
15406 Tables: 3c. Nested in th -- no escaping needed
15407 !! options
15408 parsoid
15409 !! input
15410 {|
15411 !<nowiki>foo||bar</nowiki>
15412 |}
15413 !! result
15414 <table><tbody><tr>
15415 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15416 !! end
15417
15418 !! test
15419 Tables: 4a. Escape -
15420 !! options
15421 parsoid
15422 !! input
15423 {|
15424 |-
15425 !-bar
15426 |-
15427 |<nowiki>-bar</nowiki>
15428 |}
15429 !! result
15430 <table><tbody>
15431 <tr><th>-bar</th></tr>
15432 <tr>
15433 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15434 !! end
15435
15436 !! test
15437 Tables: 4b. Escape +
15438 !! options
15439 parsoid
15440 !! input
15441 {|
15442 |-
15443 !+bar
15444 |-
15445 |<nowiki>+bar</nowiki>
15446 |}
15447 !! result
15448 <table><tbody>
15449 <tr><th>+bar</th></tr>
15450 <tr>
15451 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15452 !! end
15453
15454 !! test
15455 Tables: 4c. No escaping needed
15456 !! options
15457 parsoid
15458 !! input
15459 {|
15460 |-
15461 |foo-bar
15462 |foo+bar
15463 |-
15464 |''foo''-bar
15465 |''foo''+bar
15466 |}
15467 !! result
15468 <table><tbody>
15469 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15470 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15471 </tbody></table>
15472 !! end
15473
15474 ### SSS FIXME: Disabled right now because accurate html2wt
15475 ### on this snippet requires data-parsoid flags that we've
15476 ### stripped out of these tests. We should scheme how we
15477 ### we want to handle these kind of tests that require
15478 ### data-parsoid flags for accurate html2wt serialization
15479
15480 !! test
15481 Tables: 4d. No escaping needed
15482 !! options
15483 disabled
15484 !! input
15485 {|
15486 ||+1
15487 ||-2
15488 |}
15489 !! result
15490 <table>
15491 <tr>
15492 <td>+1
15493 </td>
15494 <td>-2
15495 </td></tr></table>
15496
15497 !! end
15498
15499 #### --------------- Links ----------------
15500 #### 1. Quote marks in link text
15501 #### 2. Wikilinks: Escapes needed
15502 #### 3. Wikilinks: No escapes needed
15503 #### 4. Extlinks: Escapes needed
15504 #### 5. Extlinks: No escapes needed
15505 #### --------------------------------------
15506 !! test
15507 Links 1. Quote marks in link text
15508 !! options
15509 parsoid
15510 !! input
15511 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15512 !! result
15513 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15514 !! end
15515
15516 !! test
15517 Links 2. WikiLinks: Escapes needed
15518 !! options
15519 parsoid
15520 !! input
15521 [[Foo|<nowiki>[Foobar]</nowiki>]]
15522 [[Foo|<nowiki>Foobar]</nowiki>]]
15523 [[Foo|x [Foobar] x]]
15524 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15525 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15526 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15527 [[Foo|<nowiki>|Bar</nowiki>]]
15528 [[Foo|<nowiki>]]bar</nowiki>]]
15529 [[Foo|<nowiki>[[bar</nowiki>]]
15530 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15531 !! result
15532 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15533 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15534 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15535 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15536 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15537 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15538 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15539 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15540 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15541 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15542 !! end
15543
15544 !! test
15545 Links 3. WikiLinks: No escapes needed
15546 !! options
15547 parsoid
15548 !! input
15549 [[Foo|[Foobar]]
15550 [[Foo|foo|bar]]
15551 !! result
15552 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15553 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15554 !! end
15555
15556 !! test
15557 Links 4. ExtLinks: Escapes needed
15558 !! options
15559 parsoid
15560 !! input
15561 [http://google.com <nowiki>[google]</nowiki>]
15562 [http://google.com <nowiki>google]</nowiki>]
15563 !! result
15564 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15565 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15566 !! end
15567
15568 !! test
15569 Links 5. ExtLinks: No escapes needed
15570 !! options
15571 parsoid
15572 !! input
15573 [http://google.com [google]
15574 !! result
15575 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15576 !! end
15577
15578 #### --------------- Quotes ---------------
15579 #### 1. Quotes inside <b> and <i>
15580 #### 2. Link fragments separated by <i> and <b> tags
15581 #### 3. Link fragments inside <i> and <b>
15582 #### --------------------------------------
15583 !! test
15584 1. Quotes inside <b> and <i>
15585 !! input
15586 ''<nowiki>'foo'</nowiki>''
15587 ''<nowiki>''foo''</nowiki>''
15588 ''<nowiki>'''foo'''</nowiki>''
15589 ''foo''<nowiki>'s</nowiki>
15590 '''<nowiki>'foo'</nowiki>'''
15591 '''<nowiki>''foo''</nowiki>'''
15592 '''<nowiki>'''foo'''</nowiki>'''
15593 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15594 '''foo'''<nowiki>'s</nowiki>
15595 !! result
15596 <p><i>'foo'</i>
15597 <i>''foo''</i>
15598 <i>'''foo'''</i>
15599 <i>foo</i>'s
15600 <b>'foo'</b>
15601 <b>''foo''</b>
15602 <b>'''foo'''</b>
15603 <b>foo'<i>bar'</i>baz</b>
15604 <b>foo</b>'s
15605 </p>
15606 !! end
15607
15608 !! test
15609 2. Link fragments separated by <i> and <b> tags
15610 !! input
15611 [[''foo''<nowiki>hello]]</nowiki>
15612
15613 [['''foo'''<nowiki>hello]]</nowiki>
15614 !! result
15615 <p>[[<i>foo</i>hello]]
15616 </p><p>[[<b>foo</b>hello]]
15617 </p>
15618 !! end
15619
15620 !! test
15621 2. Link fragments inside <i> and <b>
15622 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15623 this is one of the shortcomings of this format)
15624 !! input
15625 ''[[foo''<nowiki>]]</nowiki>
15626
15627 '''[[foo'''<nowiki>]]</nowiki>
15628 !! result
15629 <p><i>[[foo</i>]]
15630 </p><p><b>[[foo</b>]]
15631 </p>
15632 !! end
15633
15634 #### ----------- Paragraphs ---------------
15635 #### 1. No unnecessary escapes
15636 #### --------------------------------------
15637
15638 !! test
15639 1. No unnecessary escapes
15640 !! input
15641 bar <span><nowiki>[[foo]]</nowiki></span>
15642
15643 =bar <span><nowiki>[[foo]]</nowiki></span>
15644
15645 [[bar <span><nowiki>[[foo]]</nowiki></span>
15646
15647 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15648
15649 =bar <span>foo]]</span><nowiki>=</nowiki>
15650 !! result
15651 <p>bar <span>[[foo]]</span>
15652 </p><p>=bar <span>[[foo]]</span>
15653 </p><p>[[bar <span>[[foo]]</span>
15654 </p><p>]]bar <span>[[foo]]</span>
15655 </p><p>=bar <span>foo]]</span>=
15656 </p>
15657 !!end
15658
15659 #### ----------------------- PRE --------------------------
15660 #### 1. Leading whitespace in SOL context should be escaped
15661 #### ------------------------------------------------------
15662 !! test
15663 1. Leading whitespace in SOL context should be escaped
15664 !! options
15665 parsoid
15666 !! input
15667 <nowiki> a</nowiki>
15668
15669 <nowiki> a</nowiki>
15670
15671 <nowiki> a(tab)</nowiki>
15672
15673 <nowiki> a</nowiki>
15674 <!--cmt-->
15675 <nowiki> a</nowiki>
15676
15677 <nowiki>a
15678 b</nowiki>
15679
15680 <nowiki>a
15681 b</nowiki>
15682
15683 <nowiki>a
15684 b</nowiki>
15685 !! result
15686 <p> a</p>
15687 <p> a</p>
15688 <p> a(tab)</p>
15689 <p> a</p>
15690 <p><!--cmt--> a</p>
15691 <p>a
15692 b</p>
15693 <p>a
15694 b</p>
15695 <p>a
15696 b</p>
15697 !! end
15698
15699 #### --------------- HTML tags ---------------
15700 #### 1. a tags
15701 #### 2. other tags
15702 #### 3. multi-line html tag
15703 #### -----------------------------------------
15704 !! test
15705 1. a tags
15706 !! options
15707 parsoid
15708 !! input
15709 <a href="http://google.com">google</a>
15710 !! result
15711 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15712 !! end
15713
15714 !! test
15715 2. other tags
15716 !! input
15717 <nowiki><div>foo</div>
15718 <div style="color:red">foo</div></nowiki>
15719 !! result
15720 <p>&lt;div&gt;foo&lt;/div&gt;
15721 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15722 </p>
15723 !! end
15724
15725 !! test
15726 3. multi-line html tag
15727 !! input
15728 <nowiki><div
15729 >foo</div
15730 ></nowiki>
15731 !! result
15732 <p>&lt;div
15733 &gt;foo&lt;/div
15734 &gt;
15735 </p>
15736 !! end
15737
15738 !! test
15739 4. extension tags
15740 !! input
15741 <nowiki><ref>foo</ref></nowiki>
15742 !! result
15743 <p>&lt;ref&gt;foo&lt;/ref&gt;
15744 </p>
15745 !! end
15746
15747 #### --------------- Others ---------------
15748 !! test
15749 Escaping nowikis
15750 !! input
15751 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15752 !! result
15753 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15754 </p>
15755 !! end
15756 !! test
15757
15758 Tag-like HTML structures are passed through as text
15759 !! input
15760 <x y>
15761
15762 <x.y>
15763
15764 <x-y>
15765
15766 1>2
15767
15768 x<y
15769
15770 a>b
15771
15772 1<d e>f
15773 !! result
15774 <p>&lt;x y&gt;
15775 </p><p>&lt;x.y&gt;
15776 </p><p>&lt;x-y&gt;
15777 </p><p>1&gt;2
15778 </p><p>x&lt;y
15779 </p><p>a&gt;b
15780 </p><p>1&lt;d e&gt;f
15781 </p>
15782 !! end
15783
15784
15785 # This fails in the PHP parser (see bug 40670,
15786 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15787 !! test
15788 Tag names followed by punctuation should not be recognized as tags
15789 !! options
15790 parsoid
15791 !! input
15792 <s.ome> text
15793 !! result
15794 <p>&lt;s.ome&gt; text
15795 </p>
15796 !! end
15797
15798 !! test
15799 HTML tag with necessary entities in attributes
15800 !! input
15801 <span title="&amp;amp;">foo</span>
15802 !! result
15803 <p><span title="&amp;amp;">foo</span>
15804 </p>
15805 !! end
15806
15807 !! test
15808 HTML tag with 'unnecessary' entity encoding in attributes
15809 !! input
15810 <span title="&amp;">foo</span>
15811 !! result
15812 <p><span title="&amp;">foo</span>
15813 </p>
15814 !! end
15815
15816 !! test
15817 HTML tag with broken attribute value quoting
15818 !! input
15819 <span title="Hello world>Foo</span>
15820 !! result
15821 <p><span>Foo</span>
15822 </p>
15823 !! end
15824
15825 !! test
15826 Parsoid-only: HTML tag with broken attribute value quoting
15827 !! options
15828 parsoid
15829 !! input
15830 <span title="Hello world>Foo</span>
15831 !! result
15832 <p><span title="Hello world">Foo</span>
15833 </p>
15834 !! end
15835
15836 !! test
15837 Table with broken attribute value quoting
15838 !! input
15839 {|
15840 | title="Hello world|Foo
15841 |}
15842 !! result
15843 <table>
15844 <tr>
15845 <td>Foo
15846 </td></tr></table>
15847
15848 !! end
15849
15850 !! test
15851 Table with broken attribute value quoting on consecutive lines
15852 !! input
15853 {|
15854 | title="Hello world|Foo
15855 | style="color:red|Bar
15856 |}
15857 !! result
15858 <table>
15859 <tr>
15860 <td>Foo
15861 </td>
15862 <td>Bar
15863 </td></tr></table>
15864
15865 !! end
15866
15867 !! test
15868 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15869 !! options
15870 parsoid
15871 !! input
15872 {|
15873 | title="Hello world|Foo
15874 | style="color:red|Bar
15875 |}
15876 !! result
15877 <table><tbody>
15878 <tr>
15879 <td title="Hello world">Foo
15880 </td><td style="color: red">Bar
15881 </td></tr></tbody></table>
15882
15883 !! end
15884
15885 !! test
15886 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15887 !! options
15888 parsoid
15889 !! input
15890 {{}}
15891 !! result
15892 {{}}
15893 !! end
15894
15895 !! test
15896 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15897 !! options
15898 parsoid
15899 !! input
15900 }}{{
15901 !! result
15902 }}{{
15903 !! end
15904
15905 !!test
15906 Accept empty td cell attribute
15907 !!input
15908 {|
15909 | align="center" | foo || |
15910 |}
15911 !!result
15912 <table>
15913 <tr>
15914 <td align="center"> foo </td>
15915 <td>
15916 </td></tr></table>
15917
15918 !!end
15919
15920 !!test
15921 Non-empty attributes in th-cells
15922 !!input
15923 {|
15924 ! Foo !! style="color: red" | Bar
15925 |}
15926 !!result
15927 <table>
15928 <tr>
15929 <th> Foo </th>
15930 <th style="color: red"> Bar
15931 </th></tr></table>
15932
15933 !!end
15934
15935 !!test
15936 Accept empty attributes in th-cells
15937 !!input
15938 {|
15939 !| foo !!| bar
15940 |}
15941 !!result
15942 <table>
15943 <tr>
15944 <th> foo </th>
15945 <th> bar
15946 </th></tr></table>
15947
15948 !!end
15949
15950 !!test
15951 Empty table rows go away
15952 !!input
15953 {|
15954 | Hello
15955 | there
15956 |- class="foo"
15957 |-
15958 |}
15959 !! result
15960 <table>
15961 <tr>
15962 <td> Hello
15963 </td>
15964 <td> there
15965 </td></tr>
15966
15967 </table>
15968
15969 !! end
15970
15971 ###
15972 ### Parsoid-centric tests for testing RTing of inter-element separators
15973 ### Edge cases not tested by existing parser tests and specific to
15974 ### Parsoid-specific serialization strategies.
15975 ###
15976
15977 !!test
15978 RT-ed inter-element separators should be valid separators
15979 !!input
15980 {|
15981 |- [[foo]]
15982 |}
15983 !!result
15984 <table>
15985
15986 </table>
15987
15988 !!end
15989
15990 !!test
15991 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15992 (Parsoid-only since PHP parser relies on Tidy for correct output)
15993 !!options
15994 parsoid
15995 !!input
15996 {|
15997 |<small>foo
15998 bar
15999 |}
16000
16001 {|
16002 |<small>foo<small>
16003 |}
16004 !!result
16005 !!end
16006
16007 !!test
16008 Empty TD followed by TD with tpl-generated attribute
16009 !!input
16010 {|
16011 |-
16012 |
16013 |{{echo|style='color:red'}}|foo
16014 |}
16015 !!result
16016 <table>
16017
16018 <tr>
16019 <td>
16020 </td>
16021 <td>foo
16022 </td></tr></table>
16023
16024 !!end
16025
16026 !!test
16027 Indented table with an empty td
16028 !!input
16029 {|
16030 |-
16031 |
16032 |foo
16033 |}
16034 !!result
16035 <table>
16036
16037 <tr>
16038 <td>
16039 </td>
16040 <td>foo
16041 </td></tr></table>
16042
16043 !!end
16044
16045 !!test
16046 Empty TR followed by a template-generated TR
16047 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16048 !!options
16049 parsoid=wt2html,wt2wt
16050 !!input
16051 {|
16052 |-
16053 {{echo|<tr><td>foo</td></tr>}}
16054 |}
16055 !!result
16056 <table>
16057 <tbody>
16058 <tr></tr>
16059 <tr typeof="mw:Transclusion">
16060 <td>foo</td></tr></tbody></table>
16061 !!end
16062
16063 ## PHP and parsoid output differ for this, and since this is primarily
16064 ## for testing Parsoid's serializer, marking this Parsoid only
16065 !!test
16066 Empty TR followed by mixed-ws-comment line should RT correctly
16067 !!options
16068 parsoid
16069 !!input
16070 {|
16071 |-
16072 <!--c-->
16073 |-
16074 <!--c--> <!--d-->
16075 |}
16076 !!result
16077 <table>
16078 <tbody>
16079 <tr>
16080 <td> <!--c--></td></tr>
16081 <tr>
16082 <td><!--c--> <!--d--></td></tr>
16083 </tbody></table>
16084
16085 !!end
16086
16087 !!test
16088 Multi-line image caption generated by templates with/without trailing newlines
16089 !!options
16090 parsoid
16091 !!input
16092 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16093 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16094 !!result
16095 <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>
16096 <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>
16097
16098 !!end
16099
16100 ## PHP emits broken html for this, and since this is primarily
16101 ## a Parsoid serializer test, marking this Parsoid only
16102 !!test
16103 Improperly nested inline or quotes tags with whitespace in between
16104 !!options
16105 parsoid
16106 !!input
16107 <span> <s>x</span> </s>
16108 ''' ''x''' ''
16109 !!result
16110 <p><span> <s>x</s></span><s> </s>
16111 <b> <i>x</i></b><i> </i>
16112 </p>
16113 !!end
16114
16115 # -----------------------------------------------------------------
16116 # The following section of tests are primarily to spec requirements
16117 # around serialization of new/edited content.
16118 #
16119 # All these tests are marked Parsoid html2wt and html2html only
16120 # ----------------------------------------------------------------
16121
16122 !! test
16123 Image: Modifying size of an image
16124 !! options
16125 parsoid=html2wt
16126 !! input
16127 [[Image:Wiki.png|230x230px]]
16128 !! result
16129 <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>
16130 !!end
16131
16132 !! test
16133 Image: New block level image should have \n before and after
16134 !! options
16135 parsoid=html2wt
16136 !! input
16137 123
16138 [[File:Wiki.png|right|thumb|150x150px]]
16139 456
16140 !! result
16141 <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>
16142 !!end
16143
16144 !! test
16145 Lists: Add space after bullets
16146 !! options
16147 parsoid=html2wt
16148 !! input
16149
16150 * foo
16151 * bar
16152 * <span> baz</span>
16153 !! result
16154 <ul>
16155 <li>foo</li>
16156 <li> bar</li>
16157 <li><span> baz</span></li>
16158 </ul>
16159 !! end
16160
16161 # This test case is fixed by domino 1.0.12.
16162 # Note that html2wt is considerably more difficult if we use <b> in
16163 # the test case, instead of <big>
16164 !! test
16165 Ensure that HTML adoption agency algorithm is properly implemented.
16166 !! options
16167 !! input
16168 <big>X<big>Y</big>Z</big>
16169 !! result
16170 <p><big>X<big>Y</big>Z</big>
16171 </p>
16172 !! end
16173
16174 # The parsoid team believes the below behavior of the PHP parser to be
16175 # a bug.
16176 !! test
16177 Document PHP parser behavior for HTML adoption agency test case.
16178 !! options
16179 php
16180 !! input
16181 <em>X<em>Y</em>Z</em>
16182 !! result
16183 <p><em>X&lt;em&gt;Y</em>Z&lt;/em&gt;
16184 </p>
16185 !! end
16186
16187 TODO:
16188 more images
16189 more tables
16190 character entities
16191 and much more
16192 Try for 100% code coverage