Add new parserTests for table cell attributes coming from templates.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 A?b
131 !! text
132 Weirdo titles!
133 !! endarticle
134
135 ###
136 ### Basic tests
137 ###
138 !! test
139 Blank input
140 !! input
141 !! result
142 !! end
143
144
145 !! test
146 Simple paragraph
147 !! input
148 This is a simple paragraph.
149 !! result
150 <p>This is a simple paragraph.
151 </p>
152 !! end
153
154 !! test
155 Paragraphs with extra newline spacing
156 !! input
157 foo
158
159 bar
160
161
162 baz
163
164
165
166 booz
167 !! result
168 <p>foo
169 </p><p>bar
170 </p><p><br />
171 baz
172 </p><p><br />
173 </p><p>booz
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with newline spacing with comment lines in between
179 !! input
180 ----
181 a
182 <!--foo-->
183 b
184 ----
185 a
186 <!--foo--><!--More than 1 comment disables stripping of this line!-->
187 b
188 ----
189 a
190 <!--foo-->
191
192 b
193 ----
194 a
195
196 <!--foo-->
197 b
198 ----
199 a
200 <!--foo-->
201
202
203 b
204 ----
205 a
206
207
208 <!--foo-->
209 b
210 ----
211 !! result
212 <hr />
213 <p>a
214 b
215 </p>
216 <hr />
217 <p>a
218 </p><p>b
219 </p>
220 <hr />
221 <p>a
222 </p><p>b
223 </p>
224 <hr />
225 <p>a
226 </p><p>b
227 </p>
228 <hr />
229 <p>a
230 </p><p><br />
231 b
232 </p>
233 <hr />
234 <p>a
235 </p><p><br />
236 b
237 </p>
238 <hr />
239
240 !! end
241
242 !! test
243 Paragraphs with newline spacing with non-empty white-space lines in between
244 !! input
245 ----
246 a
247
248 b
249 ----
250 a
251
252
253 b
254 ----
255 !! result
256 <hr />
257 <p>a
258 </p><p>b
259 </p>
260 <hr />
261 <p>a
262 </p><p><br />
263 b
264 </p>
265 <hr />
266
267 !! end
268
269 !! test
270 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
271 !! input
272 ----
273 a
274 <!--foo-->
275 b
276 ----
277 a
278 <!--foo--><!--More than 1 comment disables stripping of this line!-->
279 b
280 ----
281 a
282
283 <!--foo-->
284 <!--bar-->
285 b
286 ----
287 a
288
289 <!--foo-->
290 <!--bar-->
291
292 b
293 ----
294 !! result
295 <hr />
296 <p>a
297 b
298 </p>
299 <hr />
300 <p>a
301 </p><p>b
302 </p>
303 <hr />
304 <p>a
305 </p><p>b
306 </p>
307 <hr />
308 <p>a
309 </p><p><br />
310 b
311 </p>
312 <hr />
313
314 !! end
315
316 !! test
317 Extra newlines: More paragraphs with indented comment
318 !! input
319 a
320
321 <!--boo-->
322
323 b
324 !!result
325 <p>a
326 </p><p><br />
327 b
328 </p>
329 !!end
330
331 !! test
332 Extra newlines followed by heading
333 !! input
334 a
335
336
337
338 =b=
339 [[a]]
340
341
342 =b=
343 !! result
344 <p>a
345 </p><p><br />
346 </p>
347 <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>
348 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
349 </p><p><br />
350 </p>
351 <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>
352
353 !! end
354
355 !! test
356 Extra newlines between heading and content are swallowed
357 !! input
358 =b=
359
360
361
362 [[a]]
363 !! result
364 <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>
365 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
366 </p>
367 !! end
368
369 !! test
370 Parsing an URL
371 !! input
372 http://fr.wikipedia.org/wiki/🍺
373 <!-- EasterEgg we love beer, better be able be able to link to it -->
374 !! result
375 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
376 </p>
377 !! end
378
379 !! test
380 Simple list
381 !! input
382 * Item 1
383 * Item 2
384 !! result
385 <ul><li> Item 1
386 </li><li> Item 2
387 </li></ul>
388
389 !! end
390
391 !! test
392 Italics and bold
393 !! input
394 * plain
395 * plain''italic''plain
396 * plain''italic''plain''italic''plain
397 * plain'''bold'''plain
398 * plain'''bold'''plain'''bold'''plain
399 * plain''italic''plain'''bold'''plain
400 * plain'''bold'''plain''italic''plain
401 * plain''italic'''bold-italic'''italic''plain
402 * plain'''bold''bold-italic''bold'''plain
403 * plain'''''bold-italic'''italic''plain
404 * plain'''''bold-italic''bold'''plain
405 * plain''italic'''bold-italic'''''plain
406 * plain'''bold''bold-italic'''''plain
407 * plain l'''italic''plain
408 * plain l''''bold''' plain
409 !! result
410 <ul><li> plain
411 </li><li> plain<i>italic</i>plain
412 </li><li> plain<i>italic</i>plain<i>italic</i>plain
413 </li><li> plain<b>bold</b>plain
414 </li><li> plain<b>bold</b>plain<b>bold</b>plain
415 </li><li> plain<i>italic</i>plain<b>bold</b>plain
416 </li><li> plain<b>bold</b>plain<i>italic</i>plain
417 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
418 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
419 </li><li> plain<i><b>bold-italic</b>italic</i>plain
420 </li><li> plain<b><i>bold-italic</i>bold</b>plain
421 </li><li> plain<i>italic<b>bold-italic</b></i>plain
422 </li><li> plain<b>bold<i>bold-italic</i></b>plain
423 </li><li> plain l'<i>italic</i>plain
424 </li><li> plain l'<b>bold</b> plain
425 </li></ul>
426
427 !! end
428
429 # this example taken from the simple/Moon article
430 !! test
431 Italics and possessives
432 !! input
433 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
434 !! result
435 <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
436 </p>
437 !! end
438
439 ###
440 ### 2-quote opening sequence tests
441 ###
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,2)
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,3)
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,4)
464 !! input
465 ''foo''''
466 !! result
467 <p><i>foo''</i>
468 </p>
469 !!end
470
471
472 !! test
473 Italics and bold: 2-quote opening sequence: (2,5) (php)
474 !! options
475 php
476 !! input
477 ''foo'''''
478 !! result
479 <p><i>foo</i>
480 </p>
481 !!end
482 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
483 !! test
484 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
485 !! options
486 parsoid
487 !! input
488 ''foo'''''
489 !! result
490 <p><i>foo</i><b></b>
491 </p>
492 !!end
493
494
495 ###
496 ### 3-quote opening sequence tests
497 ###
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,2)
501 !! input
502 '''foo''
503 !! result
504 <p>'<i>foo</i>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,3)
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,4)
521 !! input
522 '''foo''''
523 !! result
524 <p><b>foo'</b>
525 </p>
526 !!end
527
528
529 !! test
530 Italics and bold: 3-quote opening sequence: (3,5) (php)
531 !! options
532 php
533 !! input
534 '''foo'''''
535 !! result
536 <p><b>foo</b>
537 </p>
538 !!end
539 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
540 !! test
541 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
542 !! options
543 parsoid
544 !! input
545 '''foo'''''
546 !! result
547 <p><b>foo<i></i></b>
548 </p>
549 !!end
550
551
552 ###
553 ### 4-quote opening sequence tests
554 ###
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,2)
558 !! input
559 ''''foo''
560 !! result
561 <p>''<i>foo</i>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,3)
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,4)
578 !! input
579 ''''foo''''
580 !! result
581 <p>'<b>foo'</b>
582 </p>
583 !!end
584
585
586 !! test
587 Italics and bold: 4-quote opening sequence: (4,5) (php)
588 !! options
589 php
590 !! input
591 ''''foo'''''
592 !! result
593 <p>'<b>foo</b>
594 </p>
595 !!end
596 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
597 !! test
598 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
599 !! options
600 parsoid
601 !! input
602 ''''foo'''''
603 !! result
604 <p>'<b>foo<i></i></b>
605 </p>
606 !!end
607
608
609 ###
610 ### 5-quote opening sequence tests
611 ###
612
613 !! test
614 Italics and bold: 5-quote opening sequence: (5,2) (php)
615 !! options
616 php
617 !! input
618 '''''foo''
619 !! result
620 <p><b><i>foo</i></b>
621 </p>
622 !!end
623 # Parsoid reverses the nesting order, compared to the PHP parser
624 !! test
625 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
626 !! options
627 parsoid
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,3)
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,4)
648 !! input
649 '''''foo''''
650 !! result
651 <p><i><b>foo'</b></i>
652 </p>
653 !!end
654
655
656 !! test
657 Italics and bold: 5-quote opening sequence: (5,5)
658 !! input
659 '''''foo'''''
660 !! result
661 <p><i><b>foo</b></i>
662 </p>
663 !!end
664
665 ###
666 ### multiple quote sequences in a line
667 ###
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,2)
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,3)
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: (2,4,4)
690 !! input
691 ''foo''''bar''''
692 !! result
693 <p><i>foo'<b>bar'</b></i>
694 </p>
695 !!end
696
697
698 !! test
699 Italics and bold: multiple quote sequences: (3,4,2) (php)
700 !! options
701 php
702 !! input
703 '''foo''''bar''
704 !! result
705 <p><b>foo'</b>bar
706 </p>
707 !!end
708 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
709 !! test
710 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
711 !! options
712 parsoid
713 !! input
714 '''foo''''bar''
715 !! result
716 <p><b>foo'</b>bar<i></i>
717 </p>
718 !!end
719
720
721 !! test
722 Italics and bold: multiple quote sequences: (3,4,3) (php)
723 !! options
724 php
725 !! input
726 '''foo''''bar'''
727 !! result
728 <p><b>foo'</b>bar
729 </p>
730 !!end
731 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
732 !! test
733 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
734 !! options
735 parsoid
736 !! input
737 '''foo''''bar'''
738 !! result
739 <p><b>foo'</b>bar<b></b>
740 </p>
741 !!end
742
743 ###
744 ### other quote tests
745 ###
746 !! test
747 Italics and bold: other quote tests: (2,3,5)
748 !! input
749 ''this is about '''foo's family'''''
750 !! result
751 <p><i>this is about <b>foo's family</b></i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (2,(3,3),2)
758 !! input
759 ''this is about '''foo's''' family''
760 !! result
761 <p><i>this is about <b>foo's</b> family</i>
762 </p>
763 !!end
764
765
766 !! test
767 Italics and bold: other quote tests: (3,2,3,2)
768 !! input
769 '''this is about ''foo'''s family''
770 !! result
771 <p><b>this is about <i>foo</i></b><i>s family</i>
772 </p>
773 !!end
774
775
776 # The Parsoid team believes the PHP parser's output on this test is wrong.
777 # It only checks for convert-to-bold-on-single-character-word when the word
778 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
779 # This means that the bold token in position 2 (0-indexed) gets converted by
780 # parsoid, but doesn't get changed by the PHP parser.
781 !! test
782 Italics and bold: other quote tests: (3,2,3,3) (php)
783 !! options
784 php
785 !! input
786 '''this is about ''foo'''s family'''
787 !! result
788 <p>'<i>this is about </i>foo<b>s family</b>
789 </p>
790 !!end
791 # This is the output the Parsoid team believes to be correct.
792 !! test
793 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
794 !! options
795 parsoid
796 !! input
797 '''this is about ''foo'''s family'''
798 !! result
799 <p><b>this is about <i>foo'</i>s family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italics and bold: other quote tests: (3,(2,2),3)
806 !! input
807 '''this is about ''foo's'' family'''
808 !! result
809 <p><b>this is about <i>foo's</i> family</b>
810 </p>
811 !!end
812
813
814 !! test
815 Italicized possessive
816 !! input
817 The ''[[Main Page]]'''s talk page.
818 !! result
819 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
820 </p>
821 !! end
822
823 !! test
824 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
825 (Requires tidy for PHP parser output to be fixed up)
826 !! options
827 parsoid=wt2html,wt2wt
828 !! input
829 {|
830 !''a!!''b
831 |''a||''b
832 |}
833 !! result
834 <table>
835 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
836 <td><i>a</i></td><td><i>b</i></td></tr>
837 </tbody></table>
838 !! end
839
840 ###
841 ### Non-html5 tags
842 ###
843
844 !! test
845 Non-html5 tags should be accepted
846 !! input
847 <center>''foo''</center>
848 <big>''foo''</big>
849 <font>''foo''</font>
850 <strike>''foo''</strike>
851 <tt>''foo''</tt>
852 !! result
853 <center><i>foo</i></center>
854 <p><big><i>foo</i></big>
855 <font><i>foo</i></font>
856 <strike><i>foo</i></strike>
857 <tt><i>foo</i></tt>
858 </p>
859 !! end
860
861 ###
862 ### <nowiki> test cases
863 ###
864
865 !! test
866 <nowiki> unordered list
867 !! input
868 <nowiki>* This is not an unordered list item.</nowiki>
869 !! result
870 <p>* This is not an unordered list item.
871 </p>
872 !! end
873
874 !! test
875 <nowiki> spacing
876 !! input
877 <nowiki>Lorem ipsum dolor
878
879 sed abit.
880 sed nullum.
881
882 :and a colon
883 </nowiki>
884 !! result
885 <p>Lorem ipsum dolor
886
887 sed abit.
888 sed nullum.
889
890 :and a colon
891
892 </p>
893 !! end
894
895 !! test
896 nowiki 3
897 !! input
898 :There is not nowiki.
899 :There is <nowiki>nowiki</nowiki>.
900
901 #There is not nowiki.
902 #There is <nowiki>nowiki</nowiki>.
903
904 *There is not nowiki.
905 *There is <nowiki>nowiki</nowiki>.
906 !! result
907 <dl><dd>There is not nowiki.
908 </dd><dd>There is nowiki.
909 </dd></dl>
910 <ol><li>There is not nowiki.
911 </li><li>There is nowiki.
912 </li></ol>
913 <ul><li>There is not nowiki.
914 </li><li>There is nowiki.
915 </li></ul>
916
917 !! end
918
919 !! test
920 Entities inside <nowiki>
921 !! input
922 <nowiki>&lt;</nowiki>
923 !! result
924 <p>&lt;
925 </p>
926 !! end
927
928 !! test
929 Entities inside template parameters
930 !! options
931 parsoid
932 !! input
933 {{echo|&ndash;}}
934 !! result
935 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
936 </p>
937 !! end
938
939 ###
940 ### Comments
941 ###
942 !! test
943 Comments and Indent-Pre
944 !! input
945 <!-- comment 1 --> asdf
946
947 <!-- comment 1 --> asdf
948 <!-- comment 2 -->
949
950 <!-- comment 1 --> asdf
951 <!-- comment 2 -->xyz
952
953 <!-- comment 1 --> asdf
954 <!-- comment 2 --> xyz
955 !! result
956 <pre>asdf
957 </pre>
958 <pre>asdf
959 </pre>
960 <pre>asdf
961 </pre>
962 <p>xyz
963 </p>
964 <pre>asdf
965 xyz
966 </pre>
967 !! end
968
969 !! test
970 Comment test 2a
971 !! input
972 asdf
973 <!-- comment 1 -->
974 jkl
975 !! result
976 <p>asdf
977 jkl
978 </p>
979 !! end
980
981 !! test
982 Comment test 2b
983 !! input
984 asdf
985 <!-- comment 1 -->
986
987 jkl
988 !! result
989 <p>asdf
990 </p><p>jkl
991 </p>
992 !! end
993
994 !! test
995 Comment test 3
996 !! input
997 asdf
998 <!-- comment 1 -->
999 <!-- comment 2 -->
1000 jkl
1001 !! result
1002 <p>asdf
1003 jkl
1004 </p>
1005 !! end
1006
1007 !! test
1008 Comment test 4
1009 !! input
1010 asdf<!-- comment 1 -->jkl
1011 !! result
1012 <p>asdfjkl
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment spacing
1018 !! input
1019 a
1020 <!-- foo --> b <!-- bar -->
1021 c
1022 !! result
1023 <p>a
1024 </p>
1025 <pre> b
1026 </pre>
1027 <p>c
1028 </p>
1029 !! end
1030
1031 !! test
1032 Comment whitespace
1033 !! input
1034 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1035 !! result
1036
1037 !! end
1038
1039 !! test
1040 Comment semantics and delimiters
1041 !! input
1042 <!-- --><!----><!-----><!------>
1043 !! result
1044
1045 !! end
1046
1047 !! test
1048 Comment semantics and delimiters, redux
1049 !! input
1050 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1051 -- foo -- funky huh? ... -->
1052 !! result
1053
1054 !! end
1055
1056 !! test
1057 Comment semantics and delimiters: directors cut
1058 !! input
1059 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1060 everything starting with < followed by !-- until the first -- and > we see,
1061 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1062 -->-->
1063 !! result
1064 <p>--&gt;
1065 </p>
1066 !! end
1067
1068 !! test
1069 Comment semantics: nesting
1070 !! input
1071 <!--<!-- no, we're not going to do anything fancy here -->-->
1072 !! result
1073 <p>--&gt;
1074 </p>
1075 !! end
1076
1077 !! test
1078 Comment semantics: unclosed comment at end
1079 !! input
1080 <!--This comment will run out to the end of the document
1081 !! result
1082
1083 !! end
1084
1085 !! test
1086 Comment in template title
1087 !! input
1088 {{f<!---->oo}}
1089 !! result
1090 <p>FOO
1091 </p>
1092 !! end
1093
1094 !! test
1095 Comment on its own line post-expand
1096 !! input
1097 a
1098 {{blank}}<!---->
1099 b
1100 !! result
1101 <p>a
1102 </p><p>b
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment on its own line post-expand with non-significant whitespace
1108 !! input
1109 a
1110 {{blank}} <!---->
1111 b
1112 !! result
1113 <p>a
1114 </p><p>b
1115 </p>
1116 !! end
1117
1118 ###
1119 ### paragraph wrapping tests
1120 ###
1121 !! test
1122 No block tags
1123 !! input
1124 a
1125
1126 b
1127 !! result
1128 <p>a
1129 </p><p>b
1130 </p>
1131 !! end
1132 !! test
1133 Block tag on one line
1134 !! input
1135 a <div>foo</div>
1136
1137 b
1138 !! result
1139 a <div>foo</div>
1140 <p>b
1141 </p>
1142 !! end
1143
1144 !! test
1145 Block tag on both lines
1146 !! input
1147 a <div>foo</div>
1148
1149 b <div>foo</div>
1150 !! result
1151 a <div>foo</div>
1152 b <div>foo</div>
1153
1154 !! end
1155
1156 !! test
1157 Multiple lines without block tags
1158 !! input
1159 <div>foo</div> a
1160 b
1161 c
1162 d<!--foo--> e
1163 x <div>foo</div> z
1164 !! result
1165 <div>foo</div> a
1166 <p>b
1167 c
1168 d e
1169 </p>
1170 x <div>foo</div> z
1171
1172 !! end
1173
1174 !! test
1175 Empty lines between lines with block tags
1176 !! input
1177 <div></div>
1178
1179
1180 <div></div>a
1181
1182 b
1183 <div>a</div>b
1184
1185 <div>b</div>d
1186
1187
1188 <div>e</div>
1189 !! result
1190 <div></div>
1191 <p><br />
1192 </p>
1193 <div></div>a
1194 <p>b
1195 </p>
1196 <div>a</div>b
1197 <div>b</div>d
1198 <p><br />
1199 </p>
1200 <div>e</div>
1201
1202 !! end
1203
1204 ###
1205 ### Preformatted text
1206 ###
1207 !! test
1208 Preformatted text
1209 !! input
1210 This is some
1211 Preformatted text
1212 With ''italic''
1213 And '''bold'''
1214 And a [[Main Page|link]]
1215 !! result
1216 <pre>This is some
1217 Preformatted text
1218 With <i>italic</i>
1219 And <b>bold</b>
1220 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1221 </pre>
1222 !! end
1223
1224 !! test
1225 Ident preformatting with inline content
1226 !! input
1227 a
1228 ''b''
1229 !! result
1230 <pre>a
1231 <i>b</i>
1232 </pre>
1233 !! end
1234
1235 !! test
1236 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1237 !! input
1238 <pre><nowiki>
1239 <b>
1240 <cite>
1241 <em>
1242 </nowiki></pre>
1243 !! result
1244 <pre>
1245 &lt;b&gt;
1246 &lt;cite&gt;
1247 &lt;em&gt;
1248 </pre>
1249
1250 !! end
1251
1252 !! test
1253 Regression with preformatted in <center>
1254 !! input
1255 <center>
1256 Blah
1257 </center>
1258 !! result
1259 <center>
1260 <pre>Blah
1261 </pre>
1262 </center>
1263
1264 !! end
1265
1266 # Expected output in the following test is not really expected (there should be
1267 # <pre> in the output) -- it's only testing for well-formedness.
1268 !! test
1269 Bug 6200: Preformatted in <blockquote>
1270 !! input
1271 <blockquote>
1272 Blah
1273 </blockquote>
1274 !! result
1275 <blockquote>
1276 Blah
1277 </blockquote>
1278
1279 !! end
1280
1281 !! test
1282 <pre> with attributes (bug 3202)
1283 !! input
1284 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1285 !! result
1286 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1287
1288 !! end
1289
1290 !! test
1291 <pre> with width attribute (bug 3202)
1292 !! input
1293 <pre width="8">Narrow screen goodies</pre>
1294 !! result
1295 <pre width="8">Narrow screen goodies</pre>
1296
1297 !! end
1298
1299 !! test
1300 <pre> with forbidden attribute (bug 3202)
1301 !! input
1302 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1303 !! result
1304 <pre width="8">Narrow screen goodies</pre>
1305
1306 !! end
1307
1308 !! test
1309 Entities inside <pre>
1310 !! input
1311 <pre>&lt;</pre>
1312 !! result
1313 <pre>&lt;</pre>
1314
1315 !! end
1316
1317 !! test
1318 <pre> with forbidden attribute values (bug 3202)
1319 !! input
1320 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1321 !! result
1322 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1323
1324 !! end
1325
1326 !! test
1327 <nowiki> inside <pre> (bug 13238)
1328 !! input
1329 <pre>
1330 <nowiki>
1331 </pre>
1332 <pre>
1333 <nowiki></nowiki>
1334 </pre>
1335 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1336 !! result
1337 <pre>
1338 &lt;nowiki&gt;
1339 </pre>
1340 <pre>
1341
1342 </pre>
1343 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1344
1345 !! end
1346
1347 !! test
1348 <nowiki> and <pre> preference (first one wins)
1349 !! input
1350 <pre>
1351 <nowiki>
1352 </pre>
1353 </nowiki>
1354 </pre>
1355
1356 <nowiki>
1357 <pre>
1358 <nowiki>
1359 </pre>
1360 </nowiki>
1361 </pre>
1362
1363 !! result
1364 <pre>
1365 &lt;nowiki&gt;
1366 </pre>
1367 <p>&lt;/nowiki&gt;
1368 &lt;/pre&gt;
1369 </p><p>
1370 &lt;pre&gt;
1371 &lt;nowiki&gt;
1372 &lt;/pre&gt;
1373
1374 &lt;/pre&gt;
1375 </p>
1376 !! end
1377
1378 !! test
1379 </pre> inside nowiki
1380 !! input
1381 <nowiki></pre></nowiki>
1382 !! result
1383 <p>&lt;/pre&gt;
1384 </p>
1385 !! end
1386
1387 !!test
1388 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1389 !!input
1390 {{echo|}}
1391 !!result
1392
1393 !!end
1394
1395 !!test
1396 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1397 !!input
1398 {{echo|
1399 foo}}
1400 !!result
1401 <p>foo
1402 </p>
1403 !!end
1404
1405 !! test
1406 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1407 !! input
1408 {{echo|a
1409 b}}
1410 !!result
1411 <pre>a
1412 </pre>
1413 <p>b
1414 </p>
1415 !!end
1416
1417 !! test
1418 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1419 !! input
1420 {{echo|a
1421 b
1422 c
1423 d
1424 e
1425 }}
1426 !!result
1427 <pre>a
1428 </pre>
1429 <p>b
1430 c
1431 </p>
1432 <pre>d
1433 </pre>
1434 <p>e
1435 </p>
1436 !!end
1437
1438 !!test
1439 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1440 !!input
1441 {{echo| foo}}
1442
1443 {{echo| foo}}{{echo| bar}}
1444
1445 {{echo| foo}}
1446 {{echo| bar}}
1447
1448 {{echo|<!--cmt--> foo}}
1449
1450 <!--cmt-->{{echo| foo}}
1451
1452 {{echo|{{echo| }}bar}}
1453 !!result
1454 <pre>foo
1455 </pre>
1456 <pre>foo bar
1457 </pre>
1458 <pre>foo
1459 bar
1460 </pre>
1461 <pre>foo
1462 </pre>
1463 <pre>foo
1464 </pre>
1465 <pre>bar
1466 </pre>
1467 !!end
1468
1469 !! test
1470 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1471 !! input
1472 {{echo| }}a
1473
1474 {{echo|
1475 }}a
1476
1477 {{echo|
1478 b}}
1479
1480 {{echo|a
1481 }}b
1482
1483 {{echo|a
1484 }} b
1485 !!result
1486 <pre>a
1487 </pre>
1488 <p><br />
1489 </p>
1490 <pre>a
1491 </pre>
1492 <p><br />
1493 </p>
1494 <pre>b
1495 </pre>
1496 <p>a
1497 </p>
1498 <pre>b
1499 </pre>
1500 <p>a
1501 </p>
1502 <pre>b
1503 </pre>
1504 !!end
1505
1506 !! test
1507 Templates: Single-line variant of parameter whitespace stripping test
1508 !! input
1509 {{echo| a}}
1510
1511 {{echo|1= a}}
1512
1513 {{echo|{{echo| a}}}}
1514
1515 {{echo|1={{echo| a}}}}
1516 !! result
1517 <pre>a
1518 </pre>
1519 <p>a
1520 </p>
1521 <pre>a
1522 </pre>
1523 <p>a
1524 </p>
1525 !! end
1526
1527 !! test
1528 Templates: Strip whitespace from named parameters, but not positional ones
1529 !! input
1530 {{echo|
1531 foo}}
1532
1533 {{echo|
1534 * foo}}
1535
1536 {{echo| 1 =
1537 foo}}
1538
1539 {{echo| 1 =
1540 * foo}}
1541 !! result
1542 <pre>foo
1543 </pre>
1544 <p><br />
1545 </p>
1546 <ul><li> foo
1547 </li></ul>
1548 <p>foo
1549 </p>
1550 <ul><li> foo
1551 </li></ul>
1552
1553 !! end
1554
1555 !! test
1556 Templates: Dont strip whitespace from whitespace/comment-only arguments
1557 !! input
1558 {{echo| }}
1559 {{echo|<!--cmt-->}}
1560 {{echo| <!--cmt--> }}
1561 !! result
1562 <p><br />
1563 </p>
1564 !! end
1565
1566 !! test
1567 Templates: Parsoid parameter escaping test 1
1568 !! options
1569 parsoid
1570 !! input
1571 {{echo|[foo]|{{echo|[bar]}}}}
1572 !! result
1573 <p about="#mwt1" typeof="mw:Transclusion"
1574 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>
1575 !! end
1576
1577 !! test
1578 Parsoid: Pipes in external links in template parameter
1579 !! options
1580 parsoid
1581 !! input
1582 {{echo|[{{echo|http://example.com}} link]}}
1583 !! result
1584 <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>
1585 !! end
1586
1587 !! test
1588 Parsoid: pipe in transclusion parameter
1589 !! options
1590 parsoid
1591 !! input
1592 {{echo|http://foo.com/a&#124;b}}
1593 !! result
1594 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1595 typeof="mw:Transclusion"
1596 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>
1597 !! end
1598
1599 !! test
1600 Parsoid: Pipe in external link target and content in template parameter
1601 !! options
1602 parsoid=html2wt,wt2wt
1603 !! input
1604 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1605 !! result
1606 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1607 typeof="mw:Transclusion"
1608 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1609 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1610 !! end
1611
1612 !! test
1613 Templates: Dont escape already nowiki-escaped text in template parameters
1614 !! options
1615 parsoid=html2wt,wt2wt
1616 !! input
1617 {{echo|foo<nowiki>|</nowiki>bar}}
1618 !! result
1619 <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>
1620 !! end
1621
1622 ###
1623 ### Parsoid-centric tests for testing RT edge cases for pre
1624 ###
1625
1626 !!test
1627 1a. Indent-Pre and Comments
1628 !!input
1629 a
1630 <!--a-->
1631 c
1632 !!result
1633 <pre>a
1634 </pre>
1635 <p>c
1636 </p>
1637 !!end
1638
1639 !!test
1640 1b. Indent-Pre and Comments
1641 !!input
1642 a
1643 <!--a-->
1644 c
1645 !!result
1646 <pre>a
1647 </pre>
1648 <p>c
1649 </p>
1650 !!end
1651
1652 !!test
1653 1c. Indent-Pre and Comments
1654 !!input
1655 <!--a--> a
1656
1657 <!--a--> a
1658 !!result
1659 <pre> a
1660 </pre>
1661 <pre> a
1662 </pre>
1663 !!end
1664
1665 !!test
1666 2a. Indent-Pre and tables
1667 !!input
1668 {|
1669 |-
1670 !h1!!h2
1671 |foo||bar
1672 |}
1673 !!result
1674 <table>
1675
1676 <tr>
1677 <th>h1</th>
1678 <th>h2
1679 </th>
1680 <td>foo</td>
1681 <td>bar
1682 </td></tr></table>
1683
1684 !!end
1685
1686 !!test
1687 2b. Indent-Pre and tables
1688 !!input
1689 {|
1690 |-
1691 |foo
1692 |}
1693 !!result
1694 <table>
1695
1696 <tr>
1697 <td>foo
1698 </td></tr></table>
1699
1700 !!end
1701
1702 !!test
1703 2c. Indent-Pre and tables (bug 42252)
1704 !!input
1705 {|
1706 |+ foo
1707 ! | bar
1708 |}
1709 !!result
1710 <table>
1711 <caption> foo
1712 </caption>
1713 <tr>
1714 <th> bar
1715 </th></tr></table>
1716
1717 !!end
1718
1719 !!test
1720 3a. Indent-Pre and block tags (single-line html)
1721 !!input
1722 <p> foo </p>
1723 <div> foo </div>
1724 <span> foo </span>
1725 !!result
1726 <p> foo </p>
1727 <div> foo </div>
1728 <pre><span> foo </span>
1729 </pre>
1730 !!end
1731
1732 !!test
1733 3b. Indent-Pre and block tags (pre-content on separate line)
1734 !!input
1735 <p>
1736 foo
1737 </p>
1738
1739 <div>
1740 foo
1741 </div>
1742
1743 <center>
1744 foo
1745 </center>
1746
1747 <blockquote>
1748 foo
1749 </blockquote>
1750
1751 <table><tr><td>
1752 foo
1753 </td></tr></table>
1754
1755 <ul><li>
1756 foo
1757 </li></ul>
1758
1759 !!result
1760 <p>
1761 foo
1762 </p>
1763 <div>
1764 <pre>foo
1765 </pre>
1766 </div>
1767 <center>
1768 <pre>foo
1769 </pre>
1770 </center>
1771 <blockquote>
1772 foo
1773 </blockquote>
1774 <table><tr><td>
1775 <pre>foo
1776 </pre>
1777 </td></tr></table>
1778 <ul><li>
1779 foo
1780 </li></ul>
1781
1782 !!end
1783
1784 !!test
1785 4. Multiple spaces at start-of-line
1786 !!input
1787 <p> foo </p>
1788 foo
1789 {|
1790 |foo
1791 |}
1792 !!result
1793 <p> foo </p>
1794 <pre> foo
1795 </pre>
1796 <table>
1797 <tr>
1798 <td>foo
1799 </td></tr></table>
1800
1801 !!end
1802
1803 !! test
1804 5. White-space in indent-pre
1805 NOTE: the white-space char on 2nd line is significant
1806 !! input
1807 a<br/>
1808
1809 b
1810 !! result
1811 <pre>a<br />
1812
1813 b
1814 </pre>
1815 !! end
1816
1817 ###
1818 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1819 ###
1820
1821 !!test
1822 HTML-pre: 1. embedded newlines
1823 !!input
1824 <pre>foo</pre>
1825
1826 <pre>
1827 foo
1828 </pre>
1829
1830 <pre>
1831
1832 foo
1833 </pre>
1834
1835 <pre>
1836
1837
1838 foo
1839 </pre>
1840 !!result
1841 <pre>foo</pre>
1842 <pre>
1843 foo
1844 </pre>
1845 <pre>
1846
1847 foo
1848 </pre>
1849 <pre>
1850
1851
1852 foo
1853 </pre>
1854
1855 !!end
1856
1857 !!test
1858 HTML-pre: 2: indented text
1859 !!input
1860 <pre>
1861 foo
1862 </pre>
1863 !!result
1864 <pre>
1865 foo
1866 </pre>
1867
1868 !!end
1869
1870 !!test
1871 HTML-pre: 3: other wikitext
1872 !!input
1873 <pre>
1874 * foo
1875 # bar
1876 = no-h =
1877 '' no-italic ''
1878 [[ NoLink ]]
1879 </pre>
1880 !!result
1881 <pre>
1882 * foo
1883 # bar
1884 = no-h =
1885 '' no-italic ''
1886 [[ NoLink ]]
1887 </pre>
1888
1889 !!end
1890
1891 ###
1892 ### Definition lists
1893 ###
1894 !! test
1895 Simple definition
1896 !! input
1897 ; name : Definition
1898 !! result
1899 <dl><dt> name&#160;</dt><dd> Definition
1900 </dd></dl>
1901
1902 !! end
1903
1904 !! test
1905 Definition list for indentation only
1906 !! input
1907 : Indented text
1908 !! result
1909 <dl><dd> Indented text
1910 </dd></dl>
1911
1912 !! end
1913
1914 !! test
1915 Definition list with no space
1916 !! input
1917 ;name:Definition
1918 !! result
1919 <dl><dt>name</dt><dd>Definition
1920 </dd></dl>
1921
1922 !!end
1923
1924 !! test
1925 Definition list with URL link
1926 !! input
1927 ; http://example.com/ : definition
1928 !! result
1929 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1930 </dd></dl>
1931
1932 !! end
1933
1934 !! test
1935 Definition list with bracketed URL link
1936 !! input
1937 ;[http://www.example.com/ Example]:Something about it
1938 !! result
1939 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1940 </dd></dl>
1941
1942 !! end
1943
1944 !! test
1945 Definition list with wikilink containing colon
1946 !! input
1947 ; [[Help:FAQ]]: The least-read page on Wikipedia
1948 !! result
1949 <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
1950 </dd></dl>
1951
1952 !! end
1953
1954 # At Brion's and JeLuF's insistence... :)
1955 !! test
1956 Definition list with news link containing colon
1957 !! input
1958 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1959 !! result
1960 <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!
1961 </dd></dl>
1962
1963 !! end
1964
1965 !! test
1966 Malformed definition list with colon
1967 !! input
1968 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1969 !! result
1970 <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
1971 </dt></dl>
1972
1973 !! end
1974
1975 !! test
1976 Definition lists: colon in external link text
1977 !! input
1978 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1979 !! result
1980 <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
1981 </dd></dl>
1982
1983 !! end
1984
1985 !! test
1986 Definition lists: colon in HTML attribute
1987 !! input
1988 ;<b style="display: inline">bold</b>
1989 !! result
1990 <dl><dt><b style="display: inline">bold</b>
1991 </dt></dl>
1992
1993 !! end
1994
1995 !! test
1996 Definition lists: self-closed tag
1997 !! input
1998 ;one<br/>two : two-line fun
1999 !! result
2000 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2001 </dd></dl>
2002
2003 !! end
2004
2005 !! test
2006 Bug 11748: Literal closing tags
2007 !! input
2008 <dl>
2009 <dt>test 1</dt>
2010 <dd>test test test test test</dd>
2011 <dt>test 2</dt>
2012 <dd>test test test test test</dd>
2013 </dl>
2014 !! result
2015 <dl>
2016 <dt>test 1</dt>
2017 <dd>test test test test test</dd>
2018 <dt>test 2</dt>
2019 <dd>test test test test test</dd>
2020 </dl>
2021
2022 !! end
2023
2024 !! test
2025 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2026 !! input
2027 <ul><li>
2028 ; term : description
2029 * unordered
2030 </li>
2031 </ul>
2032 !! result
2033 <ul><li>
2034 <dl><dt> term&#160;</dt><dd> description
2035 </dd></dl>
2036 <ul><li> unordered
2037 </li></ul>
2038 </li>
2039 </ul>
2040
2041 !! end
2042
2043 !! test
2044
2045 Definition list with empty definition and following paragraph
2046 !! input
2047 ; term:
2048 Paragraph text
2049 !! result
2050 <dl><dt> term</dt><dd>
2051 </dd></dl>
2052 <p>Paragraph text
2053 </p>
2054 !! end
2055
2056 !! test
2057 Nested definition lists using html syntax
2058 !! input
2059 <dl><dd>
2060 <dl>
2061 <dd>Foo</dd>
2062 </dl>
2063 </dd></dl>
2064 !! result
2065 <dl><dd>
2066 <dl>
2067 <dd>Foo</dd>
2068 </dl>
2069 </dd></dl>
2070
2071 !! end
2072
2073 !! test
2074 Definition Lists: No nesting: Multiple dd's
2075 !! input
2076 ;x
2077 :a
2078 :b
2079 !! result
2080 <dl><dt>x
2081 </dt><dd>a
2082 </dd><dd>b
2083 </dd></dl>
2084
2085 !! end
2086
2087 !! test
2088 Definition Lists: Indentation: Regular
2089 !! input
2090 :i1
2091 ::i2
2092 :::i3
2093 !! result
2094 <dl><dd>i1
2095 <dl><dd>i2
2096 <dl><dd>i3
2097 </dd></dl>
2098 </dd></dl>
2099 </dd></dl>
2100
2101 !! end
2102
2103 !! test
2104 Definition Lists: Indentation: Missing 1st level
2105 !! input
2106 ::i2
2107 :::i3
2108 !! result
2109 <dl><dd><dl><dd>i2
2110 <dl><dd>i3
2111 </dd></dl>
2112 </dd></dl>
2113 </dd></dl>
2114
2115 !! end
2116
2117 !! test
2118 Definition Lists: Indentation: Multi-level indent
2119 !! input
2120 :::i3
2121 !! result
2122 <dl><dd><dl><dd><dl><dd>i3
2123 </dd></dl>
2124 </dd></dl>
2125 </dd></dl>
2126
2127 !! end
2128
2129 !! test
2130 Definition Lists: Hacky use to indent tables
2131 !! input
2132 ::{|
2133 |foo
2134 |bar
2135 |}
2136 this text
2137 should be left alone
2138 !! result
2139 <dl><dd><dl><dd><table>
2140 <tr>
2141 <td>foo
2142 </td>
2143 <td>bar
2144 </td></tr></table></dd></dl></dd></dl>
2145 <p>this text
2146 should be left alone
2147 </p>
2148 !! end
2149 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2150 ## as an empty dt item. It also ignores all but the last ";" when followed
2151 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2152 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2153 ## ";"s.
2154 ##
2155 ## Ex: ";;t2 ::d2" is transformed into:
2156 ##
2157 ## <dl>
2158 ## <dt>t2 </dt>
2159 ## <dd>
2160 ## <dl>
2161 ## <dt></dt>
2162 ## <dd>d2</dd>
2163 ## </dl>
2164 ## </dd>
2165 ## </dl>
2166 ##
2167 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2168 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2169 ##
2170 ## <dl>
2171 ## <dt>
2172 ## <dl>
2173 ## <dt>t2 </dt>
2174 ## <dd>:d2</dd>
2175 ## </dl>
2176 ## </dt>
2177 ## </dl>
2178 ##
2179 ## All Parsoid only definition list tests have this difference.
2180 ##
2181 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2182 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2183
2184 !! test
2185 Table / list interaction: indented table with lists in table contents
2186 !! input
2187 :{|
2188 |-
2189 | a
2190 * b
2191 |-
2192 | c
2193 * d
2194 |}
2195 !! result
2196 <dl><dd><table>
2197
2198 <tr>
2199 <td> a
2200 <ul><li> b
2201 </li></ul>
2202 </td></tr>
2203 <tr>
2204 <td> c
2205 <ul><li> d
2206 </li></ul>
2207 </td></tr></table></dd></dl>
2208
2209 !! end
2210
2211 !!test
2212 Table / list interaction: lists nested in tables nested in indented lists
2213 !!input
2214 :{|
2215 |
2216 :a
2217 :b
2218 |
2219 *c
2220 *d
2221 |}
2222
2223 *e
2224 *f
2225 !!result
2226 <dl><dd><table>
2227 <tr>
2228 <td>
2229 <dl><dd>a
2230 </dd><dd>b
2231 </dd></dl>
2232 </td>
2233 <td>
2234 <ul><li>c
2235 </li><li>d
2236 </li></ul>
2237 </td></tr></table></dd></dl>
2238 <ul><li>e
2239 </li><li>f
2240 </li></ul>
2241
2242 !!end
2243
2244 !! test
2245 Definition Lists: Nesting: Multi-level (Parsoid only)
2246 !! options
2247 parsoid
2248 !! input
2249 ;t1 :d1
2250 ;;t2 ::d2
2251 ;;;t3 :::d3
2252 !! result
2253 <dl>
2254 <dt>t1 </dt>
2255 <dd>d1</dd>
2256 <dt>
2257 <dl>
2258 <dt>t2 </dt>
2259 <dd>:d2</dd>
2260 <dt>
2261 <dl>
2262 <dt>t3 </dt>
2263 <dd>::d3</dd>
2264 </dl>
2265 </dt>
2266 </dl>
2267 </dt>
2268 </dl>
2269
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Nesting: Test 2 (Parsoid only)
2276 !! options
2277 parsoid
2278 !! input
2279 ;t1
2280 ::d2
2281 !! result
2282 <dl>
2283 <dt>t1</dt>
2284 <dd>
2285 <dl>
2286 <dd>d2</dd>
2287 </dl>
2288 </dd>
2289 </dl>
2290
2291 !! end
2292
2293
2294 !! test
2295 Definition Lists: Nesting: Test 3 (Parsoid only)
2296 !! options
2297 parsoid
2298 !! input
2299 :;t1
2300 ::::d2
2301 !! result
2302 <dl>
2303 <dd>
2304 <dl>
2305 <dt>t1</dt>
2306 <dd>
2307 <dl>
2308 <dd>
2309 <dl>
2310 <dd>d2</dd>
2311 </dl>
2312 </dd>
2313 </dl>
2314 </dd>
2315 </dl>
2316 </dd>
2317 </dl>
2318
2319 !! end
2320
2321
2322 !! test
2323 Definition Lists: Nesting: Test 4
2324 !! input
2325 ::;t3
2326 :::d3
2327 !! result
2328 <dl><dd><dl><dd><dl><dt>t3
2329 </dt><dd>d3
2330 </dd></dl>
2331 </dd></dl>
2332 </dd></dl>
2333
2334 !! end
2335
2336
2337 ## The Parsoid team believes the following three test exposes a
2338 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2339 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2340 !! test
2341 Definition Lists: Mixed Lists: Test 1 (php)
2342 !! options
2343 php
2344 !! input
2345 :;* foo
2346 ::* bar
2347 :; baz
2348 !! result
2349 <dl><dd><dl><dt><ul><li> foo
2350 </li><li> bar
2351 </li></ul>
2352 </dt></dl>
2353 <dl><dt> baz
2354 </dt></dl>
2355 </dd></dl>
2356
2357 !! end
2358 !! test
2359 Definition Lists: Mixed Lists: Test 1 (parsoid)
2360 !! options
2361 parsoid
2362 !! input
2363 :;* foo
2364 ::* bar
2365 :; baz
2366 !! result
2367 <dl><dd><dl><dt><ul><li> foo
2368 </li></ul></dt><dd><ul><li> bar
2369 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2370 !! end
2371
2372 !! test
2373 Definition Lists: Mixed Lists: Test 2
2374 !! input
2375 *: d1
2376 *: d2
2377 !! result
2378 <ul><li><dl><dd> d1
2379 </dd><dd> d2
2380 </dd></dl>
2381 </li></ul>
2382
2383 !! end
2384
2385
2386 !! test
2387 Definition Lists: Mixed Lists: Test 3
2388 !! input
2389 *::: d1
2390 *::: d2
2391 !! result
2392 <ul><li><dl><dd><dl><dd><dl><dd> d1
2393 </dd><dd> d2
2394 </dd></dl>
2395 </dd></dl>
2396 </dd></dl>
2397 </li></ul>
2398
2399 !! end
2400
2401
2402 !! test
2403 Definition Lists: Mixed Lists: Test 4
2404 !! input
2405 *;d1 :d2
2406 *;d3 :d4
2407 !! result
2408 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2409 </dd><dt>d3&#160;</dt><dd>d4
2410 </dd></dl>
2411 </li></ul>
2412
2413 !! end
2414
2415
2416 !! test
2417 Definition Lists: Mixed Lists: Test 5
2418 !! input
2419 *:d1
2420 *:: d2
2421 !! result
2422 <ul><li><dl><dd>d1
2423 <dl><dd> d2
2424 </dd></dl>
2425 </dd></dl>
2426 </li></ul>
2427
2428 !! end
2429
2430
2431 !! test
2432 Definition Lists: Mixed Lists: Test 6
2433 !! input
2434 #*:d1
2435 #*::: d3
2436 !! result
2437 <ol><li><ul><li><dl><dd>d1
2438 <dl><dd><dl><dd> d3
2439 </dd></dl>
2440 </dd></dl>
2441 </dd></dl>
2442 </li></ul>
2443 </li></ol>
2444
2445 !! end
2446
2447
2448 !! test
2449 Definition Lists: Mixed Lists: Test 7
2450 !! input
2451 :* d1
2452 :* d2
2453 !! result
2454 <dl><dd><ul><li> d1
2455 </li><li> d2
2456 </li></ul>
2457 </dd></dl>
2458
2459 !! end
2460
2461
2462 !! test
2463 Definition Lists: Mixed Lists: Test 8
2464 !! input
2465 :* d1
2466 ::* d2
2467 !! result
2468 <dl><dd><ul><li> d1
2469 </li></ul>
2470 <dl><dd><ul><li> d2
2471 </li></ul>
2472 </dd></dl>
2473 </dd></dl>
2474
2475 !! end
2476
2477
2478 !! test
2479 Definition Lists: Mixed Lists: Test 9
2480 !! input
2481 *;foo :bar
2482 !! result
2483 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2484 </dd></dl>
2485 </li></ul>
2486
2487 !! end
2488
2489
2490 !! test
2491 Definition Lists: Mixed Lists: Test 10
2492 !! input
2493 *#;foo :bar
2494 !! result
2495 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2496 </dd></dl>
2497 </li></ol>
2498 </li></ul>
2499
2500 !! end
2501
2502 # The Parsoid team disagrees with the PHP parser's seemingly-random
2503 # rules regarding dd/dt on the next two tests. Parsoid is more
2504 # consistent, and recognizes the shared nesting and keeps the
2505 # still-open tags around until the nesting is complete.
2506
2507 !! test
2508 Definition Lists: Mixed Lists: Test 11 (php)
2509 !! options
2510 php
2511 !! input
2512 *#*#;*;;foo :bar
2513 *#*#;boo :baz
2514 !! result
2515 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2516 </dt></dl>
2517 </dd></dl>
2518 </li></ul>
2519 </dd></dl>
2520 <dl><dt>boo&#160;</dt><dd>baz
2521 </dd></dl>
2522 </li></ol>
2523 </li></ul>
2524 </li></ol>
2525 </li></ul>
2526
2527 !! end
2528 !! test
2529 Definition Lists: Mixed Lists: Test 11 (parsoid)
2530 !! options
2531 parsoid
2532 !! input
2533 *#*#;*;;foo :bar
2534 *#*#;boo :baz
2535 !! result
2536 <ul>
2537 <li>
2538 <ol>
2539 <li>
2540 <ul>
2541 <li>
2542 <ol>
2543 <li>
2544 <dl>
2545 <dt>
2546 <ul>
2547 <li>
2548 <dl>
2549 <dt>
2550 <dl>
2551 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2552 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2553 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2554 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2555 !! end
2556
2557
2558 !! test
2559 Definition Lists: Weird Ones: Test 1 (php)
2560 !! options
2561 php
2562 !! input
2563 *#;*::;; foo : bar (who uses this?)
2564 !! result
2565 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2566 </dt></dl>
2567 </dd></dl>
2568 </dd></dl>
2569 </dd></dl>
2570 </li></ul>
2571 </dd></dl>
2572 </li></ol>
2573 </li></ul>
2574
2575 !! end
2576 !! test
2577 Definition Lists: Weird Ones: Test 1 (parsoid)
2578 !! options
2579 parsoid
2580 !! input
2581 *#;*::;; foo : bar (who uses this?)
2582 !! result
2583 <ul>
2584 <li>
2585 <ol>
2586 <li>
2587 <dl>
2588 <dt>
2589 <ul>
2590 <li>
2591 <dl>
2592 <dd>
2593 <dl>
2594 <dd>
2595 <dl>
2596 <dt>
2597 <dl>
2598 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2599 <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>
2600 !! end
2601
2602 ###
2603 ### External links
2604 ###
2605 !! test
2606 External links: non-bracketed
2607 !! input
2608 Non-bracketed: http://example.com
2609 !! result
2610 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2611 </p>
2612 !! end
2613
2614 !! test
2615 External links: numbered
2616 !! input
2617 Numbered: [http://example.com]
2618 Numbered: [http://example.net]
2619 Numbered: [http://example.com]
2620 !! result
2621 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2622 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2623 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2624 </p>
2625 !!end
2626
2627 !! test
2628 External links: specified text
2629 !! input
2630 Specified text: [http://example.com link]
2631 !! result
2632 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2633 </p>
2634 !!end
2635
2636 !! test
2637 External links: trail
2638 !! input
2639 Linktrails should not work for external links: [http://example.com link]s
2640 !! result
2641 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2642 </p>
2643 !! end
2644
2645 !! test
2646 External links: dollar sign in URL
2647 !! input
2648 http://example.com/1$2345
2649 !! result
2650 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2651 </p>
2652 !! end
2653
2654 !! test
2655 External links: dollar sign in URL (named)
2656 !! input
2657 [http://example.com/1$2345]
2658 !! result
2659 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2660 </p>
2661 !!end
2662
2663 !! test
2664 External links: open square bracket forbidden in URL (bug 4377)
2665 !! input
2666 http://example.com/1[2345
2667 !! result
2668 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2669 </p>
2670 !! end
2671
2672 !! test
2673 External links: open square bracket forbidden in URL (named) (bug 4377)
2674 !! input
2675 [http://example.com/1[2345]
2676 !! result
2677 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2678 </p>
2679 !!end
2680
2681 !! test
2682 External links: nowiki in URL link text (bug 6230)
2683 !!input
2684 [http://example.com/ <nowiki>''example site''</nowiki>]
2685 !! result
2686 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2687 </p>
2688 !! end
2689
2690 !! test
2691 External links: newline forbidden in text (bug 6230 regression check)
2692 !! input
2693 [http://example.com/ first
2694 second]
2695 !! result
2696 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2697 second]
2698 </p>
2699 !!end
2700
2701 !! test
2702 External links: Pipe char between url and text
2703 !! input
2704 [http://example.com | link]
2705 !! result
2706 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2707 </p>
2708 !!end
2709
2710 !! test
2711 External links: protocol-relative URL in brackets
2712 !! input
2713 [//example.com/ Test]
2714 !! result
2715 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2716 </p>
2717 !! end
2718
2719 !! test
2720 External links: protocol-relative URL in brackets without text
2721 !! input
2722 [//example.com]
2723 !! result
2724 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2725 </p>
2726 !! end
2727
2728 !! test
2729 External links: protocol-relative URL in free text is left alone
2730 !! input
2731 //example.com/Foo
2732 !! result
2733 <p>//example.com/Foo
2734 </p>
2735 !!end
2736
2737 !! test
2738 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2739 !! input
2740 foo//example.com/Foo
2741 !! result
2742 <p>foo//example.com/Foo
2743 </p>
2744 !! end
2745
2746 !! test
2747 External image
2748 !! input
2749 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2750 !! result
2751 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2752 </p>
2753 !! end
2754
2755 !! test
2756 External image from https
2757 !! input
2758 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2759 !! result
2760 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2761 </p>
2762 !! end
2763
2764 !! test
2765 External image (when not allowed)
2766 !! options
2767 wgAllowExternalImages=0
2768 !! input
2769 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2770 !! result
2771 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
2772 </p>
2773 !! end
2774
2775 !! test
2776 Link to non-http image, no img tag
2777 !! input
2778 Link to non-http image, no img tag: ftp://example.com/test.jpg
2779 !! result
2780 <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>
2781 </p>
2782 !! end
2783
2784 !! test
2785 External links: terminating separator
2786 !! input
2787 Terminating separator: http://example.com/thing,
2788 !! result
2789 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2790 </p>
2791 !! end
2792
2793 !! test
2794 External links: intervening separator
2795 !! input
2796 Intervening separator: http://example.com/1,2,3
2797 !! result
2798 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2799 </p>
2800 !! end
2801
2802 !! test
2803 External links: old bug with URL in query
2804 !! input
2805 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2806 !! result
2807 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2808 </p>
2809 !! end
2810
2811 !! test
2812 External links: old URL-in-URL bug, mixed protocols
2813 !! input
2814 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2815 !! result
2816 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2817 </p>
2818 !!end
2819
2820 !! test
2821 External links: URL in text
2822 !! input
2823 URL in text: [http://example.com http://example.com]
2824 !! result
2825 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2826 </p>
2827 !! end
2828
2829 !! test
2830 External links: Clickable images
2831 !! input
2832 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2833 !! result
2834 <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>
2835 </p>
2836 !!end
2837
2838 !! test
2839 External links: raw ampersand
2840 !! input
2841 Old &amp; use: http://x&y
2842 !! result
2843 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2844 </p>
2845 !! end
2846
2847 !! test
2848 External links: encoded ampersand
2849 !! input
2850 Old &amp; use: http://x&amp;y
2851 !! result
2852 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2853 </p>
2854 !! end
2855
2856 !! test
2857 External links: encoded equals (bug 6102)
2858 !! input
2859 http://example.com/?foo&#61;bar
2860 !! result
2861 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2862 </p>
2863 !! end
2864
2865 !! test
2866 External links: [raw ampersand]
2867 !! input
2868 Old &amp; use: [http://x&y]
2869 !! result
2870 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2871 </p>
2872 !! end
2873
2874 !! test
2875 External links: [encoded ampersand]
2876 !! input
2877 Old &amp; use: [http://x&amp;y]
2878 !! result
2879 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2880 </p>
2881 !! end
2882
2883 !! test
2884 External links: [encoded equals] (bug 6102)
2885 !! input
2886 [http://example.com/?foo&#61;bar]
2887 !! result
2888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2889 </p>
2890 !! end
2891
2892 !! test
2893 External links: [IDN ignored character reference in hostname; strip it right off]
2894 !! input
2895 [http://e&zwnj;xample.com/]
2896 !! result
2897 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2898 </p>
2899 !! end
2900
2901 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2902 # Where an external link could easily circumvent the sanitization of the text of
2903 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2904 # test demands a higher standard. That's a bit strange.
2905 #
2906 # Example:
2907 #
2908 # http://e‌xample.com -> [http://example.com|http://example.com]
2909 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2910 #
2911 # The first example is sanitized, but the second is not. Any security benefits
2912 # from this production are trivial to circumvent. Either remove this test and
2913 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2914 # the test accordingly.
2915 #
2916 # All our love,
2917 # The Parsoid team.
2918 !! test
2919 External links: IDN ignored character reference in hostname; strip it right off
2920 !! input
2921 http://e&zwnj;xample.com/
2922 !! result
2923 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2924 </p>
2925 !! end
2926
2927 !! test
2928 External links: www.jpeg.org (bug 554)
2929 !! input
2930 http://www.jpeg.org
2931 !!result
2932 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2933 </p>
2934 !! end
2935
2936 !! test
2937 External links: URL within URL (original bug 2)
2938 !! input
2939 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2940 !! result
2941 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2942 </p>
2943 !! end
2944
2945 !! test
2946 BUG 361: URL inside bracketed URL
2947 !! input
2948 [http://www.example.com/foo http://www.example.com/bar]
2949 !! result
2950 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2951 </p>
2952 !! end
2953
2954 !! test
2955 BUG 361: URL within URL, not bracketed
2956 !! input
2957 http://www.example.com/foo?=http://www.example.com/bar
2958 !! result
2959 <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>
2960 </p>
2961 !! end
2962
2963 !! test
2964 BUG 289: ">"-token in URL-tail
2965 !! input
2966 http://www.example.com/<hello>
2967 !! result
2968 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2969 </p>
2970 !!end
2971
2972 !! test
2973 BUG 289: literal ">"-token in URL-tail
2974 !! input
2975 http://www.example.com/<b>html</b>
2976 !! result
2977 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2978 </p>
2979 !!end
2980
2981 !! test
2982 BUG 289: ">"-token in bracketed URL
2983 !! input
2984 [http://www.example.com/<hello> stuff]
2985 !! result
2986 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2987 </p>
2988 !!end
2989
2990 !! test
2991 BUG 289: literal ">"-token in bracketed URL
2992 !! input
2993 [http://www.example.com/<b>html</b> stuff]
2994 !! result
2995 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2996 </p>
2997 !!end
2998
2999 !! test
3000 BUG 289: literal double quote at end of URL
3001 !! input
3002 http://www.example.com/"hello"
3003 !! result
3004 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3005 </p>
3006 !!end
3007
3008 !! test
3009 BUG 289: literal double quote in bracketed URL
3010 !! input
3011 [http://www.example.com/"hello" stuff]
3012 !! result
3013 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3014 </p>
3015 !!end
3016
3017 !! test
3018 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3019 !! input
3020 [http://www.example.com test]
3021 !! result
3022 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 External links: link text with spaces
3028 !! input
3029 [http://www.example.com a b c]
3030 [http://www.example.com ''a'' ''b'']
3031 !! result
3032 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3033 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 External links: wiki links within external link (Bug 3695)
3039 !! input
3040 [http://example.com [[wikilink]] embedded in ext link]
3041 !! result
3042 <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>
3043 </p>
3044 !! end
3045
3046 !! test
3047 BUG 787: Links with one slash after the url protocol are invalid
3048 !! input
3049 http:/example.com
3050
3051 [http:/example.com title]
3052 !! result
3053 <p>http:/example.com
3054 </p><p>[http:/example.com title]
3055 </p>
3056 !! end
3057
3058 !! test
3059 Bracketed external links with template-generated invalid target
3060 !! input
3061 [{{echo|http:/example.com}} title]
3062 !! result
3063 <p>[http:/example.com title]
3064 </p>
3065 !! end
3066
3067 !! test
3068 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3069 !! input
3070 ''[http://example.com text'']
3071 [http://example.com '''text]'''
3072 ''Something [http://example.com in italic'']
3073 ''Something [http://example.com mixed''''', even bold]'''
3074 '''''Now [http://example.com both''''']
3075 !! result
3076 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3077 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3078 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3079 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3080 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Bug 4781: %26 in URL
3087 !! input
3088 http://www.example.com/?title=AT%26T
3089 !! result
3090 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3091 </p>
3092 !! end
3093
3094 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3095 # % is actually legal in HTML5. Any change in output would need testing though.
3096 !! test
3097 Bug 4781, 5267: %25 in URL
3098 !! input
3099 http://www.example.com/?title=100%25_Bran
3100 !! result
3101 <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>
3102 </p>
3103 !! end
3104
3105 !! test
3106 Bug 4781, 5267: %28, %29 in URL
3107 !! input
3108 http://www.example.com/?title=Ben-Hur_%281959_film%29
3109 !! result
3110 <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>
3111 </p>
3112 !! end
3113
3114
3115 !! test
3116 Bug 4781: %26 in autonumber URL
3117 !! input
3118 [http://www.example.com/?title=AT%26T]
3119 !! result
3120 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3121 </p>
3122 !! end
3123
3124 !! test
3125 Bug 4781, 5267: %26 in autonumber URL
3126 !! input
3127 [http://www.example.com/?title=100%25_Bran]
3128 !! result
3129 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3130 </p>
3131 !! end
3132
3133 !! test
3134 Bug 4781, 5267: %28, %29 in autonumber URL
3135 !! input
3136 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3137 !! result
3138 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3139 </p>
3140 !! end
3141
3142
3143 !! test
3144 Bug 4781: %26 in bracketed URL
3145 !! input
3146 [http://www.example.com/?title=AT%26T link]
3147 !! result
3148 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3149 </p>
3150 !! end
3151
3152 !! test
3153 Bug 4781, 5267: %26 in bracketed URL
3154 !! input
3155 [http://www.example.com/?title=100%25_Bran link]
3156 !! result
3157 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3158 </p>
3159 !! end
3160
3161 !! test
3162 Bug 4781, 5267: %28, %29 in bracketed URL
3163 !! input
3164 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3165 !! result
3166 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3167 </p>
3168 !! end
3169
3170 !! test
3171 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3172 !! input
3173 Some [http://example.com/ pretty ''italics'' and stuff]!
3174 !! result
3175 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3176 </p>
3177 !! end
3178
3179 !! test
3180 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3181 !! input
3182 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3183 !! result
3184 <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>
3185 </p>
3186 !! end
3187
3188 !! test
3189 External link containing double-single-quotes with no space separating the url from text in italics
3190 !! input
3191 [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]].]
3192 !! result
3193 <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>
3194 </p>
3195 !! end
3196
3197 !! test
3198 External link with comments in link text
3199 !! input
3200 [http://www.google.com Google <!-- comment -->]
3201 !! result
3202 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3203 </p>
3204 !! end
3205
3206 !! test
3207 URL-encoding in URL functions (single parameter)
3208 !! input
3209 {{localurl:Some page|amp=&}}
3210 !! result
3211 <p>/index.php?title=Some_page&amp;amp=&amp;
3212 </p>
3213 !! end
3214
3215 !! test
3216 URL-encoding in URL functions (multiple parameters)
3217 !! input
3218 {{localurl:Some page|q=?&amp=&}}
3219 !! result
3220 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3221 </p>
3222 !! end
3223
3224 !! test
3225 Brackets in urls
3226 !! input
3227 http://example.com/index.php?foozoid%5B%5D=bar
3228
3229 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3230 !! result
3231 <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>
3232 </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>
3233 </p>
3234 !! end
3235
3236 !! test
3237 IPv6 urls (bug 21261)
3238 !! options
3239 disabled
3240 !! input
3241 http://[2404:130:0:1000::187:2]/index.php
3242 !! result
3243 <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>
3244 </p>
3245 !! end
3246
3247 !! test
3248 Non-extlinks in brackets
3249 !! input
3250 [foo]
3251 [foo bar]
3252 [foo ''bar'']
3253 [fool's] errand
3254 [fool's errand]
3255 [{{echo|foo}}]
3256 [{{echo|foo}} bar]
3257 [{{echo|foo}} ''bar'']
3258 [{{echo|foo}}l's] errand
3259 [{{echo|foo}}l's errand]
3260 [url={{echo|foo}}]
3261 [url=http://example.com]
3262 !! result
3263 <p>[foo]
3264 [foo bar]
3265 [foo <i>bar</i>]
3266 [fool's] errand
3267 [fool's errand]
3268 [foo]
3269 [foo bar]
3270 [foo <i>bar</i>]
3271 [fool's] errand
3272 [fool's errand]
3273 [url=foo]
3274 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3275 </p>
3276 !! end
3277
3278 !! test
3279 Parsoid: Percent encoding in external links
3280 !! options
3281 parsoid
3282 !! input
3283 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3284 !! result
3285 <p><a rel="mw:ExtLink"
3286 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3287 !! end
3288
3289 !! test
3290 Parsoid: use url link syntax for links where the content is equal the link
3291 target
3292 !! options
3293 parsoid
3294 !! input
3295 http://example.com
3296 !! result
3297 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3298 !! end
3299
3300 ###
3301 ### Quotes
3302 ###
3303
3304 !! test
3305 Quotes
3306 !! input
3307 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3308
3309 Normal text. '''''Bold italic text.''''' Normal text.
3310 !!result
3311 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3312 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3313 </p>
3314 !! end
3315
3316
3317 !! test
3318 Unclosed and unmatched quotes (php)
3319 !! options
3320 php
3321 !! input
3322 '''''Bold italic text '''with bold deactivated''' in between.'''''
3323
3324 '''''Bold italic text ''with italic deactivated'' in between.'''''
3325
3326 '''Bold text..
3327
3328 ..spanning two paragraphs (should not work).'''
3329
3330 '''Bold tag left open
3331
3332 ''Italic tag left open
3333
3334 Normal text.
3335
3336 <!-- Unmatching number of opening, closing tags: -->
3337 '''This year''''s election ''should'' beat '''last year''''s.
3338
3339 ''Tom'''s car is bigger than ''Susan'''s.
3340
3341 Plain ''italic'''s plain
3342 !! result
3343 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3344 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3345 </p><p><b>Bold text..</b>
3346 </p><p>..spanning two paragraphs (should not work).
3347 </p><p><b>Bold tag left open</b>
3348 </p><p><i>Italic tag left open</i>
3349 </p><p>Normal text.
3350 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3351 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3352 </p><p>Plain <i>italic'</i>s plain
3353 </p>
3354 !! end
3355 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3356 # parser strips. The wikitext contains just the first half of the bold
3357 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3358 # differently than the PHP parser.)
3359 !! test
3360 Unclosed and unmatched quotes (parsoid)
3361 !! options
3362 parsoid
3363 !! input
3364 '''''Bold italic text '''with bold deactivated''' in between.'''''
3365
3366 '''''Bold italic text ''with italic deactivated'' in between.'''''
3367
3368 '''Bold text..
3369
3370 ..spanning two paragraphs (should not work).'''
3371
3372 '''Bold tag left open
3373
3374 ''Italic tag left open
3375
3376 Normal text.
3377
3378 <!-- Unmatching number of opening, closing tags: -->
3379 '''This year''''s election ''should'' beat '''last year''''s.
3380
3381 ''Tom'''s car is bigger than ''Susan'''s.
3382
3383 Plain ''italic'''s plain
3384 !! result
3385 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3386 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3387 </p><p><b>Bold text..</b>
3388 </p><p>..spanning two paragraphs (should not work).<b></b>
3389 </p><p><b>Bold tag left open</b>
3390 </p><p><i>Italic tag left open</i>
3391 </p><p>Normal text.
3392 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3393 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3394 </p><p>Plain <i>italic'</i>s plain
3395 </p>
3396 !! end
3397
3398 ###
3399 ### Tables
3400 ###
3401 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3402 ###
3403
3404 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3405 # is the bare minimum required by the spec, see:
3406 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3407 !! test
3408 A table with no data. (php)
3409 !! options
3410 php
3411 !! input
3412 {||}
3413 !! result
3414 !! end
3415 # Parsoid team replies: empty table tags are legal in HTML5
3416 !! test
3417 A table with no data. (parsoid)
3418 !! options
3419 parsoid
3420 !! input
3421 {||}
3422 !! result
3423 <table></table>
3424 !! end
3425
3426 # A table with nothing but a caption is invalid XHTML, we might want to render
3427 # this as <p>caption</p>
3428 !! test
3429 A table with nothing but a caption (php)
3430 !! options
3431 php
3432 !! input
3433 {|
3434 |+ caption
3435 |}
3436 !! result
3437 <table>
3438 <caption> caption
3439 </caption><tr><td></td></tr></table>
3440
3441 !! end
3442 # Parsoid team replies: table with only a caption is legal in HTML5
3443 !! test
3444 A table with nothing but a caption (parsoid)
3445 !! options
3446 parsoid
3447 !! input
3448 {|
3449 |+ caption
3450 |}
3451 !! result
3452 <table><caption> caption</caption></table>
3453 !! end
3454
3455 !! test
3456 A table with caption with default-spaced attributes and a table row
3457 !! input
3458 {|
3459 |+ style="color: red;" | caption1
3460 |-
3461 | foo
3462 |}
3463 !! result
3464 <table>
3465 <caption style="color: red;"> caption1
3466 </caption>
3467 <tr>
3468 <td> foo
3469 </td></tr></table>
3470
3471 !! end
3472
3473 !! test
3474 A table with captions with non-default spaced attributes and a table row
3475 !! input
3476 {|
3477 |+style="color: red;"|caption2
3478 |+ style="color: red;"| caption3
3479 |-
3480 | foo
3481 |}
3482 !! result
3483 <table>
3484 <caption style="color: red;">caption2
3485 </caption>
3486 <caption style="color: red;"> caption3
3487 </caption>
3488 <tr>
3489 <td> foo
3490 </td></tr></table>
3491
3492 !! end
3493
3494 !! test
3495 Table td-cell syntax variations
3496 !! input
3497 {|
3498 | foo bar foo | baz
3499 | foo bar foo || baz
3500 | style='color:red;' | baz
3501 | style='color:red;' || baz
3502 |}
3503 !! result
3504 <table>
3505 <tr>
3506 <td> baz
3507 </td>
3508 <td> foo bar foo </td>
3509 <td> baz
3510 </td>
3511 <td style="color:red;"> baz
3512 </td>
3513 <td> style='color:red;' </td>
3514 <td> baz
3515 </td></tr></table>
3516
3517 !! end
3518
3519 !! test
3520 Simple table
3521 !! input
3522 {|
3523 | 1 || 2
3524 |-
3525 | 3 || 4
3526 |}
3527 !! result
3528 <table>
3529 <tr>
3530 <td> 1 </td>
3531 <td> 2
3532 </td></tr>
3533 <tr>
3534 <td> 3 </td>
3535 <td> 4
3536 </td></tr></table>
3537
3538 !! end
3539
3540 !! test
3541 Simple table but with multiple dashes for row wikitext
3542 !! input
3543 {|
3544 | foo
3545 |-----
3546 | bar
3547 |}
3548 !! result
3549 <table>
3550 <tr>
3551 <td> foo
3552 </td></tr>
3553 <tr>
3554 <td> bar
3555 </td></tr></table>
3556
3557 !! end
3558 !! test
3559 Multiplication table
3560 !! input
3561 {| border="1" cellpadding="2"
3562 |+Multiplication table
3563 |-
3564 ! &times; !! 1 !! 2 !! 3
3565 |-
3566 ! 1
3567 | 1 || 2 || 3
3568 |-
3569 ! 2
3570 | 2 || 4 || 6
3571 |-
3572 ! 3
3573 | 3 || 6 || 9
3574 |-
3575 ! 4
3576 | 4 || 8 || 12
3577 |-
3578 ! 5
3579 | 5 || 10 || 15
3580 |}
3581 !! result
3582 <table border="1" cellpadding="2">
3583 <caption>Multiplication table
3584 </caption>
3585 <tr>
3586 <th> &#215; </th>
3587 <th> 1 </th>
3588 <th> 2 </th>
3589 <th> 3
3590 </th></tr>
3591 <tr>
3592 <th> 1
3593 </th>
3594 <td> 1 </td>
3595 <td> 2 </td>
3596 <td> 3
3597 </td></tr>
3598 <tr>
3599 <th> 2
3600 </th>
3601 <td> 2 </td>
3602 <td> 4 </td>
3603 <td> 6
3604 </td></tr>
3605 <tr>
3606 <th> 3
3607 </th>
3608 <td> 3 </td>
3609 <td> 6 </td>
3610 <td> 9
3611 </td></tr>
3612 <tr>
3613 <th> 4
3614 </th>
3615 <td> 4 </td>
3616 <td> 8 </td>
3617 <td> 12
3618 </td></tr>
3619 <tr>
3620 <th> 5
3621 </th>
3622 <td> 5 </td>
3623 <td> 10 </td>
3624 <td> 15
3625 </td></tr></table>
3626
3627 !! end
3628
3629 !! test
3630 Accept "||" in table headings
3631 !! input
3632 {|
3633 !h1 || h2
3634 |}
3635 !! result
3636 <table>
3637 <tr>
3638 <th>h1 </th>
3639 <th> h2
3640 </th></tr></table>
3641
3642 !! end
3643
3644 !! test
3645 Accept "||" in indented table headings
3646 !! input
3647 :{|
3648 !h1 || h2
3649 |}
3650 !! result
3651 <dl><dd><table>
3652 <tr>
3653 <th>h1 </th>
3654 <th> h2
3655 </th></tr></table></dd></dl>
3656
3657 !! end
3658
3659 !! test
3660 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3661 !! input
3662 {|
3663 !| h1
3664 || a
3665 |}
3666 !! result
3667 <table>
3668 <tr>
3669 <th> h1
3670 </th>
3671 <td> a
3672 </td></tr></table>
3673
3674 !! end
3675
3676 !!test
3677 Accept "| !" at start of line in tables (ignore !-attribute)
3678 !!input
3679 {|
3680 |-
3681 | !style="color:red" | bar
3682 |}
3683 !!result
3684 <table>
3685
3686 <tr>
3687 <td> bar
3688 </td></tr></table>
3689
3690 !!end
3691
3692 !!test
3693 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 +/-
3694 !!input
3695 {|
3696 |-
3697 |style='color:red;'|+1
3698 |style='color:blue;'|-1
3699 |-
3700 | 1 || 2 || 3
3701 | 1 ||+2 ||-3
3702 |-
3703 | +1
3704 | -1
3705 |}
3706 !!result
3707 <table>
3708
3709 <tr>
3710 <td style="color:red;">+1
3711 </td>
3712 <td style="color:blue;">-1
3713 </td></tr>
3714 <tr>
3715 <td> 1 </td>
3716 <td> 2 </td>
3717 <td> 3
3718 </td>
3719 <td> 1 </td>
3720 <td>+2 </td>
3721 <td>-3
3722 </td></tr>
3723 <tr>
3724 <td> +1
3725 </td>
3726 <td> -1
3727 </td></tr></table>
3728
3729 !!end
3730
3731 !! test
3732 Table rowspan
3733 !! input
3734 {| border=1
3735 | Cell 1, row 1
3736 |rowspan=2| Cell 2, row 1 (and 2)
3737 | Cell 3, row 1
3738 |-
3739 | Cell 1, row 2
3740 | Cell 3, row 2
3741 |}
3742 !! result
3743 <table border="1">
3744 <tr>
3745 <td> Cell 1, row 1
3746 </td>
3747 <td rowspan="2"> Cell 2, row 1 (and 2)
3748 </td>
3749 <td> Cell 3, row 1
3750 </td></tr>
3751 <tr>
3752 <td> Cell 1, row 2
3753 </td>
3754 <td> Cell 3, row 2
3755 </td></tr></table>
3756
3757 !! end
3758
3759 !! test
3760 Nested table
3761 !! input
3762 {| border=1
3763 | &alpha;
3764 |
3765 {| bgcolor=#ABCDEF border=2
3766 |nested
3767 |-
3768 |table
3769 |}
3770 |the original table again
3771 |}
3772 !! result
3773 <table border="1">
3774 <tr>
3775 <td> &#945;
3776 </td>
3777 <td>
3778 <table bgcolor="#ABCDEF" border="2">
3779 <tr>
3780 <td>nested
3781 </td></tr>
3782 <tr>
3783 <td>table
3784 </td></tr></table>
3785 </td>
3786 <td>the original table again
3787 </td></tr></table>
3788
3789 !! end
3790
3791 !! test
3792 Invalid attributes in table cell (bug 1830)
3793 !! input
3794 {|
3795 |Cell:|broken
3796 |}
3797 !! result
3798 <table>
3799 <tr>
3800 <td>broken
3801 </td></tr></table>
3802
3803 !! end
3804
3805
3806 !! test
3807 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3808 !! input
3809 {|
3810 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3811 !! result
3812 <table>
3813 <tr>
3814 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3815 <td>]" onmouseover="alert(document.cookie)"&gt;test
3816 </td>
3817 </tr>
3818 </table>
3819
3820 !! end
3821
3822
3823 !! test
3824 Indented table markup mixed with indented pre content (proposed in bug 6200)
3825 !! input
3826 <table>
3827 <tr>
3828 <td>
3829 Text that should be rendered preformatted
3830 </td>
3831 </tr>
3832 </table>
3833 !! result
3834 <table>
3835 <tr>
3836 <td>
3837 <pre>Text that should be rendered preformatted
3838 </pre>
3839 </td>
3840 </tr>
3841 </table>
3842
3843 !! end
3844
3845 !! test
3846 Template-generated table cell attributes and cell content
3847 !! input
3848 {|
3849 |{{table_attribs}}
3850 |}
3851 !! result
3852 <table>
3853 <tr>
3854 <td style="color: red"> Foo
3855 </td></tr></table>
3856
3857 !! end
3858
3859 !! test
3860 Template-generated table cell attributes and cell content (2)
3861 !! input
3862 {|
3863 |align=center {{table_attribs}}
3864 |}
3865 !! result
3866 <table>
3867 <tr>
3868 <td align="center" style="color: red"> Foo
3869 </td></tr></table>
3870
3871 !! end
3872
3873 !! test
3874 Template-generated table cell attributes and cell content (3)
3875 !! input
3876 {|
3877 |align=center {{table_cells}}
3878 |}
3879 !! result
3880 <table>
3881 <tr>
3882 <td align="center" style="color: red"> Foo </td>
3883 <td> Bar </td>
3884 <td> Baz
3885 </td></tr></table>
3886
3887 !! end
3888
3889 !! test
3890 Table with row followed by newlines and table heading
3891 !! input
3892 {|
3893 |-
3894
3895 ! foo
3896 |}
3897 !! result
3898 <table>
3899
3900
3901 <tr>
3902 <th> foo
3903 </th></tr></table>
3904
3905 !! end
3906
3907 !! test
3908 Table with empty line following the start tag
3909 !! input
3910 {|
3911
3912 |-
3913 | foo
3914 |}
3915 !! result
3916 <table>
3917
3918
3919 <tr>
3920 <td> foo
3921 </td></tr></table>
3922
3923 !! end
3924
3925 # FIXME: Preserve the attribute properly (with an empty string as value) in
3926 # the PHP parser. Parsoid implements the behavior below.
3927 !! test
3928 Table attributes with empty value
3929 !! options
3930 parsoid
3931 !! input
3932 {|
3933 | style=| hello
3934 |}
3935 !! result
3936 <table>
3937 <tbody>
3938 <tr>
3939 <td style=""> hello
3940 </td></tr></tbody></table>
3941
3942 !! end
3943
3944 !! test
3945 Wikitext table with a lot of comments
3946 !! input
3947 {|
3948 <!-- c0 -->
3949 | foo
3950 <!-- c1 -->
3951 |- <!-- c2 -->
3952 <!-- c3 -->
3953 |<!-- c4 -->
3954 <!-- c5 -->
3955 |}
3956 !! result
3957 <table>
3958 <tr>
3959 <td> foo
3960 </td></tr>
3961 <tr>
3962 <td>
3963 </td></tr></table>
3964
3965 !! end
3966
3967 !! test
3968 Wikitext table with double-line table cell
3969 !! input
3970 {|
3971 |a
3972 b
3973 |}
3974 !! result
3975 <table>
3976 <tr>
3977 <td>a
3978 <p>b
3979 </p>
3980 </td></tr></table>
3981
3982 !! end
3983
3984 !! test
3985 Table cell with a single comment
3986 !! input
3987 {|
3988 | <!-- c1 -->
3989 | a
3990 |}
3991 !! result
3992 <table>
3993 <tr>
3994 <td>
3995 </td>
3996 <td> a
3997 </td></tr></table>
3998
3999 !! end
4000
4001 # The expected HTML structure in this test is debatable. The PHP parser does
4002 # not parse this kind of table at all. The main focus for Parsoid is on
4003 # round-tripping, so this output is ok for now. TODO: revisit!
4004 !! test
4005 Wikitext table with html-syntax row (Parsoid)
4006 !! options
4007 parsoid
4008 !! input
4009 {|
4010 |-
4011 <td>foo</td>
4012 |}
4013 !! result
4014 <table>
4015 <tbody>
4016 <tr>
4017 <td>foo</td></tr></tbody></table>
4018 !! end
4019
4020 !! test
4021 Implicit <td> after a |-
4022 (PHP parser relies on Tidy to add the missing <td> tags)
4023 !! options
4024 parsoid=wt2html,wt2wt
4025 !! input
4026 {|
4027 |-
4028 a
4029 |}
4030 !! result
4031 <table>
4032 <tr><td>a</td></tr>
4033 </table>
4034 !! end
4035
4036 !! test
4037 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4038 (PHP parser relies on Tidy to add the missing <td> tags)
4039 !! options
4040 parsoid=wt2html,wt2wt
4041 !! input
4042 {|
4043 |-
4044 |
4045 a
4046 |-
4047 b
4048 |}
4049 !! result
4050 <table>
4051 <tbody>
4052 <tr><td><pre>a</pre></td></tr>
4053 <tr><td> b</td></tr>
4054 </tbody>
4055 </table>
4056 !! end
4057
4058 !! test
4059 Lists should be recognized in an implicit <td> context
4060 (PHP parser relies on Tidy to add the missing <td> tags)
4061 !! options
4062 parsoid=wt2html,wt2wt
4063 !! input
4064 {|
4065 |-
4066 *a
4067 |}
4068 !! result
4069 <table>
4070 <tr>
4071 <td><ul><li>a</li></ul></td>
4072 </tr>
4073 </table>
4074 !! end
4075
4076 ###
4077 ### Internal links
4078 ###
4079 !! test
4080 Plain link, capitalized
4081 !! input
4082 [[Main Page]]
4083 !! result
4084 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4085 </p>
4086 !! end
4087
4088 !! test
4089 Plain link, uncapitalized
4090 !! input
4091 [[main Page]]
4092 !! result
4093 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4094 </p>
4095 !! end
4096
4097 !! test
4098 Piped link
4099 !! input
4100 [[Main Page|The Main Page]]
4101 !! result
4102 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4103 </p>
4104 !! end
4105
4106 !! test
4107 Piped link with comment in link text
4108 !! input
4109 [[Main Page|The Main<!--front--> Page]]
4110 !! result
4111 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4112 </p>
4113 !! end
4114
4115 !! test
4116 Broken link
4117 !! input
4118 [[Zigzagzogzagzig]]
4119 !! result
4120 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4121 </p>
4122 !! end
4123
4124 !! test
4125 Broken link with fragment
4126 !! input
4127 [[Zigzagzogzagzig#zug]]
4128 !! result
4129 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4130 </p>
4131 !! end
4132
4133 !! test
4134 Special page link with fragment
4135 !! input
4136 [[Special:Version#anchor]]
4137 !! result
4138 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4139 </p>
4140 !! end
4141
4142 !! test
4143 Nonexistent special page link with fragment
4144 !! input
4145 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4146 !! result
4147 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4148 </p>
4149 !! end
4150
4151 !! test
4152 Link with prefix
4153 !! input
4154 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4155 !! result
4156 <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>
4157 </p>
4158 !! end
4159
4160 !! test
4161 Link with suffix
4162 !! input
4163 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4164 !! result
4165 <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>!!!
4166 </p>
4167 !! end
4168
4169 !! article
4170 prefixed article
4171 !! text
4172 Some text
4173 !! endarticle
4174
4175 !! test
4176 Bug 43661: Piped links with identical prefixes
4177 !! input
4178 [[prefixed article|prefixed articles with spaces]]
4179
4180 [[prefixed article|prefixed articlesaoeu]]
4181
4182 [[Main Page|Main Page test]]
4183 !! result
4184 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4185 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4186 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4187 </p>
4188 !! end
4189
4190
4191 !! test
4192 Link with HTML entity in suffix / tail
4193 !! input
4194 [[Main Page]]&quot;, [[Main Page]]&#97;
4195 !! result
4196 <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;
4197 </p>
4198 !! end
4199
4200 !! test
4201 Link with 3 brackets
4202 !! input
4203 [[[main page]]]
4204 !! result
4205 <p>[[[main page]]]
4206 </p>
4207 !! end
4208
4209 !! test
4210 Piped link with 3 brackets
4211 !! input
4212 [[[main page|the main page]]]
4213 !! result
4214 <p>[[[main page|the main page]]]
4215 </p>
4216 !! end
4217
4218 !! test
4219 Link with multiple pipes
4220 !! input
4221 [[Main Page|The|Main|Page]]
4222 !! result
4223 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4224 </p>
4225 !! end
4226
4227 !! test
4228 Link to namespaces
4229 !! input
4230 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4231 !! result
4232 <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>
4233 </p>
4234 !! end
4235
4236 !! test
4237 Piped link to namespace
4238 !! input
4239 [[Meta:Disclaimers|The disclaimers]]
4240 !! result
4241 <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>
4242 </p>
4243 !! end
4244
4245 !! test
4246 Link containing }
4247 !! input
4248 [[Usually caused by a typo (oops}]]
4249 !! result
4250 <p>[[Usually caused by a typo (oops}]]
4251 </p>
4252 !! end
4253
4254 !! test
4255 Link containing % (not as a hex sequence)
4256 !! input
4257 [[7% Solution]]
4258 !! result
4259 <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>
4260 </p>
4261 !! end
4262
4263 !! test
4264 Link containing % as a single hex sequence interpreted to char
4265 !! input
4266 [[7%25 Solution]]
4267 !! result
4268 <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>
4269 </p>
4270 !!end
4271
4272 !! test
4273 Link containing % as a double hex sequence interpreted to hex sequence
4274 !! input
4275 [[7%2525 Solution]]
4276 !! result
4277 <p>[[7%2525 Solution]]
4278 </p>
4279 !!end
4280
4281 !! test
4282 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4283 Example for such a section: == < ==
4284 !! input
4285 [[%23%3c]][[%23%3e]]
4286 !! result
4287 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4288 </p>
4289 !! end
4290
4291 !! test
4292 Link containing "<#" and ">#" as a hex sequences
4293 !! input
4294 [[%3c%23]][[%3e%23]]
4295 !! result
4296 <p>[[%3c%23]][[%3e%23]]
4297 </p>
4298 !! end
4299
4300 !! test
4301 Link containing an equals sign
4302 !! input
4303 [[Special:BookSources/isbn=4-00-026157-6]]
4304 !! result
4305 <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>
4306 </p>
4307 !! end
4308
4309 !! article
4310 Foo~bar
4311 !! text
4312 Just a test of an article title containing a tilde.
4313 !! endarticle
4314
4315 # note that links containing signatures, like [[Foo~~~~]], are
4316 # massaged by the pre-save transform (PST) and so the tildes are never
4317 # seen by the parser.
4318 !! test
4319 Link containing a tilde
4320 !! input
4321 [[Foo~bar]]
4322 !! result
4323 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4324 </p>
4325 !! end
4326
4327 !! test
4328 Link containing double-single-quotes '' (bug 4598)
4329 !! input
4330 [[Lista d''e paise d''o munno]]
4331 !! result
4332 <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>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4338 !! input
4339 Some [[Link|pretty ''italics'' and stuff]]!
4340 !! result
4341 <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>!
4342 </p>
4343 !! end
4344
4345 !! test
4346 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4347 !! input
4348 ''Some [[Link|pretty ''italics'' and stuff]]!
4349 !! result
4350 <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>
4351 </p>
4352 !! end
4353
4354 !! test
4355 Link with double quotes in title part (literal) and alternate part (interpreted)
4356 !! input
4357 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4358
4359 [[''Pentecoste'']]
4360
4361 [[''Pentecoste''|Pentecoste]]
4362
4363 [[''Pentecoste''|''Pentecoste'']]
4364 !! result
4365 <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>
4366 </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>
4367 </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>
4368 </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>
4369 </p>
4370 !! end
4371
4372 !! test
4373 Broken image links with HTML captions (bug 39700)
4374 !! input
4375 [[File:Nonexistent|<script></script>]]
4376 [[File:Nonexistent|100px|<script></script>]]
4377 [[File:Nonexistent|&lt;]]
4378 [[File:Nonexistent|a<i>b</i>c]]
4379 !! result
4380 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4381 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4382 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4383 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4384 </p>
4385 !! end
4386
4387 !! test
4388 Plain link to URL
4389 !! input
4390 [[http://www.example.com]]
4391 !! result
4392 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4393 </p>
4394 !! end
4395
4396 !! test
4397 Plain link to URL with link text
4398 !! input
4399 [[http://www.example.com Link text]]
4400 !! result
4401 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4402 </p>
4403 !! end
4404
4405 !! test
4406 Plain link to protocol-relative URL
4407 !! input
4408 [[//www.example.com]]
4409 !! result
4410 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4411 </p>
4412 !! end
4413
4414 !! test
4415 Plain link to protocol-relative URL with link text
4416 !! input
4417 [[//www.example.com Link text]]
4418 !! result
4419 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4420 </p>
4421 !! end
4422
4423 !! test
4424 Plain link to page with question mark in title
4425 !! input
4426 [[A?b]]
4427
4428 [[A?b|Baz]]
4429 !! result
4430 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4431 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4432 </p>
4433 !! end
4434
4435
4436 # I'm fairly sure the expected result here is wrong.
4437 # We want these to be URL links, not pseudo-pages with URLs for titles....
4438 # However the current output is also pretty screwy.
4439 #
4440 # ----
4441 # I'm changing it to match the current output--it arguably makes more
4442 # sense in the light of the test above. Old expected result was:
4443 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4444 #</p>
4445 # But I think this test is bordering on "garbage in, garbage out" anyway.
4446 # -- wtm
4447 !! test
4448 Piped link to URL
4449 !! input
4450 Piped link to URL: [[http://www.example.com|an example URL]]
4451 !! result
4452 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4453 </p>
4454 !! end
4455
4456 !! test
4457 BUG 2: [[page|http://url/]] should link to page, not http://url/
4458 !! input
4459 [[Main Page|http://url/]]
4460 !! result
4461 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4462 </p>
4463 !! end
4464
4465 !! test
4466 BUG 337: Escaped self-links should be bold
4467 !! options
4468 title=[[Bug462]]
4469 !! input
4470 [[Bu&#103;462]] [[Bug462]]
4471 !! result
4472 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4473 </p>
4474 !! end
4475
4476 !! test
4477 Self-link to section should not be bold
4478 !! options
4479 title=[[Main Page]]
4480 !! input
4481 [[Main Page#section]]
4482 !! result
4483 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4484 </p>
4485 !! end
4486
4487 !! article
4488 00
4489 !! text
4490 This is 00.
4491 !! endarticle
4492
4493 !!test
4494 Self-link to numeric title
4495 !!options
4496 title=[[0]]
4497 !!input
4498 [[0]]
4499 !!result
4500 <p><strong class="selflink">0</strong>
4501 </p>
4502 !!end
4503
4504 !!test
4505 Link to numeric-equivalent title
4506 !!options
4507 title=[[0]]
4508 !!input
4509 [[00]]
4510 !!result
4511 <p><a href="/wiki/00" title="00">00</a>
4512 </p>
4513 !!end
4514
4515 !! test
4516 <nowiki> inside a link
4517 !! input
4518 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4519 !! result
4520 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4521 </p>
4522 !! end
4523
4524 !! test
4525 Non-breaking spaces in title
4526 !! input
4527 [[&nbsp; Main &nbsp; Page &nbsp;]]
4528 !! result
4529 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4530 </p>
4531 !!end
4532
4533 !! test
4534 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4535 !! options
4536 language=ca
4537 !! input
4538 '''[[Main Page]]'''
4539 !! result
4540 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4541 </p>
4542 !! end
4543
4544 !! test
4545 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4546 !! options
4547 language=ca
4548 !! input
4549 ''[[Main Page]]''
4550 !! result
4551 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4552 </p>
4553 !! end
4554
4555 !! test
4556 Internal link with en linktrail: no apostrophes (bug 27473)
4557 !! options
4558 language=en
4559 !! input
4560 [[Something]]'nice
4561 !! result
4562 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4563 </p>
4564 !! end
4565
4566 !! test
4567 Internal link with ca linktrail with apostrophes (bug 27473)
4568 !! options
4569 language=ca
4570 !! input
4571 [[Something]]'nice
4572 !! result
4573 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4574 </p>
4575 !! end
4576
4577 !! test
4578 Internal link with kaa linktrail with apostrophes (bug 27473)
4579 !! options
4580 language=kaa
4581 !! input
4582 [[Something]]'nice
4583 !! result
4584 <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>
4585 </p>
4586 !! end
4587
4588 !! article
4589 Söfnuður
4590 !! text
4591 Test.
4592 !! endarticle
4593
4594 !! test
4595 Internal link with is link prefix
4596 !! options
4597 language=is
4598 !! input
4599 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4600 !! result
4601 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4602 </p>
4603 !! end
4604
4605 !! article
4606 Mótmælendatrú
4607 !! text
4608 Test.
4609 !! endarticle
4610
4611 !! test
4612 Internal link with is link trail and link prefix
4613 !! options
4614 language=is
4615 !! input
4616 [[mótmælendatrú|xxx]]ar
4617 [[mótmælendatrú]]ar
4618 mótmælenda[[söfnuður]]
4619 mótmælenda[[söfnuður|söfnuðir]]
4620 mótmælenda[[söfnuður|söfnuðir]]xxx
4621 !! result
4622 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4623 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4624 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4625 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4626 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 Parsoid link trail escaping
4632 !! options
4633 parsoid=html2wt,html2html
4634 !! input
4635 [[apple]]<nowiki/>s
4636 !! result
4637 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4638 !! end
4639
4640 !! test
4641 Parsoid link prefix escaping
4642 !! options
4643 language=is
4644 parsoid=html2wt,html2html
4645 !! input
4646 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4647 !! result
4648 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4649 !! end
4650
4651 !! test
4652 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4653 !! input
4654 [[Foo| bar]]
4655
4656 [[Foo| ''bar'']]
4657
4658 [http://wp.org foo]
4659
4660 [http://wp.org ''foo'']
4661 !! result
4662 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4663 </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>
4664 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4665 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4666 </p>
4667 !! end
4668
4669 ###
4670 ### Interwiki links (see maintenance/interwiki.sql)
4671 ###
4672
4673 !! test
4674 Inline interwiki link
4675 !! input
4676 [[MeatBall:SoftSecurity]]
4677 !! result
4678 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4679 </p>
4680 !! end
4681
4682 !! test
4683 Inline interwiki link with empty title (bug 2372)
4684 !! input
4685 [[MeatBall:]]
4686 !! result
4687 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4688 </p>
4689 !! end
4690
4691 !! test
4692 Interwiki link encoding conversion (bug 1636)
4693 !! input
4694 *[[Wikipedia:ro:Olteni&#0355;a]]
4695 *[[Wikipedia:ro:Olteni&#355;a]]
4696 !! result
4697 <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>
4698 </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>
4699 </li></ul>
4700
4701 !! end
4702
4703 !! test
4704 Interwiki link with fragment (bug 2130)
4705 !! input
4706 [[MeatBall:SoftSecurity#foo]]
4707 !! result
4708 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4709 </p>
4710 !! end
4711
4712 !! test
4713 Interlanguage link
4714 !! input
4715 Blah blah blah
4716 [[zh:Chinese]]
4717 !!result
4718 <p>Blah blah blah
4719 </p>
4720 !! end
4721
4722 !! test
4723 Double interlanguage link
4724 !! input
4725 Blah blah blah
4726 [[es:Spanish]]
4727 [[zh:Chinese]]
4728 !!result
4729 <p>Blah blah blah
4730 </p>
4731 !! end
4732
4733 !! test
4734 Interlanguage link, with prefix links
4735 !! options
4736 language=ln
4737 !! input
4738 Blah blah blah
4739 [[zh:Chinese]]
4740 !!result
4741 <p>Blah blah blah
4742 </p>
4743 !! end
4744
4745 !! test
4746 Double interlanguage link, with prefix links (bug 8897)
4747 !! options
4748 language=ln
4749 !! input
4750 Blah blah blah
4751 [[es:Spanish]]
4752 [[zh:Chinese]]
4753 !!result
4754 <p>Blah blah blah
4755 </p>
4756 !! end
4757
4758 !! test
4759 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4760 !! options
4761 language=ln
4762 !! input
4763 [[WW&nbsp;II]]
4764 !!result
4765 <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>
4766 </p>
4767 !! end
4768
4769 !! test
4770 Parsoid: handle constructor well
4771 !! options
4772 parsoid
4773 !! input
4774 [[constructor]]
4775
4776 [[constructor:foo]]
4777 !! result
4778 <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>
4779
4780
4781 <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>
4782 !! end
4783
4784 ##
4785 ## Redirects, Parsoid-only
4786 ##
4787 !! test
4788 Simple redirect to page
4789 !! options
4790 parsoid
4791 !! input
4792 #REDIRECT [[Main Page]]
4793 !! result
4794 <link rel="mw:PageProp/redirect" href="./Main_Page">
4795 !! end
4796
4797 !! test
4798 Redirect to category
4799 !! options
4800 parsoid=wt2html
4801 !! input
4802 #REDIRECT [[Category:Foo]]
4803 !! result
4804 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4805 !! end
4806
4807 !! test
4808 Redirect to category page
4809 !! options
4810 parsoid=wt2html,html2html
4811 !! input
4812 #REDIRECT [[:Category:Foo]]
4813 !! result
4814 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4815 !! end
4816
4817 !! test
4818 Redirect to image page
4819 !! options
4820 parsoid
4821 !! input
4822 #REDIRECT [[File:Wiki.png]]
4823 !! result
4824 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4825 !! end
4826
4827 !! test
4828 Redirect to language
4829 !! options
4830 parsoid
4831 !! input
4832 #REDIRECT [[en:File:Wiki.png]]
4833 !! result
4834 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4835 !! end
4836
4837 !! test
4838 Redirect to interwiki
4839 !! options
4840 parsoid
4841 !! input
4842 #REDIRECT [[meatball:File:Wiki.png]]
4843 !! result
4844 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4845 !! end
4846
4847 ##
4848 ## XHTML tidiness
4849 ###
4850
4851 !! test
4852 <br> to <br />
4853 !! input
4854 1<br>2<br />3
4855 !! result
4856 <p>1<br />2<br />3
4857 </p>
4858 !! end
4859
4860 !! test
4861 Broken br tag sanitization
4862 !! options
4863 php
4864 !! input
4865 </br>
4866 !! result
4867 <p>&lt;/br&gt;
4868 </p>
4869 !! end
4870
4871 # TODO: Fix html2html mode (bug 51055)!
4872 !! test
4873 Parsoid: Broken br tag recognition
4874 !! options
4875 parsoid=wt2html
4876 !! input
4877 </br>
4878 !! result
4879 <p><br></p>
4880 !! end
4881
4882 !! test
4883 Incorrecly removing closing slashes from correctly formed XHTML
4884 !! input
4885 <br style="clear:both;" />
4886 !! result
4887 <p><br style="clear:both;" />
4888 </p>
4889 !! end
4890
4891 !! test
4892 Failing to transform badly formed HTML into correct XHTML
4893 !! input
4894 <br style="clear: left;">
4895 <br style="clear: right;">
4896 <br style="clear: both;">
4897 !! result
4898 <p><br style="clear: left;" />
4899 <br style="clear: right;" />
4900 <br style="clear: both;" />
4901 </p>
4902 !!end
4903
4904 !! test
4905 Handling html with a div self-closing tag
4906 !! input
4907 <div title />
4908 <div title/>
4909 <div title/ >
4910 <div title=bar />
4911 <div title=bar/>
4912 <div title=bar/ >
4913 !! result
4914 <p>&lt;div title /&gt;
4915 &lt;div title/&gt;
4916 </p>
4917 <div>
4918 <p>&lt;div title=bar /&gt;
4919 &lt;div title=bar/&gt;
4920 </p>
4921 <div title="bar/"></div>
4922 </div>
4923
4924 !! end
4925
4926 !! test
4927 Handling html with a br self-closing tag
4928 !! input
4929 <br title />
4930 <br title/>
4931 <br title/ >
4932 <br title=bar />
4933 <br title=bar/>
4934 <br title=bar/ >
4935 !! result
4936 <p><br title="title" />
4937 <br title="title" />
4938 <br />
4939 <br title="bar" />
4940 <br title="bar" />
4941 <br title="bar/" />
4942 </p>
4943 !! end
4944
4945 !! test
4946 Horizontal ruler (should it add that extra space?)
4947 !! input
4948 <hr>
4949 <hr >
4950 foo <hr
4951 > bar
4952 !! result
4953 <hr />
4954 <hr />
4955 foo <hr /> bar
4956
4957 !! end
4958
4959 !! test
4960 Horizontal ruler -- 4+ dashes render hr
4961 !! input
4962 ----
4963 !! result
4964 <hr />
4965
4966 !! end
4967
4968 !! test
4969 Horizontal ruler -- eats additional dashes on the same line
4970 !! input
4971 ---------
4972 !! result
4973 <hr />
4974
4975 !! end
4976
4977 !! test
4978 Horizontal ruler -- does not collapse dashes on consecutive lines
4979 !! input
4980 ----
4981 ----
4982 !! result
4983 <hr />
4984 <hr />
4985
4986 !! end
4987
4988 !! test
4989 Horizontal ruler -- <4 dashes render as plain text
4990 !! input
4991 ---
4992 !! result
4993 <p>---
4994 </p>
4995 !! end
4996
4997 !! test
4998 Horizontal ruler -- Supports content following dashes on same line
4999 !! input
5000 ---- Foo
5001 !! result
5002 <hr /> Foo
5003
5004 !! end
5005
5006 ###
5007 ### Block-level elements
5008 ###
5009 !! test
5010 Common list
5011 !! input
5012 *Common list
5013 * item 2
5014 *item 3
5015 !! result
5016 <ul><li>Common list
5017 </li><li> item 2
5018 </li><li>item 3
5019 </li></ul>
5020
5021 !! end
5022
5023 !! test
5024 Numbered list
5025 !! input
5026 #Numbered list
5027 #item 2
5028 # item 3
5029 !! result
5030 <ol><li>Numbered list
5031 </li><li>item 2
5032 </li><li> item 3
5033 </li></ol>
5034
5035 !! end
5036
5037 !! test
5038 Mixed list
5039 !! input
5040 *Mixed list
5041 *# with numbers
5042 ** and bullets
5043 *# and numbers
5044 *bullets again
5045 **bullet level 2
5046 ***bullet level 3
5047 ***#Number on level 4
5048 **bullet level 2
5049 **#Number on level 3
5050 **#Number on level 3
5051 *#number level 2
5052 *Level 1
5053 *** Level 3
5054 #** Level 3, but ordered
5055 !! result
5056 <ul><li>Mixed list
5057 <ol><li> with numbers
5058 </li></ol>
5059 <ul><li> and bullets
5060 </li></ul>
5061 <ol><li> and numbers
5062 </li></ol>
5063 </li><li>bullets again
5064 <ul><li>bullet level 2
5065 <ul><li>bullet level 3
5066 <ol><li>Number on level 4
5067 </li></ol>
5068 </li></ul>
5069 </li><li>bullet level 2
5070 <ol><li>Number on level 3
5071 </li><li>Number on level 3
5072 </li></ol>
5073 </li></ul>
5074 <ol><li>number level 2
5075 </li></ol>
5076 </li><li>Level 1
5077 <ul><li><ul><li> Level 3
5078 </li></ul>
5079 </li></ul>
5080 </li></ul>
5081 <ol><li><ul><li><ul><li> Level 3, but ordered
5082 </li></ul>
5083 </li></ul>
5084 </li></ol>
5085
5086 !! end
5087
5088 !! test
5089 Nested lists 1
5090 !! input
5091 *foo
5092 **bar
5093 !! result
5094 <ul><li>foo
5095 <ul><li>bar
5096 </li></ul>
5097 </li></ul>
5098
5099 !! end
5100
5101 !! test
5102 Nested lists 2
5103 !! input
5104 **foo
5105 *bar
5106 !! result
5107 <ul><li><ul><li>foo
5108 </li></ul>
5109 </li><li>bar
5110 </li></ul>
5111
5112 !! end
5113
5114 !! test
5115 Nested lists 3 (first element empty)
5116 !! input
5117 *
5118 **bar
5119 !! result
5120 <ul><li>
5121 <ul><li>bar
5122 </li></ul>
5123 </li></ul>
5124
5125 !! end
5126
5127 !! test
5128 Nested lists 4 (first element empty)
5129 !! input
5130 **
5131 *bar
5132 !! result
5133 <ul><li><ul><li>
5134 </li></ul>
5135 </li><li>bar
5136 </li></ul>
5137
5138 !! end
5139
5140 !! test
5141 Nested lists 5 (both elements empty)
5142 !! input
5143 **
5144 *
5145 !! result
5146 <ul><li><ul><li>
5147 </li></ul>
5148 </li><li>
5149 </li></ul>
5150
5151 !! end
5152
5153 !! test
5154 Nested lists 6 (both elements empty)
5155 !! input
5156 *
5157 **
5158 !! result
5159 <ul><li>
5160 <ul><li>
5161 </li></ul>
5162 </li></ul>
5163
5164 !! end
5165
5166 !! test
5167 Nested lists 7 (skip initial nesting levels)
5168 !! input
5169 *** foo
5170 !! result
5171 <ul><li><ul><li><ul><li> foo
5172 </li></ul>
5173 </li></ul>
5174 </li></ul>
5175
5176 !! end
5177
5178 !! test
5179 Nested lists 8 (multiple nesting transitions)
5180 !! input
5181 * foo
5182 *** bar
5183 ** baz
5184 * boo
5185 !! result
5186 <ul><li> foo
5187 <ul><li><ul><li> bar
5188 </li></ul>
5189 </li><li> baz
5190 </li></ul>
5191 </li><li> boo
5192 </li></ul>
5193
5194 !! end
5195
5196 !! test
5197 1. Lists with start-of-line-transparent tokens before bullets: Comments
5198 !! input
5199 *foo
5200 *<!--cmt-->bar
5201 <!--cmt-->*baz
5202 !! result
5203 <ul><li>foo
5204 </li><li>bar
5205 </li><li>baz
5206 </li></ul>
5207
5208 !! end
5209
5210 !! test
5211 2. Lists with start-of-line-transparent tokens before bullets: Template close
5212 !! input
5213 *foo {{echo|bar
5214 }}*baz
5215 !! result
5216 <ul><li>foo bar
5217 </li><li>baz
5218 </li></ul>
5219
5220 !! end
5221
5222 !! test
5223 Unbalanced closing block tags break a list
5224 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5225 !! options
5226 parsoid
5227 !! input
5228 <div>
5229 *a</div><div>
5230 *b</div>
5231 !! result
5232 <div>
5233 <ul><li>a
5234 </li></ul></div><div>
5235 <ul><li>b
5236 </li></ul></div>
5237 !! end
5238
5239 !! test
5240 Unbalanced closing non-block tags don't break a list
5241 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5242 !! options
5243 parsoid
5244 !! input
5245 <span>
5246 *a</span><span>
5247 *b</span>
5248 !! result
5249 <p><span></span>
5250 </p>
5251 <ul><li>a<span></span>
5252 </li><li>b
5253 </li></ul>
5254 !! end
5255
5256 !! test
5257 Unclosed formatting tags that straddle lists are closed and reopened
5258 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5259 !! options
5260 parsoid
5261 !! input
5262 # <s> a
5263 # b </s>
5264 !! result
5265 <ol><li> <s> a </s>
5266 </li><li> <s> b </s>
5267 </li></ol>
5268 !! end
5269
5270 !!test
5271 List embedded in a non-block tag
5272 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5273 !! options
5274 parsoid
5275 !!input
5276 <small>
5277 * foo
5278 </small>
5279 !!result
5280 <p><small></small></p>
5281 <small>
5282 <ul>
5283 <li> foo</li>
5284 </ul>
5285 </small>
5286 <p><small></small></p>
5287 !!end
5288
5289 !! test
5290 List items are not parsed correctly following a <pre> block (bug 785)
5291 !! input
5292 * <pre>foo</pre>
5293 * <pre>bar</pre>
5294 * zar
5295 !! result
5296 <ul><li> <pre>foo</pre>
5297 </li><li> <pre>bar</pre>
5298 </li><li> zar
5299 </li></ul>
5300
5301 !! end
5302
5303 !! test
5304 List items from template
5305 !! input
5306
5307 {{inner list}}
5308 * item 2
5309
5310 * item 0
5311 {{inner list}}
5312 * item 2
5313
5314 * item 0
5315 * notSOL{{inner list}}
5316 * item 2
5317 !! result
5318 <ul><li> item 1
5319 </li><li> item 2
5320 </li></ul>
5321 <ul><li> item 0
5322 </li><li> item 1
5323 </li><li> item 2
5324 </li></ul>
5325 <ul><li> item 0
5326 </li><li> notSOL
5327 </li><li> item 1
5328 </li><li> item 2
5329 </li></ul>
5330
5331 !! end
5332
5333 !! test
5334 List interrupted by empty line or heading
5335 !! input
5336 * foo
5337
5338 ** bar
5339 == A heading ==
5340 * Another list item
5341 !! result
5342 <ul><li> foo
5343 </li></ul>
5344 <ul><li><ul><li> bar
5345 </li></ul>
5346 </li></ul>
5347 <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>
5348 <ul><li> Another list item
5349 </li></ul>
5350
5351 !!end
5352
5353 !!test
5354 Multiple list tags generated by templates
5355 !!input
5356 {{echo|<li>}}a
5357 {{echo|<li>}}b
5358 {{echo|<li>}}c
5359 !!result
5360 <li>a
5361 <li>b
5362 <li>c</li>
5363 </li>
5364 </li>
5365
5366 !!end
5367
5368 !!test
5369 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5370 !!input
5371 *a
5372 <!--This line will NOT split the list-->
5373 *b
5374 <!--This line will NOT split the list either-->
5375 *c
5376 <!--foo--> <!--This line with more than 1 comment will split the list-->
5377 *d
5378 !!result
5379 <ul><li>a
5380 </li><li>b
5381 </li><li>c
5382 </li></ul>
5383 <ul><li>d
5384 </li></ul>
5385
5386 !!end
5387
5388 !!test
5389 Test the li-hack
5390 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5391 !!options
5392 parsoid=wt2html,wt2wt
5393 !!input
5394 * foo
5395 * <li>li-hack
5396 * {{echo|<li>templated li-hack}}
5397 * <!--foo--> <li> unsupported li-hack with preceding comments
5398
5399 <ul>
5400 <li><li>not a li-hack
5401 </li>
5402 </ul>
5403 !!result
5404 <ul><li> foo</li>
5405 <li>li-hack</li>
5406 <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>
5407 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5408
5409 <ul>
5410 <li></li><li>not a li-hack
5411 </li>
5412 </ul>
5413 !!end
5414
5415 !! test
5416 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5417 !! options
5418 parsoid
5419 !! input
5420 # foo
5421 ## bar
5422 * foo
5423 ** bar
5424 : foo
5425 :: bar
5426 !! result
5427 <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>
5428 !! end
5429
5430
5431 ###
5432 ### Magic Words
5433 ###
5434
5435 !! test
5436 Magic Word: {{CURRENTDAY}}
5437 !! input
5438 {{CURRENTDAY}}
5439 !! result
5440 <p>1
5441 </p>
5442 !! end
5443
5444 !! test
5445 Magic Word: {{CURRENTDAY2}}
5446 !! input
5447 {{CURRENTDAY2}}
5448 !! result
5449 <p>01
5450 </p>
5451 !! end
5452
5453 !! test
5454 Magic Word: {{CURRENTDAYNAME}}
5455 !! input
5456 {{CURRENTDAYNAME}}
5457 !! result
5458 <p>Thursday
5459 </p>
5460 !! end
5461
5462 !! test
5463 Magic Word: {{CURRENTDOW}}
5464 !! input
5465 {{CURRENTDOW}}
5466 !! result
5467 <p>4
5468 </p>
5469 !! end
5470
5471 !! test
5472 Magic Word: {{CURRENTMONTH}}
5473 !! input
5474 {{CURRENTMONTH}}
5475 !! result
5476 <p>01
5477 </p>
5478 !! end
5479
5480 !! test
5481 Magic Word: {{CURRENTMONTHABBREV}}
5482 !! input
5483 {{CURRENTMONTHABBREV}}
5484 !! result
5485 <p>Jan
5486 </p>
5487 !! end
5488
5489 !! test
5490 Magic Word: {{CURRENTMONTHNAME}}
5491 !! input
5492 {{CURRENTMONTHNAME}}
5493 !! result
5494 <p>January
5495 </p>
5496 !! end
5497
5498 !! test
5499 Magic Word: {{CURRENTMONTHNAMEGEN}}
5500 !! input
5501 {{CURRENTMONTHNAMEGEN}}
5502 !! result
5503 <p>January
5504 </p>
5505 !! end
5506
5507 !! test
5508 Magic Word: {{CURRENTTIME}}
5509 !! input
5510 {{CURRENTTIME}}
5511 !! result
5512 <p>00:02
5513 </p>
5514 !! end
5515
5516 !! test
5517 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5518 !! input
5519 {{CURRENTWEEK}}
5520 !! result
5521 <p>1
5522 </p>
5523 !! end
5524
5525 !! test
5526 Magic Word: {{CURRENTYEAR}}
5527 !! input
5528 {{CURRENTYEAR}}
5529 !! result
5530 <p>1970
5531 </p>
5532 !! end
5533
5534 !! test
5535 Magic Word: {{FULLPAGENAME}}
5536 !! options
5537 title=[[User:Ævar Arnfjörð Bjarmason]]
5538 !! input
5539 {{FULLPAGENAME}}
5540 !! result
5541 <p>User:Ævar Arnfjörð Bjarmason
5542 </p>
5543 !! end
5544
5545 !! test
5546 Magic Word: {{FULLPAGENAMEE}}
5547 !! options
5548 title=[[User:Ævar Arnfjörð Bjarmason]]
5549 !! input
5550 {{FULLPAGENAMEE}}
5551 !! result
5552 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5553 </p>
5554 !! end
5555
5556 !! test
5557 Magic Word: {{NAMESPACE}}
5558 !! options
5559 title=[[User:Ævar Arnfjörð Bjarmason]]
5560 !! input
5561 {{NAMESPACE}}
5562 !! result
5563 <p>User
5564 </p>
5565 !! end
5566
5567 !! test
5568 Magic Word: {{NAMESPACEE}}
5569 !! options
5570 title=[[User:Ævar Arnfjörð Bjarmason]]
5571 !! input
5572 {{NAMESPACEE}}
5573 !! result
5574 <p>User
5575 </p>
5576 !! end
5577
5578 !! test
5579 Magic Word: {{NAMESPACENUMBER}}
5580 !! options
5581 title=[[User:Ævar Arnfjörð Bjarmason]]
5582 !! input
5583 {{NAMESPACENUMBER}}
5584 !! result
5585 <p>2
5586 </p>
5587 !! end
5588
5589 !! test
5590 Magic Word: {{NUMBEROFFILES}}
5591 !! input
5592 {{NUMBEROFFILES}}
5593 !! result
5594 <p>4
5595 </p>
5596 !! end
5597
5598 !! test
5599 Magic Word: {{PAGENAME}}
5600 !! options
5601 title=[[User:Ævar Arnfjörð Bjarmason]]
5602 !! input
5603 {{PAGENAME}}
5604 !! result
5605 <p>Ævar Arnfjörð Bjarmason
5606 </p>
5607 !! end
5608
5609 !! test
5610 Magic Word: {{PAGENAME}} with metacharacters
5611 !! options
5612 title=[['foo & bar = baz']]
5613 !! input
5614 ''{{PAGENAME}}''
5615 !! result
5616 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5617 </p>
5618 !! end
5619
5620 !! test
5621 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5622 !! options
5623 title=[[*RFC 1234 http://example.com/]]
5624 !! input
5625 {{PAGENAME}}
5626 !! result
5627 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5628 </p>
5629 !! end
5630
5631 !! test
5632 Magic Word: {{PAGENAMEE}}
5633 !! options
5634 title=[[User:Ævar Arnfjörð Bjarmason]]
5635 !! input
5636 {{PAGENAMEE}}
5637 !! result
5638 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5639 </p>
5640 !! end
5641
5642 !! test
5643 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5644 !! options
5645 title=[[*RFC 1234 http://example.com/]]
5646 !! input
5647 {{PAGENAMEE}}
5648 !! result
5649 <p>&#42;RFC_1234_http&#58;//example.com/
5650 </p>
5651 !! end
5652
5653 !! test
5654 Magic Word: {{REVISIONID}}
5655 !! input
5656 {{REVISIONID}}
5657 !! result
5658 <p>1337
5659 </p>
5660 !! end
5661
5662 !! test
5663 Magic Word: {{SCRIPTPATH}}
5664 !! input
5665 {{SCRIPTPATH}}
5666 !! result
5667 <p>/
5668 </p>
5669 !! end
5670
5671 !! test
5672 Magic Word: {{SERVER}}
5673 !! input
5674 {{SERVER}}
5675 !! result
5676 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5677 </p>
5678 !! end
5679
5680 !! test
5681 Magic Word: {{SERVERNAME}}
5682 !! input
5683 {{SERVERNAME}}
5684 !! result
5685 <p>example.org
5686 </p>
5687 !! end
5688
5689 !! test
5690 Magic Word: {{SITENAME}}
5691 !! input
5692 {{SITENAME}}
5693 !! result
5694 <p>MediaWiki
5695 </p>
5696 !! end
5697
5698 !! test
5699 Case-sensitive magic words, when cased differently, should just be template transclusions
5700 !! input
5701 {{CurrentMonth}}
5702 {{currentday}}
5703 {{cURreNTweEK}}
5704 {{currentHour}}
5705 !! result
5706 <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>
5707 <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>
5708 <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>
5709 <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>
5710 </p>
5711 !! end
5712
5713 !! test
5714 Case-insensitive magic words should still work with weird casing.
5715 !! input
5716 {{sErVeRNaMe}}
5717 {{LCFirst:AOEU}}
5718 {{ucFIRST:aoeu}}
5719 {{SERver}}
5720 !! result
5721 <p>example.org
5722 aOEU
5723 Aoeu
5724 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5725 </p>
5726 !! end
5727
5728 !! test
5729 Namespace 1 {{ns:1}}
5730 !! input
5731 {{ns:1}}
5732 !! result
5733 <p>Talk
5734 </p>
5735 !! end
5736
5737 !! test
5738 Namespace 1 {{ns:01}}
5739 !! input
5740 {{ns:01}}
5741 !! result
5742 <p>Talk
5743 </p>
5744 !! end
5745
5746 !! test
5747 Namespace 0 {{ns:0}} (bug 4783)
5748 !! input
5749 {{ns:0}}
5750 !! result
5751
5752 !! end
5753
5754 !! test
5755 Namespace 0 {{ns:00}} (bug 4783)
5756 !! input
5757 {{ns:00}}
5758 !! result
5759
5760 !! end
5761
5762 !! test
5763 Namespace -1 {{ns:-1}}
5764 !! input
5765 {{ns:-1}}
5766 !! result
5767 <p>Special
5768 </p>
5769 !! end
5770
5771 !! test
5772 Namespace User {{ns:User}}
5773 !! input
5774 {{ns:User}}
5775 !! result
5776 <p>User
5777 </p>
5778 !! end
5779
5780 !! test
5781 Namespace User talk {{ns:User_talk}}
5782 !! input
5783 {{ns:User_talk}}
5784 !! result
5785 <p>User talk
5786 </p>
5787 !! end
5788
5789 !! test
5790 Namespace User talk {{ns:uSeR tAlK}}
5791 !! input
5792 {{ns:uSeR tAlK}}
5793 !! result
5794 <p>User talk
5795 </p>
5796 !! end
5797
5798 !! test
5799 Namespace File {{ns:File}}
5800 !! input
5801 {{ns:File}}
5802 !! result
5803 <p>File
5804 </p>
5805 !! end
5806
5807 !! test
5808 Namespace File {{ns:Image}}
5809 !! input
5810 {{ns:Image}}
5811 !! result
5812 <p>File
5813 </p>
5814 !! end
5815
5816 !! test
5817 Namespace (lang=de) Benutzer {{ns:User}}
5818 !! options
5819 language=de
5820 !! input
5821 {{ns:User}}
5822 !! result
5823 <p>Benutzer
5824 </p>
5825 !! end
5826
5827 !! test
5828 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5829 !! options
5830 language=de
5831 !! input
5832 {{ns:3}}
5833 !! result
5834 <p>Benutzer Diskussion
5835 </p>
5836 !! end
5837
5838
5839 !! test
5840 Urlencode
5841 !! input
5842 {{urlencode:hi world?!}}
5843 {{urlencode:hi world?!|WIKI}}
5844 {{urlencode:hi world?!|PATH}}
5845 {{urlencode:hi world?!|QUERY}}
5846 !! result
5847 <p>hi+world%3F%21
5848 hi_world%3F!
5849 hi%20world%3F%21
5850 hi+world%3F%21
5851 </p>
5852 !! end
5853
5854 ###
5855 ### Magic links
5856 ###
5857 !! test
5858 Magic links: internal link to RFC (bug 479)
5859 !! input
5860 [[RFC 123]]
5861 !! result
5862 <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>
5863 </p>
5864 !! end
5865
5866 !! test
5867 Magic links: RFC (bug 479)
5868 !! input
5869 RFC 822
5870 !! result
5871 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5872 </p>
5873 !! end
5874
5875 !! test
5876 Magic links: ISBN (bug 1937)
5877 !! input
5878 ISBN 0-306-40615-2
5879 !! result
5880 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5881 </p>
5882 !! end
5883
5884 !! test
5885 Magic links: PMID incorrectly converts space to underscore
5886 !! input
5887 PMID 1234
5888 !! result
5889 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5890 </p>
5891 !! end
5892
5893 ###
5894 ### Templates
5895 ####
5896
5897 !! test
5898 Nonexistent template
5899 !! input
5900 {{thistemplatedoesnotexist}}
5901 !! result
5902 <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>
5903 </p>
5904 !! end
5905
5906 !! test
5907 Template with invalid target containing tags
5908 !! input
5909 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5910 !! result
5911 <p>{{a<b>b</b>|foo|a=b|a = b}}
5912 </p>
5913 !! end
5914
5915 !! test
5916 Template with invalid target containing unclosed tag
5917 !! input
5918 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5919 !! result
5920 <p>{{a<b>|foo|a=b|a = b}}</b>
5921 </p>
5922 !! end
5923
5924 !! article
5925 Template:test
5926 !! text
5927 This is a test template
5928 !! endarticle
5929
5930 !! test
5931 Simple template
5932 !! input
5933 {{test}}
5934 !! result
5935 <p>This is a test template
5936 </p>
5937 !! end
5938
5939 !! test
5940 Template with explicit namespace
5941 !! input
5942 {{Template:test}}
5943 !! result
5944 <p>This is a test template
5945 </p>
5946 !! end
5947
5948
5949 !! article
5950 Template:paramtest
5951 !! text
5952 This is a test template with parameter {{{param}}}
5953 !! endarticle
5954
5955 !! test
5956 Template parameter
5957 !! input
5958 {{paramtest|param=foo}}
5959 !! result
5960 <p>This is a test template with parameter foo
5961 </p>
5962 !! end
5963
5964 !! article
5965 Template:paramtestnum
5966 !! text
5967 [[{{{1}}}|{{{2}}}]]
5968 !! endarticle
5969
5970 !! test
5971 Template unnamed parameter
5972 !! input
5973 {{paramtestnum|Main Page|the main page}}
5974 !! result
5975 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5976 </p>
5977 !! end
5978
5979 !! article
5980 Template:templatesimple
5981 !! text
5982 (test)
5983 !! endarticle
5984
5985 !! article
5986 Template:templateredirect
5987 !! text
5988 #redirect [[Template:templatesimple]]
5989 !! endarticle
5990
5991 !! article
5992 Template:templateasargtestnum
5993 !! text
5994 {{{{{1}}}}}
5995 !! endarticle
5996
5997 !! article
5998 Template:templateasargtest
5999 !! text
6000 {{template{{{templ}}}}}
6001 !! endarticle
6002
6003 !! article
6004 Template:templateasargtest2
6005 !! text
6006 {{{{{templ}}}}}
6007 !! endarticle
6008
6009 !! test
6010 Template with template name as unnamed argument
6011 !! input
6012 {{templateasargtestnum|templatesimple}}
6013 !! result
6014 <p>(test)
6015 </p>
6016 !! end
6017
6018 !! test
6019 Template with template name as argument
6020 !! input
6021 {{templateasargtest|templ=simple}}
6022 !! result
6023 <p>(test)
6024 </p>
6025 !! end
6026
6027 !! test
6028 Template with template name as argument (2)
6029 !! input
6030 {{templateasargtest2|templ=templatesimple}}
6031 !! result
6032 <p>(test)
6033 </p>
6034 !! end
6035
6036 !! article
6037 Template:templateasargtestdefault
6038 !! text
6039 {{{{{templ|templatesimple}}}}}
6040 !! endarticle
6041
6042 !! article
6043 Template:templa
6044 !! text
6045 '''templ'''
6046 !! endarticle
6047
6048 !! test
6049 Template with default value
6050 !! input
6051 {{templateasargtestdefault}}
6052 !! result
6053 <p>(test)
6054 </p>
6055 !! end
6056
6057 !! test
6058 Template with default value (value set)
6059 !! input
6060 {{templateasargtestdefault|templ=templa}}
6061 !! result
6062 <p><b>templ</b>
6063 </p>
6064 !! end
6065
6066 !! test
6067 Template redirect
6068 !! input
6069 {{templateredirect}}
6070 !! result
6071 <p>(test)
6072 </p>
6073 !! end
6074
6075 !! test
6076 Template with argument in separate line
6077 !! input
6078 {{ templateasargtest |
6079 templ = simple }}
6080 !! result
6081 <p>(test)
6082 </p>
6083 !! end
6084
6085 !! test
6086 Template with complex template as argument
6087 !! input
6088 {{paramtest|
6089 param ={{ templateasargtest |
6090 templ = simple }}}}
6091 !! result
6092 <p>This is a test template with parameter (test)
6093 </p>
6094 !! end
6095
6096 !! test
6097 Template with thumb image (with link in description)
6098 !! input
6099 {{paramtest|
6100 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6101 !! result
6102 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>
6103
6104 !! end
6105
6106 !! article
6107 Template:complextemplate
6108 !! text
6109 {{{1}}} {{paramtest|
6110 param ={{{param}}}}}
6111 !! endarticle
6112
6113 !! test
6114 Template with complex arguments
6115 !! input
6116 {{complextemplate|
6117 param ={{ templateasargtest |
6118 templ = simple }}|[[Template:complextemplate|link]]}}
6119 !! result
6120 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6121 </p>
6122 !! end
6123
6124 !! test
6125 BUG 553: link with two variables in a piped link
6126 !! input
6127 {|
6128 |[[{{{1}}}|{{{2}}}]]
6129 |}
6130 !! result
6131 <table>
6132 <tr>
6133 <td>[[{{{1}}}|{{{2}}}]]
6134 </td></tr></table>
6135
6136 !! end
6137
6138 !! test
6139 Magic variable as template parameter
6140 !! input
6141 {{paramtest|param={{SITENAME}}}}
6142 !! result
6143 <p>This is a test template with parameter MediaWiki
6144 </p>
6145 !! end
6146
6147 !! article
6148 Template:linktest
6149 !! text
6150 [[{{{param}}}|link]]
6151 !! endarticle
6152
6153 !! test
6154 Template parameter as link source
6155 !! input
6156 {{linktest|param=Main Page}}
6157 !! result
6158 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6159 </p>
6160 !! end
6161
6162 !!test
6163 Template-generated attribute string (k='v')
6164 !!input
6165 <span {{attr_str|id|v1}}>bar</span>
6166 !!result
6167 <p><span id="v1">bar</span>
6168 </p>
6169 !!end
6170
6171 !!article
6172 Template:paramtest2
6173 !! text
6174 including another template, {{paramtest|param={{{arg}}}}}
6175 !! endarticle
6176
6177 !! test
6178 Template passing argument to another template
6179 !! input
6180 {{paramtest2|arg='hmm'}}
6181 !! result
6182 <p>including another template, This is a test template with parameter 'hmm'
6183 </p>
6184 !! end
6185
6186 !! article
6187 Template:Linktest2
6188 !! text
6189 Main Page
6190 !! endarticle
6191
6192 !! test
6193 Template as link source
6194 !! input
6195 [[{{linktest2}}]]
6196
6197 [[{{linktest2}}|Main Page]]
6198
6199 [[{{linktest2}}]]Page
6200 !! result
6201 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6202 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6203 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6204 </p>
6205 !! end
6206
6207
6208 !! article
6209 Template:loop1
6210 !! text
6211 {{loop2}}
6212 !! endarticle
6213
6214 !! article
6215 Template:loop2
6216 !! text
6217 {{loop1}}
6218 !! endarticle
6219
6220 !! test
6221 Template infinite loop
6222 !! input
6223 {{loop1}}
6224 !! result
6225 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6226 </p>
6227 !! end
6228
6229 !! test
6230 Template from main namespace
6231 !! input
6232 {{:Main Page}}
6233 !! result
6234 <p>blah blah
6235 </p>
6236 !! end
6237
6238 !! article
6239 Template:table
6240 !! text
6241 {|
6242 | 1 || 2
6243 |-
6244 | 3 || 4
6245 |}
6246 !! endarticle
6247
6248 !! test
6249 BUG 529: Template with table, not included at beginning of line
6250 !! input
6251 foo {{table}}
6252 !! result
6253 <p>foo
6254 </p>
6255 <table>
6256 <tr>
6257 <td> 1 </td>
6258 <td> 2
6259 </td></tr>
6260 <tr>
6261 <td> 3 </td>
6262 <td> 4
6263 </td></tr></table>
6264
6265 !! end
6266
6267 !! test
6268 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6269 !! input
6270 foo
6271 {{table}}
6272 !! result
6273 <p>foo
6274 </p>
6275 <table>
6276 <tr>
6277 <td> 1 </td>
6278 <td> 2
6279 </td></tr>
6280 <tr>
6281 <td> 3 </td>
6282 <td> 4
6283 </td></tr></table>
6284
6285 !! end
6286
6287 !! test
6288 BUG 41: Template parameters shown as broken links
6289 !! input
6290 {{{parameter}}}
6291 !! result
6292 <p>{{{parameter}}}
6293 </p>
6294 !! end
6295
6296 !! test
6297 Template with targets containing wikilinks
6298 !! input
6299 {{[[foo]]}}
6300
6301 {{[[{{echo|foo}}]]}}
6302
6303 {{{{echo|[[foo}}]]}}
6304 !! result
6305 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6306 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6307 </p><p>{{[[foo}}]]
6308 </p>
6309 !! end
6310
6311 !! article
6312 Template:MSGNW test
6313 !! text
6314 ''None'' of '''this''' should be
6315 * interpreted
6316 but rather passed unmodified
6317 {{test}}
6318 !! endarticle
6319
6320 # hmm, fix this or just deprecate msgnw and document its behavior?
6321 !! test
6322 msgnw keyword
6323 !! options
6324 disabled
6325 !! input
6326 {{msgnw:MSGNW test}}
6327 !! result
6328 <p>''None'' of '''this''' should be
6329 * interpreted
6330 but rather passed unmodified
6331 {{test}}
6332 </p>
6333 !! end
6334
6335 !! test
6336 int keyword
6337 !! input
6338 {{int:youhavenewmessages|lots of money|not!}}
6339 !! result
6340 <p>You have lots of money (not!).
6341 </p>
6342 !! end
6343
6344 !! article
6345 Template:Includes
6346 !! text
6347 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6348 !! endarticle
6349
6350 !! test
6351 <includeonly> and <noinclude> being included
6352 !! input
6353 {{Includes}}
6354 !! result
6355 <p>Foobar
6356 </p>
6357 !! end
6358
6359 !! article
6360 Template:Includes2
6361 !! text
6362 <onlyinclude>Foo</onlyinclude>bar
6363 !! endarticle
6364
6365 !! test
6366 <onlyinclude> being included
6367 !! input
6368 {{Includes2}}
6369 !! result
6370 <p>Foo
6371 </p>
6372 !! end
6373
6374
6375 !! article
6376 Template:Includes3
6377 !! text
6378 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6379 !! endarticle
6380
6381 !! test
6382 <onlyinclude> and <includeonly> being included
6383 !! input
6384 {{Includes3}}
6385 !! result
6386 <p>Foo
6387 </p>
6388 !! end
6389
6390 !! test
6391 <includeonly> and <noinclude> on a page
6392 !! input
6393 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6394 !! result
6395 <p>Foozar
6396 </p>
6397 !! end
6398
6399 !! test
6400 Un-closed <noinclude>
6401 !! input
6402 <noinclude>
6403 !! result
6404 !! end
6405
6406 !! test
6407 <onlyinclude> on a page
6408 !! input
6409 <onlyinclude>Foo</onlyinclude>bar
6410 !! result
6411 <p>Foobar
6412 </p>
6413 !! end
6414
6415 !! test
6416 Un-closed <onlyinclude>
6417 !! input
6418 <onlyinclude>
6419 !! result
6420 !! end
6421
6422 !!test
6423 Self-closed noinclude, includeonly, onlyinclude tags
6424 !!input
6425 <noinclude />
6426 <includeonly />
6427 <onlyinclude />
6428 !!result
6429 <p><br />
6430 </p>
6431 !!end
6432
6433 !!test
6434 Unbalanced includeonly and noinclude tags
6435 !!input
6436 {|
6437 |a</noinclude>
6438 |b</noinclude></noinclude>
6439 |c</noinclude></includeonly>
6440 |d</includeonly></includeonly>
6441 |}
6442 !!result
6443 <table>
6444 <tr>
6445 <td>a
6446 </td>
6447 <td>b
6448 </td>
6449 <td>c&lt;/includeonly&gt;
6450 </td>
6451 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6452 </td></tr></table>
6453
6454 !!end
6455
6456 !! article
6457 Template:Includeonly section
6458 !! text
6459 <includeonly>
6460 ==Includeonly section==
6461 </includeonly>
6462 ==Section T-1==
6463 !!endarticle
6464
6465 !! test
6466 Bug 6563: Edit link generation for section shown by <includeonly>
6467 !! input
6468 {{includeonly section}}
6469 !! result
6470 <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>
6471 <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>
6472
6473 !! end
6474
6475 # Uses same input as the contents of [[Template:Includeonly section]]
6476 !! test
6477 Bug 6563: Section extraction for section shown by <includeonly>
6478 !! options
6479 section=T-2
6480 !! input
6481 <includeonly>
6482 ==Includeonly section==
6483 </includeonly>
6484 ==Section T-2==
6485 !! result
6486 ==Section T-2==
6487 !! end
6488
6489 !! test
6490 Bug 6563: Edit link generation for section suppressed by <includeonly>
6491 !! input
6492 <includeonly>
6493 ==Includeonly section==
6494 </includeonly>
6495 ==Section 1==
6496 !! result
6497 <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>
6498
6499 !! end
6500
6501 !! test
6502 Bug 6563: Section extraction for section suppressed by <includeonly>
6503 !! options
6504 section=1
6505 !! input
6506 <includeonly>
6507 ==Includeonly section==
6508 </includeonly>
6509 ==Section 1==
6510 !! result
6511 ==Section 1==
6512 !! end
6513
6514 !! test
6515 Un-closed <includeonly>
6516 !! input
6517 <includeonly>
6518 !! result
6519 !! end
6520
6521 ###
6522 ### <includeonly> and <noinclude> in attributes
6523 ###
6524 !!test
6525 0. includeonly around the entire attribute
6526 !!input
6527 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6528 !!result
6529 <p><span id="v2">bar</span>
6530 </p>
6531 !!end
6532
6533 !!test
6534 1. includeonly in html attr key
6535 !!input
6536 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6537 !!result
6538 <p><span id="foo">bar</span>
6539 </p>
6540 !!end
6541
6542 !!test
6543 2. includeonly in html attr value
6544 !!input
6545 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6546 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6547 !!result
6548 <p><span id="v1">bar</span>
6549 <span id="v1">bar</span>
6550 </p>
6551 !!end
6552
6553 !!test
6554 3. includeonly in part of an attr value
6555 !!input
6556 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6557 !!result
6558 <p><span style="color:red;">bar</span>
6559 </p>
6560 !!end
6561
6562 ###
6563 ### Testing parsing of templates where a template arg
6564 ### has the same name as the template itself.
6565 ###
6566
6567 !! article
6568 Template:quote
6569 !! text
6570 {{{quote|{{{1}}}}}}
6571 !! endarticle
6572
6573 !!test
6574 Templates: Template Name/Arg clash: 1. Use of positional param
6575 !!input
6576 {{quote|foo}}
6577 !!result
6578 <p>foo
6579 </p>
6580 !!end
6581
6582 !!test
6583 Templates: Template Name/Arg clash: 2. Use of named param
6584 !!input
6585 {{quote|quote=foo}}
6586 !!result
6587 <p>foo
6588 </p>
6589 !!end
6590
6591 !!test
6592 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6593 !!input
6594 {{quote|quote}}
6595 !!result
6596 <p>quote
6597 </p>
6598 !!end
6599
6600 ###
6601 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6602 ###
6603
6604 !!test
6605 Templates: 1. Simple use
6606 !!input
6607 {{echo|Foo}}
6608 !!result
6609 <p>Foo
6610 </p>
6611 !!end
6612
6613 !!test
6614 Templates: 2. Inside a block tag
6615 !!input
6616 <div>{{echo|Foo}}</div>
6617 !!result
6618 <div>Foo</div>
6619
6620 !!end
6621
6622 !!test
6623 Templates: P-wrapping: 1a. Templates on consecutive lines
6624 !!input
6625 {{echo|Foo}}
6626 {{echo|bar}}
6627 !!result
6628 <p>Foo
6629 bar
6630 </p>
6631 !!end
6632
6633 !!test
6634 Templates: P-wrapping: 1b. Templates on consecutive lines
6635 !!input
6636 Foo
6637
6638 {{echo|bar}}
6639 {{echo|baz}}
6640 !!result
6641 <p>Foo
6642 </p><p>bar
6643 baz
6644 </p>
6645 !!end
6646
6647 !!test
6648 Templates: P-wrapping: 1c. Templates on consecutive lines
6649 !!input
6650 {{echo|Foo}}
6651 {{echo|bar}} <div>baz</div>
6652 !!result
6653 <p>Foo
6654 </p>
6655 bar <div>baz</div>
6656
6657 !!end
6658
6659 !!test
6660 Templates: P-wrapping: 1d. Template preceded by comment-only line
6661 !!options
6662 parsoid=wt2html,wt2wt
6663 !!input
6664 <!-- foo -->
6665 {{echo|Bar}}
6666 !!result
6667 <!-- foo -->
6668 <p typeof="mw:Transclusion">Bar
6669 </p>
6670 !!end
6671
6672 !!test
6673 Templates: Inline Text: 1. Multiple tmeplate uses
6674 !!input
6675 {{echo|Foo}}bar{{echo|baz}}
6676 !!result
6677 <p>Foobarbaz
6678 </p>
6679 !!end
6680
6681 !!test
6682 Templates: Inline Text: 2. Back-to-back template uses
6683 !!input
6684 {{echo|Foo}}{{echo|bar}}
6685 !!result
6686 <p>Foobar
6687 </p>
6688 !!end
6689
6690 !!test
6691 Templates: Block Tags: 1. Multiple template uses
6692 !!input
6693 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6694 !!result
6695 <div>Foo</div><div>bar</div><div>baz</div>
6696
6697 !!end
6698
6699 !!test
6700 Templates: Block Tags: 2. Back-to-back template uses
6701 !!input
6702 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6703 !!result
6704 <div>Foo</div><div>bar</div>
6705
6706 !!end
6707
6708 !!test
6709 Templates: Links: 1. Simple example
6710 !!input
6711 {{echo|[[Foo|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: 2. Generation of link href
6719 !!input
6720 [[{{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: Links: 3. Generation of part of a link href
6728 !!input
6729 [[Fo{{echo|o}}|bar]]
6730
6731 [[Foo{{echo|bar}}]]
6732
6733 [[Foo{{echo|bar}}baz]]
6734
6735 [[Foo{{echo|bar}}|bar]]
6736
6737 [[:Foo{{echo|bar}}]]
6738
6739 [[:Foo{{echo|bar}}|bar]]
6740 !!result
6741 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6742 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6743 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6744 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6745 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6746 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6747 </p>
6748 !!end
6749
6750 !!test
6751 Templates: Links: 4. Multiple templates generating link href
6752 !!input
6753 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6754 !!result
6755 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6756 </p>
6757 !!end
6758
6759 !!test
6760 Templates: Links: 5. Generation of link text
6761 !!input
6762 [[Foo|{{echo|bar}}]]
6763 !!result
6764 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6765 </p>
6766 !!end
6767
6768 !!test
6769 Templates: Links: 5. Nested templates (only outermost template should be marked)
6770 !!input
6771 {{echo|[[{{echo|Foo}}|bar]]}}
6772 !!result
6773 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6774 </p>
6775 !!end
6776
6777 !!test
6778 Templates: HTML Tag: 1. Generation of HTML attr. key
6779 !!input
6780 <div {{echo|style}}="color:red;">foo</div>
6781 !!result
6782 <div style="color:red;">foo</div>
6783
6784 !!end
6785
6786 !!test
6787 Templates: HTML Tag: 2. Generation of HTML attr. value
6788 !!input
6789 <div style={{echo|'color:red;'}}>foo</div>
6790 !!result
6791 <div style="color:red;">foo</div>
6792
6793 !!end
6794
6795 !!test
6796 Templates: HTML Tag: 3. Generation of HTML attr key and value
6797 !!input
6798 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6799 !!result
6800 <div style="color:red;">foo</div>
6801
6802 !!end
6803
6804 !!test
6805 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6806 !!input
6807 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6808 !!result
6809 <div title="This is a long title with just one piece templated">foo</div>
6810
6811 !!end
6812
6813 !!test
6814 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6815 !!input
6816 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6817 !!result
6818 <div title="This is a long title with just one piece templated">foo</div>
6819
6820 !!end
6821
6822 !!test
6823 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6824 !!input
6825 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6826 !!result
6827 <div title="This is a long title with just one piece templated">foo</div>
6828
6829 !!end
6830
6831 !!test
6832 Templates: HTML Tag: 7. Generation of partial attribute key string
6833 !!input
6834 <div st{{echo|yle}}="color:red;">foo</div>
6835 !!result
6836 <div style="color:red;">foo</div>
6837
6838 !!end
6839
6840 !!test
6841 Templates: HTML Tables: 1. Generating start of a HTML table
6842 !!input
6843 {{echo|<table><tr><td>foo</td>}}</tr></table>
6844 !!result
6845 <table><tr><td>foo</td></tr></table>
6846
6847 !!end
6848
6849 !!test
6850 Templates: HTML Tables: 2a. Generating middle of a HTML table
6851 !!input
6852 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6853 !!result
6854 <table><tr><td>foo</td></tr></table>
6855
6856 !!end
6857
6858 !!test
6859 Templates: HTML Tables: 2b. Generating middle of a HTML table
6860 !!input
6861 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6862 !!result
6863 <table><tr><td>foo</td></tr></table>
6864
6865 !!end
6866
6867 !!test
6868 Templates: HTML Tables: 3. Generating end of a HTML table
6869 !!input
6870 <table><tr>{{echo|<td>foo</td></tr></table>}}
6871 !!result
6872 <table><tr><td>foo</td></tr></table>
6873
6874 !!end
6875
6876 !!test
6877 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6878 !!input
6879 {{echo|<table>}}<tr><td>foo</td></tr></table>
6880 !!result
6881 <table><tr><td>foo</td></tr></table>
6882
6883 !!end
6884
6885 !!test
6886 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6887 !!input
6888 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6889 !!result
6890 <table><tr><td>foo</td></tr></table>
6891
6892 !!end
6893
6894 !!test
6895 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6896 !!input
6897 <table><tr>{{echo|<td>}}foo</td></tr></table>
6898 !!result
6899 <table><tr><td>foo</td></tr></table>
6900
6901 !!end
6902
6903 !!test
6904 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6905 !!input
6906 <table><tr><td>foo{{echo|</td>}}</tr></table>
6907 !!result
6908 <table><tr><td>foo</td></tr></table>
6909
6910 !!end
6911
6912 !!test
6913 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6914 !!input
6915 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6916 !!result
6917 <table><tr><td>foo</td></tr></table>
6918
6919 !!end
6920
6921 !!test
6922 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6923 !!input
6924 <table><tr><td>foo</td></tr>{{echo|</table>}}
6925 !!result
6926 <table><tr><td>foo</td></tr></table>
6927
6928 !!end
6929
6930 !!test
6931 Templates: HTML Tables: 5. Proper fostering of categories from inside
6932 !!options
6933 parsoid=wt2html,wt2wt
6934 !!input
6935 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6936 <!--Two categories (Bug 50330)-->
6937 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6938 !!result
6939 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6940 <!--Two categories (Bug 50330)-->
6941 <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>
6942 !!end
6943
6944 !!test
6945 Templates: Wiki Tables: 1a. Fostering of entire template content
6946 !!input
6947 {|
6948 {{echo|a}}
6949 |}
6950 !!result
6951 <table>
6952 a
6953 <tr><td></td></tr></table>
6954
6955 !!end
6956
6957 !!test
6958 Templates: Wiki Tables: 1b. Fostering of entire template content
6959 !!input
6960 {|
6961 {{echo|<div>}}
6962 foo
6963 {{echo|</div>}}
6964 |}
6965 !!result
6966 <table>
6967 <div>
6968 <p>foo
6969 </p>
6970 </div>
6971 <tr><td></td></tr></table>
6972
6973 !!end
6974
6975 !!test
6976 Templates: Wiki Tables: 2. Fostering of partial template content
6977 !!input
6978 {|
6979 {{echo|a
6980 <div>b</div>}}
6981 |}
6982 !!result
6983 <table>
6984 a
6985 <div>b</div>
6986 <tr><td></td></tr></table>
6987
6988 !!end
6989
6990 !!test
6991 Templates: Wiki Tables: 3. td-content via multiple templates
6992 !!input
6993 {|
6994 {{echo|{{pipe}}a}}{{echo|b}}
6995 |}
6996 !!result
6997 <table>
6998 <tr>
6999 <td>ab
7000 </td></tr></table>
7001
7002 !!end
7003
7004 !!test
7005 Templates: Wiki Tables: 4. Templated tags, no content
7006 !!input
7007 {{tbl-start}}
7008 {{tbl-end}}
7009 !!result
7010 <table>
7011 <tr><td></td></tr></table>
7012
7013 !!end
7014
7015 !!test
7016 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7017 !!input
7018 {{tbl-start}}
7019 |foo
7020 {{tbl-end}}
7021 !!result
7022 <table>
7023 <tr>
7024 <td>foo
7025 </td></tr></table>
7026
7027 !!end
7028
7029 !!test
7030 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7031 !!input
7032 {{tbl-start}}
7033 {{!}}foo
7034 {{tbl-end}}
7035 !!result
7036 <table>
7037 <tr>
7038 <td>foo
7039 </td></tr></table>
7040
7041 !!end
7042
7043 !!test
7044 Templates: Lists: Multi-line list-items via templates
7045 !!input
7046 *{{echo|a {{nonexistent|
7047 unused}}}}
7048 *{{echo|b {{nonexistent|
7049 unused}}}}
7050 !!result
7051 <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>
7052 </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>
7053 </li></ul>
7054
7055 !!end
7056
7057 !!test
7058 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7059 !!input
7060 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7061 !!result
7062 <p><i>ab</i>c<i>d</i>e
7063 </p>
7064 !!end
7065
7066 !!test
7067 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7068 (PHP parser generates misnested html)
7069 !! options
7070 parsoid=wt2html,wt2wt
7071 !!input
7072 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7073 !!result
7074 <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>
7075 !!end
7076
7077 !!test
7078 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7079 (PHP parser generates misnested html)
7080 !! options
7081 parsoid=wt2html,wt2wt
7082 !!input
7083 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7084 !!result
7085 <div typeof="mw:Transclusion"><i>a</i></div>
7086 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7087 <div typeof="mw:Transclusion">e</div>
7088 !!end
7089
7090 !!test
7091 Templates: Ugly nesting: 4. Divs opened/closed across templates
7092 !!input
7093 a<div>b{{echo|c</div>d}}e
7094 !!result
7095 a<div>bc</div>de
7096
7097 !!end
7098
7099 !!test
7100 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7101 (Parsoid-centric)
7102 !! options
7103 parsoid
7104 !!input
7105 {|
7106 |{{echo|foo</table>}}
7107 |bar
7108 |}
7109 !!result
7110 <table typeof="mw:Transclusion">
7111 <tbody>
7112 <tr>
7113 <td>foo</td></tr></tbody></table><span>bar</span>
7114 !!end
7115
7116 !!test
7117 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7118 (Parsoid-centric)
7119 !! options
7120 parsoid
7121 !!input
7122 <table>
7123 <tr>
7124 <td>
7125 <table>
7126 <tr>
7127 <td>1. {{echo|foo </table>}}</td>
7128 <td> bar </td>
7129 <td>2. {{echo|baz </table>}}</td>
7130 </tr>
7131 <tr>
7132 <td>abc</td>
7133 </tr>
7134 </table>
7135 </td>
7136 </tr>
7137 <tr>
7138 <td>xyz</td>
7139 </tr>
7140 </table>
7141 !!result
7142 <table about="#mwt1" typeof="mw:Transclusion">
7143 <tbody><tr >
7144 <td >
7145 <table >
7146 <tbody><tr >
7147 <td >1. foo </td></tr></tbody></table></td>
7148 <td > bar </td>
7149 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7150 </span><span about="#mwt1">
7151
7152 abc</span><span about="#mwt1">
7153 </span><span about="#mwt1">
7154 </span><span about="#mwt1">
7155 </span><span about="#mwt1">
7156 </span><span about="#mwt1">
7157
7158 xyz</span><span about="#mwt1">
7159 </span><span about="#mwt1">
7160 </span>
7161 !!end
7162
7163 !! test
7164 Templates: Ugly templates: 3. newline-only template parameter
7165 !! input
7166 foo {{echo|
7167 }}
7168 !! result
7169 <p>foo
7170 </p>
7171 !! end
7172
7173 # This looks like a bug: a single newline triggers p/br for some reason.
7174 !! test
7175 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7176 !! input
7177 {{echo|
7178 }}
7179 !! result
7180 <p><br />
7181 </p>
7182 !! end
7183
7184
7185 !!test
7186 Parser Functions: 1. Simple example
7187 !!input
7188 {{uc:foo}}
7189 !!result
7190 <p>FOO
7191 </p>
7192 !!end
7193
7194 !!test
7195 Parser Functions: 2. Nested use (only outermost should be marked up)
7196 !!input
7197 {{uc:{{lc:FOO}}}}
7198 !!result
7199 <p>FOO
7200 </p>
7201 !!end
7202
7203 ###
7204 ### Pre-save transform tests
7205 ###
7206 !! test
7207 pre-save transform: subst:
7208 !! options
7209 PST
7210 !! input
7211 {{subst:test}}
7212 !! result
7213 This is a test template
7214 !! end
7215
7216 !! test
7217 pre-save transform: normal template
7218 !! options
7219 PST
7220 !! input
7221 {{test}}
7222 !! result
7223 {{test}}
7224 !! end
7225
7226 !! test
7227 pre-save transform: nonexistent template
7228 !! options
7229 PST
7230 !! input
7231 {{thistemplatedoesnotexist}}
7232 !! result
7233 {{thistemplatedoesnotexist}}
7234 !! end
7235
7236
7237 !! test
7238 pre-save transform: subst magic variables
7239 !! options
7240 PST
7241 !! input
7242 {{subst:SITENAME}}
7243 !! result
7244 MediaWiki
7245 !! end
7246
7247 # This is bug 89, which I fixed. -- wtm
7248 !! test
7249 pre-save transform: subst: templates with parameters
7250 !! options
7251 pst
7252 !! input
7253 {{subst:paramtest|param="something else"}}
7254 !! result
7255 This is a test template with parameter "something else"
7256 !! end
7257
7258 !! article
7259 Template:nowikitest
7260 !! text
7261 <nowiki>'''not wiki'''</nowiki>
7262 !! endarticle
7263
7264 !! test
7265 pre-save transform: nowiki in subst (bug 1188)
7266 !! options
7267 pst
7268 !! input
7269 {{subst:nowikitest}}
7270 !! result
7271 <nowiki>'''not wiki'''</nowiki>
7272 !! end
7273
7274
7275 !! article
7276 Template:commenttest
7277 !! text
7278 This template has <!-- a comment --> in it.
7279 !! endarticle
7280
7281 !! test
7282 pre-save transform: comment in subst (bug 1936)
7283 !! options
7284 pst
7285 !! input
7286 {{subst:commenttest}}
7287 !! result
7288 This template has <!-- a comment --> in it.
7289 !! end
7290
7291 !! test
7292 pre-save transform: unclosed tag
7293 !! options
7294 pst noxml
7295 !! input
7296 <nowiki>'''not wiki'''
7297 !! result
7298 <nowiki>'''not wiki'''
7299 !! end
7300
7301 !! test
7302 pre-save transform: mixed tag case
7303 !! options
7304 pst noxml
7305 !! input
7306 <NOwiki>'''not wiki'''</noWIKI>
7307 !! result
7308 <NOwiki>'''not wiki'''</noWIKI>
7309 !! end
7310
7311 !! test
7312 pre-save transform: unclosed comment in <nowiki>
7313 !! options
7314 pst noxml
7315 !! input
7316 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7317 !! result
7318 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7319 !!end
7320
7321 # Leading @ in this template definition works around a limitation
7322 # in parsoid's parserTests which otherwise strips the <span> from the
7323 # result (confusing it for a template wrapper)
7324 !! article
7325 Template:dangerous
7326 !!text
7327 @<span onmouseover="alert('crap')">Oh no</span>
7328 !!endarticle
7329
7330 !!test
7331 (confirming safety of fix for subst bug 1936)
7332 !! input
7333 {{Template:dangerous}}
7334 !! result
7335 <p>@<span>Oh no</span>
7336 </p>
7337 !! end
7338
7339 !! test
7340 pre-save transform: comment containing gallery (bug 5024)
7341 !! options
7342 pst
7343 !! input
7344 <!-- <gallery>data</gallery> -->
7345 !!result
7346 <!-- <gallery>data</gallery> -->
7347 !!end
7348
7349 !! test
7350 pre-save transform: comment containing extension
7351 !! options
7352 pst
7353 !! input
7354 <!-- <tag>data</tag> -->
7355 !!result
7356 <!-- <tag>data</tag> -->
7357 !!end
7358
7359 !! test
7360 pre-save transform: comment containing nowiki
7361 !! options
7362 pst
7363 !! input
7364 <!-- <nowiki>data</nowiki> -->
7365 !!result
7366 <!-- <nowiki>data</nowiki> -->
7367 !!end
7368
7369 !! test
7370 pre-save transform: <noinclude> in subst (bug 3298)
7371 !! options
7372 pst
7373 !! input
7374 {{subst:Includes}}
7375 !! result
7376 Foobar
7377 !! end
7378
7379 !! test
7380 pre-save transform: <onlyinclude> in subst (bug 3298)
7381 !! options
7382 pst
7383 !! input
7384 {{subst:Includes2}}
7385 !! result
7386 Foo
7387 !! end
7388
7389 !! article
7390 Template:SubstTest
7391 !!text
7392 {{<includeonly>subst:</includeonly>Includes}}
7393 !! endarticle
7394
7395 !! article
7396 Template:SafeSubstTest
7397 !! text
7398 {{<includeonly>safesubst:</includeonly>Includes}}
7399 !! endarticle
7400
7401 !! test
7402 bug 22297: safesubst: works during PST
7403 !! options
7404 pst
7405 !! input
7406 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7407 !! result
7408 FoobarFoobar
7409 !! end
7410
7411 !! test
7412 bug 22297: safesubst: works during normal parse
7413 !! input
7414 {{SafeSubstTest}}
7415 !! result
7416 <p>Foobar
7417 </p>
7418 !! end
7419
7420 !! test:
7421 subst: does not work during normal parse
7422 !! input
7423 {{SubstTest}}
7424 !! result
7425 <p>{{subst:Includes}}
7426 </p>
7427 !! end
7428
7429 !! test
7430 pre-save transform: context links ("pipe trick")
7431 !! options
7432 pst
7433 !! input
7434 [[Article (context)|]]
7435 [[Bar:Article|]]
7436 [[:Bar:Article|]]
7437 [[Bar:Article (context)|]]
7438 [[:Bar:Article (context)|]]
7439 [[|Article]]
7440 [[|Article (context)]]
7441 [[Bar:X (Y) Z|]]
7442 [[:Bar:X (Y) Z|]]
7443 !! result
7444 [[Article (context)|Article]]
7445 [[Bar:Article|Article]]
7446 [[:Bar:Article|Article]]
7447 [[Bar:Article (context)|Article]]
7448 [[:Bar:Article (context)|Article]]
7449 [[Article]]
7450 [[Article (context)]]
7451 [[Bar:X (Y) Z|X (Y) Z]]
7452 [[:Bar:X (Y) Z|X (Y) Z]]
7453 !! end
7454
7455 !! test
7456 pre-save transform: context links ("pipe trick") with interwiki prefix
7457 !! options
7458 pst
7459 !! input
7460 [[interwiki:Article|]]
7461 [[:interwiki:Article|]]
7462 [[interwiki:Bar:Article|]]
7463 [[:interwiki:Bar:Article|]]
7464 !! result
7465 [[interwiki:Article|Article]]
7466 [[:interwiki:Article|Article]]
7467 [[interwiki:Bar:Article|Bar:Article]]
7468 [[:interwiki:Bar:Article|Bar:Article]]
7469 !! end
7470
7471 !! test
7472 pre-save transform: context links ("pipe trick") with parens in title
7473 !! options
7474 pst title=[[Somearticle (context)]]
7475 !! input
7476 [[|Article]]
7477 !! result
7478 [[Article (context)|Article]]
7479 !! end
7480
7481 !! test
7482 pre-save transform: context links ("pipe trick") with comma in title
7483 !! options
7484 pst title=[[Someplace, Somewhere]]
7485 !! input
7486 [[|Otherplace]]
7487 [[Otherplace, Elsewhere|]]
7488 [[Otherplace, Elsewhere, Anywhere|]]
7489 !! result
7490 [[Otherplace, Somewhere|Otherplace]]
7491 [[Otherplace, Elsewhere|Otherplace]]
7492 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7493 !! end
7494
7495 !! test
7496 pre-save transform: context links ("pipe trick") with parens and comma
7497 !! options
7498 pst title=[[Someplace (IGNORED), Somewhere]]
7499 !! input
7500 [[|Otherplace]]
7501 [[Otherplace (place), Elsewhere|]]
7502 !! result
7503 [[Otherplace, Somewhere|Otherplace]]
7504 [[Otherplace (place), Elsewhere|Otherplace]]
7505 !! end
7506
7507 !! test
7508 pre-save transform: context links ("pipe trick") with comma and parens
7509 !! options
7510 pst title=[[Who, me? (context)]]
7511 !! input
7512 [[|Yes, you.]]
7513 [[Me, Myself, and I (1937 song)|]]
7514 !! result
7515 [[Yes, you. (context)|Yes, you.]]
7516 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7517 !! end
7518
7519 !! test
7520 pre-save transform: context links ("pipe trick") with namespace
7521 !! options
7522 pst title=[[Ns:Somearticle]]
7523 !! input
7524 [[|Article]]
7525 !! result
7526 [[Ns:Article|Article]]
7527 !! end
7528
7529 !! test
7530 pre-save transform: context links ("pipe trick") with namespace and parens
7531 !! options
7532 pst title=[[Ns:Somearticle (context)]]
7533 !! input
7534 [[|Article]]
7535 !! result
7536 [[Ns:Article (context)|Article]]
7537 !! end
7538
7539 !! test
7540 pre-save transform: context links ("pipe trick") with namespace and comma
7541 !! options
7542 pst title=[[Ns:Somearticle, Context, Whatever]]
7543 !! input
7544 [[|Article]]
7545 !! result
7546 [[Ns:Article, Context, Whatever|Article]]
7547 !! end
7548
7549 !! test
7550 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7551 !! options
7552 pst title=[[Ns:Somearticle, Context (context)]]
7553 !! input
7554 [[|Article]]
7555 !! result
7556 [[Ns:Article (context)|Article]]
7557 !! end
7558
7559 !! test
7560 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7561 !! options
7562 pst title=[[Ns:Somearticle (IGNORED), Context]]
7563 !! input
7564 [[|Article]]
7565 !! result
7566 [[Ns:Article, Context|Article]]
7567 !! end
7568
7569 !! test
7570 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7571 !! options
7572 pst
7573 !! input
7574 [[Article(context)|]]
7575 [[Bar:Article(context)|]]
7576 [[:Bar:Article(context)|]]
7577 [[|Article(context)]]
7578 [[Bar:X(Y)Z|]]
7579 [[:Bar:X(Y)Z|]]
7580 !! result
7581 [[Article(context)|Article]]
7582 [[Bar:Article(context)|Article]]
7583 [[:Bar:Article(context)|Article]]
7584 [[Article(context)]]
7585 [[Bar:X(Y)Z|X(Y)Z]]
7586 [[:Bar:X(Y)Z|X(Y)Z]]
7587 !! end
7588
7589 !! test
7590 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7591 !! options
7592 pst
7593 !! input
7594 [[Article (context)|]]
7595 [[Bar:Article (context)|]]
7596 [[:Bar:Article (context)|]]
7597 [[|Article (context)]]
7598 [[Bar:X (Y) Z|]]
7599 [[:Bar:X (Y) Z|]]
7600 !! result
7601 [[Article (context)|Article]]
7602 [[Bar:Article (context)|Article]]
7603 [[:Bar:Article (context)|Article]]
7604 [[Article (context)]]
7605 [[Bar:X (Y) Z|X (Y) Z]]
7606 [[:Bar:X (Y) Z|X (Y) Z]]
7607 !! end
7608
7609 !! test
7610 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7611 !! options
7612 pst
7613 !! input
7614 [[Article(context)|]]
7615 [[Bar:Article(context)|]]
7616 [[:Bar:Article(context)|]]
7617 [[|Article(context)]]
7618 [[Bar:X(Y)Z|]]
7619 [[:Bar:X(Y)Z|]]
7620 !! result
7621 [[Article(context)|Article]]
7622 [[Bar:Article(context)|Article]]
7623 [[:Bar:Article(context)|Article]]
7624 [[Article(context)]]
7625 [[Bar:X(Y)Z|X(Y)Z]]
7626 [[:Bar:X(Y)Z|X(Y)Z]]
7627 !! end
7628
7629 !! test
7630 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7631 !! options
7632 pst
7633 !! input
7634 [[Article (context), context|]]
7635 [[Article (context),context|]]
7636 [[Bar:Article (context), context|]]
7637 [[Bar:Article (context),context|]]
7638 [[:Bar:Article (context), context|]]
7639 [[:Bar:Article (context),context|]]
7640 !! result
7641 [[Article (context), context|Article]]
7642 [[Article (context),context|Article]]
7643 [[Bar:Article (context), context|Article]]
7644 [[Bar:Article (context),context|Article]]
7645 [[:Bar:Article (context), context|Article]]
7646 [[:Bar:Article (context),context|Article]]
7647 !! end
7648
7649 !! test
7650 pre-save transform: trim trailing empty lines
7651 !! options
7652 pst
7653 !! input
7654 Empty lines are trimmed
7655
7656
7657
7658
7659 !! result
7660 Empty lines are trimmed
7661 !! end
7662
7663 !! test
7664 pre-save transform: Signature expansion
7665 !! options
7666 pst
7667 !! input
7668 * ~~~
7669 * <noinclude>~~~</noinclude>
7670 * <includeonly>~~~</includeonly>
7671 * <onlyinclude>~~~</onlyinclude>
7672 !! result
7673 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7674 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7675 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7676 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7677 !! end
7678
7679
7680 !! test
7681 pre-save transform: Signature expansion in nowiki tags (bug 93)
7682 !! options
7683 pst disabled
7684 !! input
7685 Shall not expand:
7686
7687 <nowiki>~~~~</nowiki>
7688
7689 <includeonly><nowiki>~~~~</nowiki></includeonly>
7690
7691 <noinclude><nowiki>~~~~</nowiki></noinclude>
7692
7693 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7694
7695 {{subst:Foo}} shall be converted to FOO
7696
7697 As well as inside noinclude/onlyinclude
7698 <noinclude>{{subst:Foo}}</noinclude>
7699 <onlyinclude>{{subst:Foo}}</onlyinclude>
7700
7701 But not inside includeonly
7702 <includeonly>{{subst:Foo}}</includeonly>
7703 !! result
7704 Shall not expand:
7705
7706 <nowiki>~~~~</nowiki>
7707
7708 <includeonly><nowiki>~~~~</nowiki></includeonly>
7709
7710 <noinclude><nowiki>~~~~</nowiki></noinclude>
7711
7712 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7713
7714 FOO shall be converted to FOO
7715
7716 As well as inside noinclude/onlyinclude
7717 <noinclude>FOO</noinclude>
7718 <onlyinclude>FOO</onlyinclude>
7719
7720 But not inside includeonly
7721 <includeonly>{{subst:Foo}}</includeonly>
7722 !! end
7723
7724 ###
7725 ### Message transform tests
7726 ###
7727 !! test
7728 message transform: magic variables
7729 !! options
7730 msg
7731 !! input
7732 {{SITENAME}}
7733 !! result
7734 MediaWiki
7735 !! end
7736
7737 !! test
7738 message transform: should not transform wiki markup
7739 !! options
7740 msg
7741 !! input
7742 ''test''
7743 !! result
7744 ''test''
7745 !! end
7746
7747 !! test
7748 message transform: <noinclude> in transcluded template (bug 4926)
7749 !! options
7750 msg
7751 !! input
7752 {{Includes}}
7753 !! result
7754 Foobar
7755 !! end
7756
7757 !! test
7758 message transform: <onlyinclude> in transcluded template (bug 4926)
7759 !! options
7760 msg
7761 !! input
7762 {{Includes2}}
7763 !! result
7764 Foo
7765 !! end
7766
7767 !! test
7768 {{#special:}} page name, known
7769 !! options
7770 msg
7771 !! input
7772 {{#special:Recentchanges}}
7773 !! result
7774 Special:RecentChanges
7775 !! end
7776
7777 !! test
7778 {{#special:}} page name with subpage, known
7779 !! options
7780 msg
7781 !! input
7782 {{#special:Recentchanges/param}}
7783 !! result
7784 Special:RecentChanges/param
7785 !! end
7786
7787 !! test
7788 {{#special:}} page name, unknown
7789 !! options
7790 msg
7791 !! input
7792 {{#special:foobar nonexistent}}
7793 !! result
7794 Special:Foobar nonexistent
7795 !! end
7796
7797 !! test
7798 {{#speciale:}} page name, known
7799 !! options
7800 msg
7801 !! input
7802 {{#speciale:Recentchanges}}
7803 !! result
7804 Special:RecentChanges
7805 !! end
7806
7807 !! test
7808 {{#speciale:}} page name with subpage, known
7809 !! options
7810 msg
7811 !! input
7812 {{#speciale:Recentchanges/param}}
7813 !! result
7814 Special:RecentChanges/param
7815 !! end
7816
7817 !! test
7818 {{#speciale:}} page name, unknown
7819 !! options
7820 msg
7821 !! input
7822 {{#speciale:foobar nonexistent}}
7823 !! result
7824 Special:Foobar_nonexistent
7825 !! end
7826
7827 ###
7828 ### Images
7829 ###
7830 !! test
7831 Simple image
7832 !! input
7833 [[Image:foobar.jpg]]
7834 !! result
7835 <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>
7836 </p>
7837 !! end
7838
7839 !! test
7840 Right-aligned image
7841 !! input
7842 [[Image:foobar.jpg|right]]
7843 !! result
7844 <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>
7845
7846 !! end
7847
7848 !! test
7849 Simple image (using File: namespace, now canonical)
7850 !! input
7851 [[File:foobar.jpg]]
7852 !! result
7853 <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>
7854 </p>
7855 !! end
7856
7857 !! test
7858 Image with caption
7859 !! input
7860 [[Image:foobar.jpg|right|Caption text]]
7861 !! result
7862 <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>
7863
7864 !! end
7865
7866 !! test
7867 Image with empty attribute
7868 !! input
7869 [[Image:foobar.jpg|right||Caption text]]
7870 !! result
7871 <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>
7872
7873 !! end
7874
7875 !! test
7876 Image with link tails
7877 !! input
7878 123[[Image:foobar.jpg]]456
7879 123[[Image:foobar.jpg|right]]456
7880 123[[Image:foobar.jpg|thumb]]456
7881 !! result
7882 <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
7883 </p>
7884 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
7885 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
7886
7887 !! end
7888
7889 !! test
7890 Image with multiple captions -- only last one is accepted
7891 !! input
7892 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7893 !! result
7894 <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>
7895
7896 !! end
7897
7898 !! test
7899 Image with width attribute at different positions
7900 !! input
7901 [[Image:foobar.jpg|200px|right|Caption]]
7902 [[Image:foobar.jpg|right|200px|Caption]]
7903 [[Image:foobar.jpg|right|Caption|200px]]
7904 !! result
7905 <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>
7906 <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>
7907 <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>
7908
7909 !! end
7910
7911 !! test
7912 Image with link parameter, wiki target
7913 !! input
7914 [[Image:foobar.jpg|link=Target page]]
7915 !! result
7916 <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>
7917 </p>
7918 !! end
7919
7920 !! test
7921 Image with link parameter, URL target
7922 !! input
7923 [[Image:foobar.jpg|link=http://example.com/]]
7924 !! result
7925 <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>
7926 </p>
7927 !! end
7928
7929 !! test
7930 Image with link parameter, wgExternalLinkTarget
7931 !! input
7932 [[Image:foobar.jpg|link=http://example.com/]]
7933 !! config
7934 wgExternalLinkTarget='foobar'
7935 !! result
7936 <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>
7937 </p>
7938 !! end
7939
7940 !! test
7941 Image with link parameter, wgNoFollowLinks set to false
7942 !! input
7943 [[Image:foobar.jpg|link=http://example.com/]]
7944 !! config
7945 wgNoFollowLinks=false
7946 !! result
7947 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7948 </p>
7949 !! end
7950
7951 !! test
7952 Image with link parameter, wgNoFollowDomainExceptions
7953 !! input
7954 [[Image:foobar.jpg|link=http://example.com/]]
7955 !! config
7956 wgNoFollowDomainExceptions='example.com'
7957 !! result
7958 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7959 </p>
7960 !! end
7961
7962 !! test
7963 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7964 !! input
7965 [[Image:foobar.jpg|link=http://example.com/|Title]]
7966 !! config
7967 wgExternalLinkTarget='foobar'
7968 !! result
7969 <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>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Image with empty link parameter
7975 !! input
7976 [[Image:foobar.jpg|link=]]
7977 !! result
7978 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7979 </p>
7980 !! end
7981
7982 !! test
7983 Image with link parameter (wiki target) and unnamed parameter
7984 !! input
7985 [[Image:foobar.jpg|link=Target page|Title]]
7986 !! result
7987 <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>
7988 </p>
7989 !! end
7990
7991 !! test
7992 Image with link parameter (URL target) and unnamed parameter
7993 !! input
7994 [[Image:foobar.jpg|link=http://example.com/|Title]]
7995 !! result
7996 <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>
7997 </p>
7998 !! end
7999
8000 !! test
8001 Thumbnail image with link parameter
8002 !! options
8003 php
8004 !! input
8005 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8006 !! result
8007 <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>
8008
8009 !! end
8010
8011 !! test
8012 Manually-specified thumbnail image
8013 !! options
8014 php
8015 !! input
8016 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8017 !! result
8018 <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>
8019
8020 !! end
8021
8022 !! test
8023 Manually-specified thumbnail image with explicit link to wiki page
8024 !! options
8025 php
8026 !! input
8027 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8028 !! result
8029 <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>
8030
8031 !! end
8032
8033 !! test
8034 Manually-specified thumbnail image with explicit link to url
8035 !! options
8036 php
8037 !! input
8038 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8039 !! result
8040 <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>
8041
8042 !! end
8043
8044 !! test
8045 Manually-specified thumbnail image with explicit no link
8046 !! options
8047 php
8048 !! input
8049 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8050 !! result
8051 <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>
8052
8053 !! end
8054
8055 !! test
8056 Manually-specified thumbnail image with explicit link and alt text
8057 !! options
8058 php
8059 !! input
8060 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8061 !! result
8062 <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>
8063
8064 !! end
8065
8066 !! test
8067 Image with frame and link
8068 !! input
8069 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8070 !! result
8071 <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>
8072
8073 !! end
8074
8075 !! test
8076 Image with frame and link and explicit alt
8077 !! input
8078 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8079 !! result
8080 <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>
8081
8082 !! end
8083
8084 !! test
8085 Image with wiki markup in implicit alt
8086 !! input
8087 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8088 !! result
8089 <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>
8090 </p>
8091 !! end
8092
8093 !! test
8094 Image with wiki markup in explicit alt
8095 !! input
8096 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8097 !! result
8098 <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>
8099 </p>
8100 !! end
8101
8102 !! test
8103 Link to image page- image page normally doesn't exists, hence edit link
8104 Add test with existing image page
8105 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8106 !! input
8107 [[:Image:test]]
8108 !! result
8109 <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>
8110 </p>
8111 !! end
8112
8113 !! test
8114 bug 18784 Link to non-existent image page with caption should use caption as link text
8115 !! input
8116 [[:Image:test|caption]]
8117 !! result
8118 <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>
8119 </p>
8120 !! end
8121
8122 !! test
8123 Frameless image caption with a free URL
8124 !! input
8125 [[Image:foobar.jpg|http://example.com]]
8126 !! result
8127 <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>
8128 </p>
8129 !! end
8130
8131 !! test
8132 Thumbnail image caption with a free URL
8133 !! input
8134 [[Image:foobar.jpg|thumb|http://example.com]]
8135 !! result
8136 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
8137
8138 !! end
8139
8140 !! test
8141 Thumbnail image caption with a free URL and explicit alt
8142 !! input
8143 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8144 !! result
8145 <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>
8146
8147 !! end
8148
8149 !! test
8150 SVG thumbnails with no language set
8151 !! options
8152 !! input
8153 [[File:Foobar.svg|thumb|width=200]]
8154 !! result
8155 <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>
8156
8157 !! end
8158
8159 !! test
8160 SVG thumbnails with language de
8161 !! options
8162 !! input
8163 [[File:Foobar.svg|thumb|width=200|lang=de]]
8164 !! result
8165 <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>
8166
8167 !! end
8168
8169 !! test
8170 SVG thumbnails with invalid language code
8171 !! options
8172 !! input
8173 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8174 !! result
8175 <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>
8176
8177 !! end
8178
8179 !! test
8180 BUG 1887: A ISBN with a thumbnail
8181 !! input
8182 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8183 !! result
8184 <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>
8185
8186 !! end
8187
8188 !! test
8189 BUG 1887: A RFC with a thumbnail
8190 !! input
8191 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8192 !! result
8193 <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>
8194
8195 !! end
8196
8197 !! test
8198 BUG 1887: A mailto link with a thumbnail
8199 !! input
8200 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8201 !! result
8202 <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>
8203
8204 !! end
8205
8206 # Pending resolution to bug 368
8207 !! test
8208 BUG 648: Frameless image caption with a link
8209 !! input
8210 [[Image:foobar.jpg|text with a [[link]] in it]]
8211 !! result
8212 <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>
8213 </p>
8214 !! end
8215
8216 !! test
8217 BUG 648: Frameless image caption with a link (suffix)
8218 !! input
8219 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8220 !! result
8221 <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>
8222 </p>
8223 !! end
8224
8225 !! test
8226 BUG 648: Frameless image caption with an interwiki link
8227 !! input
8228 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8229 !! result
8230 <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>
8231 </p>
8232 !! end
8233
8234 !! test
8235 BUG 648: Frameless image caption with a piped interwiki link
8236 !! input
8237 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8238 !! result
8239 <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>
8240 </p>
8241 !! end
8242
8243 !! test
8244 Escape HTML special chars in image alt text
8245 !! input
8246 [[Image:foobar.jpg|& < > "]]
8247 !! result
8248 <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>
8249 </p>
8250 !! end
8251
8252 !! test
8253 BUG 499: Alt text should have &#1234;, not &amp;1234;
8254 !! input
8255 [[Image:foobar.jpg|&#9792;]]
8256 !! result
8257 <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>
8258 </p>
8259 !! end
8260
8261 !! test
8262 Broken image caption with link
8263 !! input
8264 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8265 !! result
8266 <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.
8267 </p>
8268 !! end
8269
8270 !! test
8271 Image caption containing another image
8272 !! input
8273 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8274 !! result
8275 <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>
8276
8277 !! end
8278
8279 !! test
8280 Image caption containing a newline
8281 !! input
8282 [[Image:Foobar.jpg|This
8283 *is some text]]
8284 !! result
8285 <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>
8286 </p>
8287 !!end
8288
8289 !!test
8290 Parsoid: Image caption containing leading space
8291 (The leading space should not trigger nowiki escaping in wt2wt mode)
8292 !! input
8293 [[Image:Foobar.jpg|thumb| bar]]
8294 !! result
8295 <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>
8296
8297 !!end
8298
8299 !! test
8300 Bug 3090: External links other than http: in image captions
8301 !! input
8302 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8303 !! result
8304 <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>
8305
8306 !! end
8307
8308 !! test
8309 Custom class
8310 !! input
8311 [[Image:foobar.jpg|a|class=b]]
8312 !! result
8313 <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>
8314 </p>
8315 !! end
8316
8317 !! test
8318 Localized image handling (1).
8319 !! options
8320 language=es
8321 !! input
8322 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8323 !! result
8324 <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>
8325
8326 !! end
8327
8328 !! test
8329 Localized image handling (2).
8330 !! options
8331 language=es
8332 !! input
8333 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8334 !! result
8335 <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>
8336
8337 !! end
8338
8339 !! test
8340 "border", "frameless" and "class" attributes on an image.
8341 !! input
8342 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8343 !! result
8344 <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>
8345 </p>
8346 !! end
8347
8348 !! article
8349 File:Barfoo.jpg
8350 !! text
8351 #REDIRECT [[File:Barfoo.jpg]]
8352 !! endarticle
8353
8354 !! test
8355 Redirected image
8356 !! input
8357 [[Image:Barfoo.jpg]]
8358 !! result
8359 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8360 </p>
8361 !! end
8362
8363 !! test
8364 Missing image with uploads disabled
8365 !! options
8366 wgEnableUploads=0
8367 !! input
8368 [[Image:Foobaz.jpg]]
8369 !! result
8370 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8371 </p>
8372 !! end
8373
8374 # Parsoid-specific testing for images
8375 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8376 # Currently imperfect due to a flaw in the Parsoid testrunner
8377 # Work in progress
8378
8379 !! test
8380 Parsoid-specific image handling - simple image
8381 !! options
8382 parsoid
8383 !! input
8384 [[Image:Foobar.jpg]]
8385 !! result
8386 <p>
8387 <span class="mw-default-size" typeof="mw:Image">
8388 <a href="File:Foobar.jpg">
8389 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8390 </a>
8391 </span>
8392 </p>
8393 !! end
8394
8395 !! test
8396 Parsoid-specific image handling - simple image without link
8397 !! options
8398 parsoid
8399 !! input
8400 [[Image:Foobar.jpg|link=]]
8401 !! result
8402 <p>
8403 <span class="mw-default-size" typeof="mw:Image">
8404 <span>
8405 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8406 </span>
8407 </span>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Parsoid-specific image handling - simple image with specific link
8413 !! options
8414 parsoid
8415 !! input
8416 [[Image:Foobar.jpg|link=Main Page]]
8417 !! result
8418 <p>
8419 <span class="mw-default-size" typeof="mw:Image">
8420 <a href="Main_Page">
8421 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8422 </a>
8423 </span>
8424 </p>
8425 !! end
8426
8427 !! test
8428 Parsoid-specific image handling - simple image with size and middle alignment
8429 !! options
8430 parsoid
8431 !! input
8432 [[Image:Foobar.jpg|50px|middle]]
8433 !! result
8434 <p>
8435 <span class="mw-valign-middle" typeof="mw:Image">
8436 <a href="File:Foobar.jpg">
8437 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8438 </a>
8439 </span>
8440 </p>
8441 !! end
8442
8443 !! test
8444 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8445 !! options
8446 parsoid
8447 !! input
8448 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8449 !! result
8450 <p>
8451 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8452 <a href="File:Foobar.jpg">
8453 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8454 </a>
8455 </span>
8456 </p>
8457 !! end
8458
8459 !! test
8460 Parsoid-specific image handling - simple image with border and size spec
8461 !! options
8462 parsoid
8463 !! input
8464 [[Image:Foobar.jpg|50px|border|caption]]
8465 !! result
8466 <p>
8467 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8468 <a href="File:Foobar.jpg">
8469 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8470 </a>
8471 </span>
8472 </p>
8473 !! end
8474
8475 !! test
8476 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8477 !! options
8478 parsoid
8479 !! input
8480 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8481 !! result
8482 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8483 <a href="File:Foobar.jpg">
8484 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8485 </a>
8486 <figcaption>caption content</figcaption>
8487 </figure>
8488 !! end
8489
8490 !! test
8491 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8492 !! options
8493 parsoid
8494 !! input
8495 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8496 !! result
8497 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8498 <a href="File:Foobar.jpg">
8499 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8500 </a>
8501 <figcaption>caption</figcaption>
8502 </figure>
8503 !! end
8504
8505 !! test
8506 Parsoid-specific image handling - framed image with specific size and caption
8507 !! options
8508 parsoid
8509 !! input
8510 [[Image:Foobar.jpg|500x50px|frame|caption]]
8511 !! result
8512 <figure typeof="mw:Image/Frame">
8513 <a href="File:Foobar.jpg">
8514 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8515 </a>
8516 <figcaption>caption</figcaption>
8517 </figure>
8518 !! end
8519
8520 !! test
8521 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8522 !! options
8523 parsoid
8524 !! input
8525 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8526 !! result
8527 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8528 <a href="File:Foobar.jpg">
8529 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8530 </a>
8531 <figcaption>caption</figcaption>
8532 </figure>
8533 !! end
8534
8535 !! test
8536 Parsoid-specific image handling - frameless image with specific size, border, and caption
8537 !! options
8538 parsoid
8539 !! input
8540 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8541 !! result
8542 <p>
8543 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8544 <a href="File:Foobar.jpg">
8545 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8546 </a>
8547 </p>
8548 !! end
8549
8550 #!! test
8551 #Parsoid-specific image handling - simple image with a formatted caption
8552 #!! options
8553 #parsoid
8554 #!! input
8555 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8556 #!! result
8557 #<p>
8558 #<span typeof="mw:Image">
8559 #<a class="mw-default-size" href="Image:Foobar.jpg">
8560 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8561 #</a>
8562 #<span>abc</span>
8563 #</span>
8564 #</p>
8565
8566
8567 ###
8568 ### Subpages
8569 ###
8570 !! article
8571 Subpage test/subpage
8572 !! text
8573 foo
8574 !! endarticle
8575
8576 !! test
8577 Subpage link
8578 !! options
8579 subpage title=[[Subpage test]]
8580 !! input
8581 [[/subpage]]
8582 !! result
8583 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8584 </p>
8585 !! end
8586
8587 !! test
8588 Subpage noslash link
8589 !! options
8590 subpage title=[[Subpage test]]
8591 !!input
8592 [[/subpage/]]
8593 !! result
8594 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8595 </p>
8596 !! end
8597
8598 # TODO: make this PHP-parser compatible!
8599 !! test
8600 Relative subpage noslash link
8601 !! options
8602 parsoid=wt2wt,wt2html,html2html
8603 subpage title=[[Subpage test/1/2/3/4]]
8604 !!input
8605 [[../../subpage/]]
8606
8607 [[../../subpage]]
8608 !! result
8609 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8610 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8611 !! end
8612
8613 # TODO: make this PHP-parser compatible!
8614 !! test
8615 Parsoid: dot-slash prefixed wikilinks
8616 !! options
8617 parsoid=wt2wt,wt2html,html2html
8618 !!input
8619 [[./foo]]
8620
8621 [[././bar]]
8622
8623 [[././baz/]]
8624 !! result
8625 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8626 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8627 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8628 !! end
8629
8630 !! test
8631 Disabled subpages
8632 !! input
8633 [[/subpage]]
8634 !! result
8635 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8636 </p>
8637 !! end
8638
8639 !! test
8640 BUG 561: {{/Subpage}}
8641 !! options
8642 subpage title=[[Page]]
8643 !! input
8644 {{/Subpage}}
8645 !! result
8646 <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>
8647 </p>
8648 !! end
8649
8650 ###
8651 ### Categories
8652 ###
8653 !! article
8654 Category:MediaWiki User's Guide
8655 !! text
8656 blah
8657 !! endarticle
8658
8659 !! test
8660 Link to category
8661 !! input
8662 [[:Category:MediaWiki User's Guide]]
8663 !! result
8664 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8665 </p>
8666 !! end
8667
8668 !! test
8669 Simple category
8670 !! options
8671 cat
8672 !! input
8673 [[Category:MediaWiki User's Guide]]
8674 !! result
8675 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8676 !! end
8677
8678 !! test
8679 PAGESINCATEGORY invalid title fatal (r33546 fix)
8680 !! input
8681 {{PAGESINCATEGORY:<bogus>}}
8682 !! result
8683 <p>0
8684 </p>
8685 !! end
8686
8687 !! test
8688 Category with different sort key
8689 !! options
8690 cat
8691 !! input
8692 [[Category:MediaWiki User's Guide|Foo]]
8693 !! result
8694 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8695 !! end
8696
8697 !! test
8698 Category with identical sort key
8699 !! options
8700 cat
8701 !! input
8702 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8703 !! result
8704 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8705 !! end
8706
8707 !! test
8708 Category with empty sort key
8709 !! options
8710 cat
8711 pst
8712 !! input
8713 [[Category:MediaWiki User's Guide|]]
8714 !! result
8715 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8716 !! end
8717
8718 !! test
8719 Category with empty sort key and parentheses
8720 !! options
8721 cat
8722 pst
8723 !! input
8724 [[Category:Foo (bar)|]]
8725 !! result
8726 [[Category:Foo (bar)|Foo]]
8727 !! end
8728
8729 !! test
8730 Category with link tail
8731 !! options
8732 cat
8733 pst
8734 !! input
8735 123[[Category:Foo]]456
8736 !! result
8737 123[[Category:Foo]]456
8738 !! end
8739
8740 !! test
8741 Category with template
8742 !! options
8743 cat
8744 pst
8745 !! input
8746 [[Category:{{echo|Foo}}]]
8747 !! result
8748 [[Category:{{echo|Foo}}]]
8749 !! end
8750
8751 !! test
8752 Category with template in sort key
8753 !! options
8754 cat
8755 pst
8756 !! input
8757 [[Category:Foo|{{echo|Bar}}]]
8758 !! result
8759 [[Category:Foo|{{echo|Bar}}]]
8760 !! end
8761
8762 !! test
8763 Category with template in sort key and title
8764 !! options
8765 cat
8766 pst
8767 !! input
8768 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8769 !! result
8770 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8771 !! end
8772
8773 !! test
8774 Category / paragraph interactions
8775 !! input
8776 Foo [[Category:Baz]] Bar
8777
8778 Foo [[Category:Baz]]
8779 Bar
8780
8781 Foo
8782 [[Category:Baz]]
8783 Bar
8784
8785 Foo
8786 [[Category:Baz]] Bar
8787
8788 Foo
8789 [[Category:Baz]]
8790 [[Category:Baz]]
8791 [[Category:Baz]]
8792 Bar
8793
8794 [[Category:Baz]]
8795 [[Category:Baz]]
8796 [[Category:Baz]]
8797
8798 [[Category:Baz]]
8799 {{echo|[[Category:Baz]]}}
8800 [[Category:Baz]]
8801 !! result
8802 <p>Foo Bar
8803 </p><p>Foo
8804 Bar
8805 </p><p>Foo
8806 Bar
8807 </p><p>Foo Bar
8808 </p><p>Foo
8809 Bar
8810 </p>
8811 !! end
8812
8813 !! test
8814 Parsoid: Serialize link to category page with colon escape
8815 !! options
8816 parsoid
8817 !! input
8818
8819 [[:Category:Foo]]
8820 [[:Category:Foo|Bar]]
8821 !! result
8822 <p>
8823 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8824 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8825 </p>
8826 !! end
8827
8828 !! test
8829 Parsoid: Serialize link to file page with colon escape
8830 !! options
8831 parsoid
8832 !! input
8833
8834 [[:File:Foo.png]]
8835 [[:File:Foo.png|Bar]]
8836 !! result
8837 <p>
8838 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8839 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8840 </p>
8841 !! end
8842
8843 !! test
8844 Parsoid: Serialize a genuine category link without colon escape
8845 !! options
8846 parsoid
8847 !! input
8848 [[Category:Foo]]
8849 [[Category:Foo|Bar]]
8850 !! result
8851 <link rel="mw:WikiLink/Category" href="Category:Foo">
8852 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8853 !! end
8854
8855 ###
8856 ### Inter-language links
8857 ###
8858 !! test
8859 Inter-language links
8860 !! options
8861 ill
8862 !! input
8863 [[es:Alimento]]
8864 [[fr:Nourriture]]
8865 [[zh:&#39135;&#21697;]]
8866 !! result
8867 es:Alimento fr:Nourriture zh:食品
8868 !! end
8869
8870 !! test
8871 Duplicate interlanguage links (bug 24502)
8872 !! options
8873 ill
8874 !! input
8875 [[es:1]]
8876 [[es:2]]
8877 [[fr:1]]
8878 [[fr:2]]
8879 !! result
8880 es:1 fr:1
8881 !! end
8882
8883 ###
8884 ### Sections
8885 ###
8886 !! test
8887 Basic section headings
8888 !! input
8889 == Headline 1 ==
8890 Some text
8891
8892 ==Headline 2==
8893 More
8894 ===Smaller headline===
8895 Blah blah
8896 !! result
8897 <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>
8898 <p>Some text
8899 </p>
8900 <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>
8901 <p>More
8902 </p>
8903 <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>
8904 <p>Blah blah
8905 </p>
8906 !! end
8907
8908 !! test
8909 Section headings with TOC
8910 !! input
8911 == Headline 1 ==
8912 === Subheadline 1 ===
8913 ===== Skipping a level =====
8914 ====== Skipping a level ======
8915
8916 == Headline 2 ==
8917 Some text
8918 ===Another headline===
8919 !! result
8920 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8921 <ul>
8922 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8923 <ul>
8924 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8925 <ul>
8926 <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>
8927 <ul>
8928 <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>
8929 </ul>
8930 </li>
8931 </ul>
8932 </li>
8933 </ul>
8934 </li>
8935 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8936 <ul>
8937 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8938 </ul>
8939 </li>
8940 </ul>
8941 </div>
8942 <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>
8943 <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>
8944 <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>
8945 <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>
8946 <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>
8947 <p>Some text
8948 </p>
8949 <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>
8950
8951 !! end
8952
8953 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8954 !! test
8955 Handling of sections up to level 6 and beyond
8956 !! input
8957 = Level 1 Heading=
8958 == Level 2 Heading==
8959 === Level 3 Heading===
8960 ==== Level 4 Heading====
8961 ===== Level 5 Heading=====
8962 ====== Level 6 Heading======
8963 ======= Level 7 Heading=======
8964 ======== Level 8 Heading========
8965 ========= Level 9 Heading=========
8966 ========== Level 10 Heading==========
8967 !! result
8968 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8969 <ul>
8970 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8971 <ul>
8972 <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>
8973 <ul>
8974 <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>
8975 <ul>
8976 <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>
8977 <ul>
8978 <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>
8979 <ul>
8980 <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>
8981 <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>
8982 <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>
8983 <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>
8984 <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>
8985 </ul>
8986 </li>
8987 </ul>
8988 </li>
8989 </ul>
8990 </li>
8991 </ul>
8992 </li>
8993 </ul>
8994 </li>
8995 </ul>
8996 </div>
8997 <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>
8998 <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>
8999 <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>
9000 <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>
9001 <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>
9002 <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>
9003 <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>
9004 <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>
9005 <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>
9006 <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>
9007
9008 !! end
9009
9010 !! test
9011 TOC regression (bug 9764)
9012 !! input
9013 == title 1 ==
9014 === title 1.1 ===
9015 ==== title 1.1.1 ====
9016 === title 1.2 ===
9017 == title 2 ==
9018 === title 2.1 ===
9019 !! result
9020 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9021 <ul>
9022 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9023 <ul>
9024 <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>
9025 <ul>
9026 <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>
9027 </ul>
9028 </li>
9029 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
9030 </ul>
9031 </li>
9032 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9033 <ul>
9034 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
9035 </ul>
9036 </li>
9037 </ul>
9038 </div>
9039 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9040 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9041 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9042 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9043 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9044 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9045
9046 !! end
9047
9048 !! test
9049 TOC with wgMaxTocLevel=3 (bug 6204)
9050 !! options
9051 wgMaxTocLevel=3
9052 !! input
9053 == title 1 ==
9054 === title 1.1 ===
9055 ==== title 1.1.1 ====
9056 === title 1.2 ===
9057 == title 2 ==
9058 === title 2.1 ===
9059 !! result
9060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9061 <ul>
9062 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9063 <ul>
9064 <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>
9065 <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>
9066 </ul>
9067 </li>
9068 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9069 <ul>
9070 <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>
9071 </ul>
9072 </li>
9073 </ul>
9074 </div>
9075 <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>
9076 <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>
9077 <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>
9078 <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>
9079 <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>
9080 <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>
9081
9082 !! end
9083
9084 !! test
9085 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9086 !! options
9087 wgMaxTocLevel=3
9088 !! input
9089 ==Section 1==
9090 ===Section 1.1===
9091 ====Section 1.1.1====
9092 ====Section 1.1.1.1====
9093 ==Section 2==
9094 !! result
9095 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9096 <ul>
9097 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9098 <ul>
9099 <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>
9100 </ul>
9101 </li>
9102 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9103 </ul>
9104 </div>
9105 <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>
9106 <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>
9107 <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>
9108 <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>
9109 <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>
9110
9111 !! end
9112
9113
9114 !! test
9115 Resolving duplicate section names
9116 !! input
9117 == Foo bar ==
9118 == Foo bar ==
9119 !! result
9120 <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>
9121 <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>
9122
9123 !! end
9124
9125 !! test
9126 Resolving duplicate section names with differing case (bug 10721)
9127 !! input
9128 == Foo bar ==
9129 == Foo Bar ==
9130 !! result
9131 <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>
9132 <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>
9133
9134 !! end
9135
9136 !! article
9137 Template:sections
9138 !! text
9139 ===Section 1===
9140 ==Section 2==
9141 !! endarticle
9142
9143 !! test
9144 Template with sections, __NOTOC__
9145 !! input
9146 __NOTOC__
9147 ==Section 0==
9148 {{sections}}
9149 ==Section 4==
9150 !! result
9151 <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>
9152 <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>
9153 <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>
9154 <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>
9155
9156 !! end
9157
9158 !! test
9159 __NOEDITSECTION__ keyword
9160 !! input
9161 __NOEDITSECTION__
9162 ==Section 1==
9163 ==Section 2==
9164 !! result
9165 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9166 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9167
9168 !! end
9169
9170 !! test
9171 Link inside a section heading
9172 !! input
9173 ==Section with a [[Main Page|link]] in it==
9174 !! result
9175 <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>
9176
9177 !! end
9178
9179 !! test
9180 TOC regression (bug 12077)
9181 !! input
9182 __TOC__
9183 == title 1 ==
9184 === title 1.1 ===
9185 == title 2 ==
9186 !! result
9187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9188 <ul>
9189 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9190 <ul>
9191 <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>
9192 </ul>
9193 </li>
9194 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9195 </ul>
9196 </div>
9197 <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>
9198 <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>
9199 <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>
9200
9201 !! end
9202
9203 !! test
9204 BUG 1219 URL next to image (good)
9205 !! input
9206 http://example.com [[Image:foobar.jpg]]
9207 !! result
9208 <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>
9209 </p>
9210 !!end
9211
9212 !! test
9213 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9214 !! input
9215 ===
9216 The line above must have a trailing space!
9217 === <!--
9218 --> <!-- -->
9219 But just in case it doesn't...
9220 !! result
9221 <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>
9222 <p>The line above must have a trailing space!
9223 </p>
9224 <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>
9225 <p>But just in case it doesn't...
9226 </p>
9227 !! end
9228
9229 !! test
9230 Header with special characters (bug 25462)
9231 !! input
9232 The tooltips shall not show entities to the user (ie. be double escaped)
9233
9234 == text > text ==
9235 section 1
9236
9237 == text < text ==
9238 section 2
9239
9240 == text & text ==
9241 section 3
9242
9243 == text ' text ==
9244 section 4
9245
9246 == text " text ==
9247 section 5
9248 !! result
9249 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9250 </p>
9251 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9252 <ul>
9253 <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>
9254 <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>
9255 <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>
9256 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9257 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9258 </ul>
9259 </div>
9260 <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>
9261 <p>section 1
9262 </p>
9263 <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>
9264 <p>section 2
9265 </p>
9266 <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>
9267 <p>section 3
9268 </p>
9269 <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>
9270 <p>section 4
9271 </p>
9272 <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>
9273 <p>section 5
9274 </p>
9275 !! end
9276
9277 !! test
9278 Headers with excess '=' characters
9279 (Are similar tests necessary beyond the 1st level?)
9280 !! input
9281 =foo==
9282 ==foo=
9283 =''italic'' heading==
9284 ==''italic'' heading=
9285 !! result
9286 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9287 <ul>
9288 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9289 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9290 <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>
9291 <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>
9292 </ul>
9293 </div>
9294 <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>
9295 <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>
9296 <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>
9297 <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>
9298
9299 !! end
9300
9301 !! test
9302 HTML headers vs TOC (bug 23393)
9303 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9304 !! input
9305 <h1>Header 1</h1>
9306 == Header 1.1 ==
9307 == Header 1.2 ==
9308
9309 <h1>Header 2
9310 </h1>
9311 == Header 2.1 ==
9312 == Header 2.2 ==
9313 __NOEDITSECTION__
9314 !! result
9315 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9316 <ul>
9317 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9318 <ul>
9319 <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>
9320 <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>
9321 </ul>
9322 </li>
9323 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9324 <ul>
9325 <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>
9326 <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>
9327 </ul>
9328 </li>
9329 </ul>
9330 </div>
9331 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9332 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9333 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9334 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9335 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9336 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9337
9338 !! end
9339
9340 !! test
9341 BUG 1219 URL next to image (broken)
9342 !! input
9343 http://example.com[[Image:foobar.jpg]]
9344 !! result
9345 <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>
9346 </p>
9347 !!end
9348
9349 !! test
9350 Bug 1186 news: in the middle of text
9351 !! input
9352 http://en.wikinews.org/wiki/Wikinews:Workplace
9353 !! result
9354 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9355 </p>
9356 !!end
9357
9358
9359 !! test
9360 Namespaced link must have a title
9361 !! input
9362 [[Project:]]
9363 !! result
9364 <p>[[Project:]]
9365 </p>
9366 !!end
9367
9368 !! test
9369 Namespaced link must have a title (bad fragment version)
9370 !! input
9371 [[Project:#fragment]]
9372 !! result
9373 <p>[[Project:#fragment]]
9374 </p>
9375 !!end
9376
9377
9378 ###
9379 ### HTML tags and HTML attributes
9380 ###
9381
9382 !! test
9383 div with no attributes
9384 !! input
9385 <div>HTML rocks</div>
9386 !! result
9387 <div>HTML rocks</div>
9388
9389 !! end
9390
9391 !! test
9392 div with double-quoted attribute
9393 !! input
9394 <div id="rock">HTML rocks</div>
9395 !! result
9396 <div id="rock">HTML rocks</div>
9397
9398 !! end
9399
9400 !! test
9401 div with single-quoted attribute
9402 !! input
9403 <div id='rock'>HTML rocks</div>
9404 !! result
9405 <div id="rock">HTML rocks</div>
9406
9407 !! end
9408
9409 !! test
9410 div with unquoted attribute
9411 !! input
9412 <div id=rock>HTML rocks</div>
9413 !! result
9414 <div id="rock">HTML rocks</div>
9415
9416 !! end
9417
9418 !! test
9419 div with illegal double attributes
9420 !! input
9421 <div id="a" id="b">HTML rocks</div>
9422 !! result
9423 <div id="b">HTML rocks</div>
9424
9425 !!end
9426
9427 # FIXME: produce empty string instead of "class" in the PHP parser, following
9428 # the HTML5 spec.
9429 !! test
9430 div with empty attribute value, space before equals
9431 !! options
9432 parsoid
9433 !! input
9434 <div class =>HTML rocks</div>
9435 !! result
9436 <div class="">HTML rocks</div>
9437
9438 !! end
9439
9440 # The PHP parser escapes the opening brace to &#123; for some reason, so
9441 # disabled this test for it.
9442 !! test
9443 div with braces in attribute value
9444 !! options
9445 parsoid
9446 !! input
9447 <div title="{}">Foo</div>
9448 !! result
9449 <div title="{}">Foo</div>
9450 !! end
9451
9452 # This it very inconsistent in the PHP parser: it returns
9453 # class="class" if there is a space between the name and the equal sign (see
9454 # 'div with empty attribute value, space before equals'), but strips the
9455 # attribute completely if the space is missing. We hope that not much content
9456 # depends on this, so are implementing the behavior below in Parsoid for
9457 # consistencies' sake. Disabled for the PHP parser.
9458 # FIXME: fix this behavior in the PHP parser?
9459 !! test
9460 div with empty attribute value, no space before equals
9461 !! options
9462 parsoid
9463 !! input
9464 <div class=>HTML rocks</div>
9465 !! result
9466 <div class="">HTML rocks</div>
9467
9468 !! end
9469
9470 !! test
9471 HTML multiple attributes correction
9472 !! input
9473 <p class="error" class="awesome">Awesome!</p>
9474 !! result
9475 <p class="awesome">Awesome!</p>
9476
9477 !!end
9478
9479 !! test
9480 Table multiple attributes correction
9481 !! input
9482 {|
9483 !+ class="error" class="awesome"| status
9484 |}
9485 !! result
9486 <table>
9487 <tr>
9488 <th class="awesome"> status
9489 </th></tr></table>
9490
9491 !!end
9492
9493 !! test
9494 DIV IN UPPERCASE
9495 !! input
9496 <DIV ID="x">HTML ROCKS</DIV>
9497 !! result
9498 <div id="x">HTML ROCKS</div>
9499
9500 !!end
9501
9502 !! test
9503 Non-ASCII pseudo-tags are rendered as text
9504 !! input
9505 <khyô>
9506 !! result
9507 <p>&lt;khyô&gt;
9508 </p>
9509 !! end
9510
9511 !! test
9512 Pseudo-tag with URL 'name' renders as url link
9513 !! input
9514 <http://example.com/>
9515 !! result
9516 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9517 </p>
9518 !! end
9519
9520 !! test
9521 text with amp in the middle of nowhere
9522 !! input
9523 Remember AT&T?
9524 !!result
9525 <p>Remember AT&amp;T?
9526 </p>
9527 !! end
9528
9529 !! test
9530 text with character entity: eacute
9531 !! input
9532 I always thought &eacute; was a cute letter.
9533 !! result
9534 <p>I always thought &#233; was a cute letter.
9535 </p>
9536 !! end
9537
9538 !! test
9539 text with entity-escaped character entity-like string: eacute
9540 !! input
9541 I always thought &amp;eacute; was a cute letter.
9542 !! result
9543 <p>I always thought &amp;eacute; was a cute letter.
9544 </p>
9545 !! end
9546
9547 !! test
9548 text with undefined character entity: xacute
9549 !! input
9550 I always thought &xacute; was a cute letter.
9551 !! result
9552 <p>I always thought &amp;xacute; was a cute letter.
9553 </p>
9554 !! end
9555
9556
9557 ###
9558 ### Nesting tests (see bug 41545, 50604, 51081)
9559 ###
9560
9561 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9562 # Note that html2wt is considerably more difficult if we use <b> in
9563 # the test case, instead of <big>
9564 !! test
9565 Ensure that HTML adoption agency algorithm is properly implemented.
9566 !! input
9567 <big>X<big>Y</big>Z</big>
9568 !! result
9569 <p><big>X<big>Y</big>Z</big>
9570 </p>
9571 !! end
9572
9573 # This was bug 41545 in the PHP parser.
9574 !! test
9575 Nesting of <kbd>
9576 !! input
9577 <kbd>X<kbd>Y</kbd>Z</kbd>
9578 !! result
9579 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9580 </p>
9581 !! end
9582
9583 # The following cases were bug 51081 in the PHP parser.
9584 # Note that there are some other nestable tags (b, i, etc) which are
9585 # not covered; see bug 51081 for discussion.
9586 !! test
9587 Nesting of <em>
9588 !! input
9589 <em>X<em>Y</em>Z</em>
9590 !! result
9591 <p><em>X<em>Y</em>Z</em>
9592 </p>
9593 !! end
9594
9595 !! test
9596 Nesting of <strong>
9597 !! input
9598 <strong>X<strong>Y</strong>Z</strong>
9599 !! result
9600 <p><strong>X<strong>Y</strong>Z</strong>
9601 </p>
9602 !! end
9603
9604 !! test
9605 Nesting of <q>
9606 !! input
9607 <q>X<q>Y</q>Z</q>
9608 !! result
9609 <p><q>X<q>Y</q>Z</q>
9610 </p>
9611 !! end
9612
9613 !! test
9614 Nesting of <ruby>
9615 !! input
9616 <ruby>X<ruby>Y</ruby>Z</ruby>
9617 !! result
9618 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9619 </p>
9620 !! end
9621
9622 !! test
9623 Nesting of <bdo>
9624 !! input
9625 <bdo>X<bdo>Y</bdo>Z</bdo>
9626 !! result
9627 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9628 </p>
9629 !! end
9630
9631
9632 ###
9633 ### Media links
9634 ###
9635
9636 !! test
9637 Media link
9638 !! input
9639 [[Media:Foobar.jpg]]
9640 !! result
9641 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9642 </p>
9643 !! end
9644
9645 !! test
9646 Media link with text
9647 !! input
9648 [[Media:Foobar.jpg|A neat file to look at]]
9649 !! result
9650 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9651 </p>
9652 !! end
9653
9654 # FIXME: this is still bad HTML tag nesting
9655 !! test
9656 Media link with nasty text
9657 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9658 !! input
9659 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9660 !! result
9661 <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>
9662
9663 !! end
9664
9665 !! test
9666 Media link to nonexistent file (bug 1702)
9667 !! input
9668 [[Media:No such.jpg]]
9669 !! result
9670 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9671 </p>
9672 !! end
9673
9674 !! test
9675 Image link to nonexistent file (bug 1850 - good)
9676 !! input
9677 [[Image:No such.jpg]]
9678 !! result
9679 <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>
9680 </p>
9681 !! end
9682
9683 !! test
9684 :Image link to nonexistent file (bug 1850 - bad)
9685 !! input
9686 [[:Image:No such.jpg]]
9687 !! result
9688 <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>
9689 </p>
9690 !! end
9691
9692
9693
9694 !! test
9695 Character reference normalization in link text (bug 1938)
9696 !! input
9697 [[Main Page|this&that]]
9698 !! result
9699 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9700 </p>
9701 !!end
9702
9703 !! article
9704 אַ
9705 !! text
9706 Test for unicode normalization
9707
9708 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9709 !! endarticle
9710
9711 !! test
9712 (bug 19451) Links should refer to the normalized form.
9713 !! input
9714 [[&#xFB2E;]]
9715 [[&#x5d0;&#x5b7;]]
9716 [[&#x5d0;ַ]]
9717 [[א&#x5b7;]]
9718 [[אַ]]
9719 !! result
9720 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9721 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9722 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9723 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9724 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9725 </p>
9726 !! end
9727
9728 !! test
9729 Empty attribute crash test (bug 2067)
9730 !! input
9731 <font color="">foo</font>
9732 !! result
9733 <p><font color="">foo</font>
9734 </p>
9735 !! end
9736
9737 !! test
9738 Empty attribute crash test single-quotes (bug 2067)
9739 !! input
9740 <font color=''>foo</font>
9741 !! result
9742 <p><font color="">foo</font>
9743 </p>
9744 !! end
9745
9746 !! test
9747 Attribute test: equals, then nothing
9748 !! input
9749 <font color=>foo</font>
9750 !! result
9751 <p><font>foo</font>
9752 </p>
9753 !! end
9754
9755 !! test
9756 Attribute test: unquoted value
9757 !! input
9758 <font color=x>foo</font>
9759 !! result
9760 <p><font color="x">foo</font>
9761 </p>
9762 !! end
9763
9764 !! test
9765 Attribute test: unquoted but illegal value (hash)
9766 !! input
9767 <font color=#x>foo</font>
9768 !! result
9769 <p><font color="#x">foo</font>
9770 </p>
9771 !! end
9772
9773 !! test
9774 Attribute test: no value
9775 !! input
9776 <font color>foo</font>
9777 !! result
9778 <p><font color="color">foo</font>
9779 </p>
9780 !! end
9781
9782 !! test
9783 Bug 2095: link with three closing brackets
9784 !! input
9785 [[Main Page]]]
9786 !! result
9787 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9788 </p>
9789 !! end
9790
9791 !! test
9792 Bug 2095: link with pipe and three closing brackets
9793 !! input
9794 [[Main Page|link]]]
9795 !! result
9796 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9797 </p>
9798 !! end
9799
9800 !! test
9801 Bug 2095: link with pipe and three closing brackets, version 2
9802 !! input
9803 [[Main Page|[http://example.com/]]]
9804 !! result
9805 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9806 </p>
9807 !! end
9808
9809
9810 ###
9811 ### Safety
9812 ###
9813
9814 !! article
9815 Template:Dangerous attribute
9816 !! text
9817 " onmouseover="alert(document.cookie)
9818 !! endarticle
9819
9820 !! article
9821 Template:Dangerous style attribute
9822 !! text
9823 border-size: expression(alert(document.cookie))
9824 !! endarticle
9825
9826 !! article
9827 Template:Div style
9828 !! text
9829 <div style="float: right; {{{1}}}">Magic div</div>
9830 !! endarticle
9831
9832 !! test
9833 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9834 !! input
9835 <div title="{{test}}"></div>
9836 !! result
9837 <div title="This is a test template"></div>
9838
9839 !! end
9840
9841 !! test
9842 Bug 2304: HTML attribute safety (dangerous template; 2309)
9843 !! input
9844 <div title="{{dangerous attribute}}"></div>
9845 !! result
9846 <div title=""></div>
9847
9848 !! end
9849
9850 !! test
9851 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9852 !! input
9853 <div style="{{dangerous style attribute}}"></div>
9854 !! result
9855 <div style="/* insecure input */"></div>
9856
9857 !! end
9858
9859 !! test
9860 Bug 2304: HTML attribute safety (safe parameter; 2309)
9861 !! input
9862 {{div style|width: 200px}}
9863 !! result
9864 <div style="float: right; width: 200px">Magic div</div>
9865
9866 !! end
9867
9868 !! test
9869 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9870 !! input
9871 {{div style|width: expression(alert(document.cookie))}}
9872 !! result
9873 <div style="/* insecure input */">Magic div</div>
9874
9875 !! end
9876
9877 !! test
9878 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9879 !! input
9880 {{div style|"><script>alert(document.cookie)</script>}}
9881 !! result
9882 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9883
9884 !! end
9885
9886 !! test
9887 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9888 !! input
9889 {{div style|" ><script>alert(document.cookie)</script>}}
9890 !! result
9891 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9892
9893 !! end
9894
9895 !! test
9896 Bug 2304: HTML attribute safety (link)
9897 !! input
9898 <div title="[[Main Page]]"></div>
9899 !! result
9900 <div title="&#91;&#91;Main Page]]"></div>
9901
9902 !! end
9903
9904 !! test
9905 Bug 2304: HTML attribute safety (italics)
9906 !! input
9907 <div title="''foobar''"></div>
9908 !! result
9909 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9910
9911 !! end
9912
9913 !! test
9914 Bug 2304: HTML attribute safety (bold)
9915 !! input
9916 <div title="'''foobar'''"></div>
9917 !! result
9918 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9919
9920 !! end
9921
9922
9923 !! test
9924 Bug 2304: HTML attribute safety (ISBN)
9925 !! input
9926 <div title="ISBN 1234567890"></div>
9927 !! result
9928 <div title="&#73;SBN 1234567890"></div>
9929
9930 !! end
9931
9932 !! test
9933 Bug 2304: HTML attribute safety (RFC)
9934 !! input
9935 <div title="RFC 1234"></div>
9936 !! result
9937 <div title="&#82;FC 1234"></div>
9938
9939 !! end
9940
9941 !! test
9942 Bug 2304: HTML attribute safety (PMID)
9943 !! input
9944 <div title="PMID 1234567890"></div>
9945 !! result
9946 <div title="&#80;MID 1234567890"></div>
9947
9948 !! end
9949
9950 !! test
9951 Bug 2304: HTML attribute safety (web link)
9952 !! input
9953 <div title="http://example.com/"></div>
9954 !! result
9955 <div title="http&#58;//example.com/"></div>
9956
9957 !! end
9958
9959 !! test
9960 Bug 2304: HTML attribute safety (named web link)
9961 !! input
9962 <div title="[http://example.com/ link]"></div>
9963 !! result
9964 <div title="&#91;http&#58;//example.com/ link]"></div>
9965
9966 !! end
9967
9968 !! test
9969 Bug 3244: HTML attribute safety (extension; safe)
9970 !! input
9971 <div style="<nowiki>background:blue</nowiki>"></div>
9972 !! result
9973 <div style="background:blue"></div>
9974
9975 !! end
9976
9977 !! test
9978 Bug 3244: HTML attribute safety (extension; unsafe)
9979 !! input
9980 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9981 !! result
9982 <div style="/* insecure input */"></div>
9983
9984 !! end
9985
9986 # More MSIE fun discovered by Tom Gilder
9987
9988 !! test
9989 MSIE CSS safety test: spurious slash
9990 !! input
9991 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9992 !! result
9993 <div style="/* insecure input */">evil</div>
9994
9995 !! end
9996
9997 !! test
9998 MSIE CSS safety test: hex code
9999 !! input
10000 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10001 !! result
10002 <div style="/* insecure input */">evil</div>
10003
10004 !! end
10005
10006 !! test
10007 MSIE CSS safety test: comment in url
10008 !! input
10009 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10010 !! result
10011 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10012
10013 !! end
10014
10015 !! test
10016 MSIE CSS safety test: comment in expression
10017 !! input
10018 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10019 !! result
10020 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10021
10022 !! end
10023
10024
10025 !! test
10026 Table attribute legitimate extension
10027 !! input
10028 {|
10029 !+ style="<nowiki>color:blue</nowiki>"| status
10030 |}
10031 !! result
10032 <table>
10033 <tr>
10034 <th style="color:blue"> status
10035 </th></tr></table>
10036
10037 !!end
10038
10039 !! test
10040 Table attribute safety
10041 !! input
10042 {|
10043 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10044 |}
10045 !! result
10046 <table>
10047 <tr>
10048 <th style="/* insecure input */"> status
10049 </th></tr></table>
10050
10051 !! end
10052
10053 !! test
10054 CSS line continuation 1
10055 !! input
10056 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10057 !! result
10058 <div style="/* insecure input */"></div>
10059
10060 !! end
10061
10062 !! test
10063 CSS line continuation 2
10064 !! input
10065 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10066 !! result
10067 <div style="/* insecure input */"></div>
10068
10069 !! end
10070
10071 !! article
10072 Template:Identity
10073 !! text
10074 {{{1}}}
10075 !! endarticle
10076
10077 !! test
10078 Expansion of multi-line templates in attribute values (bug 6255)
10079 !! input
10080 <div style="background: {{identity|#00FF00}}">-</div>
10081 !! result
10082 <div style="background: #00FF00">-</div>
10083
10084 !! end
10085
10086
10087 !! test
10088 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10089 !! input
10090 <div style="background:
10091 #00FF00">-</div>
10092 !! result
10093 <div style="background: #00FF00">-</div>
10094
10095 !! end
10096
10097 !! test
10098 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10099 !! input
10100 <div style="background: &#10;#00FF00">-</div>
10101 !! result
10102 <div style="background: &#10;#00FF00">-</div>
10103
10104 !! end
10105
10106 ###
10107 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10108 ###
10109 !! test
10110 Parser hook: empty input
10111 !! input
10112 <tag></tag>
10113 !! result
10114 <pre>
10115 ''
10116 array (
10117 )
10118 </pre>
10119
10120 !! end
10121
10122 !! test
10123 Parser hook: empty input using terminated empty elements
10124 !! input
10125 <tag/>
10126 !! result
10127 <pre>
10128 NULL
10129 array (
10130 )
10131 </pre>
10132
10133 !! end
10134
10135 !! test
10136 Parser hook: empty input using terminated empty elements (space before)
10137 !! input
10138 <tag />
10139 !! result
10140 <pre>
10141 NULL
10142 array (
10143 )
10144 </pre>
10145
10146 !! end
10147
10148 !! test
10149 Parser hook: basic input
10150 !! input
10151 <tag>input</tag>
10152 !! result
10153 <pre>
10154 'input'
10155 array (
10156 )
10157 </pre>
10158
10159 !! end
10160
10161
10162 !! test
10163 Parser hook: case insensitive
10164 !! input
10165 <TAG>input</TAG>
10166 !! result
10167 <pre>
10168 'input'
10169 array (
10170 )
10171 </pre>
10172
10173 !! end
10174
10175
10176 !! test
10177 Parser hook: case insensitive, redux
10178 !! input
10179 <TaG>input</TAg>
10180 !! result
10181 <pre>
10182 'input'
10183 array (
10184 )
10185 </pre>
10186
10187 !! end
10188
10189 !! test
10190 Parser hook: nested tags
10191 !! options
10192 noxml
10193 !! input
10194 <tag><tag></tag></tag>
10195 !! result
10196 <pre>
10197 '<tag>'
10198 array (
10199 )
10200 </pre>&lt;/tag&gt;
10201
10202 !! end
10203
10204 !! test
10205 Parser hook: basic arguments
10206 !! input
10207 <tag width=200 height = "100" depth = '50' square></tag>
10208 !! result
10209 <pre>
10210 ''
10211 array (
10212 'width' => '200',
10213 'height' => '100',
10214 'depth' => '50',
10215 'square' => 'square',
10216 )
10217 </pre>
10218
10219 !! end
10220
10221 !! test
10222 Parser hook: argument containing a forward slash (bug 5344)
10223 !! input
10224 <tag filename='/tmp/bla'></tag>
10225 !! result
10226 <pre>
10227 ''
10228 array (
10229 'filename' => '/tmp/bla',
10230 )
10231 </pre>
10232
10233 !! end
10234
10235 !! test
10236 Parser hook: empty input using terminated empty elements (bug 2374)
10237 !! input
10238 <tag foo=bar/>text
10239 !! result
10240 <pre>
10241 NULL
10242 array (
10243 'foo' => 'bar',
10244 )
10245 </pre>text
10246
10247 !! end
10248
10249 # </tag> should be output literally since there is no matching tag that begins it
10250 !! test
10251 Parser hook: basic arguments using terminated empty elements (bug 2374)
10252 !! input
10253 <tag width=200 height = "100" depth = '50' square/>
10254 other stuff
10255 </tag>
10256 !! result
10257 <pre>
10258 NULL
10259 array (
10260 'width' => '200',
10261 'height' => '100',
10262 'depth' => '50',
10263 'square' => 'square',
10264 )
10265 </pre>
10266 <p>other stuff
10267 &lt;/tag&gt;
10268 </p>
10269 !! end
10270
10271 ###
10272 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10273 ###
10274
10275 !! test
10276 Parser hook: static parser hook not inside a comment
10277 !! input
10278 <statictag>hello, world</statictag>
10279 <statictag action=flush/>
10280 !! result
10281 <p>hello, world
10282 </p>
10283 !! end
10284
10285
10286 !! test
10287 Parser hook: static parser hook inside a comment
10288 !! input
10289 <!-- <statictag>hello, world</statictag> -->
10290 <statictag action=flush/>
10291 !! result
10292 <p><br />
10293 </p>
10294 !! end
10295
10296 # Nested template calls; this case was broken by Parser.php rev 1.506,
10297 # since reverted.
10298
10299 !! article
10300 Template:One-parameter
10301 !! text
10302 (My parameter is: {{{1}}})
10303 !! endarticle
10304
10305 !! article
10306 Template:Map-one-parameter
10307 !! text
10308 {{{{{1}}}|{{{2}}}}}
10309 !! endarticle
10310
10311 !! test
10312 Nested template calls
10313 !! input
10314 {{Map-one-parameter|One-parameter|param}}
10315 !! result
10316 <p>(My parameter is: param)
10317 </p>
10318 !! end
10319
10320
10321 ###
10322 ### Sanitizer
10323 ###
10324 !! test
10325 Sanitizer: Closing of open tags
10326 !! input
10327 <s></s><table></table>
10328 !! result
10329 <s></s><table></table>
10330
10331 !! end
10332
10333 !! test
10334 Sanitizer: Closing of open but not closed tags
10335 !! input
10336 <s>foo
10337 !! result
10338 <p><s>foo</s>
10339 </p>
10340 !! end
10341
10342 !! test
10343 Sanitizer: Closing of closed but not open tags
10344 !! input
10345 </s>
10346 !! result
10347 <p>&lt;/s&gt;
10348 </p>
10349 !! end
10350
10351 !! test
10352 Sanitizer: Closing of closed but not open table tags
10353 !! input
10354 Table not started</td></tr></table>
10355 !! result
10356 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10357 </p>
10358 !! end
10359
10360 !! test
10361 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10362 !! input
10363 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10364 !! result
10365 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10366 </p>
10367 !! end
10368
10369 !! test
10370 Sanitizer: Validating the contents of the id attribute (bug 4515)
10371 !! options
10372 disabled
10373 !! input
10374 <br id=9 />
10375 !! result
10376 Something, but definitely not <br id="9" />...
10377 !! end
10378
10379 !! test
10380 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10381 !! options
10382 disabled
10383 !! input
10384 <br id="foo" /><br id="foo" />
10385 !! result
10386 Something need to be done. foo-2 ?
10387 !! end
10388
10389 !! test
10390 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10391 !! input
10392 <div itemscope>
10393 <meta itemprop="hello" content="world">
10394 <meta http-equiv="refresh" content="5">
10395 <meta itemprop="hello" http-equiv="refresh" content="5">
10396 <link itemprop="hello" href="{{SERVER}}">
10397 <link rel="stylesheet" href="{{SERVER}}">
10398 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10399 </div>
10400 !! result
10401 <div itemscope="itemscope">
10402 <p> <meta itemprop="hello" content="world" />
10403 &lt;meta http-equiv="refresh" content="5"&gt;
10404 <meta itemprop="hello" content="5" />
10405 </p>
10406 <link itemprop="hello" href="http&#58;//example.org" />
10407 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10408 <link itemprop="hello" href="http&#58;//example.org" />
10409 </div>
10410
10411 !! end
10412
10413 !! test
10414 Language converter: output gets cut off unexpectedly (bug 5757)
10415 !! options
10416 language=zh
10417 !! input
10418 this bit is safe: }-
10419
10420 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10421
10422 then we get cut off here: }-
10423
10424 all additional text is vanished
10425 !! result
10426 <p>this bit is safe: }-
10427 </p><p>but if we add a conversion instance: xxx
10428 </p><p>then we get cut off here: }-
10429 </p><p>all additional text is vanished
10430 </p>
10431 !! end
10432
10433 !! test
10434 Self closed html pairs (bug 5487)
10435 !! options
10436 !! input
10437 <center><font id="bug" />Centered text</center>
10438 <div><font id="bug2" />In div text</div>
10439 !! result
10440 <center>&lt;font id="bug" /&gt;Centered text</center>
10441 <div>&lt;font id="bug2" /&gt;In div text</div>
10442
10443 !! end
10444
10445 #
10446 #
10447 #
10448
10449 !! test
10450 Punctuation: nbsp before exclamation
10451 !! input
10452 C'est grave !
10453 !! result
10454 <p>C'est grave&#160;!
10455 </p>
10456 !! end
10457
10458 !! test
10459 Punctuation: CSS !important (bug 11874)
10460 !! input
10461 <div style="width:50% !important">important</div>
10462 !! result
10463 <div style="width:50% !important">important</div>
10464
10465 !!end
10466
10467 !! test
10468 Punctuation: CSS ! important (bug 11874; with space after)
10469 !! input
10470 <div style="width:50% ! important">important</div>
10471 !! result
10472 <div style="width:50% ! important">important</div>
10473
10474 !!end
10475
10476
10477 !! test
10478 HTML bullet list, closed tags (bug 5497)
10479 !! input
10480 <ul>
10481 <li>One</li>
10482 <li>Two</li>
10483 </ul>
10484 !! result
10485 <ul>
10486 <li>One</li>
10487 <li>Two</li>
10488 </ul>
10489
10490 !! end
10491
10492 !! test
10493 HTML bullet list, unclosed tags (bug 5497)
10494 !! options
10495 disabled
10496 !! input
10497 <ul>
10498 <li>One
10499 <li>Two
10500 </ul>
10501 !! result
10502 <ul>
10503 <li>One
10504 </li><li>Two
10505 </li></ul>
10506
10507 !! end
10508
10509 !! test
10510 HTML ordered list, closed tags (bug 5497)
10511 !! input
10512 <ol>
10513 <li>One</li>
10514 <li>Two</li>
10515 </ol>
10516 !! result
10517 <ol>
10518 <li>One</li>
10519 <li>Two</li>
10520 </ol>
10521
10522 !! end
10523
10524 !! test
10525 HTML ordered list, unclosed tags (bug 5497)
10526 !! options
10527 disabled
10528 !! input
10529 <ol>
10530 <li>One
10531 <li>Two
10532 </ol>
10533 !! result
10534 <ol>
10535 <li>One
10536 </li><li>Two
10537 </li></ol>
10538
10539 !! end
10540
10541 !! test
10542 HTML nested bullet list, closed tags (bug 5497)
10543 !! input
10544 <ul>
10545 <li>One</li>
10546 <li>Two:
10547 <ul>
10548 <li>Sub-one</li>
10549 <li>Sub-two</li>
10550 </ul>
10551 </li>
10552 </ul>
10553 !! result
10554 <ul>
10555 <li>One</li>
10556 <li>Two:
10557 <ul>
10558 <li>Sub-one</li>
10559 <li>Sub-two</li>
10560 </ul>
10561 </li>
10562 </ul>
10563
10564 !! end
10565
10566 !! test
10567 HTML nested bullet list, open tags (bug 5497)
10568 !! options
10569 disabled
10570 !! input
10571 <ul>
10572 <li>One
10573 <li>Two:
10574 <ul>
10575 <li>Sub-one
10576 <li>Sub-two
10577 </ul>
10578 </ul>
10579 !! result
10580 <ul>
10581 <li>One
10582 </li><li>Two:
10583 <ul>
10584 <li>Sub-one
10585 </li><li>Sub-two
10586 </li></ul>
10587 </li></ul>
10588
10589 !! end
10590
10591 !! test
10592 HTML nested ordered list, closed tags (bug 5497)
10593 !! input
10594 <ol>
10595 <li>One</li>
10596 <li>Two:
10597 <ol>
10598 <li>Sub-one</li>
10599 <li>Sub-two</li>
10600 </ol>
10601 </li>
10602 </ol>
10603 !! result
10604 <ol>
10605 <li>One</li>
10606 <li>Two:
10607 <ol>
10608 <li>Sub-one</li>
10609 <li>Sub-two</li>
10610 </ol>
10611 </li>
10612 </ol>
10613
10614 !! end
10615
10616 !! test
10617 HTML nested ordered list, open tags (bug 5497)
10618 !! options
10619 disabled
10620 !! input
10621 <ol>
10622 <li>One
10623 <li>Two:
10624 <ol>
10625 <li>Sub-one
10626 <li>Sub-two
10627 </ol>
10628 </ol>
10629 !! result
10630 <ol>
10631 <li>One
10632 </li><li>Two:
10633 <ol>
10634 <li>Sub-one
10635 </li><li>Sub-two
10636 </li></ol>
10637 </li></ol>
10638
10639 !! end
10640
10641 !! test
10642 HTML ordered list item with parameters oddity
10643 !! input
10644 <ol><li id="fragment">One</li></ol>
10645 !! result
10646 <ol><li id="fragment">One</li></ol>
10647
10648 !! end
10649
10650 !!test
10651 bug 5918: autonumbering
10652 !! input
10653 [http://first/] [http://second] [ftp://ftp]
10654
10655 ftp://inlineftp
10656
10657 [mailto:enclosed@mail.tld With target]
10658
10659 [mailto:enclosed@mail.tld]
10660
10661 mailto:inline@mail.tld
10662 !! result
10663 <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>
10664 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10665 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10666 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10667 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10668 </p>
10669 !! end
10670
10671
10672 #
10673 # Security and HTML correctness
10674 # From Nick Jenkins' fuzz testing
10675 #
10676
10677 !! test
10678 Fuzz testing: Parser13
10679 !! input
10680 {|
10681 | http://a|
10682 !! result
10683 <table>
10684 <tr>
10685 <td>
10686 </td>
10687 </tr>
10688 </table>
10689
10690 !! end
10691
10692 !! test
10693 Fuzz testing: Parser14
10694 !! input
10695 == onmouseover= ==
10696 http://__TOC__
10697 !! result
10698 <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>
10699 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10700 <ul>
10701 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10702 </ul>
10703 </div>
10704
10705 !! end
10706
10707 !! test
10708 Fuzz testing: Parser14-table
10709 !! input
10710 ==a==
10711 {| STYLE=__TOC__
10712 !! result
10713 <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>
10714 <table style="&#95;_TOC&#95;_">
10715 <tr><td></td></tr>
10716 </table>
10717
10718 !! end
10719
10720 # Known to produce bogus xml (extra </td>)
10721 !! test
10722 Fuzz testing: Parser16
10723 !! options
10724 noxml
10725 !! input
10726 {|
10727 !https://||||||
10728 !! result
10729 <table>
10730 <tr>
10731 <th>https://</th>
10732 <th></th>
10733 <th></th>
10734 <th>
10735 </td>
10736 </tr>
10737 </table>
10738
10739 !! end
10740
10741 !! test
10742 Fuzz testing: Parser21
10743 !! input
10744 {|
10745 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10746 |
10747 !! result
10748 <table>
10749 <tr>
10750 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10751 </th>
10752 <td>
10753 </td>
10754 </tr>
10755 </table>
10756
10757 !! end
10758
10759 !! test
10760 Fuzz testing: Parser22
10761 !! input
10762 http://===r:::https://b
10763
10764 {|
10765 !!result
10766 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10767 </p>
10768 <table>
10769 <tr><td></td></tr>
10770 </table>
10771
10772 !! end
10773
10774 # Known to produce bad XML for now
10775 !! test
10776 Fuzz testing: Parser24
10777 !! options
10778 noxml
10779 !! input
10780 {|
10781 {{{|
10782 <u CLASS=
10783 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10784 <br style="onmouseover='alert(document.cookie);' " />
10785
10786 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10787 |
10788 !! result
10789 <table>
10790 {{{|
10791 <u class="&#124;">}}}} &gt;
10792 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10793
10794 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10795 <tr>
10796 <td></u>
10797 </td>
10798 </tr>
10799 </table>
10800
10801 !! end
10802
10803 # Note: the current result listed for this is not what the original one was,
10804 # but the original bug was JavaScript injection, which is fixed in any case.
10805 # It's not clear that the original result listed was any more correct than the
10806 # current one. Original result:
10807 # <p>{{{|
10808 # </p>
10809 # <li class="&#124;&#124;">
10810 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10811 !!test
10812 Fuzz testing: Parser25 (bug 6055)
10813 !! input
10814 {{{
10815 |
10816 <LI CLASS=||
10817 >
10818 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10819 !! result
10820 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10821 </p>
10822 !! end
10823
10824 !!test
10825 Fuzz testing: URL adjacent extension (with space, clean)
10826 !! options
10827 !! input
10828 http://example.com <nowiki>junk</nowiki>
10829 !! result
10830 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10831 </p>
10832 !!end
10833
10834 !!test
10835 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10836 !! options
10837 !! input
10838 http://example.com<nowiki>junk</nowiki>
10839 !! result
10840 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10841 </p>
10842 !!end
10843
10844 !!test
10845 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10846 !! options
10847 !! input
10848 http://example.com<pre>junk</pre>
10849 !! result
10850 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10851
10852 !!end
10853
10854 !!test
10855 Fuzz testing: image with bogus manual thumbnail
10856 !!input
10857 [[Image:foobar.jpg|thumbnail= ]]
10858 !!result
10859 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10860
10861 !!end
10862
10863 !! test
10864 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10865 !! input
10866 <pre dir="&#10;"></pre>
10867 !! result
10868 <pre dir="&#10;"></pre>
10869
10870 !! end
10871
10872 !! test
10873 Parsing optional HTML elements (Bug 6171)
10874 !! options
10875 !! input
10876 <table>
10877 <tr>
10878 <td> Some tabular data</td>
10879 <td> More tabular data ...
10880 <td> And yet som tabular data</td>
10881 </tr>
10882 </table>
10883 !! result
10884 <table>
10885 <tr>
10886 <td> Some tabular data</td>
10887 <td> More tabular data ...
10888 </td><td> And yet som tabular data</td>
10889 </tr>
10890 </table>
10891
10892 !! end
10893
10894 !! test
10895 Correct handling of <td>, <tr> (Bug 6171)
10896 !! options
10897 !! input
10898 <table>
10899 <tr>
10900 <td> Some tabular data</td>
10901 <td> More tabular data ...</td>
10902 <td> And yet som tabular data</td>
10903 </tr>
10904 </table>
10905 !! result
10906 <table>
10907 <tr>
10908 <td> Some tabular data</td>
10909 <td> More tabular data ...</td>
10910 <td> And yet som tabular data</td>
10911 </tr>
10912 </table>
10913
10914 !! end
10915
10916
10917 !! test
10918 Parsing crashing regression (fr:JavaScript)
10919 !! input
10920 </body></x>
10921 !! result
10922 <p>&lt;/body&gt;&lt;/x&gt;
10923 </p>
10924 !! end
10925
10926 !! test
10927 Inline wiki vs wiki block nesting
10928 !! input
10929 '''Bold paragraph
10930
10931 New wiki paragraph
10932 !! result
10933 <p><b>Bold paragraph</b>
10934 </p><p>New wiki paragraph
10935 </p>
10936 !! end
10937
10938 !! test
10939 Inline HTML vs wiki block nesting
10940 !! options
10941 disabled
10942 !! input
10943 <b>Bold paragraph
10944
10945 New wiki paragraph
10946 !! result
10947 <p><b>Bold paragraph</b>
10948 </p><p>New wiki paragraph
10949 </p>
10950 !! end
10951
10952 # Original result was this:
10953 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10954 # </p>
10955 # While that might be marginally more intuitive, maybe, the six-apostrophe
10956 # construct is clearly pathological and the result stated here (which is what
10957 # the parser actually does) is about as reasonable as anything.
10958 !!test
10959 Mixing markup for italics and bold
10960 !! options
10961 !! input
10962 '''bold''''''bold''bolditalics'''''
10963 !! result
10964 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10965 </p>
10966 !! end
10967
10968
10969 !! article
10970 Xyzzyx
10971 !! text
10972 Article for special page transclusion test
10973 !! endarticle
10974
10975 !! test
10976 Special page transclusion
10977 !! options
10978 !! input
10979 {{Special:Prefixindex/Xyzzyx}}
10980 !! result
10981 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10982
10983 !! end
10984
10985 !! test
10986 Special page transclusion twice (bug 5021)
10987 !! options
10988 !! input
10989 {{Special:Prefixindex/Xyzzyx}}
10990 {{Special:Prefixindex/Xyzzyx}}
10991 !! result
10992 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10993 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10994
10995 !! end
10996
10997 !! test
10998 Transclusion of default MediaWiki message
10999 !! input
11000 {{MediaWiki:Mainpage}}
11001 !!result
11002 <p>Main Page
11003 </p>
11004 !! end
11005
11006 !! test
11007 Transclusion of nonexistent MediaWiki message
11008 !! input
11009 {{MediaWiki:Mainpagexxx}}
11010 !!result
11011 <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>
11012 </p>
11013 !! end
11014
11015 !! test
11016 Transclusion of MediaWiki message with underscore
11017 !! input
11018 {{MediaWiki:history_short}}
11019 !! result
11020 <p>History
11021 </p>
11022 !! end
11023
11024 !! test
11025 Transclusion of MediaWiki message with space
11026 !! input
11027 {{MediaWiki:history short}}
11028 !! result
11029 <p>History
11030 </p>
11031 !! end
11032
11033 !! test
11034 Invalid header with following text
11035 !! input
11036 = x = y
11037 !! result
11038 <p>= x = y
11039 </p>
11040 !! end
11041
11042
11043 !! test
11044 Section extraction test (section 0)
11045 !! options
11046 section=0
11047 !! input
11048 start
11049 ==a==
11050 ===aa===
11051 ====aaa====
11052 ==b==
11053 ===ba===
11054 ===bb===
11055 ====bba====
11056 ===bc===
11057 ==c==
11058 ===ca===
11059 !! result
11060 start
11061 !! end
11062
11063 !! test
11064 Section extraction test (section 1)
11065 !! options
11066 section=1
11067 !! input
11068 start
11069 ==a==
11070 ===aa===
11071 ====aaa====
11072 ==b==
11073 ===ba===
11074 ===bb===
11075 ====bba====
11076 ===bc===
11077 ==c==
11078 ===ca===
11079 !! result
11080 ==a==
11081 ===aa===
11082 ====aaa====
11083 !! end
11084
11085 !! test
11086 Section extraction test (section 2)
11087 !! options
11088 section=2
11089 !! input
11090 start
11091 ==a==
11092 ===aa===
11093 ====aaa====
11094 ==b==
11095 ===ba===
11096 ===bb===
11097 ====bba====
11098 ===bc===
11099 ==c==
11100 ===ca===
11101 !! result
11102 ===aa===
11103 ====aaa====
11104 !! end
11105
11106 !! test
11107 Section extraction test (section 3)
11108 !! options
11109 section=3
11110 !! input
11111 start
11112 ==a==
11113 ===aa===
11114 ====aaa====
11115 ==b==
11116 ===ba===
11117 ===bb===
11118 ====bba====
11119 ===bc===
11120 ==c==
11121 ===ca===
11122 !! result
11123 ====aaa====
11124 !! end
11125
11126 !! test
11127 Section extraction test (section 4)
11128 !! options
11129 section=4
11130 !! input
11131 start
11132 ==a==
11133 ===aa===
11134 ====aaa====
11135 ==b==
11136 ===ba===
11137 ===bb===
11138 ====bba====
11139 ===bc===
11140 ==c==
11141 ===ca===
11142 !! result
11143 ==b==
11144 ===ba===
11145 ===bb===
11146 ====bba====
11147 ===bc===
11148 !! end
11149
11150 !! test
11151 Section extraction test (section 5)
11152 !! options
11153 section=5
11154 !! input
11155 start
11156 ==a==
11157 ===aa===
11158 ====aaa====
11159 ==b==
11160 ===ba===
11161 ===bb===
11162 ====bba====
11163 ===bc===
11164 ==c==
11165 ===ca===
11166 !! result
11167 ===ba===
11168 !! end
11169
11170 !! test
11171 Section extraction test (section 6)
11172 !! options
11173 section=6
11174 !! input
11175 start
11176 ==a==
11177 ===aa===
11178 ====aaa====
11179 ==b==
11180 ===ba===
11181 ===bb===
11182 ====bba====
11183 ===bc===
11184 ==c==
11185 ===ca===
11186 !! result
11187 ===bb===
11188 ====bba====
11189 !! end
11190
11191 !! test
11192 Section extraction test (section 7)
11193 !! options
11194 section=7
11195 !! input
11196 start
11197 ==a==
11198 ===aa===
11199 ====aaa====
11200 ==b==
11201 ===ba===
11202 ===bb===
11203 ====bba====
11204 ===bc===
11205 ==c==
11206 ===ca===
11207 !! result
11208 ====bba====
11209 !! end
11210
11211 !! test
11212 Section extraction test (section 8)
11213 !! options
11214 section=8
11215 !! input
11216 start
11217 ==a==
11218 ===aa===
11219 ====aaa====
11220 ==b==
11221 ===ba===
11222 ===bb===
11223 ====bba====
11224 ===bc===
11225 ==c==
11226 ===ca===
11227 !! result
11228 ===bc===
11229 !! end
11230
11231 !! test
11232 Section extraction test (section 9)
11233 !! options
11234 section=9
11235 !! input
11236 start
11237 ==a==
11238 ===aa===
11239 ====aaa====
11240 ==b==
11241 ===ba===
11242 ===bb===
11243 ====bba====
11244 ===bc===
11245 ==c==
11246 ===ca===
11247 !! result
11248 ==c==
11249 ===ca===
11250 !! end
11251
11252 !! test
11253 Section extraction test (section 10)
11254 !! options
11255 section=10
11256 !! input
11257 start
11258 ==a==
11259 ===aa===
11260 ====aaa====
11261 ==b==
11262 ===ba===
11263 ===bb===
11264 ====bba====
11265 ===bc===
11266 ==c==
11267 ===ca===
11268 !! result
11269 ===ca===
11270 !! end
11271
11272 !! test
11273 Section extraction test (nonexistent section 11)
11274 !! options
11275 section=11
11276 !! input
11277 start
11278 ==a==
11279 ===aa===
11280 ====aaa====
11281 ==b==
11282 ===ba===
11283 ===bb===
11284 ====bba====
11285 ===bc===
11286 ==c==
11287 ===ca===
11288 !! result
11289 !! end
11290
11291 !! test
11292 Section extraction test with bogus heading (section 1)
11293 !! options
11294 section=1
11295 !! input
11296 ==a==
11297 ==bogus== not a legal section
11298 ==b==
11299 !! result
11300 ==a==
11301 ==bogus== not a legal section
11302 !! end
11303
11304 !! test
11305 Section extraction test with bogus heading (section 2)
11306 !! options
11307 section=2
11308 !! input
11309 ==a==
11310 ==bogus== not a legal section
11311 ==b==
11312 !! result
11313 ==b==
11314 !! end
11315
11316 !! test
11317 Section extraction test with comment after heading (section 1)
11318 !! options
11319 section=1
11320 !! input
11321 ==a==
11322 ==b== <!-- -->
11323 ==c==
11324 !! result
11325 ==a==
11326 !! end
11327
11328 !! test
11329 Section extraction test with comment after heading (section 2)
11330 !! options
11331 section=2
11332 !! input
11333 ==a==
11334 ==b== <!-- -->
11335 ==c==
11336 !! result
11337 ==b== <!-- -->
11338 !! end
11339
11340 !! test
11341 Section extraction test with bogus <nowiki> heading (section 1)
11342 !! options
11343 section=1
11344 !! input
11345 ==a==
11346 ==bogus== <nowiki>not a legal section</nowiki>
11347 ==b==
11348 !! result
11349 ==a==
11350 ==bogus== <nowiki>not a legal section</nowiki>
11351 !! end
11352
11353 !! test
11354 Section extraction test with bogus <nowiki> heading (section 2)
11355 !! options
11356 section=2
11357 !! input
11358 ==a==
11359 ==bogus== <nowiki>not a legal section</nowiki>
11360 ==b==
11361 !! result
11362 ==b==
11363 !! end
11364
11365
11366 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11367 # instead of respecting commented sections
11368 !! test
11369 Section extraction prefixed by comment (section 1)
11370 !! options
11371 section=1
11372 !! input
11373 <!-- -->==sec1==
11374 ==sec2==
11375 !!result
11376 ==sec2==
11377 !!end
11378
11379 !! test
11380 Section extraction prefixed by comment (section 2)
11381 !! options
11382 section=2
11383 !! input
11384 <!-- -->==sec1==
11385 ==sec2==
11386 !!result
11387
11388 !!end
11389
11390
11391 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11392 # instead of respecting HTML-style headings
11393 !! test
11394 Section extraction, mixed wiki and html (section 1)
11395 !! options
11396 section=1
11397 !! input
11398 <h2>unmarked</h2>
11399 unmarked
11400 ==1==
11401 one
11402 ==2==
11403 two
11404 !! result
11405 ==1==
11406 one
11407 !! end
11408
11409 !! test
11410 Section extraction, mixed wiki and html (section 2)
11411 !! options
11412 section=2
11413 !! input
11414 <h2>unmarked</h2>
11415 unmarked
11416 ==1==
11417 one
11418 ==2==
11419 two
11420 !! result
11421 ==2==
11422 two
11423 !! end
11424
11425
11426 # Formerly testing for bug 3342
11427 !! test
11428 Section extraction, heading surrounded by <noinclude>
11429 !! options
11430 section=1
11431 !! input
11432 <noinclude>==unmarked==</noinclude>
11433 ==marked==
11434 !! result
11435 ==marked==
11436 !!end
11437
11438 # Test behavior of bug 19910
11439 !! test
11440 Sectiion with all-equals
11441 !! options
11442 section=2
11443 !! input
11444 ===
11445 The line above must have a trailing space
11446 === <!--
11447 --> <!-- -->
11448 But just in case it doesn't...
11449 !! result
11450 === <!--
11451 --> <!-- -->
11452 But just in case it doesn't...
11453 !! end
11454
11455 !! test
11456 Section replacement test (section 0)
11457 !! options
11458 replace=0,"xxx"
11459 !! input
11460 start
11461 ==a==
11462 ===aa===
11463 ====aaa====
11464 ==b==
11465 ===ba===
11466 ===bb===
11467 ====bba====
11468 ===bc===
11469 ==c==
11470 ===ca===
11471 !! result
11472 xxx
11473
11474 ==a==
11475 ===aa===
11476 ====aaa====
11477 ==b==
11478 ===ba===
11479 ===bb===
11480 ====bba====
11481 ===bc===
11482 ==c==
11483 ===ca===
11484 !! end
11485
11486 !! test
11487 Section replacement test (section 1)
11488 !! options
11489 replace=1,"xxx"
11490 !! input
11491 start
11492 ==a==
11493 ===aa===
11494 ====aaa====
11495 ==b==
11496 ===ba===
11497 ===bb===
11498 ====bba====
11499 ===bc===
11500 ==c==
11501 ===ca===
11502 !! result
11503 start
11504 xxx
11505
11506 ==b==
11507 ===ba===
11508 ===bb===
11509 ====bba====
11510 ===bc===
11511 ==c==
11512 ===ca===
11513 !! end
11514
11515 !! test
11516 Section replacement test (section 2)
11517 !! options
11518 replace=2,"xxx"
11519 !! input
11520 start
11521 ==a==
11522 ===aa===
11523 ====aaa====
11524 ==b==
11525 ===ba===
11526 ===bb===
11527 ====bba====
11528 ===bc===
11529 ==c==
11530 ===ca===
11531 !! result
11532 start
11533 ==a==
11534 xxx
11535
11536 ==b==
11537 ===ba===
11538 ===bb===
11539 ====bba====
11540 ===bc===
11541 ==c==
11542 ===ca===
11543 !! end
11544
11545 !! test
11546 Section replacement test (section 3)
11547 !! options
11548 replace=3,"xxx"
11549 !! input
11550 start
11551 ==a==
11552 ===aa===
11553 ====aaa====
11554 ==b==
11555 ===ba===
11556 ===bb===
11557 ====bba====
11558 ===bc===
11559 ==c==
11560 ===ca===
11561 !! result
11562 start
11563 ==a==
11564 ===aa===
11565 xxx
11566
11567 ==b==
11568 ===ba===
11569 ===bb===
11570 ====bba====
11571 ===bc===
11572 ==c==
11573 ===ca===
11574 !! end
11575
11576 !! test
11577 Section replacement test (section 4)
11578 !! options
11579 replace=4,"xxx"
11580 !! input
11581 start
11582 ==a==
11583 ===aa===
11584 ====aaa====
11585 ==b==
11586 ===ba===
11587 ===bb===
11588 ====bba====
11589 ===bc===
11590 ==c==
11591 ===ca===
11592 !! result
11593 start
11594 ==a==
11595 ===aa===
11596 ====aaa====
11597 xxx
11598
11599 ==c==
11600 ===ca===
11601 !! end
11602
11603 !! test
11604 Section replacement test (section 5)
11605 !! options
11606 replace=5,"xxx"
11607 !! input
11608 start
11609 ==a==
11610 ===aa===
11611 ====aaa====
11612 ==b==
11613 ===ba===
11614 ===bb===
11615 ====bba====
11616 ===bc===
11617 ==c==
11618 ===ca===
11619 !! result
11620 start
11621 ==a==
11622 ===aa===
11623 ====aaa====
11624 ==b==
11625 xxx
11626
11627 ===bb===
11628 ====bba====
11629 ===bc===
11630 ==c==
11631 ===ca===
11632 !! end
11633
11634 !! test
11635 Section replacement test (section 6)
11636 !! options
11637 replace=6,"xxx"
11638 !! input
11639 start
11640 ==a==
11641 ===aa===
11642 ====aaa====
11643 ==b==
11644 ===ba===
11645 ===bb===
11646 ====bba====
11647 ===bc===
11648 ==c==
11649 ===ca===
11650 !! result
11651 start
11652 ==a==
11653 ===aa===
11654 ====aaa====
11655 ==b==
11656 ===ba===
11657 xxx
11658
11659 ===bc===
11660 ==c==
11661 ===ca===
11662 !! end
11663
11664 !! test
11665 Section replacement test (section 7)
11666 !! options
11667 replace=7,"xxx"
11668 !! input
11669 start
11670 ==a==
11671 ===aa===
11672 ====aaa====
11673 ==b==
11674 ===ba===
11675 ===bb===
11676 ====bba====
11677 ===bc===
11678 ==c==
11679 ===ca===
11680 !! result
11681 start
11682 ==a==
11683 ===aa===
11684 ====aaa====
11685 ==b==
11686 ===ba===
11687 ===bb===
11688 xxx
11689
11690 ===bc===
11691 ==c==
11692 ===ca===
11693 !! end
11694
11695 !! test
11696 Section replacement test (section 8)
11697 !! options
11698 replace=8,"xxx"
11699 !! input
11700 start
11701 ==a==
11702 ===aa===
11703 ====aaa====
11704 ==b==
11705 ===ba===
11706 ===bb===
11707 ====bba====
11708 ===bc===
11709 ==c==
11710 ===ca===
11711 !! result
11712 start
11713 ==a==
11714 ===aa===
11715 ====aaa====
11716 ==b==
11717 ===ba===
11718 ===bb===
11719 ====bba====
11720 xxx
11721
11722 ==c==
11723 ===ca===
11724 !!end
11725
11726 !! test
11727 Section replacement test (section 9)
11728 !! options
11729 replace=9,"xxx"
11730 !! input
11731 start
11732 ==a==
11733 ===aa===
11734 ====aaa====
11735 ==b==
11736 ===ba===
11737 ===bb===
11738 ====bba====
11739 ===bc===
11740 ==c==
11741 ===ca===
11742 !! result
11743 start
11744 ==a==
11745 ===aa===
11746 ====aaa====
11747 ==b==
11748 ===ba===
11749 ===bb===
11750 ====bba====
11751 ===bc===
11752 xxx
11753 !! end
11754
11755 !! test
11756 Section replacement test (section 10)
11757 !! options
11758 replace=10,"xxx"
11759 !! input
11760 start
11761 ==a==
11762 ===aa===
11763 ====aaa====
11764 ==b==
11765 ===ba===
11766 ===bb===
11767 ====bba====
11768 ===bc===
11769 ==c==
11770 ===ca===
11771 !! result
11772 start
11773 ==a==
11774 ===aa===
11775 ====aaa====
11776 ==b==
11777 ===ba===
11778 ===bb===
11779 ====bba====
11780 ===bc===
11781 ==c==
11782 xxx
11783 !! end
11784
11785 !! test
11786 Section replacement test with initial whitespace (bug 13728)
11787 !! options
11788 replace=2,"xxx"
11789 !! input
11790 Preformatted initial line
11791 ==a==
11792 ===a===
11793 !! result
11794 Preformatted initial line
11795 ==a==
11796 xxx
11797 !! end
11798
11799
11800 !! test
11801 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11802 !! options
11803 section=1
11804 !! input
11805 ==a==
11806 a
11807 !! result
11808 ==a==
11809 a
11810 !! end
11811
11812 !! test
11813 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11814 !! options
11815 section=1
11816 !! input
11817 ==a==
11818 a
11819 !! result
11820 ==a==
11821 a
11822 !! end
11823
11824
11825 !! test
11826 Section extraction, <pre> around bogus header (bug 10309)
11827 !! options
11828 noxml section=2
11829 !! input
11830 == Section One ==
11831 <pre>
11832 =======
11833 </pre>
11834
11835 == Section Two ==
11836 stuff
11837 !! result
11838 == Section Two ==
11839 stuff
11840 !! end
11841
11842 !! test
11843 Section replacement, <pre> around bogus header (bug 10309)
11844 !! options
11845 noxml replace=2,"xxx"
11846 !! input
11847 == Section One ==
11848 <pre>
11849 =======
11850 </pre>
11851
11852 == Section Two ==
11853 stuff
11854 !! result
11855 == Section One ==
11856 <pre>
11857 =======
11858 </pre>
11859
11860 xxx
11861 !! end
11862
11863
11864
11865 !! test
11866 Handling of &#x0A; in URLs
11867 !! input
11868 **irc://&#x0A;a
11869 !! result
11870 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11871 </li></ul>
11872 </li></ul>
11873
11874 !!end
11875
11876 !! test
11877 5 quotes, code coverage +1 line (php)
11878 !! options
11879 php
11880 !! input
11881 '''''
11882 !! result
11883 !! end
11884 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11885 !! test
11886 5 quotes, code coverage +1 line (parsoid)
11887 !! options
11888 parsoid
11889 !! input
11890 '''''
11891 !! result
11892 <p><i><b></b></i></p>
11893 !! end
11894
11895 !! test
11896 Special:Search page linking.
11897 !! input
11898 {{Special:search}}
11899 !! result
11900 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11901 </p>
11902 !! end
11903
11904 !! test
11905 Say the magic word
11906 !! input
11907 * {{PAGENAME}}
11908 * {{BASEPAGENAME}}
11909 * {{SUBPAGENAME}}
11910 * {{SUBPAGENAMEE}}
11911 * {{ROOTPAGENAME}}
11912 * {{ROOTPAGENAMEE}}
11913 * {{BASEPAGENAME}}
11914 * {{BASEPAGENAMEE}}
11915 * {{TALKPAGENAME}}
11916 * {{TALKPAGENAMEE}}
11917 * {{SUBJECTPAGENAME}}
11918 * {{SUBJECTPAGENAMEE}}
11919 * {{NAMESPACEE}}
11920 * {{NAMESPACE}}
11921 * {{TALKSPACE}}
11922 * {{TALKSPACEE}}
11923 * {{SUBJECTSPACE}}
11924 * {{SUBJECTSPACEE}}
11925 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11926 !! result
11927 <ul><li> Parser test
11928 </li><li> Parser test
11929 </li><li> Parser test
11930 </li><li> Parser_test
11931 </li><li> Parser test
11932 </li><li> Parser_test
11933 </li><li> Parser test
11934 </li><li> Parser_test
11935 </li><li> Talk:Parser test
11936 </li><li> Talk:Parser_test
11937 </li><li> Parser test
11938 </li><li> Parser_test
11939 </li><li>
11940 </li><li>
11941 </li><li> Talk
11942 </li><li> Talk
11943 </li><li>
11944 </li><li>
11945 </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>
11946 </li></ul>
11947
11948 !! end
11949 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11950
11951 !! test
11952 Gallery
11953 !! input
11954 <gallery>
11955 image1.png |
11956 image2.gif|||||
11957
11958 image3|
11959 image4 |300px| centre
11960 image5.svg| http://///////
11961 [[x|xx]]]]
11962 * image6
11963 </gallery>
11964 !! result
11965 <ul class="gallery">
11966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11967 <div style="height: 150px;">Image1.png</div>
11968 <div class="gallerytext">
11969 </div>
11970 </div></li>
11971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11972 <div style="height: 150px;">Image2.gif</div>
11973 <div class="gallerytext">
11974 <p>||||
11975 </p>
11976 </div>
11977 </div></li>
11978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11979 <div style="height: 150px;">Image3</div>
11980 <div class="gallerytext">
11981 </div>
11982 </div></li>
11983 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11984 <div style="height: 150px;">Image4</div>
11985 <div class="gallerytext">
11986 <p>300px| centre
11987 </p>
11988 </div>
11989 </div></li>
11990 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11991 <div style="height: 150px;">Image5.svg</div>
11992 <div class="gallerytext">
11993 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11994 </p>
11995 </div>
11996 </div></li>
11997 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11998 <div style="height: 150px;">* image6</div>
11999 <div class="gallerytext">
12000 </div>
12001 </div></li>
12002 </ul>
12003
12004 !! end
12005
12006 !! test
12007 Gallery (with options)
12008 !! input
12009 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12010 File:Nonexistant.jpg|caption
12011 File:Nonexistant.jpg
12012 image:foobar.jpg|some '''caption''' [[Main Page]]
12013 image:foobar.jpg
12014 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12015 </gallery>
12016 !! result
12017 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12018 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12019 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12020 <div style="height: 70px;">Nonexistant.jpg</div>
12021 <div class="gallerytext">
12022 <p>caption
12023 </p>
12024 </div>
12025 </div></li>
12026 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12027 <div style="height: 70px;">Nonexistant.jpg</div>
12028 <div class="gallerytext">
12029 </div>
12030 </div></li>
12031 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12032 <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>
12033 <div class="gallerytext">
12034 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12035 </p>
12036 </div>
12037 </div></li>
12038 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12039 <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>
12040 <div class="gallerytext">
12041 </div>
12042 </div></li>
12043 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12044 <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>
12045 <div class="gallerytext">
12046 <p>Blabla|blabla.
12047 </p>
12048 </div>
12049 </div></li>
12050 </ul>
12051
12052 !! end
12053
12054 !! test
12055 Gallery with wikitext inside caption
12056 !! input
12057 <gallery>
12058 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12059 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12060 </gallery>
12061 !! result
12062 <ul class="gallery">
12063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12064 <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>
12065 <div class="gallerytext">
12066 <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>
12067 </p>
12068 </div>
12069 </div></li>
12070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12071 <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>
12072 <div class="gallerytext">
12073 <p>This is a test template
12074 </p>
12075 </div>
12076 </div></li>
12077 </ul>
12078
12079 !! end
12080
12081 !! test
12082 gallery (with showfilename option)
12083 !! input
12084 <gallery showfilename>
12085 File:Nonexistant.jpg|caption
12086 File:Nonexistant.jpg
12087 image:foobar.jpg|some '''caption''' [[Main Page]]
12088 File:Foobar.jpg
12089 </gallery>
12090 !! result
12091 <ul class="gallery">
12092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12093 <div style="height: 150px;">Nonexistant.jpg</div>
12094 <div class="gallerytext">
12095 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12096 caption
12097 </p>
12098 </div>
12099 </div></li>
12100 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12101 <div style="height: 150px;">Nonexistant.jpg</div>
12102 <div class="gallerytext">
12103 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12104 </p>
12105 </div>
12106 </div></li>
12107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12108 <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>
12109 <div class="gallerytext">
12110 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12111 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12112 </p>
12113 </div>
12114 </div></li>
12115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12116 <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>
12117 <div class="gallerytext">
12118 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12119 </p>
12120 </div>
12121 </div></li>
12122 </ul>
12123
12124 !! end
12125
12126 !! test
12127 Gallery (with namespace-less filenames)
12128 !! input
12129 <gallery>
12130 File:Nonexistant.jpg
12131 Nonexistant.jpg
12132 image:foobar.jpg
12133 foobar.jpg
12134 </gallery>
12135 !! result
12136 <ul class="gallery">
12137 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12138 <div style="height: 150px;">Nonexistant.jpg</div>
12139 <div class="gallerytext">
12140 </div>
12141 </div></li>
12142 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12143 <div style="height: 150px;">Nonexistant.jpg</div>
12144 <div class="gallerytext">
12145 </div>
12146 </div></li>
12147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12148 <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>
12149 <div class="gallerytext">
12150 </div>
12151 </div></li>
12152 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12153 <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>
12154 <div class="gallerytext">
12155 </div>
12156 </div></li>
12157 </ul>
12158
12159 !! end
12160
12161 !! test
12162 HTML Hex character encoding (spells the word "JavaScript")
12163 !! input
12164 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12165 !! result
12166 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12167 </p>
12168 !! end
12169
12170 !! test
12171 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12172 !! input
12173 &#xsee;&#XSEE;
12174 !! result
12175 <p>&amp;#xsee;&amp;#XSEE;
12176 </p>
12177 !! end
12178
12179 !! test
12180 HTML Hex character encoding mixed case
12181 !! input
12182 &#xEE;&#Xee;
12183 !! result
12184 <p>&#xee;&#xee;
12185 </p>
12186 !! end
12187
12188 !! test
12189 __FORCETOC__ override
12190 !! input
12191 __NEWSECTIONLINK__
12192 __FORCETOC__
12193 !! result
12194 <p><br />
12195 </p>
12196 !! end
12197
12198 !! test
12199 ISBN code coverage
12200 !! input
12201 ISBN 978-0-1234-56&#x20;789
12202 !! result
12203 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12204 </p>
12205 !! end
12206
12207 !! test
12208 ISBN followed by 5 spaces
12209 !! input
12210 ISBN
12211 !! result
12212 <p>ISBN
12213 </p>
12214 !! end
12215
12216 !! test
12217 Double ISBN
12218 !! input
12219 ISBN ISBN 1234567890
12220 !! result
12221 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12222 </p>
12223 !! end
12224
12225 !! test
12226 Bug 22905: <abbr> followed by ISBN followed by </a>
12227 !! input
12228 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12229 !! result
12230 <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>
12231 </p>
12232 !! end
12233
12234 !! test
12235 Double RFC
12236 !! input
12237 RFC RFC 1234
12238 !! result
12239 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12240 </p>
12241 !! end
12242
12243 !! test
12244 Double RFC with a wiki link
12245 !! input
12246 RFC [[RFC 1234]]
12247 !! result
12248 <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>
12249 </p>
12250 !! end
12251
12252 !! test
12253 RFC code coverage
12254 !! input
12255 RFC 983&#x20;987
12256 !! result
12257 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12258 </p>
12259 !! end
12260
12261 !! test
12262 Centre-aligned image
12263 !! input
12264 [[Image:foobar.jpg|centre]]
12265 !! result
12266 <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>
12267
12268 !!end
12269
12270 !! test
12271 None-aligned image
12272 !! input
12273 [[Image:foobar.jpg|none]]
12274 !! result
12275 <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>
12276
12277 !!end
12278
12279 !! test
12280 Width + Height sized image (using px) (height is ignored)
12281 !! input
12282 [[Image:foobar.jpg|640x480px]]
12283 !! result
12284 <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>
12285 </p>
12286 !!end
12287
12288 !! test
12289 Width-sized image (using px, no following whitespace)
12290 !! input
12291 [[Image:foobar.jpg|640px]]
12292 !! result
12293 <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>
12294 </p>
12295 !!end
12296
12297 !! test
12298 Width-sized image (using px, with following whitespace - test regression from r39467)
12299 !! input
12300 [[Image:foobar.jpg|640px ]]
12301 !! result
12302 <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>
12303 </p>
12304 !!end
12305
12306 !! test
12307 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12308 !! input
12309 [[Image:foobar.jpg| 640px]]
12310 !! result
12311 <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>
12312 </p>
12313 !!end
12314
12315 !! test
12316 Another italics / bold test
12317 !! input
12318 ''' ''x'
12319 !! result
12320 <pre>'<i> </i>x'
12321 </pre>
12322 !!end
12323
12324 # Note the results may be incorrect, as parserTest output included this:
12325 # XML error: Mismatched tag at byte 6120:
12326 # ...<dd> </dt></dl> </dd...
12327 !! test
12328 dt/dd/dl test
12329 !! options
12330 disabled
12331 !! input
12332 :;;;::
12333 !! result
12334 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12335 </dd></dl>
12336 </dd></dl>
12337 </dt></dl>
12338 </dt></dl>
12339 </dt></dl>
12340 </dd></dl>
12341
12342 !!end
12343
12344
12345 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12346 !! test
12347 Images with the "|" character in the comment
12348 !! input
12349 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12350 !! result
12351 <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>
12352
12353 !!end
12354
12355 !! test
12356 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12357 !! input
12358 <html><script>alert(1);</script></html>
12359 !! result
12360 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12361 </p>
12362 !! end
12363
12364 !! test
12365 HTML with raw HTML ($wgRawHtml==true)
12366 !! options
12367 wgRawHtml=1
12368 !! input
12369 <html><script>alert(1);</script></html>
12370 !! result
12371 <p><script>alert(1);</script>
12372 </p>
12373 !! end
12374
12375 !! test
12376 Parents of subpages, one level up
12377 !! options
12378 subpage title=[[Subpage test/L1/L2/L3]]
12379 !! input
12380 [[../|L2]]
12381 !! result
12382 <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>
12383 </p>
12384 !! end
12385
12386
12387 !! test
12388 Parents of subpages, one level up, not named
12389 !! options
12390 subpage title=[[Subpage test/L1/L2/L3]]
12391 !! input
12392 [[../]]
12393 !! result
12394 <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>
12395 </p>
12396 !! end
12397
12398
12399
12400 !! test
12401 Parents of subpages, two levels up
12402 !! options
12403 subpage title=[[Subpage test/L1/L2/L3]]
12404 !! input
12405 [[../../|L1]]2
12406
12407 [[../../|L1]]l
12408 !! result
12409 <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
12410 </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>
12411 </p>
12412 !! end
12413
12414 !! test
12415 Parents of subpages, two levels up, without trailing slash or name.
12416 !! options
12417 subpage title=[[Subpage test/L1/L2/L3]]
12418 !! input
12419 [[../..]]
12420 !! result
12421 <p>[[../..]]
12422 </p>
12423 !! end
12424
12425 !! test
12426 Parents of subpages, two levels up, with lots of extra trailing slashes.
12427 !! options
12428 subpage title=[[Subpage test/L1/L2/L3]]
12429 !! input
12430 [[../../////]]
12431 !! result
12432 <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>
12433 </p>
12434 !! end
12435
12436 !! article
12437 Subpage test/L1/L2/L3Sibling
12438 !! text
12439 Sibling article
12440 !! endarticle
12441
12442 !! test
12443 Transclusion of a sibling page (one level up)
12444 !! options
12445 subpage title=[[Subpage test/L1/L2/L3]]
12446 !! input
12447 {{../L3Sibling}}
12448 !! result
12449 <p>Sibling article
12450 </p>
12451 !! end
12452
12453 !! test
12454 Transclusion of a child page
12455 !! options
12456 subpage title=[[Subpage test/L1/L2]]
12457 !! input
12458 {{/L3Sibling}}
12459 !! result
12460 <p>Sibling article
12461 </p>
12462 !! end
12463
12464 !! test
12465 Non-transclusion because of too many up levels
12466 !! options
12467 subpage title=[[Subpage test/L1/L2/L3]]
12468 !! input
12469 {{../../../../More than parent}}
12470 !! result
12471 <p>{{../../../../More than parent}}
12472 </p>
12473 !! end
12474
12475 !! test
12476 Definition list code coverage
12477 !! input
12478 ; title : def
12479 ; title : def
12480 ;title: def
12481 !! result
12482 <dl><dt> title &#160;</dt><dd> def
12483 </dd><dt> title&#160;</dt><dd> def
12484 </dd><dt>title</dt><dd> def
12485 </dd></dl>
12486
12487 !! end
12488
12489 !! test
12490 Don't fall for the self-closing div
12491 !! input
12492 <div>hello world</div/>
12493 !! result
12494 <div>hello world</div>
12495
12496 !! end
12497
12498 !! test
12499 MSGNW magic word
12500 !! input
12501 {{MSGNW:msg}}
12502 !! result
12503 <p>&#91;&#91;:Template:Msg&#93;&#93;
12504 </p>
12505 !! end
12506
12507 !! test
12508 RAW magic word
12509 !! input
12510 {{RAW:QUERTY}}
12511 !! result
12512 <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>
12513 </p>
12514 !! end
12515
12516 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12517 !! test
12518 Always escape literal '>' in output, not just after '<'
12519 !! input
12520 ><>
12521 !! result
12522 <p>&gt;&lt;&gt;
12523 </p>
12524 !! end
12525
12526 !! test
12527 Template caching
12528 !! input
12529 {{Test}}
12530 {{Test}}
12531 !! result
12532 <p>This is a test template
12533 This is a test template
12534 </p>
12535 !! end
12536
12537
12538 !! article
12539 MediaWiki:Fake
12540 !! text
12541 ==header==
12542 !! endarticle
12543
12544 !! test
12545 Inclusion of !userCanEdit() content
12546 !! input
12547 {{MediaWiki:Fake}}
12548 !! result
12549 <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>
12550
12551 !! end
12552
12553
12554 !! test
12555 Out-of-order TOC heading levels
12556 !! input
12557 ==2==
12558 ======6======
12559 ===3===
12560 =1=
12561 =====5=====
12562 ==2==
12563 !! result
12564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12565 <ul>
12566 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12567 <ul>
12568 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12569 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12570 </ul>
12571 </li>
12572 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12573 <ul>
12574 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12575 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12576 </ul>
12577 </li>
12578 </ul>
12579 </div>
12580 <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>
12581 <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>
12582 <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>
12583 <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>
12584 <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>
12585 <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>
12586
12587 !! end
12588
12589
12590 !! test
12591 ISBN with a dummy number
12592 !! input
12593 ISBN ---
12594 !! result
12595 <p>ISBN ---
12596 </p>
12597 !! end
12598
12599
12600 !! test
12601 ISBN with space-delimited number
12602 !! input
12603 ISBN 92 9017 032 8
12604 !! result
12605 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12606 </p>
12607 !! end
12608
12609
12610 !! test
12611 ISBN with multiple spaces, no number
12612 !! input
12613 ISBN foo
12614 !! result
12615 <p>ISBN foo
12616 </p>
12617 !! end
12618
12619
12620 !! test
12621 ISBN length
12622 !! input
12623 ISBN 123456789
12624
12625 ISBN 1234567890
12626
12627 ISBN 12345678901
12628 !! result
12629 <p>ISBN 123456789
12630 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12631 </p><p>ISBN 12345678901
12632 </p>
12633 !! end
12634
12635
12636 !! test
12637 ISBN with trailing year (bug 8110)
12638 !! input
12639 ISBN 1-234-56789-0 - 2006
12640
12641 ISBN 1 234 56789 0 - 2006
12642 !! result
12643 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12644 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12645 </p>
12646 !! end
12647
12648
12649 !! test
12650 anchorencode
12651 !! input
12652 {{anchorencode:foo bar©#%n}}
12653 !! result
12654 <p>foo_bar.C2.A9.23.25n
12655 </p>
12656 !! end
12657
12658 !! test
12659 anchorencode trims spaces
12660 !! input
12661 {{anchorencode: __pretty__please__}}
12662 !! result
12663 <p>pretty_please
12664 </p>
12665 !! end
12666
12667 !! test
12668 anchorencode deals with links
12669 !! input
12670 {{anchorencode: [[hello|world]] [[hi]]}}
12671 !! result
12672 <p>world_hi
12673 </p>
12674 !! end
12675
12676 !! test
12677 anchorencode deals with templates
12678 !! input
12679 {{anchorencode: {{Foo}} }}
12680 !! result
12681 <p>FOO
12682 </p>
12683 !! end
12684
12685 !! test
12686 anchorencode encodes like the TOC generator: (bug 18431)
12687 !! input
12688 === _ +:.3A%3A&&amp;]] ===
12689 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12690 __NOEDITSECTION__
12691 !! result
12692 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12693 <p>.2B:.3A.253A.26.26.5D.5D
12694 </p>
12695 !! end
12696
12697 # Expected output in the following test is not necessarily expected (there
12698 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12699 # only testing for well-formedness.
12700 !! test
12701 Bug 6200: blockquotes and paragraph formatting
12702 !! input
12703 <blockquote>
12704 foo
12705 </blockquote>
12706
12707 bar
12708
12709 baz
12710 !! result
12711 <blockquote>
12712 foo
12713 </blockquote>
12714 <p>bar
12715 </p>
12716 <pre>baz
12717 </pre>
12718 !! end
12719
12720 !! test
12721 Bug 8293: Use of center tag ruins paragraph formatting
12722 !! input
12723 <center>
12724 foo
12725 </center>
12726
12727 bar
12728
12729 baz
12730 !! result
12731 <center>
12732 <p>foo
12733 </p>
12734 </center>
12735 <p>bar
12736 </p>
12737 <pre>baz
12738 </pre>
12739 !! end
12740
12741 !!test
12742 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12743 !!options
12744 php
12745 !!input
12746 <span><s>x</span></s>
12747 !!result
12748 <p><span><s>x&lt;/span&gt;</s></span>
12749 </p>
12750 !!end
12751
12752 !!test
12753 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12754 !!options
12755 parsoid
12756 !!input
12757 <span><s>x</span></s>
12758 !!result
12759 <p><span><s>x</s></span><s></s>
12760 </p>
12761 !!end
12762
12763 ###
12764 ### Language variants related tests
12765 ###
12766 !! test
12767 Self-link in language variants
12768 !! options
12769 title=[[Dunav]] language=sr
12770 !! input
12771 Both [[Dunav]] and [[Дунав]] are names for this river.
12772 !! result
12773 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12774 </p>
12775 !!end
12776
12777 !! article
12778 Дуна
12779 !! text
12780 content
12781 !! endarticle
12782
12783 !! test
12784 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12785 !! options
12786 title=[[Duna]] language=sr
12787 !! input
12788 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12789 !! result
12790 <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.
12791 </p>
12792 !! end
12793
12794 !! test
12795 Link to pages in language variants
12796 !! options
12797 language=sr
12798 !! input
12799 Main Page can be written as [[Маин Паге]]
12800 !! result
12801 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12802 </p>
12803 !!end
12804
12805
12806 !! test
12807 Multiple links to pages in language variants
12808 !! options
12809 language=sr
12810 !! input
12811 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12812 !! result
12813 <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>.
12814 </p>
12815 !!end
12816
12817
12818 !! test
12819 Simple template in language variants
12820 !! options
12821 language=sr
12822 !! input
12823 {{тест}}
12824 !! result
12825 <p>This is a test template
12826 </p>
12827 !! end
12828
12829
12830 !! test
12831 Template with explicit namespace in language variants
12832 !! options
12833 language=sr
12834 !! input
12835 {{Template:тест}}
12836 !! result
12837 <p>This is a test template
12838 </p>
12839 !! end
12840
12841
12842 !! test
12843 Basic test for template parameter in language variants
12844 !! options
12845 language=sr
12846 !! input
12847 {{парамтест|param=foo}}
12848 !! result
12849 <p>This is a test template with parameter foo
12850 </p>
12851 !! end
12852
12853
12854 !! test
12855 Simple category in language variants
12856 !! options
12857 language=sr cat
12858 !! input
12859 [[Category:МедиаWики Усер'с Гуиде]]
12860 !! result
12861 <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>
12862 !! end
12863
12864
12865 !! article
12866 Category:分类
12867 !! text
12868 blah
12869 !! endarticle
12870
12871 !! article
12872 Category:分類
12873 !! text
12874 blah
12875 !! endarticle
12876
12877 !! test
12878 Don't convert blue categorylinks to another variant (bug 33210)
12879 !! options
12880 language=zh cat
12881 !! input
12882 [[A]][[Category:分类]]
12883 !! result
12884 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12885 !! end
12886
12887
12888 !! test
12889 Stripping -{}- tags (language variants)
12890 !! options
12891 language=sr
12892 !! input
12893 Latin proverb: -{Ne nuntium necare}-
12894 !! result
12895 <p>Latin proverb: Ne nuntium necare
12896 </p>
12897 !! end
12898
12899
12900 !! test
12901 Prevent conversion with -{}- tags (language variants)
12902 !! options
12903 language=sr variant=sr-ec
12904 !! input
12905 Latinski: -{Ne nuntium necare}-
12906 !! result
12907 <p>Латински: Ne nuntium necare
12908 </p>
12909 !! end
12910
12911
12912 !! test
12913 Prevent conversion of text with -{}- tags (language variants)
12914 !! options
12915 language=sr variant=sr-ec
12916 !! input
12917 Latinski: -{Ne nuntium necare}-
12918 !! result
12919 <p>Латински: Ne nuntium necare
12920 </p>
12921 !! end
12922
12923
12924 !! test
12925 Prevent conversion of links with -{}- tags (language variants)
12926 !! options
12927 language=sr variant=sr-ec
12928 !! input
12929 -{[[Main Page]]}-
12930 !! result
12931 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12932 </p>
12933 !! end
12934
12935
12936 !! test
12937 -{}- tags within headlines (within html for parserConvert())
12938 !! options
12939 language=sr variant=sr-ec
12940 !! input
12941 == -{Naslov}- ==
12942 !! result
12943 <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>
12944
12945 !! end
12946
12947
12948 !! test
12949 Explicit definition of language variant alternatives
12950 !! options
12951 language=zh variant=zh-tw
12952 !! input
12953 -{zh:China;zh-tw:Taiwan}-, not China
12954 !! result
12955 <p>Taiwan, not China
12956 </p>
12957 !! end
12958
12959
12960 !! test
12961 Conversion around HTML tags
12962 !! options
12963 language=sr variant=sr-ec
12964 !! input
12965 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12966 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12967 !! result
12968 <p>
12969 <span title="ЛаCтин">ски</span>
12970 </p>
12971 !! end
12972
12973
12974 !! test
12975 Explicit session-wise language variant mapping (A flag and - flag)
12976 !! options
12977 language=zh variant=zh-tw
12978 !! input
12979 Taiwan is not China.
12980 But -{A|zh:China;zh-tw:Taiwan}- is China,
12981 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12982 and -{China}- is China.
12983 !! result
12984 <p>Taiwan is not China.
12985 But Taiwan is Taiwan,
12986 (This should be stripped!)
12987 and China is China.
12988 </p>
12989 !! end
12990
12991 !! test
12992 Explicit session-wise language variant mapping (H flag for hide)
12993 !! options
12994 language=zh variant=zh-tw
12995 !! input
12996 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12997 Taiwan is China.
12998 !! result
12999 <p>(This should be stripped!)
13000 Taiwan is Taiwan.
13001 </p>
13002 !! end
13003
13004 !! test
13005 Adding explicit conversion rule for title (T flag)
13006 !! options
13007 language=zh variant=zh-tw showtitle
13008 !! input
13009 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13010 !! result
13011 Taiwan
13012 <p>Should be stripped!
13013 </p>
13014 !! end
13015
13016 !! test
13017 Testing that changing the language variant here in the tests actually works
13018 !! options
13019 language=zh variant=zh showtitle
13020 !! input
13021 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13022 !! result
13023 China
13024 <p>Should be stripped!
13025 </p>
13026 !! end
13027
13028 !! test
13029 Recursive conversion of alt and title attrs shouldn't clear converter state
13030 !! options
13031 language=zh variant=zh-cn showtitle
13032 !! input
13033 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13034 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13035 !! result
13036 China
13037 <p>
13038 Should be stripped<span title="Exclamation">!</span>
13039 </p>
13040 !! end
13041
13042 !! test
13043 Bug 24072: more test on conversion rule for title
13044 !! options
13045 language=zh variant=zh-tw showtitle
13046 !! input
13047 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13048 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13049 !! result
13050 Taiwan
13051 <p>This should be stripped!
13052 This won't take interferes with the title rule.
13053 </p>
13054 !! end
13055
13056 !! test
13057 Partly disable title conversion if variant == main language code
13058 !! options
13059 language=zh variant=zh title=[[ZH]] showtitle
13060 !! input
13061 -{T|zh-cn:CN;zh-tw:TW}-
13062 !! result
13063 ZH
13064 <p>
13065 </p>
13066 !! end
13067
13068 !! test
13069 Partly disable title conversion if variant == main language code, more
13070 !! options
13071 language=zh variant=zh title=[[ZH]] showtitle
13072 !! input
13073 -{T|TW}-
13074 !! result
13075 ZH
13076 <p>
13077 </p>
13078 !! end
13079
13080 !! test
13081 Raw output of variant escape tags (R flag)
13082 !! options
13083 language=zh variant=zh-tw
13084 !! input
13085 Raw: -{R|zh:China;zh-tw:Taiwan}-
13086 !! result
13087 <p>Raw: zh:China;zh-tw:Taiwan
13088 </p>
13089 !! end
13090
13091 !! test
13092 Nested using of manual convert syntax
13093 !! options
13094 language=zh variant=zh-hk
13095 !! input
13096 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13097 !! result
13098 <p>Nested: Hello Hong Kong!
13099 </p>
13100 !! end
13101
13102 !! test
13103 Proper conversion of text in external links
13104 !! options
13105 language=sr variant=sr-ec
13106 !! input
13107 http://www.google.com
13108 gopher://www.google.com
13109 [http://www.google.com http://www.google.com]
13110 [gopher://www.google.com gopher://www.google.com]
13111 [https://www.google.com irc://www.google.com]
13112 [ftp://www.google.com www.google.com/ftp://dir]
13113 [//www.google.com www.google.com]
13114 !! result
13115 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13116 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13117 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13118 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13119 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13120 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13121 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13122 </p>
13123 !! end
13124
13125 !! test
13126 Do not convert roman numbers to language variants
13127 !! options
13128 language=sr variant=sr-ec
13129 !! input
13130 Fridrih IV je car.
13131 !! result
13132 <p>Фридрих IV је цар.
13133 </p>
13134 !! end
13135
13136 !! test
13137 Unclosed language converter markup "-{"
13138 !! options
13139 language=sr
13140 !! input
13141 -{T|hello
13142 !! result
13143 <p>-{T|hello
13144 </p>
13145 !! end
13146
13147 !! test
13148 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13149 !! options
13150 language=sr
13151 !! input
13152 -{R|=&gt;}-
13153 !! result
13154 <p>=&gt;
13155 </p>
13156 !!end
13157
13158 !!article
13159 Template:Bullet
13160 !!text
13161 * Bar
13162 !!endarticle
13163
13164 !! test
13165 Bug 529: Uncovered bullet
13166 !! input
13167 * Foo {{bullet}}
13168 !! result
13169 <ul><li> Foo
13170 </li><li> Bar
13171 </li></ul>
13172
13173 !! end
13174
13175 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13176 # Templates in Wikipedia rely on this behavior, as tidy has always been
13177 # enabled there. These tests are normally run *without* tidy, so specify the
13178 # full output here.
13179 # To test realistic parsing behavior, apply a tidy-like transformation to both
13180 # the expected output and your parser's output.
13181 !! test
13182 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13183 !! input
13184 ******* Foo {{bullet}}
13185 !! result
13186 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13187 </li></ul>
13188 </li></ul>
13189 </li></ul>
13190 </li></ul>
13191 </li></ul>
13192 </li></ul>
13193 </li><li> Bar
13194 </li></ul>
13195
13196 !! end
13197
13198 !! test
13199 Bug 529: Uncovered table already at line-start
13200 !! input
13201 x
13202
13203 {{table}}
13204 y
13205 !! result
13206 <p>x
13207 </p>
13208 <table>
13209 <tr>
13210 <td> 1 </td>
13211 <td> 2
13212 </td></tr>
13213 <tr>
13214 <td> 3 </td>
13215 <td> 4
13216 </td></tr></table>
13217 <p>y
13218 </p>
13219 !! end
13220
13221 !! test
13222 Bug 529: Uncovered bullet in parser function result
13223 !! input
13224 * Foo {{lc:{{bullet}} }}
13225 !! result
13226 <ul><li> Foo
13227 </li><li> bar
13228 </li></ul>
13229
13230 !! end
13231
13232 !! test
13233 Bug 5678: Double-parsed template argument
13234 !! input
13235 {{lc:{{{1}}}|hello}}
13236 !! result
13237 <p>{{{1}}}
13238 </p>
13239 !! end
13240
13241 !! test
13242 Bug 5678: Double-parsed template invocation
13243 !! input
13244 {{lc:{{paramtest {{!}} param = hello }} }}
13245 !! result
13246 <p>{{paramtest | param = hello }}
13247 </p>
13248 !! end
13249
13250 !! test
13251 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13252 !! options
13253 language=cs
13254 title=[[Main Page]]
13255 !! input
13256 {{PRVNÍVELKÉ:ěščř}}
13257 {{prvnívelké:ěščř}}
13258 {{PRVNÍMALÉ:ěščř}}
13259 {{prvnímalé:ěščř}}
13260 {{MALÁ:ěščř}}
13261 {{malá:ěščř}}
13262 {{VELKÁ:ěščř}}
13263 {{velká:ěščř}}
13264 !! result
13265 <p>Ěščř
13266 Ěščř
13267 ěščř
13268 ěščř
13269 ěščř
13270 ěščř
13271 ĚŠČŘ
13272 ĚŠČŘ
13273 </p>
13274 !! end
13275
13276 !! test
13277 Morwen/13: Unclosed link followed by heading
13278 !! input
13279 [[link
13280 ==heading==
13281 !! result
13282 <p>[[link
13283 </p>
13284 <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>
13285
13286 !! end
13287
13288 !! test
13289 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13290 !! input
13291 {{foo|
13292 =heading=
13293 !! result
13294 <p>{{foo|
13295 </p>
13296 <h1><span class="mw-headline" id="heading">heading</span></h1>
13297
13298 !! end
13299
13300 !! test
13301 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13302 !! input
13303 {{foo|
13304 ==heading==
13305 !! result
13306 <p>{{foo|
13307 </p>
13308 <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>
13309
13310 !! end
13311
13312 !! test
13313 Tildes in comments
13314 !! options
13315 pst
13316 !! input
13317 <!-- ~~~~ -->
13318 !! result
13319 <!-- ~~~~ -->
13320 !! end
13321
13322 !! test
13323 Paragraphs inside divs (no extra line breaks)
13324 !! input
13325 <div>Line one
13326
13327 Line two</div>
13328 !! result
13329 <div>Line one
13330 Line two</div>
13331
13332 !! end
13333
13334 !! test
13335 Paragraphs inside divs (extra line break on open)
13336 !! input
13337 <div>
13338 Line one
13339
13340 Line two</div>
13341 !! result
13342 <div>
13343 <p>Line one
13344 </p>
13345 Line two</div>
13346
13347 !! end
13348
13349 !! test
13350 Paragraphs inside divs (extra line break on close)
13351 !! input
13352 <div>Line one
13353
13354 Line two
13355 </div>
13356 !! result
13357 <div>Line one
13358 <p>Line two
13359 </p>
13360 </div>
13361
13362 !! end
13363
13364 !! test
13365 Paragraphs inside divs (extra line break on open and close)
13366 !! input
13367 <div>
13368 Line one
13369
13370 Line two
13371 </div>
13372 !! result
13373 <div>
13374 <p>Line one
13375 </p><p>Line two
13376 </p>
13377 </div>
13378
13379 !! end
13380
13381 !! test
13382 Nesting tags, paragraphs on lines which begin with <div>
13383 !! options
13384 disabled
13385 !! input
13386 <div></div><strong>A
13387 B</strong>
13388 !! result
13389 <div></div>
13390 <p><strong>A
13391 B</strong>
13392 </p>
13393 !! end
13394
13395 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13396 !! test
13397 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13398 !! options
13399 disabled
13400 !! input
13401 <blockquote>Line one
13402
13403 Line two</blockquote>
13404 !! result
13405 <blockquote>Line one
13406 Line two</blockquote>
13407
13408 !! end
13409
13410 !! test
13411 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13412 !! options
13413 disabled
13414 !! input
13415 <blockquote>
13416 Line one
13417
13418 Line two</blockquote>
13419 !! result
13420 <blockquote>
13421 <p>Line one
13422 </p>
13423 Line two</blockquote>
13424
13425 !! end
13426
13427 !! test
13428 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13429 !! options
13430 disabled
13431 !! input
13432 <blockquote>Line one
13433
13434 Line two
13435 </blockquote>
13436 !! result
13437 <blockquote>Line one
13438 <p>Line two
13439 </p>
13440 </blockquote>
13441
13442 !! end
13443
13444 !! test
13445 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13446 !! options
13447 disabled
13448 !! input
13449 <blockquote>
13450 Line one
13451
13452 Line two
13453 </blockquote>
13454 !! result
13455 <blockquote>
13456 <p>Line one
13457 </p><p>Line two
13458 </p>
13459 </blockquote>
13460
13461 !! end
13462
13463 !! test
13464 Paragraphs inside blockquotes/divs (no extra line breaks)
13465 !! input
13466 <blockquote><div>Line one
13467
13468 Line two</div></blockquote>
13469 !! result
13470 <blockquote><div>Line one
13471 Line two</div></blockquote>
13472
13473 !! end
13474
13475 !! test
13476 Paragraphs inside blockquotes/divs (extra line break on open)
13477 !! input
13478 <blockquote><div>
13479 Line one
13480
13481 Line two</div></blockquote>
13482 !! result
13483 <blockquote><div>
13484 <p>Line one
13485 </p>
13486 Line two</div></blockquote>
13487
13488 !! end
13489
13490 !! test
13491 Paragraphs inside blockquotes/divs (extra line break on close)
13492 !! input
13493 <blockquote><div>Line one
13494
13495 Line two
13496 </div></blockquote>
13497 !! result
13498 <blockquote><div>Line one
13499 <p>Line two
13500 </p>
13501 </div></blockquote>
13502
13503 !! end
13504
13505 !! test
13506 Paragraphs inside blockquotes/divs (extra line break on open and close)
13507 !! input
13508 <blockquote><div>
13509 Line one
13510
13511 Line two
13512 </div></blockquote>
13513 !! result
13514 <blockquote><div>
13515 <p>Line one
13516 </p><p>Line two
13517 </p>
13518 </div></blockquote>
13519
13520 !! end
13521
13522 !! test
13523 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13524 !! options
13525 wgLinkHolderBatchSize=0
13526 !! input
13527 [[meatball:1]]
13528 [[meatball:2]]
13529 [[meatball:3]]
13530 !! result
13531 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13532 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13533 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13534 </p>
13535 !! end
13536
13537 !! test
13538 Free external link invading image caption
13539 !! input
13540 [[Image:Foobar.jpg|thumb|http://x|hello]]
13541 !! result
13542 <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>
13543
13544 !! end
13545
13546 !! test
13547 Bug 15196: localised external link numbers
13548 !! options
13549 language=fa
13550 !! input
13551 [http://en.wikipedia.org/]
13552 !! result
13553 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13554 </p>
13555 !! end
13556
13557 !! test
13558 Multibyte character in padleft
13559 !! input
13560 {{padleft:-Hello|7|Æ}}
13561 !! result
13562 <p>Æ-Hello
13563 </p>
13564 !! end
13565
13566 !! test
13567 Multibyte character in padright
13568 !! input
13569 {{padright:Hello-|7|Æ}}
13570 !! result
13571 <p>Hello-Æ
13572 </p>
13573 !! end
13574
13575 !!test
13576 formatdate parser function
13577 !!input
13578 {{#formatdate:2009-03-24}}
13579 !! result
13580 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13581 </p>
13582 !! end
13583
13584 !!test
13585 formatdate parser function, with default format
13586 !!input
13587 {{#formatdate:2009-03-24|mdy}}
13588 !! result
13589 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13590 </p>
13591 !! end
13592
13593 !! test
13594 Spacing of numbers in formatted dates
13595 !! input
13596 {{#formatdate:January 15}}
13597 !! result
13598 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13599 </p>
13600 !! end
13601
13602 !! test
13603 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
13604 !! options
13605 language=nl title=[[MediaWiki:Common.css]]
13606 !! input
13607 {{#formatdate:2009-03-24|dmy}}
13608 !! result
13609 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13610 </p>
13611 !! end
13612
13613 #
13614 #
13615 #
13616
13617 #
13618 # Edit comments
13619 #
13620
13621 !! test
13622 Edit comment with link
13623 !! options
13624 comment
13625 !! input
13626 I like the [[Main Page]] a lot
13627 !! result
13628 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13629 !!end
13630
13631 !! test
13632 Edit comment with link and link text
13633 !! options
13634 comment
13635 !! input
13636 I like the [[Main Page|best pages]] a lot
13637 !! result
13638 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13639 !!end
13640
13641 !! test
13642 Edit comment with link and link text with suffix
13643 !! options
13644 comment
13645 !! input
13646 I like the [[Main Page|best page]]s a lot
13647 !! result
13648 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13649 !!end
13650
13651 !! test
13652 Edit comment with section link (non-local, eg in history list)
13653 !! options
13654 comment title=[[Main Page]]
13655 !! input
13656 /* External links */ removed bogus entries
13657 !! result
13658 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13659 !!end
13660
13661 !! test
13662 Edit comment with section link and text before it (non-local, eg in history list)
13663 !! options
13664 comment title=[[Main Page]]
13665 !! input
13666 pre-comment text /* External links */ removed bogus entries
13667 !! result
13668 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>
13669 !!end
13670
13671 !! test
13672 Edit comment with section link (local, eg in diff view)
13673 !! options
13674 comment local title=[[Main Page]]
13675 !! input
13676 /* External links */ removed bogus entries
13677 !! result
13678 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13679 !!end
13680
13681 !! test
13682 Edit comment with subpage link (bug 14080)
13683 !! options
13684 comment
13685 subpage
13686 title=[[Subpage test]]
13687 !! input
13688 Poked at a [[/subpage]] here...
13689 !! result
13690 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13691 !!end
13692
13693 !! test
13694 Edit comment with subpage link and link text (bug 14080)
13695 !! options
13696 comment
13697 subpage
13698 title=[[Subpage test]]
13699 !! input
13700 Poked at a [[/subpage|neat little page]] here...
13701 !! result
13702 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13703 !!end
13704
13705 !! test
13706 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13707 !! options
13708 comment
13709 title=[[Subpage test]]
13710 !! input
13711 Poked at a [[/subpage]] here...
13712 !! result
13713 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...
13714 !!end
13715
13716 !! test
13717 Edit comment with bare anchor link (local, as on diff)
13718 !! options
13719 comment
13720 local
13721 title=[[Main Page]]
13722 !!input
13723 [[#section]]
13724 !! result
13725 <a href="#section">#section</a>
13726 !! end
13727
13728 !! test
13729 Edit comment with bare anchor link (non-local, as on history)
13730 !! options
13731 comment
13732 title=[[Main Page]]
13733 !!input
13734 [[#section]]
13735 !! result
13736 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13737 !! end
13738
13739 !! test
13740 Anchor starting with underscore
13741 !!input
13742 [[#_ref|One]]
13743 !! result
13744 <p><a href="#_ref">One</a>
13745 </p>
13746 !! end
13747
13748 !! test
13749 Id starting with underscore
13750 !!input
13751 <div id="_ref"></div>
13752 !! result
13753 <div id="_ref"></div>
13754
13755 !! end
13756
13757 !! test
13758 Space normalisation on autocomment (bug 22784)
13759 !! options
13760 comment
13761 title=[[Main Page]]
13762 !!input
13763 /* __hello__world__ */
13764 !! result
13765 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13766 !! end
13767
13768 !! test
13769 percent-encoding and + signs in comments (Bug 26410)
13770 !! options
13771 comment
13772 !!input
13773 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13774 !! result
13775 <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>
13776 !! end
13777
13778 !! test
13779 Bad images - basic functionality
13780 !! options
13781 disabled
13782 !! input
13783 [[File:Bad.jpg]]
13784 !! result
13785 !! end
13786
13787 !! test
13788 Bad images - bug 16039: text after bad image disappears
13789 !! options
13790 disabled
13791 !! input
13792 Foo bar
13793 [[File:Bad.jpg]]
13794 Bar foo
13795 !! result
13796 <p>Foo bar
13797 </p><p>Bar foo
13798 </p>
13799 !! end
13800
13801 !! test
13802 Verify that displaytitle works (bug #22501) no displaytitle
13803 !! options
13804 showtitle
13805 !! config
13806 wgAllowDisplayTitle=true
13807 wgRestrictDisplayTitle=false
13808 !! input
13809 this is not the the title
13810 !! result
13811 Parser test
13812 <p>this is not the the title
13813 </p>
13814 !! end
13815
13816 !! test
13817 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13818 !! options
13819 showtitle
13820 title=[[Screen]]
13821 !! config
13822 wgAllowDisplayTitle=true
13823 wgRestrictDisplayTitle=false
13824 !! input
13825 this is not the the title
13826 {{DISPLAYTITLE:whatever}}
13827 !! result
13828 whatever
13829 <p>this is not the the title
13830 </p>
13831 !! end
13832
13833 !! test
13834 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13835 !! options
13836 showtitle
13837 title=[[Screen]]
13838 !! config
13839 wgAllowDisplayTitle=true
13840 wgRestrictDisplayTitle=true
13841 !! input
13842 this is not the the title
13843 {{DISPLAYTITLE:whatever}}
13844 !! result
13845 Screen
13846 <p>this is not the the title
13847 </p>
13848 !! end
13849
13850 !! test
13851 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13852 !! options
13853 showtitle
13854 title=[[Screen]]
13855 !! config
13856 wgAllowDisplayTitle=true
13857 wgRestrictDisplayTitle=true
13858 !! input
13859 this is not the the title
13860 {{DISPLAYTITLE:screen}}
13861 !! result
13862 screen
13863 <p>this is not the the title
13864 </p>
13865 !! end
13866
13867 !! test
13868 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13869 !! options
13870 showtitle
13871 title=[[Screen]]
13872 !! config
13873 wgAllowDisplayTitle=false
13874 !! input
13875 this is not the the title
13876 {{DISPLAYTITLE:screen}}
13877 !! result
13878 Screen
13879 <p>this is not the the title
13880 <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>
13881 </p>
13882 !! end
13883
13884 !! test
13885 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13886 !! options
13887 showtitle
13888 title=[[Screen]]
13889 !! config
13890 wgAllowDisplayTitle=false
13891 !! input
13892 this is not the the title
13893 !! result
13894 Screen
13895 <p>this is not the the title
13896 </p>
13897 !! end
13898
13899 !! test
13900 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13901 !! options
13902 showtitle
13903 title=[[Screen]]
13904 !! config
13905 wgAllowDisplayTitle=true
13906 wgRestrictDisplayTitle=true
13907 !! input
13908 this is not the the title
13909 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13910 !! result
13911 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13912 <p>this is not the the title
13913 </p>
13914 !! end
13915
13916 !! test
13917 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13918 !! options
13919 showtitle
13920 title=[[Screen]]
13921 !! config
13922 wgAllowDisplayTitle=true
13923 wgRestrictDisplayTitle=true
13924 !! input
13925 this is not the the title
13926 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13927 !! result
13928 <span style="color: red;">s</span>creen
13929 <p>this is not the the title
13930 </p>
13931 !! end
13932
13933 !! test
13934 preload: check <noinclude> and <includeonly>
13935 !! options
13936 preload
13937 !! input
13938 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13939 !! result
13940 Hello kind world.
13941 !! end
13942
13943 !! test
13944 preload: check <onlyinclude>
13945 !! options
13946 preload
13947 !! input
13948 Goodbye <onlyinclude>Hello world</onlyinclude>
13949 !! result
13950 Hello world
13951 !! end
13952
13953 !! test
13954 preload: can pass tags through if we want to
13955 !! options
13956 preload
13957 !! input
13958 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13959 !! result
13960 <includeonly>Hello world</includeonly>
13961 !! end
13962
13963 !! test
13964 preload: check that it doesn't try to do tricks
13965 !! options
13966 preload
13967 !! input
13968 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13969 !! result
13970 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13971 !! end
13972
13973 !! test
13974 Play a bit with r67090 and bug 3158
13975 !! options
13976 disabled
13977 !! input
13978 <div style="width:50% !important">&nbsp;</div>
13979 <div style="width:50%&nbsp;!important">&nbsp;</div>
13980 <div style="width:50%&#160;!important">&nbsp;</div>
13981 <div style="border : solid;">&nbsp;</div>
13982 !! result
13983 <div style="width:50% !important">&nbsp;</div>
13984 <div style="width:50% !important">&nbsp;</div>
13985 <div style="width:50% !important">&nbsp;</div>
13986 <div style="border&#160;: solid;">&nbsp;</div>
13987
13988 !! end
13989
13990 !! test
13991 HTML5 data attributes
13992 !! input
13993 <span data-foo="bar">Baz</span>
13994 <p data-abc-def_hij="">Quuz</p>
13995 !! result
13996 <p><span data-foo="bar">Baz</span>
13997 </p>
13998 <p data-abc-def_hij="">Quuz</p>
13999
14000 !! end
14001
14002 !! test
14003 percent-encoding and + signs in internal links (Bug 26410)
14004 !! input
14005 [[User:+%]] [[Page+title%]]
14006 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14007 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14008 [[%33%45]] [[%33%45+]]
14009 !! result
14010 <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>
14011 <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>
14012 <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>
14013 <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>
14014 </p>
14015 !! end
14016
14017 !! test
14018 Special characters in embedded file links (bug 27679)
14019 !! input
14020 [[File:Contains & ampersand.jpg]]
14021 [[File:Does not exist.jpg|Title with & ampersand]]
14022 !! result
14023 <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>
14024 <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>
14025 </p>
14026 !! end
14027
14028
14029 !! test
14030 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14031 !! input
14032 Text&apos;s been normalized?
14033 !! result
14034 <p>Text&#39;s been normalized?
14035 </p>
14036 !! end
14037
14038 !! test
14039 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14040 !! input
14041 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14042 !! result
14043 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14044 </p>
14045 !! end
14046
14047 !! test
14048 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14049 !! input
14050 [http://www.example.org/ ideograms]
14051 !! result
14052 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14053 </p>
14054 !! end
14055
14056 !! test
14057 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14058 !! input
14059 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14060 !! result
14061 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14062 </p>
14063 !! end
14064
14065 !! article
14066 Mediawiki:loop1
14067 !! text
14068 {{Identical|A}}
14069 !! endarticle
14070
14071 !! article
14072 Mediawiki:loop2
14073 !! text
14074 {{Identical|B}}
14075 !! endarticle
14076
14077 !! article
14078 Template:Identical
14079 !! text
14080 {{int:loop1}}
14081 {{int:loop2}}
14082 !! endarticle
14083
14084 !! test
14085 Bug 31098 Template which includes system messages which includes the template
14086 !! input
14087 {{Identical}}
14088 !! result
14089 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14090 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14091 </p>
14092 !! end
14093
14094 !! test
14095 Bug31490 Turkish: ucfirst 'blah'
14096 !! options
14097 language=tr
14098 !! input
14099 {{ucfirst:blah}}
14100 !! result
14101 <p>Blah
14102 </p>
14103 !! end
14104
14105 !! test
14106 Bug31490 Turkish: ucfirst 'ix'
14107 !! options
14108 language=tr
14109 !! input
14110 {{ucfirst:ix}}
14111 !! result
14112 <p>İx
14113 </p>
14114 !! end
14115
14116 !! test
14117 Bug31490 Turkish: lcfirst 'BLAH'
14118 !! options
14119 language=tr
14120 !! input
14121 {{lcfirst:BLAH}}
14122 !! result
14123 <p>bLAH
14124 </p>
14125 !! end
14126
14127 !! test
14128 Bug31490 Turkish: ucfırst (with a dotless i)
14129 !! options
14130 language=tr
14131 !! input
14132 {{ucfırst:blah}}
14133 !! result
14134 <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>
14135 </p>
14136 !! end
14137
14138 !! test
14139 Bug31490 ucfırst (with a dotless i) with English language
14140 !! options
14141 language=en
14142 !! input
14143 {{ucfırst:blah}}
14144 !! result
14145 <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>
14146 </p>
14147 !! end
14148
14149 !! test
14150 Bug 26375: TOC with italics
14151 !! options
14152 title=[[Main Page]]
14153 !! input
14154 __TOC__
14155 == ''Lost'' episodes ==
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="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
14160 </ul>
14161 </div>
14162 <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>
14163
14164 !! end
14165
14166 !! test
14167 Bug 26375: TOC with bold
14168 !! options
14169 title=[[Main Page]]
14170 !! input
14171 __TOC__
14172 == '''should be bold''' then normal text ==
14173 !! result
14174 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14175 <ul>
14176 <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>
14177 </ul>
14178 </div>
14179 <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>
14180
14181 !! end
14182
14183 !! test
14184 Bug 33845: Headings become cursive in TOC when they contain an image
14185 !! options
14186 title=[[Main Page]]
14187 !! input
14188 __TOC__
14189 == Image [[Image:foobar.jpg]] ==
14190 !! result
14191 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14192 <ul>
14193 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14194 </ul>
14195 </div>
14196 <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>
14197
14198 !! end
14199
14200 !! test
14201 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14202 !! options
14203 title=[[Main Page]]
14204 !! input
14205 __TOC__
14206 == <blockquote>Quote</blockquote> ==
14207 !! result
14208 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14209 <ul>
14210 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14211 </ul>
14212 </div>
14213 <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>
14214
14215 !! end
14216
14217 !! test
14218 Unclosed tags in TOC
14219 !! options
14220 title=[[Main Page]]
14221 !! input
14222 __TOC__
14223 == Proof: 2 < 3 ==
14224 <small>Hanc marginis exiguitas non caperet.</small>
14225 QED
14226 !! result
14227 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14228 <ul>
14229 <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>
14230 </ul>
14231 </div>
14232 <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>
14233 <p><small>Hanc marginis exiguitas non caperet.</small>
14234 QED
14235 </p>
14236 !! end
14237
14238 !! test
14239 Multiple tags in TOC
14240 !! input
14241 __TOC__
14242 == <i>Foo</i> <b>Bar</b> ==
14243
14244 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14245 !! result
14246 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14247 <ul>
14248 <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>
14249 <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>
14250 </ul>
14251 </div>
14252 <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>
14253 <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>
14254
14255 !! end
14256
14257 !! test
14258 Tags with parameters in TOC
14259 !! input
14260 __TOC__
14261 == <sup class="in-h2">Hello</sup> ==
14262
14263 == <sup class="a > b">Evilbye</sup> ==
14264 !! result
14265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14266 <ul>
14267 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14268 <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>
14269 </ul>
14270 </div>
14271 <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>
14272 <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>
14273
14274 !! end
14275
14276 !! test
14277 span tags with directionality in TOC
14278 !! input
14279 __TOC__
14280 == <span dir="ltr">C++</span> ==
14281
14282 == <span dir="rtl">זבנג!</span> ==
14283
14284 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14285
14286 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14287
14288 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14289 !! result
14290 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14291 <ul>
14292 <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>
14293 <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>
14294 <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>
14295 <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>
14296 <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>
14297 </ul>
14298 </div>
14299 <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>
14300 <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>
14301 <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>
14302 <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>
14303 <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>
14304
14305 !! end
14306
14307 !! article
14308 MediaWiki:Bug32057
14309 !! text
14310 == {{int:headline_sample}} ==
14311 !! endarticle
14312
14313 !! test
14314 Bug 32057: Title needed when expanding <h> nodes.
14315 !! options
14316 title=[[Main Page]]
14317 !! input
14318 {{int:Bug32057}}
14319 !! result
14320 <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>
14321
14322 !! end
14323
14324 !! test
14325 Strip marker in urlencode
14326 !! input
14327 {{urlencode:x<nowiki/>y}}
14328 {{urlencode:x<nowiki/>y|wiki}}
14329 {{urlencode:x<nowiki/>y|path}}
14330 !! result
14331 <p>xy
14332 xy
14333 xy
14334 </p>
14335 !! end
14336
14337 !! test
14338 Strip marker in lc
14339 !! input
14340 {{lc:x<nowiki/>y}}
14341 !! result
14342 <p>xy
14343 </p>
14344 !! end
14345
14346 !! test
14347 Strip marker in uc
14348 !! input
14349 {{uc:x<nowiki/>y}}
14350 !! result
14351 <p>XY
14352 </p>
14353 !! end
14354
14355 !! test
14356 Strip marker in formatNum
14357 !! input
14358 {{formatnum:1<nowiki/>2}}
14359 {{formatnum:1<nowiki/>2|R}}
14360 !! result
14361 <p>12
14362 12
14363 </p>
14364 !! end
14365
14366 !! test
14367 Check noCommafy in formatNum
14368 !! options
14369 language=be-tarask
14370 !! input
14371 {{formatnum:123456.78}}
14372 {{formatnum:123456.78|NOSEP}}
14373 !! result
14374 <p>123 456,78
14375 123456.78
14376 </p>
14377 !! end
14378
14379 !! test
14380 Strip marker in grammar
14381 !! options
14382 language=fi
14383 !! input
14384 {{grammar:elative|foo<nowiki/>bar}}
14385 !! result
14386 <p>foobarista
14387 </p>
14388 !! end
14389
14390 !! test
14391 Strip marker in padleft
14392 !! input
14393 {{padleft:|2|x<nowiki/>y}}
14394 !! result
14395 <p>xy
14396 </p>
14397 !! end
14398
14399 !! test
14400 Strip marker in padright
14401 !! input
14402 {{padright:|2|x<nowiki/>y}}
14403 !! result
14404 <p>xy
14405 </p>
14406 !! end
14407
14408 !! test
14409 Strip marker in anchorencode
14410 !! input
14411 {{anchorencode:x<nowiki/>y}}
14412 !! result
14413 <p>xy
14414 </p>
14415 !! end
14416
14417 !! test
14418 nowiki inside link inside heading (bug 18295)
14419 !! input
14420 ==[[foo|x<nowiki>y</nowiki>z]]==
14421 !! result
14422 <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>
14423
14424 !! end
14425
14426 !! test
14427 new support for bdi element (bug 31817)
14428 !! input
14429 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14430 !! result
14431 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14432
14433 !!end
14434
14435 !! test
14436 Ignore pipe between table row attributes
14437 !! input
14438 {|
14439 | quux
14440 |- id=foo | style='color: red'
14441 | bar
14442 |}
14443 !! result
14444 <table>
14445 <tr>
14446 <td> quux
14447 </td></tr>
14448 <tr id="foo" style="color: red">
14449 <td> bar
14450 </td></tr></table>
14451
14452 !! end
14453
14454 !!test
14455 Gallery override link with WikiLink (bug 34852)
14456 !! input
14457 <gallery>
14458 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14459 </gallery>
14460 !! result
14461 <ul class="gallery">
14462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14463 <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>
14464 <div class="gallerytext">
14465 <p>caption
14466 </p>
14467 </div>
14468 </div></li>
14469 </ul>
14470
14471 !! end
14472
14473 !!test
14474 Gallery override link with absolute external link (bug 34852)
14475 !! input
14476 <gallery>
14477 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14478 </gallery>
14479 !! result
14480 <ul class="gallery">
14481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14482 <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>
14483 <div class="gallerytext">
14484 <p>caption
14485 </p>
14486 </div>
14487 </div></li>
14488 </ul>
14489
14490 !! end
14491
14492 !!test
14493 Gallery override link with malicious javascript (bug 34852)
14494 !! input
14495 <gallery>
14496 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14497 </gallery>
14498 !! result
14499 <ul class="gallery">
14500 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14501 <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>
14502 <div class="gallerytext">
14503 <p>caption
14504 </p>
14505 </div>
14506 </div></li>
14507 </ul>
14508
14509 !! end
14510
14511 !!test
14512 Gallery with invalid title as link (bug 43964)
14513 !! input
14514 <gallery>
14515 File:foobar.jpg|link=<
14516 </gallery>
14517 !! result
14518 <ul class="gallery">
14519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14520 <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>
14521 <div class="gallerytext">
14522 </div>
14523 </div></li>
14524 </ul>
14525
14526 !! end
14527
14528 !!test
14529 Language parser function
14530 !! input
14531 {{#language:ar}}
14532 !! result
14533 <p>العربية
14534 </p>
14535 !! end
14536
14537 !!test
14538 Padleft and padright as substr
14539 !! input
14540 {{padleft:|3|abcde}}
14541 {{padright:|3|abcde}}
14542 !! result
14543 <p>abc
14544 abc
14545 </p>
14546 !! end
14547
14548 !!test
14549 Special parser function
14550 !! input
14551 {{#special:RandomPage}}
14552 {{#special:BaDtItLe}}
14553 {{#special:Foobar}}
14554 !! result
14555 <p>Special:Random
14556 Special:Badtitle
14557 Special:Foobar
14558 </p>
14559 !! end
14560
14561 !!test
14562 Bug 34939 - Case insensitive link parsing ([HttP://])
14563 !! input
14564 [HttP://MediaWiki.Org/]
14565 !! result
14566 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14567 </p>
14568 !! end
14569
14570 !!test
14571 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14572 !! input
14573 [HttP://MediaWiki.Org/ MediaWiki]
14574 !! result
14575 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14576 </p>
14577 !! end
14578
14579 !!test
14580 Bug 34939 - Case insensitive link parsing (HttP://)
14581 !! input
14582 HttP://MediaWiki.Org/
14583 !! result
14584 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14585 </p>
14586 !! end
14587
14588
14589 ###
14590 ### Parsoids-specific tests
14591 ### Parsoid-PHP parser incompatibilities
14592 ###
14593 !!test
14594 1. SOL-sensitive wikitext tokens as template-args
14595 !!options
14596 parsoid=wt2html,wt2wt
14597 !!input
14598 {{echo|*a}}
14599 {{echo|#a}}
14600 {{echo|:a}}
14601 !!result
14602 <span about="#mwt1" typeof="mw:Transclusion">
14603 </span><ul about="#mwt1"><li>a</li></ul>
14604 <span about="#mwt2" typeof="mw:Transclusion">
14605 </span><ol about="#mwt2"><li>a</li></ol>
14606 <span about="#mwt3" typeof="mw:Transclusion">
14607 </span><dl about="#mwt3"><dd>a</dd></dl>
14608 !!end
14609
14610 #### ----------------------------------------------------------------
14611 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14612 #### tags. Parsoid's output for these tags differs from that of the
14613 #### PHP parser.
14614 #### ----------------------------------------------------------------
14615
14616 !!test
14617 Ref: 1. ref-location should be replaced with an index span
14618 !!options
14619 parsoid
14620 !!input
14621 A <ref>foo</ref>
14622 B <ref name="x">foo</ref>
14623 C <ref name="y" />
14624 !!result
14625 <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>
14626 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>
14627 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>
14628 !!end
14629
14630 !!test
14631 Ref: 2. ref-tags with identical names should all get the same index
14632 !!options
14633 parsoid
14634 !!input
14635 A <ref name="x">foo</ref>
14636 B <ref name="x" />
14637 !!result
14638 <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>
14639 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>
14640 !!end
14641
14642 !!test
14643 Ref: 3. spaces in ref-names should be ignored
14644 !!options
14645 parsoid
14646 !!input
14647 A <ref name="x">foo</ref>
14648 B <ref name=" x " />
14649 C <ref name= x />
14650 !!result
14651 <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>
14652 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>
14653 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>
14654 !!end
14655
14656 !!test
14657 Ref: 4. 'constructor' should be accepted as a valid ref-name
14658 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14659 !!options
14660 parsoid
14661 !!input
14662 A <ref name="constructor">foo</ref>
14663 !!result
14664 <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>
14665 !!end
14666
14667 !!test
14668 Ref: 5. body should accept generic wikitext
14669 !!options
14670 parsoid
14671 !!input
14672 A <ref>
14673 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14674 </ref>
14675
14676 <references />
14677 !!result
14678 <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>
14679
14680 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14681 <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>
14682 </li></ol>
14683 !!end
14684
14685 !!test
14686 Ref: 6. indent-pres should not be output in ref-body
14687 !!options
14688 parsoid
14689 !!input
14690 A <ref>
14691 foo
14692 bar
14693 baz
14694 </ref>
14695
14696 <references />
14697 !!result
14698 <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>
14699
14700 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14701 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14702 bar
14703 baz
14704 </li></ol>
14705 !!end
14706
14707 !!test
14708 Ref: 6. No p-wrapping in ref-body
14709 !!options
14710 parsoid
14711 !!input
14712 A <ref>
14713 foo
14714
14715 bar
14716
14717
14718 baz
14719
14720
14721
14722 booz
14723 </ref>
14724
14725 <references />
14726 !!result
14727 <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>
14728
14729 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14730 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14731
14732 bar
14733
14734
14735 baz
14736
14737
14738
14739 booz
14740 </li></ol>
14741 !!end
14742
14743 !!test
14744 Ref: 8. transclusion wikitext has lower precedence
14745 !!options
14746 parsoid
14747 !!input
14748 A <ref> foo {{echo|</ref> B C}}
14749
14750 <references />
14751 !!result
14752 <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>
14753
14754 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14755 <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>
14756 !!end
14757
14758 !!test
14759 Ref: 9. unclosed comments should not leak out of ref-body
14760 !!options
14761 parsoid
14762 !!input
14763 A <ref> foo <!--</ref> B C
14764
14765 <references />
14766 !!result
14767 <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>
14768
14769 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14770 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14771 !!end
14772
14773 !!test
14774 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14775 !!options
14776 parsoid
14777 !!input
14778 A <ref> <b> foo </ref> B C
14779
14780 <references />
14781 !!result
14782 <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>
14783
14784 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14785 <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>
14786 !!end
14787
14788 !!test
14789 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14790 !!options
14791 parsoid
14792 !!input
14793 A <ref>foo</ref> B
14794 C <ref>bar</ref> D
14795 !!result
14796 <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
14797 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>
14798 !!end
14799
14800 !!test
14801 Ref: 12. ref-tags act as trailing newline migration barrier
14802 !!options
14803 parsoid
14804 !!input
14805 <!--the newline at the end of this line moves out of the p-tag-->a
14806
14807 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14808 <ref />
14809
14810 c
14811 !!result
14812 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14813
14814
14815 <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>
14816 <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>
14817
14818
14819 <p>c</p>
14820 !!end
14821
14822 !!test
14823 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14824 !!options
14825 parsoid
14826 !!input
14827 <ref>foo</ref> A
14828 <ref>bar
14829 </ref> B
14830 !!result
14831 <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
14832 <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>
14833 !!end
14834
14835 !!test
14836 Ref: 14. A nested ref-tag should be emitted as plain text
14837 !!options
14838 parsoid
14839 !!input
14840 <ref>foo <ref>bar</ref> baz</ref>
14841
14842 <references />
14843 !!result
14844 <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>
14845
14846 <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>
14847 !!end
14848
14849 !!test
14850 Ref: 15. ref-tags with identical names should get identical indexes
14851 !!options
14852 parsoid
14853 !!input
14854 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14855 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14856
14857 <references />
14858 !!result
14859 <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>
14860 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>
14861
14862 <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>
14863 !!end
14864
14865 !!test
14866 References: 1. references tag without any refs should be handled properly
14867 !!options
14868 parsoid
14869 !!input
14870 <references />
14871 !!result
14872 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14873 !!end
14874
14875 !!test
14876 References: 2. references tag with group only outputs references from that group
14877 !!options
14878 parsoid
14879 !!input
14880 A <ref group="a">foo</ref>
14881 B <ref group="b">bar</ref>
14882
14883 <references group='a' />
14884 !!result
14885 <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>
14886 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>
14887
14888 <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>
14889 !!end
14890
14891 !!test
14892 References: 3. ref list should be cleared after processing references
14893 !!options
14894 parsoid
14895 !!input
14896 A <ref>foo</ref>
14897
14898 <references />
14899
14900 B <ref>bar</ref>
14901
14902 <references />
14903 !!result
14904 <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>
14905
14906 <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>
14907
14908 <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>
14909
14910 <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>
14911 !!end
14912
14913 !!test
14914 References: 4. only referenced group should be cleared after processing references
14915 !!options
14916 parsoid
14917 !!input
14918 A <ref group="a">afoo</ref>
14919 B <ref>bfoo</ref>
14920
14921 <references group="a"/>
14922
14923 C <ref>cfoo</ref>
14924
14925 <references />
14926 !!result
14927 <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>
14928 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>
14929
14930 <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>
14931
14932 <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>
14933
14934 <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>
14935 !!end
14936
14937 !!test
14938 References: 5. ref tags in references should be processed while ignoring all other content
14939 !!options
14940 parsoid
14941 !!input
14942 A <ref name="a" />
14943 B <ref name="b">bar</ref>
14944
14945 <references>
14946 <ref name="a">foo</ref>
14947 This should just get lost.
14948 </references>
14949 !!result
14950 <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>
14951 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>
14952
14953 <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>
14954 !!end
14955
14956 !!test
14957 References: 6. <references /> from a transclusion
14958 !!options
14959 parsoid
14960 !!input
14961 {{echo|<references />}}
14962 !!result
14963 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14964 !!end
14965
14966 #### ----------------------------------------------------------------
14967 #### The following section of tests are primarily to test
14968 #### wikitext escaping capabilities of Parsoid. Given that
14969 #### escaping can be done any number of ways, the wikitext (input)
14970 #### is always adjusted to reflect how Parsoid adds nowiki
14971 #### escape tags.
14972 ####
14973 #### We are marking several tests as parsoid-only since the
14974 #### HTML in the result section is different from what the
14975 #### PHP parser generates for it.
14976 #### ----------------------------------------------------------------
14977
14978
14979 #### --------------- Headings ---------------
14980 #### 0. Unnested
14981 #### 1. Nested inside html <h1>=foo=</h1>
14982 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14983 #### 3. Nested inside html with wikitext split by html tags
14984 #### 4. No escape needed
14985 #### 5. Empty headings <h1></h1>
14986 #### 6. Heading chars in SOL context
14987 #### ----------------------------------------
14988 !! test
14989 Headings: 0. Unnested
14990 !! options
14991 parsoid
14992 !! input
14993 <nowiki>=foo=</nowiki>
14994
14995 <nowiki> =foo= </nowiki>
14996 <!--cmt-->
14997 <nowiki>=foo=</nowiki>
14998
14999 =foo''a''<nowiki>=</nowiki>
15000 !! result
15001 <p><span typeof="mw:Nowiki">=foo=</span></p>
15002
15003 <p><span typeof="mw:Nowiki"> =foo= </span>
15004 <!--cmt-->
15005 <span typeof="mw:Nowiki">=foo=</span></p>
15006
15007 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15008 !!end
15009
15010 !! test
15011 Headings: 1. Nested inside html
15012 !! options
15013 parsoid
15014 !! input
15015 =<nowiki>=foo=</nowiki>=
15016
15017 ==<nowiki>=foo=</nowiki>==
15018
15019 ===<nowiki>=foo=</nowiki>===
15020
15021 ====<nowiki>=foo=</nowiki>====
15022
15023 =====<nowiki>=foo=</nowiki>=====
15024
15025 ======<nowiki>=foo=</nowiki>======
15026 !! result
15027 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15028 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15029 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15030 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15031 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15032 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15033 !!end
15034
15035 !! test
15036 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15037 !! options
15038 parsoid
15039 !! input
15040 =foo=
15041 <nowiki>*bar</nowiki>
15042
15043 =foo=
15044 =bar
15045
15046 =foo=
15047 <nowiki>=bar=</nowiki>
15048 !! result
15049 <h1>foo</h1>*bar
15050 <h1>foo</h1>=bar
15051 <h1>foo</h1>=bar=
15052 !!end
15053
15054 !! test
15055 Headings: 3. Nested inside html with wikitext split by html tags
15056 !! options
15057 parsoid
15058 !! input
15059 =='''bold'''<nowiki>foo=</nowiki>=
15060 !! result
15061 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15062 !!end
15063
15064 !! test
15065 Headings: 4a. No escaping needed (testing just h1 and h2)
15066 !! options
15067 parsoid
15068 !! input
15069 ==foo=
15070
15071 =foo==
15072
15073 = =foo= =
15074
15075 ==foo= bar=
15076
15077 ===foo==
15078
15079 ==foo===
15080
15081 =''=''foo==
15082
15083 =<nowiki>=</nowiki>=
15084 !! result
15085 <h1>=foo</h1>
15086 <h1>foo=</h1>
15087 <h1> =foo= </h1>
15088 <h1>=foo= bar</h1>
15089 <h2>=foo</h2>
15090 <h2>foo=</h2>
15091 <h1><i>=</i>foo=</h1>
15092 <h1><span typeof="mw:Nowiki">=</span></h1>
15093 !!end
15094
15095 !! test
15096 Headings: 4b. No escaping needed (inside p-tags)
15097 !! options
15098 parsoid
15099 !! input
15100 ===
15101 =foo= x
15102 =foo= <s></s>
15103 !! result
15104 <p>===
15105 =foo= x
15106 =foo= <s></s>
15107 </p>
15108 !!end
15109
15110 !! test
15111 Headings: 5. Empty headings
15112 !! options
15113 parsoid
15114 !! input
15115 =<nowiki/>=
15116
15117 ==<nowiki/>==
15118
15119 ===<nowiki/>===
15120
15121 ====<nowiki/>====
15122
15123 =====<nowiki/>=====
15124
15125 ======<nowiki/>======
15126 !! result
15127 <h1></h1>
15128 <h2></h2>
15129 <h3></h3>
15130 <h4></h4>
15131 <h5></h5>
15132 <h6></h6>
15133 !!end
15134
15135 !! test
15136 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15137 !! options
15138 parsoid
15139 !! input
15140 <nowiki>=a=</nowiki>
15141
15142 <nowiki>=a= </nowiki>
15143
15144 <nowiki>=a= </nowiki>
15145
15146 <nowiki>=a= </nowiki>
15147 !! result
15148 <p>=a=</p>
15149 <p>=a= </p>
15150 <p>=a= </p>
15151 <p>=a= </p>
15152 !!end
15153
15154 !! test
15155 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15156 !! options
15157 parsoid
15158 !! input
15159 <nowiki>=a=
15160 b</nowiki>
15161
15162 <nowiki>=a=
15163 b</nowiki>
15164
15165 <nowiki>=a=
15166 b</nowiki>
15167
15168 <nowiki>=a=
15169 b</nowiki>
15170 !! result
15171 <p>=a=
15172 b</p>
15173 <p>=a=
15174 b</p>
15175 <p>=a=
15176 b</p>
15177 <p>=a=
15178 b</p>
15179 </p>
15180 !!end
15181
15182 !! test
15183 Headings: 6c. Heading chars in SOL context (leading newline break)
15184 !! options
15185 parsoid
15186 !! input
15187 <nowiki>a
15188 =b=</nowiki>
15189 !! result
15190 <p>a
15191 =b=</p>
15192 !!end
15193
15194 !! test
15195 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15196 !! options
15197 parsoid
15198 !! input
15199 <!--c0--><nowiki>=a=</nowiki>
15200 <!--c1-->
15201 <nowiki>=a= </nowiki><!--c2--> <!--c3-->
15202 !! result
15203 <p><!--c0-->=a=</p>
15204 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15205 !!end
15206
15207 !! test
15208 Headings: 6d. Heading chars in SOL context (No escaping needed)
15209 !! options
15210 parsoid=html2wt
15211 !! input
15212 =a=<div>b</div>
15213 !! result
15214 =a=<div>b</div>
15215 !!end
15216
15217 #### --------------- Lists ---------------
15218 #### 0. Outside nests (*foo, etc.)
15219 #### 1. Nested inside html <ul><li>*foo</li></ul>
15220 #### 2. Inside definition lists
15221 #### 3. Only bullets at start should be escaped
15222 #### 4. No escapes needed
15223 #### 5. No unnecessary escapes
15224 #### 6. Escape bullets in SOL position
15225 #### 7. Escape bullets in a multi-line context
15226 #### ----------------------------------------
15227
15228 !! test
15229 Lists: 0. Outside nests
15230 !! input
15231 <nowiki>*foo</nowiki>
15232
15233 <nowiki>#foo</nowiki>
15234 !! result
15235 <p>*foo
15236 </p><p>#foo
15237 </p>
15238 !!end
15239
15240 !! test
15241 Lists: 1. Nested inside html
15242 !! input
15243 *<nowiki>*foo</nowiki>
15244
15245 *<nowiki>#foo</nowiki>
15246
15247 *<nowiki>:foo</nowiki>
15248
15249 *<nowiki>;foo</nowiki>
15250
15251 #<nowiki>*foo</nowiki>
15252
15253 #<nowiki>#foo</nowiki>
15254
15255 #<nowiki>:foo</nowiki>
15256
15257 #<nowiki>;foo</nowiki>
15258 !! result
15259 <ul><li>*foo
15260 </li></ul>
15261 <ul><li>#foo
15262 </li></ul>
15263 <ul><li>:foo
15264 </li></ul>
15265 <ul><li>;foo
15266 </li></ul>
15267 <ol><li>*foo
15268 </li></ol>
15269 <ol><li>#foo
15270 </li></ol>
15271 <ol><li>:foo
15272 </li></ol>
15273 <ol><li>;foo
15274 </li></ol>
15275
15276 !!end
15277
15278 !! test
15279 Lists: 2. Inside definition lists
15280 !! input
15281 ;<nowiki>;foo</nowiki>
15282
15283 ;<nowiki>:foo</nowiki>
15284
15285 ;<nowiki>:foo</nowiki>
15286 :bar
15287
15288 :<nowiki>:foo</nowiki>
15289 !! result
15290 <dl><dt>;foo
15291 </dt></dl>
15292 <dl><dt>:foo
15293 </dt></dl>
15294 <dl><dt>:foo
15295 </dt><dd>bar
15296 </dd></dl>
15297 <dl><dd>:foo
15298 </dd></dl>
15299
15300 !!end
15301
15302 !! test
15303 Lists: 3. Only bullets at start of text should be escaped
15304 !! input
15305 *<nowiki>*foo*bar</nowiki>
15306
15307 *<nowiki>*foo</nowiki>''it''*bar
15308 !! result
15309 <ul><li>*foo*bar
15310 </li></ul>
15311 <ul><li>*foo<i>it</i>*bar
15312 </li></ul>
15313
15314 !!end
15315
15316 !! test
15317 Lists: 4. No escapes needed
15318 !! options
15319 parsoid
15320 !! input
15321 *foo*bar
15322
15323 *''foo''*bar
15324
15325 *[[Foo]]: bar
15326 !! result
15327 <ul><li>foo*bar
15328 </li></ul>
15329 <ul><li><i>foo</i>*bar
15330 </li></ul>
15331 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15332 </li></ul>
15333 !!end
15334
15335 !! test
15336 Lists: 5. No unnecessary escapes
15337 !! input
15338 * bar <span><nowiki>[[foo]]</nowiki></span>
15339
15340 *=bar <span><nowiki>[[foo]]</nowiki></span>
15341
15342 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15343
15344 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15345
15346 *=bar <span>foo]]</span>=
15347
15348 * <s></s>: a
15349 !! result
15350 <ul><li> bar <span>[[foo]]</span>
15351 </li></ul>
15352 <ul><li>=bar <span>[[foo]]</span>
15353 </li></ul>
15354 <ul><li>[[bar <span>[[foo]]</span>
15355 </li></ul>
15356 <ul><li>]]bar <span>[[foo]]</span>
15357 </li></ul>
15358 <ul><li>=bar <span>foo]]</span>=
15359 </li></ul>
15360 <ul><li> <s></s>: a
15361 </li></ul>
15362
15363 !!end
15364
15365 !! test
15366 Lists: 6. Escape bullets in SOL position
15367 !! options
15368 parsoid
15369 !! input
15370 <!--cmt--><nowiki>*foo</nowiki>
15371 !! result
15372 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15373 !!end
15374
15375 !! test
15376 Lists: 7. Escape bullets in a multi-line context
15377 !! input
15378 <nowiki>a
15379 *b</nowiki>
15380 !! result
15381 <p>a
15382 *b
15383 </p>
15384 !!end
15385
15386 #### --------------- HRs ---------------
15387 #### 1. Single line
15388 #### -----------------------------------
15389
15390 !! test
15391 HRs: 1. Single line
15392 !! options
15393 parsoid
15394 !! input
15395 ----<nowiki>----</nowiki>
15396 ----=foo=
15397 ----*foo
15398 !! result
15399 <hr><span typeof="mw:Nowiki">----</span>
15400 <hr>=foo=
15401 <hr>*foo
15402 !! end
15403
15404 #### --------------- Tables ---------------
15405 #### 1a. Simple example
15406 #### 1b. No escaping needed (!foo)
15407 #### 1c. No escaping needed (|foo)
15408 #### 1d. No escaping needed (|}foo)
15409 ####
15410 #### 2a. Nested in td (<td>foo|bar</td>)
15411 #### 2b. Nested in td (<td>foo||bar</td>)
15412 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15413 ####
15414 #### 3a. Nested in th (<th>foo!bar</th>)
15415 #### 3b. Nested in th (<th>foo!!bar</th>)
15416 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15417 ####
15418 #### 4a. Escape -
15419 #### 4b. Escape +
15420 #### 4c. No escaping needed
15421 #### --------------------------------------
15422
15423 !! test
15424 Tables: 1a. Simple example
15425 !! input
15426 <nowiki>{|
15427 |}</nowiki>
15428 !! result
15429 <p>{|
15430 |}
15431 </p>
15432 !! end
15433
15434 !! test
15435 Tables: 1b. No escaping needed
15436 !! input
15437 !foo
15438 !! result
15439 <p>!foo
15440 </p>
15441 !! end
15442
15443 !! test
15444 Tables: 1c. No escaping needed
15445 !! input
15446 |foo
15447 !! result
15448 <p>|foo
15449 </p>
15450 !! end
15451
15452 !! test
15453 Tables: 1d. No escaping needed
15454 !! input
15455 |}foo
15456 !! result
15457 <p>|}foo
15458 </p>
15459 !! end
15460
15461 !! test
15462 Tables: 2a. Nested in td
15463 !! options
15464 parsoid
15465 !! input
15466 {|
15467 |<nowiki>foo|bar</nowiki>
15468 |}
15469 !! result
15470 <table><tbody><tr>
15471 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15472 !! end
15473
15474 !! test
15475 Tables: 2b. Nested in td
15476 !! options
15477 parsoid
15478 !! input
15479 {|
15480 |<nowiki>foo||bar</nowiki>
15481 |''it''<nowiki>foo||bar</nowiki>
15482 |}
15483 !! result
15484 <table><tbody><tr>
15485 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15486 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15487 !! end
15488
15489 !! test
15490 Tables: 2c. Nested in td -- no escaping needed
15491 !! options
15492 parsoid
15493 !! input
15494 {|
15495 |foo!!bar
15496 |}
15497 !! result
15498 <table><tbody><tr><td>foo!!bar
15499 </td></tr></tbody></table>
15500
15501 !! end
15502
15503 !! test
15504 Tables: 3a. Nested in th
15505 !! options
15506 parsoid
15507 !! input
15508 {|
15509 !foo!bar
15510 |}
15511 !! result
15512 <table><tbody><tr><th>foo!bar
15513 </th></tr></tbody></table>
15514
15515 !! end
15516
15517 !! test
15518 Tables: 3b. Nested in th
15519 !! options
15520 parsoid
15521 !! input
15522 {|
15523 !<nowiki>foo!!bar</nowiki>
15524 |}
15525 !! result
15526 <table>
15527 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15528 </tbody></table>
15529 !! end
15530
15531 !! test
15532 Tables: 3c. Nested in th -- no escaping needed
15533 !! options
15534 parsoid
15535 !! input
15536 {|
15537 !<nowiki>foo||bar</nowiki>
15538 |}
15539 !! result
15540 <table><tbody><tr>
15541 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15542 !! end
15543
15544 !! test
15545 Tables: 4a. Escape -
15546 !! options
15547 parsoid
15548 !! input
15549 {|
15550 |-
15551 !-bar
15552 |-
15553 |<nowiki>-bar</nowiki>
15554 |}
15555 !! result
15556 <table><tbody>
15557 <tr><th>-bar</th></tr>
15558 <tr>
15559 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15560 !! end
15561
15562 !! test
15563 Tables: 4b. Escape +
15564 !! options
15565 parsoid
15566 !! input
15567 {|
15568 |-
15569 !+bar
15570 |-
15571 |<nowiki>+bar</nowiki>
15572 |}
15573 !! result
15574 <table><tbody>
15575 <tr><th>+bar</th></tr>
15576 <tr>
15577 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15578 !! end
15579
15580 !! test
15581 Tables: 4c. No escaping needed
15582 !! options
15583 parsoid
15584 !! input
15585 {|
15586 |-
15587 |foo-bar
15588 |foo+bar
15589 |-
15590 |''foo''-bar
15591 |''foo''+bar
15592 |}
15593 !! result
15594 <table><tbody>
15595 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15596 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15597 </tbody></table>
15598 !! end
15599
15600 ### SSS FIXME: Disabled right now because accurate html2wt
15601 ### on this snippet requires data-parsoid flags that we've
15602 ### stripped out of these tests. We should scheme how we
15603 ### we want to handle these kind of tests that require
15604 ### data-parsoid flags for accurate html2wt serialization
15605
15606 !! test
15607 Tables: 4d. No escaping needed
15608 !! options
15609 disabled
15610 !! input
15611 {|
15612 ||+1
15613 ||-2
15614 |}
15615 !! result
15616 <table>
15617 <tr>
15618 <td>+1
15619 </td>
15620 <td>-2
15621 </td></tr></table>
15622
15623 !! end
15624
15625 #### --------------- Links ----------------
15626 #### 1. Quote marks in link text
15627 #### 2. Wikilinks: Escapes needed
15628 #### 3. Wikilinks: No escapes needed
15629 #### 4. Extlinks: Escapes needed
15630 #### 5. Extlinks: No escapes needed
15631 #### --------------------------------------
15632 !! test
15633 Links 1. Quote marks in link text
15634 !! options
15635 parsoid
15636 !! input
15637 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15638 !! result
15639 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15640 !! end
15641
15642 !! test
15643 Links 2. WikiLinks: Escapes needed
15644 !! options
15645 parsoid
15646 !! input
15647 [[Foo|<nowiki>[Foobar]</nowiki>]]
15648 [[Foo|<nowiki>Foobar]</nowiki>]]
15649 [[Foo|x [Foobar] x]]
15650 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15651 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15652 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15653 [[Foo|<nowiki>|Bar</nowiki>]]
15654 [[Foo|<nowiki>]]bar</nowiki>]]
15655 [[Foo|<nowiki>[[bar</nowiki>]]
15656 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15657 !! result
15658 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15659 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15660 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15661 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15662 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15663 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15664 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15665 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15666 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15667 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15668 !! end
15669
15670 !! test
15671 Links 3. WikiLinks: No escapes needed
15672 !! options
15673 parsoid
15674 !! input
15675 [[Foo|[Foobar]]
15676 [[Foo|foo|bar]]
15677 !! result
15678 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15679 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15680 !! end
15681
15682 !! test
15683 Links 4. ExtLinks: Escapes needed
15684 !! options
15685 parsoid
15686 !! input
15687 [http://google.com <nowiki>[google]</nowiki>]
15688 [http://google.com <nowiki>google]</nowiki>]
15689 !! result
15690 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15691 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15692 !! end
15693
15694 !! test
15695 Links 5. ExtLinks: No escapes needed
15696 !! options
15697 parsoid
15698 !! input
15699 [http://google.com [google]
15700 !! result
15701 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15702 !! end
15703
15704 #### --------------- Quotes ---------------
15705 #### 1. Quotes inside <b> and <i>
15706 #### 2. Link fragments separated by <i> and <b> tags
15707 #### 3. Link fragments inside <i> and <b>
15708 #### --------------------------------------
15709 !! test
15710 1. Quotes inside <b> and <i>
15711 !! input
15712 ''<nowiki>'foo'</nowiki>''
15713 ''<nowiki>''foo''</nowiki>''
15714 ''<nowiki>'''foo'''</nowiki>''
15715 ''foo''<nowiki>'s</nowiki>
15716 '''<nowiki>'foo'</nowiki>'''
15717 '''<nowiki>''foo''</nowiki>'''
15718 '''<nowiki>'''foo'''</nowiki>'''
15719 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15720 '''foo'''<nowiki>'s</nowiki>
15721 !! result
15722 <p><i>'foo'</i>
15723 <i>''foo''</i>
15724 <i>'''foo'''</i>
15725 <i>foo</i>'s
15726 <b>'foo'</b>
15727 <b>''foo''</b>
15728 <b>'''foo'''</b>
15729 <b>foo'<i>bar'</i>baz</b>
15730 <b>foo</b>'s
15731 </p>
15732 !! end
15733
15734 !! test
15735 2. Link fragments separated by <i> and <b> tags
15736 !! input
15737 [[''foo''<nowiki>hello]]</nowiki>
15738
15739 [['''foo'''<nowiki>hello]]</nowiki>
15740 !! result
15741 <p>[[<i>foo</i>hello]]
15742 </p><p>[[<b>foo</b>hello]]
15743 </p>
15744 !! end
15745
15746 !! test
15747 2. Link fragments inside <i> and <b>
15748 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15749 this is one of the shortcomings of this format)
15750 !! input
15751 ''[[foo''<nowiki>]]</nowiki>
15752
15753 '''[[foo'''<nowiki>]]</nowiki>
15754 !! result
15755 <p><i>[[foo</i>]]
15756 </p><p><b>[[foo</b>]]
15757 </p>
15758 !! end
15759
15760 #### ----------- Paragraphs ---------------
15761 #### 1. No unnecessary escapes
15762 #### --------------------------------------
15763
15764 !! test
15765 1. No unnecessary escapes
15766 !! input
15767 bar <span><nowiki>[[foo]]</nowiki></span>
15768
15769 =bar <span><nowiki>[[foo]]</nowiki></span>
15770
15771 [[bar <span><nowiki>[[foo]]</nowiki></span>
15772
15773 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15774
15775 =bar <span>foo]]</span><nowiki>=</nowiki>
15776 !! result
15777 <p>bar <span>[[foo]]</span>
15778 </p><p>=bar <span>[[foo]]</span>
15779 </p><p>[[bar <span>[[foo]]</span>
15780 </p><p>]]bar <span>[[foo]]</span>
15781 </p><p>=bar <span>foo]]</span>=
15782 </p>
15783 !!end
15784
15785 #### ----------------------- PRE --------------------------
15786 #### 1. Leading whitespace in SOL context should be escaped
15787 #### ------------------------------------------------------
15788 !! test
15789 1. Leading whitespace in SOL context should be escaped
15790 !! options
15791 parsoid
15792 !! input
15793 <nowiki> a</nowiki>
15794
15795 <nowiki> a</nowiki>
15796
15797 <nowiki> a(tab)</nowiki>
15798
15799 <nowiki> a</nowiki>
15800 <!--cmt-->
15801 <nowiki> a</nowiki>
15802
15803 <nowiki>a
15804 b</nowiki>
15805
15806 <nowiki>a
15807 b</nowiki>
15808
15809 <nowiki>a
15810 b</nowiki>
15811 !! result
15812 <p> a</p>
15813 <p> a</p>
15814 <p> a(tab)</p>
15815 <p> a</p>
15816 <p><!--cmt--> a</p>
15817 <p>a
15818 b</p>
15819 <p>a
15820 b</p>
15821 <p>a
15822 b</p>
15823 !! end
15824
15825 #### --------------- HTML tags ---------------
15826 #### 1. a tags
15827 #### 2. other tags
15828 #### 3. multi-line html tag
15829 #### -----------------------------------------
15830 !! test
15831 1. a tags
15832 !! options
15833 parsoid
15834 !! input
15835 <a href="http://google.com">google</a>
15836 !! result
15837 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15838 !! end
15839
15840 !! test
15841 2. other tags
15842 !! input
15843 <nowiki><div>foo</div>
15844 <div style="color:red">foo</div></nowiki>
15845 !! result
15846 <p>&lt;div&gt;foo&lt;/div&gt;
15847 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15848 </p>
15849 !! end
15850
15851 !! test
15852 3. multi-line html tag
15853 !! input
15854 <nowiki><div
15855 >foo</div
15856 ></nowiki>
15857 !! result
15858 <p>&lt;div
15859 &gt;foo&lt;/div
15860 &gt;
15861 </p>
15862 !! end
15863
15864 !! test
15865 4. extension tags
15866 !! input
15867 <nowiki><ref>foo</ref></nowiki>
15868 !! result
15869 <p>&lt;ref&gt;foo&lt;/ref&gt;
15870 </p>
15871 !! end
15872
15873 #### --------------- Others ---------------
15874 !! test
15875 Escaping nowikis
15876 !! input
15877 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15878 !! result
15879 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15880 </p>
15881 !! end
15882 !! test
15883
15884 Tag-like HTML structures are passed through as text
15885 !! input
15886 <x y>
15887
15888 <x.y>
15889
15890 <x-y>
15891
15892 1>2
15893
15894 x<y
15895
15896 a>b
15897
15898 1<d e>f
15899 !! result
15900 <p>&lt;x y&gt;
15901 </p><p>&lt;x.y&gt;
15902 </p><p>&lt;x-y&gt;
15903 </p><p>1&gt;2
15904 </p><p>x&lt;y
15905 </p><p>a&gt;b
15906 </p><p>1&lt;d e&gt;f
15907 </p>
15908 !! end
15909
15910
15911 # This fails in the PHP parser (see bug 40670,
15912 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15913 !! test
15914 Tag names followed by punctuation should not be recognized as tags
15915 !! options
15916 parsoid
15917 !! input
15918 <s.ome> text
15919 !! result
15920 <p>&lt;s.ome&gt; text
15921 </p>
15922 !! end
15923
15924 !! test
15925 HTML tag with necessary entities in attributes
15926 !! input
15927 <span title="&amp;amp;">foo</span>
15928 !! result
15929 <p><span title="&amp;amp;">foo</span>
15930 </p>
15931 !! end
15932
15933 !! test
15934 HTML tag with 'unnecessary' entity encoding in attributes
15935 !! input
15936 <span title="&amp;">foo</span>
15937 !! result
15938 <p><span title="&amp;">foo</span>
15939 </p>
15940 !! end
15941
15942 !! test
15943 HTML tag with broken attribute value quoting
15944 !! input
15945 <span title="Hello world>Foo</span>
15946 !! result
15947 <p><span>Foo</span>
15948 </p>
15949 !! end
15950
15951 !! test
15952 Parsoid-only: HTML tag with broken attribute value quoting
15953 !! options
15954 parsoid
15955 !! input
15956 <span title="Hello world>Foo</span>
15957 !! result
15958 <p><span title="Hello world">Foo</span>
15959 </p>
15960 !! end
15961
15962 !! test
15963 Table with broken attribute value quoting
15964 !! input
15965 {|
15966 | title="Hello world|Foo
15967 |}
15968 !! result
15969 <table>
15970 <tr>
15971 <td>Foo
15972 </td></tr></table>
15973
15974 !! end
15975
15976 !! test
15977 Table with broken attribute value quoting on consecutive lines
15978 !! input
15979 {|
15980 | title="Hello world|Foo
15981 | style="color:red|Bar
15982 |}
15983 !! result
15984 <table>
15985 <tr>
15986 <td>Foo
15987 </td>
15988 <td>Bar
15989 </td></tr></table>
15990
15991 !! end
15992
15993 !! test
15994 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15995 !! options
15996 parsoid
15997 !! input
15998 {|
15999 | title="Hello world|Foo
16000 | style="color:red|Bar
16001 |}
16002 !! result
16003 <table><tbody>
16004 <tr>
16005 <td title="Hello world">Foo
16006 </td><td style="color: red">Bar
16007 </td></tr></tbody></table>
16008
16009 !! end
16010
16011 !! test
16012 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16013 !! options
16014 parsoid
16015 !! input
16016 {{}}
16017 !! result
16018 {{}}
16019 !! end
16020
16021 !! test
16022 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16023 !! options
16024 parsoid
16025 !! input
16026 }}{{
16027 !! result
16028 }}{{
16029 !! end
16030
16031 !!test
16032 Accept empty td cell attribute
16033 !!input
16034 {|
16035 | align="center" | foo || |
16036 |}
16037 !!result
16038 <table>
16039 <tr>
16040 <td align="center"> foo </td>
16041 <td>
16042 </td></tr></table>
16043
16044 !!end
16045
16046 !!test
16047 Non-empty attributes in th-cells
16048 !!input
16049 {|
16050 ! Foo !! style="color: red" | Bar
16051 |}
16052 !!result
16053 <table>
16054 <tr>
16055 <th> Foo </th>
16056 <th style="color: red"> Bar
16057 </th></tr></table>
16058
16059 !!end
16060
16061 !!test
16062 Accept empty attributes in th-cells
16063 !!input
16064 {|
16065 !| foo !!| bar
16066 |}
16067 !!result
16068 <table>
16069 <tr>
16070 <th> foo </th>
16071 <th> bar
16072 </th></tr></table>
16073
16074 !!end
16075
16076 !!test
16077 Empty table rows go away
16078 !!input
16079 {|
16080 | Hello
16081 | there
16082 |- class="foo"
16083 |-
16084 |}
16085 !! result
16086 <table>
16087 <tr>
16088 <td> Hello
16089 </td>
16090 <td> there
16091 </td></tr>
16092
16093 </table>
16094
16095 !! end
16096
16097 ###
16098 ### Parsoid-centric tests for testing RTing of inter-element separators
16099 ### Edge cases not tested by existing parser tests and specific to
16100 ### Parsoid-specific serialization strategies.
16101 ###
16102
16103 !!test
16104 RT-ed inter-element separators should be valid separators
16105 !!input
16106 {|
16107 |- [[foo]]
16108 |}
16109 !!result
16110 <table>
16111
16112 </table>
16113
16114 !!end
16115
16116 !!test
16117 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16118 (Parsoid-only since PHP parser relies on Tidy for correct output)
16119 !!options
16120 parsoid
16121 !!input
16122 {|
16123 |<small>foo
16124 bar
16125 |}
16126
16127 {|
16128 |<small>foo<small>
16129 |}
16130 !!result
16131 !!end
16132
16133 !!test
16134 Empty TD followed by TD with tpl-generated attribute
16135 !!input
16136 {|
16137 |-
16138 |
16139 |{{echo|style='color:red'}}|foo
16140 |}
16141 !!result
16142 <table>
16143
16144 <tr>
16145 <td>
16146 </td>
16147 <td>foo
16148 </td></tr></table>
16149
16150 !!end
16151
16152 !!test
16153 Indented table with an empty td
16154 !!input
16155 {|
16156 |-
16157 |
16158 |foo
16159 |}
16160 !!result
16161 <table>
16162
16163 <tr>
16164 <td>
16165 </td>
16166 <td>foo
16167 </td></tr></table>
16168
16169 !!end
16170
16171 !!test
16172 Empty TR followed by a template-generated TR
16173 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16174 !!options
16175 parsoid=wt2html,wt2wt
16176 !!input
16177 {|
16178 |-
16179 {{echo|<tr><td>foo</td></tr>}}
16180 |}
16181 !!result
16182 <table>
16183 <tbody>
16184 <tr></tr>
16185 <tr typeof="mw:Transclusion">
16186 <td>foo</td></tr></tbody></table>
16187 !!end
16188
16189 ## PHP and parsoid output differ for this, and since this is primarily
16190 ## for testing Parsoid's serializer, marking this Parsoid only
16191 !!test
16192 Empty TR followed by mixed-ws-comment line should RT correctly
16193 !!options
16194 parsoid
16195 !!input
16196 {|
16197 |-
16198 <!--c-->
16199 |-
16200 <!--c--> <!--d-->
16201 |}
16202 !!result
16203 <table>
16204 <tbody>
16205 <tr>
16206 <td> <!--c--></td></tr>
16207 <tr>
16208 <td><!--c--> <!--d--></td></tr>
16209 </tbody></table>
16210
16211 !!end
16212
16213 !!test
16214 Multi-line image caption generated by templates with/without trailing newlines
16215 !!options
16216 parsoid
16217 !!input
16218 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16219 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16220 !!result
16221 <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>
16222 <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>
16223
16224 !!end
16225
16226 ## PHP emits broken html for this, and since this is primarily
16227 ## a Parsoid serializer test, marking this Parsoid only
16228 !!test
16229 Improperly nested inline or quotes tags with whitespace in between
16230 !!options
16231 parsoid
16232 !!input
16233 <span> <s>x</span> </s>
16234 ''' ''x''' ''
16235 !!result
16236 <p><span> <s>x</s></span><s> </s>
16237 <b> <i>x</i></b><i> </i>
16238 </p>
16239 !!end
16240
16241 # -----------------------------------------------------------------
16242 # The following section of tests are primarily to spec requirements
16243 # around serialization of new/edited content.
16244 #
16245 # All these tests are marked Parsoid html2wt and html2html only
16246 # ----------------------------------------------------------------
16247
16248 !! test
16249 Image: Modifying size of an image
16250 !! options
16251 parsoid=html2wt
16252 !! input
16253 [[Image:Wiki.png|230x230px]]
16254 !! result
16255 <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>
16256 !!end
16257
16258 !! test
16259 Image: New block level image should have \n before and after
16260 !! options
16261 parsoid=html2wt
16262 !! input
16263 123
16264 [[File:Wiki.png|right|thumb|150x150px]]
16265 456
16266 !! result
16267 <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>
16268 !!end
16269
16270 !! test
16271 Lists: Add space after bullets
16272 !! options
16273 parsoid=html2wt
16274 !! input
16275
16276 * foo
16277 * bar
16278 * <span> baz</span>
16279 !! result
16280 <ul>
16281 <li>foo</li>
16282 <li> bar</li>
16283 <li><span> baz</span></li>
16284 </ul>
16285 !! end
16286
16287
16288 TODO:
16289 more images
16290 more tables
16291 character entities
16292 and much more
16293 Try for 100% code coverage