Merge "Prevent Special:Contributions from indicating that an IP address is autoblocked"
[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 wrapping 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 ### Nesting tests (see bug 41545, 50604, 51081)
9508 ###
9509
9510 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9511 # Note that html2wt is considerably more difficult if we use <b> in
9512 # the test case, instead of <big>
9513 !! test
9514 Ensure that HTML adoption agency algorithm is properly implemented.
9515 !! input
9516 <big>X<big>Y</big>Z</big>
9517 !! result
9518 <p><big>X<big>Y</big>Z</big>
9519 </p>
9520 !! end
9521
9522 # This was bug 41545 in the PHP parser.
9523 !! test
9524 Nesting of <kbd>
9525 !! input
9526 <kbd>X<kbd>Y</kbd>Z</kbd>
9527 !! result
9528 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9529 </p>
9530 !! end
9531
9532 # The following cases were bug 51081 in the PHP parser.
9533 # Note that there are some other nestable tags (b, i, etc) which are
9534 # not covered; see bug 51081 for discussion.
9535 !! test
9536 Nesting of <em>
9537 !! input
9538 <em>X<em>Y</em>Z</em>
9539 !! result
9540 <p><em>X<em>Y</em>Z</em>
9541 </p>
9542 !! end
9543
9544 !! test
9545 Nesting of <strong>
9546 !! input
9547 <strong>X<strong>Y</strong>Z</strong>
9548 !! result
9549 <p><strong>X<strong>Y</strong>Z</strong>
9550 </p>
9551 !! end
9552
9553 !! test
9554 Nesting of <q>
9555 !! input
9556 <q>X<q>Y</q>Z</q>
9557 !! result
9558 <p><q>X<q>Y</q>Z</q>
9559 </p>
9560 !! end
9561
9562 !! test
9563 Nesting of <ruby>
9564 !! input
9565 <ruby>X<ruby>Y</ruby>Z</ruby>
9566 !! result
9567 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9568 </p>
9569 !! end
9570
9571 !! test
9572 Nesting of <bdo>
9573 !! input
9574 <bdo>X<bdo>Y</bdo>Z</bdo>
9575 !! result
9576 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9577 </p>
9578 !! end
9579
9580
9581 ###
9582 ### Media links
9583 ###
9584
9585 !! test
9586 Media link
9587 !! input
9588 [[Media:Foobar.jpg]]
9589 !! result
9590 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9591 </p>
9592 !! end
9593
9594 !! test
9595 Media link with text
9596 !! input
9597 [[Media:Foobar.jpg|A neat file to look at]]
9598 !! result
9599 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9600 </p>
9601 !! end
9602
9603 # FIXME: this is still bad HTML tag nesting
9604 !! test
9605 Media link with nasty text
9606 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9607 !! input
9608 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9609 !! result
9610 <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>
9611
9612 !! end
9613
9614 !! test
9615 Media link to nonexistent file (bug 1702)
9616 !! input
9617 [[Media:No such.jpg]]
9618 !! result
9619 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9620 </p>
9621 !! end
9622
9623 !! test
9624 Image link to nonexistent file (bug 1850 - good)
9625 !! input
9626 [[Image:No such.jpg]]
9627 !! result
9628 <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>
9629 </p>
9630 !! end
9631
9632 !! test
9633 :Image link to nonexistent file (bug 1850 - bad)
9634 !! input
9635 [[:Image:No such.jpg]]
9636 !! result
9637 <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>
9638 </p>
9639 !! end
9640
9641
9642
9643 !! test
9644 Character reference normalization in link text (bug 1938)
9645 !! input
9646 [[Main Page|this&that]]
9647 !! result
9648 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9649 </p>
9650 !!end
9651
9652 !! article
9653 אַ
9654 !! text
9655 Test for unicode normalization
9656
9657 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9658 !! endarticle
9659
9660 !! test
9661 (bug 19451) Links should refer to the normalized form.
9662 !! input
9663 [[&#xFB2E;]]
9664 [[&#x5d0;&#x5b7;]]
9665 [[&#x5d0;ַ]]
9666 [[א&#x5b7;]]
9667 [[אַ]]
9668 !! result
9669 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9670 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9671 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9672 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9673 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9674 </p>
9675 !! end
9676
9677 !! test
9678 Empty attribute crash test (bug 2067)
9679 !! input
9680 <font color="">foo</font>
9681 !! result
9682 <p><font color="">foo</font>
9683 </p>
9684 !! end
9685
9686 !! test
9687 Empty attribute crash test single-quotes (bug 2067)
9688 !! input
9689 <font color=''>foo</font>
9690 !! result
9691 <p><font color="">foo</font>
9692 </p>
9693 !! end
9694
9695 !! test
9696 Attribute test: equals, then nothing
9697 !! input
9698 <font color=>foo</font>
9699 !! result
9700 <p><font>foo</font>
9701 </p>
9702 !! end
9703
9704 !! test
9705 Attribute test: unquoted value
9706 !! input
9707 <font color=x>foo</font>
9708 !! result
9709 <p><font color="x">foo</font>
9710 </p>
9711 !! end
9712
9713 !! test
9714 Attribute test: unquoted but illegal value (hash)
9715 !! input
9716 <font color=#x>foo</font>
9717 !! result
9718 <p><font color="#x">foo</font>
9719 </p>
9720 !! end
9721
9722 !! test
9723 Attribute test: no value
9724 !! input
9725 <font color>foo</font>
9726 !! result
9727 <p><font color="color">foo</font>
9728 </p>
9729 !! end
9730
9731 !! test
9732 Bug 2095: link with three closing brackets
9733 !! input
9734 [[Main Page]]]
9735 !! result
9736 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9737 </p>
9738 !! end
9739
9740 !! test
9741 Bug 2095: link with pipe and three closing brackets
9742 !! input
9743 [[Main Page|link]]]
9744 !! result
9745 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9746 </p>
9747 !! end
9748
9749 !! test
9750 Bug 2095: link with pipe and three closing brackets, version 2
9751 !! input
9752 [[Main Page|[http://example.com/]]]
9753 !! result
9754 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9755 </p>
9756 !! end
9757
9758
9759 ###
9760 ### Safety
9761 ###
9762
9763 !! article
9764 Template:Dangerous attribute
9765 !! text
9766 " onmouseover="alert(document.cookie)
9767 !! endarticle
9768
9769 !! article
9770 Template:Dangerous style attribute
9771 !! text
9772 border-size: expression(alert(document.cookie))
9773 !! endarticle
9774
9775 !! article
9776 Template:Div style
9777 !! text
9778 <div style="float: right; {{{1}}}">Magic div</div>
9779 !! endarticle
9780
9781 !! test
9782 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9783 !! input
9784 <div title="{{test}}"></div>
9785 !! result
9786 <div title="This is a test template"></div>
9787
9788 !! end
9789
9790 !! test
9791 Bug 2304: HTML attribute safety (dangerous template; 2309)
9792 !! input
9793 <div title="{{dangerous attribute}}"></div>
9794 !! result
9795 <div title=""></div>
9796
9797 !! end
9798
9799 !! test
9800 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9801 !! input
9802 <div style="{{dangerous style attribute}}"></div>
9803 !! result
9804 <div style="/* insecure input */"></div>
9805
9806 !! end
9807
9808 !! test
9809 Bug 2304: HTML attribute safety (safe parameter; 2309)
9810 !! input
9811 {{div style|width: 200px}}
9812 !! result
9813 <div style="float: right; width: 200px">Magic div</div>
9814
9815 !! end
9816
9817 !! test
9818 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9819 !! input
9820 {{div style|width: expression(alert(document.cookie))}}
9821 !! result
9822 <div style="/* insecure input */">Magic div</div>
9823
9824 !! end
9825
9826 !! test
9827 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9828 !! input
9829 {{div style|"><script>alert(document.cookie)</script>}}
9830 !! result
9831 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9832
9833 !! end
9834
9835 !! test
9836 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9837 !! input
9838 {{div style|" ><script>alert(document.cookie)</script>}}
9839 !! result
9840 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9841
9842 !! end
9843
9844 !! test
9845 Bug 2304: HTML attribute safety (link)
9846 !! input
9847 <div title="[[Main Page]]"></div>
9848 !! result
9849 <div title="&#91;&#91;Main Page]]"></div>
9850
9851 !! end
9852
9853 !! test
9854 Bug 2304: HTML attribute safety (italics)
9855 !! input
9856 <div title="''foobar''"></div>
9857 !! result
9858 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9859
9860 !! end
9861
9862 !! test
9863 Bug 2304: HTML attribute safety (bold)
9864 !! input
9865 <div title="'''foobar'''"></div>
9866 !! result
9867 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9868
9869 !! end
9870
9871
9872 !! test
9873 Bug 2304: HTML attribute safety (ISBN)
9874 !! input
9875 <div title="ISBN 1234567890"></div>
9876 !! result
9877 <div title="&#73;SBN 1234567890"></div>
9878
9879 !! end
9880
9881 !! test
9882 Bug 2304: HTML attribute safety (RFC)
9883 !! input
9884 <div title="RFC 1234"></div>
9885 !! result
9886 <div title="&#82;FC 1234"></div>
9887
9888 !! end
9889
9890 !! test
9891 Bug 2304: HTML attribute safety (PMID)
9892 !! input
9893 <div title="PMID 1234567890"></div>
9894 !! result
9895 <div title="&#80;MID 1234567890"></div>
9896
9897 !! end
9898
9899 !! test
9900 Bug 2304: HTML attribute safety (web link)
9901 !! input
9902 <div title="http://example.com/"></div>
9903 !! result
9904 <div title="http&#58;//example.com/"></div>
9905
9906 !! end
9907
9908 !! test
9909 Bug 2304: HTML attribute safety (named web link)
9910 !! input
9911 <div title="[http://example.com/ link]"></div>
9912 !! result
9913 <div title="&#91;http&#58;//example.com/ link]"></div>
9914
9915 !! end
9916
9917 !! test
9918 Bug 3244: HTML attribute safety (extension; safe)
9919 !! input
9920 <div style="<nowiki>background:blue</nowiki>"></div>
9921 !! result
9922 <div style="background:blue"></div>
9923
9924 !! end
9925
9926 !! test
9927 Bug 3244: HTML attribute safety (extension; unsafe)
9928 !! input
9929 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9930 !! result
9931 <div style="/* insecure input */"></div>
9932
9933 !! end
9934
9935 # More MSIE fun discovered by Tom Gilder
9936
9937 !! test
9938 MSIE CSS safety test: spurious slash
9939 !! input
9940 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9941 !! result
9942 <div style="/* insecure input */">evil</div>
9943
9944 !! end
9945
9946 !! test
9947 MSIE CSS safety test: hex code
9948 !! input
9949 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9950 !! result
9951 <div style="/* insecure input */">evil</div>
9952
9953 !! end
9954
9955 !! test
9956 MSIE CSS safety test: comment in url
9957 !! input
9958 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9959 !! result
9960 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9961
9962 !! end
9963
9964 !! test
9965 MSIE CSS safety test: comment in expression
9966 !! input
9967 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9968 !! result
9969 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9970
9971 !! end
9972
9973
9974 !! test
9975 Table attribute legitimate extension
9976 !! input
9977 {|
9978 !+ style="<nowiki>color:blue</nowiki>"| status
9979 |}
9980 !! result
9981 <table>
9982 <tr>
9983 <th style="color:blue"> status
9984 </th></tr></table>
9985
9986 !!end
9987
9988 !! test
9989 Table attribute safety
9990 !! input
9991 {|
9992 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9993 |}
9994 !! result
9995 <table>
9996 <tr>
9997 <th style="/* insecure input */"> status
9998 </th></tr></table>
9999
10000 !! end
10001
10002 !! test
10003 CSS line continuation 1
10004 !! input
10005 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10006 !! result
10007 <div style="/* insecure input */"></div>
10008
10009 !! end
10010
10011 !! test
10012 CSS line continuation 2
10013 !! input
10014 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10015 !! result
10016 <div style="/* insecure input */"></div>
10017
10018 !! end
10019
10020 !! article
10021 Template:Identity
10022 !! text
10023 {{{1}}}
10024 !! endarticle
10025
10026 !! test
10027 Expansion of multi-line templates in attribute values (bug 6255)
10028 !! input
10029 <div style="background: {{identity|#00FF00}}">-</div>
10030 !! result
10031 <div style="background: #00FF00">-</div>
10032
10033 !! end
10034
10035
10036 !! test
10037 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10038 !! input
10039 <div style="background:
10040 #00FF00">-</div>
10041 !! result
10042 <div style="background: #00FF00">-</div>
10043
10044 !! end
10045
10046 !! test
10047 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10048 !! input
10049 <div style="background: &#10;#00FF00">-</div>
10050 !! result
10051 <div style="background: &#10;#00FF00">-</div>
10052
10053 !! end
10054
10055 ###
10056 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10057 ###
10058 !! test
10059 Parser hook: empty input
10060 !! input
10061 <tag></tag>
10062 !! result
10063 <pre>
10064 ''
10065 array (
10066 )
10067 </pre>
10068
10069 !! end
10070
10071 !! test
10072 Parser hook: empty input using terminated empty elements
10073 !! input
10074 <tag/>
10075 !! result
10076 <pre>
10077 NULL
10078 array (
10079 )
10080 </pre>
10081
10082 !! end
10083
10084 !! test
10085 Parser hook: empty input using terminated empty elements (space before)
10086 !! input
10087 <tag />
10088 !! result
10089 <pre>
10090 NULL
10091 array (
10092 )
10093 </pre>
10094
10095 !! end
10096
10097 !! test
10098 Parser hook: basic input
10099 !! input
10100 <tag>input</tag>
10101 !! result
10102 <pre>
10103 'input'
10104 array (
10105 )
10106 </pre>
10107
10108 !! end
10109
10110
10111 !! test
10112 Parser hook: case insensitive
10113 !! input
10114 <TAG>input</TAG>
10115 !! result
10116 <pre>
10117 'input'
10118 array (
10119 )
10120 </pre>
10121
10122 !! end
10123
10124
10125 !! test
10126 Parser hook: case insensitive, redux
10127 !! input
10128 <TaG>input</TAg>
10129 !! result
10130 <pre>
10131 'input'
10132 array (
10133 )
10134 </pre>
10135
10136 !! end
10137
10138 !! test
10139 Parser hook: nested tags
10140 !! options
10141 noxml
10142 !! input
10143 <tag><tag></tag></tag>
10144 !! result
10145 <pre>
10146 '<tag>'
10147 array (
10148 )
10149 </pre>&lt;/tag&gt;
10150
10151 !! end
10152
10153 !! test
10154 Parser hook: basic arguments
10155 !! input
10156 <tag width=200 height = "100" depth = '50' square></tag>
10157 !! result
10158 <pre>
10159 ''
10160 array (
10161 'width' => '200',
10162 'height' => '100',
10163 'depth' => '50',
10164 'square' => 'square',
10165 )
10166 </pre>
10167
10168 !! end
10169
10170 !! test
10171 Parser hook: argument containing a forward slash (bug 5344)
10172 !! input
10173 <tag filename='/tmp/bla'></tag>
10174 !! result
10175 <pre>
10176 ''
10177 array (
10178 'filename' => '/tmp/bla',
10179 )
10180 </pre>
10181
10182 !! end
10183
10184 !! test
10185 Parser hook: empty input using terminated empty elements (bug 2374)
10186 !! input
10187 <tag foo=bar/>text
10188 !! result
10189 <pre>
10190 NULL
10191 array (
10192 'foo' => 'bar',
10193 )
10194 </pre>text
10195
10196 !! end
10197
10198 # </tag> should be output literally since there is no matching tag that begins it
10199 !! test
10200 Parser hook: basic arguments using terminated empty elements (bug 2374)
10201 !! input
10202 <tag width=200 height = "100" depth = '50' square/>
10203 other stuff
10204 </tag>
10205 !! result
10206 <pre>
10207 NULL
10208 array (
10209 'width' => '200',
10210 'height' => '100',
10211 'depth' => '50',
10212 'square' => 'square',
10213 )
10214 </pre>
10215 <p>other stuff
10216 &lt;/tag&gt;
10217 </p>
10218 !! end
10219
10220 ###
10221 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10222 ###
10223
10224 !! test
10225 Parser hook: static parser hook not inside a comment
10226 !! input
10227 <statictag>hello, world</statictag>
10228 <statictag action=flush/>
10229 !! result
10230 <p>hello, world
10231 </p>
10232 !! end
10233
10234
10235 !! test
10236 Parser hook: static parser hook inside a comment
10237 !! input
10238 <!-- <statictag>hello, world</statictag> -->
10239 <statictag action=flush/>
10240 !! result
10241 <p><br />
10242 </p>
10243 !! end
10244
10245 # Nested template calls; this case was broken by Parser.php rev 1.506,
10246 # since reverted.
10247
10248 !! article
10249 Template:One-parameter
10250 !! text
10251 (My parameter is: {{{1}}})
10252 !! endarticle
10253
10254 !! article
10255 Template:Map-one-parameter
10256 !! text
10257 {{{{{1}}}|{{{2}}}}}
10258 !! endarticle
10259
10260 !! test
10261 Nested template calls
10262 !! input
10263 {{Map-one-parameter|One-parameter|param}}
10264 !! result
10265 <p>(My parameter is: param)
10266 </p>
10267 !! end
10268
10269
10270 ###
10271 ### Sanitizer
10272 ###
10273 !! test
10274 Sanitizer: Closing of open tags
10275 !! input
10276 <s></s><table></table>
10277 !! result
10278 <s></s><table></table>
10279
10280 !! end
10281
10282 !! test
10283 Sanitizer: Closing of open but not closed tags
10284 !! input
10285 <s>foo
10286 !! result
10287 <p><s>foo</s>
10288 </p>
10289 !! end
10290
10291 !! test
10292 Sanitizer: Closing of closed but not open tags
10293 !! input
10294 </s>
10295 !! result
10296 <p>&lt;/s&gt;
10297 </p>
10298 !! end
10299
10300 !! test
10301 Sanitizer: Closing of closed but not open table tags
10302 !! input
10303 Table not started</td></tr></table>
10304 !! result
10305 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10306 </p>
10307 !! end
10308
10309 !! test
10310 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10311 !! input
10312 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10313 !! result
10314 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10315 </p>
10316 !! end
10317
10318 !! test
10319 Sanitizer: Validating the contents of the id attribute (bug 4515)
10320 !! options
10321 disabled
10322 !! input
10323 <br id=9 />
10324 !! result
10325 Something, but definitely not <br id="9" />...
10326 !! end
10327
10328 !! test
10329 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10330 !! options
10331 disabled
10332 !! input
10333 <br id="foo" /><br id="foo" />
10334 !! result
10335 Something need to be done. foo-2 ?
10336 !! end
10337
10338 !! test
10339 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10340 !! input
10341 <div itemscope>
10342 <meta itemprop="hello" content="world">
10343 <meta http-equiv="refresh" content="5">
10344 <meta itemprop="hello" http-equiv="refresh" content="5">
10345 <link itemprop="hello" href="{{SERVER}}">
10346 <link rel="stylesheet" href="{{SERVER}}">
10347 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10348 </div>
10349 !! result
10350 <div itemscope="itemscope">
10351 <p> <meta itemprop="hello" content="world" />
10352 &lt;meta http-equiv="refresh" content="5"&gt;
10353 <meta itemprop="hello" content="5" />
10354 </p>
10355 <link itemprop="hello" href="http&#58;//example.org" />
10356 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10357 <link itemprop="hello" href="http&#58;//example.org" />
10358 </div>
10359
10360 !! end
10361
10362 !! test
10363 Language converter: output gets cut off unexpectedly (bug 5757)
10364 !! options
10365 language=zh
10366 !! input
10367 this bit is safe: }-
10368
10369 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10370
10371 then we get cut off here: }-
10372
10373 all additional text is vanished
10374 !! result
10375 <p>this bit is safe: }-
10376 </p><p>but if we add a conversion instance: xxx
10377 </p><p>then we get cut off here: }-
10378 </p><p>all additional text is vanished
10379 </p>
10380 !! end
10381
10382 !! test
10383 Self closed html pairs (bug 5487)
10384 !! options
10385 !! input
10386 <center><font id="bug" />Centered text</center>
10387 <div><font id="bug2" />In div text</div>
10388 !! result
10389 <center>&lt;font id="bug" /&gt;Centered text</center>
10390 <div>&lt;font id="bug2" /&gt;In div text</div>
10391
10392 !! end
10393
10394 #
10395 #
10396 #
10397
10398 !! test
10399 Punctuation: nbsp before exclamation
10400 !! input
10401 C'est grave !
10402 !! result
10403 <p>C'est grave&#160;!
10404 </p>
10405 !! end
10406
10407 !! test
10408 Punctuation: CSS !important (bug 11874)
10409 !! input
10410 <div style="width:50% !important">important</div>
10411 !! result
10412 <div style="width:50% !important">important</div>
10413
10414 !!end
10415
10416 !! test
10417 Punctuation: CSS ! important (bug 11874; with space after)
10418 !! input
10419 <div style="width:50% ! important">important</div>
10420 !! result
10421 <div style="width:50% ! important">important</div>
10422
10423 !!end
10424
10425
10426 !! test
10427 HTML bullet list, closed tags (bug 5497)
10428 !! input
10429 <ul>
10430 <li>One</li>
10431 <li>Two</li>
10432 </ul>
10433 !! result
10434 <ul>
10435 <li>One</li>
10436 <li>Two</li>
10437 </ul>
10438
10439 !! end
10440
10441 !! test
10442 HTML bullet list, unclosed tags (bug 5497)
10443 !! options
10444 disabled
10445 !! input
10446 <ul>
10447 <li>One
10448 <li>Two
10449 </ul>
10450 !! result
10451 <ul>
10452 <li>One
10453 </li><li>Two
10454 </li></ul>
10455
10456 !! end
10457
10458 !! test
10459 HTML ordered list, closed tags (bug 5497)
10460 !! input
10461 <ol>
10462 <li>One</li>
10463 <li>Two</li>
10464 </ol>
10465 !! result
10466 <ol>
10467 <li>One</li>
10468 <li>Two</li>
10469 </ol>
10470
10471 !! end
10472
10473 !! test
10474 HTML ordered list, unclosed tags (bug 5497)
10475 !! options
10476 disabled
10477 !! input
10478 <ol>
10479 <li>One
10480 <li>Two
10481 </ol>
10482 !! result
10483 <ol>
10484 <li>One
10485 </li><li>Two
10486 </li></ol>
10487
10488 !! end
10489
10490 !! test
10491 HTML nested bullet list, closed tags (bug 5497)
10492 !! input
10493 <ul>
10494 <li>One</li>
10495 <li>Two:
10496 <ul>
10497 <li>Sub-one</li>
10498 <li>Sub-two</li>
10499 </ul>
10500 </li>
10501 </ul>
10502 !! result
10503 <ul>
10504 <li>One</li>
10505 <li>Two:
10506 <ul>
10507 <li>Sub-one</li>
10508 <li>Sub-two</li>
10509 </ul>
10510 </li>
10511 </ul>
10512
10513 !! end
10514
10515 !! test
10516 HTML nested bullet list, open tags (bug 5497)
10517 !! options
10518 disabled
10519 !! input
10520 <ul>
10521 <li>One
10522 <li>Two:
10523 <ul>
10524 <li>Sub-one
10525 <li>Sub-two
10526 </ul>
10527 </ul>
10528 !! result
10529 <ul>
10530 <li>One
10531 </li><li>Two:
10532 <ul>
10533 <li>Sub-one
10534 </li><li>Sub-two
10535 </li></ul>
10536 </li></ul>
10537
10538 !! end
10539
10540 !! test
10541 HTML nested ordered list, closed tags (bug 5497)
10542 !! input
10543 <ol>
10544 <li>One</li>
10545 <li>Two:
10546 <ol>
10547 <li>Sub-one</li>
10548 <li>Sub-two</li>
10549 </ol>
10550 </li>
10551 </ol>
10552 !! result
10553 <ol>
10554 <li>One</li>
10555 <li>Two:
10556 <ol>
10557 <li>Sub-one</li>
10558 <li>Sub-two</li>
10559 </ol>
10560 </li>
10561 </ol>
10562
10563 !! end
10564
10565 !! test
10566 HTML nested ordered list, open tags (bug 5497)
10567 !! options
10568 disabled
10569 !! input
10570 <ol>
10571 <li>One
10572 <li>Two:
10573 <ol>
10574 <li>Sub-one
10575 <li>Sub-two
10576 </ol>
10577 </ol>
10578 !! result
10579 <ol>
10580 <li>One
10581 </li><li>Two:
10582 <ol>
10583 <li>Sub-one
10584 </li><li>Sub-two
10585 </li></ol>
10586 </li></ol>
10587
10588 !! end
10589
10590 !! test
10591 HTML ordered list item with parameters oddity
10592 !! input
10593 <ol><li id="fragment">One</li></ol>
10594 !! result
10595 <ol><li id="fragment">One</li></ol>
10596
10597 !! end
10598
10599 !!test
10600 bug 5918: autonumbering
10601 !! input
10602 [http://first/] [http://second] [ftp://ftp]
10603
10604 ftp://inlineftp
10605
10606 [mailto:enclosed@mail.tld With target]
10607
10608 [mailto:enclosed@mail.tld]
10609
10610 mailto:inline@mail.tld
10611 !! result
10612 <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>
10613 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10614 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10615 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10616 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10617 </p>
10618 !! end
10619
10620
10621 #
10622 # Security and HTML correctness
10623 # From Nick Jenkins' fuzz testing
10624 #
10625
10626 !! test
10627 Fuzz testing: Parser13
10628 !! input
10629 {|
10630 | http://a|
10631 !! result
10632 <table>
10633 <tr>
10634 <td>
10635 </td>
10636 </tr>
10637 </table>
10638
10639 !! end
10640
10641 !! test
10642 Fuzz testing: Parser14
10643 !! input
10644 == onmouseover= ==
10645 http://__TOC__
10646 !! result
10647 <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>
10648 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10649 <ul>
10650 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10651 </ul>
10652 </div>
10653
10654 !! end
10655
10656 !! test
10657 Fuzz testing: Parser14-table
10658 !! input
10659 ==a==
10660 {| STYLE=__TOC__
10661 !! result
10662 <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>
10663 <table style="&#95;_TOC&#95;_">
10664 <tr><td></td></tr>
10665 </table>
10666
10667 !! end
10668
10669 # Known to produce bogus xml (extra </td>)
10670 !! test
10671 Fuzz testing: Parser16
10672 !! options
10673 noxml
10674 !! input
10675 {|
10676 !https://||||||
10677 !! result
10678 <table>
10679 <tr>
10680 <th>https://</th>
10681 <th></th>
10682 <th></th>
10683 <th>
10684 </td>
10685 </tr>
10686 </table>
10687
10688 !! end
10689
10690 !! test
10691 Fuzz testing: Parser21
10692 !! input
10693 {|
10694 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10695 |
10696 !! result
10697 <table>
10698 <tr>
10699 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10700 </th>
10701 <td>
10702 </td>
10703 </tr>
10704 </table>
10705
10706 !! end
10707
10708 !! test
10709 Fuzz testing: Parser22
10710 !! input
10711 http://===r:::https://b
10712
10713 {|
10714 !!result
10715 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10716 </p>
10717 <table>
10718 <tr><td></td></tr>
10719 </table>
10720
10721 !! end
10722
10723 # Known to produce bad XML for now
10724 !! test
10725 Fuzz testing: Parser24
10726 !! options
10727 noxml
10728 !! input
10729 {|
10730 {{{|
10731 <u CLASS=
10732 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10733 <br style="onmouseover='alert(document.cookie);' " />
10734
10735 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10736 |
10737 !! result
10738 <table>
10739 {{{|
10740 <u class="&#124;">}}}} &gt;
10741 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10742
10743 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10744 <tr>
10745 <td></u>
10746 </td>
10747 </tr>
10748 </table>
10749
10750 !! end
10751
10752 # Note: the current result listed for this is not what the original one was,
10753 # but the original bug was JavaScript injection, which is fixed in any case.
10754 # It's not clear that the original result listed was any more correct than the
10755 # current one. Original result:
10756 # <p>{{{|
10757 # </p>
10758 # <li class="&#124;&#124;">
10759 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10760 !!test
10761 Fuzz testing: Parser25 (bug 6055)
10762 !! input
10763 {{{
10764 |
10765 <LI CLASS=||
10766 >
10767 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10768 !! result
10769 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10770 </p>
10771 !! end
10772
10773 !!test
10774 Fuzz testing: URL adjacent extension (with space, clean)
10775 !! options
10776 !! input
10777 http://example.com <nowiki>junk</nowiki>
10778 !! result
10779 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10780 </p>
10781 !!end
10782
10783 !!test
10784 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10785 !! options
10786 !! input
10787 http://example.com<nowiki>junk</nowiki>
10788 !! result
10789 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10790 </p>
10791 !!end
10792
10793 !!test
10794 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10795 !! options
10796 !! input
10797 http://example.com<pre>junk</pre>
10798 !! result
10799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10800
10801 !!end
10802
10803 !!test
10804 Fuzz testing: image with bogus manual thumbnail
10805 !!input
10806 [[Image:foobar.jpg|thumbnail= ]]
10807 !!result
10808 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10809
10810 !!end
10811
10812 !! test
10813 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10814 !! input
10815 <pre dir="&#10;"></pre>
10816 !! result
10817 <pre dir="&#10;"></pre>
10818
10819 !! end
10820
10821 !! test
10822 Parsing optional HTML elements (Bug 6171)
10823 !! options
10824 !! input
10825 <table>
10826 <tr>
10827 <td> Some tabular data</td>
10828 <td> More tabular data ...
10829 <td> And yet som tabular data</td>
10830 </tr>
10831 </table>
10832 !! result
10833 <table>
10834 <tr>
10835 <td> Some tabular data</td>
10836 <td> More tabular data ...
10837 </td><td> And yet som tabular data</td>
10838 </tr>
10839 </table>
10840
10841 !! end
10842
10843 !! test
10844 Correct handling of <td>, <tr> (Bug 6171)
10845 !! options
10846 !! input
10847 <table>
10848 <tr>
10849 <td> Some tabular data</td>
10850 <td> More tabular data ...</td>
10851 <td> And yet som tabular data</td>
10852 </tr>
10853 </table>
10854 !! result
10855 <table>
10856 <tr>
10857 <td> Some tabular data</td>
10858 <td> More tabular data ...</td>
10859 <td> And yet som tabular data</td>
10860 </tr>
10861 </table>
10862
10863 !! end
10864
10865
10866 !! test
10867 Parsing crashing regression (fr:JavaScript)
10868 !! input
10869 </body></x>
10870 !! result
10871 <p>&lt;/body&gt;&lt;/x&gt;
10872 </p>
10873 !! end
10874
10875 !! test
10876 Inline wiki vs wiki block nesting
10877 !! input
10878 '''Bold paragraph
10879
10880 New wiki paragraph
10881 !! result
10882 <p><b>Bold paragraph</b>
10883 </p><p>New wiki paragraph
10884 </p>
10885 !! end
10886
10887 !! test
10888 Inline HTML vs wiki block nesting
10889 !! options
10890 disabled
10891 !! input
10892 <b>Bold paragraph
10893
10894 New wiki paragraph
10895 !! result
10896 <p><b>Bold paragraph</b>
10897 </p><p>New wiki paragraph
10898 </p>
10899 !! end
10900
10901 # Original result was this:
10902 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10903 # </p>
10904 # While that might be marginally more intuitive, maybe, the six-apostrophe
10905 # construct is clearly pathological and the result stated here (which is what
10906 # the parser actually does) is about as reasonable as anything.
10907 !!test
10908 Mixing markup for italics and bold
10909 !! options
10910 !! input
10911 '''bold''''''bold''bolditalics'''''
10912 !! result
10913 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10914 </p>
10915 !! end
10916
10917
10918 !! article
10919 Xyzzyx
10920 !! text
10921 Article for special page transclusion test
10922 !! endarticle
10923
10924 !! test
10925 Special page transclusion
10926 !! options
10927 !! input
10928 {{Special:Prefixindex/Xyzzyx}}
10929 !! result
10930 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10931
10932 !! end
10933
10934 !! test
10935 Special page transclusion twice (bug 5021)
10936 !! options
10937 !! input
10938 {{Special:Prefixindex/Xyzzyx}}
10939 {{Special:Prefixindex/Xyzzyx}}
10940 !! result
10941 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10942 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10943
10944 !! end
10945
10946 !! test
10947 Transclusion of default MediaWiki message
10948 !! input
10949 {{MediaWiki:Mainpage}}
10950 !!result
10951 <p>Main Page
10952 </p>
10953 !! end
10954
10955 !! test
10956 Transclusion of nonexistent MediaWiki message
10957 !! input
10958 {{MediaWiki:Mainpagexxx}}
10959 !!result
10960 <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>
10961 </p>
10962 !! end
10963
10964 !! test
10965 Transclusion of MediaWiki message with underscore
10966 !! input
10967 {{MediaWiki:history_short}}
10968 !! result
10969 <p>History
10970 </p>
10971 !! end
10972
10973 !! test
10974 Transclusion of MediaWiki message with space
10975 !! input
10976 {{MediaWiki:history short}}
10977 !! result
10978 <p>History
10979 </p>
10980 !! end
10981
10982 !! test
10983 Invalid header with following text
10984 !! input
10985 = x = y
10986 !! result
10987 <p>= x = y
10988 </p>
10989 !! end
10990
10991
10992 !! test
10993 Section extraction test (section 0)
10994 !! options
10995 section=0
10996 !! input
10997 start
10998 ==a==
10999 ===aa===
11000 ====aaa====
11001 ==b==
11002 ===ba===
11003 ===bb===
11004 ====bba====
11005 ===bc===
11006 ==c==
11007 ===ca===
11008 !! result
11009 start
11010 !! end
11011
11012 !! test
11013 Section extraction test (section 1)
11014 !! options
11015 section=1
11016 !! input
11017 start
11018 ==a==
11019 ===aa===
11020 ====aaa====
11021 ==b==
11022 ===ba===
11023 ===bb===
11024 ====bba====
11025 ===bc===
11026 ==c==
11027 ===ca===
11028 !! result
11029 ==a==
11030 ===aa===
11031 ====aaa====
11032 !! end
11033
11034 !! test
11035 Section extraction test (section 2)
11036 !! options
11037 section=2
11038 !! input
11039 start
11040 ==a==
11041 ===aa===
11042 ====aaa====
11043 ==b==
11044 ===ba===
11045 ===bb===
11046 ====bba====
11047 ===bc===
11048 ==c==
11049 ===ca===
11050 !! result
11051 ===aa===
11052 ====aaa====
11053 !! end
11054
11055 !! test
11056 Section extraction test (section 3)
11057 !! options
11058 section=3
11059 !! input
11060 start
11061 ==a==
11062 ===aa===
11063 ====aaa====
11064 ==b==
11065 ===ba===
11066 ===bb===
11067 ====bba====
11068 ===bc===
11069 ==c==
11070 ===ca===
11071 !! result
11072 ====aaa====
11073 !! end
11074
11075 !! test
11076 Section extraction test (section 4)
11077 !! options
11078 section=4
11079 !! input
11080 start
11081 ==a==
11082 ===aa===
11083 ====aaa====
11084 ==b==
11085 ===ba===
11086 ===bb===
11087 ====bba====
11088 ===bc===
11089 ==c==
11090 ===ca===
11091 !! result
11092 ==b==
11093 ===ba===
11094 ===bb===
11095 ====bba====
11096 ===bc===
11097 !! end
11098
11099 !! test
11100 Section extraction test (section 5)
11101 !! options
11102 section=5
11103 !! input
11104 start
11105 ==a==
11106 ===aa===
11107 ====aaa====
11108 ==b==
11109 ===ba===
11110 ===bb===
11111 ====bba====
11112 ===bc===
11113 ==c==
11114 ===ca===
11115 !! result
11116 ===ba===
11117 !! end
11118
11119 !! test
11120 Section extraction test (section 6)
11121 !! options
11122 section=6
11123 !! input
11124 start
11125 ==a==
11126 ===aa===
11127 ====aaa====
11128 ==b==
11129 ===ba===
11130 ===bb===
11131 ====bba====
11132 ===bc===
11133 ==c==
11134 ===ca===
11135 !! result
11136 ===bb===
11137 ====bba====
11138 !! end
11139
11140 !! test
11141 Section extraction test (section 7)
11142 !! options
11143 section=7
11144 !! input
11145 start
11146 ==a==
11147 ===aa===
11148 ====aaa====
11149 ==b==
11150 ===ba===
11151 ===bb===
11152 ====bba====
11153 ===bc===
11154 ==c==
11155 ===ca===
11156 !! result
11157 ====bba====
11158 !! end
11159
11160 !! test
11161 Section extraction test (section 8)
11162 !! options
11163 section=8
11164 !! input
11165 start
11166 ==a==
11167 ===aa===
11168 ====aaa====
11169 ==b==
11170 ===ba===
11171 ===bb===
11172 ====bba====
11173 ===bc===
11174 ==c==
11175 ===ca===
11176 !! result
11177 ===bc===
11178 !! end
11179
11180 !! test
11181 Section extraction test (section 9)
11182 !! options
11183 section=9
11184 !! input
11185 start
11186 ==a==
11187 ===aa===
11188 ====aaa====
11189 ==b==
11190 ===ba===
11191 ===bb===
11192 ====bba====
11193 ===bc===
11194 ==c==
11195 ===ca===
11196 !! result
11197 ==c==
11198 ===ca===
11199 !! end
11200
11201 !! test
11202 Section extraction test (section 10)
11203 !! options
11204 section=10
11205 !! input
11206 start
11207 ==a==
11208 ===aa===
11209 ====aaa====
11210 ==b==
11211 ===ba===
11212 ===bb===
11213 ====bba====
11214 ===bc===
11215 ==c==
11216 ===ca===
11217 !! result
11218 ===ca===
11219 !! end
11220
11221 !! test
11222 Section extraction test (nonexistent section 11)
11223 !! options
11224 section=11
11225 !! input
11226 start
11227 ==a==
11228 ===aa===
11229 ====aaa====
11230 ==b==
11231 ===ba===
11232 ===bb===
11233 ====bba====
11234 ===bc===
11235 ==c==
11236 ===ca===
11237 !! result
11238 !! end
11239
11240 !! test
11241 Section extraction test with bogus heading (section 1)
11242 !! options
11243 section=1
11244 !! input
11245 ==a==
11246 ==bogus== not a legal section
11247 ==b==
11248 !! result
11249 ==a==
11250 ==bogus== not a legal section
11251 !! end
11252
11253 !! test
11254 Section extraction test with bogus heading (section 2)
11255 !! options
11256 section=2
11257 !! input
11258 ==a==
11259 ==bogus== not a legal section
11260 ==b==
11261 !! result
11262 ==b==
11263 !! end
11264
11265 !! test
11266 Section extraction test with comment after heading (section 1)
11267 !! options
11268 section=1
11269 !! input
11270 ==a==
11271 ==b== <!-- -->
11272 ==c==
11273 !! result
11274 ==a==
11275 !! end
11276
11277 !! test
11278 Section extraction test with comment after heading (section 2)
11279 !! options
11280 section=2
11281 !! input
11282 ==a==
11283 ==b== <!-- -->
11284 ==c==
11285 !! result
11286 ==b== <!-- -->
11287 !! end
11288
11289 !! test
11290 Section extraction test with bogus <nowiki> heading (section 1)
11291 !! options
11292 section=1
11293 !! input
11294 ==a==
11295 ==bogus== <nowiki>not a legal section</nowiki>
11296 ==b==
11297 !! result
11298 ==a==
11299 ==bogus== <nowiki>not a legal section</nowiki>
11300 !! end
11301
11302 !! test
11303 Section extraction test with bogus <nowiki> heading (section 2)
11304 !! options
11305 section=2
11306 !! input
11307 ==a==
11308 ==bogus== <nowiki>not a legal section</nowiki>
11309 ==b==
11310 !! result
11311 ==b==
11312 !! end
11313
11314
11315 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11316 # instead of respecting commented sections
11317 !! test
11318 Section extraction prefixed by comment (section 1)
11319 !! options
11320 section=1
11321 !! input
11322 <!-- -->==sec1==
11323 ==sec2==
11324 !!result
11325 ==sec2==
11326 !!end
11327
11328 !! test
11329 Section extraction prefixed by comment (section 2)
11330 !! options
11331 section=2
11332 !! input
11333 <!-- -->==sec1==
11334 ==sec2==
11335 !!result
11336
11337 !!end
11338
11339
11340 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11341 # instead of respecting HTML-style headings
11342 !! test
11343 Section extraction, mixed wiki and html (section 1)
11344 !! options
11345 section=1
11346 !! input
11347 <h2>unmarked</h2>
11348 unmarked
11349 ==1==
11350 one
11351 ==2==
11352 two
11353 !! result
11354 ==1==
11355 one
11356 !! end
11357
11358 !! test
11359 Section extraction, mixed wiki and html (section 2)
11360 !! options
11361 section=2
11362 !! input
11363 <h2>unmarked</h2>
11364 unmarked
11365 ==1==
11366 one
11367 ==2==
11368 two
11369 !! result
11370 ==2==
11371 two
11372 !! end
11373
11374
11375 # Formerly testing for bug 3342
11376 !! test
11377 Section extraction, heading surrounded by <noinclude>
11378 !! options
11379 section=1
11380 !! input
11381 <noinclude>==unmarked==</noinclude>
11382 ==marked==
11383 !! result
11384 ==marked==
11385 !!end
11386
11387 # Test behavior of bug 19910
11388 !! test
11389 Sectiion with all-equals
11390 !! options
11391 section=2
11392 !! input
11393 ===
11394 The line above must have a trailing space
11395 === <!--
11396 --> <!-- -->
11397 But just in case it doesn't...
11398 !! result
11399 === <!--
11400 --> <!-- -->
11401 But just in case it doesn't...
11402 !! end
11403
11404 !! test
11405 Section replacement test (section 0)
11406 !! options
11407 replace=0,"xxx"
11408 !! input
11409 start
11410 ==a==
11411 ===aa===
11412 ====aaa====
11413 ==b==
11414 ===ba===
11415 ===bb===
11416 ====bba====
11417 ===bc===
11418 ==c==
11419 ===ca===
11420 !! result
11421 xxx
11422
11423 ==a==
11424 ===aa===
11425 ====aaa====
11426 ==b==
11427 ===ba===
11428 ===bb===
11429 ====bba====
11430 ===bc===
11431 ==c==
11432 ===ca===
11433 !! end
11434
11435 !! test
11436 Section replacement test (section 1)
11437 !! options
11438 replace=1,"xxx"
11439 !! input
11440 start
11441 ==a==
11442 ===aa===
11443 ====aaa====
11444 ==b==
11445 ===ba===
11446 ===bb===
11447 ====bba====
11448 ===bc===
11449 ==c==
11450 ===ca===
11451 !! result
11452 start
11453 xxx
11454
11455 ==b==
11456 ===ba===
11457 ===bb===
11458 ====bba====
11459 ===bc===
11460 ==c==
11461 ===ca===
11462 !! end
11463
11464 !! test
11465 Section replacement test (section 2)
11466 !! options
11467 replace=2,"xxx"
11468 !! input
11469 start
11470 ==a==
11471 ===aa===
11472 ====aaa====
11473 ==b==
11474 ===ba===
11475 ===bb===
11476 ====bba====
11477 ===bc===
11478 ==c==
11479 ===ca===
11480 !! result
11481 start
11482 ==a==
11483 xxx
11484
11485 ==b==
11486 ===ba===
11487 ===bb===
11488 ====bba====
11489 ===bc===
11490 ==c==
11491 ===ca===
11492 !! end
11493
11494 !! test
11495 Section replacement test (section 3)
11496 !! options
11497 replace=3,"xxx"
11498 !! input
11499 start
11500 ==a==
11501 ===aa===
11502 ====aaa====
11503 ==b==
11504 ===ba===
11505 ===bb===
11506 ====bba====
11507 ===bc===
11508 ==c==
11509 ===ca===
11510 !! result
11511 start
11512 ==a==
11513 ===aa===
11514 xxx
11515
11516 ==b==
11517 ===ba===
11518 ===bb===
11519 ====bba====
11520 ===bc===
11521 ==c==
11522 ===ca===
11523 !! end
11524
11525 !! test
11526 Section replacement test (section 4)
11527 !! options
11528 replace=4,"xxx"
11529 !! input
11530 start
11531 ==a==
11532 ===aa===
11533 ====aaa====
11534 ==b==
11535 ===ba===
11536 ===bb===
11537 ====bba====
11538 ===bc===
11539 ==c==
11540 ===ca===
11541 !! result
11542 start
11543 ==a==
11544 ===aa===
11545 ====aaa====
11546 xxx
11547
11548 ==c==
11549 ===ca===
11550 !! end
11551
11552 !! test
11553 Section replacement test (section 5)
11554 !! options
11555 replace=5,"xxx"
11556 !! input
11557 start
11558 ==a==
11559 ===aa===
11560 ====aaa====
11561 ==b==
11562 ===ba===
11563 ===bb===
11564 ====bba====
11565 ===bc===
11566 ==c==
11567 ===ca===
11568 !! result
11569 start
11570 ==a==
11571 ===aa===
11572 ====aaa====
11573 ==b==
11574 xxx
11575
11576 ===bb===
11577 ====bba====
11578 ===bc===
11579 ==c==
11580 ===ca===
11581 !! end
11582
11583 !! test
11584 Section replacement test (section 6)
11585 !! options
11586 replace=6,"xxx"
11587 !! input
11588 start
11589 ==a==
11590 ===aa===
11591 ====aaa====
11592 ==b==
11593 ===ba===
11594 ===bb===
11595 ====bba====
11596 ===bc===
11597 ==c==
11598 ===ca===
11599 !! result
11600 start
11601 ==a==
11602 ===aa===
11603 ====aaa====
11604 ==b==
11605 ===ba===
11606 xxx
11607
11608 ===bc===
11609 ==c==
11610 ===ca===
11611 !! end
11612
11613 !! test
11614 Section replacement test (section 7)
11615 !! options
11616 replace=7,"xxx"
11617 !! input
11618 start
11619 ==a==
11620 ===aa===
11621 ====aaa====
11622 ==b==
11623 ===ba===
11624 ===bb===
11625 ====bba====
11626 ===bc===
11627 ==c==
11628 ===ca===
11629 !! result
11630 start
11631 ==a==
11632 ===aa===
11633 ====aaa====
11634 ==b==
11635 ===ba===
11636 ===bb===
11637 xxx
11638
11639 ===bc===
11640 ==c==
11641 ===ca===
11642 !! end
11643
11644 !! test
11645 Section replacement test (section 8)
11646 !! options
11647 replace=8,"xxx"
11648 !! input
11649 start
11650 ==a==
11651 ===aa===
11652 ====aaa====
11653 ==b==
11654 ===ba===
11655 ===bb===
11656 ====bba====
11657 ===bc===
11658 ==c==
11659 ===ca===
11660 !! result
11661 start
11662 ==a==
11663 ===aa===
11664 ====aaa====
11665 ==b==
11666 ===ba===
11667 ===bb===
11668 ====bba====
11669 xxx
11670
11671 ==c==
11672 ===ca===
11673 !!end
11674
11675 !! test
11676 Section replacement test (section 9)
11677 !! options
11678 replace=9,"xxx"
11679 !! input
11680 start
11681 ==a==
11682 ===aa===
11683 ====aaa====
11684 ==b==
11685 ===ba===
11686 ===bb===
11687 ====bba====
11688 ===bc===
11689 ==c==
11690 ===ca===
11691 !! result
11692 start
11693 ==a==
11694 ===aa===
11695 ====aaa====
11696 ==b==
11697 ===ba===
11698 ===bb===
11699 ====bba====
11700 ===bc===
11701 xxx
11702 !! end
11703
11704 !! test
11705 Section replacement test (section 10)
11706 !! options
11707 replace=10,"xxx"
11708 !! input
11709 start
11710 ==a==
11711 ===aa===
11712 ====aaa====
11713 ==b==
11714 ===ba===
11715 ===bb===
11716 ====bba====
11717 ===bc===
11718 ==c==
11719 ===ca===
11720 !! result
11721 start
11722 ==a==
11723 ===aa===
11724 ====aaa====
11725 ==b==
11726 ===ba===
11727 ===bb===
11728 ====bba====
11729 ===bc===
11730 ==c==
11731 xxx
11732 !! end
11733
11734 !! test
11735 Section replacement test with initial whitespace (bug 13728)
11736 !! options
11737 replace=2,"xxx"
11738 !! input
11739 Preformatted initial line
11740 ==a==
11741 ===a===
11742 !! result
11743 Preformatted initial line
11744 ==a==
11745 xxx
11746 !! end
11747
11748
11749 !! test
11750 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11751 !! options
11752 section=1
11753 !! input
11754 ==a==
11755 a
11756 !! result
11757 ==a==
11758 a
11759 !! end
11760
11761 !! test
11762 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11763 !! options
11764 section=1
11765 !! input
11766 ==a==
11767 a
11768 !! result
11769 ==a==
11770 a
11771 !! end
11772
11773
11774 !! test
11775 Section extraction, <pre> around bogus header (bug 10309)
11776 !! options
11777 noxml section=2
11778 !! input
11779 == Section One ==
11780 <pre>
11781 =======
11782 </pre>
11783
11784 == Section Two ==
11785 stuff
11786 !! result
11787 == Section Two ==
11788 stuff
11789 !! end
11790
11791 !! test
11792 Section replacement, <pre> around bogus header (bug 10309)
11793 !! options
11794 noxml replace=2,"xxx"
11795 !! input
11796 == Section One ==
11797 <pre>
11798 =======
11799 </pre>
11800
11801 == Section Two ==
11802 stuff
11803 !! result
11804 == Section One ==
11805 <pre>
11806 =======
11807 </pre>
11808
11809 xxx
11810 !! end
11811
11812
11813
11814 !! test
11815 Handling of &#x0A; in URLs
11816 !! input
11817 **irc://&#x0A;a
11818 !! result
11819 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11820 </li></ul>
11821 </li></ul>
11822
11823 !!end
11824
11825 !! test
11826 5 quotes, code coverage +1 line (php)
11827 !! options
11828 php
11829 !! input
11830 '''''
11831 !! result
11832 !! end
11833 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11834 !! test
11835 5 quotes, code coverage +1 line (parsoid)
11836 !! options
11837 parsoid
11838 !! input
11839 '''''
11840 !! result
11841 <p><i><b></b></i></p>
11842 !! end
11843
11844 !! test
11845 Special:Search page linking.
11846 !! input
11847 {{Special:search}}
11848 !! result
11849 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11850 </p>
11851 !! end
11852
11853 !! test
11854 Say the magic word
11855 !! input
11856 * {{PAGENAME}}
11857 * {{BASEPAGENAME}}
11858 * {{SUBPAGENAME}}
11859 * {{SUBPAGENAMEE}}
11860 * {{ROOTPAGENAME}}
11861 * {{ROOTPAGENAMEE}}
11862 * {{BASEPAGENAME}}
11863 * {{BASEPAGENAMEE}}
11864 * {{TALKPAGENAME}}
11865 * {{TALKPAGENAMEE}}
11866 * {{SUBJECTPAGENAME}}
11867 * {{SUBJECTPAGENAMEE}}
11868 * {{NAMESPACEE}}
11869 * {{NAMESPACE}}
11870 * {{TALKSPACE}}
11871 * {{TALKSPACEE}}
11872 * {{SUBJECTSPACE}}
11873 * {{SUBJECTSPACEE}}
11874 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11875 !! result
11876 <ul><li> Parser test
11877 </li><li> Parser test
11878 </li><li> Parser test
11879 </li><li> Parser_test
11880 </li><li> Parser test
11881 </li><li> Parser_test
11882 </li><li> Parser test
11883 </li><li> Parser_test
11884 </li><li> Talk:Parser test
11885 </li><li> Talk:Parser_test
11886 </li><li> Parser test
11887 </li><li> Parser_test
11888 </li><li>
11889 </li><li>
11890 </li><li> Talk
11891 </li><li> Talk
11892 </li><li>
11893 </li><li>
11894 </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>
11895 </li></ul>
11896
11897 !! end
11898 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11899
11900 !! test
11901 Gallery
11902 !! input
11903 <gallery>
11904 image1.png |
11905 image2.gif|||||
11906
11907 image3|
11908 image4 |300px| centre
11909 image5.svg| http://///////
11910 [[x|xx]]]]
11911 * image6
11912 </gallery>
11913 !! result
11914 <ul class="gallery">
11915 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11916 <div style="height: 150px;">Image1.png</div>
11917 <div class="gallerytext">
11918 </div>
11919 </div></li>
11920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11921 <div style="height: 150px;">Image2.gif</div>
11922 <div class="gallerytext">
11923 <p>||||
11924 </p>
11925 </div>
11926 </div></li>
11927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11928 <div style="height: 150px;">Image3</div>
11929 <div class="gallerytext">
11930 </div>
11931 </div></li>
11932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11933 <div style="height: 150px;">Image4</div>
11934 <div class="gallerytext">
11935 <p>300px| centre
11936 </p>
11937 </div>
11938 </div></li>
11939 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11940 <div style="height: 150px;">Image5.svg</div>
11941 <div class="gallerytext">
11942 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11943 </p>
11944 </div>
11945 </div></li>
11946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11947 <div style="height: 150px;">* image6</div>
11948 <div class="gallerytext">
11949 </div>
11950 </div></li>
11951 </ul>
11952
11953 !! end
11954
11955 !! test
11956 Gallery (with options)
11957 !! input
11958 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11959 File:Nonexistant.jpg|caption
11960 File:Nonexistant.jpg
11961 image:foobar.jpg|some '''caption''' [[Main Page]]
11962 image:foobar.jpg
11963 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11964 </gallery>
11965 !! result
11966 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11967 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11968 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11969 <div style="height: 70px;">Nonexistant.jpg</div>
11970 <div class="gallerytext">
11971 <p>caption
11972 </p>
11973 </div>
11974 </div></li>
11975 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11976 <div style="height: 70px;">Nonexistant.jpg</div>
11977 <div class="gallerytext">
11978 </div>
11979 </div></li>
11980 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11981 <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>
11982 <div class="gallerytext">
11983 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11984 </p>
11985 </div>
11986 </div></li>
11987 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11988 <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>
11989 <div class="gallerytext">
11990 </div>
11991 </div></li>
11992 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11993 <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>
11994 <div class="gallerytext">
11995 <p>Blabla|blabla.
11996 </p>
11997 </div>
11998 </div></li>
11999 </ul>
12000
12001 !! end
12002
12003 !! test
12004 Gallery with wikitext inside caption
12005 !! input
12006 <gallery>
12007 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12008 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12009 </gallery>
12010 !! result
12011 <ul class="gallery">
12012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12013 <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>
12014 <div class="gallerytext">
12015 <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>
12016 </p>
12017 </div>
12018 </div></li>
12019 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12020 <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>
12021 <div class="gallerytext">
12022 <p>This is a test template
12023 </p>
12024 </div>
12025 </div></li>
12026 </ul>
12027
12028 !! end
12029
12030 !! test
12031 gallery (with showfilename option)
12032 !! input
12033 <gallery showfilename>
12034 File:Nonexistant.jpg|caption
12035 File:Nonexistant.jpg
12036 image:foobar.jpg|some '''caption''' [[Main Page]]
12037 File:Foobar.jpg
12038 </gallery>
12039 !! result
12040 <ul class="gallery">
12041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12042 <div style="height: 150px;">Nonexistant.jpg</div>
12043 <div class="gallerytext">
12044 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12045 caption
12046 </p>
12047 </div>
12048 </div></li>
12049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12050 <div style="height: 150px;">Nonexistant.jpg</div>
12051 <div class="gallerytext">
12052 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12053 </p>
12054 </div>
12055 </div></li>
12056 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12057 <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>
12058 <div class="gallerytext">
12059 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12060 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12061 </p>
12062 </div>
12063 </div></li>
12064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12065 <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>
12066 <div class="gallerytext">
12067 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12068 </p>
12069 </div>
12070 </div></li>
12071 </ul>
12072
12073 !! end
12074
12075 !! test
12076 Gallery (with namespace-less filenames)
12077 !! input
12078 <gallery>
12079 File:Nonexistant.jpg
12080 Nonexistant.jpg
12081 image:foobar.jpg
12082 foobar.jpg
12083 </gallery>
12084 !! result
12085 <ul class="gallery">
12086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12087 <div style="height: 150px;">Nonexistant.jpg</div>
12088 <div class="gallerytext">
12089 </div>
12090 </div></li>
12091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12092 <div style="height: 150px;">Nonexistant.jpg</div>
12093 <div class="gallerytext">
12094 </div>
12095 </div></li>
12096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12097 <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>
12098 <div class="gallerytext">
12099 </div>
12100 </div></li>
12101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12102 <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>
12103 <div class="gallerytext">
12104 </div>
12105 </div></li>
12106 </ul>
12107
12108 !! end
12109
12110 !! test
12111 HTML Hex character encoding (spells the word "JavaScript")
12112 !! input
12113 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12114 !! result
12115 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12116 </p>
12117 !! end
12118
12119 !! test
12120 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12121 !! input
12122 &#xsee;&#XSEE;
12123 !! result
12124 <p>&amp;#xsee;&amp;#XSEE;
12125 </p>
12126 !! end
12127
12128 !! test
12129 HTML Hex character encoding mixed case
12130 !! input
12131 &#xEE;&#Xee;
12132 !! result
12133 <p>&#xee;&#xee;
12134 </p>
12135 !! end
12136
12137 !! test
12138 __FORCETOC__ override
12139 !! input
12140 __NEWSECTIONLINK__
12141 __FORCETOC__
12142 !! result
12143 <p><br />
12144 </p>
12145 !! end
12146
12147 !! test
12148 ISBN code coverage
12149 !! input
12150 ISBN 978-0-1234-56&#x20;789
12151 !! result
12152 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12153 </p>
12154 !! end
12155
12156 !! test
12157 ISBN followed by 5 spaces
12158 !! input
12159 ISBN
12160 !! result
12161 <p>ISBN
12162 </p>
12163 !! end
12164
12165 !! test
12166 Double ISBN
12167 !! input
12168 ISBN ISBN 1234567890
12169 !! result
12170 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12171 </p>
12172 !! end
12173
12174 !! test
12175 Bug 22905: <abbr> followed by ISBN followed by </a>
12176 !! input
12177 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12178 !! result
12179 <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>
12180 </p>
12181 !! end
12182
12183 !! test
12184 Double RFC
12185 !! input
12186 RFC RFC 1234
12187 !! result
12188 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12189 </p>
12190 !! end
12191
12192 !! test
12193 Double RFC with a wiki link
12194 !! input
12195 RFC [[RFC 1234]]
12196 !! result
12197 <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>
12198 </p>
12199 !! end
12200
12201 !! test
12202 RFC code coverage
12203 !! input
12204 RFC 983&#x20;987
12205 !! result
12206 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12207 </p>
12208 !! end
12209
12210 !! test
12211 Centre-aligned image
12212 !! input
12213 [[Image:foobar.jpg|centre]]
12214 !! result
12215 <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>
12216
12217 !!end
12218
12219 !! test
12220 None-aligned image
12221 !! input
12222 [[Image:foobar.jpg|none]]
12223 !! result
12224 <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>
12225
12226 !!end
12227
12228 !! test
12229 Width + Height sized image (using px) (height is ignored)
12230 !! input
12231 [[Image:foobar.jpg|640x480px]]
12232 !! result
12233 <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>
12234 </p>
12235 !!end
12236
12237 !! test
12238 Width-sized image (using px, no following whitespace)
12239 !! input
12240 [[Image:foobar.jpg|640px]]
12241 !! result
12242 <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>
12243 </p>
12244 !!end
12245
12246 !! test
12247 Width-sized image (using px, with following whitespace - test regression from r39467)
12248 !! input
12249 [[Image:foobar.jpg|640px ]]
12250 !! result
12251 <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>
12252 </p>
12253 !!end
12254
12255 !! test
12256 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12257 !! input
12258 [[Image:foobar.jpg| 640px]]
12259 !! result
12260 <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>
12261 </p>
12262 !!end
12263
12264 !! test
12265 Another italics / bold test
12266 !! input
12267 ''' ''x'
12268 !! result
12269 <pre>'<i> </i>x'
12270 </pre>
12271 !!end
12272
12273 # Note the results may be incorrect, as parserTest output included this:
12274 # XML error: Mismatched tag at byte 6120:
12275 # ...<dd> </dt></dl> </dd...
12276 !! test
12277 dt/dd/dl test
12278 !! options
12279 disabled
12280 !! input
12281 :;;;::
12282 !! result
12283 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12284 </dd></dl>
12285 </dd></dl>
12286 </dt></dl>
12287 </dt></dl>
12288 </dt></dl>
12289 </dd></dl>
12290
12291 !!end
12292
12293
12294 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12295 !! test
12296 Images with the "|" character in the comment
12297 !! input
12298 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12299 !! result
12300 <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>
12301
12302 !!end
12303
12304 !! test
12305 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12306 !! input
12307 <html><script>alert(1);</script></html>
12308 !! result
12309 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12310 </p>
12311 !! end
12312
12313 !! test
12314 HTML with raw HTML ($wgRawHtml==true)
12315 !! options
12316 rawhtml
12317 !! input
12318 <html><script>alert(1);</script></html>
12319 !! result
12320 <p><script>alert(1);</script>
12321 </p>
12322 !! end
12323
12324 !! test
12325 Parents of subpages, one level up
12326 !! options
12327 subpage title=[[Subpage test/L1/L2/L3]]
12328 !! input
12329 [[../|L2]]
12330 !! result
12331 <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>
12332 </p>
12333 !! end
12334
12335
12336 !! test
12337 Parents of subpages, one level up, not named
12338 !! options
12339 subpage title=[[Subpage test/L1/L2/L3]]
12340 !! input
12341 [[../]]
12342 !! result
12343 <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>
12344 </p>
12345 !! end
12346
12347
12348
12349 !! test
12350 Parents of subpages, two levels up
12351 !! options
12352 subpage title=[[Subpage test/L1/L2/L3]]
12353 !! input
12354 [[../../|L1]]2
12355
12356 [[../../|L1]]l
12357 !! result
12358 <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
12359 </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>
12360 </p>
12361 !! end
12362
12363 !! test
12364 Parents of subpages, two levels up, without trailing slash or name.
12365 !! options
12366 subpage title=[[Subpage test/L1/L2/L3]]
12367 !! input
12368 [[../..]]
12369 !! result
12370 <p>[[../..]]
12371 </p>
12372 !! end
12373
12374 !! test
12375 Parents of subpages, two levels up, with lots of extra trailing slashes.
12376 !! options
12377 subpage title=[[Subpage test/L1/L2/L3]]
12378 !! input
12379 [[../../////]]
12380 !! result
12381 <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>
12382 </p>
12383 !! end
12384
12385 !! article
12386 Subpage test/L1/L2/L3Sibling
12387 !! text
12388 Sibling article
12389 !! endarticle
12390
12391 !! test
12392 Transclusion of a sibling page (one level up)
12393 !! options
12394 subpage title=[[Subpage test/L1/L2/L3]]
12395 !! input
12396 {{../L3Sibling}}
12397 !! result
12398 <p>Sibling article
12399 </p>
12400 !! end
12401
12402 !! test
12403 Transclusion of a child page
12404 !! options
12405 subpage title=[[Subpage test/L1/L2]]
12406 !! input
12407 {{/L3Sibling}}
12408 !! result
12409 <p>Sibling article
12410 </p>
12411 !! end
12412
12413 !! test
12414 Non-transclusion because of too many up levels
12415 !! options
12416 subpage title=[[Subpage test/L1/L2/L3]]
12417 !! input
12418 {{../../../../More than parent}}
12419 !! result
12420 <p>{{../../../../More than parent}}
12421 </p>
12422 !! end
12423
12424 !! test
12425 Definition list code coverage
12426 !! input
12427 ; title : def
12428 ; title : def
12429 ;title: def
12430 !! result
12431 <dl><dt> title &#160;</dt><dd> def
12432 </dd><dt> title&#160;</dt><dd> def
12433 </dd><dt>title</dt><dd> def
12434 </dd></dl>
12435
12436 !! end
12437
12438 !! test
12439 Don't fall for the self-closing div
12440 !! input
12441 <div>hello world</div/>
12442 !! result
12443 <div>hello world</div>
12444
12445 !! end
12446
12447 !! test
12448 MSGNW magic word
12449 !! input
12450 {{MSGNW:msg}}
12451 !! result
12452 <p>&#91;&#91;:Template:Msg&#93;&#93;
12453 </p>
12454 !! end
12455
12456 !! test
12457 RAW magic word
12458 !! input
12459 {{RAW:QUERTY}}
12460 !! result
12461 <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>
12462 </p>
12463 !! end
12464
12465 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12466 !! test
12467 Always escape literal '>' in output, not just after '<'
12468 !! input
12469 ><>
12470 !! result
12471 <p>&gt;&lt;&gt;
12472 </p>
12473 !! end
12474
12475 !! test
12476 Template caching
12477 !! input
12478 {{Test}}
12479 {{Test}}
12480 !! result
12481 <p>This is a test template
12482 This is a test template
12483 </p>
12484 !! end
12485
12486
12487 !! article
12488 MediaWiki:Fake
12489 !! text
12490 ==header==
12491 !! endarticle
12492
12493 !! test
12494 Inclusion of !userCanEdit() content
12495 !! input
12496 {{MediaWiki:Fake}}
12497 !! result
12498 <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>
12499
12500 !! end
12501
12502
12503 !! test
12504 Out-of-order TOC heading levels
12505 !! input
12506 ==2==
12507 ======6======
12508 ===3===
12509 =1=
12510 =====5=====
12511 ==2==
12512 !! result
12513 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12514 <ul>
12515 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12516 <ul>
12517 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12518 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12519 </ul>
12520 </li>
12521 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12522 <ul>
12523 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12524 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12525 </ul>
12526 </li>
12527 </ul>
12528 </div>
12529 <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>
12530 <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>
12531 <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>
12532 <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>
12533 <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>
12534 <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>
12535
12536 !! end
12537
12538
12539 !! test
12540 ISBN with a dummy number
12541 !! input
12542 ISBN ---
12543 !! result
12544 <p>ISBN ---
12545 </p>
12546 !! end
12547
12548
12549 !! test
12550 ISBN with space-delimited number
12551 !! input
12552 ISBN 92 9017 032 8
12553 !! result
12554 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12555 </p>
12556 !! end
12557
12558
12559 !! test
12560 ISBN with multiple spaces, no number
12561 !! input
12562 ISBN foo
12563 !! result
12564 <p>ISBN foo
12565 </p>
12566 !! end
12567
12568
12569 !! test
12570 ISBN length
12571 !! input
12572 ISBN 123456789
12573
12574 ISBN 1234567890
12575
12576 ISBN 12345678901
12577 !! result
12578 <p>ISBN 123456789
12579 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12580 </p><p>ISBN 12345678901
12581 </p>
12582 !! end
12583
12584
12585 !! test
12586 ISBN with trailing year (bug 8110)
12587 !! input
12588 ISBN 1-234-56789-0 - 2006
12589
12590 ISBN 1 234 56789 0 - 2006
12591 !! result
12592 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12593 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12594 </p>
12595 !! end
12596
12597
12598 !! test
12599 anchorencode
12600 !! input
12601 {{anchorencode:foo bar©#%n}}
12602 !! result
12603 <p>foo_bar.C2.A9.23.25n
12604 </p>
12605 !! end
12606
12607 !! test
12608 anchorencode trims spaces
12609 !! input
12610 {{anchorencode: __pretty__please__}}
12611 !! result
12612 <p>pretty_please
12613 </p>
12614 !! end
12615
12616 !! test
12617 anchorencode deals with links
12618 !! input
12619 {{anchorencode: [[hello|world]] [[hi]]}}
12620 !! result
12621 <p>world_hi
12622 </p>
12623 !! end
12624
12625 !! test
12626 anchorencode deals with templates
12627 !! input
12628 {{anchorencode: {{Foo}} }}
12629 !! result
12630 <p>FOO
12631 </p>
12632 !! end
12633
12634 !! test
12635 anchorencode encodes like the TOC generator: (bug 18431)
12636 !! input
12637 === _ +:.3A%3A&&amp;]] ===
12638 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12639 __NOEDITSECTION__
12640 !! result
12641 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12642 <p>.2B:.3A.253A.26.26.5D.5D
12643 </p>
12644 !! end
12645
12646 # Expected output in the following test is not necessarily expected (there
12647 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12648 # only testing for well-formedness.
12649 !! test
12650 Bug 6200: blockquotes and paragraph formatting
12651 !! input
12652 <blockquote>
12653 foo
12654 </blockquote>
12655
12656 bar
12657
12658 baz
12659 !! result
12660 <blockquote>
12661 foo
12662 </blockquote>
12663 <p>bar
12664 </p>
12665 <pre>baz
12666 </pre>
12667 !! end
12668
12669 !! test
12670 Bug 8293: Use of center tag ruins paragraph formatting
12671 !! input
12672 <center>
12673 foo
12674 </center>
12675
12676 bar
12677
12678 baz
12679 !! result
12680 <center>
12681 <p>foo
12682 </p>
12683 </center>
12684 <p>bar
12685 </p>
12686 <pre>baz
12687 </pre>
12688 !! end
12689
12690 !!test
12691 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12692 !!options
12693 php
12694 !!input
12695 <span><s>x</span></s>
12696 !!result
12697 <p><span><s>x&lt;/span&gt;</s></span>
12698 </p>
12699 !!end
12700
12701 !!test
12702 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12703 !!options
12704 parsoid
12705 !!input
12706 <span><s>x</span></s>
12707 !!result
12708 <p><span><s>x</s></span><s></s>
12709 </p>
12710 !!end
12711
12712 ###
12713 ### Language variants related tests
12714 ###
12715 !! test
12716 Self-link in language variants
12717 !! options
12718 title=[[Dunav]] language=sr
12719 !! input
12720 Both [[Dunav]] and [[Дунав]] are names for this river.
12721 !! result
12722 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12723 </p>
12724 !!end
12725
12726 !! article
12727 Дуна
12728 !! text
12729 content
12730 !! endarticle
12731
12732 !! test
12733 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12734 !! options
12735 title=[[Duna]] language=sr
12736 !! input
12737 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12738 !! result
12739 <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.
12740 </p>
12741 !! end
12742
12743 !! test
12744 Link to pages in language variants
12745 !! options
12746 language=sr
12747 !! input
12748 Main Page can be written as [[Маин Паге]]
12749 !! result
12750 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12751 </p>
12752 !!end
12753
12754
12755 !! test
12756 Multiple links to pages in language variants
12757 !! options
12758 language=sr
12759 !! input
12760 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12761 !! result
12762 <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>.
12763 </p>
12764 !!end
12765
12766
12767 !! test
12768 Simple template in language variants
12769 !! options
12770 language=sr
12771 !! input
12772 {{тест}}
12773 !! result
12774 <p>This is a test template
12775 </p>
12776 !! end
12777
12778
12779 !! test
12780 Template with explicit namespace in language variants
12781 !! options
12782 language=sr
12783 !! input
12784 {{Template:тест}}
12785 !! result
12786 <p>This is a test template
12787 </p>
12788 !! end
12789
12790
12791 !! test
12792 Basic test for template parameter in language variants
12793 !! options
12794 language=sr
12795 !! input
12796 {{парамтест|param=foo}}
12797 !! result
12798 <p>This is a test template with parameter foo
12799 </p>
12800 !! end
12801
12802
12803 !! test
12804 Simple category in language variants
12805 !! options
12806 language=sr cat
12807 !! input
12808 [[Category:МедиаWики Усер'с Гуиде]]
12809 !! result
12810 <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>
12811 !! end
12812
12813
12814 !! article
12815 Category:分类
12816 !! text
12817 blah
12818 !! endarticle
12819
12820 !! article
12821 Category:分類
12822 !! text
12823 blah
12824 !! endarticle
12825
12826 !! test
12827 Don't convert blue categorylinks to another variant (bug 33210)
12828 !! options
12829 language=zh cat
12830 !! input
12831 [[A]][[Category:分类]]
12832 !! result
12833 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12834 !! end
12835
12836
12837 !! test
12838 Stripping -{}- tags (language variants)
12839 !! options
12840 language=sr
12841 !! input
12842 Latin proverb: -{Ne nuntium necare}-
12843 !! result
12844 <p>Latin proverb: Ne nuntium necare
12845 </p>
12846 !! end
12847
12848
12849 !! test
12850 Prevent conversion with -{}- tags (language variants)
12851 !! options
12852 language=sr variant=sr-ec
12853 !! input
12854 Latinski: -{Ne nuntium necare}-
12855 !! result
12856 <p>Латински: Ne nuntium necare
12857 </p>
12858 !! end
12859
12860
12861 !! test
12862 Prevent conversion of text with -{}- tags (language variants)
12863 !! options
12864 language=sr variant=sr-ec
12865 !! input
12866 Latinski: -{Ne nuntium necare}-
12867 !! result
12868 <p>Латински: Ne nuntium necare
12869 </p>
12870 !! end
12871
12872
12873 !! test
12874 Prevent conversion of links with -{}- tags (language variants)
12875 !! options
12876 language=sr variant=sr-ec
12877 !! input
12878 -{[[Main Page]]}-
12879 !! result
12880 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12881 </p>
12882 !! end
12883
12884
12885 !! test
12886 -{}- tags within headlines (within html for parserConvert())
12887 !! options
12888 language=sr variant=sr-ec
12889 !! input
12890 == -{Naslov}- ==
12891 !! result
12892 <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>
12893
12894 !! end
12895
12896
12897 !! test
12898 Explicit definition of language variant alternatives
12899 !! options
12900 language=zh variant=zh-tw
12901 !! input
12902 -{zh:China;zh-tw:Taiwan}-, not China
12903 !! result
12904 <p>Taiwan, not China
12905 </p>
12906 !! end
12907
12908
12909 !! test
12910 Conversion around HTML tags
12911 !! options
12912 language=sr variant=sr-ec
12913 !! input
12914 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12915 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12916 !! result
12917 <p>
12918 <span title="ЛаCтин">ски</span>
12919 </p>
12920 !! end
12921
12922
12923 !! test
12924 Explicit session-wise language variant mapping (A flag and - flag)
12925 !! options
12926 language=zh variant=zh-tw
12927 !! input
12928 Taiwan is not China.
12929 But -{A|zh:China;zh-tw:Taiwan}- is China,
12930 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12931 and -{China}- is China.
12932 !! result
12933 <p>Taiwan is not China.
12934 But Taiwan is Taiwan,
12935 (This should be stripped!)
12936 and China is China.
12937 </p>
12938 !! end
12939
12940 !! test
12941 Explicit session-wise language variant mapping (H flag for hide)
12942 !! options
12943 language=zh variant=zh-tw
12944 !! input
12945 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12946 Taiwan is China.
12947 !! result
12948 <p>(This should be stripped!)
12949 Taiwan is Taiwan.
12950 </p>
12951 !! end
12952
12953 !! test
12954 Adding explicit conversion rule for title (T flag)
12955 !! options
12956 language=zh variant=zh-tw showtitle
12957 !! input
12958 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12959 !! result
12960 Taiwan
12961 <p>Should be stripped!
12962 </p>
12963 !! end
12964
12965 !! test
12966 Testing that changing the language variant here in the tests actually works
12967 !! options
12968 language=zh variant=zh showtitle
12969 !! input
12970 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12971 !! result
12972 China
12973 <p>Should be stripped!
12974 </p>
12975 !! end
12976
12977 !! test
12978 Recursive conversion of alt and title attrs shouldn't clear converter state
12979 !! options
12980 language=zh variant=zh-cn showtitle
12981 !! input
12982 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12983 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12984 !! result
12985 China
12986 <p>
12987 Should be stripped<span title="Exclamation">!</span>
12988 </p>
12989 !! end
12990
12991 !! test
12992 Bug 24072: more test on conversion rule for title
12993 !! options
12994 language=zh variant=zh-tw showtitle
12995 !! input
12996 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12997 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12998 !! result
12999 Taiwan
13000 <p>This should be stripped!
13001 This won't take interferes with the title rule.
13002 </p>
13003 !! end
13004
13005 !! test
13006 Partly disable title conversion if variant == main language code
13007 !! options
13008 language=zh variant=zh title=[[ZH]] showtitle
13009 !! input
13010 -{T|zh-cn:CN;zh-tw:TW}-
13011 !! result
13012 ZH
13013 <p>
13014 </p>
13015 !! end
13016
13017 !! test
13018 Partly disable title conversion if variant == main language code, more
13019 !! options
13020 language=zh variant=zh title=[[ZH]] showtitle
13021 !! input
13022 -{T|TW}-
13023 !! result
13024 ZH
13025 <p>
13026 </p>
13027 !! end
13028
13029 !! test
13030 Raw output of variant escape tags (R flag)
13031 !! options
13032 language=zh variant=zh-tw
13033 !! input
13034 Raw: -{R|zh:China;zh-tw:Taiwan}-
13035 !! result
13036 <p>Raw: zh:China;zh-tw:Taiwan
13037 </p>
13038 !! end
13039
13040 !! test
13041 Nested using of manual convert syntax
13042 !! options
13043 language=zh variant=zh-hk
13044 !! input
13045 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13046 !! result
13047 <p>Nested: Hello Hong Kong!
13048 </p>
13049 !! end
13050
13051 !! test
13052 Proper conversion of text in external links
13053 !! options
13054 language=sr variant=sr-ec
13055 !! input
13056 http://www.google.com
13057 gopher://www.google.com
13058 [http://www.google.com http://www.google.com]
13059 [gopher://www.google.com gopher://www.google.com]
13060 [https://www.google.com irc://www.google.com]
13061 [ftp://www.google.com www.google.com/ftp://dir]
13062 [//www.google.com www.google.com]
13063 !! result
13064 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13065 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13066 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13067 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13068 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13069 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13070 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13071 </p>
13072 !! end
13073
13074 !! test
13075 Do not convert roman numbers to language variants
13076 !! options
13077 language=sr variant=sr-ec
13078 !! input
13079 Fridrih IV je car.
13080 !! result
13081 <p>Фридрих IV је цар.
13082 </p>
13083 !! end
13084
13085 !! test
13086 Unclosed language converter markup "-{"
13087 !! options
13088 language=sr
13089 !! input
13090 -{T|hello
13091 !! result
13092 <p>-{T|hello
13093 </p>
13094 !! end
13095
13096 !! test
13097 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13098 !! options
13099 language=sr
13100 !! input
13101 -{R|=&gt;}-
13102 !! result
13103 <p>=&gt;
13104 </p>
13105 !!end
13106
13107 !!article
13108 Template:Bullet
13109 !!text
13110 * Bar
13111 !!endarticle
13112
13113 !! test
13114 Bug 529: Uncovered bullet
13115 !! input
13116 * Foo {{bullet}}
13117 !! result
13118 <ul><li> Foo
13119 </li><li> Bar
13120 </li></ul>
13121
13122 !! end
13123
13124 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13125 # Templates in Wikipedia rely on this behavior, as tidy has always been
13126 # enabled there. These tests are normally run *without* tidy, so specify the
13127 # full output here.
13128 # To test realistic parsing behavior, apply a tidy-like transformation to both
13129 # the expected output and your parser's output.
13130 !! test
13131 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13132 !! input
13133 ******* Foo {{bullet}}
13134 !! result
13135 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13136 </li></ul>
13137 </li></ul>
13138 </li></ul>
13139 </li></ul>
13140 </li></ul>
13141 </li></ul>
13142 </li><li> Bar
13143 </li></ul>
13144
13145 !! end
13146
13147 !! test
13148 Bug 529: Uncovered table already at line-start
13149 !! input
13150 x
13151
13152 {{table}}
13153 y
13154 !! result
13155 <p>x
13156 </p>
13157 <table>
13158 <tr>
13159 <td> 1 </td>
13160 <td> 2
13161 </td></tr>
13162 <tr>
13163 <td> 3 </td>
13164 <td> 4
13165 </td></tr></table>
13166 <p>y
13167 </p>
13168 !! end
13169
13170 !! test
13171 Bug 529: Uncovered bullet in parser function result
13172 !! input
13173 * Foo {{lc:{{bullet}} }}
13174 !! result
13175 <ul><li> Foo
13176 </li><li> bar
13177 </li></ul>
13178
13179 !! end
13180
13181 !! test
13182 Bug 5678: Double-parsed template argument
13183 !! input
13184 {{lc:{{{1}}}|hello}}
13185 !! result
13186 <p>{{{1}}}
13187 </p>
13188 !! end
13189
13190 !! test
13191 Bug 5678: Double-parsed template invocation
13192 !! input
13193 {{lc:{{paramtest {{!}} param = hello }} }}
13194 !! result
13195 <p>{{paramtest | param = hello }}
13196 </p>
13197 !! end
13198
13199 !! test
13200 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13201 !! options
13202 language=cs
13203 title=[[Main Page]]
13204 !! input
13205 {{PRVNÍVELKÉ:ěščř}}
13206 {{prvnívelké:ěščř}}
13207 {{PRVNÍMALÉ:ěščř}}
13208 {{prvnímalé:ěščř}}
13209 {{MALÁ:ěščř}}
13210 {{malá:ěščř}}
13211 {{VELKÁ:ěščř}}
13212 {{velká:ěščř}}
13213 !! result
13214 <p>Ěščř
13215 Ěščř
13216 ěščř
13217 ěščř
13218 ěščř
13219 ěščř
13220 ĚŠČŘ
13221 ĚŠČŘ
13222 </p>
13223 !! end
13224
13225 !! test
13226 Morwen/13: Unclosed link followed by heading
13227 !! input
13228 [[link
13229 ==heading==
13230 !! result
13231 <p>[[link
13232 </p>
13233 <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>
13234
13235 !! end
13236
13237 !! test
13238 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13239 !! input
13240 {{foo|
13241 =heading=
13242 !! result
13243 <p>{{foo|
13244 </p>
13245 <h1><span class="mw-headline" id="heading">heading</span></h1>
13246
13247 !! end
13248
13249 !! test
13250 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13251 !! input
13252 {{foo|
13253 ==heading==
13254 !! result
13255 <p>{{foo|
13256 </p>
13257 <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>
13258
13259 !! end
13260
13261 !! test
13262 Tildes in comments
13263 !! options
13264 pst
13265 !! input
13266 <!-- ~~~~ -->
13267 !! result
13268 <!-- ~~~~ -->
13269 !! end
13270
13271 !! test
13272 Paragraphs inside divs (no extra line breaks)
13273 !! input
13274 <div>Line one
13275
13276 Line two</div>
13277 !! result
13278 <div>Line one
13279 Line two</div>
13280
13281 !! end
13282
13283 !! test
13284 Paragraphs inside divs (extra line break on open)
13285 !! input
13286 <div>
13287 Line one
13288
13289 Line two</div>
13290 !! result
13291 <div>
13292 <p>Line one
13293 </p>
13294 Line two</div>
13295
13296 !! end
13297
13298 !! test
13299 Paragraphs inside divs (extra line break on close)
13300 !! input
13301 <div>Line one
13302
13303 Line two
13304 </div>
13305 !! result
13306 <div>Line one
13307 <p>Line two
13308 </p>
13309 </div>
13310
13311 !! end
13312
13313 !! test
13314 Paragraphs inside divs (extra line break on open and close)
13315 !! input
13316 <div>
13317 Line one
13318
13319 Line two
13320 </div>
13321 !! result
13322 <div>
13323 <p>Line one
13324 </p><p>Line two
13325 </p>
13326 </div>
13327
13328 !! end
13329
13330 !! test
13331 Nesting tags, paragraphs on lines which begin with <div>
13332 !! options
13333 disabled
13334 !! input
13335 <div></div><strong>A
13336 B</strong>
13337 !! result
13338 <div></div>
13339 <p><strong>A
13340 B</strong>
13341 </p>
13342 !! end
13343
13344 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13345 !! test
13346 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13347 !! options
13348 disabled
13349 !! input
13350 <blockquote>Line one
13351
13352 Line two</blockquote>
13353 !! result
13354 <blockquote>Line one
13355 Line two</blockquote>
13356
13357 !! end
13358
13359 !! test
13360 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13361 !! options
13362 disabled
13363 !! input
13364 <blockquote>
13365 Line one
13366
13367 Line two</blockquote>
13368 !! result
13369 <blockquote>
13370 <p>Line one
13371 </p>
13372 Line two</blockquote>
13373
13374 !! end
13375
13376 !! test
13377 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13378 !! options
13379 disabled
13380 !! input
13381 <blockquote>Line one
13382
13383 Line two
13384 </blockquote>
13385 !! result
13386 <blockquote>Line one
13387 <p>Line two
13388 </p>
13389 </blockquote>
13390
13391 !! end
13392
13393 !! test
13394 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13395 !! options
13396 disabled
13397 !! input
13398 <blockquote>
13399 Line one
13400
13401 Line two
13402 </blockquote>
13403 !! result
13404 <blockquote>
13405 <p>Line one
13406 </p><p>Line two
13407 </p>
13408 </blockquote>
13409
13410 !! end
13411
13412 !! test
13413 Paragraphs inside blockquotes/divs (no extra line breaks)
13414 !! input
13415 <blockquote><div>Line one
13416
13417 Line two</div></blockquote>
13418 !! result
13419 <blockquote><div>Line one
13420 Line two</div></blockquote>
13421
13422 !! end
13423
13424 !! test
13425 Paragraphs inside blockquotes/divs (extra line break on open)
13426 !! input
13427 <blockquote><div>
13428 Line one
13429
13430 Line two</div></blockquote>
13431 !! result
13432 <blockquote><div>
13433 <p>Line one
13434 </p>
13435 Line two</div></blockquote>
13436
13437 !! end
13438
13439 !! test
13440 Paragraphs inside blockquotes/divs (extra line break on close)
13441 !! input
13442 <blockquote><div>Line one
13443
13444 Line two
13445 </div></blockquote>
13446 !! result
13447 <blockquote><div>Line one
13448 <p>Line two
13449 </p>
13450 </div></blockquote>
13451
13452 !! end
13453
13454 !! test
13455 Paragraphs inside blockquotes/divs (extra line break on open and close)
13456 !! input
13457 <blockquote><div>
13458 Line one
13459
13460 Line two
13461 </div></blockquote>
13462 !! result
13463 <blockquote><div>
13464 <p>Line one
13465 </p><p>Line two
13466 </p>
13467 </div></blockquote>
13468
13469 !! end
13470
13471 !! test
13472 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13473 !! options
13474 wgLinkHolderBatchSize=0
13475 !! input
13476 [[meatball:1]]
13477 [[meatball:2]]
13478 [[meatball:3]]
13479 !! result
13480 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13481 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13482 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13483 </p>
13484 !! end
13485
13486 !! test
13487 Free external link invading image caption
13488 !! input
13489 [[Image:Foobar.jpg|thumb|http://x|hello]]
13490 !! result
13491 <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>
13492
13493 !! end
13494
13495 !! test
13496 Bug 15196: localised external link numbers
13497 !! options
13498 language=fa
13499 !! input
13500 [http://en.wikipedia.org/]
13501 !! result
13502 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13503 </p>
13504 !! end
13505
13506 !! test
13507 Multibyte character in padleft
13508 !! input
13509 {{padleft:-Hello|7|Æ}}
13510 !! result
13511 <p>Æ-Hello
13512 </p>
13513 !! end
13514
13515 !! test
13516 Multibyte character in padright
13517 !! input
13518 {{padright:Hello-|7|Æ}}
13519 !! result
13520 <p>Hello-Æ
13521 </p>
13522 !! end
13523
13524 !!test
13525 formatdate parser function
13526 !!input
13527 {{#formatdate:2009-03-24}}
13528 !! result
13529 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13530 </p>
13531 !! end
13532
13533 !!test
13534 formatdate parser function, with default format
13535 !!input
13536 {{#formatdate:2009-03-24|mdy}}
13537 !! result
13538 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13539 </p>
13540 !! end
13541
13542 !! test
13543 Spacing of numbers in formatted dates
13544 !! input
13545 {{#formatdate:January 15}}
13546 !! result
13547 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13548 </p>
13549 !! end
13550
13551 !! test
13552 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
13553 !! options
13554 language=nl title=[[MediaWiki:Common.css]]
13555 !! input
13556 {{#formatdate:2009-03-24|dmy}}
13557 !! result
13558 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13559 </p>
13560 !! end
13561
13562 #
13563 #
13564 #
13565
13566 #
13567 # Edit comments
13568 #
13569
13570 !! test
13571 Edit comment with link
13572 !! options
13573 comment
13574 !! input
13575 I like the [[Main Page]] a lot
13576 !! result
13577 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13578 !!end
13579
13580 !! test
13581 Edit comment with link and link text
13582 !! options
13583 comment
13584 !! input
13585 I like the [[Main Page|best pages]] a lot
13586 !! result
13587 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13588 !!end
13589
13590 !! test
13591 Edit comment with link and link text with suffix
13592 !! options
13593 comment
13594 !! input
13595 I like the [[Main Page|best page]]s a lot
13596 !! result
13597 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13598 !!end
13599
13600 !! test
13601 Edit comment with section link (non-local, eg in history list)
13602 !! options
13603 comment title=[[Main Page]]
13604 !! input
13605 /* External links */ removed bogus entries
13606 !! result
13607 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13608 !!end
13609
13610 !! test
13611 Edit comment with section link and text before it (non-local, eg in history list)
13612 !! options
13613 comment title=[[Main Page]]
13614 !! input
13615 pre-comment text /* External links */ removed bogus entries
13616 !! result
13617 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>
13618 !!end
13619
13620 !! test
13621 Edit comment with section link (local, eg in diff view)
13622 !! options
13623 comment local title=[[Main Page]]
13624 !! input
13625 /* External links */ removed bogus entries
13626 !! result
13627 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13628 !!end
13629
13630 !! test
13631 Edit comment with subpage link (bug 14080)
13632 !! options
13633 comment
13634 subpage
13635 title=[[Subpage test]]
13636 !! input
13637 Poked at a [[/subpage]] here...
13638 !! result
13639 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13640 !!end
13641
13642 !! test
13643 Edit comment with subpage link and link text (bug 14080)
13644 !! options
13645 comment
13646 subpage
13647 title=[[Subpage test]]
13648 !! input
13649 Poked at a [[/subpage|neat little page]] here...
13650 !! result
13651 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13652 !!end
13653
13654 !! test
13655 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13656 !! options
13657 comment
13658 title=[[Subpage test]]
13659 !! input
13660 Poked at a [[/subpage]] here...
13661 !! result
13662 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...
13663 !!end
13664
13665 !! test
13666 Edit comment with bare anchor link (local, as on diff)
13667 !! options
13668 comment
13669 local
13670 title=[[Main Page]]
13671 !!input
13672 [[#section]]
13673 !! result
13674 <a href="#section">#section</a>
13675 !! end
13676
13677 !! test
13678 Edit comment with bare anchor link (non-local, as on history)
13679 !! options
13680 comment
13681 title=[[Main Page]]
13682 !!input
13683 [[#section]]
13684 !! result
13685 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13686 !! end
13687
13688 !! test
13689 Anchor starting with underscore
13690 !!input
13691 [[#_ref|One]]
13692 !! result
13693 <p><a href="#_ref">One</a>
13694 </p>
13695 !! end
13696
13697 !! test
13698 Id starting with underscore
13699 !!input
13700 <div id="_ref"></div>
13701 !! result
13702 <div id="_ref"></div>
13703
13704 !! end
13705
13706 !! test
13707 Space normalisation on autocomment (bug 22784)
13708 !! options
13709 comment
13710 title=[[Main Page]]
13711 !!input
13712 /* __hello__world__ */
13713 !! result
13714 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13715 !! end
13716
13717 !! test
13718 percent-encoding and + signs in comments (Bug 26410)
13719 !! options
13720 comment
13721 !!input
13722 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13723 !! result
13724 <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>
13725 !! end
13726
13727 !! test
13728 Bad images - basic functionality
13729 !! options
13730 disabled
13731 !! input
13732 [[File:Bad.jpg]]
13733 !! result
13734 !! end
13735
13736 !! test
13737 Bad images - bug 16039: text after bad image disappears
13738 !! options
13739 disabled
13740 !! input
13741 Foo bar
13742 [[File:Bad.jpg]]
13743 Bar foo
13744 !! result
13745 <p>Foo bar
13746 </p><p>Bar foo
13747 </p>
13748 !! end
13749
13750 !! test
13751 Verify that displaytitle works (bug #22501) no displaytitle
13752 !! options
13753 showtitle
13754 !! config
13755 wgAllowDisplayTitle=true
13756 wgRestrictDisplayTitle=false
13757 !! input
13758 this is not the the title
13759 !! result
13760 Parser test
13761 <p>this is not the the title
13762 </p>
13763 !! end
13764
13765 !! test
13766 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13767 !! options
13768 showtitle
13769 title=[[Screen]]
13770 !! config
13771 wgAllowDisplayTitle=true
13772 wgRestrictDisplayTitle=false
13773 !! input
13774 this is not the the title
13775 {{DISPLAYTITLE:whatever}}
13776 !! result
13777 whatever
13778 <p>this is not the the title
13779 </p>
13780 !! end
13781
13782 !! test
13783 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13784 !! options
13785 showtitle
13786 title=[[Screen]]
13787 !! config
13788 wgAllowDisplayTitle=true
13789 wgRestrictDisplayTitle=true
13790 !! input
13791 this is not the the title
13792 {{DISPLAYTITLE:whatever}}
13793 !! result
13794 Screen
13795 <p>this is not the the title
13796 </p>
13797 !! end
13798
13799 !! test
13800 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13801 !! options
13802 showtitle
13803 title=[[Screen]]
13804 !! config
13805 wgAllowDisplayTitle=true
13806 wgRestrictDisplayTitle=true
13807 !! input
13808 this is not the the title
13809 {{DISPLAYTITLE:screen}}
13810 !! result
13811 screen
13812 <p>this is not the the title
13813 </p>
13814 !! end
13815
13816 !! test
13817 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13818 !! options
13819 showtitle
13820 title=[[Screen]]
13821 !! config
13822 wgAllowDisplayTitle=false
13823 !! input
13824 this is not the the title
13825 {{DISPLAYTITLE:screen}}
13826 !! result
13827 Screen
13828 <p>this is not the the title
13829 <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>
13830 </p>
13831 !! end
13832
13833 !! test
13834 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13835 !! options
13836 showtitle
13837 title=[[Screen]]
13838 !! config
13839 wgAllowDisplayTitle=false
13840 !! input
13841 this is not the the title
13842 !! result
13843 Screen
13844 <p>this is not the the title
13845 </p>
13846 !! end
13847
13848 !! test
13849 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13850 !! options
13851 showtitle
13852 title=[[Screen]]
13853 !! config
13854 wgAllowDisplayTitle=true
13855 wgRestrictDisplayTitle=true
13856 !! input
13857 this is not the the title
13858 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13859 !! result
13860 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13861 <p>this is not the the title
13862 </p>
13863 !! end
13864
13865 !! test
13866 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13867 !! options
13868 showtitle
13869 title=[[Screen]]
13870 !! config
13871 wgAllowDisplayTitle=true
13872 wgRestrictDisplayTitle=true
13873 !! input
13874 this is not the the title
13875 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13876 !! result
13877 <span style="color: red;">s</span>creen
13878 <p>this is not the the title
13879 </p>
13880 !! end
13881
13882 !! test
13883 preload: check <noinclude> and <includeonly>
13884 !! options
13885 preload
13886 !! input
13887 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13888 !! result
13889 Hello kind world.
13890 !! end
13891
13892 !! test
13893 preload: check <onlyinclude>
13894 !! options
13895 preload
13896 !! input
13897 Goodbye <onlyinclude>Hello world</onlyinclude>
13898 !! result
13899 Hello world
13900 !! end
13901
13902 !! test
13903 preload: can pass tags through if we want to
13904 !! options
13905 preload
13906 !! input
13907 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13908 !! result
13909 <includeonly>Hello world</includeonly>
13910 !! end
13911
13912 !! test
13913 preload: check that it doesn't try to do tricks
13914 !! options
13915 preload
13916 !! input
13917 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13918 !! result
13919 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13920 !! end
13921
13922 !! test
13923 Play a bit with r67090 and bug 3158
13924 !! options
13925 disabled
13926 !! input
13927 <div style="width:50% !important">&nbsp;</div>
13928 <div style="width:50%&nbsp;!important">&nbsp;</div>
13929 <div style="width:50%&#160;!important">&nbsp;</div>
13930 <div style="border : solid;">&nbsp;</div>
13931 !! result
13932 <div style="width:50% !important">&nbsp;</div>
13933 <div style="width:50% !important">&nbsp;</div>
13934 <div style="width:50% !important">&nbsp;</div>
13935 <div style="border&#160;: solid;">&nbsp;</div>
13936
13937 !! end
13938
13939 !! test
13940 HTML5 data attributes
13941 !! input
13942 <span data-foo="bar">Baz</span>
13943 <p data-abc-def_hij="">Quuz</p>
13944 !! result
13945 <p><span data-foo="bar">Baz</span>
13946 </p>
13947 <p data-abc-def_hij="">Quuz</p>
13948
13949 !! end
13950
13951 !! test
13952 percent-encoding and + signs in internal links (Bug 26410)
13953 !! input
13954 [[User:+%]] [[Page+title%]]
13955 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13956 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13957 [[%33%45]] [[%33%45+]]
13958 !! result
13959 <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>
13960 <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>
13961 <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>
13962 <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>
13963 </p>
13964 !! end
13965
13966 !! test
13967 Special characters in embedded file links (bug 27679)
13968 !! input
13969 [[File:Contains & ampersand.jpg]]
13970 [[File:Does not exist.jpg|Title with & ampersand]]
13971 !! result
13972 <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>
13973 <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>
13974 </p>
13975 !! end
13976
13977
13978 !! test
13979 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13980 !! input
13981 Text&apos;s been normalized?
13982 !! result
13983 <p>Text&#39;s been normalized?
13984 </p>
13985 !! end
13986
13987 !! test
13988 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13989 !! input
13990 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13991 !! result
13992 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13993 </p>
13994 !! end
13995
13996 !! test
13997 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13998 !! input
13999 [http://www.example.org/ ideograms]
14000 !! result
14001 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14002 </p>
14003 !! end
14004
14005 !! test
14006 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14007 !! input
14008 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14009 !! result
14010 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14011 </p>
14012 !! end
14013
14014 !! article
14015 Mediawiki:loop1
14016 !! text
14017 {{Identical|A}}
14018 !! endarticle
14019
14020 !! article
14021 Mediawiki:loop2
14022 !! text
14023 {{Identical|B}}
14024 !! endarticle
14025
14026 !! article
14027 Template:Identical
14028 !! text
14029 {{int:loop1}}
14030 {{int:loop2}}
14031 !! endarticle
14032
14033 !! test
14034 Bug 31098 Template which includes system messages which includes the template
14035 !! input
14036 {{Identical}}
14037 !! result
14038 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14039 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14040 </p>
14041 !! end
14042
14043 !! test
14044 Bug31490 Turkish: ucfirst 'blah'
14045 !! options
14046 language=tr
14047 !! input
14048 {{ucfirst:blah}}
14049 !! result
14050 <p>Blah
14051 </p>
14052 !! end
14053
14054 !! test
14055 Bug31490 Turkish: ucfirst 'ix'
14056 !! options
14057 language=tr
14058 !! input
14059 {{ucfirst:ix}}
14060 !! result
14061 <p>İx
14062 </p>
14063 !! end
14064
14065 !! test
14066 Bug31490 Turkish: lcfirst 'BLAH'
14067 !! options
14068 language=tr
14069 !! input
14070 {{lcfirst:BLAH}}
14071 !! result
14072 <p>bLAH
14073 </p>
14074 !! end
14075
14076 !! test
14077 Bug31490 Turkish: ucfırst (with a dotless i)
14078 !! options
14079 language=tr
14080 !! input
14081 {{ucfırst:blah}}
14082 !! result
14083 <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>
14084 </p>
14085 !! end
14086
14087 !! test
14088 Bug31490 ucfırst (with a dotless i) with English language
14089 !! options
14090 language=en
14091 !! input
14092 {{ucfırst:blah}}
14093 !! result
14094 <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>
14095 </p>
14096 !! end
14097
14098 !! test
14099 Bug 26375: TOC with italics
14100 !! options
14101 title=[[Main Page]]
14102 !! input
14103 __TOC__
14104 == ''Lost'' episodes ==
14105 !! result
14106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14107 <ul>
14108 <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>
14109 </ul>
14110 </div>
14111 <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>
14112
14113 !! end
14114
14115 !! test
14116 Bug 26375: TOC with bold
14117 !! options
14118 title=[[Main Page]]
14119 !! input
14120 __TOC__
14121 == '''should be bold''' then normal text ==
14122 !! result
14123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14124 <ul>
14125 <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>
14126 </ul>
14127 </div>
14128 <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>
14129
14130 !! end
14131
14132 !! test
14133 Bug 33845: Headings become cursive in TOC when they contain an image
14134 !! options
14135 title=[[Main Page]]
14136 !! input
14137 __TOC__
14138 == Image [[Image:foobar.jpg]] ==
14139 !! result
14140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14141 <ul>
14142 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14143 </ul>
14144 </div>
14145 <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>
14146
14147 !! end
14148
14149 !! test
14150 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14151 !! options
14152 title=[[Main Page]]
14153 !! input
14154 __TOC__
14155 == <blockquote>Quote</blockquote> ==
14156 !! result
14157 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14158 <ul>
14159 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14160 </ul>
14161 </div>
14162 <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>
14163
14164 !! end
14165
14166 !! test
14167 Unclosed tags in TOC
14168 !! options
14169 title=[[Main Page]]
14170 !! input
14171 __TOC__
14172 == Proof: 2 < 3 ==
14173 <small>Hanc marginis exiguitas non caperet.</small>
14174 QED
14175 !! result
14176 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14177 <ul>
14178 <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>
14179 </ul>
14180 </div>
14181 <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>
14182 <p><small>Hanc marginis exiguitas non caperet.</small>
14183 QED
14184 </p>
14185 !! end
14186
14187 !! test
14188 Multiple tags in TOC
14189 !! input
14190 __TOC__
14191 == <i>Foo</i> <b>Bar</b> ==
14192
14193 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14194 !! result
14195 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14196 <ul>
14197 <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>
14198 <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>
14199 </ul>
14200 </div>
14201 <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>
14202 <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>
14203
14204 !! end
14205
14206 !! test
14207 Tags with parameters in TOC
14208 !! input
14209 __TOC__
14210 == <sup class="in-h2">Hello</sup> ==
14211
14212 == <sup class="a > b">Evilbye</sup> ==
14213 !! result
14214 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14215 <ul>
14216 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14217 <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>
14218 </ul>
14219 </div>
14220 <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>
14221 <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>
14222
14223 !! end
14224
14225 !! test
14226 span tags with directionality in TOC
14227 !! input
14228 __TOC__
14229 == <span dir="ltr">C++</span> ==
14230
14231 == <span dir="rtl">זבנג!</span> ==
14232
14233 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14234
14235 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14236
14237 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14238 !! result
14239 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14240 <ul>
14241 <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>
14242 <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>
14243 <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>
14244 <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>
14245 <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>
14246 </ul>
14247 </div>
14248 <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>
14249 <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>
14250 <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>
14251 <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>
14252 <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>
14253
14254 !! end
14255
14256 !! article
14257 MediaWiki:Bug32057
14258 !! text
14259 == {{int:headline_sample}} ==
14260 !! endarticle
14261
14262 !! test
14263 Bug 32057: Title needed when expanding <h> nodes.
14264 !! options
14265 title=[[Main Page]]
14266 !! input
14267 {{int:Bug32057}}
14268 !! result
14269 <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>
14270
14271 !! end
14272
14273 !! test
14274 Strip marker in urlencode
14275 !! input
14276 {{urlencode:x<nowiki/>y}}
14277 {{urlencode:x<nowiki/>y|wiki}}
14278 {{urlencode:x<nowiki/>y|path}}
14279 !! result
14280 <p>xy
14281 xy
14282 xy
14283 </p>
14284 !! end
14285
14286 !! test
14287 Strip marker in lc
14288 !! input
14289 {{lc:x<nowiki/>y}}
14290 !! result
14291 <p>xy
14292 </p>
14293 !! end
14294
14295 !! test
14296 Strip marker in uc
14297 !! input
14298 {{uc:x<nowiki/>y}}
14299 !! result
14300 <p>XY
14301 </p>
14302 !! end
14303
14304 !! test
14305 Strip marker in formatNum
14306 !! input
14307 {{formatnum:1<nowiki/>2}}
14308 {{formatnum:1<nowiki/>2|R}}
14309 !! result
14310 <p>12
14311 12
14312 </p>
14313 !! end
14314
14315 !! test
14316 Check noCommafy in formatNum
14317 !! options
14318 language=be-tarask
14319 !! input
14320 {{formatnum:123456.78}}
14321 {{formatnum:123456.78|NOSEP}}
14322 !! result
14323 <p>123 456,78
14324 123456.78
14325 </p>
14326 !! end
14327
14328 !! test
14329 Strip marker in grammar
14330 !! options
14331 language=fi
14332 !! input
14333 {{grammar:elative|foo<nowiki/>bar}}
14334 !! result
14335 <p>foobarista
14336 </p>
14337 !! end
14338
14339 !! test
14340 Strip marker in padleft
14341 !! input
14342 {{padleft:|2|x<nowiki/>y}}
14343 !! result
14344 <p>xy
14345 </p>
14346 !! end
14347
14348 !! test
14349 Strip marker in padright
14350 !! input
14351 {{padright:|2|x<nowiki/>y}}
14352 !! result
14353 <p>xy
14354 </p>
14355 !! end
14356
14357 !! test
14358 Strip marker in anchorencode
14359 !! input
14360 {{anchorencode:x<nowiki/>y}}
14361 !! result
14362 <p>xy
14363 </p>
14364 !! end
14365
14366 !! test
14367 nowiki inside link inside heading (bug 18295)
14368 !! input
14369 ==[[foo|x<nowiki>y</nowiki>z]]==
14370 !! result
14371 <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>
14372
14373 !! end
14374
14375 !! test
14376 new support for bdi element (bug 31817)
14377 !! input
14378 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14379 !! result
14380 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14381
14382 !!end
14383
14384 !! test
14385 Ignore pipe between table row attributes
14386 !! input
14387 {|
14388 | quux
14389 |- id=foo | style='color: red'
14390 | bar
14391 |}
14392 !! result
14393 <table>
14394 <tr>
14395 <td> quux
14396 </td></tr>
14397 <tr id="foo" style="color: red">
14398 <td> bar
14399 </td></tr></table>
14400
14401 !! end
14402
14403 !!test
14404 Gallery override link with WikiLink (bug 34852)
14405 !! input
14406 <gallery>
14407 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14408 </gallery>
14409 !! result
14410 <ul class="gallery">
14411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14412 <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>
14413 <div class="gallerytext">
14414 <p>caption
14415 </p>
14416 </div>
14417 </div></li>
14418 </ul>
14419
14420 !! end
14421
14422 !!test
14423 Gallery override link with absolute external link (bug 34852)
14424 !! input
14425 <gallery>
14426 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14427 </gallery>
14428 !! result
14429 <ul class="gallery">
14430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14431 <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>
14432 <div class="gallerytext">
14433 <p>caption
14434 </p>
14435 </div>
14436 </div></li>
14437 </ul>
14438
14439 !! end
14440
14441 !!test
14442 Gallery override link with malicious javascript (bug 34852)
14443 !! input
14444 <gallery>
14445 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14446 </gallery>
14447 !! result
14448 <ul class="gallery">
14449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14450 <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>
14451 <div class="gallerytext">
14452 <p>caption
14453 </p>
14454 </div>
14455 </div></li>
14456 </ul>
14457
14458 !! end
14459
14460 !!test
14461 Gallery with invalid title as link (bug 43964)
14462 !! input
14463 <gallery>
14464 File:foobar.jpg|link=<
14465 </gallery>
14466 !! result
14467 <ul class="gallery">
14468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14469 <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>
14470 <div class="gallerytext">
14471 </div>
14472 </div></li>
14473 </ul>
14474
14475 !! end
14476
14477 !!test
14478 Language parser function
14479 !! input
14480 {{#language:ar}}
14481 !! result
14482 <p>العربية
14483 </p>
14484 !! end
14485
14486 !!test
14487 Padleft and padright as substr
14488 !! input
14489 {{padleft:|3|abcde}}
14490 {{padright:|3|abcde}}
14491 !! result
14492 <p>abc
14493 abc
14494 </p>
14495 !! end
14496
14497 !!test
14498 Special parser function
14499 !! input
14500 {{#special:RandomPage}}
14501 {{#special:BaDtItLe}}
14502 {{#special:Foobar}}
14503 !! result
14504 <p>Special:Random
14505 Special:Badtitle
14506 Special:Foobar
14507 </p>
14508 !! end
14509
14510 !!test
14511 Bug 34939 - Case insensitive link parsing ([HttP://])
14512 !! input
14513 [HttP://MediaWiki.Org/]
14514 !! result
14515 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14516 </p>
14517 !! end
14518
14519 !!test
14520 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14521 !! input
14522 [HttP://MediaWiki.Org/ MediaWiki]
14523 !! result
14524 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14525 </p>
14526 !! end
14527
14528 !!test
14529 Bug 34939 - Case insensitive link parsing (HttP://)
14530 !! input
14531 HttP://MediaWiki.Org/
14532 !! result
14533 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14534 </p>
14535 !! end
14536
14537
14538 ###
14539 ### Parsoids-specific tests
14540 ### Parsoid-PHP parser incompatibilities
14541 ###
14542 !!test
14543 1. SOL-sensitive wikitext tokens as template-args
14544 !!options
14545 parsoid=wt2html,wt2wt
14546 !!input
14547 {{echo|*a}}
14548 {{echo|#a}}
14549 {{echo|:a}}
14550 !!result
14551 <span about="#mwt1" typeof="mw:Transclusion">
14552 </span><ul about="#mwt1"><li>a</li></ul>
14553 <span about="#mwt2" typeof="mw:Transclusion">
14554 </span><ol about="#mwt2"><li>a</li></ol>
14555 <span about="#mwt3" typeof="mw:Transclusion">
14556 </span><dl about="#mwt3"><dd>a</dd></dl>
14557 !!end
14558
14559 #### ----------------------------------------------------------------
14560 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14561 #### tags. Parsoid's output for these tags differs from that of the
14562 #### PHP parser.
14563 #### ----------------------------------------------------------------
14564
14565 !!test
14566 Ref: 1. ref-location should be replaced with an index span
14567 !!options
14568 parsoid
14569 !!input
14570 A <ref>foo</ref>
14571 B <ref name="x">foo</ref>
14572 C <ref name="y" />
14573 !!result
14574 <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>
14575 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>
14576 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>
14577 !!end
14578
14579 !!test
14580 Ref: 2. ref-tags with identical names should all get the same index
14581 !!options
14582 parsoid
14583 !!input
14584 A <ref name="x">foo</ref>
14585 B <ref name="x" />
14586 !!result
14587 <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>
14588 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>
14589 !!end
14590
14591 !!test
14592 Ref: 3. spaces in ref-names should be ignored
14593 !!options
14594 parsoid
14595 !!input
14596 A <ref name="x">foo</ref>
14597 B <ref name=" x " />
14598 C <ref name= x />
14599 !!result
14600 <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>
14601 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>
14602 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>
14603 !!end
14604
14605 !!test
14606 Ref: 4. 'constructor' should be accepted as a valid ref-name
14607 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14608 !!options
14609 parsoid
14610 !!input
14611 A <ref name="constructor">foo</ref>
14612 !!result
14613 <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>
14614 !!end
14615
14616 !!test
14617 Ref: 5. body should accept generic wikitext
14618 !!options
14619 parsoid
14620 !!input
14621 A <ref>
14622 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14623 </ref>
14624
14625 <references />
14626 !!result
14627 <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>
14628
14629 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14630 <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>
14631 </li></ol>
14632 !!end
14633
14634 !!test
14635 Ref: 6. indent-pres should not be output in ref-body
14636 !!options
14637 parsoid
14638 !!input
14639 A <ref>
14640 foo
14641 bar
14642 baz
14643 </ref>
14644
14645 <references />
14646 !!result
14647 <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>
14648
14649 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14650 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14651 bar
14652 baz
14653 </li></ol>
14654 !!end
14655
14656 !!test
14657 Ref: 6. No p-wrapping in ref-body
14658 !!options
14659 parsoid
14660 !!input
14661 A <ref>
14662 foo
14663
14664 bar
14665
14666
14667 baz
14668
14669
14670
14671 booz
14672 </ref>
14673
14674 <references />
14675 !!result
14676 <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>
14677
14678 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14679 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14680
14681 bar
14682
14683
14684 baz
14685
14686
14687
14688 booz
14689 </li></ol>
14690 !!end
14691
14692 !!test
14693 Ref: 8. transclusion wikitext has lower precedence
14694 !!options
14695 parsoid
14696 !!input
14697 A <ref> foo {{echo|</ref> B C}}
14698
14699 <references />
14700 !!result
14701 <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>
14702
14703 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14704 <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>
14705 !!end
14706
14707 !!test
14708 Ref: 9. unclosed comments should not leak out of ref-body
14709 !!options
14710 parsoid
14711 !!input
14712 A <ref> foo <!--</ref> B C
14713
14714 <references />
14715 !!result
14716 <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>
14717
14718 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14719 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14720 !!end
14721
14722 !!test
14723 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14724 !!options
14725 parsoid
14726 !!input
14727 A <ref> <b> foo </ref> B C
14728
14729 <references />
14730 !!result
14731 <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>
14732
14733 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14734 <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>
14735 !!end
14736
14737 !!test
14738 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14739 !!options
14740 parsoid
14741 !!input
14742 A <ref>foo</ref> B
14743 C <ref>bar</ref> D
14744 !!result
14745 <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
14746 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>
14747 !!end
14748
14749 !!test
14750 Ref: 12. ref-tags act as trailing newline migration barrier
14751 !!options
14752 parsoid
14753 !!input
14754 <!--the newline at the end of this line moves out of the p-tag-->a
14755
14756 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14757 <ref />
14758
14759 c
14760 !!result
14761 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14762
14763
14764 <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>
14765 <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>
14766
14767
14768 <p>c</p>
14769 !!end
14770
14771 !!test
14772 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14773 !!options
14774 parsoid
14775 !!input
14776 <ref>foo</ref> A
14777 <ref>bar
14778 </ref> B
14779 !!result
14780 <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
14781 <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>
14782 !!end
14783
14784 !!test
14785 Ref: 14. A nested ref-tag should be emitted as plain text
14786 !!options
14787 parsoid
14788 !!input
14789 <ref>foo <ref>bar</ref> baz</ref>
14790
14791 <references />
14792 !!result
14793 <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>
14794
14795 <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>
14796 !!end
14797
14798 !!test
14799 Ref: 15. ref-tags with identical names should get identical indexes
14800 !!options
14801 parsoid
14802 !!input
14803 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14804 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14805
14806 <references />
14807 !!result
14808 <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>
14809 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>
14810
14811 <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>
14812 !!end
14813
14814 !!test
14815 References: 1. references tag without any refs should be handled properly
14816 !!options
14817 parsoid
14818 !!input
14819 <references />
14820 !!result
14821 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14822 !!end
14823
14824 !!test
14825 References: 2. references tag with group only outputs references from that group
14826 !!options
14827 parsoid
14828 !!input
14829 A <ref group="a">foo</ref>
14830 B <ref group="b">bar</ref>
14831
14832 <references group='a' />
14833 !!result
14834 <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>
14835 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>
14836
14837 <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>
14838 !!end
14839
14840 !!test
14841 References: 3. ref list should be cleared after processing references
14842 !!options
14843 parsoid
14844 !!input
14845 A <ref>foo</ref>
14846
14847 <references />
14848
14849 B <ref>bar</ref>
14850
14851 <references />
14852 !!result
14853 <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>
14854
14855 <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>
14856
14857 <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>
14858
14859 <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>
14860 !!end
14861
14862 !!test
14863 References: 4. only referenced group should be cleared after processing references
14864 !!options
14865 parsoid
14866 !!input
14867 A <ref group="a">afoo</ref>
14868 B <ref>bfoo</ref>
14869
14870 <references group="a"/>
14871
14872 C <ref>cfoo</ref>
14873
14874 <references />
14875 !!result
14876 <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>
14877 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>
14878
14879 <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>
14880
14881 <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>
14882
14883 <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>
14884 !!end
14885
14886 !!test
14887 References: 5. ref tags in references should be processed while ignoring all other content
14888 !!options
14889 parsoid
14890 !!input
14891 A <ref name="a" />
14892 B <ref name="b">bar</ref>
14893
14894 <references>
14895 <ref name="a">foo</ref>
14896 This should just get lost.
14897 </references>
14898 !!result
14899 <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>
14900 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>
14901
14902 <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>
14903 !!end
14904
14905 !!test
14906 References: 6. <references /> from a transclusion
14907 !!options
14908 parsoid
14909 !!input
14910 {{echo|<references />}}
14911 !!result
14912 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14913 !!end
14914
14915 #### ----------------------------------------------------------------
14916 #### The following section of tests are primarily to test
14917 #### wikitext escaping capabilities of Parsoid. Given that
14918 #### escaping can be done any number of ways, the wikitext (input)
14919 #### is always adjusted to reflect how Parsoid adds nowiki
14920 #### escape tags.
14921 ####
14922 #### We are marking several tests as parsoid-only since the
14923 #### HTML in the result section is different from what the
14924 #### PHP parser generates for it.
14925 #### ----------------------------------------------------------------
14926
14927
14928 #### --------------- Headings ---------------
14929 #### 0. Unnested
14930 #### 1. Nested inside html <h1>=foo=</h1>
14931 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14932 #### 3. Nested inside html with wikitext split by html tags
14933 #### 4. No escape needed
14934 #### 5. Empty headings <h1></h1>
14935 #### 6. Heading chars in SOL context
14936 #### ----------------------------------------
14937 !! test
14938 Headings: 0. Unnested
14939 !! options
14940 parsoid
14941 !! input
14942 <nowiki>=foo=</nowiki>
14943
14944 <nowiki> =foo= </nowiki>
14945 <!--cmt-->
14946 <nowiki>=foo=</nowiki>
14947
14948 =foo''a''<nowiki>=</nowiki>
14949 !! result
14950 <p><span typeof="mw:Nowiki">=foo=</span></p>
14951
14952 <p><span typeof="mw:Nowiki"> =foo= </span>
14953 <!--cmt-->
14954 <span typeof="mw:Nowiki">=foo=</span></p>
14955
14956 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14957 !!end
14958
14959 !! test
14960 Headings: 1. Nested inside html
14961 !! options
14962 parsoid
14963 !! input
14964 =<nowiki>=foo=</nowiki>=
14965
14966 ==<nowiki>=foo=</nowiki>==
14967
14968 ===<nowiki>=foo=</nowiki>===
14969
14970 ====<nowiki>=foo=</nowiki>====
14971
14972 =====<nowiki>=foo=</nowiki>=====
14973
14974 ======<nowiki>=foo=</nowiki>======
14975 !! result
14976 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14977 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14978 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14979 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14980 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14981 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14982 !!end
14983
14984 !! test
14985 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14986 !! options
14987 parsoid
14988 !! input
14989 =foo=
14990 <nowiki>*bar</nowiki>
14991
14992 =foo=
14993 =bar
14994
14995 =foo=
14996 <nowiki>=bar=</nowiki>
14997 !! result
14998 <h1>foo</h1>*bar
14999 <h1>foo</h1>=bar
15000 <h1>foo</h1>=bar=
15001 !!end
15002
15003 !! test
15004 Headings: 3. Nested inside html with wikitext split by html tags
15005 !! options
15006 parsoid
15007 !! input
15008 =='''bold'''<nowiki>foo=</nowiki>=
15009 !! result
15010 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15011 !!end
15012
15013 !! test
15014 Headings: 4a. No escaping needed (testing just h1 and h2)
15015 !! options
15016 parsoid
15017 !! input
15018 ==foo=
15019
15020 =foo==
15021
15022 = =foo= =
15023
15024 ==foo= bar=
15025
15026 ===foo==
15027
15028 ==foo===
15029
15030 =''=''foo==
15031
15032 =<nowiki>=</nowiki>=
15033 !! result
15034 <h1>=foo</h1>
15035 <h1>foo=</h1>
15036 <h1> =foo= </h1>
15037 <h1>=foo= bar</h1>
15038 <h2>=foo</h2>
15039 <h2>foo=</h2>
15040 <h1><i>=</i>foo=</h1>
15041 <h1><span typeof="mw:Nowiki">=</span></h1>
15042 !!end
15043
15044 !! test
15045 Headings: 4b. No escaping needed (inside p-tags)
15046 !! options
15047 parsoid
15048 !! input
15049 ===
15050 =foo= x
15051 =foo= <s></s>
15052 !! result
15053 <p>===
15054 =foo= x
15055 =foo= <s></s>
15056 </p>
15057 !!end
15058
15059 !! test
15060 Headings: 5. Empty headings
15061 !! options
15062 parsoid
15063 !! input
15064 =<nowiki/>=
15065
15066 ==<nowiki/>==
15067
15068 ===<nowiki/>===
15069
15070 ====<nowiki/>====
15071
15072 =====<nowiki/>=====
15073
15074 ======<nowiki/>======
15075 !! result
15076 <h1></h1>
15077 <h2></h2>
15078 <h3></h3>
15079 <h4></h4>
15080 <h5></h5>
15081 <h6></h6>
15082 !!end
15083
15084 !! test
15085 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15086 !! options
15087 parsoid
15088 !! input
15089 <nowiki>=a=</nowiki>
15090
15091 <nowiki>=a= </nowiki>
15092
15093 <nowiki>=a= </nowiki>
15094
15095 <nowiki>=a= </nowiki>
15096 !! result
15097 <p>=a=</p>
15098 <p>=a= </p>
15099 <p>=a= </p>
15100 <p>=a= </p>
15101 !!end
15102
15103 !! test
15104 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15105 !! options
15106 parsoid
15107 !! input
15108 <nowiki>=a=
15109 b</nowiki>
15110
15111 <nowiki>=a=
15112 b</nowiki>
15113
15114 <nowiki>=a=
15115 b</nowiki>
15116
15117 <nowiki>=a=
15118 b</nowiki>
15119 !! result
15120 <p>=a=
15121 b</p>
15122 <p>=a=
15123 b</p>
15124 <p>=a=
15125 b</p>
15126 <p>=a=
15127 b</p>
15128 </p>
15129 !!end
15130
15131 !! test
15132 Headings: 6c. Heading chars in SOL context (leading newline break)
15133 !! options
15134 parsoid
15135 !! input
15136 <nowiki>a
15137 =b=</nowiki>
15138 !! result
15139 <p>a
15140 =b=</p>
15141 !!end
15142
15143 !! test
15144 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15145 !! options
15146 parsoid
15147 !! input
15148 <!--c0--><nowiki>=a=</nowiki>
15149 <!--c1-->
15150 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15151 !! result
15152 <p><!--c0-->=a=</p>
15153 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15154 !!end
15155
15156 !! test
15157 Headings: 6d. Heading chars in SOL context (No escaping needed)
15158 !! options
15159 parsoid=html2wt
15160 !! input
15161 =a=<div>b</div>
15162 !! result
15163 =a=<div>b</div>
15164 !!end
15165
15166 #### --------------- Lists ---------------
15167 #### 0. Outside nests (*foo, etc.)
15168 #### 1. Nested inside html <ul><li>*foo</li></ul>
15169 #### 2. Inside definition lists
15170 #### 3. Only bullets at start should be escaped
15171 #### 4. No escapes needed
15172 #### 5. No unnecessary escapes
15173 #### 6. Escape bullets in SOL position
15174 #### 7. Escape bullets in a multi-line context
15175 #### ----------------------------------------
15176
15177 !! test
15178 Lists: 0. Outside nests
15179 !! input
15180 <nowiki>*foo</nowiki>
15181
15182 <nowiki>#foo</nowiki>
15183 !! result
15184 <p>*foo
15185 </p><p>#foo
15186 </p>
15187 !!end
15188
15189 !! test
15190 Lists: 1. Nested inside html
15191 !! input
15192 *<nowiki>*foo</nowiki>
15193
15194 *<nowiki>#foo</nowiki>
15195
15196 *<nowiki>:foo</nowiki>
15197
15198 *<nowiki>;foo</nowiki>
15199
15200 #<nowiki>*foo</nowiki>
15201
15202 #<nowiki>#foo</nowiki>
15203
15204 #<nowiki>:foo</nowiki>
15205
15206 #<nowiki>;foo</nowiki>
15207 !! result
15208 <ul><li>*foo
15209 </li></ul>
15210 <ul><li>#foo
15211 </li></ul>
15212 <ul><li>:foo
15213 </li></ul>
15214 <ul><li>;foo
15215 </li></ul>
15216 <ol><li>*foo
15217 </li></ol>
15218 <ol><li>#foo
15219 </li></ol>
15220 <ol><li>:foo
15221 </li></ol>
15222 <ol><li>;foo
15223 </li></ol>
15224
15225 !!end
15226
15227 !! test
15228 Lists: 2. Inside definition lists
15229 !! input
15230 ;<nowiki>;foo</nowiki>
15231
15232 ;<nowiki>:foo</nowiki>
15233
15234 ;<nowiki>:foo</nowiki>
15235 :bar
15236
15237 :<nowiki>:foo</nowiki>
15238 !! result
15239 <dl><dt>;foo
15240 </dt></dl>
15241 <dl><dt>:foo
15242 </dt></dl>
15243 <dl><dt>:foo
15244 </dt><dd>bar
15245 </dd></dl>
15246 <dl><dd>:foo
15247 </dd></dl>
15248
15249 !!end
15250
15251 !! test
15252 Lists: 3. Only bullets at start of text should be escaped
15253 !! input
15254 *<nowiki>*foo*bar</nowiki>
15255
15256 *<nowiki>*foo</nowiki>''it''*bar
15257 !! result
15258 <ul><li>*foo*bar
15259 </li></ul>
15260 <ul><li>*foo<i>it</i>*bar
15261 </li></ul>
15262
15263 !!end
15264
15265 !! test
15266 Lists: 4. No escapes needed
15267 !! options
15268 parsoid
15269 !! input
15270 *foo*bar
15271
15272 *''foo''*bar
15273
15274 *[[Foo]]: bar
15275 !! result
15276 <ul><li>foo*bar
15277 </li></ul>
15278 <ul><li><i>foo</i>*bar
15279 </li></ul>
15280 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15281 </li></ul>
15282 !!end
15283
15284 !! test
15285 Lists: 5. No unnecessary escapes
15286 !! input
15287 * bar <span><nowiki>[[foo]]</nowiki></span>
15288
15289 *=bar <span><nowiki>[[foo]]</nowiki></span>
15290
15291 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15292
15293 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15294
15295 *=bar <span>foo]]</span>=
15296
15297 * <s></s>: a
15298 !! result
15299 <ul><li> bar <span>[[foo]]</span>
15300 </li></ul>
15301 <ul><li>=bar <span>[[foo]]</span>
15302 </li></ul>
15303 <ul><li>[[bar <span>[[foo]]</span>
15304 </li></ul>
15305 <ul><li>]]bar <span>[[foo]]</span>
15306 </li></ul>
15307 <ul><li>=bar <span>foo]]</span>=
15308 </li></ul>
15309 <ul><li> <s></s>: a
15310 </li></ul>
15311
15312 !!end
15313
15314 !! test
15315 Lists: 6. Escape bullets in SOL position
15316 !! options
15317 parsoid
15318 !! input
15319 <!--cmt--><nowiki>*foo</nowiki>
15320 !! result
15321 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15322 !!end
15323
15324 !! test
15325 Lists: 7. Escape bullets in a multi-line context
15326 !! input
15327 <nowiki>a
15328 *b</nowiki>
15329 !! result
15330 <p>a
15331 *b
15332 </p>
15333 !!end
15334
15335 #### --------------- HRs ---------------
15336 #### 1. Single line
15337 #### -----------------------------------
15338
15339 !! test
15340 HRs: 1. Single line
15341 !! options
15342 parsoid
15343 !! input
15344 ----<nowiki>----</nowiki>
15345 ----=foo=
15346 ----*foo
15347 !! result
15348 <hr><span typeof="mw:Nowiki">----</span>
15349 <hr>=foo=
15350 <hr>*foo
15351 !! end
15352
15353 #### --------------- Tables ---------------
15354 #### 1a. Simple example
15355 #### 1b. No escaping needed (!foo)
15356 #### 1c. No escaping needed (|foo)
15357 #### 1d. No escaping needed (|}foo)
15358 ####
15359 #### 2a. Nested in td (<td>foo|bar</td>)
15360 #### 2b. Nested in td (<td>foo||bar</td>)
15361 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15362 ####
15363 #### 3a. Nested in th (<th>foo!bar</th>)
15364 #### 3b. Nested in th (<th>foo!!bar</th>)
15365 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15366 ####
15367 #### 4a. Escape -
15368 #### 4b. Escape +
15369 #### 4c. No escaping needed
15370 #### --------------------------------------
15371
15372 !! test
15373 Tables: 1a. Simple example
15374 !! input
15375 <nowiki>{|
15376 |}</nowiki>
15377 !! result
15378 <p>{|
15379 |}
15380 </p>
15381 !! end
15382
15383 !! test
15384 Tables: 1b. No escaping needed
15385 !! input
15386 !foo
15387 !! result
15388 <p>!foo
15389 </p>
15390 !! end
15391
15392 !! test
15393 Tables: 1c. No escaping needed
15394 !! input
15395 |foo
15396 !! result
15397 <p>|foo
15398 </p>
15399 !! end
15400
15401 !! test
15402 Tables: 1d. No escaping needed
15403 !! input
15404 |}foo
15405 !! result
15406 <p>|}foo
15407 </p>
15408 !! end
15409
15410 !! test
15411 Tables: 2a. Nested in td
15412 !! options
15413 parsoid
15414 !! input
15415 {|
15416 |<nowiki>foo|bar</nowiki>
15417 |}
15418 !! result
15419 <table><tbody><tr>
15420 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15421 !! end
15422
15423 !! test
15424 Tables: 2b. Nested in td
15425 !! options
15426 parsoid
15427 !! input
15428 {|
15429 |<nowiki>foo||bar</nowiki>
15430 |''it''<nowiki>foo||bar</nowiki>
15431 |}
15432 !! result
15433 <table><tbody><tr>
15434 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15435 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15436 !! end
15437
15438 !! test
15439 Tables: 2c. Nested in td -- no escaping needed
15440 !! options
15441 parsoid
15442 !! input
15443 {|
15444 |foo!!bar
15445 |}
15446 !! result
15447 <table><tbody><tr><td>foo!!bar
15448 </td></tr></tbody></table>
15449
15450 !! end
15451
15452 !! test
15453 Tables: 3a. Nested in th
15454 !! options
15455 parsoid
15456 !! input
15457 {|
15458 !foo!bar
15459 |}
15460 !! result
15461 <table><tbody><tr><th>foo!bar
15462 </th></tr></tbody></table>
15463
15464 !! end
15465
15466 !! test
15467 Tables: 3b. Nested in th
15468 !! options
15469 parsoid
15470 !! input
15471 {|
15472 !<nowiki>foo!!bar</nowiki>
15473 |}
15474 !! result
15475 <table>
15476 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15477 </tbody></table>
15478 !! end
15479
15480 !! test
15481 Tables: 3c. Nested in th -- no escaping needed
15482 !! options
15483 parsoid
15484 !! input
15485 {|
15486 !<nowiki>foo||bar</nowiki>
15487 |}
15488 !! result
15489 <table><tbody><tr>
15490 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15491 !! end
15492
15493 !! test
15494 Tables: 4a. Escape -
15495 !! options
15496 parsoid
15497 !! input
15498 {|
15499 |-
15500 !-bar
15501 |-
15502 |<nowiki>-bar</nowiki>
15503 |}
15504 !! result
15505 <table><tbody>
15506 <tr><th>-bar</th></tr>
15507 <tr>
15508 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15509 !! end
15510
15511 !! test
15512 Tables: 4b. Escape +
15513 !! options
15514 parsoid
15515 !! input
15516 {|
15517 |-
15518 !+bar
15519 |-
15520 |<nowiki>+bar</nowiki>
15521 |}
15522 !! result
15523 <table><tbody>
15524 <tr><th>+bar</th></tr>
15525 <tr>
15526 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15527 !! end
15528
15529 !! test
15530 Tables: 4c. No escaping needed
15531 !! options
15532 parsoid
15533 !! input
15534 {|
15535 |-
15536 |foo-bar
15537 |foo+bar
15538 |-
15539 |''foo''-bar
15540 |''foo''+bar
15541 |}
15542 !! result
15543 <table><tbody>
15544 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15545 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15546 </tbody></table>
15547 !! end
15548
15549 ### SSS FIXME: Disabled right now because accurate html2wt
15550 ### on this snippet requires data-parsoid flags that we've
15551 ### stripped out of these tests. We should scheme how we
15552 ### we want to handle these kind of tests that require
15553 ### data-parsoid flags for accurate html2wt serialization
15554
15555 !! test
15556 Tables: 4d. No escaping needed
15557 !! options
15558 disabled
15559 !! input
15560 {|
15561 ||+1
15562 ||-2
15563 |}
15564 !! result
15565 <table>
15566 <tr>
15567 <td>+1
15568 </td>
15569 <td>-2
15570 </td></tr></table>
15571
15572 !! end
15573
15574 #### --------------- Links ----------------
15575 #### 1. Quote marks in link text
15576 #### 2. Wikilinks: Escapes needed
15577 #### 3. Wikilinks: No escapes needed
15578 #### 4. Extlinks: Escapes needed
15579 #### 5. Extlinks: No escapes needed
15580 #### --------------------------------------
15581 !! test
15582 Links 1. Quote marks in link text
15583 !! options
15584 parsoid
15585 !! input
15586 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15587 !! result
15588 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15589 !! end
15590
15591 !! test
15592 Links 2. WikiLinks: Escapes needed
15593 !! options
15594 parsoid
15595 !! input
15596 [[Foo|<nowiki>[Foobar]</nowiki>]]
15597 [[Foo|<nowiki>Foobar]</nowiki>]]
15598 [[Foo|x [Foobar] x]]
15599 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15600 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15601 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15602 [[Foo|<nowiki>|Bar</nowiki>]]
15603 [[Foo|<nowiki>]]bar</nowiki>]]
15604 [[Foo|<nowiki>[[bar</nowiki>]]
15605 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15606 !! result
15607 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15608 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15609 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15610 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15611 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15612 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15613 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15614 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15615 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15616 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15617 !! end
15618
15619 !! test
15620 Links 3. WikiLinks: No escapes needed
15621 !! options
15622 parsoid
15623 !! input
15624 [[Foo|[Foobar]]
15625 [[Foo|foo|bar]]
15626 !! result
15627 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15628 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15629 !! end
15630
15631 !! test
15632 Links 4. ExtLinks: Escapes needed
15633 !! options
15634 parsoid
15635 !! input
15636 [http://google.com <nowiki>[google]</nowiki>]
15637 [http://google.com <nowiki>google]</nowiki>]
15638 !! result
15639 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15640 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15641 !! end
15642
15643 !! test
15644 Links 5. ExtLinks: No escapes needed
15645 !! options
15646 parsoid
15647 !! input
15648 [http://google.com [google]
15649 !! result
15650 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15651 !! end
15652
15653 #### --------------- Quotes ---------------
15654 #### 1. Quotes inside <b> and <i>
15655 #### 2. Link fragments separated by <i> and <b> tags
15656 #### 3. Link fragments inside <i> and <b>
15657 #### --------------------------------------
15658 !! test
15659 1. Quotes inside <b> and <i>
15660 !! input
15661 ''<nowiki>'foo'</nowiki>''
15662 ''<nowiki>''foo''</nowiki>''
15663 ''<nowiki>'''foo'''</nowiki>''
15664 ''foo''<nowiki>'s</nowiki>
15665 '''<nowiki>'foo'</nowiki>'''
15666 '''<nowiki>''foo''</nowiki>'''
15667 '''<nowiki>'''foo'''</nowiki>'''
15668 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15669 '''foo'''<nowiki>'s</nowiki>
15670 !! result
15671 <p><i>'foo'</i>
15672 <i>''foo''</i>
15673 <i>'''foo'''</i>
15674 <i>foo</i>'s
15675 <b>'foo'</b>
15676 <b>''foo''</b>
15677 <b>'''foo'''</b>
15678 <b>foo'<i>bar'</i>baz</b>
15679 <b>foo</b>'s
15680 </p>
15681 !! end
15682
15683 !! test
15684 2. Link fragments separated by <i> and <b> tags
15685 !! input
15686 [[''foo''<nowiki>hello]]</nowiki>
15687
15688 [['''foo'''<nowiki>hello]]</nowiki>
15689 !! result
15690 <p>[[<i>foo</i>hello]]
15691 </p><p>[[<b>foo</b>hello]]
15692 </p>
15693 !! end
15694
15695 !! test
15696 2. Link fragments inside <i> and <b>
15697 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15698 this is one of the shortcomings of this format)
15699 !! input
15700 ''[[foo''<nowiki>]]</nowiki>
15701
15702 '''[[foo'''<nowiki>]]</nowiki>
15703 !! result
15704 <p><i>[[foo</i>]]
15705 </p><p><b>[[foo</b>]]
15706 </p>
15707 !! end
15708
15709 #### ----------- Paragraphs ---------------
15710 #### 1. No unnecessary escapes
15711 #### --------------------------------------
15712
15713 !! test
15714 1. No unnecessary escapes
15715 !! input
15716 bar <span><nowiki>[[foo]]</nowiki></span>
15717
15718 =bar <span><nowiki>[[foo]]</nowiki></span>
15719
15720 [[bar <span><nowiki>[[foo]]</nowiki></span>
15721
15722 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15723
15724 =bar <span>foo]]</span><nowiki>=</nowiki>
15725 !! result
15726 <p>bar <span>[[foo]]</span>
15727 </p><p>=bar <span>[[foo]]</span>
15728 </p><p>[[bar <span>[[foo]]</span>
15729 </p><p>]]bar <span>[[foo]]</span>
15730 </p><p>=bar <span>foo]]</span>=
15731 </p>
15732 !!end
15733
15734 #### ----------------------- PRE --------------------------
15735 #### 1. Leading whitespace in SOL context should be escaped
15736 #### ------------------------------------------------------
15737 !! test
15738 1. Leading whitespace in SOL context should be escaped
15739 !! options
15740 parsoid
15741 !! input
15742 <nowiki> a</nowiki>
15743
15744 <nowiki> a</nowiki>
15745
15746 <nowiki> a(tab)</nowiki>
15747
15748 <nowiki> a</nowiki>
15749 <!--cmt-->
15750 <nowiki> a</nowiki>
15751
15752 <nowiki>a
15753 b</nowiki>
15754
15755 <nowiki>a
15756 b</nowiki>
15757
15758 <nowiki>a
15759 b</nowiki>
15760 !! result
15761 <p> a</p>
15762 <p> a</p>
15763 <p> a(tab)</p>
15764 <p> a</p>
15765 <p><!--cmt--> a</p>
15766 <p>a
15767 b</p>
15768 <p>a
15769 b</p>
15770 <p>a
15771 b</p>
15772 !! end
15773
15774 #### --------------- HTML tags ---------------
15775 #### 1. a tags
15776 #### 2. other tags
15777 #### 3. multi-line html tag
15778 #### -----------------------------------------
15779 !! test
15780 1. a tags
15781 !! options
15782 parsoid
15783 !! input
15784 <a href="http://google.com">google</a>
15785 !! result
15786 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15787 !! end
15788
15789 !! test
15790 2. other tags
15791 !! input
15792 <nowiki><div>foo</div>
15793 <div style="color:red">foo</div></nowiki>
15794 !! result
15795 <p>&lt;div&gt;foo&lt;/div&gt;
15796 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15797 </p>
15798 !! end
15799
15800 !! test
15801 3. multi-line html tag
15802 !! input
15803 <nowiki><div
15804 >foo</div
15805 ></nowiki>
15806 !! result
15807 <p>&lt;div
15808 &gt;foo&lt;/div
15809 &gt;
15810 </p>
15811 !! end
15812
15813 !! test
15814 4. extension tags
15815 !! input
15816 <nowiki><ref>foo</ref></nowiki>
15817 !! result
15818 <p>&lt;ref&gt;foo&lt;/ref&gt;
15819 </p>
15820 !! end
15821
15822 #### --------------- Others ---------------
15823 !! test
15824 Escaping nowikis
15825 !! input
15826 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15827 !! result
15828 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15829 </p>
15830 !! end
15831 !! test
15832
15833 Tag-like HTML structures are passed through as text
15834 !! input
15835 <x y>
15836
15837 <x.y>
15838
15839 <x-y>
15840
15841 1>2
15842
15843 x<y
15844
15845 a>b
15846
15847 1<d e>f
15848 !! result
15849 <p>&lt;x y&gt;
15850 </p><p>&lt;x.y&gt;
15851 </p><p>&lt;x-y&gt;
15852 </p><p>1&gt;2
15853 </p><p>x&lt;y
15854 </p><p>a&gt;b
15855 </p><p>1&lt;d e&gt;f
15856 </p>
15857 !! end
15858
15859
15860 # This fails in the PHP parser (see bug 40670,
15861 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15862 !! test
15863 Tag names followed by punctuation should not be recognized as tags
15864 !! options
15865 parsoid
15866 !! input
15867 <s.ome> text
15868 !! result
15869 <p>&lt;s.ome&gt; text
15870 </p>
15871 !! end
15872
15873 !! test
15874 HTML tag with necessary entities in attributes
15875 !! input
15876 <span title="&amp;amp;">foo</span>
15877 !! result
15878 <p><span title="&amp;amp;">foo</span>
15879 </p>
15880 !! end
15881
15882 !! test
15883 HTML tag with 'unnecessary' entity encoding in attributes
15884 !! input
15885 <span title="&amp;">foo</span>
15886 !! result
15887 <p><span title="&amp;">foo</span>
15888 </p>
15889 !! end
15890
15891 !! test
15892 HTML tag with broken attribute value quoting
15893 !! input
15894 <span title="Hello world>Foo</span>
15895 !! result
15896 <p><span>Foo</span>
15897 </p>
15898 !! end
15899
15900 !! test
15901 Parsoid-only: HTML tag with broken attribute value quoting
15902 !! options
15903 parsoid
15904 !! input
15905 <span title="Hello world>Foo</span>
15906 !! result
15907 <p><span title="Hello world">Foo</span>
15908 </p>
15909 !! end
15910
15911 !! test
15912 Table with broken attribute value quoting
15913 !! input
15914 {|
15915 | title="Hello world|Foo
15916 |}
15917 !! result
15918 <table>
15919 <tr>
15920 <td>Foo
15921 </td></tr></table>
15922
15923 !! end
15924
15925 !! test
15926 Table with broken attribute value quoting on consecutive lines
15927 !! input
15928 {|
15929 | title="Hello world|Foo
15930 | style="color:red|Bar
15931 |}
15932 !! result
15933 <table>
15934 <tr>
15935 <td>Foo
15936 </td>
15937 <td>Bar
15938 </td></tr></table>
15939
15940 !! end
15941
15942 !! test
15943 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15944 !! options
15945 parsoid
15946 !! input
15947 {|
15948 | title="Hello world|Foo
15949 | style="color:red|Bar
15950 |}
15951 !! result
15952 <table><tbody>
15953 <tr>
15954 <td title="Hello world">Foo
15955 </td><td style="color: red">Bar
15956 </td></tr></tbody></table>
15957
15958 !! end
15959
15960 !! test
15961 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15962 !! options
15963 parsoid
15964 !! input
15965 {{}}
15966 !! result
15967 {{}}
15968 !! end
15969
15970 !! test
15971 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15972 !! options
15973 parsoid
15974 !! input
15975 }}{{
15976 !! result
15977 }}{{
15978 !! end
15979
15980 !!test
15981 Accept empty td cell attribute
15982 !!input
15983 {|
15984 | align="center" | foo || |
15985 |}
15986 !!result
15987 <table>
15988 <tr>
15989 <td align="center"> foo </td>
15990 <td>
15991 </td></tr></table>
15992
15993 !!end
15994
15995 !!test
15996 Non-empty attributes in th-cells
15997 !!input
15998 {|
15999 ! Foo !! style="color: red" | Bar
16000 |}
16001 !!result
16002 <table>
16003 <tr>
16004 <th> Foo </th>
16005 <th style="color: red"> Bar
16006 </th></tr></table>
16007
16008 !!end
16009
16010 !!test
16011 Accept empty attributes in th-cells
16012 !!input
16013 {|
16014 !| foo !!| bar
16015 |}
16016 !!result
16017 <table>
16018 <tr>
16019 <th> foo </th>
16020 <th> bar
16021 </th></tr></table>
16022
16023 !!end
16024
16025 !!test
16026 Empty table rows go away
16027 !!input
16028 {|
16029 | Hello
16030 | there
16031 |- class="foo"
16032 |-
16033 |}
16034 !! result
16035 <table>
16036 <tr>
16037 <td> Hello
16038 </td>
16039 <td> there
16040 </td></tr>
16041
16042 </table>
16043
16044 !! end
16045
16046 ###
16047 ### Parsoid-centric tests for testing RTing of inter-element separators
16048 ### Edge cases not tested by existing parser tests and specific to
16049 ### Parsoid-specific serialization strategies.
16050 ###
16051
16052 !!test
16053 RT-ed inter-element separators should be valid separators
16054 !!input
16055 {|
16056 |- [[foo]]
16057 |}
16058 !!result
16059 <table>
16060
16061 </table>
16062
16063 !!end
16064
16065 !!test
16066 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16067 (Parsoid-only since PHP parser relies on Tidy for correct output)
16068 !!options
16069 parsoid
16070 !!input
16071 {|
16072 |<small>foo
16073 bar
16074 |}
16075
16076 {|
16077 |<small>foo<small>
16078 |}
16079 !!result
16080 !!end
16081
16082 !!test
16083 Empty TD followed by TD with tpl-generated attribute
16084 !!input
16085 {|
16086 |-
16087 |
16088 |{{echo|style='color:red'}}|foo
16089 |}
16090 !!result
16091 <table>
16092
16093 <tr>
16094 <td>
16095 </td>
16096 <td>foo
16097 </td></tr></table>
16098
16099 !!end
16100
16101 !!test
16102 Indented table with an empty td
16103 !!input
16104 {|
16105 |-
16106 |
16107 |foo
16108 |}
16109 !!result
16110 <table>
16111
16112 <tr>
16113 <td>
16114 </td>
16115 <td>foo
16116 </td></tr></table>
16117
16118 !!end
16119
16120 !!test
16121 Empty TR followed by a template-generated TR
16122 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16123 !!options
16124 parsoid=wt2html,wt2wt
16125 !!input
16126 {|
16127 |-
16128 {{echo|<tr><td>foo</td></tr>}}
16129 |}
16130 !!result
16131 <table>
16132 <tbody>
16133 <tr></tr>
16134 <tr typeof="mw:Transclusion">
16135 <td>foo</td></tr></tbody></table>
16136 !!end
16137
16138 ## PHP and parsoid output differ for this, and since this is primarily
16139 ## for testing Parsoid's serializer, marking this Parsoid only
16140 !!test
16141 Empty TR followed by mixed-ws-comment line should RT correctly
16142 !!options
16143 parsoid
16144 !!input
16145 {|
16146 |-
16147 <!--c-->
16148 |-
16149 <!--c--> <!--d-->
16150 |}
16151 !!result
16152 <table>
16153 <tbody>
16154 <tr>
16155 <td> <!--c--></td></tr>
16156 <tr>
16157 <td><!--c--> <!--d--></td></tr>
16158 </tbody></table>
16159
16160 !!end
16161
16162 !!test
16163 Multi-line image caption generated by templates with/without trailing newlines
16164 !!options
16165 parsoid
16166 !!input
16167 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16168 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16169 !!result
16170 <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>
16171 <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>
16172
16173 !!end
16174
16175 ## PHP emits broken html for this, and since this is primarily
16176 ## a Parsoid serializer test, marking this Parsoid only
16177 !!test
16178 Improperly nested inline or quotes tags with whitespace in between
16179 !!options
16180 parsoid
16181 !!input
16182 <span> <s>x</span> </s>
16183 ''' ''x''' ''
16184 !!result
16185 <p><span> <s>x</s></span><s> </s>
16186 <b> <i>x</i></b><i> </i>
16187 </p>
16188 !!end
16189
16190 # -----------------------------------------------------------------
16191 # The following section of tests are primarily to spec requirements
16192 # around serialization of new/edited content.
16193 #
16194 # All these tests are marked Parsoid html2wt and html2html only
16195 # ----------------------------------------------------------------
16196
16197 !! test
16198 Image: Modifying size of an image
16199 !! options
16200 parsoid=html2wt
16201 !! input
16202 [[Image:Wiki.png|230x230px]]
16203 !! result
16204 <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>
16205 !!end
16206
16207 !! test
16208 Image: New block level image should have \n before and after
16209 !! options
16210 parsoid=html2wt
16211 !! input
16212 123
16213 [[File:Wiki.png|right|thumb|150x150px]]
16214 456
16215 !! result
16216 <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>
16217 !!end
16218
16219 !! test
16220 Lists: Add space after bullets
16221 !! options
16222 parsoid=html2wt
16223 !! input
16224
16225 * foo
16226 * bar
16227 * <span> baz</span>
16228 !! result
16229 <ul>
16230 <li>foo</li>
16231 <li> bar</li>
16232 <li><span> baz</span></li>
16233 </ul>
16234 !! end
16235
16236
16237 TODO:
16238 more images
16239 more tables
16240 character entities
16241 and much more
16242 Try for 100% code coverage