Merge "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 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1619 {{echo|<nowiki></nowiki>}}
1620 !! result
1621 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1622 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1623 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1624 </p>
1625 !! end
1626
1627 ###
1628 ### Parsoid-centric tests for testing RT edge cases for pre
1629 ###
1630
1631 !!test
1632 1a. Indent-Pre and Comments
1633 !!input
1634 a
1635 <!--a-->
1636 c
1637 !!result
1638 <pre>a
1639 </pre>
1640 <p>c
1641 </p>
1642 !!end
1643
1644 !!test
1645 1b. Indent-Pre and Comments
1646 !!input
1647 a
1648 <!--a-->
1649 c
1650 !!result
1651 <pre>a
1652 </pre>
1653 <p>c
1654 </p>
1655 !!end
1656
1657 !!test
1658 1c. Indent-Pre and Comments
1659 !!input
1660 <!--a--> a
1661
1662 <!--a--> a
1663 !!result
1664 <pre> a
1665 </pre>
1666 <pre> a
1667 </pre>
1668 !!end
1669
1670 !!test
1671 2a. Indent-Pre and tables
1672 !!input
1673 {|
1674 |-
1675 !h1!!h2
1676 |foo||bar
1677 |}
1678 !!result
1679 <table>
1680
1681 <tr>
1682 <th>h1</th>
1683 <th>h2
1684 </th>
1685 <td>foo</td>
1686 <td>bar
1687 </td></tr></table>
1688
1689 !!end
1690
1691 !!test
1692 2b. Indent-Pre and tables
1693 !!input
1694 {|
1695 |-
1696 |foo
1697 |}
1698 !!result
1699 <table>
1700
1701 <tr>
1702 <td>foo
1703 </td></tr></table>
1704
1705 !!end
1706
1707 !!test
1708 2c. Indent-Pre and tables (bug 42252)
1709 !!input
1710 {|
1711 |+ foo
1712 ! | bar
1713 |}
1714 !!result
1715 <table>
1716 <caption> foo
1717 </caption>
1718 <tr>
1719 <th> bar
1720 </th></tr></table>
1721
1722 !!end
1723
1724 !!test
1725 3a. Indent-Pre and block tags (single-line html)
1726 !!input
1727 <p> foo </p>
1728 <div> foo </div>
1729 <span> foo </span>
1730 !!result
1731 <p> foo </p>
1732 <div> foo </div>
1733 <pre><span> foo </span>
1734 </pre>
1735 !!end
1736
1737 !!test
1738 3b. Indent-Pre and block tags (pre-content on separate line)
1739 !!input
1740 <p>
1741 foo
1742 </p>
1743
1744 <div>
1745 foo
1746 </div>
1747
1748 <center>
1749 foo
1750 </center>
1751
1752 <blockquote>
1753 foo
1754 </blockquote>
1755
1756 <table><tr><td>
1757 foo
1758 </td></tr></table>
1759
1760 <ul><li>
1761 foo
1762 </li></ul>
1763
1764 !!result
1765 <p>
1766 foo
1767 </p>
1768 <div>
1769 <pre>foo
1770 </pre>
1771 </div>
1772 <center>
1773 <pre>foo
1774 </pre>
1775 </center>
1776 <blockquote>
1777 foo
1778 </blockquote>
1779 <table><tr><td>
1780 <pre>foo
1781 </pre>
1782 </td></tr></table>
1783 <ul><li>
1784 foo
1785 </li></ul>
1786
1787 !!end
1788
1789 !!test
1790 4. Multiple spaces at start-of-line
1791 !!input
1792 <p> foo </p>
1793 foo
1794 {|
1795 |foo
1796 |}
1797 !!result
1798 <p> foo </p>
1799 <pre> foo
1800 </pre>
1801 <table>
1802 <tr>
1803 <td>foo
1804 </td></tr></table>
1805
1806 !!end
1807
1808 !! test
1809 5. White-space in indent-pre
1810 NOTE: the white-space char on 2nd line is significant
1811 !! input
1812 a<br/>
1813
1814 b
1815 !! result
1816 <pre>a<br />
1817
1818 b
1819 </pre>
1820 !! end
1821
1822 ###
1823 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1824 ###
1825
1826 !!test
1827 HTML-pre: 1. embedded newlines
1828 !!input
1829 <pre>foo</pre>
1830
1831 <pre>
1832 foo
1833 </pre>
1834
1835 <pre>
1836
1837 foo
1838 </pre>
1839
1840 <pre>
1841
1842
1843 foo
1844 </pre>
1845 !!result
1846 <pre>foo</pre>
1847 <pre>
1848 foo
1849 </pre>
1850 <pre>
1851
1852 foo
1853 </pre>
1854 <pre>
1855
1856
1857 foo
1858 </pre>
1859
1860 !!end
1861
1862 !!test
1863 HTML-pre: 2: indented text
1864 !!input
1865 <pre>
1866 foo
1867 </pre>
1868 !!result
1869 <pre>
1870 foo
1871 </pre>
1872
1873 !!end
1874
1875 !!test
1876 HTML-pre: 3: other wikitext
1877 !!input
1878 <pre>
1879 * foo
1880 # bar
1881 = no-h =
1882 '' no-italic ''
1883 [[ NoLink ]]
1884 </pre>
1885 !!result
1886 <pre>
1887 * foo
1888 # bar
1889 = no-h =
1890 '' no-italic ''
1891 [[ NoLink ]]
1892 </pre>
1893
1894 !!end
1895
1896 ###
1897 ### Definition lists
1898 ###
1899 !! test
1900 Simple definition
1901 !! input
1902 ; name : Definition
1903 !! result
1904 <dl><dt> name&#160;</dt><dd> Definition
1905 </dd></dl>
1906
1907 !! end
1908
1909 !! test
1910 Definition list for indentation only
1911 !! input
1912 : Indented text
1913 !! result
1914 <dl><dd> Indented text
1915 </dd></dl>
1916
1917 !! end
1918
1919 !! test
1920 Definition list with no space
1921 !! input
1922 ;name:Definition
1923 !! result
1924 <dl><dt>name</dt><dd>Definition
1925 </dd></dl>
1926
1927 !!end
1928
1929 !! test
1930 Definition list with URL link
1931 !! input
1932 ; http://example.com/ : definition
1933 !! result
1934 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1935 </dd></dl>
1936
1937 !! end
1938
1939 !! test
1940 Definition list with bracketed URL link
1941 !! input
1942 ;[http://www.example.com/ Example]:Something about it
1943 !! result
1944 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1945 </dd></dl>
1946
1947 !! end
1948
1949 !! test
1950 Definition list with wikilink containing colon
1951 !! input
1952 ; [[Help:FAQ]]: The least-read page on Wikipedia
1953 !! result
1954 <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
1955 </dd></dl>
1956
1957 !! end
1958
1959 # At Brion's and JeLuF's insistence... :)
1960 !! test
1961 Definition list with news link containing colon
1962 !! input
1963 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1964 !! result
1965 <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!
1966 </dd></dl>
1967
1968 !! end
1969
1970 !! test
1971 Malformed definition list with colon
1972 !! input
1973 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1974 !! result
1975 <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
1976 </dt></dl>
1977
1978 !! end
1979
1980 !! test
1981 Definition lists: colon in external link text
1982 !! input
1983 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1984 !! result
1985 <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
1986 </dd></dl>
1987
1988 !! end
1989
1990 !! test
1991 Definition lists: colon in HTML attribute
1992 !! input
1993 ;<b style="display: inline">bold</b>
1994 !! result
1995 <dl><dt><b style="display: inline">bold</b>
1996 </dt></dl>
1997
1998 !! end
1999
2000 !! test
2001 Definition lists: self-closed tag
2002 !! input
2003 ;one<br/>two : two-line fun
2004 !! result
2005 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2006 </dd></dl>
2007
2008 !! end
2009
2010 !! test
2011 Bug 11748: Literal closing tags
2012 !! input
2013 <dl>
2014 <dt>test 1</dt>
2015 <dd>test test test test test</dd>
2016 <dt>test 2</dt>
2017 <dd>test test test test test</dd>
2018 </dl>
2019 !! result
2020 <dl>
2021 <dt>test 1</dt>
2022 <dd>test test test test test</dd>
2023 <dt>test 2</dt>
2024 <dd>test test test test test</dd>
2025 </dl>
2026
2027 !! end
2028
2029 !! test
2030 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2031 !! input
2032 <ul><li>
2033 ; term : description
2034 * unordered
2035 </li>
2036 </ul>
2037 !! result
2038 <ul><li>
2039 <dl><dt> term&#160;</dt><dd> description
2040 </dd></dl>
2041 <ul><li> unordered
2042 </li></ul>
2043 </li>
2044 </ul>
2045
2046 !! end
2047
2048 !! test
2049
2050 Definition list with empty definition and following paragraph
2051 !! input
2052 ; term:
2053 Paragraph text
2054 !! result
2055 <dl><dt> term</dt><dd>
2056 </dd></dl>
2057 <p>Paragraph text
2058 </p>
2059 !! end
2060
2061 !! test
2062 Nested definition lists using html syntax
2063 !! input
2064 <dl><dd>
2065 <dl>
2066 <dd>Foo</dd>
2067 </dl>
2068 </dd></dl>
2069 !! result
2070 <dl><dd>
2071 <dl>
2072 <dd>Foo</dd>
2073 </dl>
2074 </dd></dl>
2075
2076 !! end
2077
2078 !! test
2079 Definition Lists: No nesting: Multiple dd's
2080 !! input
2081 ;x
2082 :a
2083 :b
2084 !! result
2085 <dl><dt>x
2086 </dt><dd>a
2087 </dd><dd>b
2088 </dd></dl>
2089
2090 !! end
2091
2092 !! test
2093 Definition Lists: Indentation: Regular
2094 !! input
2095 :i1
2096 ::i2
2097 :::i3
2098 !! result
2099 <dl><dd>i1
2100 <dl><dd>i2
2101 <dl><dd>i3
2102 </dd></dl>
2103 </dd></dl>
2104 </dd></dl>
2105
2106 !! end
2107
2108 !! test
2109 Definition Lists: Indentation: Missing 1st level
2110 !! input
2111 ::i2
2112 :::i3
2113 !! result
2114 <dl><dd><dl><dd>i2
2115 <dl><dd>i3
2116 </dd></dl>
2117 </dd></dl>
2118 </dd></dl>
2119
2120 !! end
2121
2122 !! test
2123 Definition Lists: Indentation: Multi-level indent
2124 !! input
2125 :::i3
2126 !! result
2127 <dl><dd><dl><dd><dl><dd>i3
2128 </dd></dl>
2129 </dd></dl>
2130 </dd></dl>
2131
2132 !! end
2133
2134 !! test
2135 Definition Lists: Hacky use to indent tables
2136 !! input
2137 ::{|
2138 |foo
2139 |bar
2140 |}
2141 this text
2142 should be left alone
2143 !! result
2144 <dl><dd><dl><dd><table>
2145 <tr>
2146 <td>foo
2147 </td>
2148 <td>bar
2149 </td></tr></table></dd></dl></dd></dl>
2150 <p>this text
2151 should be left alone
2152 </p>
2153 !! end
2154 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2155 ## as an empty dt item. It also ignores all but the last ";" when followed
2156 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2157 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2158 ## ";"s.
2159 ##
2160 ## Ex: ";;t2 ::d2" is transformed into:
2161 ##
2162 ## <dl>
2163 ## <dt>t2 </dt>
2164 ## <dd>
2165 ## <dl>
2166 ## <dt></dt>
2167 ## <dd>d2</dd>
2168 ## </dl>
2169 ## </dd>
2170 ## </dl>
2171 ##
2172 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2173 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2174 ##
2175 ## <dl>
2176 ## <dt>
2177 ## <dl>
2178 ## <dt>t2 </dt>
2179 ## <dd>:d2</dd>
2180 ## </dl>
2181 ## </dt>
2182 ## </dl>
2183 ##
2184 ## All Parsoid only definition list tests have this difference.
2185 ##
2186 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2187 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2188
2189 !! test
2190 Table / list interaction: indented table with lists in table contents
2191 !! input
2192 :{|
2193 |-
2194 | a
2195 * b
2196 |-
2197 | c
2198 * d
2199 |}
2200 !! result
2201 <dl><dd><table>
2202
2203 <tr>
2204 <td> a
2205 <ul><li> b
2206 </li></ul>
2207 </td></tr>
2208 <tr>
2209 <td> c
2210 <ul><li> d
2211 </li></ul>
2212 </td></tr></table></dd></dl>
2213
2214 !! end
2215
2216 !!test
2217 Table / list interaction: lists nested in tables nested in indented lists
2218 !!input
2219 :{|
2220 |
2221 :a
2222 :b
2223 |
2224 *c
2225 *d
2226 |}
2227
2228 *e
2229 *f
2230 !!result
2231 <dl><dd><table>
2232 <tr>
2233 <td>
2234 <dl><dd>a
2235 </dd><dd>b
2236 </dd></dl>
2237 </td>
2238 <td>
2239 <ul><li>c
2240 </li><li>d
2241 </li></ul>
2242 </td></tr></table></dd></dl>
2243 <ul><li>e
2244 </li><li>f
2245 </li></ul>
2246
2247 !!end
2248
2249 !! test
2250 Definition Lists: Nesting: Multi-level (Parsoid only)
2251 !! options
2252 parsoid
2253 !! input
2254 ;t1 :d1
2255 ;;t2 ::d2
2256 ;;;t3 :::d3
2257 !! result
2258 <dl>
2259 <dt>t1 </dt>
2260 <dd>d1</dd>
2261 <dt>
2262 <dl>
2263 <dt>t2 </dt>
2264 <dd>:d2</dd>
2265 <dt>
2266 <dl>
2267 <dt>t3 </dt>
2268 <dd>::d3</dd>
2269 </dl>
2270 </dt>
2271 </dl>
2272 </dt>
2273 </dl>
2274
2275
2276 !! end
2277
2278
2279 !! test
2280 Definition Lists: Nesting: Test 2 (Parsoid only)
2281 !! options
2282 parsoid
2283 !! input
2284 ;t1
2285 ::d2
2286 !! result
2287 <dl>
2288 <dt>t1</dt>
2289 <dd>
2290 <dl>
2291 <dd>d2</dd>
2292 </dl>
2293 </dd>
2294 </dl>
2295
2296 !! end
2297
2298
2299 !! test
2300 Definition Lists: Nesting: Test 3 (Parsoid only)
2301 !! options
2302 parsoid
2303 !! input
2304 :;t1
2305 ::::d2
2306 !! result
2307 <dl>
2308 <dd>
2309 <dl>
2310 <dt>t1</dt>
2311 <dd>
2312 <dl>
2313 <dd>
2314 <dl>
2315 <dd>d2</dd>
2316 </dl>
2317 </dd>
2318 </dl>
2319 </dd>
2320 </dl>
2321 </dd>
2322 </dl>
2323
2324 !! end
2325
2326
2327 !! test
2328 Definition Lists: Nesting: Test 4
2329 !! input
2330 ::;t3
2331 :::d3
2332 !! result
2333 <dl><dd><dl><dd><dl><dt>t3
2334 </dt><dd>d3
2335 </dd></dl>
2336 </dd></dl>
2337 </dd></dl>
2338
2339 !! end
2340
2341
2342 ## The Parsoid team believes the following three test exposes a
2343 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2344 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2345 !! test
2346 Definition Lists: Mixed Lists: Test 1 (php)
2347 !! options
2348 php
2349 !! input
2350 :;* foo
2351 ::* bar
2352 :; baz
2353 !! result
2354 <dl><dd><dl><dt><ul><li> foo
2355 </li><li> bar
2356 </li></ul>
2357 </dt></dl>
2358 <dl><dt> baz
2359 </dt></dl>
2360 </dd></dl>
2361
2362 !! end
2363 !! test
2364 Definition Lists: Mixed Lists: Test 1 (parsoid)
2365 !! options
2366 parsoid
2367 !! input
2368 :;* foo
2369 ::* bar
2370 :; baz
2371 !! result
2372 <dl><dd><dl><dt><ul><li> foo
2373 </li></ul></dt><dd><ul><li> bar
2374 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2375 !! end
2376
2377 !! test
2378 Definition Lists: Mixed Lists: Test 2
2379 !! input
2380 *: d1
2381 *: d2
2382 !! result
2383 <ul><li><dl><dd> d1
2384 </dd><dd> d2
2385 </dd></dl>
2386 </li></ul>
2387
2388 !! end
2389
2390
2391 !! test
2392 Definition Lists: Mixed Lists: Test 3
2393 !! input
2394 *::: d1
2395 *::: d2
2396 !! result
2397 <ul><li><dl><dd><dl><dd><dl><dd> d1
2398 </dd><dd> d2
2399 </dd></dl>
2400 </dd></dl>
2401 </dd></dl>
2402 </li></ul>
2403
2404 !! end
2405
2406
2407 !! test
2408 Definition Lists: Mixed Lists: Test 4
2409 !! input
2410 *;d1 :d2
2411 *;d3 :d4
2412 !! result
2413 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2414 </dd><dt>d3&#160;</dt><dd>d4
2415 </dd></dl>
2416 </li></ul>
2417
2418 !! end
2419
2420
2421 !! test
2422 Definition Lists: Mixed Lists: Test 5
2423 !! input
2424 *:d1
2425 *:: d2
2426 !! result
2427 <ul><li><dl><dd>d1
2428 <dl><dd> d2
2429 </dd></dl>
2430 </dd></dl>
2431 </li></ul>
2432
2433 !! end
2434
2435
2436 !! test
2437 Definition Lists: Mixed Lists: Test 6
2438 !! input
2439 #*:d1
2440 #*::: d3
2441 !! result
2442 <ol><li><ul><li><dl><dd>d1
2443 <dl><dd><dl><dd> d3
2444 </dd></dl>
2445 </dd></dl>
2446 </dd></dl>
2447 </li></ul>
2448 </li></ol>
2449
2450 !! end
2451
2452
2453 !! test
2454 Definition Lists: Mixed Lists: Test 7
2455 !! input
2456 :* d1
2457 :* d2
2458 !! result
2459 <dl><dd><ul><li> d1
2460 </li><li> d2
2461 </li></ul>
2462 </dd></dl>
2463
2464 !! end
2465
2466
2467 !! test
2468 Definition Lists: Mixed Lists: Test 8
2469 !! input
2470 :* d1
2471 ::* d2
2472 !! result
2473 <dl><dd><ul><li> d1
2474 </li></ul>
2475 <dl><dd><ul><li> d2
2476 </li></ul>
2477 </dd></dl>
2478 </dd></dl>
2479
2480 !! end
2481
2482
2483 !! test
2484 Definition Lists: Mixed Lists: Test 9
2485 !! input
2486 *;foo :bar
2487 !! result
2488 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2489 </dd></dl>
2490 </li></ul>
2491
2492 !! end
2493
2494
2495 !! test
2496 Definition Lists: Mixed Lists: Test 10
2497 !! input
2498 *#;foo :bar
2499 !! result
2500 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2501 </dd></dl>
2502 </li></ol>
2503 </li></ul>
2504
2505 !! end
2506
2507 # The Parsoid team disagrees with the PHP parser's seemingly-random
2508 # rules regarding dd/dt on the next two tests. Parsoid is more
2509 # consistent, and recognizes the shared nesting and keeps the
2510 # still-open tags around until the nesting is complete.
2511
2512 !! test
2513 Definition Lists: Mixed Lists: Test 11 (php)
2514 !! options
2515 php
2516 !! input
2517 *#*#;*;;foo :bar
2518 *#*#;boo :baz
2519 !! result
2520 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2521 </dt></dl>
2522 </dd></dl>
2523 </li></ul>
2524 </dd></dl>
2525 <dl><dt>boo&#160;</dt><dd>baz
2526 </dd></dl>
2527 </li></ol>
2528 </li></ul>
2529 </li></ol>
2530 </li></ul>
2531
2532 !! end
2533 !! test
2534 Definition Lists: Mixed Lists: Test 11 (parsoid)
2535 !! options
2536 parsoid
2537 !! input
2538 *#*#;*;;foo :bar
2539 *#*#;boo :baz
2540 !! result
2541 <ul>
2542 <li>
2543 <ol>
2544 <li>
2545 <ul>
2546 <li>
2547 <ol>
2548 <li>
2549 <dl>
2550 <dt>
2551 <ul>
2552 <li>
2553 <dl>
2554 <dt>
2555 <dl>
2556 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2557 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2558 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2559 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2560 !! end
2561
2562
2563 !! test
2564 Definition Lists: Weird Ones: Test 1 (php)
2565 !! options
2566 php
2567 !! input
2568 *#;*::;; foo : bar (who uses this?)
2569 !! result
2570 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2571 </dt></dl>
2572 </dd></dl>
2573 </dd></dl>
2574 </dd></dl>
2575 </li></ul>
2576 </dd></dl>
2577 </li></ol>
2578 </li></ul>
2579
2580 !! end
2581 !! test
2582 Definition Lists: Weird Ones: Test 1 (parsoid)
2583 !! options
2584 parsoid
2585 !! input
2586 *#;*::;; foo : bar (who uses this?)
2587 !! result
2588 <ul>
2589 <li>
2590 <ol>
2591 <li>
2592 <dl>
2593 <dt>
2594 <ul>
2595 <li>
2596 <dl>
2597 <dd>
2598 <dl>
2599 <dd>
2600 <dl>
2601 <dt>
2602 <dl>
2603 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2604 <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>
2605 !! end
2606
2607 ###
2608 ### External links
2609 ###
2610 !! test
2611 External links: non-bracketed
2612 !! input
2613 Non-bracketed: http://example.com
2614 !! result
2615 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2616 </p>
2617 !! end
2618
2619 !! test
2620 External links: numbered
2621 !! input
2622 Numbered: [http://example.com]
2623 Numbered: [http://example.net]
2624 Numbered: [http://example.com]
2625 !! result
2626 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2627 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2628 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2629 </p>
2630 !!end
2631
2632 !! test
2633 External links: specified text
2634 !! input
2635 Specified text: [http://example.com link]
2636 !! result
2637 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2638 </p>
2639 !!end
2640
2641 !! test
2642 External links: trail
2643 !! input
2644 Linktrails should not work for external links: [http://example.com link]s
2645 !! result
2646 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2647 </p>
2648 !! end
2649
2650 !! test
2651 External links: dollar sign in URL
2652 !! input
2653 http://example.com/1$2345
2654 !! result
2655 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2656 </p>
2657 !! end
2658
2659 !! test
2660 External links: dollar sign in URL (named)
2661 !! input
2662 [http://example.com/1$2345]
2663 !! result
2664 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2665 </p>
2666 !!end
2667
2668 !! test
2669 External links: open square bracket forbidden in URL (bug 4377)
2670 !! input
2671 http://example.com/1[2345
2672 !! result
2673 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2674 </p>
2675 !! end
2676
2677 !! test
2678 External links: open square bracket forbidden in URL (named) (bug 4377)
2679 !! input
2680 [http://example.com/1[2345]
2681 !! result
2682 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2683 </p>
2684 !!end
2685
2686 !! test
2687 External links: nowiki in URL link text (bug 6230)
2688 !!input
2689 [http://example.com/ <nowiki>''example site''</nowiki>]
2690 !! result
2691 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2692 </p>
2693 !! end
2694
2695 !! test
2696 External links: newline forbidden in text (bug 6230 regression check)
2697 !! input
2698 [http://example.com/ first
2699 second]
2700 !! result
2701 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2702 second]
2703 </p>
2704 !!end
2705
2706 !! test
2707 External links: Pipe char between url and text
2708 !! input
2709 [http://example.com | link]
2710 !! result
2711 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2712 </p>
2713 !!end
2714
2715 !! test
2716 External links: protocol-relative URL in brackets
2717 !! input
2718 [//example.com/ Test]
2719 !! result
2720 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2721 </p>
2722 !! end
2723
2724 !! test
2725 External links: protocol-relative URL in brackets without text
2726 !! input
2727 [//example.com]
2728 !! result
2729 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2730 </p>
2731 !! end
2732
2733 !! test
2734 External links: protocol-relative URL in free text is left alone
2735 !! input
2736 //example.com/Foo
2737 !! result
2738 <p>//example.com/Foo
2739 </p>
2740 !!end
2741
2742 !! test
2743 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2744 !! input
2745 foo//example.com/Foo
2746 !! result
2747 <p>foo//example.com/Foo
2748 </p>
2749 !! end
2750
2751 !! test
2752 External image
2753 !! input
2754 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2755 !! result
2756 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2757 </p>
2758 !! end
2759
2760 !! test
2761 External image from https
2762 !! input
2763 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2764 !! result
2765 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2766 </p>
2767 !! end
2768
2769 !! test
2770 External image (when not allowed)
2771 !! options
2772 wgAllowExternalImages=0
2773 !! input
2774 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2775 !! result
2776 <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>
2777 </p>
2778 !! end
2779
2780 !! test
2781 Link to non-http image, no img tag
2782 !! input
2783 Link to non-http image, no img tag: ftp://example.com/test.jpg
2784 !! result
2785 <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>
2786 </p>
2787 !! end
2788
2789 !! test
2790 External links: terminating separator
2791 !! input
2792 Terminating separator: http://example.com/thing,
2793 !! result
2794 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2795 </p>
2796 !! end
2797
2798 !! test
2799 External links: intervening separator
2800 !! input
2801 Intervening separator: http://example.com/1,2,3
2802 !! result
2803 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2804 </p>
2805 !! end
2806
2807 !! test
2808 External links: old bug with URL in query
2809 !! input
2810 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2811 !! result
2812 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2813 </p>
2814 !! end
2815
2816 !! test
2817 External links: old URL-in-URL bug, mixed protocols
2818 !! input
2819 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2820 !! result
2821 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2822 </p>
2823 !!end
2824
2825 !! test
2826 External links: URL in text
2827 !! input
2828 URL in text: [http://example.com http://example.com]
2829 !! result
2830 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2831 </p>
2832 !! end
2833
2834 !! test
2835 External links: Clickable images
2836 !! input
2837 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2838 !! result
2839 <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>
2840 </p>
2841 !!end
2842
2843 !! test
2844 External links: raw ampersand
2845 !! input
2846 Old &amp; use: http://x&y
2847 !! result
2848 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2849 </p>
2850 !! end
2851
2852 !! test
2853 External links: encoded ampersand
2854 !! input
2855 Old &amp; use: http://x&amp;y
2856 !! result
2857 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2858 </p>
2859 !! end
2860
2861 !! test
2862 External links: encoded equals (bug 6102)
2863 !! input
2864 http://example.com/?foo&#61;bar
2865 !! result
2866 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2867 </p>
2868 !! end
2869
2870 !! test
2871 External links: [raw ampersand]
2872 !! input
2873 Old &amp; use: [http://x&y]
2874 !! result
2875 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2876 </p>
2877 !! end
2878
2879 !! test
2880 External links: [encoded ampersand]
2881 !! input
2882 Old &amp; use: [http://x&amp;y]
2883 !! result
2884 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2885 </p>
2886 !! end
2887
2888 !! test
2889 External links: [encoded equals] (bug 6102)
2890 !! input
2891 [http://example.com/?foo&#61;bar]
2892 !! result
2893 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2894 </p>
2895 !! end
2896
2897 !! test
2898 External links: [IDN ignored character reference in hostname; strip it right off]
2899 !! input
2900 [http://e&zwnj;xample.com/]
2901 !! result
2902 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2903 </p>
2904 !! end
2905
2906 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2907 # Where an external link could easily circumvent the sanitization of the text of
2908 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2909 # test demands a higher standard. That's a bit strange.
2910 #
2911 # Example:
2912 #
2913 # http://e‌xample.com -> [http://example.com|http://example.com]
2914 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2915 #
2916 # The first example is sanitized, but the second is not. Any security benefits
2917 # from this production are trivial to circumvent. Either remove this test and
2918 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2919 # the test accordingly.
2920 #
2921 # All our love,
2922 # The Parsoid team.
2923 !! test
2924 External links: IDN ignored character reference in hostname; strip it right off
2925 !! input
2926 http://e&zwnj;xample.com/
2927 !! result
2928 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 External links: www.jpeg.org (bug 554)
2934 !! input
2935 http://www.jpeg.org
2936 !!result
2937 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2938 </p>
2939 !! end
2940
2941 !! test
2942 External links: URL within URL (original bug 2)
2943 !! input
2944 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2945 !! result
2946 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2947 </p>
2948 !! end
2949
2950 !! test
2951 BUG 361: URL inside bracketed URL
2952 !! input
2953 [http://www.example.com/foo http://www.example.com/bar]
2954 !! result
2955 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2956 </p>
2957 !! end
2958
2959 !! test
2960 BUG 361: URL within URL, not bracketed
2961 !! input
2962 http://www.example.com/foo?=http://www.example.com/bar
2963 !! result
2964 <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>
2965 </p>
2966 !! end
2967
2968 !! test
2969 BUG 289: ">"-token in URL-tail
2970 !! input
2971 http://www.example.com/<hello>
2972 !! result
2973 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2974 </p>
2975 !!end
2976
2977 !! test
2978 BUG 289: literal ">"-token in URL-tail
2979 !! input
2980 http://www.example.com/<b>html</b>
2981 !! result
2982 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2983 </p>
2984 !!end
2985
2986 !! test
2987 BUG 289: ">"-token in bracketed URL
2988 !! input
2989 [http://www.example.com/<hello> stuff]
2990 !! result
2991 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2992 </p>
2993 !!end
2994
2995 !! test
2996 BUG 289: literal ">"-token in bracketed URL
2997 !! input
2998 [http://www.example.com/<b>html</b> stuff]
2999 !! result
3000 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3001 </p>
3002 !!end
3003
3004 !! test
3005 BUG 289: literal double quote at end of URL
3006 !! input
3007 http://www.example.com/"hello"
3008 !! result
3009 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3010 </p>
3011 !!end
3012
3013 !! test
3014 BUG 289: literal double quote in bracketed URL
3015 !! input
3016 [http://www.example.com/"hello" stuff]
3017 !! result
3018 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3019 </p>
3020 !!end
3021
3022 !! test
3023 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3024 !! input
3025 [http://www.example.com test]
3026 !! result
3027 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3028 </p>
3029 !! end
3030
3031 !! test
3032 External links: link text with spaces
3033 !! input
3034 [http://www.example.com a b c]
3035 [http://www.example.com ''a'' ''b'']
3036 !! result
3037 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3038 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3039 </p>
3040 !! end
3041
3042 !! test
3043 External links: wiki links within external link (Bug 3695)
3044 !! input
3045 [http://example.com [[wikilink]] embedded in ext link]
3046 !! result
3047 <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>
3048 </p>
3049 !! end
3050
3051 !! test
3052 BUG 787: Links with one slash after the url protocol are invalid
3053 !! input
3054 http:/example.com
3055
3056 [http:/example.com title]
3057 !! result
3058 <p>http:/example.com
3059 </p><p>[http:/example.com title]
3060 </p>
3061 !! end
3062
3063 !! test
3064 Bracketed external links with template-generated invalid target
3065 !! input
3066 [{{echo|http:/example.com}} title]
3067 !! result
3068 <p>[http:/example.com title]
3069 </p>
3070 !! end
3071
3072 !! test
3073 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3074 !! input
3075 ''[http://example.com text'']
3076 [http://example.com '''text]'''
3077 ''Something [http://example.com in italic'']
3078 ''Something [http://example.com mixed''''', even bold]'''
3079 '''''Now [http://example.com both''''']
3080 !! result
3081 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3082 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3083 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3084 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3085 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3086 </p>
3087 !! end
3088
3089
3090 !! test
3091 Bug 4781: %26 in URL
3092 !! input
3093 http://www.example.com/?title=AT%26T
3094 !! result
3095 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3096 </p>
3097 !! end
3098
3099 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3100 # % is actually legal in HTML5. Any change in output would need testing though.
3101 !! test
3102 Bug 4781, 5267: %25 in URL
3103 !! input
3104 http://www.example.com/?title=100%25_Bran
3105 !! result
3106 <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>
3107 </p>
3108 !! end
3109
3110 !! test
3111 Bug 4781, 5267: %28, %29 in URL
3112 !! input
3113 http://www.example.com/?title=Ben-Hur_%281959_film%29
3114 !! result
3115 <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>
3116 </p>
3117 !! end
3118
3119
3120 !! test
3121 Bug 4781: %26 in autonumber URL
3122 !! input
3123 [http://www.example.com/?title=AT%26T]
3124 !! result
3125 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3126 </p>
3127 !! end
3128
3129 !! test
3130 Bug 4781, 5267: %26 in autonumber URL
3131 !! input
3132 [http://www.example.com/?title=100%25_Bran]
3133 !! result
3134 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3135 </p>
3136 !! end
3137
3138 !! test
3139 Bug 4781, 5267: %28, %29 in autonumber URL
3140 !! input
3141 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3142 !! result
3143 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3144 </p>
3145 !! end
3146
3147
3148 !! test
3149 Bug 4781: %26 in bracketed URL
3150 !! input
3151 [http://www.example.com/?title=AT%26T link]
3152 !! result
3153 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3154 </p>
3155 !! end
3156
3157 !! test
3158 Bug 4781, 5267: %26 in bracketed URL
3159 !! input
3160 [http://www.example.com/?title=100%25_Bran link]
3161 !! result
3162 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3163 </p>
3164 !! end
3165
3166 !! test
3167 Bug 4781, 5267: %28, %29 in bracketed URL
3168 !! input
3169 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3170 !! result
3171 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3172 </p>
3173 !! end
3174
3175 !! test
3176 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3177 !! input
3178 Some [http://example.com/ pretty ''italics'' and stuff]!
3179 !! result
3180 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3181 </p>
3182 !! end
3183
3184 !! test
3185 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3186 !! input
3187 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3188 !! result
3189 <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>
3190 </p>
3191 !! end
3192
3193 !! test
3194 External link containing double-single-quotes with no space separating the url from text in italics
3195 !! input
3196 [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]].]
3197 !! result
3198 <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>
3199 </p>
3200 !! end
3201
3202 !! test
3203 External link with comments in link text
3204 !! input
3205 [http://www.google.com Google <!-- comment -->]
3206 !! result
3207 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3208 </p>
3209 !! end
3210
3211 !! test
3212 URL-encoding in URL functions (single parameter)
3213 !! input
3214 {{localurl:Some page|amp=&}}
3215 !! result
3216 <p>/index.php?title=Some_page&amp;amp=&amp;
3217 </p>
3218 !! end
3219
3220 !! test
3221 URL-encoding in URL functions (multiple parameters)
3222 !! input
3223 {{localurl:Some page|q=?&amp=&}}
3224 !! result
3225 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3226 </p>
3227 !! end
3228
3229 !! test
3230 Brackets in urls
3231 !! input
3232 http://example.com/index.php?foozoid%5B%5D=bar
3233
3234 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3235 !! result
3236 <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>
3237 </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>
3238 </p>
3239 !! end
3240
3241 !! test
3242 IPv6 urls (bug 21261)
3243 !! options
3244 disabled
3245 !! input
3246 http://[2404:130:0:1000::187:2]/index.php
3247 !! result
3248 <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>
3249 </p>
3250 !! end
3251
3252 !! test
3253 Non-extlinks in brackets
3254 !! input
3255 [foo]
3256 [foo bar]
3257 [foo ''bar'']
3258 [fool's] errand
3259 [fool's errand]
3260 [{{echo|foo}}]
3261 [{{echo|foo}} bar]
3262 [{{echo|foo}} ''bar'']
3263 [{{echo|foo}}l's] errand
3264 [{{echo|foo}}l's errand]
3265 [url={{echo|foo}}]
3266 [url=http://example.com]
3267 !! result
3268 <p>[foo]
3269 [foo bar]
3270 [foo <i>bar</i>]
3271 [fool's] errand
3272 [fool's errand]
3273 [foo]
3274 [foo bar]
3275 [foo <i>bar</i>]
3276 [fool's] errand
3277 [fool's errand]
3278 [url=foo]
3279 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3280 </p>
3281 !! end
3282
3283 !! test
3284 Parsoid: Percent encoding in external links
3285 !! options
3286 parsoid
3287 !! input
3288 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3289 !! result
3290 <p><a rel="mw:ExtLink"
3291 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3292 !! end
3293
3294 !! test
3295 Parsoid: use url link syntax for links where the content is equal the link
3296 target
3297 !! options
3298 parsoid
3299 !! input
3300 http://example.com
3301 !! result
3302 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3303 !! end
3304
3305 ###
3306 ### Quotes
3307 ###
3308
3309 !! test
3310 Quotes
3311 !! input
3312 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3313
3314 Normal text. '''''Bold italic text.''''' Normal text.
3315 !!result
3316 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3317 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3318 </p>
3319 !! end
3320
3321
3322 !! test
3323 Unclosed and unmatched quotes (php)
3324 !! options
3325 php
3326 !! input
3327 '''''Bold italic text '''with bold deactivated''' in between.'''''
3328
3329 '''''Bold italic text ''with italic deactivated'' in between.'''''
3330
3331 '''Bold text..
3332
3333 ..spanning two paragraphs (should not work).'''
3334
3335 '''Bold tag left open
3336
3337 ''Italic tag left open
3338
3339 Normal text.
3340
3341 <!-- Unmatching number of opening, closing tags: -->
3342 '''This year''''s election ''should'' beat '''last year''''s.
3343
3344 ''Tom'''s car is bigger than ''Susan'''s.
3345
3346 Plain ''italic'''s plain
3347 !! result
3348 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3349 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3350 </p><p><b>Bold text..</b>
3351 </p><p>..spanning two paragraphs (should not work).
3352 </p><p><b>Bold tag left open</b>
3353 </p><p><i>Italic tag left open</i>
3354 </p><p>Normal text.
3355 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3356 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3357 </p><p>Plain <i>italic'</i>s plain
3358 </p>
3359 !! end
3360 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3361 # parser strips. The wikitext contains just the first half of the bold
3362 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3363 # differently than the PHP parser.)
3364 !! test
3365 Unclosed and unmatched quotes (parsoid)
3366 !! options
3367 parsoid
3368 !! input
3369 '''''Bold italic text '''with bold deactivated''' in between.'''''
3370
3371 '''''Bold italic text ''with italic deactivated'' in between.'''''
3372
3373 '''Bold text..
3374
3375 ..spanning two paragraphs (should not work).'''
3376
3377 '''Bold tag left open
3378
3379 ''Italic tag left open
3380
3381 Normal text.
3382
3383 <!-- Unmatching number of opening, closing tags: -->
3384 '''This year''''s election ''should'' beat '''last year''''s.
3385
3386 ''Tom'''s car is bigger than ''Susan'''s.
3387
3388 Plain ''italic'''s plain
3389 !! result
3390 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3391 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3392 </p><p><b>Bold text..</b>
3393 </p><p>..spanning two paragraphs (should not work).<b></b>
3394 </p><p><b>Bold tag left open</b>
3395 </p><p><i>Italic tag left open</i>
3396 </p><p>Normal text.
3397 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3398 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3399 </p><p>Plain <i>italic'</i>s plain
3400 </p>
3401 !! end
3402
3403 ###
3404 ### Tables
3405 ###
3406 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3407 ###
3408
3409 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3410 # is the bare minimum required by the spec, see:
3411 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3412 !! test
3413 A table with no data. (php)
3414 !! options
3415 php
3416 !! input
3417 {||}
3418 !! result
3419 !! end
3420 # Parsoid team replies: empty table tags are legal in HTML5
3421 !! test
3422 A table with no data. (parsoid)
3423 !! options
3424 parsoid
3425 !! input
3426 {||}
3427 !! result
3428 <table></table>
3429 !! end
3430
3431 # A table with nothing but a caption is invalid XHTML, we might want to render
3432 # this as <p>caption</p>
3433 !! test
3434 A table with nothing but a caption (php)
3435 !! options
3436 php
3437 !! input
3438 {|
3439 |+ caption
3440 |}
3441 !! result
3442 <table>
3443 <caption> caption
3444 </caption><tr><td></td></tr></table>
3445
3446 !! end
3447 # Parsoid team replies: table with only a caption is legal in HTML5
3448 !! test
3449 A table with nothing but a caption (parsoid)
3450 !! options
3451 parsoid
3452 !! input
3453 {|
3454 |+ caption
3455 |}
3456 !! result
3457 <table><caption> caption</caption></table>
3458 !! end
3459
3460 !! test
3461 A table with caption with default-spaced attributes and a table row
3462 !! input
3463 {|
3464 |+ style="color: red;" | caption1
3465 |-
3466 | foo
3467 |}
3468 !! result
3469 <table>
3470 <caption style="color: red;"> caption1
3471 </caption>
3472 <tr>
3473 <td> foo
3474 </td></tr></table>
3475
3476 !! end
3477
3478 !! test
3479 A table with captions with non-default spaced attributes and a table row
3480 !! input
3481 {|
3482 |+style="color: red;"|caption2
3483 |+ style="color: red;"| caption3
3484 |-
3485 | foo
3486 |}
3487 !! result
3488 <table>
3489 <caption style="color: red;">caption2
3490 </caption>
3491 <caption style="color: red;"> caption3
3492 </caption>
3493 <tr>
3494 <td> foo
3495 </td></tr></table>
3496
3497 !! end
3498
3499 !! test
3500 Table td-cell syntax variations
3501 !! input
3502 {|
3503 | foo bar foo | baz
3504 | foo bar foo || baz
3505 | style='color:red;' | baz
3506 | style='color:red;' || baz
3507 |}
3508 !! result
3509 <table>
3510 <tr>
3511 <td> baz
3512 </td>
3513 <td> foo bar foo </td>
3514 <td> baz
3515 </td>
3516 <td style="color:red;"> baz
3517 </td>
3518 <td> style='color:red;' </td>
3519 <td> baz
3520 </td></tr></table>
3521
3522 !! end
3523
3524 !! test
3525 Simple table
3526 !! input
3527 {|
3528 | 1 || 2
3529 |-
3530 | 3 || 4
3531 |}
3532 !! result
3533 <table>
3534 <tr>
3535 <td> 1 </td>
3536 <td> 2
3537 </td></tr>
3538 <tr>
3539 <td> 3 </td>
3540 <td> 4
3541 </td></tr></table>
3542
3543 !! end
3544
3545 !! test
3546 Simple table but with multiple dashes for row wikitext
3547 !! input
3548 {|
3549 | foo
3550 |-----
3551 | bar
3552 |}
3553 !! result
3554 <table>
3555 <tr>
3556 <td> foo
3557 </td></tr>
3558 <tr>
3559 <td> bar
3560 </td></tr></table>
3561
3562 !! end
3563 !! test
3564 Multiplication table
3565 !! input
3566 {| border="1" cellpadding="2"
3567 |+Multiplication table
3568 |-
3569 ! &times; !! 1 !! 2 !! 3
3570 |-
3571 ! 1
3572 | 1 || 2 || 3
3573 |-
3574 ! 2
3575 | 2 || 4 || 6
3576 |-
3577 ! 3
3578 | 3 || 6 || 9
3579 |-
3580 ! 4
3581 | 4 || 8 || 12
3582 |-
3583 ! 5
3584 | 5 || 10 || 15
3585 |}
3586 !! result
3587 <table border="1" cellpadding="2">
3588 <caption>Multiplication table
3589 </caption>
3590 <tr>
3591 <th> &#215; </th>
3592 <th> 1 </th>
3593 <th> 2 </th>
3594 <th> 3
3595 </th></tr>
3596 <tr>
3597 <th> 1
3598 </th>
3599 <td> 1 </td>
3600 <td> 2 </td>
3601 <td> 3
3602 </td></tr>
3603 <tr>
3604 <th> 2
3605 </th>
3606 <td> 2 </td>
3607 <td> 4 </td>
3608 <td> 6
3609 </td></tr>
3610 <tr>
3611 <th> 3
3612 </th>
3613 <td> 3 </td>
3614 <td> 6 </td>
3615 <td> 9
3616 </td></tr>
3617 <tr>
3618 <th> 4
3619 </th>
3620 <td> 4 </td>
3621 <td> 8 </td>
3622 <td> 12
3623 </td></tr>
3624 <tr>
3625 <th> 5
3626 </th>
3627 <td> 5 </td>
3628 <td> 10 </td>
3629 <td> 15
3630 </td></tr></table>
3631
3632 !! end
3633
3634 !! test
3635 Accept "||" in table headings
3636 !! input
3637 {|
3638 !h1 || h2
3639 |}
3640 !! result
3641 <table>
3642 <tr>
3643 <th>h1 </th>
3644 <th> h2
3645 </th></tr></table>
3646
3647 !! end
3648
3649 !! test
3650 Accept "||" in indented table headings
3651 !! input
3652 :{|
3653 !h1 || h2
3654 |}
3655 !! result
3656 <dl><dd><table>
3657 <tr>
3658 <th>h1 </th>
3659 <th> h2
3660 </th></tr></table></dd></dl>
3661
3662 !! end
3663
3664 !! test
3665 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3666 !! input
3667 {|
3668 !| h1
3669 || a
3670 |}
3671 !! result
3672 <table>
3673 <tr>
3674 <th> h1
3675 </th>
3676 <td> a
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !!test
3682 Accept "| !" at start of line in tables (ignore !-attribute)
3683 !!input
3684 {|
3685 |-
3686 | !style="color:red" | bar
3687 |}
3688 !!result
3689 <table>
3690
3691 <tr>
3692 <td> bar
3693 </td></tr></table>
3694
3695 !!end
3696
3697 !!test
3698 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 +/-
3699 !!input
3700 {|
3701 |-
3702 |style='color:red;'|+1
3703 |style='color:blue;'|-1
3704 |-
3705 | 1 || 2 || 3
3706 | 1 ||+2 ||-3
3707 |-
3708 | +1
3709 | -1
3710 |}
3711 !!result
3712 <table>
3713
3714 <tr>
3715 <td style="color:red;">+1
3716 </td>
3717 <td style="color:blue;">-1
3718 </td></tr>
3719 <tr>
3720 <td> 1 </td>
3721 <td> 2 </td>
3722 <td> 3
3723 </td>
3724 <td> 1 </td>
3725 <td>+2 </td>
3726 <td>-3
3727 </td></tr>
3728 <tr>
3729 <td> +1
3730 </td>
3731 <td> -1
3732 </td></tr></table>
3733
3734 !!end
3735
3736 !! test
3737 Table rowspan
3738 !! input
3739 {| border=1
3740 | Cell 1, row 1
3741 |rowspan=2| Cell 2, row 1 (and 2)
3742 | Cell 3, row 1
3743 |-
3744 | Cell 1, row 2
3745 | Cell 3, row 2
3746 |}
3747 !! result
3748 <table border="1">
3749 <tr>
3750 <td> Cell 1, row 1
3751 </td>
3752 <td rowspan="2"> Cell 2, row 1 (and 2)
3753 </td>
3754 <td> Cell 3, row 1
3755 </td></tr>
3756 <tr>
3757 <td> Cell 1, row 2
3758 </td>
3759 <td> Cell 3, row 2
3760 </td></tr></table>
3761
3762 !! end
3763
3764 !! test
3765 Nested table
3766 !! input
3767 {| border=1
3768 | &alpha;
3769 |
3770 {| bgcolor=#ABCDEF border=2
3771 |nested
3772 |-
3773 |table
3774 |}
3775 |the original table again
3776 |}
3777 !! result
3778 <table border="1">
3779 <tr>
3780 <td> &#945;
3781 </td>
3782 <td>
3783 <table bgcolor="#ABCDEF" border="2">
3784 <tr>
3785 <td>nested
3786 </td></tr>
3787 <tr>
3788 <td>table
3789 </td></tr></table>
3790 </td>
3791 <td>the original table again
3792 </td></tr></table>
3793
3794 !! end
3795
3796 !! test
3797 Invalid attributes in table cell (bug 1830)
3798 !! input
3799 {|
3800 |Cell:|broken
3801 |}
3802 !! result
3803 <table>
3804 <tr>
3805 <td>broken
3806 </td></tr></table>
3807
3808 !! end
3809
3810
3811 !! test
3812 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3813 !! input
3814 {|
3815 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3816 !! result
3817 <table>
3818 <tr>
3819 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3820 <td>]" onmouseover="alert(document.cookie)"&gt;test
3821 </td>
3822 </tr>
3823 </table>
3824
3825 !! end
3826
3827
3828 !! test
3829 Indented table markup mixed with indented pre content (proposed in bug 6200)
3830 !! input
3831 <table>
3832 <tr>
3833 <td>
3834 Text that should be rendered preformatted
3835 </td>
3836 </tr>
3837 </table>
3838 !! result
3839 <table>
3840 <tr>
3841 <td>
3842 <pre>Text that should be rendered preformatted
3843 </pre>
3844 </td>
3845 </tr>
3846 </table>
3847
3848 !! end
3849
3850 !! test
3851 Template-generated table cell attributes and cell content
3852 !! input
3853 {|
3854 |{{table_attribs}}
3855 |}
3856 !! result
3857 <table>
3858 <tr>
3859 <td style="color: red"> Foo
3860 </td></tr></table>
3861
3862 !! end
3863
3864 !! test
3865 Template-generated table cell attributes and cell content (2)
3866 !! input
3867 {|
3868 |align=center {{table_attribs}}
3869 |}
3870 !! result
3871 <table>
3872 <tr>
3873 <td align="center" style="color: red"> Foo
3874 </td></tr></table>
3875
3876 !! end
3877
3878 !! test
3879 Template-generated table cell attributes and cell content (3)
3880 !! input
3881 {|
3882 |align=center {{table_cells}}
3883 |}
3884 !! result
3885 <table>
3886 <tr>
3887 <td align="center" style="color: red"> Foo </td>
3888 <td> Bar </td>
3889 <td> Baz
3890 </td></tr></table>
3891
3892 !! end
3893
3894 !! test
3895 Table with row followed by newlines and table heading
3896 !! input
3897 {|
3898 |-
3899
3900 ! foo
3901 |}
3902 !! result
3903 <table>
3904
3905
3906 <tr>
3907 <th> foo
3908 </th></tr></table>
3909
3910 !! end
3911
3912 !! test
3913 Table with empty line following the start tag
3914 !! input
3915 {|
3916
3917 |-
3918 | foo
3919 |}
3920 !! result
3921 <table>
3922
3923
3924 <tr>
3925 <td> foo
3926 </td></tr></table>
3927
3928 !! end
3929
3930 # FIXME: Preserve the attribute properly (with an empty string as value) in
3931 # the PHP parser. Parsoid implements the behavior below.
3932 !! test
3933 Table attributes with empty value
3934 !! options
3935 parsoid
3936 !! input
3937 {|
3938 | style=| hello
3939 |}
3940 !! result
3941 <table>
3942 <tbody>
3943 <tr>
3944 <td style=""> hello
3945 </td></tr></tbody></table>
3946
3947 !! end
3948
3949 !! test
3950 Wikitext table with a lot of comments
3951 !! input
3952 {|
3953 <!-- c0 -->
3954 | foo
3955 <!-- c1 -->
3956 |- <!-- c2 -->
3957 <!-- c3 -->
3958 |<!-- c4 -->
3959 <!-- c5 -->
3960 |}
3961 !! result
3962 <table>
3963 <tr>
3964 <td> foo
3965 </td></tr>
3966 <tr>
3967 <td>
3968 </td></tr></table>
3969
3970 !! end
3971
3972 !! test
3973 Wikitext table with double-line table cell
3974 !! input
3975 {|
3976 |a
3977 b
3978 |}
3979 !! result
3980 <table>
3981 <tr>
3982 <td>a
3983 <p>b
3984 </p>
3985 </td></tr></table>
3986
3987 !! end
3988
3989 !! test
3990 Table cell with a single comment
3991 !! input
3992 {|
3993 | <!-- c1 -->
3994 | a
3995 |}
3996 !! result
3997 <table>
3998 <tr>
3999 <td>
4000 </td>
4001 <td> a
4002 </td></tr></table>
4003
4004 !! end
4005
4006 # The expected HTML structure in this test is debatable. The PHP parser does
4007 # not parse this kind of table at all. The main focus for Parsoid is on
4008 # round-tripping, so this output is ok for now. TODO: revisit!
4009 !! test
4010 Wikitext table with html-syntax row (Parsoid)
4011 !! options
4012 parsoid
4013 !! input
4014 {|
4015 |-
4016 <td>foo</td>
4017 |}
4018 !! result
4019 <table>
4020 <tbody>
4021 <tr>
4022 <td>foo</td></tr></tbody></table>
4023 !! end
4024
4025 !! test
4026 Implicit <td> after a |-
4027 (PHP parser relies on Tidy to add the missing <td> tags)
4028 !! options
4029 parsoid=wt2html,wt2wt
4030 !! input
4031 {|
4032 |-
4033 a
4034 |}
4035 !! result
4036 <table>
4037 <tr><td>a</td></tr>
4038 </table>
4039 !! end
4040
4041 !! test
4042 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4043 (PHP parser relies on Tidy to add the missing <td> tags)
4044 !! options
4045 parsoid=wt2html,wt2wt
4046 !! input
4047 {|
4048 |-
4049 |
4050 a
4051 |-
4052 b
4053 |}
4054 !! result
4055 <table>
4056 <tbody>
4057 <tr><td><pre>a</pre></td></tr>
4058 <tr><td> b</td></tr>
4059 </tbody>
4060 </table>
4061 !! end
4062
4063 !! test
4064 Lists should be recognized in an implicit <td> context
4065 (PHP parser relies on Tidy to add the missing <td> tags)
4066 !! options
4067 parsoid=wt2html,wt2wt
4068 !! input
4069 {|
4070 |-
4071 *a
4072 |}
4073 !! result
4074 <table>
4075 <tr>
4076 <td><ul><li>a</li></ul></td>
4077 </tr>
4078 </table>
4079 !! end
4080
4081 ###
4082 ### Internal links
4083 ###
4084 !! test
4085 Plain link, capitalized
4086 !! input
4087 [[Main Page]]
4088 !! result
4089 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4090 </p>
4091 !! end
4092
4093 !! test
4094 Plain link, uncapitalized
4095 !! input
4096 [[main Page]]
4097 !! result
4098 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4099 </p>
4100 !! end
4101
4102 !! test
4103 Piped link
4104 !! input
4105 [[Main Page|The Main Page]]
4106 !! result
4107 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4108 </p>
4109 !! end
4110
4111 !! test
4112 Piped link with comment in link text
4113 !! input
4114 [[Main Page|The Main<!--front--> Page]]
4115 !! result
4116 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4117 </p>
4118 !! end
4119
4120 !! test
4121 Broken link
4122 !! input
4123 [[Zigzagzogzagzig]]
4124 !! result
4125 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4126 </p>
4127 !! end
4128
4129 !! test
4130 Broken link with fragment
4131 !! input
4132 [[Zigzagzogzagzig#zug]]
4133 !! result
4134 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4135 </p>
4136 !! end
4137
4138 !! test
4139 Special page link with fragment
4140 !! input
4141 [[Special:Version#anchor]]
4142 !! result
4143 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4144 </p>
4145 !! end
4146
4147 !! test
4148 Nonexistent special page link with fragment
4149 !! input
4150 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4151 !! result
4152 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4153 </p>
4154 !! end
4155
4156 !! test
4157 Link with prefix
4158 !! input
4159 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4160 !! result
4161 <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>
4162 </p>
4163 !! end
4164
4165 !! test
4166 Link with suffix
4167 !! input
4168 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4169 !! result
4170 <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>!!!
4171 </p>
4172 !! end
4173
4174 !! article
4175 prefixed article
4176 !! text
4177 Some text
4178 !! endarticle
4179
4180 !! test
4181 Bug 43661: Piped links with identical prefixes
4182 !! input
4183 [[prefixed article|prefixed articles with spaces]]
4184
4185 [[prefixed article|prefixed articlesaoeu]]
4186
4187 [[Main Page|Main Page test]]
4188 !! result
4189 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4190 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4191 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4192 </p>
4193 !! end
4194
4195
4196 !! test
4197 Link with HTML entity in suffix / tail
4198 !! input
4199 [[Main Page]]&quot;, [[Main Page]]&#97;
4200 !! result
4201 <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;
4202 </p>
4203 !! end
4204
4205 !! test
4206 Link with 3 brackets
4207 !! input
4208 [[[main page]]]
4209 !! result
4210 <p>[[[main page]]]
4211 </p>
4212 !! end
4213
4214 !! test
4215 Piped link with 3 brackets
4216 !! input
4217 [[[main page|the main page]]]
4218 !! result
4219 <p>[[[main page|the main page]]]
4220 </p>
4221 !! end
4222
4223 !! test
4224 Link with multiple pipes
4225 !! input
4226 [[Main Page|The|Main|Page]]
4227 !! result
4228 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4229 </p>
4230 !! end
4231
4232 !! test
4233 Link to namespaces
4234 !! input
4235 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4236 !! result
4237 <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>
4238 </p>
4239 !! end
4240
4241 !! test
4242 Piped link to namespace
4243 !! input
4244 [[Meta:Disclaimers|The disclaimers]]
4245 !! result
4246 <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>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Link containing }
4252 !! input
4253 [[Usually caused by a typo (oops}]]
4254 !! result
4255 <p>[[Usually caused by a typo (oops}]]
4256 </p>
4257 !! end
4258
4259 !! test
4260 Link containing % (not as a hex sequence)
4261 !! input
4262 [[7% Solution]]
4263 !! result
4264 <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>
4265 </p>
4266 !! end
4267
4268 !! test
4269 Link containing % as a single hex sequence interpreted to char
4270 !! input
4271 [[7%25 Solution]]
4272 !! result
4273 <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>
4274 </p>
4275 !!end
4276
4277 !! test
4278 Link containing % as a double hex sequence interpreted to hex sequence
4279 !! input
4280 [[7%2525 Solution]]
4281 !! result
4282 <p>[[7%2525 Solution]]
4283 </p>
4284 !!end
4285
4286 !! test
4287 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4288 Example for such a section: == < ==
4289 !! input
4290 [[%23%3c]][[%23%3e]]
4291 !! result
4292 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4293 </p>
4294 !! end
4295
4296 !! test
4297 Link containing "<#" and ">#" as a hex sequences
4298 !! input
4299 [[%3c%23]][[%3e%23]]
4300 !! result
4301 <p>[[%3c%23]][[%3e%23]]
4302 </p>
4303 !! end
4304
4305 !! test
4306 Link containing an equals sign
4307 !! input
4308 [[Special:BookSources/isbn=4-00-026157-6]]
4309 !! result
4310 <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>
4311 </p>
4312 !! end
4313
4314 !! article
4315 Foo~bar
4316 !! text
4317 Just a test of an article title containing a tilde.
4318 !! endarticle
4319
4320 # note that links containing signatures, like [[Foo~~~~]], are
4321 # massaged by the pre-save transform (PST) and so the tildes are never
4322 # seen by the parser.
4323 !! test
4324 Link containing a tilde
4325 !! input
4326 [[Foo~bar]]
4327 !! result
4328 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4329 </p>
4330 !! end
4331
4332 !! test
4333 Link containing double-single-quotes '' (bug 4598)
4334 !! input
4335 [[Lista d''e paise d''o munno]]
4336 !! result
4337 <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>
4338 </p>
4339 !! end
4340
4341 !! test
4342 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4343 !! input
4344 Some [[Link|pretty ''italics'' and stuff]]!
4345 !! result
4346 <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>!
4347 </p>
4348 !! end
4349
4350 !! test
4351 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4352 !! input
4353 ''Some [[Link|pretty ''italics'' and stuff]]!
4354 !! result
4355 <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>
4356 </p>
4357 !! end
4358
4359 !! test
4360 Link with double quotes in title part (literal) and alternate part (interpreted)
4361 !! input
4362 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4363
4364 [[''Pentecoste'']]
4365
4366 [[''Pentecoste''|Pentecoste]]
4367
4368 [[''Pentecoste''|''Pentecoste'']]
4369 !! result
4370 <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>
4371 </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>
4372 </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>
4373 </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>
4374 </p>
4375 !! end
4376
4377 !! test
4378 Broken image links with HTML captions (bug 39700)
4379 !! input
4380 [[File:Nonexistent|<script></script>]]
4381 [[File:Nonexistent|100px|<script></script>]]
4382 [[File:Nonexistent|&lt;]]
4383 [[File:Nonexistent|a<i>b</i>c]]
4384 !! result
4385 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4386 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4387 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4388 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4389 </p>
4390 !! end
4391
4392 !! test
4393 Plain link to URL
4394 !! input
4395 [[http://www.example.com]]
4396 !! result
4397 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4398 </p>
4399 !! end
4400
4401 !! test
4402 Plain link to URL with link text
4403 !! input
4404 [[http://www.example.com Link text]]
4405 !! result
4406 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4407 </p>
4408 !! end
4409
4410 !! test
4411 Plain link to protocol-relative URL
4412 !! input
4413 [[//www.example.com]]
4414 !! result
4415 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4416 </p>
4417 !! end
4418
4419 !! test
4420 Plain link to protocol-relative URL with link text
4421 !! input
4422 [[//www.example.com Link text]]
4423 !! result
4424 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4425 </p>
4426 !! end
4427
4428 !! test
4429 Plain link to page with question mark in title
4430 !! input
4431 [[A?b]]
4432
4433 [[A?b|Baz]]
4434 !! result
4435 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4436 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4437 </p>
4438 !! end
4439
4440
4441 # I'm fairly sure the expected result here is wrong.
4442 # We want these to be URL links, not pseudo-pages with URLs for titles....
4443 # However the current output is also pretty screwy.
4444 #
4445 # ----
4446 # I'm changing it to match the current output--it arguably makes more
4447 # sense in the light of the test above. Old expected result was:
4448 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4449 #</p>
4450 # But I think this test is bordering on "garbage in, garbage out" anyway.
4451 # -- wtm
4452 !! test
4453 Piped link to URL
4454 !! input
4455 Piped link to URL: [[http://www.example.com|an example URL]]
4456 !! result
4457 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4458 </p>
4459 !! end
4460
4461 !! test
4462 BUG 2: [[page|http://url/]] should link to page, not http://url/
4463 !! input
4464 [[Main Page|http://url/]]
4465 !! result
4466 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4467 </p>
4468 !! end
4469
4470 !! test
4471 BUG 337: Escaped self-links should be bold
4472 !! options
4473 title=[[Bug462]]
4474 !! input
4475 [[Bu&#103;462]] [[Bug462]]
4476 !! result
4477 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4478 </p>
4479 !! end
4480
4481 !! test
4482 Self-link to section should not be bold
4483 !! options
4484 title=[[Main Page]]
4485 !! input
4486 [[Main Page#section]]
4487 !! result
4488 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4489 </p>
4490 !! end
4491
4492 !! article
4493 00
4494 !! text
4495 This is 00.
4496 !! endarticle
4497
4498 !!test
4499 Self-link to numeric title
4500 !!options
4501 title=[[0]]
4502 !!input
4503 [[0]]
4504 !!result
4505 <p><strong class="selflink">0</strong>
4506 </p>
4507 !!end
4508
4509 !!test
4510 Link to numeric-equivalent title
4511 !!options
4512 title=[[0]]
4513 !!input
4514 [[00]]
4515 !!result
4516 <p><a href="/wiki/00" title="00">00</a>
4517 </p>
4518 !!end
4519
4520 !! test
4521 <nowiki> inside a link
4522 !! input
4523 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4524 !! result
4525 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4526 </p>
4527 !! end
4528
4529 !! test
4530 Non-breaking spaces in title
4531 !! input
4532 [[&nbsp; Main &nbsp; Page &nbsp;]]
4533 !! result
4534 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4535 </p>
4536 !!end
4537
4538 !! test
4539 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4540 !! options
4541 language=ca
4542 !! input
4543 '''[[Main Page]]'''
4544 !! result
4545 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4546 </p>
4547 !! end
4548
4549 !! test
4550 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4551 !! options
4552 language=ca
4553 !! input
4554 ''[[Main Page]]''
4555 !! result
4556 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4557 </p>
4558 !! end
4559
4560 !! test
4561 Internal link with en linktrail: no apostrophes (bug 27473)
4562 !! options
4563 language=en
4564 !! input
4565 [[Something]]'nice
4566 !! result
4567 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4568 </p>
4569 !! end
4570
4571 !! test
4572 Internal link with ca linktrail with apostrophes (bug 27473)
4573 !! options
4574 language=ca
4575 !! input
4576 [[Something]]'nice
4577 !! result
4578 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4579 </p>
4580 !! end
4581
4582 !! test
4583 Internal link with kaa linktrail with apostrophes (bug 27473)
4584 !! options
4585 language=kaa
4586 !! input
4587 [[Something]]'nice
4588 !! result
4589 <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>
4590 </p>
4591 !! end
4592
4593 !! article
4594 Söfnuður
4595 !! text
4596 Test.
4597 !! endarticle
4598
4599 !! test
4600 Internal link with is link prefix
4601 !! options
4602 language=is
4603 !! input
4604 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4605 !! result
4606 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4607 </p>
4608 !! end
4609
4610 !! article
4611 Mótmælendatrú
4612 !! text
4613 Test.
4614 !! endarticle
4615
4616 !! test
4617 Internal link with is link trail and link prefix
4618 !! options
4619 language=is
4620 !! input
4621 [[mótmælendatrú|xxx]]ar
4622 [[mótmælendatrú]]ar
4623 mótmælenda[[söfnuður]]
4624 mótmælenda[[söfnuður|söfnuðir]]
4625 mótmælenda[[söfnuður|söfnuðir]]xxx
4626 !! result
4627 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4628 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4629 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4630 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4631 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4632 </p>
4633 !! end
4634
4635 !! test
4636 Parsoid link trail escaping
4637 !! options
4638 parsoid=html2wt,html2html
4639 !! input
4640 [[apple]]<nowiki/>s
4641 !! result
4642 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4643 !! end
4644
4645 !! test
4646 Parsoid link prefix escaping
4647 !! options
4648 language=is
4649 parsoid=html2wt,html2html
4650 !! input
4651 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4652 !! result
4653 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4654 !! end
4655
4656 !! test
4657 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4658 !! input
4659 [[Foo| bar]]
4660
4661 [[Foo| ''bar'']]
4662
4663 [http://wp.org foo]
4664
4665 [http://wp.org ''foo'']
4666 !! result
4667 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4668 </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>
4669 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4670 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4671 </p>
4672 !! end
4673
4674 ###
4675 ### Interwiki links (see maintenance/interwiki.sql)
4676 ###
4677
4678 !! test
4679 Inline interwiki link
4680 !! input
4681 [[MeatBall:SoftSecurity]]
4682 !! result
4683 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4684 </p>
4685 !! end
4686
4687 !! test
4688 Inline interwiki link with empty title (bug 2372)
4689 !! input
4690 [[MeatBall:]]
4691 !! result
4692 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4693 </p>
4694 !! end
4695
4696 !! test
4697 Interwiki link encoding conversion (bug 1636)
4698 !! input
4699 *[[Wikipedia:ro:Olteni&#0355;a]]
4700 *[[Wikipedia:ro:Olteni&#355;a]]
4701 !! result
4702 <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>
4703 </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>
4704 </li></ul>
4705
4706 !! end
4707
4708 !! test
4709 Interwiki link with fragment (bug 2130)
4710 !! input
4711 [[MeatBall:SoftSecurity#foo]]
4712 !! result
4713 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4714 </p>
4715 !! end
4716
4717 !! test
4718 Interlanguage link
4719 !! input
4720 Blah blah blah
4721 [[zh:Chinese]]
4722 !!result
4723 <p>Blah blah blah
4724 </p>
4725 !! end
4726
4727 !! test
4728 Double interlanguage link
4729 !! input
4730 Blah blah blah
4731 [[es:Spanish]]
4732 [[zh:Chinese]]
4733 !!result
4734 <p>Blah blah blah
4735 </p>
4736 !! end
4737
4738 !! test
4739 Interlanguage link, with prefix links
4740 !! options
4741 language=ln
4742 !! input
4743 Blah blah blah
4744 [[zh:Chinese]]
4745 !!result
4746 <p>Blah blah blah
4747 </p>
4748 !! end
4749
4750 !! test
4751 Double interlanguage link, with prefix links (bug 8897)
4752 !! options
4753 language=ln
4754 !! input
4755 Blah blah blah
4756 [[es:Spanish]]
4757 [[zh:Chinese]]
4758 !!result
4759 <p>Blah blah blah
4760 </p>
4761 !! end
4762
4763 !! test
4764 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4765 !! options
4766 language=ln
4767 !! input
4768 [[WW&nbsp;II]]
4769 !!result
4770 <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>
4771 </p>
4772 !! end
4773
4774 !! test
4775 Parsoid: handle constructor well
4776 !! options
4777 parsoid
4778 !! input
4779 [[constructor]]
4780
4781 [[constructor:foo]]
4782 !! result
4783 <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>
4784
4785
4786 <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>
4787 !! end
4788
4789 ##
4790 ## Redirects, Parsoid-only
4791 ##
4792 !! test
4793 Simple redirect to page
4794 !! options
4795 parsoid
4796 !! input
4797 #REDIRECT [[Main Page]]
4798 !! result
4799 <link rel="mw:PageProp/redirect" href="./Main_Page">
4800 !! end
4801
4802 !! test
4803 Redirect to category
4804 !! options
4805 parsoid=wt2html
4806 !! input
4807 #REDIRECT [[Category:Foo]]
4808 !! result
4809 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4810 !! end
4811
4812 !! test
4813 Redirect to category page
4814 !! options
4815 parsoid=wt2html,html2html
4816 !! input
4817 #REDIRECT [[:Category:Foo]]
4818 !! result
4819 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4820 !! end
4821
4822 !! test
4823 Redirect to image page
4824 !! options
4825 parsoid
4826 !! input
4827 #REDIRECT [[File:Wiki.png]]
4828 !! result
4829 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4830 !! end
4831
4832 !! test
4833 Redirect to language
4834 !! options
4835 parsoid
4836 !! input
4837 #REDIRECT [[en:File:Wiki.png]]
4838 !! result
4839 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4840 !! end
4841
4842 !! test
4843 Redirect to interwiki
4844 !! options
4845 parsoid
4846 !! input
4847 #REDIRECT [[meatball:File:Wiki.png]]
4848 !! result
4849 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4850 !! end
4851
4852 ##
4853 ## XHTML tidiness
4854 ###
4855
4856 !! test
4857 <br> to <br />
4858 !! input
4859 1<br>2<br />3
4860 !! result
4861 <p>1<br />2<br />3
4862 </p>
4863 !! end
4864
4865 !! test
4866 Broken br tag sanitization
4867 !! options
4868 php
4869 !! input
4870 </br>
4871 !! result
4872 <p>&lt;/br&gt;
4873 </p>
4874 !! end
4875
4876 # TODO: Fix html2html mode (bug 51055)!
4877 !! test
4878 Parsoid: Broken br tag recognition
4879 !! options
4880 parsoid=wt2html
4881 !! input
4882 </br>
4883 !! result
4884 <p><br></p>
4885 !! end
4886
4887 !! test
4888 Incorrecly removing closing slashes from correctly formed XHTML
4889 !! input
4890 <br style="clear:both;" />
4891 !! result
4892 <p><br style="clear:both;" />
4893 </p>
4894 !! end
4895
4896 !! test
4897 Failing to transform badly formed HTML into correct XHTML
4898 !! input
4899 <br style="clear: left;">
4900 <br style="clear: right;">
4901 <br style="clear: both;">
4902 !! result
4903 <p><br style="clear: left;" />
4904 <br style="clear: right;" />
4905 <br style="clear: both;" />
4906 </p>
4907 !!end
4908
4909 !! test
4910 Handling html with a div self-closing tag
4911 !! input
4912 <div title />
4913 <div title/>
4914 <div title/ >
4915 <div title=bar />
4916 <div title=bar/>
4917 <div title=bar/ >
4918 !! result
4919 <p>&lt;div title /&gt;
4920 &lt;div title/&gt;
4921 </p>
4922 <div>
4923 <p>&lt;div title=bar /&gt;
4924 &lt;div title=bar/&gt;
4925 </p>
4926 <div title="bar/"></div>
4927 </div>
4928
4929 !! end
4930
4931 !! test
4932 Handling html with a br self-closing tag
4933 !! input
4934 <br title />
4935 <br title/>
4936 <br title/ >
4937 <br title=bar />
4938 <br title=bar/>
4939 <br title=bar/ >
4940 !! result
4941 <p><br title="title" />
4942 <br title="title" />
4943 <br />
4944 <br title="bar" />
4945 <br title="bar" />
4946 <br title="bar/" />
4947 </p>
4948 !! end
4949
4950 !! test
4951 Horizontal ruler (should it add that extra space?)
4952 !! input
4953 <hr>
4954 <hr >
4955 foo <hr
4956 > bar
4957 !! result
4958 <hr />
4959 <hr />
4960 foo <hr /> bar
4961
4962 !! end
4963
4964 !! test
4965 Horizontal ruler -- 4+ dashes render hr
4966 !! input
4967 ----
4968 !! result
4969 <hr />
4970
4971 !! end
4972
4973 !! test
4974 Horizontal ruler -- eats additional dashes on the same line
4975 !! input
4976 ---------
4977 !! result
4978 <hr />
4979
4980 !! end
4981
4982 !! test
4983 Horizontal ruler -- does not collapse dashes on consecutive lines
4984 !! input
4985 ----
4986 ----
4987 !! result
4988 <hr />
4989 <hr />
4990
4991 !! end
4992
4993 !! test
4994 Horizontal ruler -- <4 dashes render as plain text
4995 !! input
4996 ---
4997 !! result
4998 <p>---
4999 </p>
5000 !! end
5001
5002 !! test
5003 Horizontal ruler -- Supports content following dashes on same line
5004 !! input
5005 ---- Foo
5006 !! result
5007 <hr /> Foo
5008
5009 !! end
5010
5011 ###
5012 ### Block-level elements
5013 ###
5014 !! test
5015 Common list
5016 !! input
5017 *Common list
5018 * item 2
5019 *item 3
5020 !! result
5021 <ul><li>Common list
5022 </li><li> item 2
5023 </li><li>item 3
5024 </li></ul>
5025
5026 !! end
5027
5028 !! test
5029 Numbered list
5030 !! input
5031 #Numbered list
5032 #item 2
5033 # item 3
5034 !! result
5035 <ol><li>Numbered list
5036 </li><li>item 2
5037 </li><li> item 3
5038 </li></ol>
5039
5040 !! end
5041
5042 !! test
5043 Mixed list
5044 !! input
5045 *Mixed list
5046 *# with numbers
5047 ** and bullets
5048 *# and numbers
5049 *bullets again
5050 **bullet level 2
5051 ***bullet level 3
5052 ***#Number on level 4
5053 **bullet level 2
5054 **#Number on level 3
5055 **#Number on level 3
5056 *#number level 2
5057 *Level 1
5058 *** Level 3
5059 #** Level 3, but ordered
5060 !! result
5061 <ul><li>Mixed list
5062 <ol><li> with numbers
5063 </li></ol>
5064 <ul><li> and bullets
5065 </li></ul>
5066 <ol><li> and numbers
5067 </li></ol>
5068 </li><li>bullets again
5069 <ul><li>bullet level 2
5070 <ul><li>bullet level 3
5071 <ol><li>Number on level 4
5072 </li></ol>
5073 </li></ul>
5074 </li><li>bullet level 2
5075 <ol><li>Number on level 3
5076 </li><li>Number on level 3
5077 </li></ol>
5078 </li></ul>
5079 <ol><li>number level 2
5080 </li></ol>
5081 </li><li>Level 1
5082 <ul><li><ul><li> Level 3
5083 </li></ul>
5084 </li></ul>
5085 </li></ul>
5086 <ol><li><ul><li><ul><li> Level 3, but ordered
5087 </li></ul>
5088 </li></ul>
5089 </li></ol>
5090
5091 !! end
5092
5093 !! test
5094 Nested lists 1
5095 !! input
5096 *foo
5097 **bar
5098 !! result
5099 <ul><li>foo
5100 <ul><li>bar
5101 </li></ul>
5102 </li></ul>
5103
5104 !! end
5105
5106 !! test
5107 Nested lists 2
5108 !! input
5109 **foo
5110 *bar
5111 !! result
5112 <ul><li><ul><li>foo
5113 </li></ul>
5114 </li><li>bar
5115 </li></ul>
5116
5117 !! end
5118
5119 !! test
5120 Nested lists 3 (first element empty)
5121 !! input
5122 *
5123 **bar
5124 !! result
5125 <ul><li>
5126 <ul><li>bar
5127 </li></ul>
5128 </li></ul>
5129
5130 !! end
5131
5132 !! test
5133 Nested lists 4 (first element empty)
5134 !! input
5135 **
5136 *bar
5137 !! result
5138 <ul><li><ul><li>
5139 </li></ul>
5140 </li><li>bar
5141 </li></ul>
5142
5143 !! end
5144
5145 !! test
5146 Nested lists 5 (both elements empty)
5147 !! input
5148 **
5149 *
5150 !! result
5151 <ul><li><ul><li>
5152 </li></ul>
5153 </li><li>
5154 </li></ul>
5155
5156 !! end
5157
5158 !! test
5159 Nested lists 6 (both elements empty)
5160 !! input
5161 *
5162 **
5163 !! result
5164 <ul><li>
5165 <ul><li>
5166 </li></ul>
5167 </li></ul>
5168
5169 !! end
5170
5171 !! test
5172 Nested lists 7 (skip initial nesting levels)
5173 !! input
5174 *** foo
5175 !! result
5176 <ul><li><ul><li><ul><li> foo
5177 </li></ul>
5178 </li></ul>
5179 </li></ul>
5180
5181 !! end
5182
5183 !! test
5184 Nested lists 8 (multiple nesting transitions)
5185 !! input
5186 * foo
5187 *** bar
5188 ** baz
5189 * boo
5190 !! result
5191 <ul><li> foo
5192 <ul><li><ul><li> bar
5193 </li></ul>
5194 </li><li> baz
5195 </li></ul>
5196 </li><li> boo
5197 </li></ul>
5198
5199 !! end
5200
5201 !! test
5202 1. Lists with start-of-line-transparent tokens before bullets: Comments
5203 !! input
5204 *foo
5205 *<!--cmt-->bar
5206 <!--cmt-->*baz
5207 !! result
5208 <ul><li>foo
5209 </li><li>bar
5210 </li><li>baz
5211 </li></ul>
5212
5213 !! end
5214
5215 !! test
5216 2. Lists with start-of-line-transparent tokens before bullets: Template close
5217 !! input
5218 *foo {{echo|bar
5219 }}*baz
5220 !! result
5221 <ul><li>foo bar
5222 </li><li>baz
5223 </li></ul>
5224
5225 !! end
5226
5227 !! test
5228 List items are not parsed correctly following a <pre> block (bug 785)
5229 !! input
5230 * <pre>foo</pre>
5231 * <pre>bar</pre>
5232 * zar
5233 !! result
5234 <ul><li> <pre>foo</pre>
5235 </li><li> <pre>bar</pre>
5236 </li><li> zar
5237 </li></ul>
5238
5239 !! end
5240
5241 !! test
5242 List items from template
5243 !! input
5244
5245 {{inner list}}
5246 * item 2
5247
5248 * item 0
5249 {{inner list}}
5250 * item 2
5251
5252 * item 0
5253 * notSOL{{inner list}}
5254 * item 2
5255 !! result
5256 <ul><li> item 1
5257 </li><li> item 2
5258 </li></ul>
5259 <ul><li> item 0
5260 </li><li> item 1
5261 </li><li> item 2
5262 </li></ul>
5263 <ul><li> item 0
5264 </li><li> notSOL
5265 </li><li> item 1
5266 </li><li> item 2
5267 </li></ul>
5268
5269 !! end
5270
5271 !! test
5272 List interrupted by empty line or heading
5273 !! input
5274 * foo
5275
5276 ** bar
5277 == A heading ==
5278 * Another list item
5279 !! result
5280 <ul><li> foo
5281 </li></ul>
5282 <ul><li><ul><li> bar
5283 </li></ul>
5284 </li></ul>
5285 <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>
5286 <ul><li> Another list item
5287 </li></ul>
5288
5289 !!end
5290
5291 !!test
5292 Multiple list tags generated by templates
5293 !!input
5294 {{echo|<li>}}a
5295 {{echo|<li>}}b
5296 {{echo|<li>}}c
5297 !!result
5298 <li>a
5299 <li>b
5300 <li>c</li>
5301 </li>
5302 </li>
5303
5304 !!end
5305
5306 !!test
5307 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5308 !!input
5309 *a
5310 <!--This line will NOT split the list-->
5311 *b
5312 <!--This line will NOT split the list either-->
5313 *c
5314 <!--foo--> <!--This line with more than 1 comment will split the list-->
5315 *d
5316 !!result
5317 <ul><li>a
5318 </li><li>b
5319 </li><li>c
5320 </li></ul>
5321 <ul><li>d
5322 </li></ul>
5323
5324 !!end
5325
5326 !!test
5327 Test the li-hack
5328 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5329 !!options
5330 parsoid=wt2html,wt2wt
5331 !!input
5332 * foo
5333 * <li>li-hack
5334 * {{echo|<li>templated li-hack}}
5335 * <!--foo--> <li> unsupported li-hack with preceding comments
5336
5337 <ul>
5338 <li><li>not a li-hack
5339 </li>
5340 </ul>
5341 !!result
5342 <ul><li> foo</li>
5343 <li>li-hack</li>
5344 <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>
5345 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5346
5347 <ul>
5348 <li></li><li>not a li-hack
5349 </li>
5350 </ul>
5351 !!end
5352
5353 !! test
5354 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5355 !! options
5356 parsoid
5357 !! input
5358 # foo
5359 ## bar
5360 * foo
5361 ** bar
5362 : foo
5363 :: bar
5364 !! result
5365 <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>
5366 !! end
5367
5368 # ------------------------------------------------------------------------
5369 # The next set of tests are about Parsoid's ability to handle badly nested
5370 # tags (parse, minimize scope of fixup, and roundtrip back)
5371 # ------------------------------------------------------------------------
5372
5373 !! test
5374 Unbalanced closing block tags break a list
5375 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5376 !! options
5377 parsoid
5378 !! input
5379 <div>
5380 *a</div><div>
5381 *b</div>
5382 !! result
5383 <div>
5384 <ul><li>a
5385 </li></ul></div><div>
5386 <ul><li>b
5387 </li></ul></div>
5388 !! end
5389
5390 !! test
5391 Unbalanced closing non-block tags don't break a list
5392 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5393 !! options
5394 parsoid
5395 !! input
5396 <span>
5397 *a</span><span>
5398 *b</span>
5399 !! result
5400 <p><span></span>
5401 </p>
5402 <ul><li>a<span></span>
5403 </li><li>b
5404 </li></ul>
5405 !! end
5406
5407 !! test
5408 Unclosed formatting tags that straddle lists are closed and reopened
5409 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5410 !! options
5411 parsoid
5412 !! input
5413 # <s> a
5414 # b </s>
5415 !! result
5416 <ol><li> <s> a </s>
5417 </li><li> <s> b </s>
5418 </li></ol>
5419 !! end
5420
5421 !!test
5422 List embedded in a non-block tag
5423 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5424 !! options
5425 parsoid
5426 !!input
5427 <small>
5428 * foo
5429 </small>
5430 !!result
5431 <p><small></small></p>
5432 <small>
5433 <ul>
5434 <li> foo</li>
5435 </ul>
5436 </small>
5437 <p><small></small></p>
5438 !!end
5439
5440 ###
5441 ### Magic Words
5442 ###
5443
5444 !! test
5445 Magic Word: {{CURRENTDAY}}
5446 !! input
5447 {{CURRENTDAY}}
5448 !! result
5449 <p>1
5450 </p>
5451 !! end
5452
5453 !! test
5454 Magic Word: {{CURRENTDAY2}}
5455 !! input
5456 {{CURRENTDAY2}}
5457 !! result
5458 <p>01
5459 </p>
5460 !! end
5461
5462 !! test
5463 Magic Word: {{CURRENTDAYNAME}}
5464 !! input
5465 {{CURRENTDAYNAME}}
5466 !! result
5467 <p>Thursday
5468 </p>
5469 !! end
5470
5471 !! test
5472 Magic Word: {{CURRENTDOW}}
5473 !! input
5474 {{CURRENTDOW}}
5475 !! result
5476 <p>4
5477 </p>
5478 !! end
5479
5480 !! test
5481 Magic Word: {{CURRENTMONTH}}
5482 !! input
5483 {{CURRENTMONTH}}
5484 !! result
5485 <p>01
5486 </p>
5487 !! end
5488
5489 !! test
5490 Magic Word: {{CURRENTMONTHABBREV}}
5491 !! input
5492 {{CURRENTMONTHABBREV}}
5493 !! result
5494 <p>Jan
5495 </p>
5496 !! end
5497
5498 !! test
5499 Magic Word: {{CURRENTMONTHNAME}}
5500 !! input
5501 {{CURRENTMONTHNAME}}
5502 !! result
5503 <p>January
5504 </p>
5505 !! end
5506
5507 !! test
5508 Magic Word: {{CURRENTMONTHNAMEGEN}}
5509 !! input
5510 {{CURRENTMONTHNAMEGEN}}
5511 !! result
5512 <p>January
5513 </p>
5514 !! end
5515
5516 !! test
5517 Magic Word: {{CURRENTTIME}}
5518 !! input
5519 {{CURRENTTIME}}
5520 !! result
5521 <p>00:02
5522 </p>
5523 !! end
5524
5525 !! test
5526 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5527 !! input
5528 {{CURRENTWEEK}}
5529 !! result
5530 <p>1
5531 </p>
5532 !! end
5533
5534 !! test
5535 Magic Word: {{CURRENTYEAR}}
5536 !! input
5537 {{CURRENTYEAR}}
5538 !! result
5539 <p>1970
5540 </p>
5541 !! end
5542
5543 !! test
5544 Magic Word: {{FULLPAGENAME}}
5545 !! options
5546 title=[[User:Ævar Arnfjörð Bjarmason]]
5547 !! input
5548 {{FULLPAGENAME}}
5549 !! result
5550 <p>User:Ævar Arnfjörð Bjarmason
5551 </p>
5552 !! end
5553
5554 !! test
5555 Magic Word: {{FULLPAGENAMEE}}
5556 !! options
5557 title=[[User:Ævar Arnfjörð Bjarmason]]
5558 !! input
5559 {{FULLPAGENAMEE}}
5560 !! result
5561 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5562 </p>
5563 !! end
5564
5565 !! test
5566 Magic Word: {{NAMESPACE}}
5567 !! options
5568 title=[[User:Ævar Arnfjörð Bjarmason]]
5569 !! input
5570 {{NAMESPACE}}
5571 !! result
5572 <p>User
5573 </p>
5574 !! end
5575
5576 !! test
5577 Magic Word: {{NAMESPACEE}}
5578 !! options
5579 title=[[User:Ævar Arnfjörð Bjarmason]]
5580 !! input
5581 {{NAMESPACEE}}
5582 !! result
5583 <p>User
5584 </p>
5585 !! end
5586
5587 !! test
5588 Magic Word: {{NAMESPACENUMBER}}
5589 !! options
5590 title=[[User:Ævar Arnfjörð Bjarmason]]
5591 !! input
5592 {{NAMESPACENUMBER}}
5593 !! result
5594 <p>2
5595 </p>
5596 !! end
5597
5598 !! test
5599 Magic Word: {{NUMBEROFFILES}}
5600 !! input
5601 {{NUMBEROFFILES}}
5602 !! result
5603 <p>4
5604 </p>
5605 !! end
5606
5607 !! test
5608 Magic Word: {{PAGENAME}}
5609 !! options
5610 title=[[User:Ævar Arnfjörð Bjarmason]]
5611 !! input
5612 {{PAGENAME}}
5613 !! result
5614 <p>Ævar Arnfjörð Bjarmason
5615 </p>
5616 !! end
5617
5618 !! test
5619 Magic Word: {{PAGENAME}} with metacharacters
5620 !! options
5621 title=[['foo & bar = baz']]
5622 !! input
5623 ''{{PAGENAME}}''
5624 !! result
5625 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5626 </p>
5627 !! end
5628
5629 !! test
5630 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5631 !! options
5632 title=[[*RFC 1234 http://example.com/]]
5633 !! input
5634 {{PAGENAME}}
5635 !! result
5636 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5637 </p>
5638 !! end
5639
5640 !! test
5641 Magic Word: {{PAGENAMEE}}
5642 !! options
5643 title=[[User:Ævar Arnfjörð Bjarmason]]
5644 !! input
5645 {{PAGENAMEE}}
5646 !! result
5647 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5648 </p>
5649 !! end
5650
5651 !! test
5652 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5653 !! options
5654 title=[[*RFC 1234 http://example.com/]]
5655 !! input
5656 {{PAGENAMEE}}
5657 !! result
5658 <p>&#42;RFC_1234_http&#58;//example.com/
5659 </p>
5660 !! end
5661
5662 !! test
5663 Magic Word: {{REVISIONID}}
5664 !! input
5665 {{REVISIONID}}
5666 !! result
5667 <p>1337
5668 </p>
5669 !! end
5670
5671 !! test
5672 Magic Word: {{SCRIPTPATH}}
5673 !! input
5674 {{SCRIPTPATH}}
5675 !! result
5676 <p>/
5677 </p>
5678 !! end
5679
5680 !! test
5681 Magic Word: {{SERVER}}
5682 !! input
5683 {{SERVER}}
5684 !! result
5685 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5686 </p>
5687 !! end
5688
5689 !! test
5690 Magic Word: {{SERVERNAME}}
5691 !! input
5692 {{SERVERNAME}}
5693 !! result
5694 <p>example.org
5695 </p>
5696 !! end
5697
5698 !! test
5699 Magic Word: {{SITENAME}}
5700 !! input
5701 {{SITENAME}}
5702 !! result
5703 <p>MediaWiki
5704 </p>
5705 !! end
5706
5707 !! test
5708 Case-sensitive magic words, when cased differently, should just be template transclusions
5709 !! input
5710 {{CurrentMonth}}
5711 {{currentday}}
5712 {{cURreNTweEK}}
5713 {{currentHour}}
5714 !! result
5715 <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>
5716 <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>
5717 <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>
5718 <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>
5719 </p>
5720 !! end
5721
5722 !! test
5723 Case-insensitive magic words should still work with weird casing.
5724 !! input
5725 {{sErVeRNaMe}}
5726 {{LCFirst:AOEU}}
5727 {{ucFIRST:aoeu}}
5728 {{SERver}}
5729 !! result
5730 <p>example.org
5731 aOEU
5732 Aoeu
5733 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5734 </p>
5735 !! end
5736
5737 !! test
5738 Namespace 1 {{ns:1}}
5739 !! input
5740 {{ns:1}}
5741 !! result
5742 <p>Talk
5743 </p>
5744 !! end
5745
5746 !! test
5747 Namespace 1 {{ns:01}}
5748 !! input
5749 {{ns:01}}
5750 !! result
5751 <p>Talk
5752 </p>
5753 !! end
5754
5755 !! test
5756 Namespace 0 {{ns:0}} (bug 4783)
5757 !! input
5758 {{ns:0}}
5759 !! result
5760
5761 !! end
5762
5763 !! test
5764 Namespace 0 {{ns:00}} (bug 4783)
5765 !! input
5766 {{ns:00}}
5767 !! result
5768
5769 !! end
5770
5771 !! test
5772 Namespace -1 {{ns:-1}}
5773 !! input
5774 {{ns:-1}}
5775 !! result
5776 <p>Special
5777 </p>
5778 !! end
5779
5780 !! test
5781 Namespace User {{ns:User}}
5782 !! input
5783 {{ns:User}}
5784 !! result
5785 <p>User
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 User talk {{ns:uSeR tAlK}}
5800 !! input
5801 {{ns:uSeR tAlK}}
5802 !! result
5803 <p>User talk
5804 </p>
5805 !! end
5806
5807 !! test
5808 Namespace File {{ns:File}}
5809 !! input
5810 {{ns:File}}
5811 !! result
5812 <p>File
5813 </p>
5814 !! end
5815
5816 !! test
5817 Namespace File {{ns:Image}}
5818 !! input
5819 {{ns:Image}}
5820 !! result
5821 <p>File
5822 </p>
5823 !! end
5824
5825 !! test
5826 Namespace (lang=de) Benutzer {{ns:User}}
5827 !! options
5828 language=de
5829 !! input
5830 {{ns:User}}
5831 !! result
5832 <p>Benutzer
5833 </p>
5834 !! end
5835
5836 !! test
5837 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5838 !! options
5839 language=de
5840 !! input
5841 {{ns:3}}
5842 !! result
5843 <p>Benutzer Diskussion
5844 </p>
5845 !! end
5846
5847
5848 !! test
5849 Urlencode
5850 !! input
5851 {{urlencode:hi world?!}}
5852 {{urlencode:hi world?!|WIKI}}
5853 {{urlencode:hi world?!|PATH}}
5854 {{urlencode:hi world?!|QUERY}}
5855 !! result
5856 <p>hi+world%3F%21
5857 hi_world%3F!
5858 hi%20world%3F%21
5859 hi+world%3F%21
5860 </p>
5861 !! end
5862
5863 ###
5864 ### Magic links
5865 ###
5866 !! test
5867 Magic links: internal link to RFC (bug 479)
5868 !! input
5869 [[RFC 123]]
5870 !! result
5871 <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>
5872 </p>
5873 !! end
5874
5875 !! test
5876 Magic links: RFC (bug 479)
5877 !! input
5878 RFC 822
5879 !! result
5880 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5881 </p>
5882 !! end
5883
5884 !! test
5885 Magic links: ISBN (bug 1937)
5886 !! input
5887 ISBN 0-306-40615-2
5888 !! result
5889 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5890 </p>
5891 !! end
5892
5893 !! test
5894 Magic links: PMID incorrectly converts space to underscore
5895 !! input
5896 PMID 1234
5897 !! result
5898 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5899 </p>
5900 !! end
5901
5902 ###
5903 ### Templates
5904 ####
5905
5906 !! test
5907 Nonexistent template
5908 !! input
5909 {{thistemplatedoesnotexist}}
5910 !! result
5911 <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>
5912 </p>
5913 !! end
5914
5915 !! test
5916 Template with invalid target containing tags
5917 !! input
5918 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5919 !! result
5920 <p>{{a<b>b</b>|foo|a=b|a = b}}
5921 </p>
5922 !! end
5923
5924 !! test
5925 Template with invalid target containing unclosed tag
5926 !! input
5927 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5928 !! result
5929 <p>{{a<b>|foo|a=b|a = b}}</b>
5930 </p>
5931 !! end
5932
5933 !! article
5934 Template:test
5935 !! text
5936 This is a test template
5937 !! endarticle
5938
5939 !! test
5940 Simple template
5941 !! input
5942 {{test}}
5943 !! result
5944 <p>This is a test template
5945 </p>
5946 !! end
5947
5948 !! test
5949 Template with explicit namespace
5950 !! input
5951 {{Template:test}}
5952 !! result
5953 <p>This is a test template
5954 </p>
5955 !! end
5956
5957
5958 !! article
5959 Template:paramtest
5960 !! text
5961 This is a test template with parameter {{{param}}}
5962 !! endarticle
5963
5964 !! test
5965 Template parameter
5966 !! input
5967 {{paramtest|param=foo}}
5968 !! result
5969 <p>This is a test template with parameter foo
5970 </p>
5971 !! end
5972
5973 !! article
5974 Template:paramtestnum
5975 !! text
5976 [[{{{1}}}|{{{2}}}]]
5977 !! endarticle
5978
5979 !! test
5980 Template unnamed parameter
5981 !! input
5982 {{paramtestnum|Main Page|the main page}}
5983 !! result
5984 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5985 </p>
5986 !! end
5987
5988 !! article
5989 Template:templatesimple
5990 !! text
5991 (test)
5992 !! endarticle
5993
5994 !! article
5995 Template:templateredirect
5996 !! text
5997 #redirect [[Template:templatesimple]]
5998 !! endarticle
5999
6000 !! article
6001 Template:templateasargtestnum
6002 !! text
6003 {{{{{1}}}}}
6004 !! endarticle
6005
6006 !! article
6007 Template:templateasargtest
6008 !! text
6009 {{template{{{templ}}}}}
6010 !! endarticle
6011
6012 !! article
6013 Template:templateasargtest2
6014 !! text
6015 {{{{{templ}}}}}
6016 !! endarticle
6017
6018 !! test
6019 Template with template name as unnamed argument
6020 !! input
6021 {{templateasargtestnum|templatesimple}}
6022 !! result
6023 <p>(test)
6024 </p>
6025 !! end
6026
6027 !! test
6028 Template with template name as argument
6029 !! input
6030 {{templateasargtest|templ=simple}}
6031 !! result
6032 <p>(test)
6033 </p>
6034 !! end
6035
6036 !! test
6037 Template with template name as argument (2)
6038 !! input
6039 {{templateasargtest2|templ=templatesimple}}
6040 !! result
6041 <p>(test)
6042 </p>
6043 !! end
6044
6045 !! article
6046 Template:templateasargtestdefault
6047 !! text
6048 {{{{{templ|templatesimple}}}}}
6049 !! endarticle
6050
6051 !! article
6052 Template:templa
6053 !! text
6054 '''templ'''
6055 !! endarticle
6056
6057 !! test
6058 Template with default value
6059 !! input
6060 {{templateasargtestdefault}}
6061 !! result
6062 <p>(test)
6063 </p>
6064 !! end
6065
6066 !! test
6067 Template with default value (value set)
6068 !! input
6069 {{templateasargtestdefault|templ=templa}}
6070 !! result
6071 <p><b>templ</b>
6072 </p>
6073 !! end
6074
6075 !! test
6076 Template redirect
6077 !! input
6078 {{templateredirect}}
6079 !! result
6080 <p>(test)
6081 </p>
6082 !! end
6083
6084 !! test
6085 Template with argument in separate line
6086 !! input
6087 {{ templateasargtest |
6088 templ = simple }}
6089 !! result
6090 <p>(test)
6091 </p>
6092 !! end
6093
6094 !! test
6095 Template with complex template as argument
6096 !! input
6097 {{paramtest|
6098 param ={{ templateasargtest |
6099 templ = simple }}}}
6100 !! result
6101 <p>This is a test template with parameter (test)
6102 </p>
6103 !! end
6104
6105 !! test
6106 Template with thumb image (with link in description)
6107 !! input
6108 {{paramtest|
6109 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6110 !! result
6111 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>
6112
6113 !! end
6114
6115 !! article
6116 Template:complextemplate
6117 !! text
6118 {{{1}}} {{paramtest|
6119 param ={{{param}}}}}
6120 !! endarticle
6121
6122 !! test
6123 Template with complex arguments
6124 !! input
6125 {{complextemplate|
6126 param ={{ templateasargtest |
6127 templ = simple }}|[[Template:complextemplate|link]]}}
6128 !! result
6129 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6130 </p>
6131 !! end
6132
6133 !! test
6134 BUG 553: link with two variables in a piped link
6135 !! input
6136 {|
6137 |[[{{{1}}}|{{{2}}}]]
6138 |}
6139 !! result
6140 <table>
6141 <tr>
6142 <td>[[{{{1}}}|{{{2}}}]]
6143 </td></tr></table>
6144
6145 !! end
6146
6147 !! test
6148 Magic variable as template parameter
6149 !! input
6150 {{paramtest|param={{SITENAME}}}}
6151 !! result
6152 <p>This is a test template with parameter MediaWiki
6153 </p>
6154 !! end
6155
6156 !! article
6157 Template:linktest
6158 !! text
6159 [[{{{param}}}|link]]
6160 !! endarticle
6161
6162 !! test
6163 Template parameter as link source
6164 !! input
6165 {{linktest|param=Main Page}}
6166 !! result
6167 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6168 </p>
6169 !! end
6170
6171 !!test
6172 Template-generated attribute string (k='v')
6173 !!input
6174 <span {{attr_str|id|v1}}>bar</span>
6175 !!result
6176 <p><span id="v1">bar</span>
6177 </p>
6178 !!end
6179
6180 !!article
6181 Template:paramtest2
6182 !! text
6183 including another template, {{paramtest|param={{{arg}}}}}
6184 !! endarticle
6185
6186 !! test
6187 Template passing argument to another template
6188 !! input
6189 {{paramtest2|arg='hmm'}}
6190 !! result
6191 <p>including another template, This is a test template with parameter 'hmm'
6192 </p>
6193 !! end
6194
6195 !! article
6196 Template:Linktest2
6197 !! text
6198 Main Page
6199 !! endarticle
6200
6201 !! test
6202 Template as link source
6203 !! input
6204 [[{{linktest2}}]]
6205
6206 [[{{linktest2}}|Main Page]]
6207
6208 [[{{linktest2}}]]Page
6209 !! result
6210 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6211 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6212 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6213 </p>
6214 !! end
6215
6216
6217 !! article
6218 Template:loop1
6219 !! text
6220 {{loop2}}
6221 !! endarticle
6222
6223 !! article
6224 Template:loop2
6225 !! text
6226 {{loop1}}
6227 !! endarticle
6228
6229 !! test
6230 Template infinite loop
6231 !! input
6232 {{loop1}}
6233 !! result
6234 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6235 </p>
6236 !! end
6237
6238 !! test
6239 Template from main namespace
6240 !! input
6241 {{:Main Page}}
6242 !! result
6243 <p>blah blah
6244 </p>
6245 !! end
6246
6247 !! article
6248 Template:table
6249 !! text
6250 {|
6251 | 1 || 2
6252 |-
6253 | 3 || 4
6254 |}
6255 !! endarticle
6256
6257 !! test
6258 BUG 529: Template with table, not included at beginning of line
6259 !! input
6260 foo {{table}}
6261 !! result
6262 <p>foo
6263 </p>
6264 <table>
6265 <tr>
6266 <td> 1 </td>
6267 <td> 2
6268 </td></tr>
6269 <tr>
6270 <td> 3 </td>
6271 <td> 4
6272 </td></tr></table>
6273
6274 !! end
6275
6276 !! test
6277 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6278 !! input
6279 foo
6280 {{table}}
6281 !! result
6282 <p>foo
6283 </p>
6284 <table>
6285 <tr>
6286 <td> 1 </td>
6287 <td> 2
6288 </td></tr>
6289 <tr>
6290 <td> 3 </td>
6291 <td> 4
6292 </td></tr></table>
6293
6294 !! end
6295
6296 !! test
6297 BUG 41: Template parameters shown as broken links
6298 !! input
6299 {{{parameter}}}
6300 !! result
6301 <p>{{{parameter}}}
6302 </p>
6303 !! end
6304
6305 !! test
6306 Template with targets containing wikilinks
6307 !! input
6308 {{[[foo]]}}
6309
6310 {{[[{{echo|foo}}]]}}
6311
6312 {{{{echo|[[foo}}]]}}
6313 !! result
6314 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6315 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6316 </p><p>{{[[foo}}]]
6317 </p>
6318 !! end
6319
6320 !! article
6321 Template:MSGNW test
6322 !! text
6323 ''None'' of '''this''' should be
6324 * interpreted
6325 but rather passed unmodified
6326 {{test}}
6327 !! endarticle
6328
6329 # hmm, fix this or just deprecate msgnw and document its behavior?
6330 !! test
6331 msgnw keyword
6332 !! options
6333 disabled
6334 !! input
6335 {{msgnw:MSGNW test}}
6336 !! result
6337 <p>''None'' of '''this''' should be
6338 * interpreted
6339 but rather passed unmodified
6340 {{test}}
6341 </p>
6342 !! end
6343
6344 !! test
6345 int keyword
6346 !! input
6347 {{int:youhavenewmessages|lots of money|not!}}
6348 !! result
6349 <p>You have lots of money (not!).
6350 </p>
6351 !! end
6352
6353 !! article
6354 Template:Includes
6355 !! text
6356 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6357 !! endarticle
6358
6359 !! test
6360 <includeonly> and <noinclude> being included
6361 !! input
6362 {{Includes}}
6363 !! result
6364 <p>Foobar
6365 </p>
6366 !! end
6367
6368 !! article
6369 Template:Includes2
6370 !! text
6371 <onlyinclude>Foo</onlyinclude>bar
6372 !! endarticle
6373
6374 !! test
6375 <onlyinclude> being included
6376 !! input
6377 {{Includes2}}
6378 !! result
6379 <p>Foo
6380 </p>
6381 !! end
6382
6383
6384 !! article
6385 Template:Includes3
6386 !! text
6387 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6388 !! endarticle
6389
6390 !! test
6391 <onlyinclude> and <includeonly> being included
6392 !! input
6393 {{Includes3}}
6394 !! result
6395 <p>Foo
6396 </p>
6397 !! end
6398
6399 !! test
6400 <includeonly> and <noinclude> on a page
6401 !! input
6402 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6403 !! result
6404 <p>Foozar
6405 </p>
6406 !! end
6407
6408 !! test
6409 Un-closed <noinclude>
6410 !! input
6411 <noinclude>
6412 !! result
6413 !! end
6414
6415 !! test
6416 <onlyinclude> on a page
6417 !! input
6418 <onlyinclude>Foo</onlyinclude>bar
6419 !! result
6420 <p>Foobar
6421 </p>
6422 !! end
6423
6424 !! test
6425 Un-closed <onlyinclude>
6426 !! input
6427 <onlyinclude>
6428 !! result
6429 !! end
6430
6431 !!test
6432 Self-closed noinclude, includeonly, onlyinclude tags
6433 !!input
6434 <noinclude />
6435 <includeonly />
6436 <onlyinclude />
6437 !!result
6438 <p><br />
6439 </p>
6440 !!end
6441
6442 !!test
6443 Unbalanced includeonly and noinclude tags
6444 !!input
6445 {|
6446 |a</noinclude>
6447 |b</noinclude></noinclude>
6448 |c</noinclude></includeonly>
6449 |d</includeonly></includeonly>
6450 |}
6451 !!result
6452 <table>
6453 <tr>
6454 <td>a
6455 </td>
6456 <td>b
6457 </td>
6458 <td>c&lt;/includeonly&gt;
6459 </td>
6460 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6461 </td></tr></table>
6462
6463 !!end
6464
6465 !! article
6466 Template:Includeonly section
6467 !! text
6468 <includeonly>
6469 ==Includeonly section==
6470 </includeonly>
6471 ==Section T-1==
6472 !!endarticle
6473
6474 !! test
6475 Bug 6563: Edit link generation for section shown by <includeonly>
6476 !! input
6477 {{includeonly section}}
6478 !! result
6479 <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>
6480 <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>
6481
6482 !! end
6483
6484 # Uses same input as the contents of [[Template:Includeonly section]]
6485 !! test
6486 Bug 6563: Section extraction for section shown by <includeonly>
6487 !! options
6488 section=T-2
6489 !! input
6490 <includeonly>
6491 ==Includeonly section==
6492 </includeonly>
6493 ==Section T-2==
6494 !! result
6495 ==Section T-2==
6496 !! end
6497
6498 !! test
6499 Bug 6563: Edit link generation for section suppressed by <includeonly>
6500 !! input
6501 <includeonly>
6502 ==Includeonly section==
6503 </includeonly>
6504 ==Section 1==
6505 !! result
6506 <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>
6507
6508 !! end
6509
6510 !! test
6511 Bug 6563: Section extraction for section suppressed by <includeonly>
6512 !! options
6513 section=1
6514 !! input
6515 <includeonly>
6516 ==Includeonly section==
6517 </includeonly>
6518 ==Section 1==
6519 !! result
6520 ==Section 1==
6521 !! end
6522
6523 !! test
6524 Un-closed <includeonly>
6525 !! input
6526 <includeonly>
6527 !! result
6528 !! end
6529
6530 ###
6531 ### <includeonly> and <noinclude> in attributes
6532 ###
6533 !!test
6534 0. includeonly around the entire attribute
6535 !!input
6536 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6537 !!result
6538 <p><span id="v2">bar</span>
6539 </p>
6540 !!end
6541
6542 !!test
6543 1. includeonly in html attr key
6544 !!input
6545 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6546 !!result
6547 <p><span id="foo">bar</span>
6548 </p>
6549 !!end
6550
6551 !!test
6552 2. includeonly in html attr value
6553 !!input
6554 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6555 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6556 !!result
6557 <p><span id="v1">bar</span>
6558 <span id="v1">bar</span>
6559 </p>
6560 !!end
6561
6562 !!test
6563 3. includeonly in part of an attr value
6564 !!input
6565 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6566 !!result
6567 <p><span style="color:red;">bar</span>
6568 </p>
6569 !!end
6570
6571 ###
6572 ### Testing parsing of templates where a template arg
6573 ### has the same name as the template itself.
6574 ###
6575
6576 !! article
6577 Template:quote
6578 !! text
6579 {{{quote|{{{1}}}}}}
6580 !! endarticle
6581
6582 !!test
6583 Templates: Template Name/Arg clash: 1. Use of positional param
6584 !!input
6585 {{quote|foo}}
6586 !!result
6587 <p>foo
6588 </p>
6589 !!end
6590
6591 !!test
6592 Templates: Template Name/Arg clash: 2. Use of named param
6593 !!input
6594 {{quote|quote=foo}}
6595 !!result
6596 <p>foo
6597 </p>
6598 !!end
6599
6600 !!test
6601 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6602 !!input
6603 {{quote|quote}}
6604 !!result
6605 <p>quote
6606 </p>
6607 !!end
6608
6609 ###
6610 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6611 ###
6612
6613 !!test
6614 Templates: 1. Simple use
6615 !!input
6616 {{echo|Foo}}
6617 !!result
6618 <p>Foo
6619 </p>
6620 !!end
6621
6622 !!test
6623 Templates: 2. Inside a block tag
6624 !!input
6625 <div>{{echo|Foo}}</div>
6626 !!result
6627 <div>Foo</div>
6628
6629 !!end
6630
6631 !!test
6632 Templates: P-wrapping: 1a. Templates on consecutive lines
6633 !!input
6634 {{echo|Foo}}
6635 {{echo|bar}}
6636 !!result
6637 <p>Foo
6638 bar
6639 </p>
6640 !!end
6641
6642 !!test
6643 Templates: P-wrapping: 1b. Templates on consecutive lines
6644 !!input
6645 Foo
6646
6647 {{echo|bar}}
6648 {{echo|baz}}
6649 !!result
6650 <p>Foo
6651 </p><p>bar
6652 baz
6653 </p>
6654 !!end
6655
6656 !!test
6657 Templates: P-wrapping: 1c. Templates on consecutive lines
6658 !!input
6659 {{echo|Foo}}
6660 {{echo|bar}} <div>baz</div>
6661 !!result
6662 <p>Foo
6663 </p>
6664 bar <div>baz</div>
6665
6666 !!end
6667
6668 !!test
6669 Templates: P-wrapping: 1d. Template preceded by comment-only line
6670 !!options
6671 parsoid=wt2html,wt2wt
6672 !!input
6673 <!-- foo -->
6674 {{echo|Bar}}
6675 !!result
6676 <!-- foo -->
6677 <p typeof="mw:Transclusion">Bar
6678 </p>
6679 !!end
6680
6681 !!test
6682 Templates: Inline Text: 1. Multiple tmeplate uses
6683 !!input
6684 {{echo|Foo}}bar{{echo|baz}}
6685 !!result
6686 <p>Foobarbaz
6687 </p>
6688 !!end
6689
6690 !!test
6691 Templates: Inline Text: 2. Back-to-back template uses
6692 !!input
6693 {{echo|Foo}}{{echo|bar}}
6694 !!result
6695 <p>Foobar
6696 </p>
6697 !!end
6698
6699 !!test
6700 Templates: Block Tags: 1. Multiple template uses
6701 !!input
6702 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6703 !!result
6704 <div>Foo</div><div>bar</div><div>baz</div>
6705
6706 !!end
6707
6708 !!test
6709 Templates: Block Tags: 2. Back-to-back template uses
6710 !!input
6711 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6712 !!result
6713 <div>Foo</div><div>bar</div>
6714
6715 !!end
6716
6717 !!test
6718 Templates: Links: 1. Simple example
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: 2. Generation of link href
6728 !!input
6729 [[{{echo|Foo}}|bar]]
6730 !!result
6731 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6732 </p>
6733 !!end
6734
6735 !!test
6736 Templates: Links: 3. Generation of part of a link href
6737 !!input
6738 [[Fo{{echo|o}}|bar]]
6739
6740 [[Foo{{echo|bar}}]]
6741
6742 [[Foo{{echo|bar}}baz]]
6743
6744 [[Foo{{echo|bar}}|bar]]
6745
6746 [[:Foo{{echo|bar}}]]
6747
6748 [[:Foo{{echo|bar}}|bar]]
6749 !!result
6750 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6751 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6752 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6753 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6754 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6755 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6756 </p>
6757 !!end
6758
6759 !!test
6760 Templates: Links: 4. Multiple templates generating link href
6761 !!input
6762 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6763 !!result
6764 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6765 </p>
6766 !!end
6767
6768 !!test
6769 Templates: Links: 5. Generation of link text
6770 !!input
6771 [[Foo|{{echo|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: Links: 5. Nested templates (only outermost template should be marked)
6779 !!input
6780 {{echo|[[{{echo|Foo}}|bar]]}}
6781 !!result
6782 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6783 </p>
6784 !!end
6785
6786 !!test
6787 Templates: HTML Tag: 1. Generation of HTML attr. key
6788 !!input
6789 <div {{echo|style}}="color:red;">foo</div>
6790 !!result
6791 <div style="color:red;">foo</div>
6792
6793 !!end
6794
6795 !!test
6796 Templates: HTML Tag: 2. Generation of HTML attr. value
6797 !!input
6798 <div 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: 3. Generation of HTML attr key and value
6806 !!input
6807 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6808 !!result
6809 <div style="color:red;">foo</div>
6810
6811 !!end
6812
6813 !!test
6814 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6815 !!input
6816 <div title="{{echo|This is a long title}} with just 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: 5. Generation of middle piece of HTML attr value
6824 !!input
6825 <div title="This is a long title with just {{echo|one piece}} 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: 6. Generation of end piece of HTML attr value
6833 !!input
6834 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6835 !!result
6836 <div title="This is a long title with just one piece templated">foo</div>
6837
6838 !!end
6839
6840 !!test
6841 Templates: HTML Tag: 7. Generation of partial attribute key string
6842 !!input
6843 <div st{{echo|yle}}="color:red;">foo</div>
6844 !!result
6845 <div style="color:red;">foo</div>
6846
6847 !!end
6848
6849 !!test
6850 Templates: HTML Tables: 1. Generating start of a HTML table
6851 !!input
6852 {{echo|<table><tr><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: 2a. Generating middle of a HTML table
6860 !!input
6861 <table><tr>{{echo|<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: 2b. Generating middle of a HTML table
6869 !!input
6870 <table>{{echo|<tr><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: 3. Generating end of a HTML table
6878 !!input
6879 <table><tr>{{echo|<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: 4a. Generating a single tag of a HTML table
6887 !!input
6888 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
6896 !!input
6897 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
6905 !!input
6906 <table><tr>{{echo|<td>}}foo</td></tr></table>
6907 !!result
6908 <table><tr><td>foo</td></tr></table>
6909
6910 !!end
6911
6912 !!test
6913 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6914 !!input
6915 <table><tr><td>foo{{echo|</td>}}</tr></table>
6916 !!result
6917 <table><tr><td>foo</td></tr></table>
6918
6919 !!end
6920
6921 !!test
6922 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6923 !!input
6924 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6925 !!result
6926 <table><tr><td>foo</td></tr></table>
6927
6928 !!end
6929
6930 !!test
6931 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6932 !!input
6933 <table><tr><td>foo</td></tr>{{echo|</table>}}
6934 !!result
6935 <table><tr><td>foo</td></tr></table>
6936
6937 !!end
6938
6939 !!test
6940 Templates: HTML Tables: 5. Proper fostering of categories from inside
6941 !!options
6942 parsoid=wt2html,wt2wt
6943 !!input
6944 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6945 <!--Two categories (Bug 50330)-->
6946 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6947 !!result
6948 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6949 <!--Two categories (Bug 50330)-->
6950 <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>
6951 !!end
6952
6953 !!test
6954 Templates: Wiki Tables: 1a. Fostering of entire template content
6955 !!input
6956 {|
6957 {{echo|a}}
6958 |}
6959 !!result
6960 <table>
6961 a
6962 <tr><td></td></tr></table>
6963
6964 !!end
6965
6966 !!test
6967 Templates: Wiki Tables: 1b. Fostering of entire template content
6968 !!input
6969 {|
6970 {{echo|<div>}}
6971 foo
6972 {{echo|</div>}}
6973 |}
6974 !!result
6975 <table>
6976 <div>
6977 <p>foo
6978 </p>
6979 </div>
6980 <tr><td></td></tr></table>
6981
6982 !!end
6983
6984 !!test
6985 Templates: Wiki Tables: 2. Fostering of partial template content
6986 !!input
6987 {|
6988 {{echo|a
6989 <div>b</div>}}
6990 |}
6991 !!result
6992 <table>
6993 a
6994 <div>b</div>
6995 <tr><td></td></tr></table>
6996
6997 !!end
6998
6999 !!test
7000 Templates: Wiki Tables: 3. td-content via multiple templates
7001 !!input
7002 {|
7003 {{echo|{{pipe}}a}}{{echo|b}}
7004 |}
7005 !!result
7006 <table>
7007 <tr>
7008 <td>ab
7009 </td></tr></table>
7010
7011 !!end
7012
7013 !!test
7014 Templates: Wiki Tables: 4. Templated tags, no content
7015 !!input
7016 {{tbl-start}}
7017 {{tbl-end}}
7018 !!result
7019 <table>
7020 <tr><td></td></tr></table>
7021
7022 !!end
7023
7024 !!test
7025 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7026 !!input
7027 {{tbl-start}}
7028 |foo
7029 {{tbl-end}}
7030 !!result
7031 <table>
7032 <tr>
7033 <td>foo
7034 </td></tr></table>
7035
7036 !!end
7037
7038 !!test
7039 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7040 !!input
7041 {{tbl-start}}
7042 {{!}}foo
7043 {{tbl-end}}
7044 !!result
7045 <table>
7046 <tr>
7047 <td>foo
7048 </td></tr></table>
7049
7050 !!end
7051
7052 !!test
7053 Templates: Lists: Multi-line list-items via templates
7054 !!input
7055 *{{echo|a {{nonexistent|
7056 unused}}}}
7057 *{{echo|b {{nonexistent|
7058 unused}}}}
7059 !!result
7060 <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>
7061 </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>
7062 </li></ul>
7063
7064 !!end
7065
7066 !!test
7067 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7068 !!input
7069 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7070 !!result
7071 <p><i>ab</i>c<i>d</i>e
7072 </p>
7073 !!end
7074
7075 !!test
7076 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7077 (PHP parser generates misnested html)
7078 !! options
7079 parsoid=wt2html,wt2wt
7080 !!input
7081 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7082 !!result
7083 <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>
7084 !!end
7085
7086 !!test
7087 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7088 (PHP parser generates misnested html)
7089 !! options
7090 parsoid=wt2html,wt2wt
7091 !!input
7092 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7093 !!result
7094 <div typeof="mw:Transclusion"><i>a</i></div>
7095 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7096 <div typeof="mw:Transclusion">e</div>
7097 !!end
7098
7099 !!test
7100 Templates: Ugly nesting: 4. Divs opened/closed across templates
7101 !!input
7102 a<div>b{{echo|c</div>d}}e
7103 !!result
7104 a<div>bc</div>de
7105
7106 !!end
7107
7108 !!test
7109 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7110 (Parsoid-centric)
7111 !! options
7112 parsoid
7113 !!input
7114 {|
7115 |{{echo|foo</table>}}
7116 |bar
7117 |}
7118 !!result
7119 <table typeof="mw:Transclusion">
7120 <tbody>
7121 <tr>
7122 <td>foo</td></tr></tbody></table><span>bar</span>
7123 !!end
7124
7125 !!test
7126 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7127 (Parsoid-centric)
7128 !! options
7129 parsoid
7130 !!input
7131 <table>
7132 <tr>
7133 <td>
7134 <table>
7135 <tr>
7136 <td>1. {{echo|foo </table>}}</td>
7137 <td> bar </td>
7138 <td>2. {{echo|baz </table>}}</td>
7139 </tr>
7140 <tr>
7141 <td>abc</td>
7142 </tr>
7143 </table>
7144 </td>
7145 </tr>
7146 <tr>
7147 <td>xyz</td>
7148 </tr>
7149 </table>
7150 !!result
7151 <table about="#mwt1" typeof="mw:Transclusion">
7152 <tbody><tr >
7153 <td >
7154 <table >
7155 <tbody><tr >
7156 <td >1. foo </td></tr></tbody></table></td>
7157 <td > bar </td>
7158 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7159 </span><span about="#mwt1">
7160
7161 abc</span><span about="#mwt1">
7162 </span><span about="#mwt1">
7163 </span><span about="#mwt1">
7164 </span><span about="#mwt1">
7165 </span><span about="#mwt1">
7166
7167 xyz</span><span about="#mwt1">
7168 </span><span about="#mwt1">
7169 </span>
7170 !!end
7171
7172 !! test
7173 Templates: Ugly templates: 3. newline-only template parameter
7174 !! input
7175 foo {{echo|
7176 }}
7177 !! result
7178 <p>foo
7179 </p>
7180 !! end
7181
7182 # This looks like a bug: a single newline triggers p/br for some reason.
7183 !! test
7184 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7185 !! input
7186 {{echo|
7187 }}
7188 !! result
7189 <p><br />
7190 </p>
7191 !! end
7192
7193
7194 !!test
7195 Parser Functions: 1. Simple example
7196 !!input
7197 {{uc:foo}}
7198 !!result
7199 <p>FOO
7200 </p>
7201 !!end
7202
7203 !!test
7204 Parser Functions: 2. Nested use (only outermost should be marked up)
7205 !!input
7206 {{uc:{{lc:FOO}}}}
7207 !!result
7208 <p>FOO
7209 </p>
7210 !!end
7211
7212 ###
7213 ### Pre-save transform tests
7214 ###
7215 !! test
7216 pre-save transform: subst:
7217 !! options
7218 PST
7219 !! input
7220 {{subst:test}}
7221 !! result
7222 This is a test template
7223 !! end
7224
7225 !! test
7226 pre-save transform: normal template
7227 !! options
7228 PST
7229 !! input
7230 {{test}}
7231 !! result
7232 {{test}}
7233 !! end
7234
7235 !! test
7236 pre-save transform: nonexistent template
7237 !! options
7238 PST
7239 !! input
7240 {{thistemplatedoesnotexist}}
7241 !! result
7242 {{thistemplatedoesnotexist}}
7243 !! end
7244
7245
7246 !! test
7247 pre-save transform: subst magic variables
7248 !! options
7249 PST
7250 !! input
7251 {{subst:SITENAME}}
7252 !! result
7253 MediaWiki
7254 !! end
7255
7256 # This is bug 89, which I fixed. -- wtm
7257 !! test
7258 pre-save transform: subst: templates with parameters
7259 !! options
7260 pst
7261 !! input
7262 {{subst:paramtest|param="something else"}}
7263 !! result
7264 This is a test template with parameter "something else"
7265 !! end
7266
7267 !! article
7268 Template:nowikitest
7269 !! text
7270 <nowiki>'''not wiki'''</nowiki>
7271 !! endarticle
7272
7273 !! test
7274 pre-save transform: nowiki in subst (bug 1188)
7275 !! options
7276 pst
7277 !! input
7278 {{subst:nowikitest}}
7279 !! result
7280 <nowiki>'''not wiki'''</nowiki>
7281 !! end
7282
7283
7284 !! article
7285 Template:commenttest
7286 !! text
7287 This template has <!-- a comment --> in it.
7288 !! endarticle
7289
7290 !! test
7291 pre-save transform: comment in subst (bug 1936)
7292 !! options
7293 pst
7294 !! input
7295 {{subst:commenttest}}
7296 !! result
7297 This template has <!-- a comment --> in it.
7298 !! end
7299
7300 !! test
7301 pre-save transform: unclosed tag
7302 !! options
7303 pst noxml
7304 !! input
7305 <nowiki>'''not wiki'''
7306 !! result
7307 <nowiki>'''not wiki'''
7308 !! end
7309
7310 !! test
7311 pre-save transform: mixed tag case
7312 !! options
7313 pst noxml
7314 !! input
7315 <NOwiki>'''not wiki'''</noWIKI>
7316 !! result
7317 <NOwiki>'''not wiki'''</noWIKI>
7318 !! end
7319
7320 !! test
7321 pre-save transform: unclosed comment in <nowiki>
7322 !! options
7323 pst noxml
7324 !! input
7325 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7326 !! result
7327 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7328 !!end
7329
7330 # Leading @ in this template definition works around a limitation
7331 # in parsoid's parserTests which otherwise strips the <span> from the
7332 # result (confusing it for a template wrapper)
7333 !! article
7334 Template:dangerous
7335 !!text
7336 @<span onmouseover="alert('crap')">Oh no</span>
7337 !!endarticle
7338
7339 !!test
7340 (confirming safety of fix for subst bug 1936)
7341 !! input
7342 {{Template:dangerous}}
7343 !! result
7344 <p>@<span>Oh no</span>
7345 </p>
7346 !! end
7347
7348 !! test
7349 pre-save transform: comment containing gallery (bug 5024)
7350 !! options
7351 pst
7352 !! input
7353 <!-- <gallery>data</gallery> -->
7354 !!result
7355 <!-- <gallery>data</gallery> -->
7356 !!end
7357
7358 !! test
7359 pre-save transform: comment containing extension
7360 !! options
7361 pst
7362 !! input
7363 <!-- <tag>data</tag> -->
7364 !!result
7365 <!-- <tag>data</tag> -->
7366 !!end
7367
7368 !! test
7369 pre-save transform: comment containing nowiki
7370 !! options
7371 pst
7372 !! input
7373 <!-- <nowiki>data</nowiki> -->
7374 !!result
7375 <!-- <nowiki>data</nowiki> -->
7376 !!end
7377
7378 !! test
7379 pre-save transform: <noinclude> in subst (bug 3298)
7380 !! options
7381 pst
7382 !! input
7383 {{subst:Includes}}
7384 !! result
7385 Foobar
7386 !! end
7387
7388 !! test
7389 pre-save transform: <onlyinclude> in subst (bug 3298)
7390 !! options
7391 pst
7392 !! input
7393 {{subst:Includes2}}
7394 !! result
7395 Foo
7396 !! end
7397
7398 !! article
7399 Template:SubstTest
7400 !!text
7401 {{<includeonly>subst:</includeonly>Includes}}
7402 !! endarticle
7403
7404 !! article
7405 Template:SafeSubstTest
7406 !! text
7407 {{<includeonly>safesubst:</includeonly>Includes}}
7408 !! endarticle
7409
7410 !! test
7411 bug 22297: safesubst: works during PST
7412 !! options
7413 pst
7414 !! input
7415 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7416 !! result
7417 FoobarFoobar
7418 !! end
7419
7420 !! test
7421 bug 22297: safesubst: works during normal parse
7422 !! input
7423 {{SafeSubstTest}}
7424 !! result
7425 <p>Foobar
7426 </p>
7427 !! end
7428
7429 !! test:
7430 subst: does not work during normal parse
7431 !! input
7432 {{SubstTest}}
7433 !! result
7434 <p>{{subst:Includes}}
7435 </p>
7436 !! end
7437
7438 !! test
7439 pre-save transform: context links ("pipe trick")
7440 !! options
7441 pst
7442 !! input
7443 [[Article (context)|]]
7444 [[Bar:Article|]]
7445 [[:Bar:Article|]]
7446 [[Bar:Article (context)|]]
7447 [[:Bar:Article (context)|]]
7448 [[|Article]]
7449 [[|Article (context)]]
7450 [[Bar:X (Y) Z|]]
7451 [[:Bar:X (Y) Z|]]
7452 !! result
7453 [[Article (context)|Article]]
7454 [[Bar:Article|Article]]
7455 [[:Bar:Article|Article]]
7456 [[Bar:Article (context)|Article]]
7457 [[:Bar:Article (context)|Article]]
7458 [[Article]]
7459 [[Article (context)]]
7460 [[Bar:X (Y) Z|X (Y) Z]]
7461 [[:Bar:X (Y) Z|X (Y) Z]]
7462 !! end
7463
7464 !! test
7465 pre-save transform: context links ("pipe trick") with interwiki prefix
7466 !! options
7467 pst
7468 !! input
7469 [[interwiki:Article|]]
7470 [[:interwiki:Article|]]
7471 [[interwiki:Bar:Article|]]
7472 [[:interwiki:Bar:Article|]]
7473 !! result
7474 [[interwiki:Article|Article]]
7475 [[:interwiki:Article|Article]]
7476 [[interwiki:Bar:Article|Bar:Article]]
7477 [[:interwiki:Bar:Article|Bar:Article]]
7478 !! end
7479
7480 !! test
7481 pre-save transform: context links ("pipe trick") with parens in title
7482 !! options
7483 pst title=[[Somearticle (context)]]
7484 !! input
7485 [[|Article]]
7486 !! result
7487 [[Article (context)|Article]]
7488 !! end
7489
7490 !! test
7491 pre-save transform: context links ("pipe trick") with comma in title
7492 !! options
7493 pst title=[[Someplace, Somewhere]]
7494 !! input
7495 [[|Otherplace]]
7496 [[Otherplace, Elsewhere|]]
7497 [[Otherplace, Elsewhere, Anywhere|]]
7498 !! result
7499 [[Otherplace, Somewhere|Otherplace]]
7500 [[Otherplace, Elsewhere|Otherplace]]
7501 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7502 !! end
7503
7504 !! test
7505 pre-save transform: context links ("pipe trick") with parens and comma
7506 !! options
7507 pst title=[[Someplace (IGNORED), Somewhere]]
7508 !! input
7509 [[|Otherplace]]
7510 [[Otherplace (place), Elsewhere|]]
7511 !! result
7512 [[Otherplace, Somewhere|Otherplace]]
7513 [[Otherplace (place), Elsewhere|Otherplace]]
7514 !! end
7515
7516 !! test
7517 pre-save transform: context links ("pipe trick") with comma and parens
7518 !! options
7519 pst title=[[Who, me? (context)]]
7520 !! input
7521 [[|Yes, you.]]
7522 [[Me, Myself, and I (1937 song)|]]
7523 !! result
7524 [[Yes, you. (context)|Yes, you.]]
7525 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7526 !! end
7527
7528 !! test
7529 pre-save transform: context links ("pipe trick") with namespace
7530 !! options
7531 pst title=[[Ns:Somearticle]]
7532 !! input
7533 [[|Article]]
7534 !! result
7535 [[Ns:Article|Article]]
7536 !! end
7537
7538 !! test
7539 pre-save transform: context links ("pipe trick") with namespace and parens
7540 !! options
7541 pst title=[[Ns:Somearticle (context)]]
7542 !! input
7543 [[|Article]]
7544 !! result
7545 [[Ns:Article (context)|Article]]
7546 !! end
7547
7548 !! test
7549 pre-save transform: context links ("pipe trick") with namespace and comma
7550 !! options
7551 pst title=[[Ns:Somearticle, Context, Whatever]]
7552 !! input
7553 [[|Article]]
7554 !! result
7555 [[Ns:Article, Context, Whatever|Article]]
7556 !! end
7557
7558 !! test
7559 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7560 !! options
7561 pst title=[[Ns:Somearticle, Context (context)]]
7562 !! input
7563 [[|Article]]
7564 !! result
7565 [[Ns:Article (context)|Article]]
7566 !! end
7567
7568 !! test
7569 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7570 !! options
7571 pst title=[[Ns:Somearticle (IGNORED), Context]]
7572 !! input
7573 [[|Article]]
7574 !! result
7575 [[Ns:Article, Context|Article]]
7576 !! end
7577
7578 !! test
7579 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7580 !! options
7581 pst
7582 !! input
7583 [[Article(context)|]]
7584 [[Bar:Article(context)|]]
7585 [[:Bar:Article(context)|]]
7586 [[|Article(context)]]
7587 [[Bar:X(Y)Z|]]
7588 [[:Bar:X(Y)Z|]]
7589 !! result
7590 [[Article(context)|Article]]
7591 [[Bar:Article(context)|Article]]
7592 [[:Bar:Article(context)|Article]]
7593 [[Article(context)]]
7594 [[Bar:X(Y)Z|X(Y)Z]]
7595 [[:Bar:X(Y)Z|X(Y)Z]]
7596 !! end
7597
7598 !! test
7599 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7600 !! options
7601 pst
7602 !! input
7603 [[Article (context)|]]
7604 [[Bar:Article (context)|]]
7605 [[:Bar:Article (context)|]]
7606 [[|Article (context)]]
7607 [[Bar:X (Y) Z|]]
7608 [[:Bar:X (Y) Z|]]
7609 !! result
7610 [[Article (context)|Article]]
7611 [[Bar:Article (context)|Article]]
7612 [[:Bar:Article (context)|Article]]
7613 [[Article (context)]]
7614 [[Bar:X (Y) Z|X (Y) Z]]
7615 [[:Bar:X (Y) Z|X (Y) Z]]
7616 !! end
7617
7618 !! test
7619 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7620 !! options
7621 pst
7622 !! input
7623 [[Article(context)|]]
7624 [[Bar:Article(context)|]]
7625 [[:Bar:Article(context)|]]
7626 [[|Article(context)]]
7627 [[Bar:X(Y)Z|]]
7628 [[:Bar:X(Y)Z|]]
7629 !! result
7630 [[Article(context)|Article]]
7631 [[Bar:Article(context)|Article]]
7632 [[:Bar:Article(context)|Article]]
7633 [[Article(context)]]
7634 [[Bar:X(Y)Z|X(Y)Z]]
7635 [[:Bar:X(Y)Z|X(Y)Z]]
7636 !! end
7637
7638 !! test
7639 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7640 !! options
7641 pst
7642 !! input
7643 [[Article (context), context|]]
7644 [[Article (context),context|]]
7645 [[Bar:Article (context), context|]]
7646 [[Bar:Article (context),context|]]
7647 [[:Bar:Article (context), context|]]
7648 [[:Bar:Article (context),context|]]
7649 !! result
7650 [[Article (context), context|Article]]
7651 [[Article (context),context|Article]]
7652 [[Bar:Article (context), context|Article]]
7653 [[Bar:Article (context),context|Article]]
7654 [[:Bar:Article (context), context|Article]]
7655 [[:Bar:Article (context),context|Article]]
7656 !! end
7657
7658 !! test
7659 pre-save transform: trim trailing empty lines
7660 !! options
7661 pst
7662 !! input
7663 Empty lines are trimmed
7664
7665
7666
7667
7668 !! result
7669 Empty lines are trimmed
7670 !! end
7671
7672 !! test
7673 pre-save transform: Signature expansion
7674 !! options
7675 pst
7676 !! input
7677 * ~~~
7678 * <noinclude>~~~</noinclude>
7679 * <includeonly>~~~</includeonly>
7680 * <onlyinclude>~~~</onlyinclude>
7681 !! result
7682 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7683 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7684 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7685 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7686 !! end
7687
7688
7689 !! test
7690 pre-save transform: Signature expansion in nowiki tags (bug 93)
7691 !! options
7692 pst disabled
7693 !! input
7694 Shall not expand:
7695
7696 <nowiki>~~~~</nowiki>
7697
7698 <includeonly><nowiki>~~~~</nowiki></includeonly>
7699
7700 <noinclude><nowiki>~~~~</nowiki></noinclude>
7701
7702 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7703
7704 {{subst:Foo}} shall be converted to FOO
7705
7706 As well as inside noinclude/onlyinclude
7707 <noinclude>{{subst:Foo}}</noinclude>
7708 <onlyinclude>{{subst:Foo}}</onlyinclude>
7709
7710 But not inside includeonly
7711 <includeonly>{{subst:Foo}}</includeonly>
7712 !! result
7713 Shall not expand:
7714
7715 <nowiki>~~~~</nowiki>
7716
7717 <includeonly><nowiki>~~~~</nowiki></includeonly>
7718
7719 <noinclude><nowiki>~~~~</nowiki></noinclude>
7720
7721 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7722
7723 FOO shall be converted to FOO
7724
7725 As well as inside noinclude/onlyinclude
7726 <noinclude>FOO</noinclude>
7727 <onlyinclude>FOO</onlyinclude>
7728
7729 But not inside includeonly
7730 <includeonly>{{subst:Foo}}</includeonly>
7731 !! end
7732
7733 ###
7734 ### Message transform tests
7735 ###
7736 !! test
7737 message transform: magic variables
7738 !! options
7739 msg
7740 !! input
7741 {{SITENAME}}
7742 !! result
7743 MediaWiki
7744 !! end
7745
7746 !! test
7747 message transform: should not transform wiki markup
7748 !! options
7749 msg
7750 !! input
7751 ''test''
7752 !! result
7753 ''test''
7754 !! end
7755
7756 !! test
7757 message transform: <noinclude> in transcluded template (bug 4926)
7758 !! options
7759 msg
7760 !! input
7761 {{Includes}}
7762 !! result
7763 Foobar
7764 !! end
7765
7766 !! test
7767 message transform: <onlyinclude> in transcluded template (bug 4926)
7768 !! options
7769 msg
7770 !! input
7771 {{Includes2}}
7772 !! result
7773 Foo
7774 !! end
7775
7776 !! test
7777 {{#special:}} page name, known
7778 !! options
7779 msg
7780 !! input
7781 {{#special:Recentchanges}}
7782 !! result
7783 Special:RecentChanges
7784 !! end
7785
7786 !! test
7787 {{#special:}} page name with subpage, known
7788 !! options
7789 msg
7790 !! input
7791 {{#special:Recentchanges/param}}
7792 !! result
7793 Special:RecentChanges/param
7794 !! end
7795
7796 !! test
7797 {{#special:}} page name, unknown
7798 !! options
7799 msg
7800 !! input
7801 {{#special:foobar nonexistent}}
7802 !! result
7803 Special:Foobar nonexistent
7804 !! end
7805
7806 !! test
7807 {{#speciale:}} page name, known
7808 !! options
7809 msg
7810 !! input
7811 {{#speciale:Recentchanges}}
7812 !! result
7813 Special:RecentChanges
7814 !! end
7815
7816 !! test
7817 {{#speciale:}} page name with subpage, known
7818 !! options
7819 msg
7820 !! input
7821 {{#speciale:Recentchanges/param}}
7822 !! result
7823 Special:RecentChanges/param
7824 !! end
7825
7826 !! test
7827 {{#speciale:}} page name, unknown
7828 !! options
7829 msg
7830 !! input
7831 {{#speciale:foobar nonexistent}}
7832 !! result
7833 Special:Foobar_nonexistent
7834 !! end
7835
7836 ###
7837 ### Images
7838 ###
7839 !! test
7840 Simple image
7841 !! input
7842 [[Image:foobar.jpg]]
7843 !! result
7844 <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>
7845 </p>
7846 !! end
7847
7848 !! test
7849 Right-aligned image
7850 !! input
7851 [[Image:foobar.jpg|right]]
7852 !! result
7853 <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>
7854
7855 !! end
7856
7857 !! test
7858 Simple image (using File: namespace, now canonical)
7859 !! input
7860 [[File:foobar.jpg]]
7861 !! result
7862 <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>
7863 </p>
7864 !! end
7865
7866 !! test
7867 Image with caption
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 empty attribute
7877 !! input
7878 [[Image:foobar.jpg|right||Caption text]]
7879 !! result
7880 <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>
7881
7882 !! end
7883
7884 !! test
7885 Image with link tails
7886 !! input
7887 123[[Image:foobar.jpg]]456
7888 123[[Image:foobar.jpg|right]]456
7889 123[[Image:foobar.jpg|thumb]]456
7890 !! result
7891 <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
7892 </p>
7893 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
7894 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
7895
7896 !! end
7897
7898 !! test
7899 Image with multiple captions -- only last one is accepted
7900 !! input
7901 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7902 !! result
7903 <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>
7904
7905 !! end
7906
7907 !! test
7908 Image with width attribute at different positions
7909 !! input
7910 [[Image:foobar.jpg|200px|right|Caption]]
7911 [[Image:foobar.jpg|right|200px|Caption]]
7912 [[Image:foobar.jpg|right|Caption|200px]]
7913 !! result
7914 <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>
7915 <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>
7916 <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>
7917
7918 !! end
7919
7920 !! test
7921 Image with link parameter, wiki target
7922 !! input
7923 [[Image:foobar.jpg|link=Target page]]
7924 !! result
7925 <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>
7926 </p>
7927 !! end
7928
7929 !! test
7930 Image with link parameter, URL target
7931 !! input
7932 [[Image:foobar.jpg|link=http://example.com/]]
7933 !! result
7934 <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>
7935 </p>
7936 !! end
7937
7938 !! test
7939 Image with link parameter, wgExternalLinkTarget
7940 !! input
7941 [[Image:foobar.jpg|link=http://example.com/]]
7942 !! config
7943 wgExternalLinkTarget='foobar'
7944 !! result
7945 <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>
7946 </p>
7947 !! end
7948
7949 !! test
7950 Image with link parameter, wgNoFollowLinks set to false
7951 !! input
7952 [[Image:foobar.jpg|link=http://example.com/]]
7953 !! config
7954 wgNoFollowLinks=false
7955 !! result
7956 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7957 </p>
7958 !! end
7959
7960 !! test
7961 Image with link parameter, wgNoFollowDomainExceptions
7962 !! input
7963 [[Image:foobar.jpg|link=http://example.com/]]
7964 !! config
7965 wgNoFollowDomainExceptions='example.com'
7966 !! result
7967 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7968 </p>
7969 !! end
7970
7971 !! test
7972 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7973 !! input
7974 [[Image:foobar.jpg|link=http://example.com/|Title]]
7975 !! config
7976 wgExternalLinkTarget='foobar'
7977 !! result
7978 <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>
7979 </p>
7980 !! end
7981
7982 !! test
7983 Image with empty link parameter
7984 !! input
7985 [[Image:foobar.jpg|link=]]
7986 !! result
7987 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7988 </p>
7989 !! end
7990
7991 !! test
7992 Image with link parameter (wiki target) and unnamed parameter
7993 !! input
7994 [[Image:foobar.jpg|link=Target page|Title]]
7995 !! result
7996 <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>
7997 </p>
7998 !! end
7999
8000 !! test
8001 Image with link parameter (URL target) and unnamed parameter
8002 !! input
8003 [[Image:foobar.jpg|link=http://example.com/|Title]]
8004 !! result
8005 <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>
8006 </p>
8007 !! end
8008
8009 !! test
8010 Thumbnail image with link parameter
8011 !! options
8012 php
8013 !! input
8014 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8015 !! result
8016 <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>
8017
8018 !! end
8019
8020 !! test
8021 Manually-specified thumbnail image
8022 !! options
8023 php
8024 !! input
8025 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8026 !! result
8027 <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>
8028
8029 !! end
8030
8031 !! test
8032 Manually-specified thumbnail image with explicit link to wiki page
8033 !! options
8034 php
8035 !! input
8036 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8037 !! result
8038 <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>
8039
8040 !! end
8041
8042 !! test
8043 Manually-specified thumbnail image with explicit link to url
8044 !! options
8045 php
8046 !! input
8047 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8048 !! result
8049 <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>
8050
8051 !! end
8052
8053 !! test
8054 Manually-specified thumbnail image with explicit no link
8055 !! options
8056 php
8057 !! input
8058 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8059 !! result
8060 <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>
8061
8062 !! end
8063
8064 !! test
8065 Manually-specified thumbnail image with explicit link and alt text
8066 !! options
8067 php
8068 !! input
8069 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8070 !! result
8071 <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>
8072
8073 !! end
8074
8075 !! test
8076 Image with frame and link
8077 !! input
8078 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8079 !! result
8080 <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>
8081
8082 !! end
8083
8084 !! test
8085 Image with frame and link and explicit alt
8086 !! input
8087 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8088 !! result
8089 <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>
8090
8091 !! end
8092
8093 !! test
8094 Image with wiki markup in implicit alt
8095 !! input
8096 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8097 !! result
8098 <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>
8099 </p>
8100 !! end
8101
8102 !! test
8103 Image with wiki markup in explicit alt
8104 !! input
8105 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8106 !! result
8107 <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>
8108 </p>
8109 !! end
8110
8111 !! test
8112 Link to image page- image page normally doesn't exists, hence edit link
8113 Add test with existing image page
8114 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8115 !! input
8116 [[:Image:test]]
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)">Image:test</a>
8119 </p>
8120 !! end
8121
8122 !! test
8123 bug 18784 Link to non-existent image page with caption should use caption as link text
8124 !! input
8125 [[:Image:test|caption]]
8126 !! result
8127 <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>
8128 </p>
8129 !! end
8130
8131 !! test
8132 Frameless image caption with a free URL
8133 !! input
8134 [[Image:foobar.jpg|http://example.com]]
8135 !! result
8136 <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>
8137 </p>
8138 !! end
8139
8140 !! test
8141 Thumbnail image caption with a free URL
8142 !! input
8143 [[Image:foobar.jpg|thumb|http://example.com]]
8144 !! result
8145 <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>
8146
8147 !! end
8148
8149 !! test
8150 Thumbnail image caption with a free URL and explicit alt
8151 !! input
8152 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8153 !! result
8154 <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>
8155
8156 !! end
8157
8158 !! test
8159 SVG thumbnails with no language set
8160 !! options
8161 !! input
8162 [[File:Foobar.svg|thumb|width=200]]
8163 !! result
8164 <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>
8165
8166 !! end
8167
8168 !! test
8169 SVG thumbnails with language de
8170 !! options
8171 !! input
8172 [[File:Foobar.svg|thumb|width=200|lang=de]]
8173 !! result
8174 <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>
8175
8176 !! end
8177
8178 !! test
8179 SVG thumbnails with invalid language code
8180 !! options
8181 !! input
8182 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8183 !! result
8184 <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>
8185
8186 !! end
8187
8188 !! test
8189 BUG 1887: A ISBN with a thumbnail
8190 !! input
8191 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
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><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
8194
8195 !! end
8196
8197 !! test
8198 BUG 1887: A RFC with a thumbnail
8199 !! input
8200 [[Image:foobar.jpg|thumb|This is RFC 12354]]
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>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
8203
8204 !! end
8205
8206 !! test
8207 BUG 1887: A mailto link with a thumbnail
8208 !! input
8209 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8210 !! result
8211 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
8212
8213 !! end
8214
8215 # Pending resolution to bug 368
8216 !! test
8217 BUG 648: Frameless image caption with a link
8218 !! input
8219 [[Image:foobar.jpg|text with a [[link]] in it]]
8220 !! result
8221 <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>
8222 </p>
8223 !! end
8224
8225 !! test
8226 BUG 648: Frameless image caption with a link (suffix)
8227 !! input
8228 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8229 !! result
8230 <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>
8231 </p>
8232 !! end
8233
8234 !! test
8235 BUG 648: Frameless image caption with an interwiki link
8236 !! input
8237 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8238 !! result
8239 <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>
8240 </p>
8241 !! end
8242
8243 !! test
8244 BUG 648: Frameless image caption with a piped interwiki link
8245 !! input
8246 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8247 !! result
8248 <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>
8249 </p>
8250 !! end
8251
8252 !! test
8253 Escape HTML special chars in image alt text
8254 !! input
8255 [[Image:foobar.jpg|& < > "]]
8256 !! result
8257 <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>
8258 </p>
8259 !! end
8260
8261 !! test
8262 BUG 499: Alt text should have &#1234;, not &amp;1234;
8263 !! input
8264 [[Image:foobar.jpg|&#9792;]]
8265 !! result
8266 <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>
8267 </p>
8268 !! end
8269
8270 !! test
8271 Broken image caption with link
8272 !! input
8273 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8274 !! result
8275 <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.
8276 </p>
8277 !! end
8278
8279 !! test
8280 Image caption containing another image
8281 !! input
8282 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8283 !! result
8284 <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>
8285
8286 !! end
8287
8288 !! test
8289 Image caption containing a newline
8290 !! input
8291 [[Image:Foobar.jpg|This
8292 *is some text]]
8293 !! result
8294 <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>
8295 </p>
8296 !!end
8297
8298 !!test
8299 Parsoid: Image caption containing leading space
8300 (The leading space should not trigger nowiki escaping in wt2wt mode)
8301 !! input
8302 [[Image:Foobar.jpg|thumb| bar]]
8303 !! result
8304 <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>
8305
8306 !!end
8307
8308 !! test
8309 Bug 3090: External links other than http: in image captions
8310 !! input
8311 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8312 !! result
8313 <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>
8314
8315 !! end
8316
8317 !! test
8318 Custom class
8319 !! input
8320 [[Image:foobar.jpg|a|class=b]]
8321 !! result
8322 <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>
8323 </p>
8324 !! end
8325
8326 !! test
8327 Localized image handling (1).
8328 !! options
8329 language=es
8330 !! input
8331 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8332 !! result
8333 <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>
8334
8335 !! end
8336
8337 !! test
8338 Localized image handling (2).
8339 !! options
8340 language=es
8341 !! input
8342 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8343 !! result
8344 <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>
8345
8346 !! end
8347
8348 !! test
8349 "border", "frameless" and "class" attributes on an image.
8350 !! input
8351 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8352 !! result
8353 <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>
8354 </p>
8355 !! end
8356
8357 !! article
8358 File:Barfoo.jpg
8359 !! text
8360 #REDIRECT [[File:Barfoo.jpg]]
8361 !! endarticle
8362
8363 !! test
8364 Redirected image
8365 !! input
8366 [[Image:Barfoo.jpg]]
8367 !! result
8368 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8369 </p>
8370 !! end
8371
8372 !! test
8373 Missing image with uploads disabled
8374 !! options
8375 wgEnableUploads=0
8376 !! input
8377 [[Image:Foobaz.jpg]]
8378 !! result
8379 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8380 </p>
8381 !! end
8382
8383 # Parsoid-specific testing for images
8384 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8385 # Currently imperfect due to a flaw in the Parsoid testrunner
8386 # Work in progress
8387
8388 !! test
8389 Parsoid-specific image handling - simple image
8390 !! options
8391 parsoid
8392 !! input
8393 [[Image:Foobar.jpg]]
8394 !! result
8395 <p>
8396 <span class="mw-default-size" typeof="mw:Image">
8397 <a href="File:Foobar.jpg">
8398 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8399 </a>
8400 </span>
8401 </p>
8402 !! end
8403
8404 !! test
8405 Parsoid-specific image handling - simple image without link
8406 !! options
8407 parsoid
8408 !! input
8409 [[Image:Foobar.jpg|link=]]
8410 !! result
8411 <p>
8412 <span class="mw-default-size" typeof="mw:Image">
8413 <span>
8414 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8415 </span>
8416 </span>
8417 </p>
8418 !! end
8419
8420 !! test
8421 Parsoid-specific image handling - simple image with specific link
8422 !! options
8423 parsoid
8424 !! input
8425 [[Image:Foobar.jpg|link=Main Page]]
8426 !! result
8427 <p>
8428 <span class="mw-default-size" typeof="mw:Image">
8429 <a href="Main_Page">
8430 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8431 </a>
8432 </span>
8433 </p>
8434 !! end
8435
8436 !! test
8437 Parsoid-specific image handling - simple image with size and middle alignment
8438 !! options
8439 parsoid
8440 !! input
8441 [[Image:Foobar.jpg|50px|middle]]
8442 !! result
8443 <p>
8444 <span class="mw-valign-middle" typeof="mw:Image">
8445 <a href="File:Foobar.jpg">
8446 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8447 </a>
8448 </span>
8449 </p>
8450 !! end
8451
8452 !! test
8453 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8454 !! options
8455 parsoid
8456 !! input
8457 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8458 !! result
8459 <p>
8460 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8461 <a href="File:Foobar.jpg">
8462 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8463 </a>
8464 </span>
8465 </p>
8466 !! end
8467
8468 !! test
8469 Parsoid-specific image handling - simple image with border and size spec
8470 !! options
8471 parsoid
8472 !! input
8473 [[Image:Foobar.jpg|50px|border|caption]]
8474 !! result
8475 <p>
8476 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8477 <a href="File:Foobar.jpg">
8478 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8479 </a>
8480 </span>
8481 </p>
8482 !! end
8483
8484 !! test
8485 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8486 !! options
8487 parsoid
8488 !! input
8489 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8490 !! result
8491 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8492 <a href="File:Foobar.jpg">
8493 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8494 </a>
8495 <figcaption>caption content</figcaption>
8496 </figure>
8497 !! end
8498
8499 !! test
8500 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8501 !! options
8502 parsoid
8503 !! input
8504 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8505 !! result
8506 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8507 <a href="File:Foobar.jpg">
8508 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8509 </a>
8510 <figcaption>caption</figcaption>
8511 </figure>
8512 !! end
8513
8514 !! test
8515 Parsoid-specific image handling - framed image with specific size and caption
8516 !! options
8517 parsoid
8518 !! input
8519 [[Image:Foobar.jpg|500x50px|frame|caption]]
8520 !! result
8521 <figure typeof="mw:Image/Frame">
8522 <a href="File:Foobar.jpg">
8523 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8524 </a>
8525 <figcaption>caption</figcaption>
8526 </figure>
8527 !! end
8528
8529 !! test
8530 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8531 !! options
8532 parsoid
8533 !! input
8534 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8535 !! result
8536 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8537 <a href="File:Foobar.jpg">
8538 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8539 </a>
8540 <figcaption>caption</figcaption>
8541 </figure>
8542 !! end
8543
8544 !! test
8545 Parsoid-specific image handling - frameless image with specific size, border, and caption
8546 !! options
8547 parsoid
8548 !! input
8549 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8550 !! result
8551 <p>
8552 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8553 <a href="File:Foobar.jpg">
8554 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8555 </a>
8556 </p>
8557 !! end
8558
8559 #!! test
8560 #Parsoid-specific image handling - simple image with a formatted caption
8561 #!! options
8562 #parsoid
8563 #!! input
8564 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8565 #!! result
8566 #<p>
8567 #<span typeof="mw:Image">
8568 #<a class="mw-default-size" href="Image:Foobar.jpg">
8569 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8570 #</a>
8571 #<span>abc</span>
8572 #</span>
8573 #</p>
8574
8575
8576 ###
8577 ### Subpages
8578 ###
8579 !! article
8580 Subpage test/subpage
8581 !! text
8582 foo
8583 !! endarticle
8584
8585 !! test
8586 Subpage link
8587 !! options
8588 subpage title=[[Subpage test]]
8589 !! input
8590 [[/subpage]]
8591 !! result
8592 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8593 </p>
8594 !! end
8595
8596 !! test
8597 Subpage noslash link
8598 !! options
8599 subpage title=[[Subpage test]]
8600 !!input
8601 [[/subpage/]]
8602 !! result
8603 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8604 </p>
8605 !! end
8606
8607 # TODO: make this PHP-parser compatible!
8608 !! test
8609 Relative subpage noslash link
8610 !! options
8611 parsoid=wt2wt,wt2html,html2html
8612 subpage title=[[Subpage test/1/2/3/4]]
8613 !!input
8614 [[../../subpage/]]
8615
8616 [[../../subpage]]
8617 !! result
8618 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8619 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8620 !! end
8621
8622 # TODO: make this PHP-parser compatible!
8623 !! test
8624 Parsoid: dot-slash prefixed wikilinks
8625 !! options
8626 parsoid=wt2wt,wt2html,html2html
8627 !!input
8628 [[./foo]]
8629
8630 [[././bar]]
8631
8632 [[././baz/]]
8633 !! result
8634 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8635 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8636 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8637 !! end
8638
8639 !! test
8640 Disabled subpages
8641 !! input
8642 [[/subpage]]
8643 !! result
8644 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8645 </p>
8646 !! end
8647
8648 !! test
8649 BUG 561: {{/Subpage}}
8650 !! options
8651 subpage title=[[Page]]
8652 !! input
8653 {{/Subpage}}
8654 !! result
8655 <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>
8656 </p>
8657 !! end
8658
8659 ###
8660 ### Categories
8661 ###
8662 !! article
8663 Category:MediaWiki User's Guide
8664 !! text
8665 blah
8666 !! endarticle
8667
8668 !! test
8669 Link to category
8670 !! input
8671 [[:Category:MediaWiki User's Guide]]
8672 !! result
8673 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8674 </p>
8675 !! end
8676
8677 !! test
8678 Simple category
8679 !! options
8680 cat
8681 !! input
8682 [[Category:MediaWiki User's Guide]]
8683 !! result
8684 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8685 !! end
8686
8687 !! test
8688 PAGESINCATEGORY invalid title fatal (r33546 fix)
8689 !! input
8690 {{PAGESINCATEGORY:<bogus>}}
8691 !! result
8692 <p>0
8693 </p>
8694 !! end
8695
8696 !! test
8697 Category with different sort key
8698 !! options
8699 cat
8700 !! input
8701 [[Category:MediaWiki User's Guide|Foo]]
8702 !! result
8703 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8704 !! end
8705
8706 !! test
8707 Category with identical sort key
8708 !! options
8709 cat
8710 !! input
8711 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8712 !! result
8713 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8714 !! end
8715
8716 !! test
8717 Category with empty sort key
8718 !! options
8719 cat
8720 pst
8721 !! input
8722 [[Category:MediaWiki User's Guide|]]
8723 !! result
8724 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8725 !! end
8726
8727 !! test
8728 Category with empty sort key and parentheses
8729 !! options
8730 cat
8731 pst
8732 !! input
8733 [[Category:Foo (bar)|]]
8734 !! result
8735 [[Category:Foo (bar)|Foo]]
8736 !! end
8737
8738 !! test
8739 Category with link tail
8740 !! options
8741 cat
8742 pst
8743 !! input
8744 123[[Category:Foo]]456
8745 !! result
8746 123[[Category:Foo]]456
8747 !! end
8748
8749 !! test
8750 Category with template
8751 !! options
8752 cat
8753 pst
8754 !! input
8755 [[Category:{{echo|Foo}}]]
8756 !! result
8757 [[Category:{{echo|Foo}}]]
8758 !! end
8759
8760 !! test
8761 Category with template in sort key
8762 !! options
8763 cat
8764 pst
8765 !! input
8766 [[Category:Foo|{{echo|Bar}}]]
8767 !! result
8768 [[Category:Foo|{{echo|Bar}}]]
8769 !! end
8770
8771 !! test
8772 Category with template in sort key and title
8773 !! options
8774 cat
8775 pst
8776 !! input
8777 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8778 !! result
8779 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8780 !! end
8781
8782 !! test
8783 Category / paragraph interactions
8784 !! input
8785 Foo [[Category:Baz]] Bar
8786
8787 Foo [[Category:Baz]]
8788 Bar
8789
8790 Foo
8791 [[Category:Baz]]
8792 Bar
8793
8794 Foo
8795 [[Category:Baz]] Bar
8796
8797 Foo
8798 [[Category:Baz]]
8799 [[Category:Baz]]
8800 [[Category:Baz]]
8801 Bar
8802
8803 [[Category:Baz]]
8804 [[Category:Baz]]
8805 [[Category:Baz]]
8806
8807 [[Category:Baz]]
8808 {{echo|[[Category:Baz]]}}
8809 [[Category:Baz]]
8810 !! result
8811 <p>Foo Bar
8812 </p><p>Foo
8813 Bar
8814 </p><p>Foo
8815 Bar
8816 </p><p>Foo Bar
8817 </p><p>Foo
8818 Bar
8819 </p>
8820 !! end
8821
8822 !! test
8823 Parsoid: Serialize link to category page with colon escape
8824 !! options
8825 parsoid
8826 !! input
8827
8828 [[:Category:Foo]]
8829 [[:Category:Foo|Bar]]
8830 !! result
8831 <p>
8832 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8833 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8834 </p>
8835 !! end
8836
8837 !! test
8838 Parsoid: Link prefix/suffixes aren't applied to category links
8839 !! options
8840 parsoid=wt2html,wt2wt,html2html
8841 language=is
8842 !! input
8843 x[[Category:Foo]]y
8844 !! result
8845 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
8846 !! end
8847
8848 !! test
8849 Parsoid: Serialize link to file page with colon escape
8850 !! options
8851 parsoid
8852 !! input
8853
8854 [[:File:Foo.png]]
8855 [[:File:Foo.png|Bar]]
8856 !! result
8857 <p>
8858 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8859 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8860 </p>
8861 !! end
8862
8863 !! test
8864 Parsoid: Serialize a genuine category link without colon escape
8865 !! options
8866 parsoid
8867 !! input
8868 [[Category:Foo]]
8869 [[Category:Foo|Bar]]
8870 !! result
8871 <link rel="mw:WikiLink/Category" href="Category:Foo">
8872 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8873 !! end
8874
8875 ###
8876 ### Inter-language links
8877 ###
8878 !! test
8879 Inter-language links
8880 !! options
8881 ill
8882 !! input
8883 [[es:Alimento]]
8884 [[fr:Nourriture]]
8885 [[zh:&#39135;&#21697;]]
8886 !! result
8887 es:Alimento fr:Nourriture zh:食品
8888 !! end
8889
8890 !! test
8891 Duplicate interlanguage links (bug 24502)
8892 !! options
8893 ill
8894 !! input
8895 [[es:1]]
8896 [[es:2]]
8897 [[fr:1]]
8898 [[fr:2]]
8899 !! result
8900 es:1 fr:1
8901 !! end
8902
8903 ###
8904 ### Sections
8905 ###
8906 !! test
8907 Basic section headings
8908 !! input
8909 == Headline 1 ==
8910 Some text
8911
8912 ==Headline 2==
8913 More
8914 ===Smaller headline===
8915 Blah blah
8916 !! result
8917 <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>
8918 <p>Some text
8919 </p>
8920 <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>
8921 <p>More
8922 </p>
8923 <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>
8924 <p>Blah blah
8925 </p>
8926 !! end
8927
8928 !! test
8929 Section headings with TOC
8930 !! input
8931 == Headline 1 ==
8932 === Subheadline 1 ===
8933 ===== Skipping a level =====
8934 ====== Skipping a level ======
8935
8936 == Headline 2 ==
8937 Some text
8938 ===Another headline===
8939 !! result
8940 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8941 <ul>
8942 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8943 <ul>
8944 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8945 <ul>
8946 <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>
8947 <ul>
8948 <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>
8949 </ul>
8950 </li>
8951 </ul>
8952 </li>
8953 </ul>
8954 </li>
8955 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8956 <ul>
8957 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8958 </ul>
8959 </li>
8960 </ul>
8961 </div>
8962 <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>
8963 <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>
8964 <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>
8965 <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>
8966 <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>
8967 <p>Some text
8968 </p>
8969 <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>
8970
8971 !! end
8972
8973 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8974 !! test
8975 Handling of sections up to level 6 and beyond
8976 !! input
8977 = Level 1 Heading=
8978 == Level 2 Heading==
8979 === Level 3 Heading===
8980 ==== Level 4 Heading====
8981 ===== Level 5 Heading=====
8982 ====== Level 6 Heading======
8983 ======= Level 7 Heading=======
8984 ======== Level 8 Heading========
8985 ========= Level 9 Heading=========
8986 ========== Level 10 Heading==========
8987 !! result
8988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
8989 <ul>
8990 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8991 <ul>
8992 <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>
8993 <ul>
8994 <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>
8995 <ul>
8996 <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>
8997 <ul>
8998 <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>
8999 <ul>
9000 <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>
9001 <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>
9002 <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>
9003 <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>
9004 <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>
9005 </ul>
9006 </li>
9007 </ul>
9008 </li>
9009 </ul>
9010 </li>
9011 </ul>
9012 </li>
9013 </ul>
9014 </li>
9015 </ul>
9016 </div>
9017 <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>
9018 <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>
9019 <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>
9020 <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>
9021 <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>
9022 <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>
9023 <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>
9024 <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>
9025 <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>
9026 <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>
9027
9028 !! end
9029
9030 !! test
9031 TOC regression (bug 9764)
9032 !! input
9033 == title 1 ==
9034 === title 1.1 ===
9035 ==== title 1.1.1 ====
9036 === title 1.2 ===
9037 == title 2 ==
9038 === title 2.1 ===
9039 !! result
9040 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9041 <ul>
9042 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9043 <ul>
9044 <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>
9045 <ul>
9046 <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>
9047 </ul>
9048 </li>
9049 <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>
9050 </ul>
9051 </li>
9052 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9053 <ul>
9054 <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>
9055 </ul>
9056 </li>
9057 </ul>
9058 </div>
9059 <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>
9060 <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>
9061 <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>
9062 <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>
9063 <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>
9064 <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>
9065
9066 !! end
9067
9068 !! test
9069 TOC with wgMaxTocLevel=3 (bug 6204)
9070 !! options
9071 wgMaxTocLevel=3
9072 !! input
9073 == title 1 ==
9074 === title 1.1 ===
9075 ==== title 1.1.1 ====
9076 === title 1.2 ===
9077 == title 2 ==
9078 === title 2.1 ===
9079 !! result
9080 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9081 <ul>
9082 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9083 <ul>
9084 <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>
9085 <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>
9086 </ul>
9087 </li>
9088 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9089 <ul>
9090 <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>
9091 </ul>
9092 </li>
9093 </ul>
9094 </div>
9095 <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>
9096 <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>
9097 <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>
9098 <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>
9099 <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>
9100 <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>
9101
9102 !! end
9103
9104 !! test
9105 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9106 !! options
9107 wgMaxTocLevel=3
9108 !! input
9109 ==Section 1==
9110 ===Section 1.1===
9111 ====Section 1.1.1====
9112 ====Section 1.1.1.1====
9113 ==Section 2==
9114 !! result
9115 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9116 <ul>
9117 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9118 <ul>
9119 <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>
9120 </ul>
9121 </li>
9122 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9123 </ul>
9124 </div>
9125 <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>
9126 <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>
9127 <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>
9128 <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>
9129 <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>
9130
9131 !! end
9132
9133
9134 !! test
9135 Resolving duplicate section names
9136 !! input
9137 == Foo bar ==
9138 == Foo bar ==
9139 !! result
9140 <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>
9141 <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>
9142
9143 !! end
9144
9145 !! test
9146 Resolving duplicate section names with differing case (bug 10721)
9147 !! input
9148 == Foo bar ==
9149 == Foo Bar ==
9150 !! result
9151 <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>
9152 <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>
9153
9154 !! end
9155
9156 !! article
9157 Template:sections
9158 !! text
9159 ===Section 1===
9160 ==Section 2==
9161 !! endarticle
9162
9163 !! test
9164 Template with sections, __NOTOC__
9165 !! input
9166 __NOTOC__
9167 ==Section 0==
9168 {{sections}}
9169 ==Section 4==
9170 !! result
9171 <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>
9172 <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>
9173 <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>
9174 <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>
9175
9176 !! end
9177
9178 !! test
9179 __NOEDITSECTION__ keyword
9180 !! input
9181 __NOEDITSECTION__
9182 ==Section 1==
9183 ==Section 2==
9184 !! result
9185 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9186 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9187
9188 !! end
9189
9190 !! test
9191 Link inside a section heading
9192 !! input
9193 ==Section with a [[Main Page|link]] in it==
9194 !! result
9195 <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>
9196
9197 !! end
9198
9199 !! test
9200 TOC regression (bug 12077)
9201 !! input
9202 __TOC__
9203 == title 1 ==
9204 === title 1.1 ===
9205 == title 2 ==
9206 !! result
9207 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9208 <ul>
9209 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9210 <ul>
9211 <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>
9212 </ul>
9213 </li>
9214 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9215 </ul>
9216 </div>
9217 <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>
9218 <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>
9219 <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>
9220
9221 !! end
9222
9223 !! test
9224 BUG 1219 URL next to image (good)
9225 !! input
9226 http://example.com [[Image:foobar.jpg]]
9227 !! result
9228 <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>
9229 </p>
9230 !!end
9231
9232 !! test
9233 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9234 !! input
9235 ===
9236 The line above must have a trailing space!
9237 === <!--
9238 --> <!-- -->
9239 But just in case it doesn't...
9240 !! result
9241 <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>
9242 <p>The line above must have a trailing space!
9243 </p>
9244 <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>
9245 <p>But just in case it doesn't...
9246 </p>
9247 !! end
9248
9249 !! test
9250 Header with special characters (bug 25462)
9251 !! input
9252 The tooltips shall not show entities to the user (ie. be double escaped)
9253
9254 == text > text ==
9255 section 1
9256
9257 == text < text ==
9258 section 2
9259
9260 == text & text ==
9261 section 3
9262
9263 == text ' text ==
9264 section 4
9265
9266 == text " text ==
9267 section 5
9268 !! result
9269 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9270 </p>
9271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9272 <ul>
9273 <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>
9274 <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>
9275 <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>
9276 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9277 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9278 </ul>
9279 </div>
9280 <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>
9281 <p>section 1
9282 </p>
9283 <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>
9284 <p>section 2
9285 </p>
9286 <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>
9287 <p>section 3
9288 </p>
9289 <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>
9290 <p>section 4
9291 </p>
9292 <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>
9293 <p>section 5
9294 </p>
9295 !! end
9296
9297 !! test
9298 Headers with excess '=' characters
9299 (Are similar tests necessary beyond the 1st level?)
9300 !! input
9301 =foo==
9302 ==foo=
9303 =''italic'' heading==
9304 ==''italic'' heading=
9305 !! result
9306 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9307 <ul>
9308 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9309 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9310 <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>
9311 <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>
9312 </ul>
9313 </div>
9314 <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>
9315 <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>
9316 <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>
9317 <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>
9318
9319 !! end
9320
9321 !! test
9322 HTML headers vs TOC (bug 23393)
9323 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9324 !! input
9325 <h1>Header 1</h1>
9326 == Header 1.1 ==
9327 == Header 1.2 ==
9328
9329 <h1>Header 2
9330 </h1>
9331 == Header 2.1 ==
9332 == Header 2.2 ==
9333 __NOEDITSECTION__
9334 !! result
9335 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9336 <ul>
9337 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9338 <ul>
9339 <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>
9340 <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>
9341 </ul>
9342 </li>
9343 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9344 <ul>
9345 <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>
9346 <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>
9347 </ul>
9348 </li>
9349 </ul>
9350 </div>
9351 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9352 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9353 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9354 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9355 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9356 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9357
9358 !! end
9359
9360 !! test
9361 BUG 1219 URL next to image (broken)
9362 !! input
9363 http://example.com[[Image:foobar.jpg]]
9364 !! result
9365 <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>
9366 </p>
9367 !!end
9368
9369 !! test
9370 Bug 1186 news: in the middle of text
9371 !! input
9372 http://en.wikinews.org/wiki/Wikinews:Workplace
9373 !! result
9374 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9375 </p>
9376 !!end
9377
9378
9379 !! test
9380 Namespaced link must have a title
9381 !! input
9382 [[Project:]]
9383 !! result
9384 <p>[[Project:]]
9385 </p>
9386 !!end
9387
9388 !! test
9389 Namespaced link must have a title (bad fragment version)
9390 !! input
9391 [[Project:#fragment]]
9392 !! result
9393 <p>[[Project:#fragment]]
9394 </p>
9395 !!end
9396
9397
9398 ###
9399 ### HTML tags and HTML attributes
9400 ###
9401
9402 !! test
9403 div with no attributes
9404 !! input
9405 <div>HTML rocks</div>
9406 !! result
9407 <div>HTML rocks</div>
9408
9409 !! end
9410
9411 !! test
9412 div with double-quoted attribute
9413 !! input
9414 <div id="rock">HTML rocks</div>
9415 !! result
9416 <div id="rock">HTML rocks</div>
9417
9418 !! end
9419
9420 !! test
9421 div with single-quoted attribute
9422 !! input
9423 <div id='rock'>HTML rocks</div>
9424 !! result
9425 <div id="rock">HTML rocks</div>
9426
9427 !! end
9428
9429 !! test
9430 div with unquoted attribute
9431 !! input
9432 <div id=rock>HTML rocks</div>
9433 !! result
9434 <div id="rock">HTML rocks</div>
9435
9436 !! end
9437
9438 !! test
9439 div with illegal double attributes
9440 !! input
9441 <div id="a" id="b">HTML rocks</div>
9442 !! result
9443 <div id="b">HTML rocks</div>
9444
9445 !!end
9446
9447 # FIXME: produce empty string instead of "class" in the PHP parser, following
9448 # the HTML5 spec.
9449 !! test
9450 div with empty attribute value, space before equals
9451 !! options
9452 parsoid
9453 !! input
9454 <div class =>HTML rocks</div>
9455 !! result
9456 <div class="">HTML rocks</div>
9457
9458 !! end
9459
9460 # The PHP parser escapes the opening brace to &#123; for some reason, so
9461 # disabled this test for it.
9462 !! test
9463 div with braces in attribute value
9464 !! options
9465 parsoid
9466 !! input
9467 <div title="{}">Foo</div>
9468 !! result
9469 <div title="{}">Foo</div>
9470 !! end
9471
9472 # This it very inconsistent in the PHP parser: it returns
9473 # class="class" if there is a space between the name and the equal sign (see
9474 # 'div with empty attribute value, space before equals'), but strips the
9475 # attribute completely if the space is missing. We hope that not much content
9476 # depends on this, so are implementing the behavior below in Parsoid for
9477 # consistencies' sake. Disabled for the PHP parser.
9478 # FIXME: fix this behavior in the PHP parser?
9479 !! test
9480 div with empty attribute value, no space before equals
9481 !! options
9482 parsoid
9483 !! input
9484 <div class=>HTML rocks</div>
9485 !! result
9486 <div class="">HTML rocks</div>
9487
9488 !! end
9489
9490 !! test
9491 HTML multiple attributes correction
9492 !! input
9493 <p class="error" class="awesome">Awesome!</p>
9494 !! result
9495 <p class="awesome">Awesome!</p>
9496
9497 !!end
9498
9499 !! test
9500 Table multiple attributes correction
9501 !! input
9502 {|
9503 !+ class="error" class="awesome"| status
9504 |}
9505 !! result
9506 <table>
9507 <tr>
9508 <th class="awesome"> status
9509 </th></tr></table>
9510
9511 !!end
9512
9513 !! test
9514 DIV IN UPPERCASE
9515 !! input
9516 <DIV ID="x">HTML ROCKS</DIV>
9517 !! result
9518 <div id="x">HTML ROCKS</div>
9519
9520 !!end
9521
9522 !! test
9523 Non-ASCII pseudo-tags are rendered as text
9524 !! input
9525 <khyô>
9526 !! result
9527 <p>&lt;khyô&gt;
9528 </p>
9529 !! end
9530
9531 !! test
9532 Pseudo-tag with URL 'name' renders as url link
9533 !! input
9534 <http://example.com/>
9535 !! result
9536 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9537 </p>
9538 !! end
9539
9540 !! test
9541 text with amp in the middle of nowhere
9542 !! input
9543 Remember AT&T?
9544 !!result
9545 <p>Remember AT&amp;T?
9546 </p>
9547 !! end
9548
9549 !! test
9550 text with character entity: eacute
9551 !! input
9552 I always thought &eacute; was a cute letter.
9553 !! result
9554 <p>I always thought &#233; was a cute letter.
9555 </p>
9556 !! end
9557
9558 !! test
9559 text with entity-escaped character entity-like string: eacute
9560 !! input
9561 I always thought &amp;eacute; was a cute letter.
9562 !! result
9563 <p>I always thought &amp;eacute; was a cute letter.
9564 </p>
9565 !! end
9566
9567 !! test
9568 text with undefined character entity: xacute
9569 !! input
9570 I always thought &xacute; was a cute letter.
9571 !! result
9572 <p>I always thought &amp;xacute; was a cute letter.
9573 </p>
9574 !! end
9575
9576
9577 ###
9578 ### Nesting tests (see bug 41545, 50604, 51081)
9579 ###
9580
9581 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9582 # Note that html2wt is considerably more difficult if we use <b> in
9583 # the test case, instead of <big>
9584 !! test
9585 Ensure that HTML adoption agency algorithm is properly implemented.
9586 !! input
9587 <big>X<big>Y</big>Z</big>
9588 !! result
9589 <p><big>X<big>Y</big>Z</big>
9590 </p>
9591 !! end
9592
9593 # This was bug 41545 in the PHP parser.
9594 !! test
9595 Nesting of <kbd>
9596 !! input
9597 <kbd>X<kbd>Y</kbd>Z</kbd>
9598 !! result
9599 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9600 </p>
9601 !! end
9602
9603 # The following cases were bug 51081 in the PHP parser.
9604 # Note that there are some other nestable tags (b, i, etc) which are
9605 # not covered; see bug 51081 for discussion.
9606 !! test
9607 Nesting of <em>
9608 !! input
9609 <em>X<em>Y</em>Z</em>
9610 !! result
9611 <p><em>X<em>Y</em>Z</em>
9612 </p>
9613 !! end
9614
9615 !! test
9616 Nesting of <strong>
9617 !! input
9618 <strong>X<strong>Y</strong>Z</strong>
9619 !! result
9620 <p><strong>X<strong>Y</strong>Z</strong>
9621 </p>
9622 !! end
9623
9624 !! test
9625 Nesting of <q>
9626 !! input
9627 <q>X<q>Y</q>Z</q>
9628 !! result
9629 <p><q>X<q>Y</q>Z</q>
9630 </p>
9631 !! end
9632
9633 !! test
9634 Nesting of <ruby>
9635 !! input
9636 <ruby>X<ruby>Y</ruby>Z</ruby>
9637 !! result
9638 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9639 </p>
9640 !! end
9641
9642 !! test
9643 Nesting of <bdo>
9644 !! input
9645 <bdo>X<bdo>Y</bdo>Z</bdo>
9646 !! result
9647 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9648 </p>
9649 !! end
9650
9651
9652 ###
9653 ### Media links
9654 ###
9655
9656 !! test
9657 Media link
9658 !! input
9659 [[Media:Foobar.jpg]]
9660 !! result
9661 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9662 </p>
9663 !! end
9664
9665 !! test
9666 Media link with text
9667 !! input
9668 [[Media:Foobar.jpg|A neat file to look at]]
9669 !! result
9670 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9671 </p>
9672 !! end
9673
9674 # FIXME: this is still bad HTML tag nesting
9675 !! test
9676 Media link with nasty text
9677 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9678 !! input
9679 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9680 !! result
9681 <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>
9682
9683 !! end
9684
9685 !! test
9686 Media link to nonexistent file (bug 1702)
9687 !! input
9688 [[Media:No such.jpg]]
9689 !! result
9690 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9691 </p>
9692 !! end
9693
9694 !! test
9695 Image link to nonexistent file (bug 1850 - good)
9696 !! input
9697 [[Image:No such.jpg]]
9698 !! result
9699 <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>
9700 </p>
9701 !! end
9702
9703 !! test
9704 :Image link to nonexistent file (bug 1850 - bad)
9705 !! input
9706 [[:Image:No such.jpg]]
9707 !! result
9708 <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>
9709 </p>
9710 !! end
9711
9712
9713
9714 !! test
9715 Character reference normalization in link text (bug 1938)
9716 !! input
9717 [[Main Page|this&that]]
9718 !! result
9719 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9720 </p>
9721 !!end
9722
9723 !! article
9724 אַ
9725 !! text
9726 Test for unicode normalization
9727
9728 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9729 !! endarticle
9730
9731 !! test
9732 (bug 19451) Links should refer to the normalized form.
9733 !! input
9734 [[&#xFB2E;]]
9735 [[&#x5d0;&#x5b7;]]
9736 [[&#x5d0;ַ]]
9737 [[א&#x5b7;]]
9738 [[אַ]]
9739 !! result
9740 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9741 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9742 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9743 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9744 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9745 </p>
9746 !! end
9747
9748 !! test
9749 Empty attribute crash test (bug 2067)
9750 !! input
9751 <font color="">foo</font>
9752 !! result
9753 <p><font color="">foo</font>
9754 </p>
9755 !! end
9756
9757 !! test
9758 Empty attribute crash test single-quotes (bug 2067)
9759 !! input
9760 <font color=''>foo</font>
9761 !! result
9762 <p><font color="">foo</font>
9763 </p>
9764 !! end
9765
9766 !! test
9767 Attribute test: equals, then nothing
9768 !! input
9769 <font color=>foo</font>
9770 !! result
9771 <p><font>foo</font>
9772 </p>
9773 !! end
9774
9775 !! test
9776 Attribute test: unquoted value
9777 !! input
9778 <font color=x>foo</font>
9779 !! result
9780 <p><font color="x">foo</font>
9781 </p>
9782 !! end
9783
9784 !! test
9785 Attribute test: unquoted but illegal value (hash)
9786 !! input
9787 <font color=#x>foo</font>
9788 !! result
9789 <p><font color="#x">foo</font>
9790 </p>
9791 !! end
9792
9793 !! test
9794 Attribute test: no value
9795 !! input
9796 <font color>foo</font>
9797 !! result
9798 <p><font color="color">foo</font>
9799 </p>
9800 !! end
9801
9802 !! test
9803 Bug 2095: link with three closing brackets
9804 !! input
9805 [[Main Page]]]
9806 !! result
9807 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9808 </p>
9809 !! end
9810
9811 !! test
9812 Bug 2095: link with pipe and three closing brackets
9813 !! input
9814 [[Main Page|link]]]
9815 !! result
9816 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9817 </p>
9818 !! end
9819
9820 !! test
9821 Bug 2095: link with pipe and three closing brackets, version 2
9822 !! input
9823 [[Main Page|[http://example.com/]]]
9824 !! result
9825 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9826 </p>
9827 !! end
9828
9829
9830 ###
9831 ### Safety
9832 ###
9833
9834 !! article
9835 Template:Dangerous attribute
9836 !! text
9837 " onmouseover="alert(document.cookie)
9838 !! endarticle
9839
9840 !! article
9841 Template:Dangerous style attribute
9842 !! text
9843 border-size: expression(alert(document.cookie))
9844 !! endarticle
9845
9846 !! article
9847 Template:Div style
9848 !! text
9849 <div style="float: right; {{{1}}}">Magic div</div>
9850 !! endarticle
9851
9852 !! test
9853 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9854 !! input
9855 <div title="{{test}}"></div>
9856 !! result
9857 <div title="This is a test template"></div>
9858
9859 !! end
9860
9861 !! test
9862 Bug 2304: HTML attribute safety (dangerous template; 2309)
9863 !! input
9864 <div title="{{dangerous attribute}}"></div>
9865 !! result
9866 <div title=""></div>
9867
9868 !! end
9869
9870 !! test
9871 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9872 !! input
9873 <div style="{{dangerous style attribute}}"></div>
9874 !! result
9875 <div style="/* insecure input */"></div>
9876
9877 !! end
9878
9879 !! test
9880 Bug 2304: HTML attribute safety (safe parameter; 2309)
9881 !! input
9882 {{div style|width: 200px}}
9883 !! result
9884 <div style="float: right; width: 200px">Magic div</div>
9885
9886 !! end
9887
9888 !! test
9889 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9890 !! input
9891 {{div style|width: expression(alert(document.cookie))}}
9892 !! result
9893 <div style="/* insecure input */">Magic div</div>
9894
9895 !! end
9896
9897 !! test
9898 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9899 !! input
9900 {{div style|"><script>alert(document.cookie)</script>}}
9901 !! result
9902 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9903
9904 !! end
9905
9906 !! test
9907 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9908 !! input
9909 {{div style|" ><script>alert(document.cookie)</script>}}
9910 !! result
9911 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9912
9913 !! end
9914
9915 !! test
9916 Bug 2304: HTML attribute safety (link)
9917 !! input
9918 <div title="[[Main Page]]"></div>
9919 !! result
9920 <div title="&#91;&#91;Main Page]]"></div>
9921
9922 !! end
9923
9924 !! test
9925 Bug 2304: HTML attribute safety (italics)
9926 !! input
9927 <div title="''foobar''"></div>
9928 !! result
9929 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9930
9931 !! end
9932
9933 !! test
9934 Bug 2304: HTML attribute safety (bold)
9935 !! input
9936 <div title="'''foobar'''"></div>
9937 !! result
9938 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9939
9940 !! end
9941
9942
9943 !! test
9944 Bug 2304: HTML attribute safety (ISBN)
9945 !! input
9946 <div title="ISBN 1234567890"></div>
9947 !! result
9948 <div title="&#73;SBN 1234567890"></div>
9949
9950 !! end
9951
9952 !! test
9953 Bug 2304: HTML attribute safety (RFC)
9954 !! input
9955 <div title="RFC 1234"></div>
9956 !! result
9957 <div title="&#82;FC 1234"></div>
9958
9959 !! end
9960
9961 !! test
9962 Bug 2304: HTML attribute safety (PMID)
9963 !! input
9964 <div title="PMID 1234567890"></div>
9965 !! result
9966 <div title="&#80;MID 1234567890"></div>
9967
9968 !! end
9969
9970 !! test
9971 Bug 2304: HTML attribute safety (web link)
9972 !! input
9973 <div title="http://example.com/"></div>
9974 !! result
9975 <div title="http&#58;//example.com/"></div>
9976
9977 !! end
9978
9979 !! test
9980 Bug 2304: HTML attribute safety (named web link)
9981 !! input
9982 <div title="[http://example.com/ link]"></div>
9983 !! result
9984 <div title="&#91;http&#58;//example.com/ link]"></div>
9985
9986 !! end
9987
9988 !! test
9989 Bug 3244: HTML attribute safety (extension; safe)
9990 !! input
9991 <div style="<nowiki>background:blue</nowiki>"></div>
9992 !! result
9993 <div style="background:blue"></div>
9994
9995 !! end
9996
9997 !! test
9998 Bug 3244: HTML attribute safety (extension; unsafe)
9999 !! input
10000 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10001 !! result
10002 <div style="/* insecure input */"></div>
10003
10004 !! end
10005
10006 # More MSIE fun discovered by Tom Gilder
10007
10008 !! test
10009 MSIE CSS safety test: spurious slash
10010 !! input
10011 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10012 !! result
10013 <div style="/* insecure input */">evil</div>
10014
10015 !! end
10016
10017 !! test
10018 MSIE CSS safety test: hex code
10019 !! input
10020 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10021 !! result
10022 <div style="/* insecure input */">evil</div>
10023
10024 !! end
10025
10026 !! test
10027 MSIE CSS safety test: comment in url
10028 !! input
10029 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10030 !! result
10031 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10032
10033 !! end
10034
10035 !! test
10036 MSIE CSS safety test: comment in expression
10037 !! input
10038 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10039 !! result
10040 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10041
10042 !! end
10043
10044
10045 !! test
10046 Table attribute legitimate extension
10047 !! input
10048 {|
10049 !+ style="<nowiki>color:blue</nowiki>"| status
10050 |}
10051 !! result
10052 <table>
10053 <tr>
10054 <th style="color:blue"> status
10055 </th></tr></table>
10056
10057 !!end
10058
10059 !! test
10060 Table attribute safety
10061 !! input
10062 {|
10063 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10064 |}
10065 !! result
10066 <table>
10067 <tr>
10068 <th style="/* insecure input */"> status
10069 </th></tr></table>
10070
10071 !! end
10072
10073 !! test
10074 CSS line continuation 1
10075 !! input
10076 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10077 !! result
10078 <div style="/* insecure input */"></div>
10079
10080 !! end
10081
10082 !! test
10083 CSS line continuation 2
10084 !! input
10085 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10086 !! result
10087 <div style="/* insecure input */"></div>
10088
10089 !! end
10090
10091 !! article
10092 Template:Identity
10093 !! text
10094 {{{1}}}
10095 !! endarticle
10096
10097 !! test
10098 Expansion of multi-line templates in attribute values (bug 6255)
10099 !! input
10100 <div style="background: {{identity|#00FF00}}">-</div>
10101 !! result
10102 <div style="background: #00FF00">-</div>
10103
10104 !! end
10105
10106
10107 !! test
10108 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10109 !! input
10110 <div style="background:
10111 #00FF00">-</div>
10112 !! result
10113 <div style="background: #00FF00">-</div>
10114
10115 !! end
10116
10117 !! test
10118 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10119 !! input
10120 <div style="background: &#10;#00FF00">-</div>
10121 !! result
10122 <div style="background: &#10;#00FF00">-</div>
10123
10124 !! end
10125
10126 ###
10127 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10128 ###
10129 !! test
10130 Parser hook: empty input
10131 !! input
10132 <tag></tag>
10133 !! result
10134 <pre>
10135 ''
10136 array (
10137 )
10138 </pre>
10139
10140 !! end
10141
10142 !! test
10143 Parser hook: empty input using terminated empty elements
10144 !! input
10145 <tag/>
10146 !! result
10147 <pre>
10148 NULL
10149 array (
10150 )
10151 </pre>
10152
10153 !! end
10154
10155 !! test
10156 Parser hook: empty input using terminated empty elements (space before)
10157 !! input
10158 <tag />
10159 !! result
10160 <pre>
10161 NULL
10162 array (
10163 )
10164 </pre>
10165
10166 !! end
10167
10168 !! test
10169 Parser hook: basic input
10170 !! input
10171 <tag>input</tag>
10172 !! result
10173 <pre>
10174 'input'
10175 array (
10176 )
10177 </pre>
10178
10179 !! end
10180
10181
10182 !! test
10183 Parser hook: case insensitive
10184 !! input
10185 <TAG>input</TAG>
10186 !! result
10187 <pre>
10188 'input'
10189 array (
10190 )
10191 </pre>
10192
10193 !! end
10194
10195
10196 !! test
10197 Parser hook: case insensitive, redux
10198 !! input
10199 <TaG>input</TAg>
10200 !! result
10201 <pre>
10202 'input'
10203 array (
10204 )
10205 </pre>
10206
10207 !! end
10208
10209 !! test
10210 Parser hook: nested tags
10211 !! options
10212 noxml
10213 !! input
10214 <tag><tag></tag></tag>
10215 !! result
10216 <pre>
10217 '<tag>'
10218 array (
10219 )
10220 </pre>&lt;/tag&gt;
10221
10222 !! end
10223
10224 !! test
10225 Parser hook: basic arguments
10226 !! input
10227 <tag width=200 height = "100" depth = '50' square></tag>
10228 !! result
10229 <pre>
10230 ''
10231 array (
10232 'width' => '200',
10233 'height' => '100',
10234 'depth' => '50',
10235 'square' => 'square',
10236 )
10237 </pre>
10238
10239 !! end
10240
10241 !! test
10242 Parser hook: argument containing a forward slash (bug 5344)
10243 !! input
10244 <tag filename='/tmp/bla'></tag>
10245 !! result
10246 <pre>
10247 ''
10248 array (
10249 'filename' => '/tmp/bla',
10250 )
10251 </pre>
10252
10253 !! end
10254
10255 !! test
10256 Parser hook: empty input using terminated empty elements (bug 2374)
10257 !! input
10258 <tag foo=bar/>text
10259 !! result
10260 <pre>
10261 NULL
10262 array (
10263 'foo' => 'bar',
10264 )
10265 </pre>text
10266
10267 !! end
10268
10269 # </tag> should be output literally since there is no matching tag that begins it
10270 !! test
10271 Parser hook: basic arguments using terminated empty elements (bug 2374)
10272 !! input
10273 <tag width=200 height = "100" depth = '50' square/>
10274 other stuff
10275 </tag>
10276 !! result
10277 <pre>
10278 NULL
10279 array (
10280 'width' => '200',
10281 'height' => '100',
10282 'depth' => '50',
10283 'square' => 'square',
10284 )
10285 </pre>
10286 <p>other stuff
10287 &lt;/tag&gt;
10288 </p>
10289 !! end
10290
10291 ###
10292 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10293 ###
10294
10295 !! test
10296 Parser hook: static parser hook not inside a comment
10297 !! input
10298 <statictag>hello, world</statictag>
10299 <statictag action=flush/>
10300 !! result
10301 <p>hello, world
10302 </p>
10303 !! end
10304
10305
10306 !! test
10307 Parser hook: static parser hook inside a comment
10308 !! input
10309 <!-- <statictag>hello, world</statictag> -->
10310 <statictag action=flush/>
10311 !! result
10312 <p><br />
10313 </p>
10314 !! end
10315
10316 # Nested template calls; this case was broken by Parser.php rev 1.506,
10317 # since reverted.
10318
10319 !! article
10320 Template:One-parameter
10321 !! text
10322 (My parameter is: {{{1}}})
10323 !! endarticle
10324
10325 !! article
10326 Template:Map-one-parameter
10327 !! text
10328 {{{{{1}}}|{{{2}}}}}
10329 !! endarticle
10330
10331 !! test
10332 Nested template calls
10333 !! input
10334 {{Map-one-parameter|One-parameter|param}}
10335 !! result
10336 <p>(My parameter is: param)
10337 </p>
10338 !! end
10339
10340
10341 ###
10342 ### Sanitizer
10343 ###
10344 !! test
10345 Sanitizer: Closing of open tags
10346 !! input
10347 <s></s><table></table>
10348 !! result
10349 <s></s><table></table>
10350
10351 !! end
10352
10353 !! test
10354 Sanitizer: Closing of open but not closed tags
10355 !! input
10356 <s>foo
10357 !! result
10358 <p><s>foo</s>
10359 </p>
10360 !! end
10361
10362 !! test
10363 Sanitizer: Closing of closed but not open tags
10364 !! input
10365 </s>
10366 !! result
10367 <p>&lt;/s&gt;
10368 </p>
10369 !! end
10370
10371 !! test
10372 Sanitizer: Closing of closed but not open table tags
10373 !! input
10374 Table not started</td></tr></table>
10375 !! result
10376 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10377 </p>
10378 !! end
10379
10380 !! test
10381 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10382 !! input
10383 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10384 !! result
10385 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10386 </p>
10387 !! end
10388
10389 !! test
10390 Sanitizer: Validating the contents of the id attribute (bug 4515)
10391 !! options
10392 disabled
10393 !! input
10394 <br id=9 />
10395 !! result
10396 Something, but definitely not <br id="9" />...
10397 !! end
10398
10399 !! test
10400 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10401 !! options
10402 disabled
10403 !! input
10404 <br id="foo" /><br id="foo" />
10405 !! result
10406 Something need to be done. foo-2 ?
10407 !! end
10408
10409 !! test
10410 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10411 !! input
10412 <div itemscope>
10413 <meta itemprop="hello" content="world">
10414 <meta http-equiv="refresh" content="5">
10415 <meta itemprop="hello" http-equiv="refresh" content="5">
10416 <link itemprop="hello" href="{{SERVER}}">
10417 <link rel="stylesheet" href="{{SERVER}}">
10418 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10419 </div>
10420 !! result
10421 <div itemscope="itemscope">
10422 <p> <meta itemprop="hello" content="world" />
10423 &lt;meta http-equiv="refresh" content="5"&gt;
10424 <meta itemprop="hello" content="5" />
10425 </p>
10426 <link itemprop="hello" href="http&#58;//example.org" />
10427 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10428 <link itemprop="hello" href="http&#58;//example.org" />
10429 </div>
10430
10431 !! end
10432
10433 !! test
10434 Language converter: output gets cut off unexpectedly (bug 5757)
10435 !! options
10436 language=zh
10437 !! input
10438 this bit is safe: }-
10439
10440 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10441
10442 then we get cut off here: }-
10443
10444 all additional text is vanished
10445 !! result
10446 <p>this bit is safe: }-
10447 </p><p>but if we add a conversion instance: xxx
10448 </p><p>then we get cut off here: }-
10449 </p><p>all additional text is vanished
10450 </p>
10451 !! end
10452
10453 !! test
10454 Self closed html pairs (bug 5487)
10455 !! options
10456 !! input
10457 <center><font id="bug" />Centered text</center>
10458 <div><font id="bug2" />In div text</div>
10459 !! result
10460 <center>&lt;font id="bug" /&gt;Centered text</center>
10461 <div>&lt;font id="bug2" /&gt;In div text</div>
10462
10463 !! end
10464
10465 #
10466 #
10467 #
10468
10469 !! test
10470 Punctuation: nbsp before exclamation
10471 !! input
10472 C'est grave !
10473 !! result
10474 <p>C'est grave&#160;!
10475 </p>
10476 !! end
10477
10478 !! test
10479 Punctuation: CSS !important (bug 11874)
10480 !! input
10481 <div style="width:50% !important">important</div>
10482 !! result
10483 <div style="width:50% !important">important</div>
10484
10485 !!end
10486
10487 !! test
10488 Punctuation: CSS ! important (bug 11874; with space after)
10489 !! input
10490 <div style="width:50% ! important">important</div>
10491 !! result
10492 <div style="width:50% ! important">important</div>
10493
10494 !!end
10495
10496
10497 !! test
10498 HTML bullet list, closed tags (bug 5497)
10499 !! input
10500 <ul>
10501 <li>One</li>
10502 <li>Two</li>
10503 </ul>
10504 !! result
10505 <ul>
10506 <li>One</li>
10507 <li>Two</li>
10508 </ul>
10509
10510 !! end
10511
10512 !! test
10513 HTML bullet list, unclosed tags (bug 5497)
10514 !! options
10515 disabled
10516 !! input
10517 <ul>
10518 <li>One
10519 <li>Two
10520 </ul>
10521 !! result
10522 <ul>
10523 <li>One
10524 </li><li>Two
10525 </li></ul>
10526
10527 !! end
10528
10529 !! test
10530 HTML ordered list, closed tags (bug 5497)
10531 !! input
10532 <ol>
10533 <li>One</li>
10534 <li>Two</li>
10535 </ol>
10536 !! result
10537 <ol>
10538 <li>One</li>
10539 <li>Two</li>
10540 </ol>
10541
10542 !! end
10543
10544 !! test
10545 HTML ordered list, unclosed tags (bug 5497)
10546 !! options
10547 disabled
10548 !! input
10549 <ol>
10550 <li>One
10551 <li>Two
10552 </ol>
10553 !! result
10554 <ol>
10555 <li>One
10556 </li><li>Two
10557 </li></ol>
10558
10559 !! end
10560
10561 !! test
10562 HTML nested bullet list, closed tags (bug 5497)
10563 !! input
10564 <ul>
10565 <li>One</li>
10566 <li>Two:
10567 <ul>
10568 <li>Sub-one</li>
10569 <li>Sub-two</li>
10570 </ul>
10571 </li>
10572 </ul>
10573 !! result
10574 <ul>
10575 <li>One</li>
10576 <li>Two:
10577 <ul>
10578 <li>Sub-one</li>
10579 <li>Sub-two</li>
10580 </ul>
10581 </li>
10582 </ul>
10583
10584 !! end
10585
10586 !! test
10587 HTML nested bullet list, open tags (bug 5497)
10588 !! options
10589 disabled
10590 !! input
10591 <ul>
10592 <li>One
10593 <li>Two:
10594 <ul>
10595 <li>Sub-one
10596 <li>Sub-two
10597 </ul>
10598 </ul>
10599 !! result
10600 <ul>
10601 <li>One
10602 </li><li>Two:
10603 <ul>
10604 <li>Sub-one
10605 </li><li>Sub-two
10606 </li></ul>
10607 </li></ul>
10608
10609 !! end
10610
10611 !! test
10612 HTML nested ordered list, closed tags (bug 5497)
10613 !! input
10614 <ol>
10615 <li>One</li>
10616 <li>Two:
10617 <ol>
10618 <li>Sub-one</li>
10619 <li>Sub-two</li>
10620 </ol>
10621 </li>
10622 </ol>
10623 !! result
10624 <ol>
10625 <li>One</li>
10626 <li>Two:
10627 <ol>
10628 <li>Sub-one</li>
10629 <li>Sub-two</li>
10630 </ol>
10631 </li>
10632 </ol>
10633
10634 !! end
10635
10636 !! test
10637 HTML nested ordered list, open tags (bug 5497)
10638 !! options
10639 disabled
10640 !! input
10641 <ol>
10642 <li>One
10643 <li>Two:
10644 <ol>
10645 <li>Sub-one
10646 <li>Sub-two
10647 </ol>
10648 </ol>
10649 !! result
10650 <ol>
10651 <li>One
10652 </li><li>Two:
10653 <ol>
10654 <li>Sub-one
10655 </li><li>Sub-two
10656 </li></ol>
10657 </li></ol>
10658
10659 !! end
10660
10661 !! test
10662 HTML ordered list item with parameters oddity
10663 !! input
10664 <ol><li id="fragment">One</li></ol>
10665 !! result
10666 <ol><li id="fragment">One</li></ol>
10667
10668 !! end
10669
10670 !!test
10671 bug 5918: autonumbering
10672 !! input
10673 [http://first/] [http://second] [ftp://ftp]
10674
10675 ftp://inlineftp
10676
10677 [mailto:enclosed@mail.tld With target]
10678
10679 [mailto:enclosed@mail.tld]
10680
10681 mailto:inline@mail.tld
10682 !! result
10683 <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>
10684 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10685 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10686 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10687 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10688 </p>
10689 !! end
10690
10691
10692 #
10693 # Security and HTML correctness
10694 # From Nick Jenkins' fuzz testing
10695 #
10696
10697 !! test
10698 Fuzz testing: Parser13
10699 !! input
10700 {|
10701 | http://a|
10702 !! result
10703 <table>
10704 <tr>
10705 <td>
10706 </td>
10707 </tr>
10708 </table>
10709
10710 !! end
10711
10712 !! test
10713 Fuzz testing: Parser14
10714 !! input
10715 == onmouseover= ==
10716 http://__TOC__
10717 !! result
10718 <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>
10719 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10720 <ul>
10721 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10722 </ul>
10723 </div>
10724
10725 !! end
10726
10727 !! test
10728 Fuzz testing: Parser14-table
10729 !! input
10730 ==a==
10731 {| STYLE=__TOC__
10732 !! result
10733 <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>
10734 <table style="&#95;_TOC&#95;_">
10735 <tr><td></td></tr>
10736 </table>
10737
10738 !! end
10739
10740 # Known to produce bogus xml (extra </td>)
10741 !! test
10742 Fuzz testing: Parser16
10743 !! options
10744 noxml
10745 !! input
10746 {|
10747 !https://||||||
10748 !! result
10749 <table>
10750 <tr>
10751 <th>https://</th>
10752 <th></th>
10753 <th></th>
10754 <th>
10755 </td>
10756 </tr>
10757 </table>
10758
10759 !! end
10760
10761 !! test
10762 Fuzz testing: Parser21
10763 !! input
10764 {|
10765 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10766 |
10767 !! result
10768 <table>
10769 <tr>
10770 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10771 </th>
10772 <td>
10773 </td>
10774 </tr>
10775 </table>
10776
10777 !! end
10778
10779 !! test
10780 Fuzz testing: Parser22
10781 !! input
10782 http://===r:::https://b
10783
10784 {|
10785 !!result
10786 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10787 </p>
10788 <table>
10789 <tr><td></td></tr>
10790 </table>
10791
10792 !! end
10793
10794 # Known to produce bad XML for now
10795 !! test
10796 Fuzz testing: Parser24
10797 !! options
10798 noxml
10799 !! input
10800 {|
10801 {{{|
10802 <u CLASS=
10803 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10804 <br style="onmouseover='alert(document.cookie);' " />
10805
10806 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10807 |
10808 !! result
10809 <table>
10810 {{{|
10811 <u class="&#124;">}}}} &gt;
10812 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10813
10814 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10815 <tr>
10816 <td></u>
10817 </td>
10818 </tr>
10819 </table>
10820
10821 !! end
10822
10823 # Note: the current result listed for this is not what the original one was,
10824 # but the original bug was JavaScript injection, which is fixed in any case.
10825 # It's not clear that the original result listed was any more correct than the
10826 # current one. Original result:
10827 # <p>{{{|
10828 # </p>
10829 # <li class="&#124;&#124;">
10830 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10831 !!test
10832 Fuzz testing: Parser25 (bug 6055)
10833 !! input
10834 {{{
10835 |
10836 <LI CLASS=||
10837 >
10838 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10839 !! result
10840 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10841 </p>
10842 !! end
10843
10844 !!test
10845 Fuzz testing: URL adjacent extension (with space, clean)
10846 !! options
10847 !! input
10848 http://example.com <nowiki>junk</nowiki>
10849 !! result
10850 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10851 </p>
10852 !!end
10853
10854 !!test
10855 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10856 !! options
10857 !! input
10858 http://example.com<nowiki>junk</nowiki>
10859 !! result
10860 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10861 </p>
10862 !!end
10863
10864 !!test
10865 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10866 !! options
10867 !! input
10868 http://example.com<pre>junk</pre>
10869 !! result
10870 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10871
10872 !!end
10873
10874 !!test
10875 Fuzz testing: image with bogus manual thumbnail
10876 !!input
10877 [[Image:foobar.jpg|thumbnail= ]]
10878 !!result
10879 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10880
10881 !!end
10882
10883 !! test
10884 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10885 !! input
10886 <pre dir="&#10;"></pre>
10887 !! result
10888 <pre dir="&#10;"></pre>
10889
10890 !! end
10891
10892 !! test
10893 Parsing optional HTML elements (Bug 6171)
10894 !! options
10895 !! input
10896 <table>
10897 <tr>
10898 <td> Some tabular data</td>
10899 <td> More tabular data ...
10900 <td> And yet som tabular data</td>
10901 </tr>
10902 </table>
10903 !! result
10904 <table>
10905 <tr>
10906 <td> Some tabular data</td>
10907 <td> More tabular data ...
10908 </td><td> And yet som tabular data</td>
10909 </tr>
10910 </table>
10911
10912 !! end
10913
10914 !! test
10915 Correct handling of <td>, <tr> (Bug 6171)
10916 !! options
10917 !! input
10918 <table>
10919 <tr>
10920 <td> Some tabular data</td>
10921 <td> More tabular data ...</td>
10922 <td> And yet som tabular data</td>
10923 </tr>
10924 </table>
10925 !! result
10926 <table>
10927 <tr>
10928 <td> Some tabular data</td>
10929 <td> More tabular data ...</td>
10930 <td> And yet som tabular data</td>
10931 </tr>
10932 </table>
10933
10934 !! end
10935
10936
10937 !! test
10938 Parsing crashing regression (fr:JavaScript)
10939 !! input
10940 </body></x>
10941 !! result
10942 <p>&lt;/body&gt;&lt;/x&gt;
10943 </p>
10944 !! end
10945
10946 !! test
10947 Inline wiki vs wiki block nesting
10948 !! input
10949 '''Bold paragraph
10950
10951 New wiki paragraph
10952 !! result
10953 <p><b>Bold paragraph</b>
10954 </p><p>New wiki paragraph
10955 </p>
10956 !! end
10957
10958 !! test
10959 Inline HTML vs wiki block nesting
10960 !! options
10961 disabled
10962 !! input
10963 <b>Bold paragraph
10964
10965 New wiki paragraph
10966 !! result
10967 <p><b>Bold paragraph</b>
10968 </p><p>New wiki paragraph
10969 </p>
10970 !! end
10971
10972 # Original result was this:
10973 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10974 # </p>
10975 # While that might be marginally more intuitive, maybe, the six-apostrophe
10976 # construct is clearly pathological and the result stated here (which is what
10977 # the parser actually does) is about as reasonable as anything.
10978 !!test
10979 Mixing markup for italics and bold
10980 !! options
10981 !! input
10982 '''bold''''''bold''bolditalics'''''
10983 !! result
10984 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10985 </p>
10986 !! end
10987
10988
10989 !! article
10990 Xyzzyx
10991 !! text
10992 Article for special page transclusion test
10993 !! endarticle
10994
10995 !! test
10996 Special page transclusion
10997 !! options
10998 !! input
10999 {{Special:Prefixindex/Xyzzyx}}
11000 !! result
11001 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11002
11003 !! end
11004
11005 !! test
11006 Special page transclusion twice (bug 5021)
11007 !! options
11008 !! input
11009 {{Special:Prefixindex/Xyzzyx}}
11010 {{Special:Prefixindex/Xyzzyx}}
11011 !! result
11012 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11013 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11014
11015 !! end
11016
11017 !! test
11018 Transclusion of default MediaWiki message
11019 !! input
11020 {{MediaWiki:Mainpage}}
11021 !!result
11022 <p>Main Page
11023 </p>
11024 !! end
11025
11026 !! test
11027 Transclusion of nonexistent MediaWiki message
11028 !! input
11029 {{MediaWiki:Mainpagexxx}}
11030 !!result
11031 <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>
11032 </p>
11033 !! end
11034
11035 !! test
11036 Transclusion of MediaWiki message with underscore
11037 !! input
11038 {{MediaWiki:history_short}}
11039 !! result
11040 <p>History
11041 </p>
11042 !! end
11043
11044 !! test
11045 Transclusion of MediaWiki message with space
11046 !! input
11047 {{MediaWiki:history short}}
11048 !! result
11049 <p>History
11050 </p>
11051 !! end
11052
11053 !! test
11054 Invalid header with following text
11055 !! input
11056 = x = y
11057 !! result
11058 <p>= x = y
11059 </p>
11060 !! end
11061
11062
11063 !! test
11064 Section extraction test (section 0)
11065 !! options
11066 section=0
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 start
11081 !! end
11082
11083 !! test
11084 Section extraction test (section 1)
11085 !! options
11086 section=1
11087 !! input
11088 start
11089 ==a==
11090 ===aa===
11091 ====aaa====
11092 ==b==
11093 ===ba===
11094 ===bb===
11095 ====bba====
11096 ===bc===
11097 ==c==
11098 ===ca===
11099 !! result
11100 ==a==
11101 ===aa===
11102 ====aaa====
11103 !! end
11104
11105 !! test
11106 Section extraction test (section 2)
11107 !! options
11108 section=2
11109 !! input
11110 start
11111 ==a==
11112 ===aa===
11113 ====aaa====
11114 ==b==
11115 ===ba===
11116 ===bb===
11117 ====bba====
11118 ===bc===
11119 ==c==
11120 ===ca===
11121 !! result
11122 ===aa===
11123 ====aaa====
11124 !! end
11125
11126 !! test
11127 Section extraction test (section 3)
11128 !! options
11129 section=3
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 ====aaa====
11144 !! end
11145
11146 !! test
11147 Section extraction test (section 4)
11148 !! options
11149 section=4
11150 !! input
11151 start
11152 ==a==
11153 ===aa===
11154 ====aaa====
11155 ==b==
11156 ===ba===
11157 ===bb===
11158 ====bba====
11159 ===bc===
11160 ==c==
11161 ===ca===
11162 !! result
11163 ==b==
11164 ===ba===
11165 ===bb===
11166 ====bba====
11167 ===bc===
11168 !! end
11169
11170 !! test
11171 Section extraction test (section 5)
11172 !! options
11173 section=5
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 ===ba===
11188 !! end
11189
11190 !! test
11191 Section extraction test (section 6)
11192 !! options
11193 section=6
11194 !! input
11195 start
11196 ==a==
11197 ===aa===
11198 ====aaa====
11199 ==b==
11200 ===ba===
11201 ===bb===
11202 ====bba====
11203 ===bc===
11204 ==c==
11205 ===ca===
11206 !! result
11207 ===bb===
11208 ====bba====
11209 !! end
11210
11211 !! test
11212 Section extraction test (section 7)
11213 !! options
11214 section=7
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 ====bba====
11229 !! end
11230
11231 !! test
11232 Section extraction test (section 8)
11233 !! options
11234 section=8
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 ===bc===
11249 !! end
11250
11251 !! test
11252 Section extraction test (section 9)
11253 !! options
11254 section=9
11255 !! input
11256 start
11257 ==a==
11258 ===aa===
11259 ====aaa====
11260 ==b==
11261 ===ba===
11262 ===bb===
11263 ====bba====
11264 ===bc===
11265 ==c==
11266 ===ca===
11267 !! result
11268 ==c==
11269 ===ca===
11270 !! end
11271
11272 !! test
11273 Section extraction test (section 10)
11274 !! options
11275 section=10
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 ===ca===
11290 !! end
11291
11292 !! test
11293 Section extraction test (nonexistent section 11)
11294 !! options
11295 section=11
11296 !! input
11297 start
11298 ==a==
11299 ===aa===
11300 ====aaa====
11301 ==b==
11302 ===ba===
11303 ===bb===
11304 ====bba====
11305 ===bc===
11306 ==c==
11307 ===ca===
11308 !! result
11309 !! end
11310
11311 !! test
11312 Section extraction test with bogus heading (section 1)
11313 !! options
11314 section=1
11315 !! input
11316 ==a==
11317 ==bogus== not a legal section
11318 ==b==
11319 !! result
11320 ==a==
11321 ==bogus== not a legal section
11322 !! end
11323
11324 !! test
11325 Section extraction test with bogus heading (section 2)
11326 !! options
11327 section=2
11328 !! input
11329 ==a==
11330 ==bogus== not a legal section
11331 ==b==
11332 !! result
11333 ==b==
11334 !! end
11335
11336 !! test
11337 Section extraction test with comment after heading (section 1)
11338 !! options
11339 section=1
11340 !! input
11341 ==a==
11342 ==b== <!-- -->
11343 ==c==
11344 !! result
11345 ==a==
11346 !! end
11347
11348 !! test
11349 Section extraction test with comment after heading (section 2)
11350 !! options
11351 section=2
11352 !! input
11353 ==a==
11354 ==b== <!-- -->
11355 ==c==
11356 !! result
11357 ==b== <!-- -->
11358 !! end
11359
11360 !! test
11361 Section extraction test with bogus <nowiki> heading (section 1)
11362 !! options
11363 section=1
11364 !! input
11365 ==a==
11366 ==bogus== <nowiki>not a legal section</nowiki>
11367 ==b==
11368 !! result
11369 ==a==
11370 ==bogus== <nowiki>not a legal section</nowiki>
11371 !! end
11372
11373 !! test
11374 Section extraction test with bogus <nowiki> heading (section 2)
11375 !! options
11376 section=2
11377 !! input
11378 ==a==
11379 ==bogus== <nowiki>not a legal section</nowiki>
11380 ==b==
11381 !! result
11382 ==b==
11383 !! end
11384
11385
11386 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11387 # instead of respecting commented sections
11388 !! test
11389 Section extraction prefixed by comment (section 1)
11390 !! options
11391 section=1
11392 !! input
11393 <!-- -->==sec1==
11394 ==sec2==
11395 !!result
11396 ==sec2==
11397 !!end
11398
11399 !! test
11400 Section extraction prefixed by comment (section 2)
11401 !! options
11402 section=2
11403 !! input
11404 <!-- -->==sec1==
11405 ==sec2==
11406 !!result
11407
11408 !!end
11409
11410
11411 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11412 # instead of respecting HTML-style headings
11413 !! test
11414 Section extraction, mixed wiki and html (section 1)
11415 !! options
11416 section=1
11417 !! input
11418 <h2>unmarked</h2>
11419 unmarked
11420 ==1==
11421 one
11422 ==2==
11423 two
11424 !! result
11425 ==1==
11426 one
11427 !! end
11428
11429 !! test
11430 Section extraction, mixed wiki and html (section 2)
11431 !! options
11432 section=2
11433 !! input
11434 <h2>unmarked</h2>
11435 unmarked
11436 ==1==
11437 one
11438 ==2==
11439 two
11440 !! result
11441 ==2==
11442 two
11443 !! end
11444
11445
11446 # Formerly testing for bug 3342
11447 !! test
11448 Section extraction, heading surrounded by <noinclude>
11449 !! options
11450 section=1
11451 !! input
11452 <noinclude>==unmarked==</noinclude>
11453 ==marked==
11454 !! result
11455 ==marked==
11456 !!end
11457
11458 # Test behavior of bug 19910
11459 !! test
11460 Sectiion with all-equals
11461 !! options
11462 section=2
11463 !! input
11464 ===
11465 The line above must have a trailing space
11466 === <!--
11467 --> <!-- -->
11468 But just in case it doesn't...
11469 !! result
11470 === <!--
11471 --> <!-- -->
11472 But just in case it doesn't...
11473 !! end
11474
11475 !! test
11476 Section replacement test (section 0)
11477 !! options
11478 replace=0,"xxx"
11479 !! input
11480 start
11481 ==a==
11482 ===aa===
11483 ====aaa====
11484 ==b==
11485 ===ba===
11486 ===bb===
11487 ====bba====
11488 ===bc===
11489 ==c==
11490 ===ca===
11491 !! result
11492 xxx
11493
11494 ==a==
11495 ===aa===
11496 ====aaa====
11497 ==b==
11498 ===ba===
11499 ===bb===
11500 ====bba====
11501 ===bc===
11502 ==c==
11503 ===ca===
11504 !! end
11505
11506 !! test
11507 Section replacement test (section 1)
11508 !! options
11509 replace=1,"xxx"
11510 !! input
11511 start
11512 ==a==
11513 ===aa===
11514 ====aaa====
11515 ==b==
11516 ===ba===
11517 ===bb===
11518 ====bba====
11519 ===bc===
11520 ==c==
11521 ===ca===
11522 !! result
11523 start
11524 xxx
11525
11526 ==b==
11527 ===ba===
11528 ===bb===
11529 ====bba====
11530 ===bc===
11531 ==c==
11532 ===ca===
11533 !! end
11534
11535 !! test
11536 Section replacement test (section 2)
11537 !! options
11538 replace=2,"xxx"
11539 !! input
11540 start
11541 ==a==
11542 ===aa===
11543 ====aaa====
11544 ==b==
11545 ===ba===
11546 ===bb===
11547 ====bba====
11548 ===bc===
11549 ==c==
11550 ===ca===
11551 !! result
11552 start
11553 ==a==
11554 xxx
11555
11556 ==b==
11557 ===ba===
11558 ===bb===
11559 ====bba====
11560 ===bc===
11561 ==c==
11562 ===ca===
11563 !! end
11564
11565 !! test
11566 Section replacement test (section 3)
11567 !! options
11568 replace=3,"xxx"
11569 !! input
11570 start
11571 ==a==
11572 ===aa===
11573 ====aaa====
11574 ==b==
11575 ===ba===
11576 ===bb===
11577 ====bba====
11578 ===bc===
11579 ==c==
11580 ===ca===
11581 !! result
11582 start
11583 ==a==
11584 ===aa===
11585 xxx
11586
11587 ==b==
11588 ===ba===
11589 ===bb===
11590 ====bba====
11591 ===bc===
11592 ==c==
11593 ===ca===
11594 !! end
11595
11596 !! test
11597 Section replacement test (section 4)
11598 !! options
11599 replace=4,"xxx"
11600 !! input
11601 start
11602 ==a==
11603 ===aa===
11604 ====aaa====
11605 ==b==
11606 ===ba===
11607 ===bb===
11608 ====bba====
11609 ===bc===
11610 ==c==
11611 ===ca===
11612 !! result
11613 start
11614 ==a==
11615 ===aa===
11616 ====aaa====
11617 xxx
11618
11619 ==c==
11620 ===ca===
11621 !! end
11622
11623 !! test
11624 Section replacement test (section 5)
11625 !! options
11626 replace=5,"xxx"
11627 !! input
11628 start
11629 ==a==
11630 ===aa===
11631 ====aaa====
11632 ==b==
11633 ===ba===
11634 ===bb===
11635 ====bba====
11636 ===bc===
11637 ==c==
11638 ===ca===
11639 !! result
11640 start
11641 ==a==
11642 ===aa===
11643 ====aaa====
11644 ==b==
11645 xxx
11646
11647 ===bb===
11648 ====bba====
11649 ===bc===
11650 ==c==
11651 ===ca===
11652 !! end
11653
11654 !! test
11655 Section replacement test (section 6)
11656 !! options
11657 replace=6,"xxx"
11658 !! input
11659 start
11660 ==a==
11661 ===aa===
11662 ====aaa====
11663 ==b==
11664 ===ba===
11665 ===bb===
11666 ====bba====
11667 ===bc===
11668 ==c==
11669 ===ca===
11670 !! result
11671 start
11672 ==a==
11673 ===aa===
11674 ====aaa====
11675 ==b==
11676 ===ba===
11677 xxx
11678
11679 ===bc===
11680 ==c==
11681 ===ca===
11682 !! end
11683
11684 !! test
11685 Section replacement test (section 7)
11686 !! options
11687 replace=7,"xxx"
11688 !! input
11689 start
11690 ==a==
11691 ===aa===
11692 ====aaa====
11693 ==b==
11694 ===ba===
11695 ===bb===
11696 ====bba====
11697 ===bc===
11698 ==c==
11699 ===ca===
11700 !! result
11701 start
11702 ==a==
11703 ===aa===
11704 ====aaa====
11705 ==b==
11706 ===ba===
11707 ===bb===
11708 xxx
11709
11710 ===bc===
11711 ==c==
11712 ===ca===
11713 !! end
11714
11715 !! test
11716 Section replacement test (section 8)
11717 !! options
11718 replace=8,"xxx"
11719 !! input
11720 start
11721 ==a==
11722 ===aa===
11723 ====aaa====
11724 ==b==
11725 ===ba===
11726 ===bb===
11727 ====bba====
11728 ===bc===
11729 ==c==
11730 ===ca===
11731 !! result
11732 start
11733 ==a==
11734 ===aa===
11735 ====aaa====
11736 ==b==
11737 ===ba===
11738 ===bb===
11739 ====bba====
11740 xxx
11741
11742 ==c==
11743 ===ca===
11744 !!end
11745
11746 !! test
11747 Section replacement test (section 9)
11748 !! options
11749 replace=9,"xxx"
11750 !! input
11751 start
11752 ==a==
11753 ===aa===
11754 ====aaa====
11755 ==b==
11756 ===ba===
11757 ===bb===
11758 ====bba====
11759 ===bc===
11760 ==c==
11761 ===ca===
11762 !! result
11763 start
11764 ==a==
11765 ===aa===
11766 ====aaa====
11767 ==b==
11768 ===ba===
11769 ===bb===
11770 ====bba====
11771 ===bc===
11772 xxx
11773 !! end
11774
11775 !! test
11776 Section replacement test (section 10)
11777 !! options
11778 replace=10,"xxx"
11779 !! input
11780 start
11781 ==a==
11782 ===aa===
11783 ====aaa====
11784 ==b==
11785 ===ba===
11786 ===bb===
11787 ====bba====
11788 ===bc===
11789 ==c==
11790 ===ca===
11791 !! result
11792 start
11793 ==a==
11794 ===aa===
11795 ====aaa====
11796 ==b==
11797 ===ba===
11798 ===bb===
11799 ====bba====
11800 ===bc===
11801 ==c==
11802 xxx
11803 !! end
11804
11805 !! test
11806 Section replacement test with initial whitespace (bug 13728)
11807 !! options
11808 replace=2,"xxx"
11809 !! input
11810 Preformatted initial line
11811 ==a==
11812 ===a===
11813 !! result
11814 Preformatted initial line
11815 ==a==
11816 xxx
11817 !! end
11818
11819
11820 !! test
11821 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11822 !! options
11823 section=1
11824 !! input
11825 ==a==
11826 a
11827 !! result
11828 ==a==
11829 a
11830 !! end
11831
11832 !! test
11833 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11834 !! options
11835 section=1
11836 !! input
11837 ==a==
11838 a
11839 !! result
11840 ==a==
11841 a
11842 !! end
11843
11844
11845 !! test
11846 Section extraction, <pre> around bogus header (bug 10309)
11847 !! options
11848 noxml section=2
11849 !! input
11850 == Section One ==
11851 <pre>
11852 =======
11853 </pre>
11854
11855 == Section Two ==
11856 stuff
11857 !! result
11858 == Section Two ==
11859 stuff
11860 !! end
11861
11862 !! test
11863 Section replacement, <pre> around bogus header (bug 10309)
11864 !! options
11865 noxml replace=2,"xxx"
11866 !! input
11867 == Section One ==
11868 <pre>
11869 =======
11870 </pre>
11871
11872 == Section Two ==
11873 stuff
11874 !! result
11875 == Section One ==
11876 <pre>
11877 =======
11878 </pre>
11879
11880 xxx
11881 !! end
11882
11883
11884
11885 !! test
11886 Handling of &#x0A; in URLs
11887 !! input
11888 **irc://&#x0A;a
11889 !! result
11890 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11891 </li></ul>
11892 </li></ul>
11893
11894 !!end
11895
11896 !! test
11897 5 quotes, code coverage +1 line (php)
11898 !! options
11899 php
11900 !! input
11901 '''''
11902 !! result
11903 !! end
11904 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11905 !! test
11906 5 quotes, code coverage +1 line (parsoid)
11907 !! options
11908 parsoid
11909 !! input
11910 '''''
11911 !! result
11912 <p><i><b></b></i></p>
11913 !! end
11914
11915 !! test
11916 Special:Search page linking.
11917 !! input
11918 {{Special:search}}
11919 !! result
11920 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11921 </p>
11922 !! end
11923
11924 !! test
11925 Say the magic word
11926 !! input
11927 * {{PAGENAME}}
11928 * {{BASEPAGENAME}}
11929 * {{SUBPAGENAME}}
11930 * {{SUBPAGENAMEE}}
11931 * {{ROOTPAGENAME}}
11932 * {{ROOTPAGENAMEE}}
11933 * {{BASEPAGENAME}}
11934 * {{BASEPAGENAMEE}}
11935 * {{TALKPAGENAME}}
11936 * {{TALKPAGENAMEE}}
11937 * {{SUBJECTPAGENAME}}
11938 * {{SUBJECTPAGENAMEE}}
11939 * {{NAMESPACEE}}
11940 * {{NAMESPACE}}
11941 * {{TALKSPACE}}
11942 * {{TALKSPACEE}}
11943 * {{SUBJECTSPACE}}
11944 * {{SUBJECTSPACEE}}
11945 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11946 !! result
11947 <ul><li> Parser test
11948 </li><li> Parser test
11949 </li><li> Parser test
11950 </li><li> Parser_test
11951 </li><li> Parser test
11952 </li><li> Parser_test
11953 </li><li> Parser test
11954 </li><li> Parser_test
11955 </li><li> Talk:Parser test
11956 </li><li> Talk:Parser_test
11957 </li><li> Parser test
11958 </li><li> Parser_test
11959 </li><li>
11960 </li><li>
11961 </li><li> Talk
11962 </li><li> Talk
11963 </li><li>
11964 </li><li>
11965 </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>
11966 </li></ul>
11967
11968 !! end
11969 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11970
11971 !! test
11972 Gallery
11973 !! input
11974 <gallery>
11975 image1.png |
11976 image2.gif|||||
11977
11978 image3|
11979 image4 |300px| centre
11980 image5.svg| http://///////
11981 [[x|xx]]]]
11982 * image6
11983 </gallery>
11984 !! result
11985 <ul class="gallery">
11986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11987 <div style="height: 150px;">Image1.png</div>
11988 <div class="gallerytext">
11989 </div>
11990 </div></li>
11991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11992 <div style="height: 150px;">Image2.gif</div>
11993 <div class="gallerytext">
11994 <p>||||
11995 </p>
11996 </div>
11997 </div></li>
11998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11999 <div style="height: 150px;">Image3</div>
12000 <div class="gallerytext">
12001 </div>
12002 </div></li>
12003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12004 <div style="height: 150px;">Image4</div>
12005 <div class="gallerytext">
12006 <p>300px| centre
12007 </p>
12008 </div>
12009 </div></li>
12010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12011 <div style="height: 150px;">Image5.svg</div>
12012 <div class="gallerytext">
12013 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12014 </p>
12015 </div>
12016 </div></li>
12017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12018 <div style="height: 150px;">* image6</div>
12019 <div class="gallerytext">
12020 </div>
12021 </div></li>
12022 </ul>
12023
12024 !! end
12025
12026 !! test
12027 Gallery (with options)
12028 !! input
12029 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12030 File:Nonexistant.jpg|caption
12031 File:Nonexistant.jpg
12032 image:foobar.jpg|some '''caption''' [[Main Page]]
12033 image:foobar.jpg
12034 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12035 </gallery>
12036 !! result
12037 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12038 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12039 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12040 <div style="height: 70px;">Nonexistant.jpg</div>
12041 <div class="gallerytext">
12042 <p>caption
12043 </p>
12044 </div>
12045 </div></li>
12046 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12047 <div style="height: 70px;">Nonexistant.jpg</div>
12048 <div class="gallerytext">
12049 </div>
12050 </div></li>
12051 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12052 <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>
12053 <div class="gallerytext">
12054 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12055 </p>
12056 </div>
12057 </div></li>
12058 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12059 <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>
12060 <div class="gallerytext">
12061 </div>
12062 </div></li>
12063 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12064 <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>
12065 <div class="gallerytext">
12066 <p>Blabla|blabla.
12067 </p>
12068 </div>
12069 </div></li>
12070 </ul>
12071
12072 !! end
12073
12074 !! test
12075 Gallery with wikitext inside caption
12076 !! input
12077 <gallery>
12078 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12079 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12080 </gallery>
12081 !! result
12082 <ul class="gallery">
12083 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12084 <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>
12085 <div class="gallerytext">
12086 <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>
12087 </p>
12088 </div>
12089 </div></li>
12090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12091 <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>
12092 <div class="gallerytext">
12093 <p>This is a test template
12094 </p>
12095 </div>
12096 </div></li>
12097 </ul>
12098
12099 !! end
12100
12101 !! test
12102 gallery (with showfilename option)
12103 !! input
12104 <gallery showfilename>
12105 File:Nonexistant.jpg|caption
12106 File:Nonexistant.jpg
12107 image:foobar.jpg|some '''caption''' [[Main Page]]
12108 File:Foobar.jpg
12109 </gallery>
12110 !! result
12111 <ul class="gallery">
12112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12113 <div style="height: 150px;">Nonexistant.jpg</div>
12114 <div class="gallerytext">
12115 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12116 caption
12117 </p>
12118 </div>
12119 </div></li>
12120 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12121 <div style="height: 150px;">Nonexistant.jpg</div>
12122 <div class="gallerytext">
12123 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12124 </p>
12125 </div>
12126 </div></li>
12127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12128 <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>
12129 <div class="gallerytext">
12130 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12131 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12132 </p>
12133 </div>
12134 </div></li>
12135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12136 <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>
12137 <div class="gallerytext">
12138 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12139 </p>
12140 </div>
12141 </div></li>
12142 </ul>
12143
12144 !! end
12145
12146 !! test
12147 Gallery (with namespace-less filenames)
12148 !! input
12149 <gallery>
12150 File:Nonexistant.jpg
12151 Nonexistant.jpg
12152 image:foobar.jpg
12153 foobar.jpg
12154 </gallery>
12155 !! result
12156 <ul class="gallery">
12157 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12158 <div style="height: 150px;">Nonexistant.jpg</div>
12159 <div class="gallerytext">
12160 </div>
12161 </div></li>
12162 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12163 <div style="height: 150px;">Nonexistant.jpg</div>
12164 <div class="gallerytext">
12165 </div>
12166 </div></li>
12167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12168 <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>
12169 <div class="gallerytext">
12170 </div>
12171 </div></li>
12172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12173 <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>
12174 <div class="gallerytext">
12175 </div>
12176 </div></li>
12177 </ul>
12178
12179 !! end
12180
12181 !! test
12182 HTML Hex character encoding (spells the word "JavaScript")
12183 !! input
12184 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12185 !! result
12186 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12187 </p>
12188 !! end
12189
12190 !! test
12191 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12192 !! input
12193 &#xsee;&#XSEE;
12194 !! result
12195 <p>&amp;#xsee;&amp;#XSEE;
12196 </p>
12197 !! end
12198
12199 !! test
12200 HTML Hex character encoding mixed case
12201 !! input
12202 &#xEE;&#Xee;
12203 !! result
12204 <p>&#xee;&#xee;
12205 </p>
12206 !! end
12207
12208 !! test
12209 __FORCETOC__ override
12210 !! input
12211 __NEWSECTIONLINK__
12212 __FORCETOC__
12213 !! result
12214 <p><br />
12215 </p>
12216 !! end
12217
12218 !! test
12219 ISBN code coverage
12220 !! input
12221 ISBN 978-0-1234-56&#x20;789
12222 !! result
12223 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12224 </p>
12225 !! end
12226
12227 !! test
12228 ISBN followed by 5 spaces
12229 !! input
12230 ISBN
12231 !! result
12232 <p>ISBN
12233 </p>
12234 !! end
12235
12236 !! test
12237 Double ISBN
12238 !! input
12239 ISBN ISBN 1234567890
12240 !! result
12241 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12242 </p>
12243 !! end
12244
12245 !! test
12246 Bug 22905: <abbr> followed by ISBN followed by </a>
12247 !! input
12248 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12249 !! result
12250 <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>
12251 </p>
12252 !! end
12253
12254 !! test
12255 Double RFC
12256 !! input
12257 RFC RFC 1234
12258 !! result
12259 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12260 </p>
12261 !! end
12262
12263 !! test
12264 Double RFC with a wiki link
12265 !! input
12266 RFC [[RFC 1234]]
12267 !! result
12268 <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>
12269 </p>
12270 !! end
12271
12272 !! test
12273 RFC code coverage
12274 !! input
12275 RFC 983&#x20;987
12276 !! result
12277 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12278 </p>
12279 !! end
12280
12281 !! test
12282 Centre-aligned image
12283 !! input
12284 [[Image:foobar.jpg|centre]]
12285 !! result
12286 <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>
12287
12288 !!end
12289
12290 !! test
12291 None-aligned image
12292 !! input
12293 [[Image:foobar.jpg|none]]
12294 !! result
12295 <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>
12296
12297 !!end
12298
12299 !! test
12300 Width + Height sized image (using px) (height is ignored)
12301 !! input
12302 [[Image:foobar.jpg|640x480px]]
12303 !! result
12304 <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>
12305 </p>
12306 !!end
12307
12308 !! test
12309 Width-sized image (using px, no following whitespace)
12310 !! input
12311 [[Image:foobar.jpg|640px]]
12312 !! result
12313 <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>
12314 </p>
12315 !!end
12316
12317 !! test
12318 Width-sized image (using px, with following whitespace - test regression from r39467)
12319 !! input
12320 [[Image:foobar.jpg|640px ]]
12321 !! result
12322 <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>
12323 </p>
12324 !!end
12325
12326 !! test
12327 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12328 !! input
12329 [[Image:foobar.jpg| 640px]]
12330 !! result
12331 <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>
12332 </p>
12333 !!end
12334
12335 !! test
12336 Another italics / bold test
12337 !! input
12338 ''' ''x'
12339 !! result
12340 <pre>'<i> </i>x'
12341 </pre>
12342 !!end
12343
12344 # Note the results may be incorrect, as parserTest output included this:
12345 # XML error: Mismatched tag at byte 6120:
12346 # ...<dd> </dt></dl> </dd...
12347 !! test
12348 dt/dd/dl test
12349 !! options
12350 disabled
12351 !! input
12352 :;;;::
12353 !! result
12354 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12355 </dd></dl>
12356 </dd></dl>
12357 </dt></dl>
12358 </dt></dl>
12359 </dt></dl>
12360 </dd></dl>
12361
12362 !!end
12363
12364
12365 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12366 !! test
12367 Images with the "|" character in the comment
12368 !! input
12369 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12370 !! result
12371 <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>
12372
12373 !!end
12374
12375 !! test
12376 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12377 !! input
12378 <html><script>alert(1);</script></html>
12379 !! result
12380 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12381 </p>
12382 !! end
12383
12384 !! test
12385 HTML with raw HTML ($wgRawHtml==true)
12386 !! options
12387 wgRawHtml=1
12388 !! input
12389 <html><script>alert(1);</script></html>
12390 !! result
12391 <p><script>alert(1);</script>
12392 </p>
12393 !! end
12394
12395 !! test
12396 Parents of subpages, one level up
12397 !! options
12398 subpage title=[[Subpage test/L1/L2/L3]]
12399 !! input
12400 [[../|L2]]
12401 !! result
12402 <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>
12403 </p>
12404 !! end
12405
12406
12407 !! test
12408 Parents of subpages, one level up, not named
12409 !! options
12410 subpage title=[[Subpage test/L1/L2/L3]]
12411 !! input
12412 [[../]]
12413 !! result
12414 <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>
12415 </p>
12416 !! end
12417
12418
12419
12420 !! test
12421 Parents of subpages, two levels up
12422 !! options
12423 subpage title=[[Subpage test/L1/L2/L3]]
12424 !! input
12425 [[../../|L1]]2
12426
12427 [[../../|L1]]l
12428 !! result
12429 <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
12430 </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>
12431 </p>
12432 !! end
12433
12434 !! test
12435 Parents of subpages, two levels up, without trailing slash or name.
12436 !! options
12437 subpage title=[[Subpage test/L1/L2/L3]]
12438 !! input
12439 [[../..]]
12440 !! result
12441 <p>[[../..]]
12442 </p>
12443 !! end
12444
12445 !! test
12446 Parents of subpages, two levels up, with lots of extra trailing slashes.
12447 !! options
12448 subpage title=[[Subpage test/L1/L2/L3]]
12449 !! input
12450 [[../../////]]
12451 !! result
12452 <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>
12453 </p>
12454 !! end
12455
12456 !! article
12457 Subpage test/L1/L2/L3Sibling
12458 !! text
12459 Sibling article
12460 !! endarticle
12461
12462 !! test
12463 Transclusion of a sibling page (one level up)
12464 !! options
12465 subpage title=[[Subpage test/L1/L2/L3]]
12466 !! input
12467 {{../L3Sibling}}
12468 !! result
12469 <p>Sibling article
12470 </p>
12471 !! end
12472
12473 !! test
12474 Transclusion of a child page
12475 !! options
12476 subpage title=[[Subpage test/L1/L2]]
12477 !! input
12478 {{/L3Sibling}}
12479 !! result
12480 <p>Sibling article
12481 </p>
12482 !! end
12483
12484 !! test
12485 Non-transclusion because of too many up levels
12486 !! options
12487 subpage title=[[Subpage test/L1/L2/L3]]
12488 !! input
12489 {{../../../../More than parent}}
12490 !! result
12491 <p>{{../../../../More than parent}}
12492 </p>
12493 !! end
12494
12495 !! test
12496 Definition list code coverage
12497 !! input
12498 ; title : def
12499 ; title : def
12500 ;title: def
12501 !! result
12502 <dl><dt> title &#160;</dt><dd> def
12503 </dd><dt> title&#160;</dt><dd> def
12504 </dd><dt>title</dt><dd> def
12505 </dd></dl>
12506
12507 !! end
12508
12509 !! test
12510 Don't fall for the self-closing div
12511 !! input
12512 <div>hello world</div/>
12513 !! result
12514 <div>hello world</div>
12515
12516 !! end
12517
12518 !! test
12519 MSGNW magic word
12520 !! input
12521 {{MSGNW:msg}}
12522 !! result
12523 <p>&#91;&#91;:Template:Msg&#93;&#93;
12524 </p>
12525 !! end
12526
12527 !! test
12528 RAW magic word
12529 !! input
12530 {{RAW:QUERTY}}
12531 !! result
12532 <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>
12533 </p>
12534 !! end
12535
12536 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12537 !! test
12538 Always escape literal '>' in output, not just after '<'
12539 !! input
12540 ><>
12541 !! result
12542 <p>&gt;&lt;&gt;
12543 </p>
12544 !! end
12545
12546 !! test
12547 Template caching
12548 !! input
12549 {{Test}}
12550 {{Test}}
12551 !! result
12552 <p>This is a test template
12553 This is a test template
12554 </p>
12555 !! end
12556
12557
12558 !! article
12559 MediaWiki:Fake
12560 !! text
12561 ==header==
12562 !! endarticle
12563
12564 !! test
12565 Inclusion of !userCanEdit() content
12566 !! input
12567 {{MediaWiki:Fake}}
12568 !! result
12569 <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>
12570
12571 !! end
12572
12573
12574 !! test
12575 Out-of-order TOC heading levels
12576 !! input
12577 ==2==
12578 ======6======
12579 ===3===
12580 =1=
12581 =====5=====
12582 ==2==
12583 !! result
12584 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12585 <ul>
12586 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12587 <ul>
12588 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12589 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12590 </ul>
12591 </li>
12592 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12593 <ul>
12594 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12595 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12596 </ul>
12597 </li>
12598 </ul>
12599 </div>
12600 <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>
12601 <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>
12602 <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>
12603 <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>
12604 <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>
12605 <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>
12606
12607 !! end
12608
12609
12610 !! test
12611 ISBN with a dummy number
12612 !! input
12613 ISBN ---
12614 !! result
12615 <p>ISBN ---
12616 </p>
12617 !! end
12618
12619
12620 !! test
12621 ISBN with space-delimited number
12622 !! input
12623 ISBN 92 9017 032 8
12624 !! result
12625 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12626 </p>
12627 !! end
12628
12629
12630 !! test
12631 ISBN with multiple spaces, no number
12632 !! input
12633 ISBN foo
12634 !! result
12635 <p>ISBN foo
12636 </p>
12637 !! end
12638
12639
12640 !! test
12641 ISBN length
12642 !! input
12643 ISBN 123456789
12644
12645 ISBN 1234567890
12646
12647 ISBN 12345678901
12648 !! result
12649 <p>ISBN 123456789
12650 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12651 </p><p>ISBN 12345678901
12652 </p>
12653 !! end
12654
12655
12656 !! test
12657 ISBN with trailing year (bug 8110)
12658 !! input
12659 ISBN 1-234-56789-0 - 2006
12660
12661 ISBN 1 234 56789 0 - 2006
12662 !! result
12663 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12664 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12665 </p>
12666 !! end
12667
12668
12669 !! test
12670 anchorencode
12671 !! input
12672 {{anchorencode:foo bar©#%n}}
12673 !! result
12674 <p>foo_bar.C2.A9.23.25n
12675 </p>
12676 !! end
12677
12678 !! test
12679 anchorencode trims spaces
12680 !! input
12681 {{anchorencode: __pretty__please__}}
12682 !! result
12683 <p>pretty_please
12684 </p>
12685 !! end
12686
12687 !! test
12688 anchorencode deals with links
12689 !! input
12690 {{anchorencode: [[hello|world]] [[hi]]}}
12691 !! result
12692 <p>world_hi
12693 </p>
12694 !! end
12695
12696 !! test
12697 anchorencode deals with templates
12698 !! input
12699 {{anchorencode: {{Foo}} }}
12700 !! result
12701 <p>FOO
12702 </p>
12703 !! end
12704
12705 !! test
12706 anchorencode encodes like the TOC generator: (bug 18431)
12707 !! input
12708 === _ +:.3A%3A&&amp;]] ===
12709 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12710 __NOEDITSECTION__
12711 !! result
12712 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12713 <p>.2B:.3A.253A.26.26.5D.5D
12714 </p>
12715 !! end
12716
12717 # Expected output in the following test is not necessarily expected (there
12718 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12719 # only testing for well-formedness.
12720 !! test
12721 Bug 6200: blockquotes and paragraph formatting
12722 !! input
12723 <blockquote>
12724 foo
12725 </blockquote>
12726
12727 bar
12728
12729 baz
12730 !! result
12731 <blockquote>
12732 foo
12733 </blockquote>
12734 <p>bar
12735 </p>
12736 <pre>baz
12737 </pre>
12738 !! end
12739
12740 !! test
12741 Bug 8293: Use of center tag ruins paragraph formatting
12742 !! input
12743 <center>
12744 foo
12745 </center>
12746
12747 bar
12748
12749 baz
12750 !! result
12751 <center>
12752 <p>foo
12753 </p>
12754 </center>
12755 <p>bar
12756 </p>
12757 <pre>baz
12758 </pre>
12759 !! end
12760
12761 !!test
12762 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12763 !!options
12764 php
12765 !!input
12766 <span><s>x</span></s>
12767 !!result
12768 <p><span><s>x&lt;/span&gt;</s></span>
12769 </p>
12770 !!end
12771
12772 !!test
12773 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12774 !!options
12775 parsoid
12776 !!input
12777 <span><s>x</span></s>
12778 !!result
12779 <p><span><s>x</s></span><s></s>
12780 </p>
12781 !!end
12782
12783 ###
12784 ### Language variants related tests
12785 ###
12786 !! test
12787 Self-link in language variants
12788 !! options
12789 title=[[Dunav]] language=sr
12790 !! input
12791 Both [[Dunav]] and [[Дунав]] are names for this river.
12792 !! result
12793 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12794 </p>
12795 !!end
12796
12797 !! article
12798 Дуна
12799 !! text
12800 content
12801 !! endarticle
12802
12803 !! test
12804 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12805 !! options
12806 title=[[Duna]] language=sr
12807 !! input
12808 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12809 !! result
12810 <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.
12811 </p>
12812 !! end
12813
12814 !! test
12815 Link to pages in language variants
12816 !! options
12817 language=sr
12818 !! input
12819 Main Page can be written as [[Маин Паге]]
12820 !! result
12821 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12822 </p>
12823 !!end
12824
12825
12826 !! test
12827 Multiple links to pages in language variants
12828 !! options
12829 language=sr
12830 !! input
12831 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12832 !! result
12833 <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>.
12834 </p>
12835 !!end
12836
12837
12838 !! test
12839 Simple template in language variants
12840 !! options
12841 language=sr
12842 !! input
12843 {{тест}}
12844 !! result
12845 <p>This is a test template
12846 </p>
12847 !! end
12848
12849
12850 !! test
12851 Template with explicit namespace in language variants
12852 !! options
12853 language=sr
12854 !! input
12855 {{Template:тест}}
12856 !! result
12857 <p>This is a test template
12858 </p>
12859 !! end
12860
12861
12862 !! test
12863 Basic test for template parameter in language variants
12864 !! options
12865 language=sr
12866 !! input
12867 {{парамтест|param=foo}}
12868 !! result
12869 <p>This is a test template with parameter foo
12870 </p>
12871 !! end
12872
12873
12874 !! test
12875 Simple category in language variants
12876 !! options
12877 language=sr cat
12878 !! input
12879 [[Category:МедиаWики Усер'с Гуиде]]
12880 !! result
12881 <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>
12882 !! end
12883
12884
12885 !! article
12886 Category:分类
12887 !! text
12888 blah
12889 !! endarticle
12890
12891 !! article
12892 Category:分類
12893 !! text
12894 blah
12895 !! endarticle
12896
12897 !! test
12898 Don't convert blue categorylinks to another variant (bug 33210)
12899 !! options
12900 language=zh cat
12901 !! input
12902 [[A]][[Category:分类]]
12903 !! result
12904 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12905 !! end
12906
12907
12908 !! test
12909 Stripping -{}- tags (language variants)
12910 !! options
12911 language=sr
12912 !! input
12913 Latin proverb: -{Ne nuntium necare}-
12914 !! result
12915 <p>Latin proverb: Ne nuntium necare
12916 </p>
12917 !! end
12918
12919
12920 !! test
12921 Prevent conversion with -{}- tags (language variants)
12922 !! options
12923 language=sr variant=sr-ec
12924 !! input
12925 Latinski: -{Ne nuntium necare}-
12926 !! result
12927 <p>Латински: Ne nuntium necare
12928 </p>
12929 !! end
12930
12931
12932 !! test
12933 Prevent conversion of text with -{}- tags (language variants)
12934 !! options
12935 language=sr variant=sr-ec
12936 !! input
12937 Latinski: -{Ne nuntium necare}-
12938 !! result
12939 <p>Латински: Ne nuntium necare
12940 </p>
12941 !! end
12942
12943
12944 !! test
12945 Prevent conversion of links with -{}- tags (language variants)
12946 !! options
12947 language=sr variant=sr-ec
12948 !! input
12949 -{[[Main Page]]}-
12950 !! result
12951 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12952 </p>
12953 !! end
12954
12955
12956 !! test
12957 -{}- tags within headlines (within html for parserConvert())
12958 !! options
12959 language=sr variant=sr-ec
12960 !! input
12961 == -{Naslov}- ==
12962 !! result
12963 <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>
12964
12965 !! end
12966
12967
12968 !! test
12969 Explicit definition of language variant alternatives
12970 !! options
12971 language=zh variant=zh-tw
12972 !! input
12973 -{zh:China;zh-tw:Taiwan}-, not China
12974 !! result
12975 <p>Taiwan, not China
12976 </p>
12977 !! end
12978
12979
12980 !! test
12981 Conversion around HTML tags
12982 !! options
12983 language=sr variant=sr-ec
12984 !! input
12985 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12986 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12987 !! result
12988 <p>
12989 <span title="ЛаCтин">ски</span>
12990 </p>
12991 !! end
12992
12993
12994 !! test
12995 Explicit session-wise language variant mapping (A flag and - flag)
12996 !! options
12997 language=zh variant=zh-tw
12998 !! input
12999 Taiwan is not China.
13000 But -{A|zh:China;zh-tw:Taiwan}- is China,
13001 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13002 and -{China}- is China.
13003 !! result
13004 <p>Taiwan is not China.
13005 But Taiwan is Taiwan,
13006 (This should be stripped!)
13007 and China is China.
13008 </p>
13009 !! end
13010
13011 !! test
13012 Explicit session-wise language variant mapping (H flag for hide)
13013 !! options
13014 language=zh variant=zh-tw
13015 !! input
13016 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13017 Taiwan is China.
13018 !! result
13019 <p>(This should be stripped!)
13020 Taiwan is Taiwan.
13021 </p>
13022 !! end
13023
13024 !! test
13025 Adding explicit conversion rule for title (T flag)
13026 !! options
13027 language=zh variant=zh-tw showtitle
13028 !! input
13029 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13030 !! result
13031 Taiwan
13032 <p>Should be stripped!
13033 </p>
13034 !! end
13035
13036 !! test
13037 Testing that changing the language variant here in the tests actually works
13038 !! options
13039 language=zh variant=zh showtitle
13040 !! input
13041 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13042 !! result
13043 China
13044 <p>Should be stripped!
13045 </p>
13046 !! end
13047
13048 !! test
13049 Recursive conversion of alt and title attrs shouldn't clear converter state
13050 !! options
13051 language=zh variant=zh-cn showtitle
13052 !! input
13053 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13054 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13055 !! result
13056 China
13057 <p>
13058 Should be stripped<span title="Exclamation">!</span>
13059 </p>
13060 !! end
13061
13062 !! test
13063 Bug 24072: more test on conversion rule for title
13064 !! options
13065 language=zh variant=zh-tw showtitle
13066 !! input
13067 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13068 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13069 !! result
13070 Taiwan
13071 <p>This should be stripped!
13072 This won't take interferes with the title rule.
13073 </p>
13074 !! end
13075
13076 !! test
13077 Partly disable title conversion if variant == main language code
13078 !! options
13079 language=zh variant=zh title=[[ZH]] showtitle
13080 !! input
13081 -{T|zh-cn:CN;zh-tw:TW}-
13082 !! result
13083 ZH
13084 <p>
13085 </p>
13086 !! end
13087
13088 !! test
13089 Partly disable title conversion if variant == main language code, more
13090 !! options
13091 language=zh variant=zh title=[[ZH]] showtitle
13092 !! input
13093 -{T|TW}-
13094 !! result
13095 ZH
13096 <p>
13097 </p>
13098 !! end
13099
13100 !! test
13101 Raw output of variant escape tags (R flag)
13102 !! options
13103 language=zh variant=zh-tw
13104 !! input
13105 Raw: -{R|zh:China;zh-tw:Taiwan}-
13106 !! result
13107 <p>Raw: zh:China;zh-tw:Taiwan
13108 </p>
13109 !! end
13110
13111 !! test
13112 Nested using of manual convert syntax
13113 !! options
13114 language=zh variant=zh-hk
13115 !! input
13116 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13117 !! result
13118 <p>Nested: Hello Hong Kong!
13119 </p>
13120 !! end
13121
13122 !! test
13123 Proper conversion of text in external links
13124 !! options
13125 language=sr variant=sr-ec
13126 !! input
13127 http://www.google.com
13128 gopher://www.google.com
13129 [http://www.google.com http://www.google.com]
13130 [gopher://www.google.com gopher://www.google.com]
13131 [https://www.google.com irc://www.google.com]
13132 [ftp://www.google.com www.google.com/ftp://dir]
13133 [//www.google.com www.google.com]
13134 !! result
13135 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13136 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13137 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13138 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13139 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13140 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13141 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13142 </p>
13143 !! end
13144
13145 !! test
13146 Do not convert roman numbers to language variants
13147 !! options
13148 language=sr variant=sr-ec
13149 !! input
13150 Fridrih IV je car.
13151 !! result
13152 <p>Фридрих IV је цар.
13153 </p>
13154 !! end
13155
13156 !! test
13157 Unclosed language converter markup "-{"
13158 !! options
13159 language=sr
13160 !! input
13161 -{T|hello
13162 !! result
13163 <p>-{T|hello
13164 </p>
13165 !! end
13166
13167 !! test
13168 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13169 !! options
13170 language=sr
13171 !! input
13172 -{R|=&gt;}-
13173 !! result
13174 <p>=&gt;
13175 </p>
13176 !!end
13177
13178 !!article
13179 Template:Bullet
13180 !!text
13181 * Bar
13182 !!endarticle
13183
13184 !! test
13185 Bug 529: Uncovered bullet
13186 !! input
13187 * Foo {{bullet}}
13188 !! result
13189 <ul><li> Foo
13190 </li><li> Bar
13191 </li></ul>
13192
13193 !! end
13194
13195 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13196 # Templates in Wikipedia rely on this behavior, as tidy has always been
13197 # enabled there. These tests are normally run *without* tidy, so specify the
13198 # full output here.
13199 # To test realistic parsing behavior, apply a tidy-like transformation to both
13200 # the expected output and your parser's output.
13201 !! test
13202 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13203 !! input
13204 ******* Foo {{bullet}}
13205 !! result
13206 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13207 </li></ul>
13208 </li></ul>
13209 </li></ul>
13210 </li></ul>
13211 </li></ul>
13212 </li></ul>
13213 </li><li> Bar
13214 </li></ul>
13215
13216 !! end
13217
13218 !! test
13219 Bug 529: Uncovered table already at line-start
13220 !! input
13221 x
13222
13223 {{table}}
13224 y
13225 !! result
13226 <p>x
13227 </p>
13228 <table>
13229 <tr>
13230 <td> 1 </td>
13231 <td> 2
13232 </td></tr>
13233 <tr>
13234 <td> 3 </td>
13235 <td> 4
13236 </td></tr></table>
13237 <p>y
13238 </p>
13239 !! end
13240
13241 !! test
13242 Bug 529: Uncovered bullet in parser function result
13243 !! input
13244 * Foo {{lc:{{bullet}} }}
13245 !! result
13246 <ul><li> Foo
13247 </li><li> bar
13248 </li></ul>
13249
13250 !! end
13251
13252 !! test
13253 Bug 5678: Double-parsed template argument
13254 !! input
13255 {{lc:{{{1}}}|hello}}
13256 !! result
13257 <p>{{{1}}}
13258 </p>
13259 !! end
13260
13261 !! test
13262 Bug 5678: Double-parsed template invocation
13263 !! input
13264 {{lc:{{paramtest {{!}} param = hello }} }}
13265 !! result
13266 <p>{{paramtest | param = hello }}
13267 </p>
13268 !! end
13269
13270 !! test
13271 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13272 !! options
13273 language=cs
13274 title=[[Main Page]]
13275 !! input
13276 {{PRVNÍVELKÉ:ěščř}}
13277 {{prvnívelké:ěščř}}
13278 {{PRVNÍMALÉ:ěščř}}
13279 {{prvnímalé:ěščř}}
13280 {{MALÁ:ěščř}}
13281 {{malá:ěščř}}
13282 {{VELKÁ:ěščř}}
13283 {{velká:ěščř}}
13284 !! result
13285 <p>Ěščř
13286 Ěščř
13287 ěščř
13288 ěščř
13289 ěščř
13290 ěščř
13291 ĚŠČŘ
13292 ĚŠČŘ
13293 </p>
13294 !! end
13295
13296 !! test
13297 Morwen/13: Unclosed link followed by heading
13298 !! input
13299 [[link
13300 ==heading==
13301 !! result
13302 <p>[[link
13303 </p>
13304 <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>
13305
13306 !! end
13307
13308 !! test
13309 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13310 !! input
13311 {{foo|
13312 =heading=
13313 !! result
13314 <p>{{foo|
13315 </p>
13316 <h1><span class="mw-headline" id="heading">heading</span></h1>
13317
13318 !! end
13319
13320 !! test
13321 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13322 !! input
13323 {{foo|
13324 ==heading==
13325 !! result
13326 <p>{{foo|
13327 </p>
13328 <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>
13329
13330 !! end
13331
13332 !! test
13333 Tildes in comments
13334 !! options
13335 pst
13336 !! input
13337 <!-- ~~~~ -->
13338 !! result
13339 <!-- ~~~~ -->
13340 !! end
13341
13342 !! test
13343 Paragraphs inside divs (no extra line breaks)
13344 !! input
13345 <div>Line one
13346
13347 Line two</div>
13348 !! result
13349 <div>Line one
13350 Line two</div>
13351
13352 !! end
13353
13354 !! test
13355 Paragraphs inside divs (extra line break on open)
13356 !! input
13357 <div>
13358 Line one
13359
13360 Line two</div>
13361 !! result
13362 <div>
13363 <p>Line one
13364 </p>
13365 Line two</div>
13366
13367 !! end
13368
13369 !! test
13370 Paragraphs inside divs (extra line break on close)
13371 !! input
13372 <div>Line one
13373
13374 Line two
13375 </div>
13376 !! result
13377 <div>Line one
13378 <p>Line two
13379 </p>
13380 </div>
13381
13382 !! end
13383
13384 !! test
13385 Paragraphs inside divs (extra line break on open and close)
13386 !! input
13387 <div>
13388 Line one
13389
13390 Line two
13391 </div>
13392 !! result
13393 <div>
13394 <p>Line one
13395 </p><p>Line two
13396 </p>
13397 </div>
13398
13399 !! end
13400
13401 !! test
13402 Nesting tags, paragraphs on lines which begin with <div>
13403 !! options
13404 disabled
13405 !! input
13406 <div></div><strong>A
13407 B</strong>
13408 !! result
13409 <div></div>
13410 <p><strong>A
13411 B</strong>
13412 </p>
13413 !! end
13414
13415 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13416 !! test
13417 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13418 !! options
13419 disabled
13420 !! input
13421 <blockquote>Line one
13422
13423 Line two</blockquote>
13424 !! result
13425 <blockquote>Line one
13426 Line two</blockquote>
13427
13428 !! end
13429
13430 !! test
13431 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13432 !! options
13433 disabled
13434 !! input
13435 <blockquote>
13436 Line one
13437
13438 Line two</blockquote>
13439 !! result
13440 <blockquote>
13441 <p>Line one
13442 </p>
13443 Line two</blockquote>
13444
13445 !! end
13446
13447 !! test
13448 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13449 !! options
13450 disabled
13451 !! input
13452 <blockquote>Line one
13453
13454 Line two
13455 </blockquote>
13456 !! result
13457 <blockquote>Line one
13458 <p>Line two
13459 </p>
13460 </blockquote>
13461
13462 !! end
13463
13464 !! test
13465 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13466 !! options
13467 disabled
13468 !! input
13469 <blockquote>
13470 Line one
13471
13472 Line two
13473 </blockquote>
13474 !! result
13475 <blockquote>
13476 <p>Line one
13477 </p><p>Line two
13478 </p>
13479 </blockquote>
13480
13481 !! end
13482
13483 !! test
13484 Paragraphs inside blockquotes/divs (no extra line breaks)
13485 !! input
13486 <blockquote><div>Line one
13487
13488 Line two</div></blockquote>
13489 !! result
13490 <blockquote><div>Line one
13491 Line two</div></blockquote>
13492
13493 !! end
13494
13495 !! test
13496 Paragraphs inside blockquotes/divs (extra line break on open)
13497 !! input
13498 <blockquote><div>
13499 Line one
13500
13501 Line two</div></blockquote>
13502 !! result
13503 <blockquote><div>
13504 <p>Line one
13505 </p>
13506 Line two</div></blockquote>
13507
13508 !! end
13509
13510 !! test
13511 Paragraphs inside blockquotes/divs (extra line break on close)
13512 !! input
13513 <blockquote><div>Line one
13514
13515 Line two
13516 </div></blockquote>
13517 !! result
13518 <blockquote><div>Line one
13519 <p>Line two
13520 </p>
13521 </div></blockquote>
13522
13523 !! end
13524
13525 !! test
13526 Paragraphs inside blockquotes/divs (extra line break on open and close)
13527 !! input
13528 <blockquote><div>
13529 Line one
13530
13531 Line two
13532 </div></blockquote>
13533 !! result
13534 <blockquote><div>
13535 <p>Line one
13536 </p><p>Line two
13537 </p>
13538 </div></blockquote>
13539
13540 !! end
13541
13542 !! test
13543 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13544 !! options
13545 wgLinkHolderBatchSize=0
13546 !! input
13547 [[meatball:1]]
13548 [[meatball:2]]
13549 [[meatball:3]]
13550 !! result
13551 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13552 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13553 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13554 </p>
13555 !! end
13556
13557 !! test
13558 Free external link invading image caption
13559 !! input
13560 [[Image:Foobar.jpg|thumb|http://x|hello]]
13561 !! result
13562 <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>
13563
13564 !! end
13565
13566 !! test
13567 Bug 15196: localised external link numbers
13568 !! options
13569 language=fa
13570 !! input
13571 [http://en.wikipedia.org/]
13572 !! result
13573 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13574 </p>
13575 !! end
13576
13577 !! test
13578 Multibyte character in padleft
13579 !! input
13580 {{padleft:-Hello|7|Æ}}
13581 !! result
13582 <p>Æ-Hello
13583 </p>
13584 !! end
13585
13586 !! test
13587 Multibyte character in padright
13588 !! input
13589 {{padright:Hello-|7|Æ}}
13590 !! result
13591 <p>Hello-Æ
13592 </p>
13593 !! end
13594
13595 !!test
13596 formatdate parser function
13597 !!input
13598 {{#formatdate:2009-03-24}}
13599 !! result
13600 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13601 </p>
13602 !! end
13603
13604 !!test
13605 formatdate parser function, with default format
13606 !!input
13607 {{#formatdate:2009-03-24|mdy}}
13608 !! result
13609 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13610 </p>
13611 !! end
13612
13613 !! test
13614 Spacing of numbers in formatted dates
13615 !! input
13616 {{#formatdate:January 15}}
13617 !! result
13618 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13619 </p>
13620 !! end
13621
13622 !! test
13623 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
13624 !! options
13625 language=nl title=[[MediaWiki:Common.css]]
13626 !! input
13627 {{#formatdate:2009-03-24|dmy}}
13628 !! result
13629 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13630 </p>
13631 !! end
13632
13633 #
13634 #
13635 #
13636
13637 #
13638 # Edit comments
13639 #
13640
13641 !! test
13642 Edit comment with link
13643 !! options
13644 comment
13645 !! input
13646 I like the [[Main Page]] a lot
13647 !! result
13648 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13649 !!end
13650
13651 !! test
13652 Edit comment with link and link text
13653 !! options
13654 comment
13655 !! input
13656 I like the [[Main Page|best pages]] a lot
13657 !! result
13658 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13659 !!end
13660
13661 !! test
13662 Edit comment with link and link text with suffix
13663 !! options
13664 comment
13665 !! input
13666 I like the [[Main Page|best page]]s a lot
13667 !! result
13668 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13669 !!end
13670
13671 !! test
13672 Edit comment with section link (non-local, eg in history list)
13673 !! options
13674 comment title=[[Main Page]]
13675 !! input
13676 /* External links */ removed bogus entries
13677 !! result
13678 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13679 !!end
13680
13681 !! test
13682 Edit comment with section link and text before it (non-local, eg in history list)
13683 !! options
13684 comment title=[[Main Page]]
13685 !! input
13686 pre-comment text /* External links */ removed bogus entries
13687 !! result
13688 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>
13689 !!end
13690
13691 !! test
13692 Edit comment with section link (local, eg in diff view)
13693 !! options
13694 comment local title=[[Main Page]]
13695 !! input
13696 /* External links */ removed bogus entries
13697 !! result
13698 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13699 !!end
13700
13701 !! test
13702 Edit comment with subpage link (bug 14080)
13703 !! options
13704 comment
13705 subpage
13706 title=[[Subpage test]]
13707 !! input
13708 Poked at a [[/subpage]] here...
13709 !! result
13710 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13711 !!end
13712
13713 !! test
13714 Edit comment with subpage link and link text (bug 14080)
13715 !! options
13716 comment
13717 subpage
13718 title=[[Subpage test]]
13719 !! input
13720 Poked at a [[/subpage|neat little page]] here...
13721 !! result
13722 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13723 !!end
13724
13725 !! test
13726 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13727 !! options
13728 comment
13729 title=[[Subpage test]]
13730 !! input
13731 Poked at a [[/subpage]] here...
13732 !! result
13733 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...
13734 !!end
13735
13736 !! test
13737 Edit comment with bare anchor link (local, as on diff)
13738 !! options
13739 comment
13740 local
13741 title=[[Main Page]]
13742 !!input
13743 [[#section]]
13744 !! result
13745 <a href="#section">#section</a>
13746 !! end
13747
13748 !! test
13749 Edit comment with bare anchor link (non-local, as on history)
13750 !! options
13751 comment
13752 title=[[Main Page]]
13753 !!input
13754 [[#section]]
13755 !! result
13756 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13757 !! end
13758
13759 !! test
13760 Anchor starting with underscore
13761 !!input
13762 [[#_ref|One]]
13763 !! result
13764 <p><a href="#_ref">One</a>
13765 </p>
13766 !! end
13767
13768 !! test
13769 Id starting with underscore
13770 !!input
13771 <div id="_ref"></div>
13772 !! result
13773 <div id="_ref"></div>
13774
13775 !! end
13776
13777 !! test
13778 Space normalisation on autocomment (bug 22784)
13779 !! options
13780 comment
13781 title=[[Main Page]]
13782 !!input
13783 /* __hello__world__ */
13784 !! result
13785 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13786 !! end
13787
13788 !! test
13789 percent-encoding and + signs in comments (Bug 26410)
13790 !! options
13791 comment
13792 !!input
13793 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13794 !! result
13795 <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>
13796 !! end
13797
13798 !! test
13799 Bad images - basic functionality
13800 !! options
13801 disabled
13802 !! input
13803 [[File:Bad.jpg]]
13804 !! result
13805 !! end
13806
13807 !! test
13808 Bad images - bug 16039: text after bad image disappears
13809 !! options
13810 disabled
13811 !! input
13812 Foo bar
13813 [[File:Bad.jpg]]
13814 Bar foo
13815 !! result
13816 <p>Foo bar
13817 </p><p>Bar foo
13818 </p>
13819 !! end
13820
13821 !! test
13822 Verify that displaytitle works (bug #22501) no displaytitle
13823 !! options
13824 showtitle
13825 !! config
13826 wgAllowDisplayTitle=true
13827 wgRestrictDisplayTitle=false
13828 !! input
13829 this is not the the title
13830 !! result
13831 Parser test
13832 <p>this is not the the title
13833 </p>
13834 !! end
13835
13836 !! test
13837 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13838 !! options
13839 showtitle
13840 title=[[Screen]]
13841 !! config
13842 wgAllowDisplayTitle=true
13843 wgRestrictDisplayTitle=false
13844 !! input
13845 this is not the the title
13846 {{DISPLAYTITLE:whatever}}
13847 !! result
13848 whatever
13849 <p>this is not the the title
13850 </p>
13851 !! end
13852
13853 !! test
13854 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13855 !! options
13856 showtitle
13857 title=[[Screen]]
13858 !! config
13859 wgAllowDisplayTitle=true
13860 wgRestrictDisplayTitle=true
13861 !! input
13862 this is not the the title
13863 {{DISPLAYTITLE:whatever}}
13864 !! result
13865 Screen
13866 <p>this is not the the title
13867 </p>
13868 !! end
13869
13870 !! test
13871 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13872 !! options
13873 showtitle
13874 title=[[Screen]]
13875 !! config
13876 wgAllowDisplayTitle=true
13877 wgRestrictDisplayTitle=true
13878 !! input
13879 this is not the the title
13880 {{DISPLAYTITLE:screen}}
13881 !! result
13882 screen
13883 <p>this is not the the title
13884 </p>
13885 !! end
13886
13887 !! test
13888 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13889 !! options
13890 showtitle
13891 title=[[Screen]]
13892 !! config
13893 wgAllowDisplayTitle=false
13894 !! input
13895 this is not the the title
13896 {{DISPLAYTITLE:screen}}
13897 !! result
13898 Screen
13899 <p>this is not the the title
13900 <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>
13901 </p>
13902 !! end
13903
13904 !! test
13905 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13906 !! options
13907 showtitle
13908 title=[[Screen]]
13909 !! config
13910 wgAllowDisplayTitle=false
13911 !! input
13912 this is not the the title
13913 !! result
13914 Screen
13915 <p>this is not the the title
13916 </p>
13917 !! end
13918
13919 !! test
13920 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13921 !! options
13922 showtitle
13923 title=[[Screen]]
13924 !! config
13925 wgAllowDisplayTitle=true
13926 wgRestrictDisplayTitle=true
13927 !! input
13928 this is not the the title
13929 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13930 !! result
13931 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13932 <p>this is not the the title
13933 </p>
13934 !! end
13935
13936 !! test
13937 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13938 !! options
13939 showtitle
13940 title=[[Screen]]
13941 !! config
13942 wgAllowDisplayTitle=true
13943 wgRestrictDisplayTitle=true
13944 !! input
13945 this is not the the title
13946 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13947 !! result
13948 <span style="color: red;">s</span>creen
13949 <p>this is not the the title
13950 </p>
13951 !! end
13952
13953 !! test
13954 preload: check <noinclude> and <includeonly>
13955 !! options
13956 preload
13957 !! input
13958 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13959 !! result
13960 Hello kind world.
13961 !! end
13962
13963 !! test
13964 preload: check <onlyinclude>
13965 !! options
13966 preload
13967 !! input
13968 Goodbye <onlyinclude>Hello world</onlyinclude>
13969 !! result
13970 Hello world
13971 !! end
13972
13973 !! test
13974 preload: can pass tags through if we want to
13975 !! options
13976 preload
13977 !! input
13978 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13979 !! result
13980 <includeonly>Hello world</includeonly>
13981 !! end
13982
13983 !! test
13984 preload: check that it doesn't try to do tricks
13985 !! options
13986 preload
13987 !! input
13988 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13989 !! result
13990 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13991 !! end
13992
13993 !! test
13994 Play a bit with r67090 and bug 3158
13995 !! options
13996 disabled
13997 !! input
13998 <div style="width:50% !important">&nbsp;</div>
13999 <div style="width:50%&nbsp;!important">&nbsp;</div>
14000 <div style="width:50%&#160;!important">&nbsp;</div>
14001 <div style="border : solid;">&nbsp;</div>
14002 !! result
14003 <div style="width:50% !important">&nbsp;</div>
14004 <div style="width:50% !important">&nbsp;</div>
14005 <div style="width:50% !important">&nbsp;</div>
14006 <div style="border&#160;: solid;">&nbsp;</div>
14007
14008 !! end
14009
14010 !! test
14011 HTML5 data attributes
14012 !! input
14013 <span data-foo="bar">Baz</span>
14014 <p data-abc-def_hij="">Quuz</p>
14015 !! result
14016 <p><span data-foo="bar">Baz</span>
14017 </p>
14018 <p data-abc-def_hij="">Quuz</p>
14019
14020 !! end
14021
14022 !! test
14023 percent-encoding and + signs in internal links (Bug 26410)
14024 !! input
14025 [[User:+%]] [[Page+title%]]
14026 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14027 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14028 [[%33%45]] [[%33%45+]]
14029 !! result
14030 <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>
14031 <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>
14032 <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>
14033 <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>
14034 </p>
14035 !! end
14036
14037 !! test
14038 Special characters in embedded file links (bug 27679)
14039 !! input
14040 [[File:Contains & ampersand.jpg]]
14041 [[File:Does not exist.jpg|Title with & ampersand]]
14042 !! result
14043 <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>
14044 <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>
14045 </p>
14046 !! end
14047
14048
14049 !! test
14050 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14051 !! input
14052 Text&apos;s been normalized?
14053 !! result
14054 <p>Text&#39;s been normalized?
14055 </p>
14056 !! end
14057
14058 !! test
14059 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14060 !! input
14061 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14062 !! result
14063 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14064 </p>
14065 !! end
14066
14067 !! test
14068 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14069 !! input
14070 [http://www.example.org/ ideograms]
14071 !! result
14072 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14073 </p>
14074 !! end
14075
14076 !! test
14077 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14078 !! input
14079 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14080 !! result
14081 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14082 </p>
14083 !! end
14084
14085 !! article
14086 Mediawiki:loop1
14087 !! text
14088 {{Identical|A}}
14089 !! endarticle
14090
14091 !! article
14092 Mediawiki:loop2
14093 !! text
14094 {{Identical|B}}
14095 !! endarticle
14096
14097 !! article
14098 Template:Identical
14099 !! text
14100 {{int:loop1}}
14101 {{int:loop2}}
14102 !! endarticle
14103
14104 !! test
14105 Bug 31098 Template which includes system messages which includes the template
14106 !! input
14107 {{Identical}}
14108 !! result
14109 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14110 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14111 </p>
14112 !! end
14113
14114 !! test
14115 Bug31490 Turkish: ucfirst 'blah'
14116 !! options
14117 language=tr
14118 !! input
14119 {{ucfirst:blah}}
14120 !! result
14121 <p>Blah
14122 </p>
14123 !! end
14124
14125 !! test
14126 Bug31490 Turkish: ucfirst 'ix'
14127 !! options
14128 language=tr
14129 !! input
14130 {{ucfirst:ix}}
14131 !! result
14132 <p>İx
14133 </p>
14134 !! end
14135
14136 !! test
14137 Bug31490 Turkish: lcfirst 'BLAH'
14138 !! options
14139 language=tr
14140 !! input
14141 {{lcfirst:BLAH}}
14142 !! result
14143 <p>bLAH
14144 </p>
14145 !! end
14146
14147 !! test
14148 Bug31490 Turkish: ucfırst (with a dotless i)
14149 !! options
14150 language=tr
14151 !! input
14152 {{ucfırst:blah}}
14153 !! result
14154 <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>
14155 </p>
14156 !! end
14157
14158 !! test
14159 Bug31490 ucfırst (with a dotless i) with English language
14160 !! options
14161 language=en
14162 !! input
14163 {{ucfırst:blah}}
14164 !! result
14165 <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>
14166 </p>
14167 !! end
14168
14169 !! test
14170 Bug 26375: TOC with italics
14171 !! options
14172 title=[[Main Page]]
14173 !! input
14174 __TOC__
14175 == ''Lost'' episodes ==
14176 !! result
14177 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14178 <ul>
14179 <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>
14180 </ul>
14181 </div>
14182 <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>
14183
14184 !! end
14185
14186 !! test
14187 Bug 26375: TOC with bold
14188 !! options
14189 title=[[Main Page]]
14190 !! input
14191 __TOC__
14192 == '''should be bold''' then normal text ==
14193 !! result
14194 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14195 <ul>
14196 <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>
14197 </ul>
14198 </div>
14199 <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>
14200
14201 !! end
14202
14203 !! test
14204 Bug 33845: Headings become cursive in TOC when they contain an image
14205 !! options
14206 title=[[Main Page]]
14207 !! input
14208 __TOC__
14209 == Image [[Image:foobar.jpg]] ==
14210 !! result
14211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14212 <ul>
14213 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14214 </ul>
14215 </div>
14216 <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>
14217
14218 !! end
14219
14220 !! test
14221 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14222 !! options
14223 title=[[Main Page]]
14224 !! input
14225 __TOC__
14226 == <blockquote>Quote</blockquote> ==
14227 !! result
14228 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14229 <ul>
14230 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14231 </ul>
14232 </div>
14233 <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>
14234
14235 !! end
14236
14237 !! test
14238 Unclosed tags in TOC
14239 !! options
14240 title=[[Main Page]]
14241 !! input
14242 __TOC__
14243 == Proof: 2 < 3 ==
14244 <small>Hanc marginis exiguitas non caperet.</small>
14245 QED
14246 !! result
14247 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14248 <ul>
14249 <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>
14250 </ul>
14251 </div>
14252 <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>
14253 <p><small>Hanc marginis exiguitas non caperet.</small>
14254 QED
14255 </p>
14256 !! end
14257
14258 !! test
14259 Multiple tags in TOC
14260 !! input
14261 __TOC__
14262 == <i>Foo</i> <b>Bar</b> ==
14263
14264 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14265 !! result
14266 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14267 <ul>
14268 <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>
14269 <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>
14270 </ul>
14271 </div>
14272 <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>
14273 <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>
14274
14275 !! end
14276
14277 !! test
14278 Tags with parameters in TOC
14279 !! input
14280 __TOC__
14281 == <sup class="in-h2">Hello</sup> ==
14282
14283 == <sup class="a > b">Evilbye</sup> ==
14284 !! result
14285 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14286 <ul>
14287 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14288 <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>
14289 </ul>
14290 </div>
14291 <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>
14292 <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>
14293
14294 !! end
14295
14296 !! test
14297 span tags with directionality in TOC
14298 !! input
14299 __TOC__
14300 == <span dir="ltr">C++</span> ==
14301
14302 == <span dir="rtl">זבנג!</span> ==
14303
14304 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14305
14306 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14307
14308 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14309 !! result
14310 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14311 <ul>
14312 <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>
14313 <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>
14314 <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>
14315 <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>
14316 <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>
14317 </ul>
14318 </div>
14319 <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>
14320 <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>
14321 <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>
14322 <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>
14323 <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>
14324
14325 !! end
14326
14327 !! article
14328 MediaWiki:Bug32057
14329 !! text
14330 == {{int:headline_sample}} ==
14331 !! endarticle
14332
14333 !! test
14334 Bug 32057: Title needed when expanding <h> nodes.
14335 !! options
14336 title=[[Main Page]]
14337 !! input
14338 {{int:Bug32057}}
14339 !! result
14340 <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>
14341
14342 !! end
14343
14344 !! test
14345 Strip marker in urlencode
14346 !! input
14347 {{urlencode:x<nowiki/>y}}
14348 {{urlencode:x<nowiki/>y|wiki}}
14349 {{urlencode:x<nowiki/>y|path}}
14350 !! result
14351 <p>xy
14352 xy
14353 xy
14354 </p>
14355 !! end
14356
14357 !! test
14358 Strip marker in lc
14359 !! input
14360 {{lc:x<nowiki/>y}}
14361 !! result
14362 <p>xy
14363 </p>
14364 !! end
14365
14366 !! test
14367 Strip marker in uc
14368 !! input
14369 {{uc:x<nowiki/>y}}
14370 !! result
14371 <p>XY
14372 </p>
14373 !! end
14374
14375 !! test
14376 Strip marker in formatNum
14377 !! input
14378 {{formatnum:1<nowiki/>2}}
14379 {{formatnum:1<nowiki/>2|R}}
14380 !! result
14381 <p>12
14382 12
14383 </p>
14384 !! end
14385
14386 !! test
14387 Check noCommafy in formatNum
14388 !! options
14389 language=be-tarask
14390 !! input
14391 {{formatnum:123456.78}}
14392 {{formatnum:123456.78|NOSEP}}
14393 !! result
14394 <p>123 456,78
14395 123456.78
14396 </p>
14397 !! end
14398
14399 !! test
14400 Strip marker in grammar
14401 !! options
14402 language=fi
14403 !! input
14404 {{grammar:elative|foo<nowiki/>bar}}
14405 !! result
14406 <p>foobarista
14407 </p>
14408 !! end
14409
14410 !! test
14411 Strip marker in padleft
14412 !! input
14413 {{padleft:|2|x<nowiki/>y}}
14414 !! result
14415 <p>xy
14416 </p>
14417 !! end
14418
14419 !! test
14420 Strip marker in padright
14421 !! input
14422 {{padright:|2|x<nowiki/>y}}
14423 !! result
14424 <p>xy
14425 </p>
14426 !! end
14427
14428 !! test
14429 Strip marker in anchorencode
14430 !! input
14431 {{anchorencode:x<nowiki/>y}}
14432 !! result
14433 <p>xy
14434 </p>
14435 !! end
14436
14437 !! test
14438 nowiki inside link inside heading (bug 18295)
14439 !! input
14440 ==[[foo|x<nowiki>y</nowiki>z]]==
14441 !! result
14442 <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>
14443
14444 !! end
14445
14446 !! test
14447 new support for bdi element (bug 31817)
14448 !! input
14449 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14450 !! result
14451 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14452
14453 !!end
14454
14455 !! test
14456 Ignore pipe between table row attributes
14457 !! input
14458 {|
14459 | quux
14460 |- id=foo | style='color: red'
14461 | bar
14462 |}
14463 !! result
14464 <table>
14465 <tr>
14466 <td> quux
14467 </td></tr>
14468 <tr id="foo" style="color: red">
14469 <td> bar
14470 </td></tr></table>
14471
14472 !! end
14473
14474 !!test
14475 Gallery override link with WikiLink (bug 34852)
14476 !! input
14477 <gallery>
14478 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14479 </gallery>
14480 !! result
14481 <ul class="gallery">
14482 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14483 <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>
14484 <div class="gallerytext">
14485 <p>caption
14486 </p>
14487 </div>
14488 </div></li>
14489 </ul>
14490
14491 !! end
14492
14493 !!test
14494 Gallery override link with absolute external link (bug 34852)
14495 !! input
14496 <gallery>
14497 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14498 </gallery>
14499 !! result
14500 <ul class="gallery">
14501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14502 <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>
14503 <div class="gallerytext">
14504 <p>caption
14505 </p>
14506 </div>
14507 </div></li>
14508 </ul>
14509
14510 !! end
14511
14512 !!test
14513 Gallery override link with malicious javascript (bug 34852)
14514 !! input
14515 <gallery>
14516 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14517 </gallery>
14518 !! result
14519 <ul class="gallery">
14520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14521 <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>
14522 <div class="gallerytext">
14523 <p>caption
14524 </p>
14525 </div>
14526 </div></li>
14527 </ul>
14528
14529 !! end
14530
14531 !!test
14532 Gallery with invalid title as link (bug 43964)
14533 !! input
14534 <gallery>
14535 File:foobar.jpg|link=<
14536 </gallery>
14537 !! result
14538 <ul class="gallery">
14539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14540 <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>
14541 <div class="gallerytext">
14542 </div>
14543 </div></li>
14544 </ul>
14545
14546 !! end
14547
14548 !!test
14549 Language parser function
14550 !! input
14551 {{#language:ar}}
14552 !! result
14553 <p>العربية
14554 </p>
14555 !! end
14556
14557 !!test
14558 Padleft and padright as substr
14559 !! input
14560 {{padleft:|3|abcde}}
14561 {{padright:|3|abcde}}
14562 !! result
14563 <p>abc
14564 abc
14565 </p>
14566 !! end
14567
14568 !!test
14569 Special parser function
14570 !! input
14571 {{#special:RandomPage}}
14572 {{#special:BaDtItLe}}
14573 {{#special:Foobar}}
14574 !! result
14575 <p>Special:Random
14576 Special:Badtitle
14577 Special:Foobar
14578 </p>
14579 !! end
14580
14581 !!test
14582 Bug 34939 - Case insensitive link parsing ([HttP://])
14583 !! input
14584 [HttP://MediaWiki.Org/]
14585 !! result
14586 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14587 </p>
14588 !! end
14589
14590 !!test
14591 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14592 !! input
14593 [HttP://MediaWiki.Org/ MediaWiki]
14594 !! result
14595 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14596 </p>
14597 !! end
14598
14599 !!test
14600 Bug 34939 - Case insensitive link parsing (HttP://)
14601 !! input
14602 HttP://MediaWiki.Org/
14603 !! result
14604 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14605 </p>
14606 !! end
14607
14608
14609 ###
14610 ### Parsoids-specific tests
14611 ### Parsoid-PHP parser incompatibilities
14612 ###
14613 !!test
14614 1. SOL-sensitive wikitext tokens as template-args
14615 !!options
14616 parsoid=wt2html,wt2wt
14617 !!input
14618 {{echo|*a}}
14619 {{echo|#a}}
14620 {{echo|:a}}
14621 !!result
14622 <span about="#mwt1" typeof="mw:Transclusion">
14623 </span><ul about="#mwt1"><li>a</li></ul>
14624 <span about="#mwt2" typeof="mw:Transclusion">
14625 </span><ol about="#mwt2"><li>a</li></ol>
14626 <span about="#mwt3" typeof="mw:Transclusion">
14627 </span><dl about="#mwt3"><dd>a</dd></dl>
14628 !!end
14629
14630 #### ----------------------------------------------------------------
14631 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14632 #### tags. Parsoid's output for these tags differs from that of the
14633 #### PHP parser.
14634 #### ----------------------------------------------------------------
14635
14636 !!test
14637 Ref: 1. ref-location should be replaced with an index span
14638 !!options
14639 parsoid
14640 !!input
14641 A <ref>foo</ref>
14642 B <ref name="x">foo</ref>
14643 C <ref name="y" />
14644 !!result
14645 <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>
14646 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>
14647 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>
14648 !!end
14649
14650 !!test
14651 Ref: 2. ref-tags with identical names should all get the same index
14652 !!options
14653 parsoid
14654 !!input
14655 A <ref name="x">foo</ref>
14656 B <ref name="x" />
14657 !!result
14658 <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>
14659 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>
14660 !!end
14661
14662 !!test
14663 Ref: 3. spaces in ref-names should be ignored
14664 !!options
14665 parsoid
14666 !!input
14667 A <ref name="x">foo</ref>
14668 B <ref name=" x " />
14669 C <ref name= x />
14670 !!result
14671 <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>
14672 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>
14673 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>
14674 !!end
14675
14676 !!test
14677 Ref: 4. 'constructor' should be accepted as a valid ref-name
14678 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14679 !!options
14680 parsoid
14681 !!input
14682 A <ref name="constructor">foo</ref>
14683 !!result
14684 <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>
14685 !!end
14686
14687 !!test
14688 Ref: 5. body should accept generic wikitext
14689 !!options
14690 parsoid
14691 !!input
14692 A <ref>
14693 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14694 </ref>
14695
14696 <references />
14697 !!result
14698 <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>
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> 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>
14702 </li></ol>
14703 !!end
14704
14705 !!test
14706 Ref: 6. indent-pres should not be output in ref-body
14707 !!options
14708 parsoid
14709 !!input
14710 A <ref>
14711 foo
14712 bar
14713 baz
14714 </ref>
14715
14716 <references />
14717 !!result
14718 <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>
14719
14720 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14721 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14722 bar
14723 baz
14724 </li></ol>
14725 !!end
14726
14727 !!test
14728 Ref: 6. No p-wrapping in ref-body
14729 !!options
14730 parsoid
14731 !!input
14732 A <ref>
14733 foo
14734
14735 bar
14736
14737
14738 baz
14739
14740
14741
14742 booz
14743 </ref>
14744
14745 <references />
14746 !!result
14747 <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>
14748
14749 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14750 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14751
14752 bar
14753
14754
14755 baz
14756
14757
14758
14759 booz
14760 </li></ol>
14761 !!end
14762
14763 !!test
14764 Ref: 8. transclusion wikitext has lower precedence
14765 !!options
14766 parsoid
14767 !!input
14768 A <ref> foo {{echo|</ref> B C}}
14769
14770 <references />
14771 !!result
14772 <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>
14773
14774 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14775 <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>
14776 !!end
14777
14778 !!test
14779 Ref: 9. unclosed comments should not leak out of ref-body
14780 !!options
14781 parsoid
14782 !!input
14783 A <ref> foo <!--</ref> B C
14784
14785 <references />
14786 !!result
14787 <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>
14788
14789 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14790 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14791 !!end
14792
14793 !!test
14794 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14795 !!options
14796 parsoid
14797 !!input
14798 A <ref> <b> foo </ref> B C
14799
14800 <references />
14801 !!result
14802 <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>
14803
14804 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14805 <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>
14806 !!end
14807
14808 !!test
14809 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14810 !!options
14811 parsoid
14812 !!input
14813 A <ref>foo</ref> B
14814 C <ref>bar</ref> D
14815 !!result
14816 <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
14817 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>
14818 !!end
14819
14820 !!test
14821 Ref: 12. ref-tags act as trailing newline migration barrier
14822 !!options
14823 parsoid
14824 !!input
14825 <!--the newline at the end of this line moves out of the p-tag-->a
14826
14827 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14828 <ref />
14829
14830 c
14831 !!result
14832 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14833
14834
14835 <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>
14836 <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>
14837
14838
14839 <p>c</p>
14840 !!end
14841
14842 !!test
14843 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14844 !!options
14845 parsoid
14846 !!input
14847 <ref>foo</ref> A
14848 <ref>bar
14849 </ref> B
14850 !!result
14851 <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
14852 <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>
14853 !!end
14854
14855 !!test
14856 Ref: 14. A nested ref-tag should be emitted as plain text
14857 !!options
14858 parsoid
14859 !!input
14860 <ref>foo <ref>bar</ref> baz</ref>
14861
14862 <references />
14863 !!result
14864 <span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14865
14866 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
14867 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
14868 !!end
14869
14870 !!test
14871 Ref: 15. ref-tags with identical names should get identical indexes
14872 !!options
14873 parsoid
14874 !!input
14875 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14876 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14877
14878 <references />
14879 !!result
14880 <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>
14881 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>
14882
14883 <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>
14884 !!end
14885
14886 !!test
14887 References: 1. references tag without any refs should be handled properly
14888 !!options
14889 parsoid
14890 !!input
14891 <references />
14892 !!result
14893 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14894 !!end
14895
14896 !!test
14897 References: 2. references tag with group only outputs references from that group
14898 !!options
14899 parsoid
14900 !!input
14901 A <ref group="a">foo</ref>
14902 B <ref group="b">bar</ref>
14903
14904 <references group='a' />
14905 !!result
14906 <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>
14907 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>
14908
14909 <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>
14910 !!end
14911
14912 !!test
14913 References: 3. ref list should be cleared after processing references
14914 !!options
14915 parsoid
14916 !!input
14917 A <ref>foo</ref>
14918
14919 <references />
14920
14921 B <ref>bar</ref>
14922
14923 <references />
14924 !!result
14925 <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>
14926
14927 <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>
14928
14929 <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>
14930
14931 <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>
14932 !!end
14933
14934 !!test
14935 References: 4. only referenced group should be cleared after processing references
14936 !!options
14937 parsoid
14938 !!input
14939 A <ref group="a">afoo</ref>
14940 B <ref>bfoo</ref>
14941
14942 <references group="a"/>
14943
14944 C <ref>cfoo</ref>
14945
14946 <references />
14947 !!result
14948 <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>
14949 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>
14950
14951 <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>
14952
14953 <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>
14954
14955 <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>
14956 !!end
14957
14958 !!test
14959 References: 5. ref tags in references should be processed while ignoring all other content
14960 !!options
14961 parsoid
14962 !!input
14963 A <ref name="a" />
14964 B <ref name="b">bar</ref>
14965
14966 <references>
14967 <ref name="a">foo</ref>
14968 This should just get lost.
14969 </references>
14970 !!result
14971 <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>
14972 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>
14973
14974 <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>
14975 !!end
14976
14977 !!test
14978 References: 6. <references /> from a transclusion
14979 !!options
14980 parsoid
14981 !!input
14982 {{echo|<references />}}
14983 !!result
14984 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
14985 !!end
14986
14987 #### ----------------------------------------------------------------
14988 #### The following section of tests are primarily to test
14989 #### wikitext escaping capabilities of Parsoid. Given that
14990 #### escaping can be done any number of ways, the wikitext (input)
14991 #### is always adjusted to reflect how Parsoid adds nowiki
14992 #### escape tags.
14993 ####
14994 #### We are marking several tests as parsoid-only since the
14995 #### HTML in the result section is different from what the
14996 #### PHP parser generates for it.
14997 #### ----------------------------------------------------------------
14998
14999
15000 #### --------------- Headings ---------------
15001 #### 0. Unnested
15002 #### 1. Nested inside html <h1>=foo=</h1>
15003 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15004 #### 3. Nested inside html with wikitext split by html tags
15005 #### 4. No escape needed
15006 #### 5. Empty headings <h1></h1>
15007 #### 6. Heading chars in SOL context
15008 #### ----------------------------------------
15009 !! test
15010 Headings: 0. Unnested
15011 !! options
15012 parsoid
15013 !! input
15014 <nowiki>=foo=</nowiki>
15015
15016 <nowiki> =foo= </nowiki>
15017 <!--cmt-->
15018 <nowiki>=foo=</nowiki>
15019
15020 =foo''a''<nowiki>=</nowiki>
15021 !! result
15022 <p><span typeof="mw:Nowiki">=foo=</span></p>
15023
15024 <p><span typeof="mw:Nowiki"> =foo= </span>
15025 <!--cmt-->
15026 <span typeof="mw:Nowiki">=foo=</span></p>
15027
15028 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15029 !!end
15030
15031 !! test
15032 Headings: 1. Nested inside html
15033 !! options
15034 parsoid
15035 !! input
15036 =<nowiki>=foo=</nowiki>=
15037
15038 ==<nowiki>=foo=</nowiki>==
15039
15040 ===<nowiki>=foo=</nowiki>===
15041
15042 ====<nowiki>=foo=</nowiki>====
15043
15044 =====<nowiki>=foo=</nowiki>=====
15045
15046 ======<nowiki>=foo=</nowiki>======
15047 !! result
15048 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15049 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15050 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15051 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15052 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15053 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15054 !!end
15055
15056 !! test
15057 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15058 !! options
15059 parsoid
15060 !! input
15061 =foo=
15062 <nowiki>*</nowiki>bar
15063
15064 =foo=
15065 =bar
15066
15067 =foo=
15068 <nowiki>=bar=</nowiki>
15069 !! result
15070 <h1>foo</h1>*bar
15071 <h1>foo</h1>=bar
15072 <h1>foo</h1>=bar=
15073 !!end
15074
15075 !! test
15076 Headings: 3. Nested inside html with wikitext split by html tags
15077 !! options
15078 parsoid
15079 !! input
15080 =='''bold'''<nowiki>foo=</nowiki>=
15081 !! result
15082 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15083 !!end
15084
15085 !! test
15086 Headings: 4a. No escaping needed (testing just h1 and h2)
15087 !! options
15088 parsoid
15089 !! input
15090 ==foo=
15091
15092 =foo==
15093
15094 = =foo= =
15095
15096 ==foo= bar=
15097
15098 ===foo==
15099
15100 ==foo===
15101
15102 =''=''foo==
15103
15104 =<nowiki>=</nowiki>=
15105 !! result
15106 <h1>=foo</h1>
15107 <h1>foo=</h1>
15108 <h1> =foo= </h1>
15109 <h1>=foo= bar</h1>
15110 <h2>=foo</h2>
15111 <h2>foo=</h2>
15112 <h1><i>=</i>foo=</h1>
15113 <h1><span typeof="mw:Nowiki">=</span></h1>
15114 !!end
15115
15116 !! test
15117 Headings: 4b. No escaping needed (inside p-tags)
15118 !! options
15119 parsoid
15120 !! input
15121 ===
15122 =foo= x
15123 =foo= <s></s>
15124 !! result
15125 <p>===
15126 =foo= x
15127 =foo= <s></s>
15128 </p>
15129 !!end
15130
15131 !! test
15132 Headings: 5. Empty headings
15133 !! options
15134 parsoid
15135 !! input
15136 =<nowiki/>=
15137
15138 ==<nowiki/>==
15139
15140 ===<nowiki/>===
15141
15142 ====<nowiki/>====
15143
15144 =====<nowiki/>=====
15145
15146 ======<nowiki/>======
15147 !! result
15148 <h1></h1>
15149 <h2></h2>
15150 <h3></h3>
15151 <h4></h4>
15152 <h5></h5>
15153 <h6></h6>
15154 !!end
15155
15156 !! test
15157 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15158 !! options
15159 parsoid
15160 !! input
15161 <nowiki>=a=</nowiki>
15162
15163 <nowiki>=a=</nowiki>
15164
15165 <nowiki>=a=</nowiki>
15166
15167 <nowiki>=a=</nowiki>
15168 !! result
15169 <p>=a=</p>
15170 <p>=a= </p>
15171 <p>=a= </p>
15172 <p>=a= </p>
15173 !!end
15174
15175 !! test
15176 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15177 !! options
15178 parsoid
15179 !! input
15180 <nowiki>=a=
15181 b</nowiki>
15182
15183 <nowiki>=a=
15184 b</nowiki>
15185
15186 <nowiki>=a=
15187 b</nowiki>
15188
15189 <nowiki>=a=
15190 b</nowiki>
15191 !! result
15192 <p>=a=
15193 b</p>
15194 <p>=a=
15195 b</p>
15196 <p>=a=
15197 b</p>
15198 <p>=a=
15199 b</p>
15200 </p>
15201 !!end
15202
15203 !! test
15204 Headings: 6c. Heading chars in SOL context (leading newline break)
15205 !! options
15206 parsoid
15207 !! input
15208 a
15209 <nowiki>=b=</nowiki>
15210 !! result
15211 <p>a
15212 =b=</p>
15213 !!end
15214
15215 !! test
15216 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15217 !! options
15218 parsoid
15219 !! input
15220 <!--c0--><nowiki>=a=</nowiki>
15221 <!--c1-->
15222 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15223 !! result
15224 <p><!--c0-->=a=</p>
15225 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15226 !!end
15227
15228 !! test
15229 Headings: 6d. Heading chars in SOL context (No escaping needed)
15230 !! options
15231 parsoid=html2wt
15232 !! input
15233 =a=<div>b</div>
15234 !! result
15235 =a=<div>b</div>
15236 !!end
15237
15238 #### --------------- Lists ---------------
15239 #### 0. Outside nests (*foo, etc.)
15240 #### 1. Nested inside html <ul><li>*foo</li></ul>
15241 #### 2. Inside definition lists
15242 #### 3. Only bullets at start should be escaped
15243 #### 4. No escapes needed
15244 #### 5. No unnecessary escapes
15245 #### 6. Escape bullets in SOL position
15246 #### 7. Escape bullets in a multi-line context
15247 #### ----------------------------------------
15248
15249 !! test
15250 Lists: 0. Outside nests
15251 !! input
15252 <nowiki>*</nowiki>foo
15253
15254 <nowiki>#</nowiki>foo
15255 !! result
15256 <p>*foo
15257 </p><p>#foo
15258 </p>
15259 !!end
15260
15261 !! test
15262 Lists: 1. Nested inside html
15263 !! input
15264 *<nowiki>*foo</nowiki>
15265
15266 *<nowiki>#foo</nowiki>
15267
15268 *<nowiki>:foo</nowiki>
15269
15270 *<nowiki>;foo</nowiki>
15271
15272 #<nowiki>*foo</nowiki>
15273
15274 #<nowiki>#foo</nowiki>
15275
15276 #<nowiki>:foo</nowiki>
15277
15278 #<nowiki>;foo</nowiki>
15279 !! result
15280 <ul><li>*foo
15281 </li></ul>
15282 <ul><li>#foo
15283 </li></ul>
15284 <ul><li>:foo
15285 </li></ul>
15286 <ul><li>;foo
15287 </li></ul>
15288 <ol><li>*foo
15289 </li></ol>
15290 <ol><li>#foo
15291 </li></ol>
15292 <ol><li>:foo
15293 </li></ol>
15294 <ol><li>;foo
15295 </li></ol>
15296
15297 !!end
15298
15299 !! test
15300 Lists: 2. Inside definition lists
15301 !! input
15302 ;<nowiki>;foo</nowiki>
15303
15304 ;<nowiki>:foo</nowiki>
15305
15306 ;<nowiki>:foo</nowiki>
15307 :bar
15308
15309 :<nowiki>:foo</nowiki>
15310 !! result
15311 <dl><dt>;foo
15312 </dt></dl>
15313 <dl><dt>:foo
15314 </dt></dl>
15315 <dl><dt>:foo
15316 </dt><dd>bar
15317 </dd></dl>
15318 <dl><dd>:foo
15319 </dd></dl>
15320
15321 !!end
15322
15323 !! test
15324 Lists: 3. Only bullets at start of text should be escaped
15325 !! input
15326 *<nowiki>*foo*bar</nowiki>
15327
15328 *<nowiki>*foo</nowiki>''it''*bar
15329 !! result
15330 <ul><li>*foo*bar
15331 </li></ul>
15332 <ul><li>*foo<i>it</i>*bar
15333 </li></ul>
15334
15335 !!end
15336
15337 !! test
15338 Lists: 4. No escapes needed
15339 !! options
15340 parsoid
15341 !! input
15342 *foo*bar
15343
15344 *''foo''*bar
15345
15346 *[[Foo]]: bar
15347 !! result
15348 <ul><li>foo*bar
15349 </li></ul>
15350 <ul><li><i>foo</i>*bar
15351 </li></ul>
15352 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15353 </li></ul>
15354 !!end
15355
15356 !! test
15357 Lists: 5. No unnecessary escapes
15358 !! input
15359 * bar <span><nowiki>[[foo]]</nowiki></span>
15360
15361 *=bar <span><nowiki>[[foo]]</nowiki></span>
15362
15363 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15364
15365 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15366
15367 *=bar <span>foo]]</span>=
15368
15369 * <s></s>: a
15370 !! result
15371 <ul><li> bar <span>[[foo]]</span>
15372 </li></ul>
15373 <ul><li>=bar <span>[[foo]]</span>
15374 </li></ul>
15375 <ul><li>[[bar <span>[[foo]]</span>
15376 </li></ul>
15377 <ul><li>]]bar <span>[[foo]]</span>
15378 </li></ul>
15379 <ul><li>=bar <span>foo]]</span>=
15380 </li></ul>
15381 <ul><li> <s></s>: a
15382 </li></ul>
15383
15384 !!end
15385
15386 !! test
15387 Lists: 6. Escape bullets in SOL position
15388 !! options
15389 parsoid
15390 !! input
15391 <!--cmt--><nowiki>*foo</nowiki>
15392 !! result
15393 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15394 !!end
15395
15396 !! test
15397 Lists: 7. Escape bullets in a multi-line context
15398 !! input
15399 a
15400 <nowiki>*</nowiki>b
15401 !! result
15402 <p>a
15403 *b
15404 </p>
15405 !!end
15406
15407 #### --------------- HRs ---------------
15408 #### 1. Single line
15409 #### -----------------------------------
15410
15411 !! test
15412 HRs: 1. Single line
15413 !! options
15414 parsoid
15415 !! input
15416 ----<nowiki>----</nowiki>
15417 ----=foo=
15418 ----*foo
15419 !! result
15420 <hr><span typeof="mw:Nowiki">----</span>
15421 <hr>=foo=
15422 <hr>*foo
15423 !! end
15424
15425 #### --------------- Tables ---------------
15426 #### 1a. Simple example
15427 #### 1b. No escaping needed (!foo)
15428 #### 1c. No escaping needed (|foo)
15429 #### 1d. No escaping needed (|}foo)
15430 ####
15431 #### 2a. Nested in td (<td>foo|bar</td>)
15432 #### 2b. Nested in td (<td>foo||bar</td>)
15433 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15434 ####
15435 #### 3a. Nested in th (<th>foo!bar</th>)
15436 #### 3b. Nested in th (<th>foo!!bar</th>)
15437 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15438 ####
15439 #### 4a. Escape -
15440 #### 4b. Escape +
15441 #### 4c. No escaping needed
15442 #### --------------------------------------
15443
15444 !! test
15445 Tables: 1a. Simple example
15446 !! input
15447 <nowiki>{|
15448 |}</nowiki>
15449 !! result
15450 <p>{|
15451 |}
15452 </p>
15453 !! end
15454
15455 !! test
15456 Tables: 1b. No escaping needed
15457 !! input
15458 !foo
15459 !! result
15460 <p>!foo
15461 </p>
15462 !! end
15463
15464 !! test
15465 Tables: 1c. No escaping needed
15466 !! input
15467 |foo
15468 !! result
15469 <p>|foo
15470 </p>
15471 !! end
15472
15473 !! test
15474 Tables: 1d. No escaping needed
15475 !! input
15476 |}foo
15477 !! result
15478 <p>|}foo
15479 </p>
15480 !! end
15481
15482 !! test
15483 Tables: 2a. Nested in td
15484 !! options
15485 parsoid
15486 !! input
15487 {|
15488 |<nowiki>foo|bar</nowiki>
15489 |}
15490 !! result
15491 <table><tbody><tr>
15492 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15493 !! end
15494
15495 !! test
15496 Tables: 2b. Nested in td
15497 !! options
15498 parsoid
15499 !! input
15500 {|
15501 |<nowiki>foo||bar</nowiki>
15502 |''it''<nowiki>foo||bar</nowiki>
15503 |}
15504 !! result
15505 <table><tbody><tr>
15506 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15507 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15508 !! end
15509
15510 !! test
15511 Tables: 2c. Nested in td -- no escaping needed
15512 !! options
15513 parsoid
15514 !! input
15515 {|
15516 |foo!!bar
15517 |}
15518 !! result
15519 <table><tbody><tr><td>foo!!bar
15520 </td></tr></tbody></table>
15521
15522 !! end
15523
15524 !! test
15525 Tables: 3a. Nested in th
15526 !! options
15527 parsoid
15528 !! input
15529 {|
15530 !foo!bar
15531 |}
15532 !! result
15533 <table><tbody><tr><th>foo!bar
15534 </th></tr></tbody></table>
15535
15536 !! end
15537
15538 !! test
15539 Tables: 3b. Nested in th
15540 !! options
15541 parsoid
15542 !! input
15543 {|
15544 !<nowiki>foo!!bar</nowiki>
15545 |}
15546 !! result
15547 <table>
15548 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15549 </tbody></table>
15550 !! end
15551
15552 !! test
15553 Tables: 3c. Nested in th -- no escaping needed
15554 !! options
15555 parsoid
15556 !! input
15557 {|
15558 !<nowiki>foo||bar</nowiki>
15559 |}
15560 !! result
15561 <table><tbody><tr>
15562 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15563 !! end
15564
15565 !! test
15566 Tables: 4a. Escape -
15567 !! options
15568 parsoid
15569 !! input
15570 {|
15571 |-
15572 !-bar
15573 |-
15574 |<nowiki>-bar</nowiki>
15575 |}
15576 !! result
15577 <table><tbody>
15578 <tr><th>-bar</th></tr>
15579 <tr>
15580 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15581 !! end
15582
15583 !! test
15584 Tables: 4b. Escape +
15585 !! options
15586 parsoid
15587 !! input
15588 {|
15589 |-
15590 !+bar
15591 |-
15592 |<nowiki>+bar</nowiki>
15593 |}
15594 !! result
15595 <table><tbody>
15596 <tr><th>+bar</th></tr>
15597 <tr>
15598 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15599 !! end
15600
15601 !! test
15602 Tables: 4c. No escaping needed
15603 !! options
15604 parsoid
15605 !! input
15606 {|
15607 |-
15608 |foo-bar
15609 |foo+bar
15610 |-
15611 |''foo''-bar
15612 |''foo''+bar
15613 |}
15614 !! result
15615 <table><tbody>
15616 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15617 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15618 </tbody></table>
15619 !! end
15620
15621 ### SSS FIXME: Disabled right now because accurate html2wt
15622 ### on this snippet requires data-parsoid flags that we've
15623 ### stripped out of these tests. We should scheme how we
15624 ### we want to handle these kind of tests that require
15625 ### data-parsoid flags for accurate html2wt serialization
15626
15627 !! test
15628 Tables: 4d. No escaping needed
15629 !! options
15630 disabled
15631 !! input
15632 {|
15633 ||+1
15634 ||-2
15635 |}
15636 !! result
15637 <table>
15638 <tr>
15639 <td>+1
15640 </td>
15641 <td>-2
15642 </td></tr></table>
15643
15644 !! end
15645
15646 #### --------------- Links ----------------
15647 #### 1. Quote marks in link text
15648 #### 2. Wikilinks: Escapes needed
15649 #### 3. Wikilinks: No escapes needed
15650 #### 4. Extlinks: Escapes needed
15651 #### 5. Extlinks: No escapes needed
15652 #### --------------------------------------
15653 !! test
15654 Links 1. Quote marks in link text
15655 !! options
15656 parsoid
15657 !! input
15658 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15659 !! result
15660 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15661 !! end
15662
15663 !! test
15664 Links 2. WikiLinks: Escapes needed
15665 !! options
15666 parsoid
15667 !! input
15668 [[Foo|<nowiki>[Foobar]</nowiki>]]
15669 [[Foo|<nowiki>Foobar]</nowiki>]]
15670 [[Foo|x [Foobar] x]]
15671 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15672 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15673 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15674 [[Foo|<nowiki>|Bar</nowiki>]]
15675 [[Foo|<nowiki>]]bar</nowiki>]]
15676 [[Foo|<nowiki>[[bar</nowiki>]]
15677 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15678 !! result
15679 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15680 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15681 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15682 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15683 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15684 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15685 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15686 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15687 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15688 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15689 !! end
15690
15691 !! test
15692 Links 3. WikiLinks: No escapes needed
15693 !! options
15694 parsoid
15695 !! input
15696 [[Foo|[Foobar]]
15697 [[Foo|foo|bar]]
15698 !! result
15699 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15700 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15701 !! end
15702
15703 !! test
15704 Links 4. ExtLinks: Escapes needed
15705 !! options
15706 parsoid
15707 !! input
15708 [http://google.com <nowiki>[google]</nowiki>]
15709 [http://google.com <nowiki>google]</nowiki>]
15710 !! result
15711 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15712 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15713 !! end
15714
15715 !! test
15716 Links 5. ExtLinks: No escapes needed
15717 !! options
15718 parsoid
15719 !! input
15720 [http://google.com [google]
15721 !! result
15722 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15723 !! end
15724
15725 #### --------------- Quotes ---------------
15726 #### 1. Quotes inside <b> and <i>
15727 #### 2. Link fragments separated by <i> and <b> tags
15728 #### 3. Link fragments inside <i> and <b>
15729 #### --------------------------------------
15730 !! test
15731 1. Quotes inside <b> and <i>
15732 !! input
15733 ''<nowiki>'foo'</nowiki>''
15734 ''<nowiki>''foo''</nowiki>''
15735 ''<nowiki>'''foo'''</nowiki>''
15736 ''foo''<nowiki>'s</nowiki>
15737 '''<nowiki>'foo'</nowiki>'''
15738 '''<nowiki>''foo''</nowiki>'''
15739 '''<nowiki>'''foo'''</nowiki>'''
15740 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15741 '''foo'''<nowiki>'s</nowiki>
15742 !! result
15743 <p><i>'foo'</i>
15744 <i>''foo''</i>
15745 <i>'''foo'''</i>
15746 <i>foo</i>'s
15747 <b>'foo'</b>
15748 <b>''foo''</b>
15749 <b>'''foo'''</b>
15750 <b>foo'<i>bar'</i>baz</b>
15751 <b>foo</b>'s
15752 </p>
15753 !! end
15754
15755 !! test
15756 2. Link fragments separated by <i> and <b> tags
15757 !! input
15758 [[''foo''<nowiki>hello]]</nowiki>
15759
15760 [['''foo'''<nowiki>hello]]</nowiki>
15761 !! result
15762 <p>[[<i>foo</i>hello]]
15763 </p><p>[[<b>foo</b>hello]]
15764 </p>
15765 !! end
15766
15767 !! test
15768 2. Link fragments inside <i> and <b>
15769 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15770 this is one of the shortcomings of this format)
15771 !! input
15772 ''[[foo''<nowiki>]]</nowiki>
15773
15774 '''[[foo'''<nowiki>]]</nowiki>
15775 !! result
15776 <p><i>[[foo</i>]]
15777 </p><p><b>[[foo</b>]]
15778 </p>
15779 !! end
15780
15781 #### ----------- Paragraphs ---------------
15782 #### 1. No unnecessary escapes
15783 #### --------------------------------------
15784
15785 !! test
15786 1. No unnecessary escapes
15787 !! input
15788 bar <span><nowiki>[[foo]]</nowiki></span>
15789
15790 =bar <span><nowiki>[[foo]]</nowiki></span>
15791
15792 [[bar <span><nowiki>[[foo]]</nowiki></span>
15793
15794 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15795
15796 =bar <span>foo]]</span><nowiki>=</nowiki>
15797 !! result
15798 <p>bar <span>[[foo]]</span>
15799 </p><p>=bar <span>[[foo]]</span>
15800 </p><p>[[bar <span>[[foo]]</span>
15801 </p><p>]]bar <span>[[foo]]</span>
15802 </p><p>=bar <span>foo]]</span>=
15803 </p>
15804 !!end
15805
15806 #### ----------------------- PRE --------------------------
15807 #### 1. Leading whitespace in SOL context should be escaped
15808 #### ------------------------------------------------------
15809 !! test
15810 1. Leading whitespace in SOL context should be escaped
15811 !! options
15812 parsoid
15813 !! input
15814 <nowiki> </nowiki>a
15815
15816 <nowiki> </nowiki> a
15817
15818 <nowiki> </nowiki>a(tab)
15819
15820 <nowiki> </nowiki> a
15821 <!--cmt-->
15822 <nowiki> </nowiki> a
15823
15824 a
15825 <nowiki> </nowiki>b
15826
15827 a
15828 <nowiki> </nowiki>b
15829
15830 a
15831 <nowiki> </nowiki> b
15832 !! result
15833 <p> a</p>
15834 <p> a</p>
15835 <p> a(tab)</p>
15836 <p> a</p>
15837 <p><!--cmt--> a</p>
15838 <p>a
15839 b</p>
15840 <p>a
15841 b</p>
15842 <p>a
15843 b</p>
15844 !! end
15845
15846 #### --------------- HTML tags ---------------
15847 #### 1. a tags
15848 #### 2. other tags
15849 #### 3. multi-line html tag
15850 #### -----------------------------------------
15851 !! test
15852 1. a tags
15853 !! options
15854 parsoid
15855 !! input
15856 <a href="http://google.com">google</a>
15857 !! result
15858 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15859 !! end
15860
15861 !! test
15862 2. other tags
15863 !! input
15864 <nowiki><div>foo</div>
15865 <div style="color:red">foo</div></nowiki>
15866 !! result
15867 <p>&lt;div&gt;foo&lt;/div&gt;
15868 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15869 </p>
15870 !! end
15871
15872 !! test
15873 3. multi-line html tag
15874 !! input
15875 <nowiki><div
15876 >foo</div
15877 ></nowiki>
15878 !! result
15879 <p>&lt;div
15880 &gt;foo&lt;/div
15881 &gt;
15882 </p>
15883 !! end
15884
15885 !! test
15886 4. extension tags
15887 !! input
15888 <nowiki><ref>foo</ref></nowiki>
15889 !! result
15890 <p>&lt;ref&gt;foo&lt;/ref&gt;
15891 </p>
15892 !! end
15893
15894 #### --------------- Others ---------------
15895 !! test
15896 Escaping nowikis
15897 !! input
15898 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15899 !! result
15900 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15901 </p>
15902 !! end
15903 !! test
15904
15905 Tag-like HTML structures are passed through as text
15906 !! input
15907 <x y>
15908
15909 <x.y>
15910
15911 <x-y>
15912
15913 1>2
15914
15915 x<y
15916
15917 a>b
15918
15919 1<d e>f
15920 !! result
15921 <p>&lt;x y&gt;
15922 </p><p>&lt;x.y&gt;
15923 </p><p>&lt;x-y&gt;
15924 </p><p>1&gt;2
15925 </p><p>x&lt;y
15926 </p><p>a&gt;b
15927 </p><p>1&lt;d e&gt;f
15928 </p>
15929 !! end
15930
15931
15932 # This fails in the PHP parser (see bug 40670,
15933 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15934 !! test
15935 Tag names followed by punctuation should not be recognized as tags
15936 !! options
15937 parsoid
15938 !! input
15939 <s.ome> text
15940 !! result
15941 <p>&lt;s.ome&gt; text
15942 </p>
15943 !! end
15944
15945 !! test
15946 HTML tag with necessary entities in attributes
15947 !! input
15948 <span title="&amp;amp;">foo</span>
15949 !! result
15950 <p><span title="&amp;amp;">foo</span>
15951 </p>
15952 !! end
15953
15954 !! test
15955 HTML tag with 'unnecessary' entity encoding in attributes
15956 !! input
15957 <span title="&amp;">foo</span>
15958 !! result
15959 <p><span title="&amp;">foo</span>
15960 </p>
15961 !! end
15962
15963 !! test
15964 HTML tag with broken attribute value quoting
15965 !! input
15966 <span title="Hello world>Foo</span>
15967 !! result
15968 <p><span>Foo</span>
15969 </p>
15970 !! end
15971
15972 !! test
15973 Parsoid-only: HTML tag with broken attribute value quoting
15974 !! options
15975 parsoid
15976 !! input
15977 <span title="Hello world>Foo</span>
15978 !! result
15979 <p><span title="Hello world">Foo</span>
15980 </p>
15981 !! end
15982
15983 !! test
15984 Table with broken attribute value quoting
15985 !! input
15986 {|
15987 | title="Hello world|Foo
15988 |}
15989 !! result
15990 <table>
15991 <tr>
15992 <td>Foo
15993 </td></tr></table>
15994
15995 !! end
15996
15997 !! test
15998 Table with broken attribute value quoting on consecutive lines
15999 !! input
16000 {|
16001 | title="Hello world|Foo
16002 | style="color:red|Bar
16003 |}
16004 !! result
16005 <table>
16006 <tr>
16007 <td>Foo
16008 </td>
16009 <td>Bar
16010 </td></tr></table>
16011
16012 !! end
16013
16014 !! test
16015 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16016 !! options
16017 parsoid
16018 !! input
16019 {|
16020 | title="Hello world|Foo
16021 | style="color:red|Bar
16022 |}
16023 !! result
16024 <table><tbody>
16025 <tr>
16026 <td title="Hello world">Foo
16027 </td><td style="color: red">Bar
16028 </td></tr></tbody></table>
16029
16030 !! end
16031
16032 !! test
16033 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16034 !! options
16035 parsoid
16036 !! input
16037 {{}}
16038 !! result
16039 {{}}
16040 !! end
16041
16042 !! test
16043 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16044 !! options
16045 parsoid
16046 !! input
16047 }}{{
16048 !! result
16049 }}{{
16050 !! end
16051
16052 !!test
16053 Accept empty td cell attribute
16054 !!input
16055 {|
16056 | align="center" | foo || |
16057 |}
16058 !!result
16059 <table>
16060 <tr>
16061 <td align="center"> foo </td>
16062 <td>
16063 </td></tr></table>
16064
16065 !!end
16066
16067 !!test
16068 Non-empty attributes in th-cells
16069 !!input
16070 {|
16071 ! Foo !! style="color: red" | Bar
16072 |}
16073 !!result
16074 <table>
16075 <tr>
16076 <th> Foo </th>
16077 <th style="color: red"> Bar
16078 </th></tr></table>
16079
16080 !!end
16081
16082 !!test
16083 Accept empty attributes in th-cells
16084 !!input
16085 {|
16086 !| foo !!| bar
16087 |}
16088 !!result
16089 <table>
16090 <tr>
16091 <th> foo </th>
16092 <th> bar
16093 </th></tr></table>
16094
16095 !!end
16096
16097 !!test
16098 Empty table rows go away
16099 !!input
16100 {|
16101 | Hello
16102 | there
16103 |- class="foo"
16104 |-
16105 |}
16106 !! result
16107 <table>
16108 <tr>
16109 <td> Hello
16110 </td>
16111 <td> there
16112 </td></tr>
16113
16114 </table>
16115
16116 !! end
16117
16118 ###
16119 ### Parsoid-centric tests for testing RTing of inter-element separators
16120 ### Edge cases not tested by existing parser tests and specific to
16121 ### Parsoid-specific serialization strategies.
16122 ###
16123
16124 !!test
16125 RT-ed inter-element separators should be valid separators
16126 !!input
16127 {|
16128 |- [[foo]]
16129 |}
16130 !!result
16131 <table>
16132
16133 </table>
16134
16135 !!end
16136
16137 !!test
16138 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16139 (Parsoid-only since PHP parser relies on Tidy for correct output)
16140 !!options
16141 parsoid
16142 !!input
16143 {|
16144 |<small>foo
16145 bar
16146 |}
16147
16148 {|
16149 |<small>foo<small>
16150 |}
16151 !!result
16152 !!end
16153
16154 !!test
16155 Empty TD followed by TD with tpl-generated attribute
16156 !!input
16157 {|
16158 |-
16159 |
16160 |{{echo|style='color:red'}}|foo
16161 |}
16162 !!result
16163 <table>
16164
16165 <tr>
16166 <td>
16167 </td>
16168 <td>foo
16169 </td></tr></table>
16170
16171 !!end
16172
16173 !!test
16174 Indented table with an empty td
16175 !!input
16176 {|
16177 |-
16178 |
16179 |foo
16180 |}
16181 !!result
16182 <table>
16183
16184 <tr>
16185 <td>
16186 </td>
16187 <td>foo
16188 </td></tr></table>
16189
16190 !!end
16191
16192 !!test
16193 Empty TR followed by a template-generated TR
16194 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16195 !!options
16196 parsoid=wt2html,wt2wt
16197 !!input
16198 {|
16199 |-
16200 {{echo|<tr><td>foo</td></tr>}}
16201 |}
16202 !!result
16203 <table>
16204 <tbody>
16205 <tr></tr>
16206 <tr typeof="mw:Transclusion">
16207 <td>foo</td></tr></tbody></table>
16208 !!end
16209
16210 ## PHP and parsoid output differ for this, and since this is primarily
16211 ## for testing Parsoid's serializer, marking this Parsoid only
16212 !!test
16213 Empty TR followed by mixed-ws-comment line should RT correctly
16214 !!options
16215 parsoid
16216 !!input
16217 {|
16218 |-
16219 <!--c-->
16220 |-
16221 <!--c--> <!--d-->
16222 |}
16223 !!result
16224 <table>
16225 <tbody>
16226 <tr>
16227 <td> <!--c--></td></tr>
16228 <tr>
16229 <td><!--c--> <!--d--></td></tr>
16230 </tbody></table>
16231
16232 !!end
16233
16234 !!test
16235 Multi-line image caption generated by templates with/without trailing newlines
16236 !!options
16237 parsoid
16238 !!input
16239 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16240 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16241 !!result
16242 <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>
16243 <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>
16244
16245 !!end
16246
16247 ## PHP emits broken html for this, and since this is primarily
16248 ## a Parsoid serializer test, marking this Parsoid only
16249 !!test
16250 Improperly nested inline or quotes tags with whitespace in between
16251 !!options
16252 parsoid
16253 !!input
16254 <span> <s>x</span> </s>
16255 ''' ''x''' ''
16256 !!result
16257 <p><span> <s>x</s></span><s> </s>
16258 <b> <i>x</i></b><i> </i>
16259 </p>
16260 !!end
16261
16262 # -----------------------------------------------------------------
16263 # The following section of tests are primarily to spec requirements
16264 # around serialization of new/edited content.
16265 #
16266 # All these tests are marked Parsoid html2wt and html2html only
16267 # ----------------------------------------------------------------
16268
16269 !! test
16270 Image: Modifying size of an image
16271 !! options
16272 parsoid=html2wt
16273 !! input
16274 [[Image:Wiki.png|230x230px]]
16275 !! result
16276 <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>
16277 !!end
16278
16279 !! test
16280 Image: New block level image should have \n before and after
16281 !! options
16282 parsoid=html2wt
16283 !! input
16284 123
16285 [[File:Wiki.png|right|thumb|150x150px]]
16286 456
16287 !! result
16288 <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>
16289 !!end
16290
16291 !! test
16292 Lists: Add space after bullets
16293 !! options
16294 parsoid=html2wt
16295 !! input
16296
16297 * foo
16298 * bar
16299 * <span> baz</span>
16300 !! result
16301 <ul>
16302 <li>foo</li>
16303 <li> bar</li>
16304 <li><span> baz</span></li>
16305 </ul>
16306 !! end
16307
16308 !! test
16309 Parsoid: Serialize positional parameters with = in them as named parameter
16310 !! options
16311 parsoid=html2wt
16312 !! input
16313 {{echo|1 = f=oo}}
16314 !! result
16315 <p about="#mwt1" typeof="mw:Transclusion"
16316 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16317 >foo</p>
16318 !! end
16319
16320 # -----------------------------------------------------------------
16321 # End of section for Parsoid-only html2wt tests for serialization
16322 # of new content
16323 # -----------------------------------------------------------------
16324
16325 TODO:
16326 more images
16327 more tables
16328 character entities
16329 and much more
16330 Try for 100% code coverage