76388d9b7db5d5b7503e9126a93f07f81166d572
[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 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 ###
143 ### Basic tests
144 ###
145 !! test
146 Blank input
147 !! input
148 !! result
149 !! end
150
151
152 !! test
153 Simple paragraph
154 !! input
155 This is a simple paragraph.
156 !! result
157 <p>This is a simple paragraph.
158 </p>
159 !! end
160
161 !! test
162 Paragraphs with extra newline spacing
163 !! input
164 foo
165
166 bar
167
168
169 baz
170
171
172
173 booz
174 !! result
175 <p>foo
176 </p><p>bar
177 </p><p><br />
178 baz
179 </p><p><br />
180 </p><p>booz
181 </p>
182 !! end
183
184 !! test
185 Paragraphs with newline spacing with comment lines in between
186 !! input
187 ----
188 a
189 <!--foo-->
190 b
191 ----
192 a
193 <!--foo--><!--More than 1 comment disables stripping of this line!-->
194 b
195 ----
196 a
197 <!--foo-->
198
199 b
200 ----
201 a
202
203 <!--foo-->
204 b
205 ----
206 a
207 <!--foo-->
208
209
210 b
211 ----
212 a
213
214
215 <!--foo-->
216 b
217 ----
218 !! result
219 <hr />
220 <p>a
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p>b
226 </p>
227 <hr />
228 <p>a
229 </p><p>b
230 </p>
231 <hr />
232 <p>a
233 </p><p>b
234 </p>
235 <hr />
236 <p>a
237 </p><p><br />
238 b
239 </p>
240 <hr />
241 <p>a
242 </p><p><br />
243 b
244 </p>
245 <hr />
246
247 !! end
248
249 !! test
250 Paragraphs with newline spacing with non-empty white-space lines in between
251 !! input
252 ----
253 a
254
255 b
256 ----
257 a
258
259
260 b
261 ----
262 !! result
263 <hr />
264 <p>a
265 </p><p>b
266 </p>
267 <hr />
268 <p>a
269 </p><p><br />
270 b
271 </p>
272 <hr />
273
274 !! end
275
276 !! test
277 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
278 !! input
279 ----
280 a
281 <!--foo-->
282 b
283 ----
284 a
285 <!--foo--><!--More than 1 comment disables stripping of this line!-->
286 b
287 ----
288 a
289
290 <!--foo-->
291 <!--bar-->
292 b
293 ----
294 a
295
296 <!--foo-->
297 <!--bar-->
298
299 b
300 ----
301 !! result
302 <hr />
303 <p>a
304 b
305 </p>
306 <hr />
307 <p>a
308 </p><p>b
309 </p>
310 <hr />
311 <p>a
312 </p><p>b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 <hr />
320
321 !! end
322
323 !! test
324 Extra newlines: More paragraphs with indented comment
325 !! input
326 a
327
328 <!--boo-->
329
330 b
331 !!result
332 <p>a
333 </p><p><br />
334 b
335 </p>
336 !!end
337
338 !! test
339 Extra newlines followed by heading
340 !! input
341 a
342
343
344
345 =b=
346 [[a]]
347
348
349 =b=
350 !! result
351 <p>a
352 </p><p><br />
353 </p>
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p><p><br />
357 </p>
358 <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>
359
360 !! end
361
362 !! test
363 Extra newlines between heading and content are swallowed
364 !! input
365 =b=
366
367
368
369 [[a]]
370 !! result
371 <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>
372 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
373 </p>
374 !! end
375
376 !! test
377 Parsing an URL
378 !! input
379 http://fr.wikipedia.org/wiki/🍺
380 <!-- EasterEgg we love beer, better be able be able to link to it -->
381 !! result
382 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
383 </p>
384 !! end
385
386 !! test
387 Simple list
388 !! input
389 * Item 1
390 * Item 2
391 !! result
392 <ul><li> Item 1
393 </li><li> Item 2
394 </li></ul>
395
396 !! end
397
398 !! test
399 Italics and bold
400 !! input
401 * plain
402 * plain''italic''plain
403 * plain''italic''plain''italic''plain
404 * plain'''bold'''plain
405 * plain'''bold'''plain'''bold'''plain
406 * plain''italic''plain'''bold'''plain
407 * plain'''bold'''plain''italic''plain
408 * plain''italic'''bold-italic'''italic''plain
409 * plain'''bold''bold-italic''bold'''plain
410 * plain'''''bold-italic'''italic''plain
411 * plain'''''bold-italic''bold'''plain
412 * plain''italic'''bold-italic'''''plain
413 * plain'''bold''bold-italic'''''plain
414 * plain l'''italic''plain
415 * plain l''''bold''' plain
416 !! result
417 <ul><li> plain
418 </li><li> plain<i>italic</i>plain
419 </li><li> plain<i>italic</i>plain<i>italic</i>plain
420 </li><li> plain<b>bold</b>plain
421 </li><li> plain<b>bold</b>plain<b>bold</b>plain
422 </li><li> plain<i>italic</i>plain<b>bold</b>plain
423 </li><li> plain<b>bold</b>plain<i>italic</i>plain
424 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
425 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
426 </li><li> plain<i><b>bold-italic</b>italic</i>plain
427 </li><li> plain<b><i>bold-italic</i>bold</b>plain
428 </li><li> plain<i>italic<b>bold-italic</b></i>plain
429 </li><li> plain<b>bold<i>bold-italic</i></b>plain
430 </li><li> plain l'<i>italic</i>plain
431 </li><li> plain l'<b>bold</b> plain
432 </li></ul>
433
434 !! end
435
436 # this example taken from the simple/Moon article
437 !! test
438 Italics and possessives
439 !! input
440 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
441 !! result
442 <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
443 </p>
444 !! end
445
446 ###
447 ### 2-quote opening sequence tests
448 ###
449 !! test
450 Italics and bold: 2-quote opening sequence: (2,2)
451 !! input
452 ''foo''
453 !! result
454 <p><i>foo</i>
455 </p>
456 !!end
457
458
459 !! test
460 Italics and bold: 2-quote opening sequence: (2,3)
461 !! input
462 ''foo'''
463 !! result
464 <p><i>foo'</i>
465 </p>
466 !!end
467
468
469 !! test
470 Italics and bold: 2-quote opening sequence: (2,4)
471 !! input
472 ''foo''''
473 !! result
474 <p><i>foo''</i>
475 </p>
476 !!end
477
478
479 !! test
480 Italics and bold: 2-quote opening sequence: (2,5) (php)
481 !! options
482 php
483 !! input
484 ''foo'''''
485 !! result
486 <p><i>foo</i>
487 </p>
488 !!end
489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
490 !! test
491 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
492 !! options
493 parsoid
494 !! input
495 ''foo'''''
496 !! result
497 <p><i>foo</i><b></b>
498 </p>
499 !!end
500
501
502 ###
503 ### 3-quote opening sequence tests
504 ###
505
506 !! test
507 Italics and bold: 3-quote opening sequence: (3,2)
508 !! input
509 '''foo''
510 !! result
511 <p>'<i>foo</i>
512 </p>
513 !!end
514
515
516 !! test
517 Italics and bold: 3-quote opening sequence: (3,3)
518 !! input
519 '''foo'''
520 !! result
521 <p><b>foo</b>
522 </p>
523 !!end
524
525
526 !! test
527 Italics and bold: 3-quote opening sequence: (3,4)
528 !! input
529 '''foo''''
530 !! result
531 <p><b>foo'</b>
532 </p>
533 !!end
534
535
536 !! test
537 Italics and bold: 3-quote opening sequence: (3,5) (php)
538 !! options
539 php
540 !! input
541 '''foo'''''
542 !! result
543 <p><b>foo</b>
544 </p>
545 !!end
546 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
547 !! test
548 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
549 !! options
550 parsoid
551 !! input
552 '''foo'''''
553 !! result
554 <p><b>foo<i></i></b>
555 </p>
556 !!end
557
558
559 ###
560 ### 4-quote opening sequence tests
561 ###
562
563 !! test
564 Italics and bold: 4-quote opening sequence: (4,2)
565 !! input
566 ''''foo''
567 !! result
568 <p>''<i>foo</i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 4-quote opening sequence: (4,3)
575 !! input
576 ''''foo'''
577 !! result
578 <p>'<b>foo</b>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 4-quote opening sequence: (4,4)
585 !! input
586 ''''foo''''
587 !! result
588 <p>'<b>foo'</b>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 4-quote opening sequence: (4,5) (php)
595 !! options
596 php
597 !! input
598 ''''foo'''''
599 !! result
600 <p>'<b>foo</b>
601 </p>
602 !!end
603 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
604 !! test
605 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
606 !! options
607 parsoid
608 !! input
609 ''''foo'''''
610 !! result
611 <p>'<b>foo<i></i></b>
612 </p>
613 !!end
614
615
616 ###
617 ### 5-quote opening sequence tests
618 ###
619
620 !! test
621 Italics and bold: 5-quote opening sequence: (5,2) (php)
622 !! options
623 php
624 !! input
625 '''''foo''
626 !! result
627 <p><b><i>foo</i></b>
628 </p>
629 !!end
630 # Parsoid reverses the nesting order, compared to the PHP parser
631 !! test
632 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
633 !! options
634 parsoid
635 !! input
636 '''''foo''
637 !! result
638 <p><i><b>foo</b></i>
639 </p>
640 !!end
641
642
643 !! test
644 Italics and bold: 5-quote opening sequence: (5,3)
645 !! input
646 '''''foo'''
647 !! result
648 <p><i><b>foo</b></i>
649 </p>
650 !!end
651
652
653 !! test
654 Italics and bold: 5-quote opening sequence: (5,4)
655 !! input
656 '''''foo''''
657 !! result
658 <p><i><b>foo'</b></i>
659 </p>
660 !!end
661
662
663 !! test
664 Italics and bold: 5-quote opening sequence: (5,5)
665 !! input
666 '''''foo'''''
667 !! result
668 <p><i><b>foo</b></i>
669 </p>
670 !!end
671
672 ###
673 ### multiple quote sequences in a line
674 ###
675 !! test
676 Italics and bold: multiple quote sequences: (2,4,2)
677 !! input
678 ''foo''''bar''
679 !! result
680 <p><i>foo'<b>bar</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: multiple quote sequences: (2,4,3)
687 !! input
688 ''foo''''bar'''
689 !! result
690 <p><i>foo'<b>bar</b></i>
691 </p>
692 !!end
693
694
695 !! test
696 Italics and bold: multiple quote sequences: (2,4,4)
697 !! input
698 ''foo''''bar''''
699 !! result
700 <p><i>foo'<b>bar'</b></i>
701 </p>
702 !!end
703
704
705 !! test
706 Italics and bold: multiple quote sequences: (3,4,2) (php)
707 !! options
708 php
709 !! input
710 '''foo''''bar''
711 !! result
712 <p><b>foo'</b>bar
713 </p>
714 !!end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
718 !! options
719 parsoid
720 !! input
721 '''foo''''bar''
722 !! result
723 <p><b>foo'</b>bar<i></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,3) (php)
730 !! options
731 php
732 !! input
733 '''foo''''bar'''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar'''
745 !! result
746 <p><b>foo'</b>bar<b></b>
747 </p>
748 !!end
749
750 ###
751 ### other quote tests
752 ###
753 !! test
754 Italics and bold: other quote tests: (2,3,5)
755 !! input
756 ''this is about '''foo's family'''''
757 !! result
758 <p><i>this is about <b>foo's family</b></i>
759 </p>
760 !!end
761
762
763 !! test
764 Italics and bold: other quote tests: (2,(3,3),2)
765 !! input
766 ''this is about '''foo's''' family''
767 !! result
768 <p><i>this is about <b>foo's</b> family</i>
769 </p>
770 !!end
771
772
773 !! test
774 Italics and bold: other quote tests: (3,2,3,2)
775 !! input
776 '''this is about ''foo'''s family''
777 !! result
778 <p><b>this is about <i>foo</i></b><i>s family</i>
779 </p>
780 !!end
781
782
783 # The Parsoid team believes the PHP parser's output on this test is wrong.
784 # It only checks for convert-to-bold-on-single-character-word when the word
785 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
786 # This means that the bold token in position 2 (0-indexed) gets converted by
787 # parsoid, but doesn't get changed by the PHP parser.
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3) (php)
790 !! options
791 php
792 !! input
793 '''this is about ''foo'''s family'''
794 !! result
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798 # This is the output the Parsoid team believes to be correct.
799 !! test
800 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
801 !! options
802 parsoid
803 !! input
804 '''this is about ''foo'''s family'''
805 !! result
806 <p><b>this is about <i>foo'</i>s family</b>
807 </p>
808 !!end
809
810
811 !! test
812 Italics and bold: other quote tests: (3,(2,2),3)
813 !! input
814 '''this is about ''foo's'' family'''
815 !! result
816 <p><b>this is about <i>foo's</i> family</b>
817 </p>
818 !!end
819
820
821 !! test
822 Italicized possessive
823 !! input
824 The ''[[Main Page]]'''s talk page.
825 !! result
826 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
827 </p>
828 !! end
829
830 !! test
831 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
832 (Requires tidy for PHP parser output to be fixed up)
833 !! options
834 parsoid=wt2html,wt2wt
835 !! input
836 {|
837 !''a!!''b
838 |''a||''b
839 |}
840 !! result
841 <table>
842 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
843 <td><i>a</i></td><td><i>b</i></td></tr>
844 </tbody></table>
845 !! end
846
847 ###
848 ### Non-html5 tags
849 ###
850
851 !! test
852 Non-html5 tags should be accepted
853 !! input
854 <center>''foo''</center>
855 <big>''foo''</big>
856 <font>''foo''</font>
857 <strike>''foo''</strike>
858 <tt>''foo''</tt>
859 !! result
860 <center><i>foo</i></center>
861 <p><big><i>foo</i></big>
862 <font><i>foo</i></font>
863 <strike><i>foo</i></strike>
864 <tt><i>foo</i></tt>
865 </p>
866 !! end
867
868 ###
869 ### <nowiki> test cases
870 ###
871
872 !! test
873 <nowiki> unordered list
874 !! input
875 <nowiki>* This is not an unordered list item.</nowiki>
876 !! result
877 <p>* This is not an unordered list item.
878 </p>
879 !! end
880
881 !! test
882 <nowiki> spacing
883 !! input
884 <nowiki>Lorem ipsum dolor
885
886 sed abit.
887 sed nullum.
888
889 :and a colon
890 </nowiki>
891 !! result
892 <p>Lorem ipsum dolor
893
894 sed abit.
895 sed nullum.
896
897 :and a colon
898
899 </p>
900 !! end
901
902 !! test
903 nowiki 3
904 !! input
905 :There is not nowiki.
906 :There is <nowiki>nowiki</nowiki>.
907
908 #There is not nowiki.
909 #There is <nowiki>nowiki</nowiki>.
910
911 *There is not nowiki.
912 *There is <nowiki>nowiki</nowiki>.
913 !! result
914 <dl><dd>There is not nowiki.
915 </dd><dd>There is nowiki.
916 </dd></dl>
917 <ol><li>There is not nowiki.
918 </li><li>There is nowiki.
919 </li></ol>
920 <ul><li>There is not nowiki.
921 </li><li>There is nowiki.
922 </li></ul>
923
924 !! end
925
926 !! test
927 Entities inside <nowiki>
928 !! input
929 <nowiki>&lt;</nowiki>
930 !! result
931 <p>&lt;
932 </p>
933 !! end
934
935 !! test
936 Entities inside template parameters
937 !! options
938 parsoid
939 !! input
940 {{echo|&ndash;}}
941 !! result
942 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
943 </p>
944 !! end
945
946 ###
947 ### Comments
948 ###
949 !! test
950 Comments and Indent-Pre
951 !! input
952 <!-- comment 1 --> asdf
953
954 <!-- comment 1 --> asdf
955 <!-- comment 2 -->
956
957 <!-- comment 1 --> asdf
958 <!-- comment 2 -->xyz
959
960 <!-- comment 1 --> asdf
961 <!-- comment 2 --> xyz
962 !! result
963 <pre>asdf
964 </pre>
965 <pre>asdf
966 </pre>
967 <pre>asdf
968 </pre>
969 <p>xyz
970 </p>
971 <pre>asdf
972 xyz
973 </pre>
974 !! end
975
976 !! test
977 Comment test 2a
978 !! input
979 asdf
980 <!-- comment 1 -->
981 jkl
982 !! result
983 <p>asdf
984 jkl
985 </p>
986 !! end
987
988 !! test
989 Comment test 2b
990 !! input
991 asdf
992 <!-- comment 1 -->
993
994 jkl
995 !! result
996 <p>asdf
997 </p><p>jkl
998 </p>
999 !! end
1000
1001 !! test
1002 Comment test 3
1003 !! input
1004 asdf
1005 <!-- comment 1 -->
1006 <!-- comment 2 -->
1007 jkl
1008 !! result
1009 <p>asdf
1010 jkl
1011 </p>
1012 !! end
1013
1014 !! test
1015 Comment test 4
1016 !! input
1017 asdf<!-- comment 1 -->jkl
1018 !! result
1019 <p>asdfjkl
1020 </p>
1021 !! end
1022
1023 !! test
1024 Comment spacing
1025 !! input
1026 a
1027 <!-- foo --> b <!-- bar -->
1028 c
1029 !! result
1030 <p>a
1031 </p>
1032 <pre> b
1033 </pre>
1034 <p>c
1035 </p>
1036 !! end
1037
1038 !! test
1039 Comment whitespace
1040 !! input
1041 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1042 !! result
1043
1044 !! end
1045
1046 !! test
1047 Comment semantics and delimiters
1048 !! input
1049 <!-- --><!----><!-----><!------>
1050 !! result
1051
1052 !! end
1053
1054 !! test
1055 Comment semantics and delimiters, redux
1056 !! input
1057 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1058 -- foo -- funky huh? ... -->
1059 !! result
1060
1061 !! end
1062
1063 !! test
1064 Comment semantics and delimiters: directors cut
1065 !! input
1066 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1067 everything starting with < followed by !-- until the first -- and > we see,
1068 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1069 -->-->
1070 !! result
1071 <p>--&gt;
1072 </p>
1073 !! end
1074
1075 !! test
1076 Comment semantics: nesting
1077 !! input
1078 <!--<!-- no, we're not going to do anything fancy here -->-->
1079 !! result
1080 <p>--&gt;
1081 </p>
1082 !! end
1083
1084 !! test
1085 Comment semantics: unclosed comment at end
1086 !! input
1087 <!--This comment will run out to the end of the document
1088 !! result
1089
1090 !! end
1091
1092 !! test
1093 Comment in template title
1094 !! input
1095 {{f<!---->oo}}
1096 !! result
1097 <p>FOO
1098 </p>
1099 !! end
1100
1101 !! test
1102 Comment on its own line post-expand
1103 !! input
1104 a
1105 {{blank}}<!---->
1106 b
1107 !! result
1108 <p>a
1109 </p><p>b
1110 </p>
1111 !! end
1112
1113 !! test
1114 Comment on its own line post-expand with non-significant whitespace
1115 !! input
1116 a
1117 {{blank}} <!---->
1118 b
1119 !! result
1120 <p>a
1121 </p><p>b
1122 </p>
1123 !! end
1124
1125 ###
1126 ### paragraph wrapping tests
1127 ###
1128 !! test
1129 No block tags
1130 !! input
1131 a
1132
1133 b
1134 !! result
1135 <p>a
1136 </p><p>b
1137 </p>
1138 !! end
1139 !! test
1140 Block tag on one line
1141 !! input
1142 a <div>foo</div>
1143
1144 b
1145 !! result
1146 a <div>foo</div>
1147 <p>b
1148 </p>
1149 !! end
1150
1151 !! test
1152 Block tag on both lines
1153 !! input
1154 a <div>foo</div>
1155
1156 b <div>foo</div>
1157 !! result
1158 a <div>foo</div>
1159 b <div>foo</div>
1160
1161 !! end
1162
1163 !! test
1164 Multiple lines without block tags
1165 !! input
1166 <div>foo</div> a
1167 b
1168 c
1169 d<!--foo--> e
1170 x <div>foo</div> z
1171 !! result
1172 <div>foo</div> a
1173 <p>b
1174 c
1175 d e
1176 </p>
1177 x <div>foo</div> z
1178
1179 !! end
1180
1181 !! test
1182 Empty lines between lines with block tags
1183 !! input
1184 <div></div>
1185
1186
1187 <div></div>a
1188
1189 b
1190 <div>a</div>b
1191
1192 <div>b</div>d
1193
1194
1195 <div>e</div>
1196 !! result
1197 <div></div>
1198 <p><br />
1199 </p>
1200 <div></div>a
1201 <p>b
1202 </p>
1203 <div>a</div>b
1204 <div>b</div>d
1205 <p><br />
1206 </p>
1207 <div>e</div>
1208
1209 !! end
1210
1211 ###
1212 ### Preformatted text
1213 ###
1214 !! test
1215 Preformatted text
1216 !! input
1217 This is some
1218 Preformatted text
1219 With ''italic''
1220 And '''bold'''
1221 And a [[Main Page|link]]
1222 !! result
1223 <pre>This is some
1224 Preformatted text
1225 With <i>italic</i>
1226 And <b>bold</b>
1227 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1228 </pre>
1229 !! end
1230
1231 !! test
1232 Ident preformatting with inline content
1233 !! input
1234 a
1235 ''b''
1236 !! result
1237 <pre>a
1238 <i>b</i>
1239 </pre>
1240 !! end
1241
1242 !! test
1243 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1244 !! input
1245 <pre><nowiki>
1246 <b>
1247 <cite>
1248 <em>
1249 </nowiki></pre>
1250 !! result
1251 <pre>
1252 &lt;b&gt;
1253 &lt;cite&gt;
1254 &lt;em&gt;
1255 </pre>
1256
1257 !! end
1258
1259 !! test
1260 Regression with preformatted in <center>
1261 !! input
1262 <center>
1263 Blah
1264 </center>
1265 !! result
1266 <center>
1267 <pre>Blah
1268 </pre>
1269 </center>
1270
1271 !! end
1272
1273 # Expected output in the following test is not really expected (there should be
1274 # <pre> in the output) -- it's only testing for well-formedness.
1275 !! test
1276 Bug 6200: Preformatted in <blockquote>
1277 !! input
1278 <blockquote>
1279 Blah
1280 </blockquote>
1281 !! result
1282 <blockquote>
1283 Blah
1284 </blockquote>
1285
1286 !! end
1287
1288 !! test
1289 <pre> with attributes (bug 3202)
1290 !! input
1291 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1292 !! result
1293 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1294
1295 !! end
1296
1297 !! test
1298 <pre> with width attribute (bug 3202)
1299 !! input
1300 <pre width="8">Narrow screen goodies</pre>
1301 !! result
1302 <pre width="8">Narrow screen goodies</pre>
1303
1304 !! end
1305
1306 !! test
1307 <pre> with forbidden attribute (bug 3202)
1308 !! input
1309 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1310 !! result
1311 <pre width="8">Narrow screen goodies</pre>
1312
1313 !! end
1314
1315 !! test
1316 Entities inside <pre>
1317 !! input
1318 <pre>&lt;</pre>
1319 !! result
1320 <pre>&lt;</pre>
1321
1322 !! end
1323
1324 !! test
1325 <pre> with forbidden attribute values (bug 3202)
1326 !! input
1327 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1328 !! result
1329 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1330
1331 !! end
1332
1333 !! test
1334 <nowiki> inside <pre> (bug 13238)
1335 !! input
1336 <pre>
1337 <nowiki>
1338 </pre>
1339 <pre>
1340 <nowiki></nowiki>
1341 </pre>
1342 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1343 !! result
1344 <pre>
1345 &lt;nowiki&gt;
1346 </pre>
1347 <pre>
1348
1349 </pre>
1350 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1351
1352 !! end
1353
1354 !! test
1355 <nowiki> and <pre> preference (first one wins)
1356 !! input
1357 <pre>
1358 <nowiki>
1359 </pre>
1360 </nowiki>
1361 </pre>
1362
1363 <nowiki>
1364 <pre>
1365 <nowiki>
1366 </pre>
1367 </nowiki>
1368 </pre>
1369
1370 !! result
1371 <pre>
1372 &lt;nowiki&gt;
1373 </pre>
1374 <p>&lt;/nowiki&gt;
1375 &lt;/pre&gt;
1376 </p><p>
1377 &lt;pre&gt;
1378 &lt;nowiki&gt;
1379 &lt;/pre&gt;
1380
1381 &lt;/pre&gt;
1382 </p>
1383 !! end
1384
1385 !! test
1386 </pre> inside nowiki
1387 !! input
1388 <nowiki></pre></nowiki>
1389 !! result
1390 <p>&lt;/pre&gt;
1391 </p>
1392 !! end
1393
1394 !!test
1395 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1396 !!input
1397 {{echo|}}
1398 !!result
1399
1400 !!end
1401
1402 !!test
1403 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1404 !!input
1405 {{echo|
1406 foo}}
1407 !!result
1408 <p>foo
1409 </p>
1410 !!end
1411
1412 !! test
1413 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1414 !! input
1415 {{echo|a
1416 b}}
1417 !!result
1418 <pre>a
1419 </pre>
1420 <p>b
1421 </p>
1422 !!end
1423
1424 !! test
1425 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1426 !! input
1427 {{echo|a
1428 b
1429 c
1430 d
1431 e
1432 }}
1433 !!result
1434 <pre>a
1435 </pre>
1436 <p>b
1437 c
1438 </p>
1439 <pre>d
1440 </pre>
1441 <p>e
1442 </p>
1443 !!end
1444
1445 !!test
1446 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1447 !!input
1448 {{echo| foo}}
1449
1450 {{echo| foo}}{{echo| bar}}
1451
1452 {{echo| foo}}
1453 {{echo| bar}}
1454
1455 {{echo|<!--cmt--> foo}}
1456
1457 <!--cmt-->{{echo| foo}}
1458
1459 {{echo|{{echo| }}bar}}
1460 !!result
1461 <pre>foo
1462 </pre>
1463 <pre>foo bar
1464 </pre>
1465 <pre>foo
1466 bar
1467 </pre>
1468 <pre>foo
1469 </pre>
1470 <pre>foo
1471 </pre>
1472 <pre>bar
1473 </pre>
1474 !!end
1475
1476 !! test
1477 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1478 !! input
1479 {{echo| }}a
1480
1481 {{echo|
1482 }}a
1483
1484 {{echo|
1485 b}}
1486
1487 {{echo|a
1488 }}b
1489
1490 {{echo|a
1491 }} b
1492 !!result
1493 <pre>a
1494 </pre>
1495 <p><br />
1496 </p>
1497 <pre>a
1498 </pre>
1499 <p><br />
1500 </p>
1501 <pre>b
1502 </pre>
1503 <p>a
1504 </p>
1505 <pre>b
1506 </pre>
1507 <p>a
1508 </p>
1509 <pre>b
1510 </pre>
1511 !!end
1512
1513 !! test
1514 Templates: Single-line variant of parameter whitespace stripping test
1515 !! input
1516 {{echo| a}}
1517
1518 {{echo|1= a}}
1519
1520 {{echo|{{echo| a}}}}
1521
1522 {{echo|1={{echo| a}}}}
1523 !! result
1524 <pre>a
1525 </pre>
1526 <p>a
1527 </p>
1528 <pre>a
1529 </pre>
1530 <p>a
1531 </p>
1532 !! end
1533
1534 !! test
1535 Templates: Strip whitespace from named parameters, but not positional ones
1536 !! input
1537 {{echo|
1538 foo}}
1539
1540 {{echo|
1541 * foo}}
1542
1543 {{echo| 1 =
1544 foo}}
1545
1546 {{echo| 1 =
1547 * foo}}
1548 !! result
1549 <pre>foo
1550 </pre>
1551 <p><br />
1552 </p>
1553 <ul><li> foo
1554 </li></ul>
1555 <p>foo
1556 </p>
1557 <ul><li> foo
1558 </li></ul>
1559
1560 !! end
1561
1562 !! test
1563 Templates: Dont strip whitespace from whitespace/comment-only arguments
1564 !! input
1565 {{echo| }}
1566 {{echo|<!--cmt-->}}
1567 {{echo| <!--cmt--> }}
1568 !! result
1569 <p><br />
1570 </p>
1571 !! end
1572
1573 !! test
1574 Templates: Parsoid parameter escaping test 1
1575 !! options
1576 parsoid
1577 !! input
1578 {{echo|[foo]|{{echo|[bar]}}}}
1579 !! result
1580 <p about="#mwt1" typeof="mw:Transclusion"
1581 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>
1582 !! end
1583
1584 !! test
1585 Parsoid: Pipes in external links in template parameter
1586 !! options
1587 parsoid
1588 !! input
1589 {{echo|[{{echo|http://example.com}} link]}}
1590 !! result
1591 <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>
1592 !! end
1593
1594 !! test
1595 Parsoid: pipe in transclusion parameter
1596 !! options
1597 parsoid
1598 !! input
1599 {{echo|http://foo.com/a&#124;b}}
1600 !! result
1601 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1602 typeof="mw:Transclusion"
1603 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>
1604 !! end
1605
1606 !! test
1607 Parsoid: Pipe in external link target and content in template parameter
1608 !! options
1609 parsoid=html2wt,wt2wt
1610 !! input
1611 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1612 !! result
1613 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1614 typeof="mw:Transclusion"
1615 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1616 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1617 !! end
1618
1619 !! test
1620 Templates: Dont escape already nowiki-escaped text in template parameters
1621 !! options
1622 parsoid=html2wt,wt2wt
1623 !! input
1624 {{echo|foo<nowiki>|</nowiki>bar}}
1625 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1626 {{echo|<nowiki></nowiki>}}
1627 !! result
1628 <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>
1629 <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>
1630 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1631 </p>
1632 !! end
1633
1634 ###
1635 ### Parsoid-centric tests for testing RT edge cases for pre
1636 ###
1637
1638 !!test
1639 1a. Indent-Pre and Comments
1640 !!input
1641 a
1642 <!--a-->
1643 c
1644 !!result
1645 <pre>a
1646 </pre>
1647 <p>c
1648 </p>
1649 !!end
1650
1651 !!test
1652 1b. Indent-Pre and Comments
1653 !!input
1654 a
1655 <!--a-->
1656 c
1657 !!result
1658 <pre>a
1659 </pre>
1660 <p>c
1661 </p>
1662 !!end
1663
1664 !!test
1665 1c. Indent-Pre and Comments
1666 !!input
1667 <!--a--> a
1668
1669 <!--a--> a
1670 !!result
1671 <pre> a
1672 </pre>
1673 <pre> a
1674 </pre>
1675 !!end
1676
1677 !!test
1678 2a. Indent-Pre and tables
1679 !!input
1680 {|
1681 |-
1682 !h1!!h2
1683 |foo||bar
1684 |}
1685 !!result
1686 <table>
1687
1688 <tr>
1689 <th>h1</th>
1690 <th>h2
1691 </th>
1692 <td>foo</td>
1693 <td>bar
1694 </td></tr></table>
1695
1696 !!end
1697
1698 !!test
1699 2b. Indent-Pre and tables
1700 !!input
1701 {|
1702 |-
1703 |foo
1704 |}
1705 !!result
1706 <table>
1707
1708 <tr>
1709 <td>foo
1710 </td></tr></table>
1711
1712 !!end
1713
1714 !!test
1715 2c. Indent-Pre and tables (bug 42252)
1716 !!input
1717 {|
1718 |+ foo
1719 ! | bar
1720 |}
1721 !!result
1722 <table>
1723 <caption> foo
1724 </caption>
1725 <tr>
1726 <th> bar
1727 </th></tr></table>
1728
1729 !!end
1730
1731 !!test
1732 3a. Indent-Pre and block tags (single-line html)
1733 !!input
1734 <p> foo </p>
1735 <div> foo </div>
1736 <span> foo </span>
1737 !!result
1738 <p> foo </p>
1739 <div> foo </div>
1740 <pre><span> foo </span>
1741 </pre>
1742 !!end
1743
1744 !!test
1745 3b. Indent-Pre and block tags (pre-content on separate line)
1746 !!input
1747 <p>
1748 foo
1749 </p>
1750
1751 <div>
1752 foo
1753 </div>
1754
1755 <center>
1756 foo
1757 </center>
1758
1759 <blockquote>
1760 foo
1761 </blockquote>
1762
1763 <table><tr><td>
1764 foo
1765 </td></tr></table>
1766
1767 <ul><li>
1768 foo
1769 </li></ul>
1770
1771 !!result
1772 <p>
1773 foo
1774 </p>
1775 <div>
1776 <pre>foo
1777 </pre>
1778 </div>
1779 <center>
1780 <pre>foo
1781 </pre>
1782 </center>
1783 <blockquote>
1784 foo
1785 </blockquote>
1786 <table><tr><td>
1787 <pre>foo
1788 </pre>
1789 </td></tr></table>
1790 <ul><li>
1791 foo
1792 </li></ul>
1793
1794 !!end
1795
1796 !!test
1797 4. Multiple spaces at start-of-line
1798 !!input
1799 <p> foo </p>
1800 foo
1801 {|
1802 |foo
1803 |}
1804 !!result
1805 <p> foo </p>
1806 <pre> foo
1807 </pre>
1808 <table>
1809 <tr>
1810 <td>foo
1811 </td></tr></table>
1812
1813 !!end
1814
1815 !! test
1816 5. White-space in indent-pre
1817 NOTE: the white-space char on 2nd line is significant
1818 !! input
1819 a<br/>
1820
1821 b
1822 !! result
1823 <pre>a<br />
1824
1825 b
1826 </pre>
1827 !! end
1828
1829 ###
1830 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1831 ###
1832
1833 !!test
1834 HTML-pre: 1. embedded newlines
1835 !!input
1836 <pre>foo</pre>
1837
1838 <pre>
1839 foo
1840 </pre>
1841
1842 <pre>
1843
1844 foo
1845 </pre>
1846
1847 <pre>
1848
1849
1850 foo
1851 </pre>
1852 !!result
1853 <pre>foo</pre>
1854 <pre>
1855 foo
1856 </pre>
1857 <pre>
1858
1859 foo
1860 </pre>
1861 <pre>
1862
1863
1864 foo
1865 </pre>
1866
1867 !!end
1868
1869 !!test
1870 HTML-pre: 2: indented text
1871 !!input
1872 <pre>
1873 foo
1874 </pre>
1875 !!result
1876 <pre>
1877 foo
1878 </pre>
1879
1880 !!end
1881
1882 !!test
1883 HTML-pre: 3: other wikitext
1884 !!input
1885 <pre>
1886 * foo
1887 # bar
1888 = no-h =
1889 '' no-italic ''
1890 [[ NoLink ]]
1891 </pre>
1892 !!result
1893 <pre>
1894 * foo
1895 # bar
1896 = no-h =
1897 '' no-italic ''
1898 [[ NoLink ]]
1899 </pre>
1900
1901 !!end
1902
1903 ###
1904 ### Definition lists
1905 ###
1906 !! test
1907 Simple definition
1908 !! input
1909 ; name : Definition
1910 !! result
1911 <dl><dt> name&#160;</dt><dd> Definition
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition list for indentation only
1918 !! input
1919 : Indented text
1920 !! result
1921 <dl><dd> Indented text
1922 </dd></dl>
1923
1924 !! end
1925
1926 !! test
1927 Definition list with no space
1928 !! input
1929 ;name:Definition
1930 !! result
1931 <dl><dt>name</dt><dd>Definition
1932 </dd></dl>
1933
1934 !!end
1935
1936 !! test
1937 Definition list with URL link
1938 !! input
1939 ; http://example.com/ : definition
1940 !! result
1941 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition list with bracketed URL link
1948 !! input
1949 ;[http://www.example.com/ Example]:Something about it
1950 !! result
1951 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1952 </dd></dl>
1953
1954 !! end
1955
1956 !! test
1957 Definition list with wikilink containing colon
1958 !! input
1959 ; [[Help:FAQ]]: The least-read page on Wikipedia
1960 !! result
1961 <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
1962 </dd></dl>
1963
1964 !! end
1965
1966 # At Brion's and JeLuF's insistence... :)
1967 !! test
1968 Definition list with news link containing colon
1969 !! input
1970 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1971 !! result
1972 <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!
1973 </dd></dl>
1974
1975 !! end
1976
1977 !! test
1978 Malformed definition list with colon
1979 !! input
1980 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1981 !! result
1982 <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
1983 </dt></dl>
1984
1985 !! end
1986
1987 !! test
1988 Definition lists: colon in external link text
1989 !! input
1990 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1991 !! result
1992 <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
1993 </dd></dl>
1994
1995 !! end
1996
1997 !! test
1998 Definition lists: colon in HTML attribute
1999 !! input
2000 ;<b style="display: inline">bold</b>
2001 !! result
2002 <dl><dt><b style="display: inline">bold</b>
2003 </dt></dl>
2004
2005 !! end
2006
2007 !! test
2008 Definition lists: self-closed tag
2009 !! input
2010 ;one<br/>two : two-line fun
2011 !! result
2012 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2013 </dd></dl>
2014
2015 !! end
2016
2017 !! test
2018 Bug 11748: Literal closing tags
2019 !! input
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 !! result
2027 <dl>
2028 <dt>test 1</dt>
2029 <dd>test test test test test</dd>
2030 <dt>test 2</dt>
2031 <dd>test test test test test</dd>
2032 </dl>
2033
2034 !! end
2035
2036 !! test
2037 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2038 !! input
2039 <ul><li>
2040 ; term : description
2041 * unordered
2042 </li>
2043 </ul>
2044 !! result
2045 <ul><li>
2046 <dl><dt> term&#160;</dt><dd> description
2047 </dd></dl>
2048 <ul><li> unordered
2049 </li></ul>
2050 </li>
2051 </ul>
2052
2053 !! end
2054
2055 !! test
2056
2057 Definition list with empty definition and following paragraph
2058 !! input
2059 ; term:
2060 Paragraph text
2061 !! result
2062 <dl><dt> term</dt><dd>
2063 </dd></dl>
2064 <p>Paragraph text
2065 </p>
2066 !! end
2067
2068 !! test
2069 Nested definition lists using html syntax
2070 !! input
2071 <dl><dd>
2072 <dl>
2073 <dd>Foo</dd>
2074 </dl>
2075 </dd></dl>
2076 !! result
2077 <dl><dd>
2078 <dl>
2079 <dd>Foo</dd>
2080 </dl>
2081 </dd></dl>
2082
2083 !! end
2084
2085 !! test
2086 Definition Lists: No nesting: Multiple dd's
2087 !! input
2088 ;x
2089 :a
2090 :b
2091 !! result
2092 <dl><dt>x
2093 </dt><dd>a
2094 </dd><dd>b
2095 </dd></dl>
2096
2097 !! end
2098
2099 !! test
2100 Definition Lists: Indentation: Regular
2101 !! input
2102 :i1
2103 ::i2
2104 :::i3
2105 !! result
2106 <dl><dd>i1
2107 <dl><dd>i2
2108 <dl><dd>i3
2109 </dd></dl>
2110 </dd></dl>
2111 </dd></dl>
2112
2113 !! end
2114
2115 !! test
2116 Definition Lists: Indentation: Missing 1st level
2117 !! input
2118 ::i2
2119 :::i3
2120 !! result
2121 <dl><dd><dl><dd>i2
2122 <dl><dd>i3
2123 </dd></dl>
2124 </dd></dl>
2125 </dd></dl>
2126
2127 !! end
2128
2129 !! test
2130 Definition Lists: Indentation: Multi-level indent
2131 !! input
2132 :::i3
2133 !! result
2134 <dl><dd><dl><dd><dl><dd>i3
2135 </dd></dl>
2136 </dd></dl>
2137 </dd></dl>
2138
2139 !! end
2140
2141 !! test
2142 Definition Lists: Hacky use to indent tables
2143 !! input
2144 ::{|
2145 |foo
2146 |bar
2147 |}
2148 this text
2149 should be left alone
2150 !! result
2151 <dl><dd><dl><dd><table>
2152 <tr>
2153 <td>foo
2154 </td>
2155 <td>bar
2156 </td></tr></table></dd></dl></dd></dl>
2157 <p>this text
2158 should be left alone
2159 </p>
2160 !! end
2161 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2162 ## as an empty dt item. It also ignores all but the last ";" when followed
2163 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2164 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2165 ## ";"s.
2166 ##
2167 ## Ex: ";;t2 ::d2" is transformed into:
2168 ##
2169 ## <dl>
2170 ## <dt>t2 </dt>
2171 ## <dd>
2172 ## <dl>
2173 ## <dt></dt>
2174 ## <dd>d2</dd>
2175 ## </dl>
2176 ## </dd>
2177 ## </dl>
2178 ##
2179 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2180 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2181 ##
2182 ## <dl>
2183 ## <dt>
2184 ## <dl>
2185 ## <dt>t2 </dt>
2186 ## <dd>:d2</dd>
2187 ## </dl>
2188 ## </dt>
2189 ## </dl>
2190 ##
2191 ## All Parsoid only definition list tests have this difference.
2192 ##
2193 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2194 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2195
2196 !! test
2197 Table / list interaction: indented table with lists in table contents
2198 !! input
2199 :{|
2200 |-
2201 | a
2202 * b
2203 |-
2204 | c
2205 * d
2206 |}
2207 !! result
2208 <dl><dd><table>
2209
2210 <tr>
2211 <td> a
2212 <ul><li> b
2213 </li></ul>
2214 </td></tr>
2215 <tr>
2216 <td> c
2217 <ul><li> d
2218 </li></ul>
2219 </td></tr></table></dd></dl>
2220
2221 !! end
2222
2223 !!test
2224 Table / list interaction: lists nested in tables nested in indented lists
2225 !!input
2226 :{|
2227 |
2228 :a
2229 :b
2230 |
2231 *c
2232 *d
2233 |}
2234
2235 *e
2236 *f
2237 !!result
2238 <dl><dd><table>
2239 <tr>
2240 <td>
2241 <dl><dd>a
2242 </dd><dd>b
2243 </dd></dl>
2244 </td>
2245 <td>
2246 <ul><li>c
2247 </li><li>d
2248 </li></ul>
2249 </td></tr></table></dd></dl>
2250 <ul><li>e
2251 </li><li>f
2252 </li></ul>
2253
2254 !!end
2255
2256 !! test
2257 Definition Lists: Nesting: Multi-level (Parsoid only)
2258 !! options
2259 parsoid
2260 !! input
2261 ;t1 :d1
2262 ;;t2 ::d2
2263 ;;;t3 :::d3
2264 !! result
2265 <dl>
2266 <dt>t1 </dt>
2267 <dd>d1</dd>
2268 <dt>
2269 <dl>
2270 <dt>t2 </dt>
2271 <dd>:d2</dd>
2272 <dt>
2273 <dl>
2274 <dt>t3 </dt>
2275 <dd>::d3</dd>
2276 </dl>
2277 </dt>
2278 </dl>
2279 </dt>
2280 </dl>
2281
2282
2283 !! end
2284
2285
2286 !! test
2287 Definition Lists: Nesting: Test 2 (Parsoid only)
2288 !! options
2289 parsoid
2290 !! input
2291 ;t1
2292 ::d2
2293 !! result
2294 <dl>
2295 <dt>t1</dt>
2296 <dd>
2297 <dl>
2298 <dd>d2</dd>
2299 </dl>
2300 </dd>
2301 </dl>
2302
2303 !! end
2304
2305
2306 !! test
2307 Definition Lists: Nesting: Test 3 (Parsoid only)
2308 !! options
2309 parsoid
2310 !! input
2311 :;t1
2312 ::::d2
2313 !! result
2314 <dl>
2315 <dd>
2316 <dl>
2317 <dt>t1</dt>
2318 <dd>
2319 <dl>
2320 <dd>
2321 <dl>
2322 <dd>d2</dd>
2323 </dl>
2324 </dd>
2325 </dl>
2326 </dd>
2327 </dl>
2328 </dd>
2329 </dl>
2330
2331 !! end
2332
2333
2334 !! test
2335 Definition Lists: Nesting: Test 4
2336 !! input
2337 ::;t3
2338 :::d3
2339 !! result
2340 <dl><dd><dl><dd><dl><dt>t3
2341 </dt><dd>d3
2342 </dd></dl>
2343 </dd></dl>
2344 </dd></dl>
2345
2346 !! end
2347
2348
2349 ## The Parsoid team believes the following three test exposes a
2350 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2351 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2352 !! test
2353 Definition Lists: Mixed Lists: Test 1 (php)
2354 !! options
2355 php
2356 !! input
2357 :;* foo
2358 ::* bar
2359 :; baz
2360 !! result
2361 <dl><dd><dl><dt><ul><li> foo
2362 </li><li> bar
2363 </li></ul>
2364 </dt></dl>
2365 <dl><dt> baz
2366 </dt></dl>
2367 </dd></dl>
2368
2369 !! end
2370 !! test
2371 Definition Lists: Mixed Lists: Test 1 (parsoid)
2372 !! options
2373 parsoid
2374 !! input
2375 :;* foo
2376 ::* bar
2377 :; baz
2378 !! result
2379 <dl><dd><dl><dt><ul><li> foo
2380 </li></ul></dt><dd><ul><li> bar
2381 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2382 !! end
2383
2384 !! test
2385 Definition Lists: Mixed Lists: Test 2
2386 !! input
2387 *: d1
2388 *: d2
2389 !! result
2390 <ul><li><dl><dd> d1
2391 </dd><dd> d2
2392 </dd></dl>
2393 </li></ul>
2394
2395 !! end
2396
2397
2398 !! test
2399 Definition Lists: Mixed Lists: Test 3
2400 !! input
2401 *::: d1
2402 *::: d2
2403 !! result
2404 <ul><li><dl><dd><dl><dd><dl><dd> d1
2405 </dd><dd> d2
2406 </dd></dl>
2407 </dd></dl>
2408 </dd></dl>
2409 </li></ul>
2410
2411 !! end
2412
2413
2414 !! test
2415 Definition Lists: Mixed Lists: Test 4
2416 !! input
2417 *;d1 :d2
2418 *;d3 :d4
2419 !! result
2420 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2421 </dd><dt>d3&#160;</dt><dd>d4
2422 </dd></dl>
2423 </li></ul>
2424
2425 !! end
2426
2427
2428 !! test
2429 Definition Lists: Mixed Lists: Test 5
2430 !! input
2431 *:d1
2432 *:: d2
2433 !! result
2434 <ul><li><dl><dd>d1
2435 <dl><dd> d2
2436 </dd></dl>
2437 </dd></dl>
2438 </li></ul>
2439
2440 !! end
2441
2442
2443 !! test
2444 Definition Lists: Mixed Lists: Test 6
2445 !! input
2446 #*:d1
2447 #*::: d3
2448 !! result
2449 <ol><li><ul><li><dl><dd>d1
2450 <dl><dd><dl><dd> d3
2451 </dd></dl>
2452 </dd></dl>
2453 </dd></dl>
2454 </li></ul>
2455 </li></ol>
2456
2457 !! end
2458
2459
2460 !! test
2461 Definition Lists: Mixed Lists: Test 7
2462 !! input
2463 :* d1
2464 :* d2
2465 !! result
2466 <dl><dd><ul><li> d1
2467 </li><li> d2
2468 </li></ul>
2469 </dd></dl>
2470
2471 !! end
2472
2473
2474 !! test
2475 Definition Lists: Mixed Lists: Test 8
2476 !! input
2477 :* d1
2478 ::* d2
2479 !! result
2480 <dl><dd><ul><li> d1
2481 </li></ul>
2482 <dl><dd><ul><li> d2
2483 </li></ul>
2484 </dd></dl>
2485 </dd></dl>
2486
2487 !! end
2488
2489
2490 !! test
2491 Definition Lists: Mixed Lists: Test 9
2492 !! input
2493 *;foo :bar
2494 !! result
2495 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2496 </dd></dl>
2497 </li></ul>
2498
2499 !! end
2500
2501
2502 !! test
2503 Definition Lists: Mixed Lists: Test 10
2504 !! input
2505 *#;foo :bar
2506 !! result
2507 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2508 </dd></dl>
2509 </li></ol>
2510 </li></ul>
2511
2512 !! end
2513
2514 # The Parsoid team disagrees with the PHP parser's seemingly-random
2515 # rules regarding dd/dt on the next two tests. Parsoid is more
2516 # consistent, and recognizes the shared nesting and keeps the
2517 # still-open tags around until the nesting is complete.
2518
2519 !! test
2520 Definition Lists: Mixed Lists: Test 11 (php)
2521 !! options
2522 php
2523 !! input
2524 *#*#;*;;foo :bar
2525 *#*#;boo :baz
2526 !! result
2527 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2528 </dt></dl>
2529 </dd></dl>
2530 </li></ul>
2531 </dd></dl>
2532 <dl><dt>boo&#160;</dt><dd>baz
2533 </dd></dl>
2534 </li></ol>
2535 </li></ul>
2536 </li></ol>
2537 </li></ul>
2538
2539 !! end
2540 !! test
2541 Definition Lists: Mixed Lists: Test 11 (parsoid)
2542 !! options
2543 parsoid
2544 !! input
2545 *#*#;*;;foo :bar
2546 *#*#;boo :baz
2547 !! result
2548 <ul>
2549 <li>
2550 <ol>
2551 <li>
2552 <ul>
2553 <li>
2554 <ol>
2555 <li>
2556 <dl>
2557 <dt>
2558 <ul>
2559 <li>
2560 <dl>
2561 <dt>
2562 <dl>
2563 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2564 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2565 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2566 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2567 !! end
2568
2569
2570 !! test
2571 Definition Lists: Weird Ones: Test 1 (php)
2572 !! options
2573 php
2574 !! input
2575 *#;*::;; foo : bar (who uses this?)
2576 !! result
2577 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2578 </dt></dl>
2579 </dd></dl>
2580 </dd></dl>
2581 </dd></dl>
2582 </li></ul>
2583 </dd></dl>
2584 </li></ol>
2585 </li></ul>
2586
2587 !! end
2588 !! test
2589 Definition Lists: Weird Ones: Test 1 (parsoid)
2590 !! options
2591 parsoid
2592 !! input
2593 *#;*::;; foo : bar (who uses this?)
2594 !! result
2595 <ul>
2596 <li>
2597 <ol>
2598 <li>
2599 <dl>
2600 <dt>
2601 <ul>
2602 <li>
2603 <dl>
2604 <dd>
2605 <dl>
2606 <dd>
2607 <dl>
2608 <dt>
2609 <dl>
2610 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2611 <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>
2612 !! end
2613
2614 ###
2615 ### External links
2616 ###
2617 !! test
2618 External links: non-bracketed
2619 !! input
2620 Non-bracketed: http://example.com
2621 !! result
2622 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2623 </p>
2624 !! end
2625
2626 !! test
2627 External links: numbered
2628 !! input
2629 Numbered: [http://example.com]
2630 Numbered: [http://example.net]
2631 Numbered: [http://example.com]
2632 !! result
2633 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2634 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2635 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2636 </p>
2637 !!end
2638
2639 !! test
2640 External links: specified text
2641 !! input
2642 Specified text: [http://example.com link]
2643 !! result
2644 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2645 </p>
2646 !!end
2647
2648 !! test
2649 External links: trail
2650 !! input
2651 Linktrails should not work for external links: [http://example.com link]s
2652 !! result
2653 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2654 </p>
2655 !! end
2656
2657 !! test
2658 External links: dollar sign in URL
2659 !! input
2660 http://example.com/1$2345
2661 !! result
2662 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2663 </p>
2664 !! end
2665
2666 !! test
2667 External links: dollar sign in URL (named)
2668 !! input
2669 [http://example.com/1$2345]
2670 !! result
2671 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2672 </p>
2673 !!end
2674
2675 !! test
2676 External links: open square bracket forbidden in URL (bug 4377)
2677 !! input
2678 http://example.com/1[2345
2679 !! result
2680 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2681 </p>
2682 !! end
2683
2684 !! test
2685 External links: open square bracket forbidden in URL (named) (bug 4377)
2686 !! input
2687 [http://example.com/1[2345]
2688 !! result
2689 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2690 </p>
2691 !!end
2692
2693 !! test
2694 External links: nowiki in URL link text (bug 6230)
2695 !!input
2696 [http://example.com/ <nowiki>''example site''</nowiki>]
2697 !! result
2698 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2699 </p>
2700 !! end
2701
2702 !! test
2703 External links: newline forbidden in text (bug 6230 regression check)
2704 !! input
2705 [http://example.com/ first
2706 second]
2707 !! result
2708 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2709 second]
2710 </p>
2711 !!end
2712
2713 !! test
2714 External links: Pipe char between url and text
2715 !! input
2716 [http://example.com | link]
2717 !! result
2718 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2719 </p>
2720 !!end
2721
2722 !! test
2723 External links: protocol-relative URL in brackets
2724 !! input
2725 [//example.com/ Test]
2726 !! result
2727 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2728 </p>
2729 !! end
2730
2731 !! test
2732 External links: protocol-relative URL in brackets without text
2733 !! input
2734 [//example.com]
2735 !! result
2736 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2737 </p>
2738 !! end
2739
2740 !! test
2741 External links: protocol-relative URL in free text is left alone
2742 !! input
2743 //example.com/Foo
2744 !! result
2745 <p>//example.com/Foo
2746 </p>
2747 !!end
2748
2749 !! test
2750 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2751 !! input
2752 foo//example.com/Foo
2753 !! result
2754 <p>foo//example.com/Foo
2755 </p>
2756 !! end
2757
2758 !! test
2759 External image
2760 !! input
2761 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2762 !! result
2763 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2764 </p>
2765 !! end
2766
2767 !! test
2768 External image from https
2769 !! input
2770 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2771 !! result
2772 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2773 </p>
2774 !! end
2775
2776 !! test
2777 External image (when not allowed)
2778 !! options
2779 wgAllowExternalImages=0
2780 !! input
2781 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2782 !! result
2783 <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>
2784 </p>
2785 !! end
2786
2787 !! test
2788 Link to non-http image, no img tag
2789 !! input
2790 Link to non-http image, no img tag: ftp://example.com/test.jpg
2791 !! result
2792 <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>
2793 </p>
2794 !! end
2795
2796 !! test
2797 External links: terminating separator
2798 !! input
2799 Terminating separator: http://example.com/thing,
2800 !! result
2801 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2802 </p>
2803 !! end
2804
2805 !! test
2806 External links: intervening separator
2807 !! input
2808 Intervening separator: http://example.com/1,2,3
2809 !! result
2810 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2811 </p>
2812 !! end
2813
2814 !! test
2815 External links: old bug with URL in query
2816 !! input
2817 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2818 !! result
2819 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2820 </p>
2821 !! end
2822
2823 !! test
2824 External links: old URL-in-URL bug, mixed protocols
2825 !! input
2826 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2827 !! result
2828 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2829 </p>
2830 !!end
2831
2832 !! test
2833 External links: URL in text
2834 !! input
2835 URL in text: [http://example.com http://example.com]
2836 !! result
2837 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2838 </p>
2839 !! end
2840
2841 !! test
2842 External links: Clickable images
2843 !! input
2844 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2845 !! result
2846 <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>
2847 </p>
2848 !!end
2849
2850 !! test
2851 External links: raw ampersand
2852 !! input
2853 Old &amp; use: http://x&y
2854 !! result
2855 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2856 </p>
2857 !! end
2858
2859 !! test
2860 External links: encoded ampersand
2861 !! input
2862 Old &amp; use: http://x&amp;y
2863 !! result
2864 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2865 </p>
2866 !! end
2867
2868 !! test
2869 External links: encoded equals (bug 6102)
2870 !! input
2871 http://example.com/?foo&#61;bar
2872 !! result
2873 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2874 </p>
2875 !! end
2876
2877 !! test
2878 External links: [raw ampersand]
2879 !! input
2880 Old &amp; use: [http://x&y]
2881 !! result
2882 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2883 </p>
2884 !! end
2885
2886 !! test
2887 External links: [encoded ampersand]
2888 !! input
2889 Old &amp; use: [http://x&amp;y]
2890 !! result
2891 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2892 </p>
2893 !! end
2894
2895 !! test
2896 External links: [encoded equals] (bug 6102)
2897 !! input
2898 [http://example.com/?foo&#61;bar]
2899 !! result
2900 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 External links: [IDN ignored character reference in hostname; strip it right off]
2906 !! input
2907 [http://e&zwnj;xample.com/]
2908 !! result
2909 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2910 </p>
2911 !! end
2912
2913 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2914 # Where an external link could easily circumvent the sanitization of the text of
2915 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2916 # test demands a higher standard. That's a bit strange.
2917 #
2918 # Example:
2919 #
2920 # http://e‌xample.com -> [http://example.com|http://example.com]
2921 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2922 #
2923 # The first example is sanitized, but the second is not. Any security benefits
2924 # from this production are trivial to circumvent. Either remove this test and
2925 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2926 # the test accordingly.
2927 #
2928 # All our love,
2929 # The Parsoid team.
2930 !! test
2931 External links: IDN ignored character reference in hostname; strip it right off
2932 !! input
2933 http://e&zwnj;xample.com/
2934 !! result
2935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2936 </p>
2937 !! end
2938
2939 !! test
2940 External links: www.jpeg.org (bug 554)
2941 !! input
2942 http://www.jpeg.org
2943 !!result
2944 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2945 </p>
2946 !! end
2947
2948 !! test
2949 External links: URL within URL (original bug 2)
2950 !! input
2951 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2952 !! result
2953 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2954 </p>
2955 !! end
2956
2957 !! test
2958 BUG 361: URL inside bracketed URL
2959 !! input
2960 [http://www.example.com/foo http://www.example.com/bar]
2961 !! result
2962 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2963 </p>
2964 !! end
2965
2966 !! test
2967 BUG 361: URL within URL, not bracketed
2968 !! input
2969 http://www.example.com/foo?=http://www.example.com/bar
2970 !! result
2971 <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>
2972 </p>
2973 !! end
2974
2975 !! test
2976 BUG 289: ">"-token in URL-tail
2977 !! input
2978 http://www.example.com/<hello>
2979 !! result
2980 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2981 </p>
2982 !!end
2983
2984 !! test
2985 BUG 289: literal ">"-token in URL-tail
2986 !! input
2987 http://www.example.com/<b>html</b>
2988 !! result
2989 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2990 </p>
2991 !!end
2992
2993 !! test
2994 BUG 289: ">"-token in bracketed URL
2995 !! input
2996 [http://www.example.com/<hello> stuff]
2997 !! result
2998 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2999 </p>
3000 !!end
3001
3002 !! test
3003 BUG 289: literal ">"-token in bracketed URL
3004 !! input
3005 [http://www.example.com/<b>html</b> stuff]
3006 !! result
3007 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3008 </p>
3009 !!end
3010
3011 !! test
3012 BUG 289: literal double quote at end of URL
3013 !! input
3014 http://www.example.com/"hello"
3015 !! result
3016 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3017 </p>
3018 !!end
3019
3020 !! test
3021 BUG 289: literal double quote in bracketed URL
3022 !! input
3023 [http://www.example.com/"hello" stuff]
3024 !! result
3025 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3026 </p>
3027 !!end
3028
3029 !! test
3030 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3031 !! input
3032 [http://www.example.com test]
3033 !! result
3034 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3035 </p>
3036 !! end
3037
3038 !! test
3039 External links: link text with spaces
3040 !! input
3041 [http://www.example.com a b c]
3042 [http://www.example.com ''a'' ''b'']
3043 !! result
3044 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3045 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3046 </p>
3047 !! end
3048
3049 !! test
3050 External links: wiki links within external link (Bug 3695)
3051 !! input
3052 [http://example.com [[wikilink]] embedded in ext link]
3053 !! result
3054 <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>
3055 </p>
3056 !! end
3057
3058 !! test
3059 BUG 787: Links with one slash after the url protocol are invalid
3060 !! input
3061 http:/example.com
3062
3063 [http:/example.com title]
3064 !! result
3065 <p>http:/example.com
3066 </p><p>[http:/example.com title]
3067 </p>
3068 !! end
3069
3070 !! test
3071 Bracketed external links with template-generated invalid target
3072 !! input
3073 [{{echo|http:/example.com}} title]
3074 !! result
3075 <p>[http:/example.com title]
3076 </p>
3077 !! end
3078
3079 !! test
3080 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3081 !! input
3082 ''[http://example.com text'']
3083 [http://example.com '''text]'''
3084 ''Something [http://example.com in italic'']
3085 ''Something [http://example.com mixed''''', even bold]'''
3086 '''''Now [http://example.com both''''']
3087 !! result
3088 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3089 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3090 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3091 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3092 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3093 </p>
3094 !! end
3095
3096
3097 !! test
3098 Bug 4781: %26 in URL
3099 !! input
3100 http://www.example.com/?title=AT%26T
3101 !! result
3102 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3103 </p>
3104 !! end
3105
3106 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3107 # % is actually legal in HTML5. Any change in output would need testing though.
3108 !! test
3109 Bug 4781, 5267: %25 in URL
3110 !! input
3111 http://www.example.com/?title=100%25_Bran
3112 !! result
3113 <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>
3114 </p>
3115 !! end
3116
3117 !! test
3118 Bug 4781, 5267: %28, %29 in URL
3119 !! input
3120 http://www.example.com/?title=Ben-Hur_%281959_film%29
3121 !! result
3122 <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>
3123 </p>
3124 !! end
3125
3126
3127 !! test
3128 Bug 4781: %26 in autonumber URL
3129 !! input
3130 [http://www.example.com/?title=AT%26T]
3131 !! result
3132 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3133 </p>
3134 !! end
3135
3136 !! test
3137 Bug 4781, 5267: %26 in autonumber URL
3138 !! input
3139 [http://www.example.com/?title=100%25_Bran]
3140 !! result
3141 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3142 </p>
3143 !! end
3144
3145 !! test
3146 Bug 4781, 5267: %28, %29 in autonumber URL
3147 !! input
3148 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3149 !! result
3150 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3151 </p>
3152 !! end
3153
3154
3155 !! test
3156 Bug 4781: %26 in bracketed URL
3157 !! input
3158 [http://www.example.com/?title=AT%26T link]
3159 !! result
3160 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3161 </p>
3162 !! end
3163
3164 !! test
3165 Bug 4781, 5267: %26 in bracketed URL
3166 !! input
3167 [http://www.example.com/?title=100%25_Bran link]
3168 !! result
3169 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3170 </p>
3171 !! end
3172
3173 !! test
3174 Bug 4781, 5267: %28, %29 in bracketed URL
3175 !! input
3176 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3177 !! result
3178 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3179 </p>
3180 !! end
3181
3182 !! test
3183 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3184 !! input
3185 Some [http://example.com/ pretty ''italics'' and stuff]!
3186 !! result
3187 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3188 </p>
3189 !! end
3190
3191 !! test
3192 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3193 !! input
3194 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3195 !! result
3196 <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>
3197 </p>
3198 !! end
3199
3200 !! test
3201 External link containing double-single-quotes with no space separating the url from text in italics
3202 !! input
3203 [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]].]
3204 !! result
3205 <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>
3206 </p>
3207 !! end
3208
3209 !! test
3210 External link with comments in link text
3211 !! input
3212 [http://www.google.com Google <!-- comment -->]
3213 !! result
3214 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3215 </p>
3216 !! end
3217
3218 !! test
3219 URL-encoding in URL functions (single parameter)
3220 !! input
3221 {{localurl:Some page|amp=&}}
3222 !! result
3223 <p>/index.php?title=Some_page&amp;amp=&amp;
3224 </p>
3225 !! end
3226
3227 !! test
3228 URL-encoding in URL functions (multiple parameters)
3229 !! input
3230 {{localurl:Some page|q=?&amp=&}}
3231 !! result
3232 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3233 </p>
3234 !! end
3235
3236 !! test
3237 Brackets in urls
3238 !! input
3239 http://example.com/index.php?foozoid%5B%5D=bar
3240
3241 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3242 !! result
3243 <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>
3244 </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>
3245 </p>
3246 !! end
3247
3248 !! test
3249 IPv6 urls (bug 21261)
3250 !! options
3251 disabled
3252 !! input
3253 http://[2404:130:0:1000::187:2]/index.php
3254 !! result
3255 <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>
3256 </p>
3257 !! end
3258
3259 !! test
3260 Non-extlinks in brackets
3261 !! input
3262 [foo]
3263 [foo bar]
3264 [foo ''bar'']
3265 [fool's] errand
3266 [fool's errand]
3267 [{{echo|foo}}]
3268 [{{echo|foo}} bar]
3269 [{{echo|foo}} ''bar'']
3270 [{{echo|foo}}l's] errand
3271 [{{echo|foo}}l's errand]
3272 [url={{echo|foo}}]
3273 [url=http://example.com]
3274 !! result
3275 <p>[foo]
3276 [foo bar]
3277 [foo <i>bar</i>]
3278 [fool's] errand
3279 [fool's errand]
3280 [foo]
3281 [foo bar]
3282 [foo <i>bar</i>]
3283 [fool's] errand
3284 [fool's errand]
3285 [url=foo]
3286 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3287 </p>
3288 !! end
3289
3290 !! test
3291 Parsoid: Percent encoding in external links
3292 !! options
3293 parsoid
3294 !! input
3295 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3296 !! result
3297 <p><a rel="mw:ExtLink"
3298 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3299 !! end
3300
3301 !! test
3302 Parsoid: use url link syntax for links where the content is equal the link
3303 target
3304 !! options
3305 parsoid
3306 !! input
3307 http://example.com
3308 !! result
3309 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3310 !! end
3311
3312 ###
3313 ### Quotes
3314 ###
3315
3316 !! test
3317 Quotes
3318 !! input
3319 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3320
3321 Normal text. '''''Bold italic text.''''' Normal text.
3322 !!result
3323 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3324 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3325 </p>
3326 !! end
3327
3328
3329 !! test
3330 Unclosed and unmatched quotes (php)
3331 !! options
3332 php
3333 !! input
3334 '''''Bold italic text '''with bold deactivated''' in between.'''''
3335
3336 '''''Bold italic text ''with italic deactivated'' in between.'''''
3337
3338 '''Bold text..
3339
3340 ..spanning two paragraphs (should not work).'''
3341
3342 '''Bold tag left open
3343
3344 ''Italic tag left open
3345
3346 Normal text.
3347
3348 <!-- Unmatching number of opening, closing tags: -->
3349 '''This year''''s election ''should'' beat '''last year''''s.
3350
3351 ''Tom'''s car is bigger than ''Susan'''s.
3352
3353 Plain ''italic'''s plain
3354 !! result
3355 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3356 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3357 </p><p><b>Bold text..</b>
3358 </p><p>..spanning two paragraphs (should not work).
3359 </p><p><b>Bold tag left open</b>
3360 </p><p><i>Italic tag left open</i>
3361 </p><p>Normal text.
3362 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3363 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3364 </p><p>Plain <i>italic'</i>s plain
3365 </p>
3366 !! end
3367 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3368 # parser strips. The wikitext contains just the first half of the bold
3369 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3370 # differently than the PHP parser.)
3371 !! test
3372 Unclosed and unmatched quotes (parsoid)
3373 !! options
3374 parsoid
3375 !! input
3376 '''''Bold italic text '''with bold deactivated''' in between.'''''
3377
3378 '''''Bold italic text ''with italic deactivated'' in between.'''''
3379
3380 '''Bold text..
3381
3382 ..spanning two paragraphs (should not work).'''
3383
3384 '''Bold tag left open
3385
3386 ''Italic tag left open
3387
3388 Normal text.
3389
3390 <!-- Unmatching number of opening, closing tags: -->
3391 '''This year''''s election ''should'' beat '''last year''''s.
3392
3393 ''Tom'''s car is bigger than ''Susan'''s.
3394
3395 Plain ''italic'''s plain
3396 !! result
3397 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3398 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3399 </p><p><b>Bold text..</b>
3400 </p><p>..spanning two paragraphs (should not work).<b></b>
3401 </p><p><b>Bold tag left open</b>
3402 </p><p><i>Italic tag left open</i>
3403 </p><p>Normal text.
3404 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3405 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3406 </p><p>Plain <i>italic'</i>s plain
3407 </p>
3408 !! end
3409
3410 ###
3411 ### Tables
3412 ###
3413 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3414 ###
3415
3416 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3417 # is the bare minimum required by the spec, see:
3418 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3419 !! test
3420 A table with no data. (php)
3421 !! options
3422 php
3423 !! input
3424 {||}
3425 !! result
3426 !! end
3427 # Parsoid team replies: empty table tags are legal in HTML5
3428 !! test
3429 A table with no data. (parsoid)
3430 !! options
3431 parsoid
3432 !! input
3433 {||}
3434 !! result
3435 <table></table>
3436 !! end
3437
3438 # A table with nothing but a caption is invalid XHTML, we might want to render
3439 # this as <p>caption</p>
3440 !! test
3441 A table with nothing but a caption (php)
3442 !! options
3443 php
3444 !! input
3445 {|
3446 |+ caption
3447 |}
3448 !! result
3449 <table>
3450 <caption> caption
3451 </caption><tr><td></td></tr></table>
3452
3453 !! end
3454 # Parsoid team replies: table with only a caption is legal in HTML5
3455 !! test
3456 A table with nothing but a caption (parsoid)
3457 !! options
3458 parsoid
3459 !! input
3460 {|
3461 |+ caption
3462 |}
3463 !! result
3464 <table><caption> caption</caption></table>
3465 !! end
3466
3467 !! test
3468 A table with caption with default-spaced attributes and a table row
3469 !! input
3470 {|
3471 |+ style="color: red;" | caption1
3472 |-
3473 | foo
3474 |}
3475 !! result
3476 <table>
3477 <caption style="color: red;"> caption1
3478 </caption>
3479 <tr>
3480 <td> foo
3481 </td></tr></table>
3482
3483 !! end
3484
3485 !! test
3486 A table with captions with non-default spaced attributes and a table row
3487 !! input
3488 {|
3489 |+style="color: red;"|caption2
3490 |+ style="color: red;"| caption3
3491 |-
3492 | foo
3493 |}
3494 !! result
3495 <table>
3496 <caption style="color: red;">caption2
3497 </caption>
3498 <caption style="color: red;"> caption3
3499 </caption>
3500 <tr>
3501 <td> foo
3502 </td></tr></table>
3503
3504 !! end
3505
3506 !! test
3507 Table td-cell syntax variations
3508 !! input
3509 {|
3510 | foo bar foo | baz
3511 | foo bar foo || baz
3512 | style='color:red;' | baz
3513 | style='color:red;' || baz
3514 |}
3515 !! result
3516 <table>
3517 <tr>
3518 <td> baz
3519 </td>
3520 <td> foo bar foo </td>
3521 <td> baz
3522 </td>
3523 <td style="color:red;"> baz
3524 </td>
3525 <td> style='color:red;' </td>
3526 <td> baz
3527 </td></tr></table>
3528
3529 !! end
3530
3531 !! test
3532 Simple table
3533 !! input
3534 {|
3535 | 1 || 2
3536 |-
3537 | 3 || 4
3538 |}
3539 !! result
3540 <table>
3541 <tr>
3542 <td> 1 </td>
3543 <td> 2
3544 </td></tr>
3545 <tr>
3546 <td> 3 </td>
3547 <td> 4
3548 </td></tr></table>
3549
3550 !! end
3551
3552 !! test
3553 Simple table but with multiple dashes for row wikitext
3554 !! input
3555 {|
3556 | foo
3557 |-----
3558 | bar
3559 |}
3560 !! result
3561 <table>
3562 <tr>
3563 <td> foo
3564 </td></tr>
3565 <tr>
3566 <td> bar
3567 </td></tr></table>
3568
3569 !! end
3570 !! test
3571 Multiplication table
3572 !! input
3573 {| border="1" cellpadding="2"
3574 |+Multiplication table
3575 |-
3576 ! &times; !! 1 !! 2 !! 3
3577 |-
3578 ! 1
3579 | 1 || 2 || 3
3580 |-
3581 ! 2
3582 | 2 || 4 || 6
3583 |-
3584 ! 3
3585 | 3 || 6 || 9
3586 |-
3587 ! 4
3588 | 4 || 8 || 12
3589 |-
3590 ! 5
3591 | 5 || 10 || 15
3592 |}
3593 !! result
3594 <table border="1" cellpadding="2">
3595 <caption>Multiplication table
3596 </caption>
3597 <tr>
3598 <th> &#215; </th>
3599 <th> 1 </th>
3600 <th> 2 </th>
3601 <th> 3
3602 </th></tr>
3603 <tr>
3604 <th> 1
3605 </th>
3606 <td> 1 </td>
3607 <td> 2 </td>
3608 <td> 3
3609 </td></tr>
3610 <tr>
3611 <th> 2
3612 </th>
3613 <td> 2 </td>
3614 <td> 4 </td>
3615 <td> 6
3616 </td></tr>
3617 <tr>
3618 <th> 3
3619 </th>
3620 <td> 3 </td>
3621 <td> 6 </td>
3622 <td> 9
3623 </td></tr>
3624 <tr>
3625 <th> 4
3626 </th>
3627 <td> 4 </td>
3628 <td> 8 </td>
3629 <td> 12
3630 </td></tr>
3631 <tr>
3632 <th> 5
3633 </th>
3634 <td> 5 </td>
3635 <td> 10 </td>
3636 <td> 15
3637 </td></tr></table>
3638
3639 !! end
3640
3641 !! test
3642 Accept "||" in table headings
3643 !! input
3644 {|
3645 !h1 || h2
3646 |}
3647 !! result
3648 <table>
3649 <tr>
3650 <th>h1 </th>
3651 <th> h2
3652 </th></tr></table>
3653
3654 !! end
3655
3656 !! test
3657 Accept "||" in indented table headings
3658 !! input
3659 :{|
3660 !h1 || h2
3661 |}
3662 !! result
3663 <dl><dd><table>
3664 <tr>
3665 <th>h1 </th>
3666 <th> h2
3667 </th></tr></table></dd></dl>
3668
3669 !! end
3670
3671 !! test
3672 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3673 !! input
3674 {|
3675 !| h1
3676 || a
3677 |}
3678 !! result
3679 <table>
3680 <tr>
3681 <th> h1
3682 </th>
3683 <td> a
3684 </td></tr></table>
3685
3686 !! end
3687
3688 !!test
3689 Accept "| !" at start of line in tables (ignore !-attribute)
3690 !!input
3691 {|
3692 |-
3693 | !style="color:red" | bar
3694 |}
3695 !!result
3696 <table>
3697
3698 <tr>
3699 <td> bar
3700 </td></tr></table>
3701
3702 !!end
3703
3704 !!test
3705 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 +/-
3706 !!input
3707 {|
3708 |-
3709 |style='color:red;'|+1
3710 |style='color:blue;'|-1
3711 |-
3712 | 1 || 2 || 3
3713 | 1 ||+2 ||-3
3714 |-
3715 | +1
3716 | -1
3717 |}
3718 !!result
3719 <table>
3720
3721 <tr>
3722 <td style="color:red;">+1
3723 </td>
3724 <td style="color:blue;">-1
3725 </td></tr>
3726 <tr>
3727 <td> 1 </td>
3728 <td> 2 </td>
3729 <td> 3
3730 </td>
3731 <td> 1 </td>
3732 <td>+2 </td>
3733 <td>-3
3734 </td></tr>
3735 <tr>
3736 <td> +1
3737 </td>
3738 <td> -1
3739 </td></tr></table>
3740
3741 !!end
3742
3743 !! test
3744 Table rowspan
3745 !! input
3746 {| border=1
3747 | Cell 1, row 1
3748 |rowspan=2| Cell 2, row 1 (and 2)
3749 | Cell 3, row 1
3750 |-
3751 | Cell 1, row 2
3752 | Cell 3, row 2
3753 |}
3754 !! result
3755 <table border="1">
3756 <tr>
3757 <td> Cell 1, row 1
3758 </td>
3759 <td rowspan="2"> Cell 2, row 1 (and 2)
3760 </td>
3761 <td> Cell 3, row 1
3762 </td></tr>
3763 <tr>
3764 <td> Cell 1, row 2
3765 </td>
3766 <td> Cell 3, row 2
3767 </td></tr></table>
3768
3769 !! end
3770
3771 !! test
3772 Nested table
3773 !! input
3774 {| border=1
3775 | &alpha;
3776 |
3777 {| bgcolor=#ABCDEF border=2
3778 |nested
3779 |-
3780 |table
3781 |}
3782 |the original table again
3783 |}
3784 !! result
3785 <table border="1">
3786 <tr>
3787 <td> &#945;
3788 </td>
3789 <td>
3790 <table bgcolor="#ABCDEF" border="2">
3791 <tr>
3792 <td>nested
3793 </td></tr>
3794 <tr>
3795 <td>table
3796 </td></tr></table>
3797 </td>
3798 <td>the original table again
3799 </td></tr></table>
3800
3801 !! end
3802
3803 !! test
3804 Invalid attributes in table cell (bug 1830)
3805 !! input
3806 {|
3807 |Cell:|broken
3808 |}
3809 !! result
3810 <table>
3811 <tr>
3812 <td>broken
3813 </td></tr></table>
3814
3815 !! end
3816
3817
3818 !! test
3819 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3820 !! input
3821 {|
3822 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3823 !! result
3824 <table>
3825 <tr>
3826 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3827 <td>]" onmouseover="alert(document.cookie)"&gt;test
3828 </td>
3829 </tr>
3830 </table>
3831
3832 !! end
3833
3834
3835 !! test
3836 Indented table markup mixed with indented pre content (proposed in bug 6200)
3837 !! input
3838 <table>
3839 <tr>
3840 <td>
3841 Text that should be rendered preformatted
3842 </td>
3843 </tr>
3844 </table>
3845 !! result
3846 <table>
3847 <tr>
3848 <td>
3849 <pre>Text that should be rendered preformatted
3850 </pre>
3851 </td>
3852 </tr>
3853 </table>
3854
3855 !! end
3856
3857 !! test
3858 Template-generated table cell attributes and cell content
3859 !! input
3860 {|
3861 |{{table_attribs}}
3862 |}
3863 !! result
3864 <table>
3865 <tr>
3866 <td style="color: red"> Foo
3867 </td></tr></table>
3868
3869 !! end
3870
3871 !! test
3872 Template-generated table cell attributes and cell content (2)
3873 !! input
3874 {|
3875 |align=center {{table_attribs}}
3876 |}
3877 !! result
3878 <table>
3879 <tr>
3880 <td align="center" style="color: red"> Foo
3881 </td></tr></table>
3882
3883 !! end
3884
3885 !! test
3886 Template-generated table cell attributes and cell content (3)
3887 !! input
3888 {|
3889 |align=center {{table_cells}}
3890 |}
3891 !! result
3892 <table>
3893 <tr>
3894 <td align="center" style="color: red"> Foo </td>
3895 <td> Bar </td>
3896 <td> Baz
3897 </td></tr></table>
3898
3899 !! end
3900
3901 !! test
3902 Table with row followed by newlines and table heading
3903 !! input
3904 {|
3905 |-
3906
3907 ! foo
3908 |}
3909 !! result
3910 <table>
3911
3912
3913 <tr>
3914 <th> foo
3915 </th></tr></table>
3916
3917 !! end
3918
3919 !! test
3920 Table with empty line following the start tag
3921 !! input
3922 {|
3923
3924 |-
3925 | foo
3926 |}
3927 !! result
3928 <table>
3929
3930
3931 <tr>
3932 <td> foo
3933 </td></tr></table>
3934
3935 !! end
3936
3937 # FIXME: Preserve the attribute properly (with an empty string as value) in
3938 # the PHP parser. Parsoid implements the behavior below.
3939 !! test
3940 Table attributes with empty value
3941 !! options
3942 parsoid
3943 !! input
3944 {|
3945 | style=| hello
3946 |}
3947 !! result
3948 <table>
3949 <tbody>
3950 <tr>
3951 <td style=""> hello
3952 </td></tr></tbody></table>
3953
3954 !! end
3955
3956 !! test
3957 Wikitext table with a lot of comments
3958 !! input
3959 {|
3960 <!-- c0 -->
3961 | foo
3962 <!-- c1 -->
3963 |- <!-- c2 -->
3964 <!-- c3 -->
3965 |<!-- c4 -->
3966 <!-- c5 -->
3967 |}
3968 !! result
3969 <table>
3970 <tr>
3971 <td> foo
3972 </td></tr>
3973 <tr>
3974 <td>
3975 </td></tr></table>
3976
3977 !! end
3978
3979 !! test
3980 Wikitext table with double-line table cell
3981 !! input
3982 {|
3983 |a
3984 b
3985 |}
3986 !! result
3987 <table>
3988 <tr>
3989 <td>a
3990 <p>b
3991 </p>
3992 </td></tr></table>
3993
3994 !! end
3995
3996 !! test
3997 Table cell with a single comment
3998 !! input
3999 {|
4000 | <!-- c1 -->
4001 | a
4002 |}
4003 !! result
4004 <table>
4005 <tr>
4006 <td>
4007 </td>
4008 <td> a
4009 </td></tr></table>
4010
4011 !! end
4012
4013 # The expected HTML structure in this test is debatable. The PHP parser does
4014 # not parse this kind of table at all. The main focus for Parsoid is on
4015 # round-tripping, so this output is ok for now. TODO: revisit!
4016 !! test
4017 Wikitext table with html-syntax row (Parsoid)
4018 !! options
4019 parsoid
4020 !! input
4021 {|
4022 |-
4023 <td>foo</td>
4024 |}
4025 !! result
4026 <table>
4027 <tbody>
4028 <tr>
4029 <td>foo</td></tr></tbody></table>
4030 !! end
4031
4032 !! test
4033 Implicit <td> after a |-
4034 (PHP parser relies on Tidy to add the missing <td> tags)
4035 !! options
4036 parsoid=wt2html,wt2wt
4037 !! input
4038 {|
4039 |-
4040 a
4041 |}
4042 !! result
4043 <table>
4044 <tr><td>a</td></tr>
4045 </table>
4046 !! end
4047
4048 !! test
4049 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4050 (PHP parser relies on Tidy to add the missing <td> tags)
4051 !! options
4052 parsoid=wt2html,wt2wt
4053 !! input
4054 {|
4055 |-
4056 |
4057 a
4058 |-
4059 b
4060 |}
4061 !! result
4062 <table>
4063 <tbody>
4064 <tr><td><pre>a</pre></td></tr>
4065 <tr><td> b</td></tr>
4066 </tbody>
4067 </table>
4068 !! end
4069
4070 !! test
4071 Lists should be recognized in an implicit <td> context
4072 (PHP parser relies on Tidy to add the missing <td> tags)
4073 !! options
4074 parsoid=wt2html,wt2wt
4075 !! input
4076 {|
4077 |-
4078 *a
4079 |}
4080 !! result
4081 <table>
4082 <tr>
4083 <td><ul><li>a</li></ul></td>
4084 </tr>
4085 </table>
4086 !! end
4087
4088 ###
4089 ### Internal links
4090 ###
4091 !! test
4092 Plain link, capitalized
4093 !! input
4094 [[Main Page]]
4095 !! result
4096 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4097 </p>
4098 !! end
4099
4100 !! test
4101 Plain link, uncapitalized
4102 !! input
4103 [[main Page]]
4104 !! result
4105 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4106 </p>
4107 !! end
4108
4109 !! test
4110 Piped link
4111 !! input
4112 [[Main Page|The Main Page]]
4113 !! result
4114 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4115 </p>
4116 !! end
4117
4118 !! test
4119 Piped link with comment in link text
4120 !! input
4121 [[Main Page|The Main<!--front--> Page]]
4122 !! result
4123 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4124 </p>
4125 !! end
4126
4127 !! test
4128 Broken link
4129 !! input
4130 [[Zigzagzogzagzig]]
4131 !! result
4132 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4133 </p>
4134 !! end
4135
4136 !! test
4137 Broken link with fragment
4138 !! input
4139 [[Zigzagzogzagzig#zug]]
4140 !! result
4141 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4142 </p>
4143 !! end
4144
4145 !! test
4146 Special page link with fragment
4147 !! input
4148 [[Special:Version#anchor]]
4149 !! result
4150 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4151 </p>
4152 !! end
4153
4154 !! test
4155 Nonexistent special page link with fragment
4156 !! input
4157 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4158 !! result
4159 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4160 </p>
4161 !! end
4162
4163 !! test
4164 Link with prefix
4165 !! input
4166 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4167 !! result
4168 <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>
4169 </p>
4170 !! end
4171
4172 !! test
4173 Link with suffix
4174 !! input
4175 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4176 !! result
4177 <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>!!!
4178 </p>
4179 !! end
4180
4181 !! article
4182 prefixed article
4183 !! text
4184 Some text
4185 !! endarticle
4186
4187 !! test
4188 Bug 43661: Piped links with identical prefixes
4189 !! input
4190 [[prefixed article|prefixed articles with spaces]]
4191
4192 [[prefixed article|prefixed articlesaoeu]]
4193
4194 [[Main Page|Main Page test]]
4195 !! result
4196 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4197 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4198 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4199 </p>
4200 !! end
4201
4202
4203 !! test
4204 Link with HTML entity in suffix / tail
4205 !! input
4206 [[Main Page]]&quot;, [[Main Page]]&#97;
4207 !! result
4208 <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;
4209 </p>
4210 !! end
4211
4212 !! test
4213 Link with 3 brackets
4214 !! input
4215 [[[main page]]]
4216 !! result
4217 <p>[[[main page]]]
4218 </p>
4219 !! end
4220
4221 !! test
4222 Piped link with 3 brackets
4223 !! input
4224 [[[main page|the main page]]]
4225 !! result
4226 <p>[[[main page|the main page]]]
4227 </p>
4228 !! end
4229
4230 !! test
4231 Link with multiple pipes
4232 !! input
4233 [[Main Page|The|Main|Page]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4236 </p>
4237 !! end
4238
4239 !! test
4240 Link to namespaces
4241 !! input
4242 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4243 !! result
4244 <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>
4245 </p>
4246 !! end
4247
4248 !! test
4249 Piped link to namespace
4250 !! input
4251 [[Meta:Disclaimers|The disclaimers]]
4252 !! result
4253 <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>
4254 </p>
4255 !! end
4256
4257 !! test
4258 Link containing }
4259 !! input
4260 [[Usually caused by a typo (oops}]]
4261 !! result
4262 <p>[[Usually caused by a typo (oops}]]
4263 </p>
4264 !! end
4265
4266 !! test
4267 Link containing % (not as a hex sequence)
4268 !! input
4269 [[7% Solution]]
4270 !! result
4271 <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>
4272 </p>
4273 !! end
4274
4275 !! test
4276 Link containing % as a single hex sequence interpreted to char
4277 !! input
4278 [[7%25 Solution]]
4279 !! result
4280 <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>
4281 </p>
4282 !!end
4283
4284 !! test
4285 Link containing % as a double hex sequence interpreted to hex sequence
4286 !! input
4287 [[7%2525 Solution]]
4288 !! result
4289 <p>[[7%2525 Solution]]
4290 </p>
4291 !!end
4292
4293 !! test
4294 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4295 Example for such a section: == < ==
4296 !! input
4297 [[%23%3c]][[%23%3e]]
4298 !! result
4299 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Link containing "<#" and ">#" as a hex sequences
4305 !! input
4306 [[%3c%23]][[%3e%23]]
4307 !! result
4308 <p>[[%3c%23]][[%3e%23]]
4309 </p>
4310 !! end
4311
4312 !! test
4313 Link containing an equals sign
4314 !! input
4315 [[Special:BookSources/isbn=4-00-026157-6]]
4316 !! result
4317 <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>
4318 </p>
4319 !! end
4320
4321 !! article
4322 Foo~bar
4323 !! text
4324 Just a test of an article title containing a tilde.
4325 !! endarticle
4326
4327 # note that links containing signatures, like [[Foo~~~~]], are
4328 # massaged by the pre-save transform (PST) and so the tildes are never
4329 # seen by the parser.
4330 !! test
4331 Link containing a tilde
4332 !! input
4333 [[Foo~bar]]
4334 !! result
4335 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4336 </p>
4337 !! end
4338
4339 !! test
4340 Link containing double-single-quotes '' (bug 4598)
4341 !! input
4342 [[Lista d''e paise d''o munno]]
4343 !! result
4344 <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>
4345 </p>
4346 !! end
4347
4348 !! test
4349 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4350 !! input
4351 Some [[Link|pretty ''italics'' and stuff]]!
4352 !! result
4353 <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>!
4354 </p>
4355 !! end
4356
4357 !! test
4358 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4359 !! input
4360 ''Some [[Link|pretty ''italics'' and stuff]]!
4361 !! result
4362 <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>
4363 </p>
4364 !! end
4365
4366 !! test
4367 Link with double quotes in title part (literal) and alternate part (interpreted)
4368 !! input
4369 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4370
4371 [[''Pentecoste'']]
4372
4373 [[''Pentecoste''|Pentecoste]]
4374
4375 [[''Pentecoste''|''Pentecoste'']]
4376 !! result
4377 <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>
4378 </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>
4379 </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>
4380 </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>
4381 </p>
4382 !! end
4383
4384 !! test
4385 Broken image links with HTML captions (bug 39700)
4386 !! input
4387 [[File:Nonexistent|<script></script>]]
4388 [[File:Nonexistent|100px|<script></script>]]
4389 [[File:Nonexistent|&lt;]]
4390 [[File:Nonexistent|a<i>b</i>c]]
4391 !! result
4392 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4393 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4394 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4395 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4396 </p>
4397 !! end
4398
4399 !! test
4400 Plain link to URL
4401 !! input
4402 [[http://www.example.com]]
4403 !! result
4404 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4405 </p>
4406 !! end
4407
4408 !! test
4409 Plain link to URL with link text
4410 !! input
4411 [[http://www.example.com Link text]]
4412 !! result
4413 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4414 </p>
4415 !! end
4416
4417 !! test
4418 Plain link to protocol-relative URL
4419 !! input
4420 [[//www.example.com]]
4421 !! result
4422 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4423 </p>
4424 !! end
4425
4426 !! test
4427 Plain link to protocol-relative URL with link text
4428 !! input
4429 [[//www.example.com Link text]]
4430 !! result
4431 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4432 </p>
4433 !! end
4434
4435 !! test
4436 Plain link to page with question mark in title
4437 !! input
4438 [[A?b]]
4439
4440 [[A?b|Baz]]
4441 !! result
4442 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4443 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4444 </p>
4445 !! end
4446
4447
4448 # I'm fairly sure the expected result here is wrong.
4449 # We want these to be URL links, not pseudo-pages with URLs for titles....
4450 # However the current output is also pretty screwy.
4451 #
4452 # ----
4453 # I'm changing it to match the current output--it arguably makes more
4454 # sense in the light of the test above. Old expected result was:
4455 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4456 #</p>
4457 # But I think this test is bordering on "garbage in, garbage out" anyway.
4458 # -- wtm
4459 !! test
4460 Piped link to URL
4461 !! input
4462 Piped link to URL: [[http://www.example.com|an example URL]]
4463 !! result
4464 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4465 </p>
4466 !! end
4467
4468 !! test
4469 BUG 2: [[page|http://url/]] should link to page, not http://url/
4470 !! input
4471 [[Main Page|http://url/]]
4472 !! result
4473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4474 </p>
4475 !! end
4476
4477 !! test
4478 BUG 337: Escaped self-links should be bold
4479 !! options
4480 title=[[Bug462]]
4481 !! input
4482 [[Bu&#103;462]] [[Bug462]]
4483 !! result
4484 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4485 </p>
4486 !! end
4487
4488 !! test
4489 Self-link to section should not be bold
4490 !! options
4491 title=[[Main Page]]
4492 !! input
4493 [[Main Page#section]]
4494 !! result
4495 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4496 </p>
4497 !! end
4498
4499 !! article
4500 00
4501 !! text
4502 This is 00.
4503 !! endarticle
4504
4505 !!test
4506 Self-link to numeric title
4507 !!options
4508 title=[[0]]
4509 !!input
4510 [[0]]
4511 !!result
4512 <p><strong class="selflink">0</strong>
4513 </p>
4514 !!end
4515
4516 !!test
4517 Link to numeric-equivalent title
4518 !!options
4519 title=[[0]]
4520 !!input
4521 [[00]]
4522 !!result
4523 <p><a href="/wiki/00" title="00">00</a>
4524 </p>
4525 !!end
4526
4527 !! test
4528 <nowiki> inside a link
4529 !! input
4530 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4531 !! result
4532 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4533 </p>
4534 !! end
4535
4536 !! test
4537 Non-breaking spaces in title
4538 !! input
4539 [[&nbsp; Main &nbsp; Page &nbsp;]]
4540 !! result
4541 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4542 </p>
4543 !!end
4544
4545 !! test
4546 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4547 !! options
4548 language=ca
4549 !! input
4550 '''[[Main Page]]'''
4551 !! result
4552 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4553 </p>
4554 !! end
4555
4556 !! test
4557 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4558 !! options
4559 language=ca
4560 !! input
4561 ''[[Main Page]]''
4562 !! result
4563 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4564 </p>
4565 !! end
4566
4567 !! test
4568 Internal link with en linktrail: no apostrophes (bug 27473)
4569 !! options
4570 language=en
4571 !! input
4572 [[Something]]'nice
4573 !! result
4574 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4575 </p>
4576 !! end
4577
4578 !! test
4579 Internal link with ca linktrail with apostrophes (bug 27473)
4580 !! options
4581 language=ca
4582 !! input
4583 [[Something]]'nice
4584 !! result
4585 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4586 </p>
4587 !! end
4588
4589 !! test
4590 Internal link with kaa linktrail with apostrophes (bug 27473)
4591 !! options
4592 language=kaa
4593 !! input
4594 [[Something]]'nice
4595 !! result
4596 <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>
4597 </p>
4598 !! end
4599
4600 !! article
4601 Söfnuður
4602 !! text
4603 Test.
4604 !! endarticle
4605
4606 !! test
4607 Internal link with is link prefix
4608 !! options
4609 language=is
4610 !! input
4611 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4612 !! result
4613 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4614 </p>
4615 !! end
4616
4617 !! article
4618 Mótmælendatrú
4619 !! text
4620 Test.
4621 !! endarticle
4622
4623 !! test
4624 Internal link with is link trail and link prefix
4625 !! options
4626 language=is
4627 !! input
4628 [[mótmælendatrú|xxx]]ar
4629 [[mótmælendatrú]]ar
4630 mótmælenda[[söfnuður]]
4631 mótmælenda[[söfnuður|söfnuðir]]
4632 mótmælenda[[söfnuður|söfnuðir]]xxx
4633 !! result
4634 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4635 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4636 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4637 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4638 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4639 </p>
4640 !! end
4641
4642 !! test
4643 Parsoid link trail escaping
4644 !! options
4645 parsoid=html2wt,html2html
4646 !! input
4647 [[apple]]<nowiki/>s
4648 !! result
4649 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4650 !! end
4651
4652 !! test
4653 Parsoid link prefix escaping
4654 !! options
4655 language=is
4656 parsoid=html2wt,html2html
4657 !! input
4658 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4659 !! result
4660 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4661 !! end
4662
4663 !! test
4664 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4665 !! input
4666 [[Foo| bar]]
4667
4668 [[Foo| ''bar'']]
4669
4670 [http://wp.org foo]
4671
4672 [http://wp.org ''foo'']
4673 !! result
4674 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4675 </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>
4676 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4677 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4678 </p>
4679 !! end
4680
4681 ###
4682 ### Interwiki links (see maintenance/interwiki.sql)
4683 ###
4684
4685 !! test
4686 Inline interwiki link
4687 !! input
4688 [[MeatBall:SoftSecurity]]
4689 !! result
4690 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4691 </p>
4692 !! end
4693
4694 !! test
4695 Inline interwiki link with empty title (bug 2372)
4696 !! input
4697 [[MeatBall:]]
4698 !! result
4699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4700 </p>
4701 !! end
4702
4703 !! test
4704 Interwiki link encoding conversion (bug 1636)
4705 !! input
4706 *[[Wikipedia:ro:Olteni&#0355;a]]
4707 *[[Wikipedia:ro:Olteni&#355;a]]
4708 !! result
4709 <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>
4710 </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>
4711 </li></ul>
4712
4713 !! end
4714
4715 !! test
4716 Interwiki link with fragment (bug 2130)
4717 !! input
4718 [[MeatBall:SoftSecurity#foo]]
4719 !! result
4720 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4721 </p>
4722 !! end
4723
4724 !! test
4725 Interlanguage link
4726 !! input
4727 Blah blah blah
4728 [[zh:Chinese]]
4729 !!result
4730 <p>Blah blah blah
4731 </p>
4732 !! end
4733
4734 !! test
4735 Double interlanguage link
4736 !! input
4737 Blah blah blah
4738 [[es:Spanish]]
4739 [[zh:Chinese]]
4740 !!result
4741 <p>Blah blah blah
4742 </p>
4743 !! end
4744
4745 !! test
4746 Interlanguage link, with prefix links
4747 !! options
4748 language=ln
4749 !! input
4750 Blah blah blah
4751 [[zh:Chinese]]
4752 !!result
4753 <p>Blah blah blah
4754 </p>
4755 !! end
4756
4757 !! test
4758 Double interlanguage link, with prefix links (bug 8897)
4759 !! options
4760 language=ln
4761 !! input
4762 Blah blah blah
4763 [[es:Spanish]]
4764 [[zh:Chinese]]
4765 !!result
4766 <p>Blah blah blah
4767 </p>
4768 !! end
4769
4770 !! test
4771 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4772 !! options
4773 language=ln
4774 !! input
4775 [[WW&nbsp;II]]
4776 !!result
4777 <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>
4778 </p>
4779 !! end
4780
4781 !! test
4782 Parsoid: handle constructor well
4783 !! options
4784 parsoid
4785 !! input
4786 [[constructor]]
4787
4788 [[constructor:foo]]
4789 !! result
4790 <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>
4791
4792
4793 <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>
4794 !! end
4795
4796 ##
4797 ## Redirects, Parsoid-only
4798 ##
4799 !! test
4800 Simple redirect to page
4801 !! options
4802 parsoid
4803 !! input
4804 #REDIRECT [[Main Page]]
4805 !! result
4806 <link rel="mw:PageProp/redirect" href="./Main_Page">
4807 !! end
4808
4809 !! test
4810 Redirect to category
4811 !! options
4812 parsoid=wt2html
4813 !! input
4814 #REDIRECT [[Category:Foo]]
4815 !! result
4816 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4817 !! end
4818
4819 !! test
4820 Redirect to category page
4821 !! options
4822 parsoid=wt2html,html2html
4823 !! input
4824 #REDIRECT [[:Category:Foo]]
4825 !! result
4826 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4827 !! end
4828
4829 !! test
4830 Redirect to image page
4831 !! options
4832 parsoid
4833 !! input
4834 #REDIRECT [[File:Wiki.png]]
4835 !! result
4836 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4837 !! end
4838
4839 !! test
4840 Redirect to language
4841 !! options
4842 parsoid
4843 !! input
4844 #REDIRECT [[en:File:Wiki.png]]
4845 !! result
4846 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4847 !! end
4848
4849 !! test
4850 Redirect to interwiki
4851 !! options
4852 parsoid
4853 !! input
4854 #REDIRECT [[meatball:File:Wiki.png]]
4855 !! result
4856 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4857 !! end
4858
4859 ##
4860 ## XHTML tidiness
4861 ###
4862
4863 !! test
4864 <br> to <br />
4865 !! input
4866 1<br>2<br />3
4867 !! result
4868 <p>1<br />2<br />3
4869 </p>
4870 !! end
4871
4872 !! test
4873 Broken br tag sanitization
4874 !! options
4875 php
4876 !! input
4877 </br>
4878 !! result
4879 <p>&lt;/br&gt;
4880 </p>
4881 !! end
4882
4883 # TODO: Fix html2html mode (bug 51055)!
4884 !! test
4885 Parsoid: Broken br tag recognition
4886 !! options
4887 parsoid=wt2html
4888 !! input
4889 </br>
4890 !! result
4891 <p><br></p>
4892 !! end
4893
4894 !! test
4895 Incorrecly removing closing slashes from correctly formed XHTML
4896 !! input
4897 <br style="clear:both;" />
4898 !! result
4899 <p><br style="clear:both;" />
4900 </p>
4901 !! end
4902
4903 !! test
4904 Failing to transform badly formed HTML into correct XHTML
4905 !! input
4906 <br style="clear: left;">
4907 <br style="clear: right;">
4908 <br style="clear: both;">
4909 !! result
4910 <p><br style="clear: left;" />
4911 <br style="clear: right;" />
4912 <br style="clear: both;" />
4913 </p>
4914 !!end
4915
4916 !! test
4917 Handling html with a div self-closing tag
4918 !! input
4919 <div title />
4920 <div title/>
4921 <div title/ >
4922 <div title=bar />
4923 <div title=bar/>
4924 <div title=bar/ >
4925 !! result
4926 <p>&lt;div title /&gt;
4927 &lt;div title/&gt;
4928 </p>
4929 <div>
4930 <p>&lt;div title=bar /&gt;
4931 &lt;div title=bar/&gt;
4932 </p>
4933 <div title="bar/"></div>
4934 </div>
4935
4936 !! end
4937
4938 !! test
4939 Handling html with a br self-closing tag
4940 !! input
4941 <br title />
4942 <br title/>
4943 <br title/ >
4944 <br title=bar />
4945 <br title=bar/>
4946 <br title=bar/ >
4947 !! result
4948 <p><br title="title" />
4949 <br title="title" />
4950 <br />
4951 <br title="bar" />
4952 <br title="bar" />
4953 <br title="bar/" />
4954 </p>
4955 !! end
4956
4957 !! test
4958 Horizontal ruler (should it add that extra space?)
4959 !! input
4960 <hr>
4961 <hr >
4962 foo <hr
4963 > bar
4964 !! result
4965 <hr />
4966 <hr />
4967 foo <hr /> bar
4968
4969 !! end
4970
4971 !! test
4972 Horizontal ruler -- 4+ dashes render hr
4973 !! input
4974 ----
4975 !! result
4976 <hr />
4977
4978 !! end
4979
4980 !! test
4981 Horizontal ruler -- eats additional dashes on the same line
4982 !! input
4983 ---------
4984 !! result
4985 <hr />
4986
4987 !! end
4988
4989 !! test
4990 Horizontal ruler -- does not collapse dashes on consecutive lines
4991 !! input
4992 ----
4993 ----
4994 !! result
4995 <hr />
4996 <hr />
4997
4998 !! end
4999
5000 !! test
5001 Horizontal ruler -- <4 dashes render as plain text
5002 !! input
5003 ---
5004 !! result
5005 <p>---
5006 </p>
5007 !! end
5008
5009 !! test
5010 Horizontal ruler -- Supports content following dashes on same line
5011 !! input
5012 ---- Foo
5013 !! result
5014 <hr /> Foo
5015
5016 !! end
5017
5018 ###
5019 ### Block-level elements
5020 ###
5021 !! test
5022 Common list
5023 !! input
5024 *Common list
5025 * item 2
5026 *item 3
5027 !! result
5028 <ul><li>Common list
5029 </li><li> item 2
5030 </li><li>item 3
5031 </li></ul>
5032
5033 !! end
5034
5035 !! test
5036 Numbered list
5037 !! input
5038 #Numbered list
5039 #item 2
5040 # item 3
5041 !! result
5042 <ol><li>Numbered list
5043 </li><li>item 2
5044 </li><li> item 3
5045 </li></ol>
5046
5047 !! end
5048
5049 !! test
5050 Mixed list
5051 !! input
5052 *Mixed list
5053 *# with numbers
5054 ** and bullets
5055 *# and numbers
5056 *bullets again
5057 **bullet level 2
5058 ***bullet level 3
5059 ***#Number on level 4
5060 **bullet level 2
5061 **#Number on level 3
5062 **#Number on level 3
5063 *#number level 2
5064 *Level 1
5065 *** Level 3
5066 #** Level 3, but ordered
5067 !! result
5068 <ul><li>Mixed list
5069 <ol><li> with numbers
5070 </li></ol>
5071 <ul><li> and bullets
5072 </li></ul>
5073 <ol><li> and numbers
5074 </li></ol>
5075 </li><li>bullets again
5076 <ul><li>bullet level 2
5077 <ul><li>bullet level 3
5078 <ol><li>Number on level 4
5079 </li></ol>
5080 </li></ul>
5081 </li><li>bullet level 2
5082 <ol><li>Number on level 3
5083 </li><li>Number on level 3
5084 </li></ol>
5085 </li></ul>
5086 <ol><li>number level 2
5087 </li></ol>
5088 </li><li>Level 1
5089 <ul><li><ul><li> Level 3
5090 </li></ul>
5091 </li></ul>
5092 </li></ul>
5093 <ol><li><ul><li><ul><li> Level 3, but ordered
5094 </li></ul>
5095 </li></ul>
5096 </li></ol>
5097
5098 !! end
5099
5100 !! test
5101 Nested lists 1
5102 !! input
5103 *foo
5104 **bar
5105 !! result
5106 <ul><li>foo
5107 <ul><li>bar
5108 </li></ul>
5109 </li></ul>
5110
5111 !! end
5112
5113 !! test
5114 Nested lists 2
5115 !! input
5116 **foo
5117 *bar
5118 !! result
5119 <ul><li><ul><li>foo
5120 </li></ul>
5121 </li><li>bar
5122 </li></ul>
5123
5124 !! end
5125
5126 !! test
5127 Nested lists 3 (first element empty)
5128 !! input
5129 *
5130 **bar
5131 !! result
5132 <ul><li>
5133 <ul><li>bar
5134 </li></ul>
5135 </li></ul>
5136
5137 !! end
5138
5139 !! test
5140 Nested lists 4 (first element empty)
5141 !! input
5142 **
5143 *bar
5144 !! result
5145 <ul><li><ul><li>
5146 </li></ul>
5147 </li><li>bar
5148 </li></ul>
5149
5150 !! end
5151
5152 !! test
5153 Nested lists 5 (both elements empty)
5154 !! input
5155 **
5156 *
5157 !! result
5158 <ul><li><ul><li>
5159 </li></ul>
5160 </li><li>
5161 </li></ul>
5162
5163 !! end
5164
5165 !! test
5166 Nested lists 6 (both elements empty)
5167 !! input
5168 *
5169 **
5170 !! result
5171 <ul><li>
5172 <ul><li>
5173 </li></ul>
5174 </li></ul>
5175
5176 !! end
5177
5178 !! test
5179 Nested lists 7 (skip initial nesting levels)
5180 !! input
5181 *** foo
5182 !! result
5183 <ul><li><ul><li><ul><li> foo
5184 </li></ul>
5185 </li></ul>
5186 </li></ul>
5187
5188 !! end
5189
5190 !! test
5191 Nested lists 8 (multiple nesting transitions)
5192 !! input
5193 * foo
5194 *** bar
5195 ** baz
5196 * boo
5197 !! result
5198 <ul><li> foo
5199 <ul><li><ul><li> bar
5200 </li></ul>
5201 </li><li> baz
5202 </li></ul>
5203 </li><li> boo
5204 </li></ul>
5205
5206 !! end
5207
5208 !! test
5209 1. Lists with start-of-line-transparent tokens before bullets: Comments
5210 !! input
5211 *foo
5212 *<!--cmt-->bar
5213 <!--cmt-->*baz
5214 !! result
5215 <ul><li>foo
5216 </li><li>bar
5217 </li><li>baz
5218 </li></ul>
5219
5220 !! end
5221
5222 !! test
5223 2. Lists with start-of-line-transparent tokens before bullets: Template close
5224 !! input
5225 *foo {{echo|bar
5226 }}*baz
5227 !! result
5228 <ul><li>foo bar
5229 </li><li>baz
5230 </li></ul>
5231
5232 !! end
5233
5234 !! test
5235 List items are not parsed correctly following a <pre> block (bug 785)
5236 !! input
5237 * <pre>foo</pre>
5238 * <pre>bar</pre>
5239 * zar
5240 !! result
5241 <ul><li> <pre>foo</pre>
5242 </li><li> <pre>bar</pre>
5243 </li><li> zar
5244 </li></ul>
5245
5246 !! end
5247
5248 !! test
5249 List items from template
5250 !! input
5251
5252 {{inner list}}
5253 * item 2
5254
5255 * item 0
5256 {{inner list}}
5257 * item 2
5258
5259 * item 0
5260 * notSOL{{inner list}}
5261 * item 2
5262 !! result
5263 <ul><li> item 1
5264 </li><li> item 2
5265 </li></ul>
5266 <ul><li> item 0
5267 </li><li> item 1
5268 </li><li> item 2
5269 </li></ul>
5270 <ul><li> item 0
5271 </li><li> notSOL
5272 </li><li> item 1
5273 </li><li> item 2
5274 </li></ul>
5275
5276 !! end
5277
5278 !! test
5279 List interrupted by empty line or heading
5280 !! input
5281 * foo
5282
5283 ** bar
5284 == A heading ==
5285 * Another list item
5286 !! result
5287 <ul><li> foo
5288 </li></ul>
5289 <ul><li><ul><li> bar
5290 </li></ul>
5291 </li></ul>
5292 <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>
5293 <ul><li> Another list item
5294 </li></ul>
5295
5296 !!end
5297
5298 !!test
5299 Multiple list tags generated by templates
5300 !!input
5301 {{echo|<li>}}a
5302 {{echo|<li>}}b
5303 {{echo|<li>}}c
5304 !!result
5305 <li>a
5306 <li>b
5307 <li>c</li>
5308 </li>
5309 </li>
5310
5311 !!end
5312
5313 !!test
5314 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5315 !!input
5316 *a
5317 <!--This line will NOT split the list-->
5318 *b
5319 <!--This line will NOT split the list either-->
5320 *c
5321 <!--foo--> <!--This line with more than 1 comment will split the list-->
5322 *d
5323 !!result
5324 <ul><li>a
5325 </li><li>b
5326 </li><li>c
5327 </li></ul>
5328 <ul><li>d
5329 </li></ul>
5330
5331 !!end
5332
5333 !!test
5334 Test the li-hack
5335 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5336 !!options
5337 parsoid=wt2html,wt2wt
5338 !!input
5339 * foo
5340 * <li>li-hack
5341 * {{echo|<li>templated li-hack}}
5342 * <!--foo--> <li> unsupported li-hack with preceding comments
5343
5344 <ul>
5345 <li><li>not a li-hack
5346 </li>
5347 </ul>
5348 !!result
5349 <ul><li> foo</li>
5350 <li>li-hack</li>
5351 <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>
5352 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5353
5354 <ul>
5355 <li></li><li>not a li-hack
5356 </li>
5357 </ul>
5358 !!end
5359
5360 !! test
5361 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5362 !! options
5363 parsoid
5364 !! input
5365 # foo
5366 ## bar
5367 * foo
5368 ** bar
5369 : foo
5370 :: bar
5371 !! result
5372 <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>
5373 !! end
5374
5375 # ------------------------------------------------------------------------
5376 # The next set of tests are about Parsoid's ability to handle badly nested
5377 # tags (parse, minimize scope of fixup, and roundtrip back)
5378 # ------------------------------------------------------------------------
5379
5380 !! test
5381 Unbalanced closing block tags break a list
5382 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5383 !! options
5384 parsoid
5385 !! input
5386 <div>
5387 *a</div><div>
5388 *b</div>
5389 !! result
5390 <div>
5391 <ul><li>a
5392 </li></ul></div><div>
5393 <ul><li>b
5394 </li></ul></div>
5395 !! end
5396
5397 !! test
5398 Unbalanced closing non-block tags don't break a list
5399 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5400 !! options
5401 parsoid
5402 !! input
5403 <span>
5404 *a</span><span>
5405 *b</span>
5406 !! result
5407 <p><span></span>
5408 </p>
5409 <ul><li>a<span></span>
5410 </li><li>b
5411 </li></ul>
5412 !! end
5413
5414 !! test
5415 Unclosed formatting tags that straddle lists are closed and reopened
5416 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5417 !! options
5418 parsoid
5419 !! input
5420 # <s> a
5421 # b </s>
5422 !! result
5423 <ol><li> <s> a </s>
5424 </li><li> <s> b </s>
5425 </li></ol>
5426 !! end
5427
5428 !!test
5429 List embedded in a non-block tag
5430 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5431 !! options
5432 parsoid
5433 !!input
5434 <small>
5435 * foo
5436 </small>
5437 !!result
5438 <p><small></small></p>
5439 <small>
5440 <ul>
5441 <li> foo</li>
5442 </ul>
5443 </small>
5444 <p><small></small></p>
5445 !!end
5446
5447 ###
5448 ### Magic Words
5449 ###
5450
5451 !! test
5452 Magic Word: {{CURRENTDAY}}
5453 !! input
5454 {{CURRENTDAY}}
5455 !! result
5456 <p>1
5457 </p>
5458 !! end
5459
5460 !! test
5461 Magic Word: {{CURRENTDAY2}}
5462 !! input
5463 {{CURRENTDAY2}}
5464 !! result
5465 <p>01
5466 </p>
5467 !! end
5468
5469 !! test
5470 Magic Word: {{CURRENTDAYNAME}}
5471 !! input
5472 {{CURRENTDAYNAME}}
5473 !! result
5474 <p>Thursday
5475 </p>
5476 !! end
5477
5478 !! test
5479 Magic Word: {{CURRENTDOW}}
5480 !! input
5481 {{CURRENTDOW}}
5482 !! result
5483 <p>4
5484 </p>
5485 !! end
5486
5487 !! test
5488 Magic Word: {{CURRENTMONTH}}
5489 !! input
5490 {{CURRENTMONTH}}
5491 !! result
5492 <p>01
5493 </p>
5494 !! end
5495
5496 !! test
5497 Magic Word: {{CURRENTMONTHABBREV}}
5498 !! input
5499 {{CURRENTMONTHABBREV}}
5500 !! result
5501 <p>Jan
5502 </p>
5503 !! end
5504
5505 !! test
5506 Magic Word: {{CURRENTMONTHNAME}}
5507 !! input
5508 {{CURRENTMONTHNAME}}
5509 !! result
5510 <p>January
5511 </p>
5512 !! end
5513
5514 !! test
5515 Magic Word: {{CURRENTMONTHNAMEGEN}}
5516 !! input
5517 {{CURRENTMONTHNAMEGEN}}
5518 !! result
5519 <p>January
5520 </p>
5521 !! end
5522
5523 !! test
5524 Magic Word: {{CURRENTTIME}}
5525 !! input
5526 {{CURRENTTIME}}
5527 !! result
5528 <p>00:02
5529 </p>
5530 !! end
5531
5532 !! test
5533 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5534 !! input
5535 {{CURRENTWEEK}}
5536 !! result
5537 <p>1
5538 </p>
5539 !! end
5540
5541 !! test
5542 Magic Word: {{CURRENTYEAR}}
5543 !! input
5544 {{CURRENTYEAR}}
5545 !! result
5546 <p>1970
5547 </p>
5548 !! end
5549
5550 !! test
5551 Magic Word: {{FULLPAGENAME}}
5552 !! options
5553 title=[[User:Ævar Arnfjörð Bjarmason]]
5554 !! input
5555 {{FULLPAGENAME}}
5556 !! result
5557 <p>User:Ævar Arnfjörð Bjarmason
5558 </p>
5559 !! end
5560
5561 !! test
5562 Magic Word: {{FULLPAGENAMEE}}
5563 !! options
5564 title=[[User:Ævar Arnfjörð Bjarmason]]
5565 !! input
5566 {{FULLPAGENAMEE}}
5567 !! result
5568 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5569 </p>
5570 !! end
5571
5572 !! test
5573 Magic Word: {{NAMESPACE}}
5574 !! options
5575 title=[[User:Ævar Arnfjörð Bjarmason]]
5576 !! input
5577 {{NAMESPACE}}
5578 !! result
5579 <p>User
5580 </p>
5581 !! end
5582
5583 !! test
5584 Magic Word: {{NAMESPACEE}}
5585 !! options
5586 title=[[User:Ævar Arnfjörð Bjarmason]]
5587 !! input
5588 {{NAMESPACEE}}
5589 !! result
5590 <p>User
5591 </p>
5592 !! end
5593
5594 !! test
5595 Magic Word: {{NAMESPACENUMBER}}
5596 !! options
5597 title=[[User:Ævar Arnfjörð Bjarmason]]
5598 !! input
5599 {{NAMESPACENUMBER}}
5600 !! result
5601 <p>2
5602 </p>
5603 !! end
5604
5605 !! test
5606 Magic Word: {{NUMBEROFFILES}}
5607 !! input
5608 {{NUMBEROFFILES}}
5609 !! result
5610 <p>4
5611 </p>
5612 !! end
5613
5614 !! test
5615 Magic Word: {{PAGENAME}}
5616 !! options
5617 title=[[User:Ævar Arnfjörð Bjarmason]]
5618 !! input
5619 {{PAGENAME}}
5620 !! result
5621 <p>Ævar Arnfjörð Bjarmason
5622 </p>
5623 !! end
5624
5625 !! test
5626 Magic Word: {{PAGENAME}} with metacharacters
5627 !! options
5628 title=[['foo & bar = baz']]
5629 !! input
5630 ''{{PAGENAME}}''
5631 !! result
5632 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5633 </p>
5634 !! end
5635
5636 !! test
5637 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5638 !! options
5639 title=[[*RFC 1234 http://example.com/]]
5640 !! input
5641 {{PAGENAME}}
5642 !! result
5643 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5644 </p>
5645 !! end
5646
5647 !! test
5648 Magic Word: {{PAGENAMEE}}
5649 !! options
5650 title=[[User:Ævar Arnfjörð Bjarmason]]
5651 !! input
5652 {{PAGENAMEE}}
5653 !! result
5654 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5655 </p>
5656 !! end
5657
5658 !! test
5659 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5660 !! options
5661 title=[[*RFC 1234 http://example.com/]]
5662 !! input
5663 {{PAGENAMEE}}
5664 !! result
5665 <p>&#42;RFC_1234_http&#58;//example.com/
5666 </p>
5667 !! end
5668
5669 !! test
5670 Magic Word: {{REVISIONID}}
5671 !! input
5672 {{REVISIONID}}
5673 !! result
5674 <p>1337
5675 </p>
5676 !! end
5677
5678 !! test
5679 Magic Word: {{SCRIPTPATH}}
5680 !! input
5681 {{SCRIPTPATH}}
5682 !! result
5683 <p>/
5684 </p>
5685 !! end
5686
5687 !! test
5688 Magic Word: {{SERVER}}
5689 !! input
5690 {{SERVER}}
5691 !! result
5692 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5693 </p>
5694 !! end
5695
5696 !! test
5697 Magic Word: {{SERVERNAME}}
5698 !! input
5699 {{SERVERNAME}}
5700 !! result
5701 <p>example.org
5702 </p>
5703 !! end
5704
5705 !! test
5706 Magic Word: {{SITENAME}}
5707 !! input
5708 {{SITENAME}}
5709 !! result
5710 <p>MediaWiki
5711 </p>
5712 !! end
5713
5714 !! test
5715 Case-sensitive magic words, when cased differently, should just be template transclusions
5716 !! input
5717 {{CurrentMonth}}
5718 {{currentday}}
5719 {{cURreNTweEK}}
5720 {{currentHour}}
5721 !! result
5722 <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>
5723 <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>
5724 <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>
5725 <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>
5726 </p>
5727 !! end
5728
5729 !! test
5730 Case-insensitive magic words should still work with weird casing.
5731 !! input
5732 {{sErVeRNaMe}}
5733 {{LCFirst:AOEU}}
5734 {{ucFIRST:aoeu}}
5735 {{SERver}}
5736 !! result
5737 <p>example.org
5738 aOEU
5739 Aoeu
5740 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5741 </p>
5742 !! end
5743
5744 !! test
5745 Namespace 1 {{ns:1}}
5746 !! input
5747 {{ns:1}}
5748 !! result
5749 <p>Talk
5750 </p>
5751 !! end
5752
5753 !! test
5754 Namespace 1 {{ns:01}}
5755 !! input
5756 {{ns:01}}
5757 !! result
5758 <p>Talk
5759 </p>
5760 !! end
5761
5762 !! test
5763 Namespace 0 {{ns:0}} (bug 4783)
5764 !! input
5765 {{ns:0}}
5766 !! result
5767
5768 !! end
5769
5770 !! test
5771 Namespace 0 {{ns:00}} (bug 4783)
5772 !! input
5773 {{ns:00}}
5774 !! result
5775
5776 !! end
5777
5778 !! test
5779 Namespace -1 {{ns:-1}}
5780 !! input
5781 {{ns:-1}}
5782 !! result
5783 <p>Special
5784 </p>
5785 !! end
5786
5787 !! test
5788 Namespace User {{ns:User}}
5789 !! input
5790 {{ns:User}}
5791 !! result
5792 <p>User
5793 </p>
5794 !! end
5795
5796 !! test
5797 Namespace User talk {{ns:User_talk}}
5798 !! input
5799 {{ns:User_talk}}
5800 !! result
5801 <p>User talk
5802 </p>
5803 !! end
5804
5805 !! test
5806 Namespace User talk {{ns:uSeR tAlK}}
5807 !! input
5808 {{ns:uSeR tAlK}}
5809 !! result
5810 <p>User talk
5811 </p>
5812 !! end
5813
5814 !! test
5815 Namespace File {{ns:File}}
5816 !! input
5817 {{ns:File}}
5818 !! result
5819 <p>File
5820 </p>
5821 !! end
5822
5823 !! test
5824 Namespace File {{ns:Image}}
5825 !! input
5826 {{ns:Image}}
5827 !! result
5828 <p>File
5829 </p>
5830 !! end
5831
5832 !! test
5833 Namespace (lang=de) Benutzer {{ns:User}}
5834 !! options
5835 language=de
5836 !! input
5837 {{ns:User}}
5838 !! result
5839 <p>Benutzer
5840 </p>
5841 !! end
5842
5843 !! test
5844 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5845 !! options
5846 language=de
5847 !! input
5848 {{ns:3}}
5849 !! result
5850 <p>Benutzer Diskussion
5851 </p>
5852 !! end
5853
5854
5855 !! test
5856 Urlencode
5857 !! input
5858 {{urlencode:hi world?!}}
5859 {{urlencode:hi world?!|WIKI}}
5860 {{urlencode:hi world?!|PATH}}
5861 {{urlencode:hi world?!|QUERY}}
5862 !! result
5863 <p>hi+world%3F%21
5864 hi_world%3F!
5865 hi%20world%3F%21
5866 hi+world%3F%21
5867 </p>
5868 !! end
5869
5870 ###
5871 ### Magic links
5872 ###
5873 !! test
5874 Magic links: internal link to RFC (bug 479)
5875 !! input
5876 [[RFC 123]]
5877 !! result
5878 <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>
5879 </p>
5880 !! end
5881
5882 !! test
5883 Magic links: RFC (bug 479)
5884 !! input
5885 RFC 822
5886 !! result
5887 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5888 </p>
5889 !! end
5890
5891 !! test
5892 Magic links: ISBN (bug 1937)
5893 !! input
5894 ISBN 0-306-40615-2
5895 !! result
5896 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5897 </p>
5898 !! end
5899
5900 !! test
5901 Magic links: PMID incorrectly converts space to underscore
5902 !! input
5903 PMID 1234
5904 !! result
5905 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5906 </p>
5907 !! end
5908
5909 ###
5910 ### Templates
5911 ####
5912
5913 !! test
5914 Nonexistent template
5915 !! input
5916 {{thistemplatedoesnotexist}}
5917 !! result
5918 <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>
5919 </p>
5920 !! end
5921
5922 !! test
5923 Template with invalid target containing tags
5924 !! input
5925 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5926 !! result
5927 <p>{{a<b>b</b>|foo|a=b|a = b}}
5928 </p>
5929 !! end
5930
5931 !! test
5932 Template with invalid target containing unclosed tag
5933 !! input
5934 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5935 !! result
5936 <p>{{a<b>|foo|a=b|a = b}}</b>
5937 </p>
5938 !! end
5939
5940 !! article
5941 Template:test
5942 !! text
5943 This is a test template
5944 !! endarticle
5945
5946 !! test
5947 Simple template
5948 !! input
5949 {{test}}
5950 !! result
5951 <p>This is a test template
5952 </p>
5953 !! end
5954
5955 !! test
5956 Template with explicit namespace
5957 !! input
5958 {{Template:test}}
5959 !! result
5960 <p>This is a test template
5961 </p>
5962 !! end
5963
5964
5965 !! article
5966 Template:paramtest
5967 !! text
5968 This is a test template with parameter {{{param}}}
5969 !! endarticle
5970
5971 !! test
5972 Template parameter
5973 !! input
5974 {{paramtest|param=foo}}
5975 !! result
5976 <p>This is a test template with parameter foo
5977 </p>
5978 !! end
5979
5980 !! article
5981 Template:paramtestnum
5982 !! text
5983 [[{{{1}}}|{{{2}}}]]
5984 !! endarticle
5985
5986 !! test
5987 Template unnamed parameter
5988 !! input
5989 {{paramtestnum|Main Page|the main page}}
5990 !! result
5991 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5992 </p>
5993 !! end
5994
5995 !! article
5996 Template:templatesimple
5997 !! text
5998 (test)
5999 !! endarticle
6000
6001 !! article
6002 Template:templateredirect
6003 !! text
6004 #redirect [[Template:templatesimple]]
6005 !! endarticle
6006
6007 !! article
6008 Template:templateasargtestnum
6009 !! text
6010 {{{{{1}}}}}
6011 !! endarticle
6012
6013 !! article
6014 Template:templateasargtest
6015 !! text
6016 {{template{{{templ}}}}}
6017 !! endarticle
6018
6019 !! article
6020 Template:templateasargtest2
6021 !! text
6022 {{{{{templ}}}}}
6023 !! endarticle
6024
6025 !! test
6026 Template with template name as unnamed argument
6027 !! input
6028 {{templateasargtestnum|templatesimple}}
6029 !! result
6030 <p>(test)
6031 </p>
6032 !! end
6033
6034 !! test
6035 Template with template name as argument
6036 !! input
6037 {{templateasargtest|templ=simple}}
6038 !! result
6039 <p>(test)
6040 </p>
6041 !! end
6042
6043 !! test
6044 Template with template name as argument (2)
6045 !! input
6046 {{templateasargtest2|templ=templatesimple}}
6047 !! result
6048 <p>(test)
6049 </p>
6050 !! end
6051
6052 !! article
6053 Template:templateasargtestdefault
6054 !! text
6055 {{{{{templ|templatesimple}}}}}
6056 !! endarticle
6057
6058 !! article
6059 Template:templa
6060 !! text
6061 '''templ'''
6062 !! endarticle
6063
6064 !! test
6065 Template with default value
6066 !! input
6067 {{templateasargtestdefault}}
6068 !! result
6069 <p>(test)
6070 </p>
6071 !! end
6072
6073 !! test
6074 Template with default value (value set)
6075 !! input
6076 {{templateasargtestdefault|templ=templa}}
6077 !! result
6078 <p><b>templ</b>
6079 </p>
6080 !! end
6081
6082 !! test
6083 Template redirect
6084 !! input
6085 {{templateredirect}}
6086 !! result
6087 <p>(test)
6088 </p>
6089 !! end
6090
6091 !! test
6092 Template with argument in separate line
6093 !! input
6094 {{ templateasargtest |
6095 templ = simple }}
6096 !! result
6097 <p>(test)
6098 </p>
6099 !! end
6100
6101 !! test
6102 Template with complex template as argument
6103 !! input
6104 {{paramtest|
6105 param ={{ templateasargtest |
6106 templ = simple }}}}
6107 !! result
6108 <p>This is a test template with parameter (test)
6109 </p>
6110 !! end
6111
6112 !! test
6113 Template with thumb image (with link in description)
6114 !! input
6115 {{paramtest|
6116 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6117 !! result
6118 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>
6119
6120 !! end
6121
6122 !! article
6123 Template:complextemplate
6124 !! text
6125 {{{1}}} {{paramtest|
6126 param ={{{param}}}}}
6127 !! endarticle
6128
6129 !! test
6130 Template with complex arguments
6131 !! input
6132 {{complextemplate|
6133 param ={{ templateasargtest |
6134 templ = simple }}|[[Template:complextemplate|link]]}}
6135 !! result
6136 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6137 </p>
6138 !! end
6139
6140 !! test
6141 BUG 553: link with two variables in a piped link
6142 !! input
6143 {|
6144 |[[{{{1}}}|{{{2}}}]]
6145 |}
6146 !! result
6147 <table>
6148 <tr>
6149 <td>[[{{{1}}}|{{{2}}}]]
6150 </td></tr></table>
6151
6152 !! end
6153
6154 !! test
6155 Magic variable as template parameter
6156 !! input
6157 {{paramtest|param={{SITENAME}}}}
6158 !! result
6159 <p>This is a test template with parameter MediaWiki
6160 </p>
6161 !! end
6162
6163 !! article
6164 Template:linktest
6165 !! text
6166 [[{{{param}}}|link]]
6167 !! endarticle
6168
6169 !! test
6170 Template parameter as link source
6171 !! input
6172 {{linktest|param=Main Page}}
6173 !! result
6174 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6175 </p>
6176 !! end
6177
6178 !!test
6179 Template-generated attribute string (k='v')
6180 !!input
6181 <span {{attr_str|id|v1}}>bar</span>
6182 !!result
6183 <p><span id="v1">bar</span>
6184 </p>
6185 !!end
6186
6187 !!article
6188 Template:paramtest2
6189 !! text
6190 including another template, {{paramtest|param={{{arg}}}}}
6191 !! endarticle
6192
6193 !! test
6194 Template passing argument to another template
6195 !! input
6196 {{paramtest2|arg='hmm'}}
6197 !! result
6198 <p>including another template, This is a test template with parameter 'hmm'
6199 </p>
6200 !! end
6201
6202 !! article
6203 Template:Linktest2
6204 !! text
6205 Main Page
6206 !! endarticle
6207
6208 !! test
6209 Template as link source
6210 !! input
6211 [[{{linktest2}}]]
6212
6213 [[{{linktest2}}|Main Page]]
6214
6215 [[{{linktest2}}]]Page
6216 !! result
6217 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6218 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6219 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6220 </p>
6221 !! end
6222
6223
6224 !! article
6225 Template:loop1
6226 !! text
6227 {{loop2}}
6228 !! endarticle
6229
6230 !! article
6231 Template:loop2
6232 !! text
6233 {{loop1}}
6234 !! endarticle
6235
6236 !! test
6237 Template infinite loop
6238 !! input
6239 {{loop1}}
6240 !! result
6241 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6242 </p>
6243 !! end
6244
6245 !! test
6246 Template from main namespace
6247 !! input
6248 {{:Main Page}}
6249 !! result
6250 <p>blah blah
6251 </p>
6252 !! end
6253
6254 !! article
6255 Template:table
6256 !! text
6257 {|
6258 | 1 || 2
6259 |-
6260 | 3 || 4
6261 |}
6262 !! endarticle
6263
6264 !! test
6265 BUG 529: Template with table, not included at beginning of line
6266 !! input
6267 foo {{table}}
6268 !! result
6269 <p>foo
6270 </p>
6271 <table>
6272 <tr>
6273 <td> 1 </td>
6274 <td> 2
6275 </td></tr>
6276 <tr>
6277 <td> 3 </td>
6278 <td> 4
6279 </td></tr></table>
6280
6281 !! end
6282
6283 !! test
6284 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6285 !! input
6286 foo
6287 {{table}}
6288 !! result
6289 <p>foo
6290 </p>
6291 <table>
6292 <tr>
6293 <td> 1 </td>
6294 <td> 2
6295 </td></tr>
6296 <tr>
6297 <td> 3 </td>
6298 <td> 4
6299 </td></tr></table>
6300
6301 !! end
6302
6303 !! test
6304 BUG 41: Template parameters shown as broken links
6305 !! input
6306 {{{parameter}}}
6307 !! result
6308 <p>{{{parameter}}}
6309 </p>
6310 !! end
6311
6312 !! test
6313 Template with targets containing wikilinks
6314 !! input
6315 {{[[foo]]}}
6316
6317 {{[[{{echo|foo}}]]}}
6318
6319 {{{{echo|[[foo}}]]}}
6320 !! result
6321 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6322 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6323 </p><p>{{[[foo}}]]
6324 </p>
6325 !! end
6326
6327 !! article
6328 Template:MSGNW test
6329 !! text
6330 ''None'' of '''this''' should be
6331 * interpreted
6332 but rather passed unmodified
6333 {{test}}
6334 !! endarticle
6335
6336 # hmm, fix this or just deprecate msgnw and document its behavior?
6337 !! test
6338 msgnw keyword
6339 !! options
6340 disabled
6341 !! input
6342 {{msgnw:MSGNW test}}
6343 !! result
6344 <p>''None'' of '''this''' should be
6345 * interpreted
6346 but rather passed unmodified
6347 {{test}}
6348 </p>
6349 !! end
6350
6351 !! test
6352 int keyword
6353 !! input
6354 {{int:youhavenewmessages|lots of money|not!}}
6355 !! result
6356 <p>You have lots of money (not!).
6357 </p>
6358 !! end
6359
6360 !! article
6361 Template:Includes
6362 !! text
6363 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6364 !! endarticle
6365
6366 !! test
6367 <includeonly> and <noinclude> being included
6368 !! input
6369 {{Includes}}
6370 !! result
6371 <p>Foobar
6372 </p>
6373 !! end
6374
6375 !! article
6376 Template:Includes2
6377 !! text
6378 <onlyinclude>Foo</onlyinclude>bar
6379 !! endarticle
6380
6381 !! test
6382 <onlyinclude> being included
6383 !! input
6384 {{Includes2}}
6385 !! result
6386 <p>Foo
6387 </p>
6388 !! end
6389
6390
6391 !! article
6392 Template:Includes3
6393 !! text
6394 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6395 !! endarticle
6396
6397 !! test
6398 <onlyinclude> and <includeonly> being included
6399 !! input
6400 {{Includes3}}
6401 !! result
6402 <p>Foo
6403 </p>
6404 !! end
6405
6406 !! test
6407 <includeonly> and <noinclude> on a page
6408 !! input
6409 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6410 !! result
6411 <p>Foozar
6412 </p>
6413 !! end
6414
6415 !! test
6416 Un-closed <noinclude>
6417 !! input
6418 <noinclude>
6419 !! result
6420 !! end
6421
6422 !! test
6423 <onlyinclude> on a page
6424 !! input
6425 <onlyinclude>Foo</onlyinclude>bar
6426 !! result
6427 <p>Foobar
6428 </p>
6429 !! end
6430
6431 !! test
6432 Un-closed <onlyinclude>
6433 !! input
6434 <onlyinclude>
6435 !! result
6436 !! end
6437
6438 !!test
6439 Self-closed noinclude, includeonly, onlyinclude tags
6440 !!input
6441 <noinclude />
6442 <includeonly />
6443 <onlyinclude />
6444 !!result
6445 <p><br />
6446 </p>
6447 !!end
6448
6449 !!test
6450 Unbalanced includeonly and noinclude tags
6451 !!input
6452 {|
6453 |a</noinclude>
6454 |b</noinclude></noinclude>
6455 |c</noinclude></includeonly>
6456 |d</includeonly></includeonly>
6457 |}
6458 !!result
6459 <table>
6460 <tr>
6461 <td>a
6462 </td>
6463 <td>b
6464 </td>
6465 <td>c&lt;/includeonly&gt;
6466 </td>
6467 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6468 </td></tr></table>
6469
6470 !!end
6471
6472 !! article
6473 Template:Includeonly section
6474 !! text
6475 <includeonly>
6476 ==Includeonly section==
6477 </includeonly>
6478 ==Section T-1==
6479 !!endarticle
6480
6481 !! test
6482 Bug 6563: Edit link generation for section shown by <includeonly>
6483 !! input
6484 {{includeonly section}}
6485 !! result
6486 <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>
6487 <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>
6488
6489 !! end
6490
6491 # Uses same input as the contents of [[Template:Includeonly section]]
6492 !! test
6493 Bug 6563: Section extraction for section shown by <includeonly>
6494 !! options
6495 section=T-2
6496 !! input
6497 <includeonly>
6498 ==Includeonly section==
6499 </includeonly>
6500 ==Section T-2==
6501 !! result
6502 ==Section T-2==
6503 !! end
6504
6505 !! test
6506 Bug 6563: Edit link generation for section suppressed by <includeonly>
6507 !! input
6508 <includeonly>
6509 ==Includeonly section==
6510 </includeonly>
6511 ==Section 1==
6512 !! result
6513 <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>
6514
6515 !! end
6516
6517 !! test
6518 Bug 6563: Section extraction for section suppressed by <includeonly>
6519 !! options
6520 section=1
6521 !! input
6522 <includeonly>
6523 ==Includeonly section==
6524 </includeonly>
6525 ==Section 1==
6526 !! result
6527 ==Section 1==
6528 !! end
6529
6530 !! test
6531 Un-closed <includeonly>
6532 !! input
6533 <includeonly>
6534 !! result
6535 !! end
6536
6537 # TODO: test with DOM fragment reuse!
6538 !! test
6539 Parsoid: DOM fragment reuse
6540 !! options
6541 parsoid=wt2wt,wt2html
6542 !! input
6543 a{{echo|b<table></table>c}}d
6544
6545 a{{echo|b
6546 <table></table>
6547 c}}d
6548
6549 {{echo|a
6550
6551 <table></table>
6552
6553 b}}
6554 !! result
6555 a<span typeof="mw:Transclusion">b</span>
6556 <table></table><span>c</span>d
6557 <p typeof="mw:Transclusion">ab</p>
6558 <table></table>
6559 <p>cd</p>
6560 <p typeof="mw:Transclusion">a</p>
6561 <table></table>
6562 <p>b</p>
6563 !! end
6564
6565 ###
6566 ### <includeonly> and <noinclude> in attributes
6567 ###
6568 !!test
6569 0. includeonly around the entire attribute
6570 !!input
6571 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6572 !!result
6573 <p><span id="v2">bar</span>
6574 </p>
6575 !!end
6576
6577 !!test
6578 1. includeonly in html attr key
6579 !!input
6580 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6581 !!result
6582 <p><span id="foo">bar</span>
6583 </p>
6584 !!end
6585
6586 !!test
6587 2. includeonly in html attr value
6588 !!input
6589 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6590 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6591 !!result
6592 <p><span id="v1">bar</span>
6593 <span id="v1">bar</span>
6594 </p>
6595 !!end
6596
6597 !!test
6598 3. includeonly in part of an attr value
6599 !!input
6600 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6601 !!result
6602 <p><span style="color:red;">bar</span>
6603 </p>
6604 !!end
6605
6606 ###
6607 ### Testing parsing of templates where a template arg
6608 ### has the same name as the template itself.
6609 ###
6610
6611 !! article
6612 Template:quote
6613 !! text
6614 {{{quote|{{{1}}}}}}
6615 !! endarticle
6616
6617 !!test
6618 Templates: Template Name/Arg clash: 1. Use of positional param
6619 !!input
6620 {{quote|foo}}
6621 !!result
6622 <p>foo
6623 </p>
6624 !!end
6625
6626 !!test
6627 Templates: Template Name/Arg clash: 2. Use of named param
6628 !!input
6629 {{quote|quote=foo}}
6630 !!result
6631 <p>foo
6632 </p>
6633 !!end
6634
6635 !!test
6636 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6637 !!input
6638 {{quote|quote}}
6639 !!result
6640 <p>quote
6641 </p>
6642 !!end
6643
6644 ###
6645 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6646 ###
6647
6648 !!test
6649 Templates: 1. Simple use
6650 !!input
6651 {{echo|Foo}}
6652 !!result
6653 <p>Foo
6654 </p>
6655 !!end
6656
6657 !!test
6658 Templates: 2. Inside a block tag
6659 !!input
6660 <div>{{echo|Foo}}</div>
6661 !!result
6662 <div>Foo</div>
6663
6664 !!end
6665
6666 !!test
6667 Templates: P-wrapping: 1a. Templates on consecutive lines
6668 !!input
6669 {{echo|Foo}}
6670 {{echo|bar}}
6671 !!result
6672 <p>Foo
6673 bar
6674 </p>
6675 !!end
6676
6677 !!test
6678 Templates: P-wrapping: 1b. Templates on consecutive lines
6679 !!input
6680 Foo
6681
6682 {{echo|bar}}
6683 {{echo|baz}}
6684 !!result
6685 <p>Foo
6686 </p><p>bar
6687 baz
6688 </p>
6689 !!end
6690
6691 !!test
6692 Templates: P-wrapping: 1c. Templates on consecutive lines
6693 !!input
6694 {{echo|Foo}}
6695 {{echo|bar}} <div>baz</div>
6696 !!result
6697 <p>Foo
6698 </p>
6699 bar <div>baz</div>
6700
6701 !!end
6702
6703 !!test
6704 Templates: P-wrapping: 1d. Template preceded by comment-only line
6705 !!options
6706 parsoid=wt2html,wt2wt
6707 !!input
6708 <!-- foo -->
6709 {{echo|Bar}}
6710 !!result
6711 <!-- foo -->
6712 <p typeof="mw:Transclusion">Bar
6713 </p>
6714 !!end
6715
6716 !!test
6717 Templates: Inline Text: 1. Multiple tmeplate uses
6718 !!input
6719 {{echo|Foo}}bar{{echo|baz}}
6720 !!result
6721 <p>Foobarbaz
6722 </p>
6723 !!end
6724
6725 !!test
6726 Templates: Inline Text: 2. Back-to-back template uses
6727 !!input
6728 {{echo|Foo}}{{echo|bar}}
6729 !!result
6730 <p>Foobar
6731 </p>
6732 !!end
6733
6734 !!test
6735 Templates: Block Tags: 1. Multiple template uses
6736 !!input
6737 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6738 !!result
6739 <div>Foo</div><div>bar</div><div>baz</div>
6740
6741 !!end
6742
6743 !!test
6744 Templates: Block Tags: 2. Back-to-back template uses
6745 !!input
6746 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6747 !!result
6748 <div>Foo</div><div>bar</div>
6749
6750 !!end
6751
6752 !!test
6753 Templates: Links: 1. Simple example
6754 !!input
6755 {{echo|[[Foo|bar]]}}
6756 !!result
6757 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6758 </p>
6759 !!end
6760
6761 !!test
6762 Templates: Links: 2. Generation of link href
6763 !!input
6764 [[{{echo|Foo}}|bar]]
6765 !!result
6766 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6767 </p>
6768 !!end
6769
6770 !!test
6771 Templates: Links: 3. Generation of part of a link href
6772 !!input
6773 [[Fo{{echo|o}}|bar]]
6774
6775 [[Foo{{echo|bar}}]]
6776
6777 [[Foo{{echo|bar}}baz]]
6778
6779 [[Foo{{echo|bar}}|bar]]
6780
6781 [[:Foo{{echo|bar}}]]
6782
6783 [[:Foo{{echo|bar}}|bar]]
6784 !!result
6785 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6786 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6787 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6788 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6789 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6790 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6791 </p>
6792 !!end
6793
6794 !!test
6795 Templates: Links: 4. Multiple templates generating link href
6796 !!input
6797 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6798 !!result
6799 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6800 </p>
6801 !!end
6802
6803 !!test
6804 Templates: Links: 5. Generation of link text
6805 !!input
6806 [[Foo|{{echo|bar}}]]
6807 !!result
6808 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6809 </p>
6810 !!end
6811
6812 !!test
6813 Templates: Links: 5. Nested templates (only outermost template should be marked)
6814 !!input
6815 {{echo|[[{{echo|Foo}}|bar]]}}
6816 !!result
6817 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6818 </p>
6819 !!end
6820
6821 !!test
6822 Templates: HTML Tag: 1. Generation of HTML attr. key
6823 !!input
6824 <div {{echo|style}}="color:red;">foo</div>
6825 !!result
6826 <div style="color:red;">foo</div>
6827
6828 !!end
6829
6830 !!test
6831 Templates: HTML Tag: 2. Generation of HTML attr. value
6832 !!input
6833 <div style={{echo|'color:red;'}}>foo</div>
6834 !!result
6835 <div style="color:red;">foo</div>
6836
6837 !!end
6838
6839 !!test
6840 Templates: HTML Tag: 3. Generation of HTML attr key and value
6841 !!input
6842 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6843 !!result
6844 <div style="color:red;">foo</div>
6845
6846 !!end
6847
6848 !!test
6849 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6850 !!input
6851 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6852 !!result
6853 <div title="This is a long title with just one piece templated">foo</div>
6854
6855 !!end
6856
6857 !!test
6858 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6859 !!input
6860 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6861 !!result
6862 <div title="This is a long title with just one piece templated">foo</div>
6863
6864 !!end
6865
6866 !!test
6867 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6868 !!input
6869 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6870 !!result
6871 <div title="This is a long title with just one piece templated">foo</div>
6872
6873 !!end
6874
6875 !!test
6876 Templates: HTML Tag: 7. Generation of partial attribute key string
6877 !!input
6878 <div st{{echo|yle}}="color:red;">foo</div>
6879 !!result
6880 <div style="color:red;">foo</div>
6881
6882 !!end
6883
6884 !!test
6885 Templates: HTML Tables: 1. Generating start of a HTML table
6886 !!input
6887 {{echo|<table><tr><td>foo</td>}}</tr></table>
6888 !!result
6889 <table><tr><td>foo</td></tr></table>
6890
6891 !!end
6892
6893 !!test
6894 Templates: HTML Tables: 2a. Generating middle of a HTML table
6895 !!input
6896 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6897 !!result
6898 <table><tr><td>foo</td></tr></table>
6899
6900 !!end
6901
6902 !!test
6903 Templates: HTML Tables: 2b. Generating middle of a HTML table
6904 !!input
6905 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6906 !!result
6907 <table><tr><td>foo</td></tr></table>
6908
6909 !!end
6910
6911 !!test
6912 Templates: HTML Tables: 3. Generating end of a HTML table
6913 !!input
6914 <table><tr>{{echo|<td>foo</td></tr></table>}}
6915 !!result
6916 <table><tr><td>foo</td></tr></table>
6917
6918 !!end
6919
6920 !!test
6921 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6922 !!input
6923 {{echo|<table>}}<tr><td>foo</td></tr></table>
6924 !!result
6925 <table><tr><td>foo</td></tr></table>
6926
6927 !!end
6928
6929 !!test
6930 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6931 !!input
6932 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6933 !!result
6934 <table><tr><td>foo</td></tr></table>
6935
6936 !!end
6937
6938 !!test
6939 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6940 !!input
6941 <table><tr>{{echo|<td>}}foo</td></tr></table>
6942 !!result
6943 <table><tr><td>foo</td></tr></table>
6944
6945 !!end
6946
6947 !!test
6948 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6949 !!input
6950 <table><tr><td>foo{{echo|</td>}}</tr></table>
6951 !!result
6952 <table><tr><td>foo</td></tr></table>
6953
6954 !!end
6955
6956 !!test
6957 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6958 !!input
6959 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6960 !!result
6961 <table><tr><td>foo</td></tr></table>
6962
6963 !!end
6964
6965 !!test
6966 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6967 !!input
6968 <table><tr><td>foo</td></tr>{{echo|</table>}}
6969 !!result
6970 <table><tr><td>foo</td></tr></table>
6971
6972 !!end
6973
6974 !!test
6975 Templates: HTML Tables: 5. Proper fostering of categories from inside
6976 !!options
6977 parsoid=wt2html,wt2wt
6978 !!input
6979 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6980 <!--Two categories (Bug 50330)-->
6981 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6982 !!result
6983 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6984 <!--Two categories (Bug 50330)-->
6985 <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>
6986 !!end
6987
6988 !!test
6989 Templates: Wiki Tables: 1a. Fostering of entire template content
6990 !!input
6991 {|
6992 {{echo|a}}
6993 |}
6994 !!result
6995 <table>
6996 a
6997 <tr><td></td></tr></table>
6998
6999 !!end
7000
7001 !!test
7002 Templates: Wiki Tables: 1b. Fostering of entire template content
7003 !!input
7004 {|
7005 {{echo|<div>}}
7006 foo
7007 {{echo|</div>}}
7008 |}
7009 !!result
7010 <table>
7011 <div>
7012 <p>foo
7013 </p>
7014 </div>
7015 <tr><td></td></tr></table>
7016
7017 !!end
7018
7019 !!test
7020 Templates: Wiki Tables: 2. Fostering of partial template content
7021 !!input
7022 {|
7023 {{echo|a
7024 <div>b</div>}}
7025 |}
7026 !!result
7027 <table>
7028 a
7029 <div>b</div>
7030 <tr><td></td></tr></table>
7031
7032 !!end
7033
7034 !!test
7035 Templates: Wiki Tables: 3. td-content via multiple templates
7036 !!input
7037 {|
7038 {{echo|{{pipe}}a}}{{echo|b}}
7039 |}
7040 !!result
7041 <table>
7042 <tr>
7043 <td>ab
7044 </td></tr></table>
7045
7046 !!end
7047
7048 !!test
7049 Templates: Wiki Tables: 4. Templated tags, no content
7050 !!input
7051 {{tbl-start}}
7052 {{tbl-end}}
7053 !!result
7054 <table>
7055 <tr><td></td></tr></table>
7056
7057 !!end
7058
7059 !!test
7060 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7061 !!input
7062 {{tbl-start}}
7063 |foo
7064 {{tbl-end}}
7065 !!result
7066 <table>
7067 <tr>
7068 <td>foo
7069 </td></tr></table>
7070
7071 !!end
7072
7073 !!test
7074 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7075 !!input
7076 {{tbl-start}}
7077 {{!}}foo
7078 {{tbl-end}}
7079 !!result
7080 <table>
7081 <tr>
7082 <td>foo
7083 </td></tr></table>
7084
7085 !!end
7086
7087 !!test
7088 Templates: Lists: Multi-line list-items via templates
7089 !!input
7090 *{{echo|a {{nonexistent|
7091 unused}}}}
7092 *{{echo|b {{nonexistent|
7093 unused}}}}
7094 !!result
7095 <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>
7096 </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>
7097 </li></ul>
7098
7099 !!end
7100
7101 !!test
7102 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7103 !!input
7104 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7105 !!result
7106 <p><i>ab</i>c<i>d</i>e
7107 </p>
7108 !!end
7109
7110 !!test
7111 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7112 (PHP parser generates misnested html)
7113 !! options
7114 parsoid=wt2html,wt2wt
7115 !!input
7116 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7117 !!result
7118 <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>
7119 !!end
7120
7121 !!test
7122 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7123 (PHP parser generates misnested html)
7124 !! options
7125 parsoid=wt2html,wt2wt
7126 !!input
7127 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7128 !!result
7129 <div typeof="mw:Transclusion"><i>a</i></div>
7130 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7131 <div typeof="mw:Transclusion">e</div>
7132 !!end
7133
7134 !!test
7135 Templates: Ugly nesting: 4. Divs opened/closed across templates
7136 !!input
7137 a<div>b{{echo|c</div>d}}e
7138 !!result
7139 a<div>bc</div>de
7140
7141 !!end
7142
7143 !!test
7144 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7145 (Parsoid-centric)
7146 !! options
7147 parsoid
7148 !!input
7149 {|
7150 |{{echo|foo</table>}}
7151 |bar
7152 |}
7153 !!result
7154 <table typeof="mw:Transclusion">
7155 <tbody>
7156 <tr>
7157 <td>foo</td></tr></tbody></table><span>bar</span>
7158 !!end
7159
7160 !!test
7161 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7162 (Parsoid-centric)
7163 !! options
7164 parsoid
7165 !!input
7166 <table>
7167 <tr>
7168 <td>
7169 <table>
7170 <tr>
7171 <td>1. {{echo|foo </table>}}</td>
7172 <td> bar </td>
7173 <td>2. {{echo|baz </table>}}</td>
7174 </tr>
7175 <tr>
7176 <td>abc</td>
7177 </tr>
7178 </table>
7179 </td>
7180 </tr>
7181 <tr>
7182 <td>xyz</td>
7183 </tr>
7184 </table>
7185 !!result
7186 <table about="#mwt1" typeof="mw:Transclusion">
7187 <tbody><tr >
7188 <td >
7189 <table >
7190 <tbody><tr >
7191 <td >1. foo </td></tr></tbody></table></td>
7192 <td > bar </td>
7193 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7194 </span><span about="#mwt1">
7195
7196 abc</span><span about="#mwt1">
7197 </span><span about="#mwt1">
7198 </span><span about="#mwt1">
7199 </span><span about="#mwt1">
7200 </span><span about="#mwt1">
7201
7202 xyz</span><span about="#mwt1">
7203 </span><span about="#mwt1">
7204 </span>
7205 !!end
7206
7207 !! test
7208 Templates: Ugly templates: 3. newline-only template parameter
7209 !! input
7210 foo {{echo|
7211 }}
7212 !! result
7213 <p>foo
7214 </p>
7215 !! end
7216
7217 # This looks like a bug: a single newline triggers p/br for some reason.
7218 !! test
7219 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7220 !! input
7221 {{echo|
7222 }}
7223 !! result
7224 <p><br />
7225 </p>
7226 !! end
7227
7228
7229 !!test
7230 Parser Functions: 1. Simple example
7231 !!input
7232 {{uc:foo}}
7233 !!result
7234 <p>FOO
7235 </p>
7236 !!end
7237
7238 !!test
7239 Parser Functions: 2. Nested use (only outermost should be marked up)
7240 !!input
7241 {{uc:{{lc:FOO}}}}
7242 !!result
7243 <p>FOO
7244 </p>
7245 !!end
7246
7247 ###
7248 ### Pre-save transform tests
7249 ###
7250 !! test
7251 pre-save transform: subst:
7252 !! options
7253 PST
7254 !! input
7255 {{subst:test}}
7256 !! result
7257 This is a test template
7258 !! end
7259
7260 !! test
7261 pre-save transform: normal template
7262 !! options
7263 PST
7264 !! input
7265 {{test}}
7266 !! result
7267 {{test}}
7268 !! end
7269
7270 !! test
7271 pre-save transform: nonexistent template
7272 !! options
7273 PST
7274 !! input
7275 {{thistemplatedoesnotexist}}
7276 !! result
7277 {{thistemplatedoesnotexist}}
7278 !! end
7279
7280
7281 !! test
7282 pre-save transform: subst magic variables
7283 !! options
7284 PST
7285 !! input
7286 {{subst:SITENAME}}
7287 !! result
7288 MediaWiki
7289 !! end
7290
7291 # This is bug 89, which I fixed. -- wtm
7292 !! test
7293 pre-save transform: subst: templates with parameters
7294 !! options
7295 pst
7296 !! input
7297 {{subst:paramtest|param="something else"}}
7298 !! result
7299 This is a test template with parameter "something else"
7300 !! end
7301
7302 !! article
7303 Template:nowikitest
7304 !! text
7305 <nowiki>'''not wiki'''</nowiki>
7306 !! endarticle
7307
7308 !! test
7309 pre-save transform: nowiki in subst (bug 1188)
7310 !! options
7311 pst
7312 !! input
7313 {{subst:nowikitest}}
7314 !! result
7315 <nowiki>'''not wiki'''</nowiki>
7316 !! end
7317
7318
7319 !! article
7320 Template:commenttest
7321 !! text
7322 This template has <!-- a comment --> in it.
7323 !! endarticle
7324
7325 !! test
7326 pre-save transform: comment in subst (bug 1936)
7327 !! options
7328 pst
7329 !! input
7330 {{subst:commenttest}}
7331 !! result
7332 This template has <!-- a comment --> in it.
7333 !! end
7334
7335 !! test
7336 pre-save transform: unclosed tag
7337 !! options
7338 pst noxml
7339 !! input
7340 <nowiki>'''not wiki'''
7341 !! result
7342 <nowiki>'''not wiki'''
7343 !! end
7344
7345 !! test
7346 pre-save transform: mixed tag case
7347 !! options
7348 pst noxml
7349 !! input
7350 <NOwiki>'''not wiki'''</noWIKI>
7351 !! result
7352 <NOwiki>'''not wiki'''</noWIKI>
7353 !! end
7354
7355 !! test
7356 pre-save transform: unclosed comment in <nowiki>
7357 !! options
7358 pst noxml
7359 !! input
7360 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7361 !! result
7362 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7363 !!end
7364
7365 # Leading @ in this template definition works around a limitation
7366 # in parsoid's parserTests which otherwise strips the <span> from the
7367 # result (confusing it for a template wrapper)
7368 !! article
7369 Template:dangerous
7370 !!text
7371 @<span onmouseover="alert('crap')">Oh no</span>
7372 !!endarticle
7373
7374 !!test
7375 (confirming safety of fix for subst bug 1936)
7376 !! input
7377 {{Template:dangerous}}
7378 !! result
7379 <p>@<span>Oh no</span>
7380 </p>
7381 !! end
7382
7383 !! test
7384 pre-save transform: comment containing gallery (bug 5024)
7385 !! options
7386 pst
7387 !! input
7388 <!-- <gallery>data</gallery> -->
7389 !!result
7390 <!-- <gallery>data</gallery> -->
7391 !!end
7392
7393 !! test
7394 pre-save transform: comment containing extension
7395 !! options
7396 pst
7397 !! input
7398 <!-- <tag>data</tag> -->
7399 !!result
7400 <!-- <tag>data</tag> -->
7401 !!end
7402
7403 !! test
7404 pre-save transform: comment containing nowiki
7405 !! options
7406 pst
7407 !! input
7408 <!-- <nowiki>data</nowiki> -->
7409 !!result
7410 <!-- <nowiki>data</nowiki> -->
7411 !!end
7412
7413 !! test
7414 pre-save transform: <noinclude> in subst (bug 3298)
7415 !! options
7416 pst
7417 !! input
7418 {{subst:Includes}}
7419 !! result
7420 Foobar
7421 !! end
7422
7423 !! test
7424 pre-save transform: <onlyinclude> in subst (bug 3298)
7425 !! options
7426 pst
7427 !! input
7428 {{subst:Includes2}}
7429 !! result
7430 Foo
7431 !! end
7432
7433 !! article
7434 Template:SubstTest
7435 !!text
7436 {{<includeonly>subst:</includeonly>Includes}}
7437 !! endarticle
7438
7439 !! article
7440 Template:SafeSubstTest
7441 !! text
7442 {{<includeonly>safesubst:</includeonly>Includes}}
7443 !! endarticle
7444
7445 !! test
7446 bug 22297: safesubst: works during PST
7447 !! options
7448 pst
7449 !! input
7450 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7451 !! result
7452 FoobarFoobar
7453 !! end
7454
7455 !! test
7456 bug 22297: safesubst: works during normal parse
7457 !! input
7458 {{SafeSubstTest}}
7459 !! result
7460 <p>Foobar
7461 </p>
7462 !! end
7463
7464 !! test:
7465 subst: does not work during normal parse
7466 !! input
7467 {{SubstTest}}
7468 !! result
7469 <p>{{subst:Includes}}
7470 </p>
7471 !! end
7472
7473 !! test
7474 pre-save transform: context links ("pipe trick")
7475 !! options
7476 pst
7477 !! input
7478 [[Article (context)|]]
7479 [[Bar:Article|]]
7480 [[:Bar:Article|]]
7481 [[Bar:Article (context)|]]
7482 [[:Bar:Article (context)|]]
7483 [[|Article]]
7484 [[|Article (context)]]
7485 [[Bar:X (Y) Z|]]
7486 [[:Bar:X (Y) Z|]]
7487 !! result
7488 [[Article (context)|Article]]
7489 [[Bar:Article|Article]]
7490 [[:Bar:Article|Article]]
7491 [[Bar:Article (context)|Article]]
7492 [[:Bar:Article (context)|Article]]
7493 [[Article]]
7494 [[Article (context)]]
7495 [[Bar:X (Y) Z|X (Y) Z]]
7496 [[:Bar:X (Y) Z|X (Y) Z]]
7497 !! end
7498
7499 !! test
7500 pre-save transform: context links ("pipe trick") with interwiki prefix
7501 !! options
7502 pst
7503 !! input
7504 [[interwiki:Article|]]
7505 [[:interwiki:Article|]]
7506 [[interwiki:Bar:Article|]]
7507 [[:interwiki:Bar:Article|]]
7508 !! result
7509 [[interwiki:Article|Article]]
7510 [[:interwiki:Article|Article]]
7511 [[interwiki:Bar:Article|Bar:Article]]
7512 [[:interwiki:Bar:Article|Bar:Article]]
7513 !! end
7514
7515 !! test
7516 pre-save transform: context links ("pipe trick") with parens in title
7517 !! options
7518 pst title=[[Somearticle (context)]]
7519 !! input
7520 [[|Article]]
7521 !! result
7522 [[Article (context)|Article]]
7523 !! end
7524
7525 !! test
7526 pre-save transform: context links ("pipe trick") with comma in title
7527 !! options
7528 pst title=[[Someplace, Somewhere]]
7529 !! input
7530 [[|Otherplace]]
7531 [[Otherplace, Elsewhere|]]
7532 [[Otherplace, Elsewhere, Anywhere|]]
7533 !! result
7534 [[Otherplace, Somewhere|Otherplace]]
7535 [[Otherplace, Elsewhere|Otherplace]]
7536 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7537 !! end
7538
7539 !! test
7540 pre-save transform: context links ("pipe trick") with parens and comma
7541 !! options
7542 pst title=[[Someplace (IGNORED), Somewhere]]
7543 !! input
7544 [[|Otherplace]]
7545 [[Otherplace (place), Elsewhere|]]
7546 !! result
7547 [[Otherplace, Somewhere|Otherplace]]
7548 [[Otherplace (place), Elsewhere|Otherplace]]
7549 !! end
7550
7551 !! test
7552 pre-save transform: context links ("pipe trick") with comma and parens
7553 !! options
7554 pst title=[[Who, me? (context)]]
7555 !! input
7556 [[|Yes, you.]]
7557 [[Me, Myself, and I (1937 song)|]]
7558 !! result
7559 [[Yes, you. (context)|Yes, you.]]
7560 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7561 !! end
7562
7563 !! test
7564 pre-save transform: context links ("pipe trick") with namespace
7565 !! options
7566 pst title=[[Ns:Somearticle]]
7567 !! input
7568 [[|Article]]
7569 !! result
7570 [[Ns:Article|Article]]
7571 !! end
7572
7573 !! test
7574 pre-save transform: context links ("pipe trick") with namespace and parens
7575 !! options
7576 pst title=[[Ns:Somearticle (context)]]
7577 !! input
7578 [[|Article]]
7579 !! result
7580 [[Ns:Article (context)|Article]]
7581 !! end
7582
7583 !! test
7584 pre-save transform: context links ("pipe trick") with namespace and comma
7585 !! options
7586 pst title=[[Ns:Somearticle, Context, Whatever]]
7587 !! input
7588 [[|Article]]
7589 !! result
7590 [[Ns:Article, Context, Whatever|Article]]
7591 !! end
7592
7593 !! test
7594 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7595 !! options
7596 pst title=[[Ns:Somearticle, Context (context)]]
7597 !! input
7598 [[|Article]]
7599 !! result
7600 [[Ns:Article (context)|Article]]
7601 !! end
7602
7603 !! test
7604 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7605 !! options
7606 pst title=[[Ns:Somearticle (IGNORED), Context]]
7607 !! input
7608 [[|Article]]
7609 !! result
7610 [[Ns:Article, Context|Article]]
7611 !! end
7612
7613 !! test
7614 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7615 !! options
7616 pst
7617 !! input
7618 [[Article(context)|]]
7619 [[Bar:Article(context)|]]
7620 [[:Bar:Article(context)|]]
7621 [[|Article(context)]]
7622 [[Bar:X(Y)Z|]]
7623 [[:Bar:X(Y)Z|]]
7624 !! result
7625 [[Article(context)|Article]]
7626 [[Bar:Article(context)|Article]]
7627 [[:Bar:Article(context)|Article]]
7628 [[Article(context)]]
7629 [[Bar:X(Y)Z|X(Y)Z]]
7630 [[:Bar:X(Y)Z|X(Y)Z]]
7631 !! end
7632
7633 !! test
7634 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7635 !! options
7636 pst
7637 !! input
7638 [[Article (context)|]]
7639 [[Bar:Article (context)|]]
7640 [[:Bar:Article (context)|]]
7641 [[|Article (context)]]
7642 [[Bar:X (Y) Z|]]
7643 [[:Bar:X (Y) Z|]]
7644 !! result
7645 [[Article (context)|Article]]
7646 [[Bar:Article (context)|Article]]
7647 [[:Bar:Article (context)|Article]]
7648 [[Article (context)]]
7649 [[Bar:X (Y) Z|X (Y) Z]]
7650 [[:Bar:X (Y) Z|X (Y) Z]]
7651 !! end
7652
7653 !! test
7654 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7655 !! options
7656 pst
7657 !! input
7658 [[Article(context)|]]
7659 [[Bar:Article(context)|]]
7660 [[:Bar:Article(context)|]]
7661 [[|Article(context)]]
7662 [[Bar:X(Y)Z|]]
7663 [[:Bar:X(Y)Z|]]
7664 !! result
7665 [[Article(context)|Article]]
7666 [[Bar:Article(context)|Article]]
7667 [[:Bar:Article(context)|Article]]
7668 [[Article(context)]]
7669 [[Bar:X(Y)Z|X(Y)Z]]
7670 [[:Bar:X(Y)Z|X(Y)Z]]
7671 !! end
7672
7673 !! test
7674 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7675 !! options
7676 pst
7677 !! input
7678 [[Article (context), context|]]
7679 [[Article (context),context|]]
7680 [[Bar:Article (context), context|]]
7681 [[Bar:Article (context),context|]]
7682 [[:Bar:Article (context), context|]]
7683 [[:Bar:Article (context),context|]]
7684 !! result
7685 [[Article (context), context|Article]]
7686 [[Article (context),context|Article]]
7687 [[Bar:Article (context), context|Article]]
7688 [[Bar:Article (context),context|Article]]
7689 [[:Bar:Article (context), context|Article]]
7690 [[:Bar:Article (context),context|Article]]
7691 !! end
7692
7693 !! test
7694 pre-save transform: trim trailing empty lines
7695 !! options
7696 pst
7697 !! input
7698 Empty lines are trimmed
7699
7700
7701
7702
7703 !! result
7704 Empty lines are trimmed
7705 !! end
7706
7707 !! test
7708 pre-save transform: Signature expansion
7709 !! options
7710 pst
7711 !! input
7712 * ~~~
7713 * <noinclude>~~~</noinclude>
7714 * <includeonly>~~~</includeonly>
7715 * <onlyinclude>~~~</onlyinclude>
7716 !! result
7717 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7718 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7719 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7720 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7721 !! end
7722
7723
7724 !! test
7725 pre-save transform: Signature expansion in nowiki tags (bug 93)
7726 !! options
7727 pst disabled
7728 !! input
7729 Shall not expand:
7730
7731 <nowiki>~~~~</nowiki>
7732
7733 <includeonly><nowiki>~~~~</nowiki></includeonly>
7734
7735 <noinclude><nowiki>~~~~</nowiki></noinclude>
7736
7737 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7738
7739 {{subst:Foo}} shall be converted to FOO
7740
7741 As well as inside noinclude/onlyinclude
7742 <noinclude>{{subst:Foo}}</noinclude>
7743 <onlyinclude>{{subst:Foo}}</onlyinclude>
7744
7745 But not inside includeonly
7746 <includeonly>{{subst:Foo}}</includeonly>
7747 !! result
7748 Shall not expand:
7749
7750 <nowiki>~~~~</nowiki>
7751
7752 <includeonly><nowiki>~~~~</nowiki></includeonly>
7753
7754 <noinclude><nowiki>~~~~</nowiki></noinclude>
7755
7756 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7757
7758 FOO shall be converted to FOO
7759
7760 As well as inside noinclude/onlyinclude
7761 <noinclude>FOO</noinclude>
7762 <onlyinclude>FOO</onlyinclude>
7763
7764 But not inside includeonly
7765 <includeonly>{{subst:Foo}}</includeonly>
7766 !! end
7767
7768 !! test
7769 Parsoid: Recognize nowiki with trailing space in tags
7770 !! options
7771 parsoid=wt2html
7772 !! input
7773 <nowiki ><div>[[foo]]</nowiki >
7774
7775 a<nowiki / >b
7776
7777 c<nowiki />d
7778
7779 e<nowiki/ >f
7780 !! result
7781 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7782 <p>ab</p>
7783 <p>cd</p>
7784 <p>ef</p>
7785 !! end
7786
7787 !! test
7788 Parsoid: Recognize nowiki with odd capitalization
7789 !! options
7790 parsoid=wt2html
7791 !! input
7792 <noWikI ><div>[[foo]]</Nowiki >
7793 !! result
7794 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7795 !! end
7796
7797
7798 !! test
7799 Parsoid: Escape nowiki with trailing space in tags
7800 !! options
7801 parsoid=html2wt
7802 !! input
7803 &lt;nowiki &gt; foo &lt;/nowiki &gt;
7804
7805 a&lt;nowiki /&gt;b
7806
7807 c&lt;nowiki/ &gt;d
7808 !! result
7809 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
7810 <p>a&lt;nowiki /&gt;b</p>
7811 <p>c&lt;nowiki/ &gt;d</p>
7812 !! end
7813
7814 !! test
7815 Parsoid: Escape weird noWikI capitalizations
7816 !! options
7817 parsoid=html2wt
7818 !! input
7819 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
7820 !! result
7821 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
7822 !! end
7823
7824 ###
7825 ### Message transform tests
7826 ###
7827 !! test
7828 message transform: magic variables
7829 !! options
7830 msg
7831 !! input
7832 {{SITENAME}}
7833 !! result
7834 MediaWiki
7835 !! end
7836
7837 !! test
7838 message transform: should not transform wiki markup
7839 !! options
7840 msg
7841 !! input
7842 ''test''
7843 !! result
7844 ''test''
7845 !! end
7846
7847 !! test
7848 message transform: <noinclude> in transcluded template (bug 4926)
7849 !! options
7850 msg
7851 !! input
7852 {{Includes}}
7853 !! result
7854 Foobar
7855 !! end
7856
7857 !! test
7858 message transform: <onlyinclude> in transcluded template (bug 4926)
7859 !! options
7860 msg
7861 !! input
7862 {{Includes2}}
7863 !! result
7864 Foo
7865 !! end
7866
7867 !! test
7868 {{#special:}} page name, known
7869 !! options
7870 msg
7871 !! input
7872 {{#special:Recentchanges}}
7873 !! result
7874 Special:RecentChanges
7875 !! end
7876
7877 !! test
7878 {{#special:}} page name with subpage, known
7879 !! options
7880 msg
7881 !! input
7882 {{#special:Recentchanges/param}}
7883 !! result
7884 Special:RecentChanges/param
7885 !! end
7886
7887 !! test
7888 {{#special:}} page name, unknown
7889 !! options
7890 msg
7891 !! input
7892 {{#special:foobar nonexistent}}
7893 !! result
7894 Special:Foobar nonexistent
7895 !! end
7896
7897 !! test
7898 {{#speciale:}} page name, known
7899 !! options
7900 msg
7901 !! input
7902 {{#speciale:Recentchanges}}
7903 !! result
7904 Special:RecentChanges
7905 !! end
7906
7907 !! test
7908 {{#speciale:}} page name with subpage, known
7909 !! options
7910 msg
7911 !! input
7912 {{#speciale:Recentchanges/param}}
7913 !! result
7914 Special:RecentChanges/param
7915 !! end
7916
7917 !! test
7918 {{#speciale:}} page name, unknown
7919 !! options
7920 msg
7921 !! input
7922 {{#speciale:foobar nonexistent}}
7923 !! result
7924 Special:Foobar_nonexistent
7925 !! end
7926
7927 ###
7928 ### Images
7929 ###
7930 !! test
7931 Simple image
7932 !! input
7933 [[Image:foobar.jpg]]
7934 !! result
7935 <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>
7936 </p>
7937 !! end
7938
7939 !! test
7940 Right-aligned image
7941 !! input
7942 [[Image:foobar.jpg|right]]
7943 !! result
7944 <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>
7945
7946 !! end
7947
7948 !! test
7949 Simple image (using File: namespace, now canonical)
7950 !! input
7951 [[File:foobar.jpg]]
7952 !! result
7953 <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>
7954 </p>
7955 !! end
7956
7957 !! test
7958 Image with caption
7959 !! input
7960 [[Image:foobar.jpg|right|Caption text]]
7961 !! result
7962 <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>
7963
7964 !! end
7965
7966 !! test
7967 Image with empty attribute
7968 !! input
7969 [[Image:foobar.jpg|right||Caption text]]
7970 !! result
7971 <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>
7972
7973 !! end
7974
7975 !! test
7976 Image with attributes from template.
7977 !! input
7978 [[Image:foobar.jpg|{{image_attribs}}]]
7979 !! result
7980 <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>
7981
7982 !! end
7983
7984 !! test
7985 Image with link tails
7986 !! input
7987 123[[Image:foobar.jpg]]456
7988 123[[Image:foobar.jpg|right]]456
7989 123[[Image:foobar.jpg|thumb]]456
7990 !! result
7991 <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
7992 </p>
7993 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
7994 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
7995
7996 !! end
7997
7998 !! test
7999 Image with multiple captions -- only last one is accepted
8000 !! input
8001 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8002 !! result
8003 <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>
8004
8005 !! end
8006
8007 !! test
8008 Image with width attribute at different positions
8009 !! input
8010 [[Image:foobar.jpg|200px|right|Caption]]
8011 [[Image:foobar.jpg|right|200px|Caption]]
8012 [[Image:foobar.jpg|right|Caption|200px]]
8013 !! result
8014 <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>
8015 <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>
8016 <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>
8017
8018 !! end
8019
8020 !! test
8021 Image with link parameter, wiki target
8022 !! input
8023 [[Image:foobar.jpg|link=Target page]]
8024 !! result
8025 <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>
8026 </p>
8027 !! end
8028
8029 !! test
8030 Image with link parameter, URL target
8031 !! input
8032 [[Image:foobar.jpg|link=http://example.com/]]
8033 !! result
8034 <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>
8035 </p>
8036 !! end
8037
8038 !! test
8039 Image with link parameter, wgExternalLinkTarget
8040 !! input
8041 [[Image:foobar.jpg|link=http://example.com/]]
8042 !! config
8043 wgExternalLinkTarget='foobar'
8044 !! result
8045 <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>
8046 </p>
8047 !! end
8048
8049 !! test
8050 Image with link parameter, wgNoFollowLinks set to false
8051 !! input
8052 [[Image:foobar.jpg|link=http://example.com/]]
8053 !! config
8054 wgNoFollowLinks=false
8055 !! result
8056 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8057 </p>
8058 !! end
8059
8060 !! test
8061 Image with link parameter, wgNoFollowDomainExceptions
8062 !! input
8063 [[Image:foobar.jpg|link=http://example.com/]]
8064 !! config
8065 wgNoFollowDomainExceptions='example.com'
8066 !! result
8067 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8073 !! input
8074 [[Image:foobar.jpg|link=http://example.com/|Title]]
8075 !! config
8076 wgExternalLinkTarget='foobar'
8077 !! result
8078 <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>
8079 </p>
8080 !! end
8081
8082 !! test
8083 Image with empty link parameter
8084 !! input
8085 [[Image:foobar.jpg|link=]]
8086 !! result
8087 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8088 </p>
8089 !! end
8090
8091 !! test
8092 Image with link parameter (wiki target) and unnamed parameter
8093 !! input
8094 [[Image:foobar.jpg|link=Target page|Title]]
8095 !! result
8096 <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>
8097 </p>
8098 !! end
8099
8100 !! test
8101 Image with link parameter (URL target) and unnamed parameter
8102 !! input
8103 [[Image:foobar.jpg|link=http://example.com/|Title]]
8104 !! result
8105 <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>
8106 </p>
8107 !! end
8108
8109 !! test
8110 Thumbnail image with link parameter
8111 !! options
8112 php
8113 !! input
8114 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8115 !! result
8116 <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>
8117
8118 !! end
8119
8120 !! test
8121 Manually-specified thumbnail image
8122 !! options
8123 php
8124 !! input
8125 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8126 !! result
8127 <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>
8128
8129 !! end
8130
8131 !! test
8132 Manually-specified thumbnail image with explicit link to wiki page
8133 !! options
8134 php
8135 !! input
8136 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8137 !! result
8138 <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>
8139
8140 !! end
8141
8142 !! test
8143 Manually-specified thumbnail image with explicit link to url
8144 !! options
8145 php
8146 !! input
8147 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8148 !! result
8149 <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>
8150
8151 !! end
8152
8153 !! test
8154 Manually-specified thumbnail image with explicit no link
8155 !! options
8156 php
8157 !! input
8158 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8159 !! result
8160 <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>
8161
8162 !! end
8163
8164 !! test
8165 Manually-specified thumbnail image with explicit link and alt text
8166 !! options
8167 php
8168 !! input
8169 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8170 !! result
8171 <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>
8172
8173 !! end
8174
8175 !! test
8176 Image with frame and link
8177 !! input
8178 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8179 !! result
8180 <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>
8181
8182 !! end
8183
8184 !! test
8185 Image with frame and link and explicit alt
8186 !! input
8187 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8188 !! result
8189 <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>
8190
8191 !! end
8192
8193 !! test
8194 Image with wiki markup in implicit alt
8195 !! input
8196 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8197 !! result
8198 <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>
8199 </p>
8200 !! end
8201
8202 !! test
8203 Image with wiki markup in explicit alt
8204 !! input
8205 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8206 !! result
8207 <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>
8208 </p>
8209 !! end
8210
8211 !! test
8212 Link to image page- image page normally doesn't exists, hence edit link
8213 Add test with existing image page
8214 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8215 !! input
8216 [[:Image:test]]
8217 !! result
8218 <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>
8219 </p>
8220 !! end
8221
8222 !! test
8223 bug 18784 Link to non-existent image page with caption should use caption as link text
8224 !! input
8225 [[:Image:test|caption]]
8226 !! result
8227 <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>
8228 </p>
8229 !! end
8230
8231 !! test
8232 Frameless image caption with a free URL
8233 !! input
8234 [[Image:foobar.jpg|http://example.com]]
8235 !! result
8236 <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>
8237 </p>
8238 !! end
8239
8240 !! test
8241 Thumbnail image caption with a free URL
8242 !! input
8243 [[Image:foobar.jpg|thumb|http://example.com]]
8244 !! result
8245 <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>
8246
8247 !! end
8248
8249 !! test
8250 Thumbnail image caption with a free URL and explicit alt
8251 !! input
8252 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8253 !! result
8254 <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>
8255
8256 !! end
8257
8258 !! test
8259 SVG thumbnails with no language set
8260 !! options
8261 !! input
8262 [[File:Foobar.svg|thumb|width=200]]
8263 !! result
8264 <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>
8265
8266 !! end
8267
8268 !! test
8269 SVG thumbnails with language de
8270 !! options
8271 !! input
8272 [[File:Foobar.svg|thumb|width=200|lang=de]]
8273 !! result
8274 <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>
8275
8276 !! end
8277
8278 !! test
8279 SVG thumbnails with invalid language code
8280 !! options
8281 !! input
8282 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8283 !! result
8284 <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>
8285
8286 !! end
8287
8288 !! test
8289 BUG 1887: A ISBN with a thumbnail
8290 !! input
8291 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8292 !! result
8293 <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>
8294
8295 !! end
8296
8297 !! test
8298 BUG 1887: A RFC with a thumbnail
8299 !! input
8300 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8301 !! result
8302 <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>
8303
8304 !! end
8305
8306 !! test
8307 BUG 1887: A mailto link with a thumbnail
8308 !! input
8309 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8310 !! result
8311 <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>
8312
8313 !! end
8314
8315 # Pending resolution to bug 368
8316 !! test
8317 BUG 648: Frameless image caption with a link
8318 !! input
8319 [[Image:foobar.jpg|text with a [[link]] in it]]
8320 !! result
8321 <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>
8322 </p>
8323 !! end
8324
8325 !! test
8326 BUG 648: Frameless image caption with a link (suffix)
8327 !! input
8328 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8329 !! result
8330 <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>
8331 </p>
8332 !! end
8333
8334 !! test
8335 BUG 648: Frameless image caption with an interwiki link
8336 !! input
8337 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8338 !! result
8339 <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>
8340 </p>
8341 !! end
8342
8343 !! test
8344 BUG 648: Frameless image caption with a piped interwiki link
8345 !! input
8346 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8347 !! result
8348 <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>
8349 </p>
8350 !! end
8351
8352 !! test
8353 Escape HTML special chars in image alt text
8354 !! input
8355 [[Image:foobar.jpg|& < > "]]
8356 !! result
8357 <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>
8358 </p>
8359 !! end
8360
8361 !! test
8362 BUG 499: Alt text should have &#1234;, not &amp;1234;
8363 !! input
8364 [[Image:foobar.jpg|&#9792;]]
8365 !! result
8366 <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>
8367 </p>
8368 !! end
8369
8370 !! test
8371 Broken image caption with link
8372 !! input
8373 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8374 !! result
8375 <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.
8376 </p>
8377 !! end
8378
8379 !! test
8380 Image caption containing another image
8381 !! input
8382 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8383 !! result
8384 <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>
8385
8386 !! end
8387
8388 !! test
8389 Image caption containing a newline
8390 !! input
8391 [[Image:Foobar.jpg|This
8392 *is some text]]
8393 !! result
8394 <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>
8395 </p>
8396 !!end
8397
8398 !!test
8399 Parsoid: Image caption containing leading space
8400 (The leading space should not trigger nowiki escaping in wt2wt mode)
8401 !! input
8402 [[Image:Foobar.jpg|thumb| bar]]
8403 !! result
8404 <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>
8405
8406 !!end
8407
8408 !! test
8409 Bug 3090: External links other than http: in image captions
8410 !! input
8411 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8412 !! result
8413 <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>
8414
8415 !! end
8416
8417 !! test
8418 Custom class
8419 !! input
8420 [[Image:foobar.jpg|a|class=b]]
8421 !! result
8422 <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>
8423 </p>
8424 !! end
8425
8426 !! test
8427 Localized image handling (1).
8428 !! options
8429 language=es
8430 !! input
8431 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8432 !! result
8433 <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>
8434
8435 !! end
8436
8437 !! test
8438 Localized image handling (2).
8439 !! options
8440 language=es
8441 !! input
8442 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8443 !! result
8444 <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>
8445
8446 !! end
8447
8448 !! test
8449 "border", "frameless" and "class" attributes on an image.
8450 !! input
8451 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8452 !! result
8453 <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>
8454 </p>
8455 !! end
8456
8457 !! article
8458 File:Barfoo.jpg
8459 !! text
8460 #REDIRECT [[File:Barfoo.jpg]]
8461 !! endarticle
8462
8463 !! test
8464 Redirected image
8465 !! input
8466 [[Image:Barfoo.jpg]]
8467 !! result
8468 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8469 </p>
8470 !! end
8471
8472 !! test
8473 Missing image with uploads disabled
8474 !! options
8475 wgEnableUploads=0
8476 !! input
8477 [[Image:Foobaz.jpg]]
8478 !! result
8479 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8480 </p>
8481 !! end
8482
8483 # Parsoid-specific testing for images
8484 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8485 # Currently imperfect due to a flaw in the Parsoid testrunner
8486 # Work in progress
8487
8488 !! test
8489 Parsoid-specific image handling - simple image
8490 !! options
8491 parsoid
8492 !! input
8493 [[Image:Foobar.jpg]]
8494 !! result
8495 <p>
8496 <span class="mw-default-size" typeof="mw:Image">
8497 <a href="File:Foobar.jpg">
8498 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8499 </a>
8500 </span>
8501 </p>
8502 !! end
8503
8504 !! test
8505 Parsoid-specific image handling - simple image without link
8506 !! options
8507 parsoid
8508 !! input
8509 [[Image:Foobar.jpg|link=]]
8510 !! result
8511 <p>
8512 <span class="mw-default-size" typeof="mw:Image">
8513 <span>
8514 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8515 </span>
8516 </span>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Parsoid-specific image handling - simple image with specific link
8522 !! options
8523 parsoid
8524 !! input
8525 [[Image:Foobar.jpg|link=Main Page]]
8526 !! result
8527 <p>
8528 <span class="mw-default-size" typeof="mw:Image">
8529 <a href="Main_Page">
8530 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8531 </a>
8532 </span>
8533 </p>
8534 !! end
8535
8536 !! test
8537 Parsoid-specific image handling - simple image with size and middle alignment
8538 !! options
8539 parsoid
8540 !! input
8541 [[Image:Foobar.jpg|50px|middle]]
8542 !! result
8543 <p>
8544 <span class="mw-valign-middle" typeof="mw:Image">
8545 <a href="File:Foobar.jpg">
8546 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8547 </a>
8548 </span>
8549 </p>
8550 !! end
8551
8552 !! test
8553 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8554 !! options
8555 parsoid
8556 !! input
8557 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8558 !! result
8559 <p>
8560 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8561 <a href="File:Foobar.jpg">
8562 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8563 </a>
8564 </span>
8565 </p>
8566 !! end
8567
8568 !! test
8569 Parsoid-specific image handling - simple image with border and size spec
8570 !! options
8571 parsoid
8572 !! input
8573 [[Image:Foobar.jpg|50px|border|caption]]
8574 !! result
8575 <p>
8576 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8577 <a href="File:Foobar.jpg">
8578 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8579 </a>
8580 </span>
8581 </p>
8582 !! end
8583
8584 !! test
8585 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8586 !! options
8587 parsoid
8588 !! input
8589 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8590 !! result
8591 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8592 <a href="File:Foobar.jpg">
8593 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8594 </a>
8595 <figcaption>caption content</figcaption>
8596 </figure>
8597 !! end
8598
8599 !! test
8600 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8601 !! options
8602 parsoid
8603 !! input
8604 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8605 !! result
8606 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8607 <a href="File:Foobar.jpg">
8608 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8609 </a>
8610 <figcaption>caption</figcaption>
8611 </figure>
8612 !! end
8613
8614 !! test
8615 Parsoid-specific image handling - framed image with specific size and caption
8616 !! options
8617 parsoid
8618 !! input
8619 [[Image:Foobar.jpg|500x50px|frame|caption]]
8620 !! result
8621 <figure typeof="mw:Image/Frame">
8622 <a href="File:Foobar.jpg">
8623 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8624 </a>
8625 <figcaption>caption</figcaption>
8626 </figure>
8627 !! end
8628
8629 !! test
8630 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8631 !! options
8632 parsoid
8633 !! input
8634 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8635 !! result
8636 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8637 <a href="File:Foobar.jpg">
8638 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8639 </a>
8640 <figcaption>caption</figcaption>
8641 </figure>
8642 !! end
8643
8644 !! test
8645 Parsoid-specific image handling - frameless image with specific size, border, and caption
8646 !! options
8647 parsoid
8648 !! input
8649 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8650 !! result
8651 <p>
8652 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8653 <a href="File:Foobar.jpg">
8654 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8655 </a>
8656 </p>
8657 !! end
8658
8659 #!! test
8660 #Parsoid-specific image handling - simple image with a formatted caption
8661 #!! options
8662 #parsoid
8663 #!! input
8664 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8665 #!! result
8666 #<p>
8667 #<span typeof="mw:Image">
8668 #<a class="mw-default-size" href="Image:Foobar.jpg">
8669 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8670 #</a>
8671 #<span>abc</span>
8672 #</span>
8673 #</p>
8674
8675
8676 ###
8677 ### Subpages
8678 ###
8679 !! article
8680 Subpage test/subpage
8681 !! text
8682 foo
8683 !! endarticle
8684
8685 !! test
8686 Subpage link
8687 !! options
8688 subpage title=[[Subpage test]]
8689 !! input
8690 [[/subpage]]
8691 !! result
8692 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8693 </p>
8694 !! end
8695
8696 !! test
8697 Subpage noslash link
8698 !! options
8699 subpage title=[[Subpage test]]
8700 !!input
8701 [[/subpage/]]
8702 !! result
8703 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8704 </p>
8705 !! end
8706
8707 # TODO: make this PHP-parser compatible!
8708 !! test
8709 Relative subpage noslash link
8710 !! options
8711 parsoid=wt2wt,wt2html,html2html
8712 subpage title=[[Subpage test/1/2/3/4]]
8713 !!input
8714 [[../../subpage/]]
8715
8716 [[../../subpage]]
8717 !! result
8718 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8719 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8720 !! end
8721
8722 # TODO: make this PHP-parser compatible!
8723 !! test
8724 Parsoid: dot-slash prefixed wikilinks
8725 !! options
8726 parsoid=wt2wt,wt2html,html2html
8727 !!input
8728 [[./foo]]
8729
8730 [[././bar]]
8731
8732 [[././baz/]]
8733 !! result
8734 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8735 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8736 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8737 !! end
8738
8739 !! test
8740 Disabled subpages
8741 !! input
8742 [[/subpage]]
8743 !! result
8744 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8745 </p>
8746 !! end
8747
8748 !! test
8749 BUG 561: {{/Subpage}}
8750 !! options
8751 subpage title=[[Page]]
8752 !! input
8753 {{/Subpage}}
8754 !! result
8755 <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>
8756 </p>
8757 !! end
8758
8759 ###
8760 ### Categories
8761 ###
8762 !! article
8763 Category:MediaWiki User's Guide
8764 !! text
8765 blah
8766 !! endarticle
8767
8768 !! test
8769 Link to category
8770 !! input
8771 [[:Category:MediaWiki User's Guide]]
8772 !! result
8773 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8774 </p>
8775 !! end
8776
8777 !! test
8778 Simple category
8779 !! options
8780 cat
8781 !! input
8782 [[Category:MediaWiki User's Guide]]
8783 !! result
8784 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8785 !! end
8786
8787 !! test
8788 PAGESINCATEGORY invalid title fatal (r33546 fix)
8789 !! input
8790 {{PAGESINCATEGORY:<bogus>}}
8791 !! result
8792 <p>0
8793 </p>
8794 !! end
8795
8796 !! test
8797 Category with different sort key
8798 !! options
8799 cat
8800 !! input
8801 [[Category:MediaWiki User's Guide|Foo]]
8802 !! result
8803 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8804 !! end
8805
8806 !! test
8807 Category with identical sort key
8808 !! options
8809 cat
8810 !! input
8811 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8812 !! result
8813 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8814 !! end
8815
8816 !! test
8817 Category with empty sort key
8818 !! options
8819 cat
8820 pst
8821 !! input
8822 [[Category:MediaWiki User's Guide|]]
8823 !! result
8824 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8825 !! end
8826
8827 !! test
8828 Category with empty sort key and parentheses
8829 !! options
8830 cat
8831 pst
8832 !! input
8833 [[Category:Foo (bar)|]]
8834 !! result
8835 [[Category:Foo (bar)|Foo]]
8836 !! end
8837
8838 !! test
8839 Category with link tail
8840 !! options
8841 cat
8842 pst
8843 !! input
8844 123[[Category:Foo]]456
8845 !! result
8846 123[[Category:Foo]]456
8847 !! end
8848
8849 !! test
8850 Category with template
8851 !! options
8852 cat
8853 pst
8854 !! input
8855 [[Category:{{echo|Foo}}]]
8856 !! result
8857 [[Category:{{echo|Foo}}]]
8858 !! end
8859
8860 !! test
8861 Category with template in sort key
8862 !! options
8863 cat
8864 pst
8865 !! input
8866 [[Category:Foo|{{echo|Bar}}]]
8867 !! result
8868 [[Category:Foo|{{echo|Bar}}]]
8869 !! end
8870
8871 !! test
8872 Category with template in sort key and title
8873 !! options
8874 cat
8875 pst
8876 !! input
8877 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8878 !! result
8879 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8880 !! end
8881
8882 !! test
8883 Category / paragraph interactions
8884 !! input
8885 Foo [[Category:Baz]] Bar
8886
8887 Foo [[Category:Baz]]
8888 Bar
8889
8890 Foo
8891 [[Category:Baz]]
8892 Bar
8893
8894 Foo
8895 [[Category:Baz]] Bar
8896
8897 Foo
8898 [[Category:Baz]]
8899 [[Category:Baz]]
8900 [[Category:Baz]]
8901 Bar
8902
8903 [[Category:Baz]]
8904 [[Category:Baz]]
8905 [[Category:Baz]]
8906
8907 [[Category:Baz]]
8908 {{echo|[[Category:Baz]]}}
8909 [[Category:Baz]]
8910 !! result
8911 <p>Foo Bar
8912 </p><p>Foo
8913 Bar
8914 </p><p>Foo
8915 Bar
8916 </p><p>Foo Bar
8917 </p><p>Foo
8918 Bar
8919 </p>
8920 !! end
8921
8922 !! test
8923 Parsoid: Serialize link to category page with colon escape
8924 !! options
8925 parsoid
8926 !! input
8927
8928 [[:Category:Foo]]
8929 [[:Category:Foo|Bar]]
8930 !! result
8931 <p>
8932 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8933 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8934 </p>
8935 !! end
8936
8937 !! test
8938 Parsoid: Link prefix/suffixes aren't applied to category links
8939 !! options
8940 parsoid=wt2html,wt2wt,html2html
8941 language=is
8942 !! input
8943 x[[Category:Foo]]y
8944 !! result
8945 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
8946 !! end
8947
8948 !! test
8949 Parsoid: Serialize link to file page with colon escape
8950 !! options
8951 parsoid
8952 !! input
8953
8954 [[:File:Foo.png]]
8955 [[:File:Foo.png|Bar]]
8956 !! result
8957 <p>
8958 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8959 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8960 </p>
8961 !! end
8962
8963 !! test
8964 Parsoid: Serialize a genuine category link without colon escape
8965 !! options
8966 parsoid
8967 !! input
8968 [[Category:Foo]]
8969 [[Category:Foo|Bar]]
8970 !! result
8971 <link rel="mw:WikiLink/Category" href="Category:Foo">
8972 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
8973 !! end
8974
8975 ###
8976 ### Inter-language links
8977 ###
8978 !! test
8979 Inter-language links
8980 !! options
8981 ill
8982 !! input
8983 [[es:Alimento]]
8984 [[fr:Nourriture]]
8985 [[zh:&#39135;&#21697;]]
8986 !! result
8987 es:Alimento fr:Nourriture zh:食品
8988 !! end
8989
8990 !! test
8991 Duplicate interlanguage links (bug 24502)
8992 !! options
8993 ill
8994 !! input
8995 [[es:1]]
8996 [[es:2]]
8997 [[fr:1]]
8998 [[fr:2]]
8999 !! result
9000 es:1 fr:1
9001 !! end
9002
9003 ###
9004 ### Sections
9005 ###
9006 !! test
9007 Basic section headings
9008 !! input
9009 == Headline 1 ==
9010 Some text
9011
9012 ==Headline 2==
9013 More
9014 ===Smaller headline===
9015 Blah blah
9016 !! result
9017 <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>
9018 <p>Some text
9019 </p>
9020 <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>
9021 <p>More
9022 </p>
9023 <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>
9024 <p>Blah blah
9025 </p>
9026 !! end
9027
9028 !! test
9029 Section headings with TOC
9030 !! input
9031 == Headline 1 ==
9032 === Subheadline 1 ===
9033 ===== Skipping a level =====
9034 ====== Skipping a level ======
9035
9036 == Headline 2 ==
9037 Some text
9038 ===Another headline===
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="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9043 <ul>
9044 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9045 <ul>
9046 <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>
9047 <ul>
9048 <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>
9049 </ul>
9050 </li>
9051 </ul>
9052 </li>
9053 </ul>
9054 </li>
9055 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9056 <ul>
9057 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9058 </ul>
9059 </li>
9060 </ul>
9061 </div>
9062 <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>
9063 <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>
9064 <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>
9065 <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>
9066 <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>
9067 <p>Some text
9068 </p>
9069 <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>
9070
9071 !! end
9072
9073 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9074 !! test
9075 Handling of sections up to level 6 and beyond
9076 !! input
9077 = Level 1 Heading=
9078 == Level 2 Heading==
9079 === Level 3 Heading===
9080 ==== Level 4 Heading====
9081 ===== Level 5 Heading=====
9082 ====== Level 6 Heading======
9083 ======= Level 7 Heading=======
9084 ======== Level 8 Heading========
9085 ========= Level 9 Heading=========
9086 ========== Level 10 Heading==========
9087 !! result
9088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9089 <ul>
9090 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9091 <ul>
9092 <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>
9093 <ul>
9094 <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>
9095 <ul>
9096 <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>
9097 <ul>
9098 <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>
9099 <ul>
9100 <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>
9101 <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>
9102 <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>
9103 <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>
9104 <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>
9105 </ul>
9106 </li>
9107 </ul>
9108 </li>
9109 </ul>
9110 </li>
9111 </ul>
9112 </li>
9113 </ul>
9114 </li>
9115 </ul>
9116 </div>
9117 <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>
9118 <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>
9119 <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>
9120 <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>
9121 <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>
9122 <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>
9123 <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>
9124 <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>
9125 <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>
9126 <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>
9127
9128 !! end
9129
9130 !! test
9131 TOC regression (bug 9764)
9132 !! input
9133 == title 1 ==
9134 === title 1.1 ===
9135 ==== title 1.1.1 ====
9136 === title 1.2 ===
9137 == title 2 ==
9138 === title 2.1 ===
9139 !! result
9140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9141 <ul>
9142 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9143 <ul>
9144 <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>
9145 <ul>
9146 <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>
9147 </ul>
9148 </li>
9149 <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>
9150 </ul>
9151 </li>
9152 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9153 <ul>
9154 <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>
9155 </ul>
9156 </li>
9157 </ul>
9158 </div>
9159 <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>
9160 <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>
9161 <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>
9162 <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>
9163 <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>
9164 <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>
9165
9166 !! end
9167
9168 !! test
9169 TOC with wgMaxTocLevel=3 (bug 6204)
9170 !! options
9171 wgMaxTocLevel=3
9172 !! input
9173 == title 1 ==
9174 === title 1.1 ===
9175 ==== title 1.1.1 ====
9176 === title 1.2 ===
9177 == title 2 ==
9178 === title 2.1 ===
9179 !! result
9180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9181 <ul>
9182 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9183 <ul>
9184 <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>
9185 <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>
9186 </ul>
9187 </li>
9188 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9189 <ul>
9190 <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>
9191 </ul>
9192 </li>
9193 </ul>
9194 </div>
9195 <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>
9196 <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>
9197 <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>
9198 <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>
9199 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9200 <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>
9201
9202 !! end
9203
9204 !! test
9205 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9206 !! options
9207 wgMaxTocLevel=3
9208 !! input
9209 ==Section 1==
9210 ===Section 1.1===
9211 ====Section 1.1.1====
9212 ====Section 1.1.1.1====
9213 ==Section 2==
9214 !! result
9215 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9216 <ul>
9217 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9218 <ul>
9219 <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>
9220 </ul>
9221 </li>
9222 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9223 </ul>
9224 </div>
9225 <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>
9226 <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>
9227 <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>
9228 <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>
9229 <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>
9230
9231 !! end
9232
9233
9234 !! test
9235 Resolving duplicate section names
9236 !! input
9237 == Foo bar ==
9238 == Foo bar ==
9239 !! result
9240 <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>
9241 <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>
9242
9243 !! end
9244
9245 !! test
9246 Resolving duplicate section names with differing case (bug 10721)
9247 !! input
9248 == Foo bar ==
9249 == Foo Bar ==
9250 !! result
9251 <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>
9252 <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>
9253
9254 !! end
9255
9256 !! article
9257 Template:sections
9258 !! text
9259 ===Section 1===
9260 ==Section 2==
9261 !! endarticle
9262
9263 !! test
9264 Template with sections, __NOTOC__
9265 !! input
9266 __NOTOC__
9267 ==Section 0==
9268 {{sections}}
9269 ==Section 4==
9270 !! result
9271 <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>
9272 <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>
9273 <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>
9274 <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>
9275
9276 !! end
9277
9278 !! test
9279 __NOEDITSECTION__ keyword
9280 !! input
9281 __NOEDITSECTION__
9282 ==Section 1==
9283 ==Section 2==
9284 !! result
9285 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9286 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9287
9288 !! end
9289
9290 !! test
9291 Link inside a section heading
9292 !! input
9293 ==Section with a [[Main Page|link]] in it==
9294 !! result
9295 <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>
9296
9297 !! end
9298
9299 !! test
9300 TOC regression (bug 12077)
9301 !! input
9302 __TOC__
9303 == title 1 ==
9304 === title 1.1 ===
9305 == title 2 ==
9306 !! result
9307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9308 <ul>
9309 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9310 <ul>
9311 <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>
9312 </ul>
9313 </li>
9314 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9315 </ul>
9316 </div>
9317 <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>
9318 <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>
9319 <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>
9320
9321 !! end
9322
9323 !! test
9324 BUG 1219 URL next to image (good)
9325 !! input
9326 http://example.com [[Image:foobar.jpg]]
9327 !! result
9328 <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>
9329 </p>
9330 !!end
9331
9332 !! test
9333 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9334 !! input
9335 ===
9336 The line above must have a trailing space!
9337 === <!--
9338 --> <!-- -->
9339 But just in case it doesn't...
9340 !! result
9341 <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>
9342 <p>The line above must have a trailing space!
9343 </p>
9344 <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>
9345 <p>But just in case it doesn't...
9346 </p>
9347 !! end
9348
9349 !! test
9350 Header with special characters (bug 25462)
9351 !! input
9352 The tooltips shall not show entities to the user (ie. be double escaped)
9353
9354 == text > text ==
9355 section 1
9356
9357 == text < text ==
9358 section 2
9359
9360 == text & text ==
9361 section 3
9362
9363 == text ' text ==
9364 section 4
9365
9366 == text " text ==
9367 section 5
9368 !! result
9369 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9370 </p>
9371 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9372 <ul>
9373 <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>
9374 <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>
9375 <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>
9376 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9377 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9378 </ul>
9379 </div>
9380 <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>
9381 <p>section 1
9382 </p>
9383 <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>
9384 <p>section 2
9385 </p>
9386 <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>
9387 <p>section 3
9388 </p>
9389 <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>
9390 <p>section 4
9391 </p>
9392 <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>
9393 <p>section 5
9394 </p>
9395 !! end
9396
9397 !! test
9398 Headers with excess '=' characters
9399 (Are similar tests necessary beyond the 1st level?)
9400 !! input
9401 =foo==
9402 ==foo=
9403 =''italic'' heading==
9404 ==''italic'' heading=
9405 !! result
9406 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9407 <ul>
9408 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9409 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9410 <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>
9411 <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>
9412 </ul>
9413 </div>
9414 <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>
9415 <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>
9416 <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>
9417 <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>
9418
9419 !! end
9420
9421 !! test
9422 HTML headers vs TOC (bug 23393)
9423 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9424 !! input
9425 <h1>Header 1</h1>
9426 == Header 1.1 ==
9427 == Header 1.2 ==
9428
9429 <h1>Header 2
9430 </h1>
9431 == Header 2.1 ==
9432 == Header 2.2 ==
9433 __NOEDITSECTION__
9434 !! result
9435 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9436 <ul>
9437 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9438 <ul>
9439 <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>
9440 <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>
9441 </ul>
9442 </li>
9443 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9444 <ul>
9445 <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>
9446 <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>
9447 </ul>
9448 </li>
9449 </ul>
9450 </div>
9451 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9452 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9453 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9454 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9455 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9456 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9457
9458 !! end
9459
9460 !! test
9461 BUG 1219 URL next to image (broken)
9462 !! input
9463 http://example.com[[Image:foobar.jpg]]
9464 !! result
9465 <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>
9466 </p>
9467 !!end
9468
9469 !! test
9470 Bug 1186 news: in the middle of text
9471 !! input
9472 http://en.wikinews.org/wiki/Wikinews:Workplace
9473 !! result
9474 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9475 </p>
9476 !!end
9477
9478
9479 !! test
9480 Namespaced link must have a title
9481 !! input
9482 [[Project:]]
9483 !! result
9484 <p>[[Project:]]
9485 </p>
9486 !!end
9487
9488 !! test
9489 Namespaced link must have a title (bad fragment version)
9490 !! input
9491 [[Project:#fragment]]
9492 !! result
9493 <p>[[Project:#fragment]]
9494 </p>
9495 !!end
9496
9497
9498 ###
9499 ### HTML tags and HTML attributes
9500 ###
9501
9502 !! test
9503 div with no attributes
9504 !! input
9505 <div>HTML rocks</div>
9506 !! result
9507 <div>HTML rocks</div>
9508
9509 !! end
9510
9511 !! test
9512 div with double-quoted attribute
9513 !! input
9514 <div id="rock">HTML rocks</div>
9515 !! result
9516 <div id="rock">HTML rocks</div>
9517
9518 !! end
9519
9520 !! test
9521 div with single-quoted attribute
9522 !! input
9523 <div id='rock'>HTML rocks</div>
9524 !! result
9525 <div id="rock">HTML rocks</div>
9526
9527 !! end
9528
9529 !! test
9530 div with unquoted attribute
9531 !! input
9532 <div id=rock>HTML rocks</div>
9533 !! result
9534 <div id="rock">HTML rocks</div>
9535
9536 !! end
9537
9538 !! test
9539 div with illegal double attributes
9540 !! input
9541 <div id="a" id="b">HTML rocks</div>
9542 !! result
9543 <div id="b">HTML rocks</div>
9544
9545 !!end
9546
9547 # FIXME: produce empty string instead of "class" in the PHP parser, following
9548 # the HTML5 spec.
9549 !! test
9550 div with empty attribute value, space before equals
9551 !! options
9552 parsoid
9553 !! input
9554 <div class =>HTML rocks</div>
9555 !! result
9556 <div class="">HTML rocks</div>
9557
9558 !! end
9559
9560 # The PHP parser escapes the opening brace to &#123; for some reason, so
9561 # disabled this test for it.
9562 !! test
9563 div with braces in attribute value
9564 !! options
9565 parsoid
9566 !! input
9567 <div title="{}">Foo</div>
9568 !! result
9569 <div title="{}">Foo</div>
9570 !! end
9571
9572 # This it very inconsistent in the PHP parser: it returns
9573 # class="class" if there is a space between the name and the equal sign (see
9574 # 'div with empty attribute value, space before equals'), but strips the
9575 # attribute completely if the space is missing. We hope that not much content
9576 # depends on this, so are implementing the behavior below in Parsoid for
9577 # consistencies' sake. Disabled for the PHP parser.
9578 # FIXME: fix this behavior in the PHP parser?
9579 !! test
9580 div with empty attribute value, no space before equals
9581 !! options
9582 parsoid
9583 !! input
9584 <div class=>HTML rocks</div>
9585 !! result
9586 <div class="">HTML rocks</div>
9587
9588 !! end
9589
9590 !! test
9591 HTML multiple attributes correction
9592 !! input
9593 <p class="error" class="awesome">Awesome!</p>
9594 !! result
9595 <p class="awesome">Awesome!</p>
9596
9597 !!end
9598
9599 !! test
9600 Table multiple attributes correction
9601 !! input
9602 {|
9603 !+ class="error" class="awesome"| status
9604 |}
9605 !! result
9606 <table>
9607 <tr>
9608 <th class="awesome"> status
9609 </th></tr></table>
9610
9611 !!end
9612
9613 !! test
9614 DIV IN UPPERCASE
9615 !! input
9616 <DIV ID="x">HTML ROCKS</DIV>
9617 !! result
9618 <div id="x">HTML ROCKS</div>
9619
9620 !!end
9621
9622 !! test
9623 Non-ASCII pseudo-tags are rendered as text
9624 !! input
9625 <khyô>
9626 !! result
9627 <p>&lt;khyô&gt;
9628 </p>
9629 !! end
9630
9631 !! test
9632 Pseudo-tag with URL 'name' renders as url link
9633 !! input
9634 <http://example.com/>
9635 !! result
9636 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9637 </p>
9638 !! end
9639
9640 !! test
9641 text with amp in the middle of nowhere
9642 !! input
9643 Remember AT&T?
9644 !!result
9645 <p>Remember AT&amp;T?
9646 </p>
9647 !! end
9648
9649 !! test
9650 text with character entity: eacute
9651 !! input
9652 I always thought &eacute; was a cute letter.
9653 !! result
9654 <p>I always thought &#233; was a cute letter.
9655 </p>
9656 !! end
9657
9658 !! test
9659 text with entity-escaped character entity-like string: eacute
9660 !! input
9661 I always thought &amp;eacute; was a cute letter.
9662 !! result
9663 <p>I always thought &amp;eacute; was a cute letter.
9664 </p>
9665 !! end
9666
9667 !! test
9668 text with undefined character entity: xacute
9669 !! input
9670 I always thought &xacute; was a cute letter.
9671 !! result
9672 <p>I always thought &amp;xacute; was a cute letter.
9673 </p>
9674 !! end
9675
9676
9677 ###
9678 ### Nesting tests (see bug 41545, 50604, 51081)
9679 ###
9680
9681 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9682 # Note that html2wt is considerably more difficult if we use <b> in
9683 # the test case, instead of <big>
9684 !! test
9685 Ensure that HTML adoption agency algorithm is properly implemented.
9686 !! input
9687 <big>X<big>Y</big>Z</big>
9688 !! result
9689 <p><big>X<big>Y</big>Z</big>
9690 </p>
9691 !! end
9692
9693 # This was bug 41545 in the PHP parser.
9694 !! test
9695 Nesting of <kbd>
9696 !! input
9697 <kbd>X<kbd>Y</kbd>Z</kbd>
9698 !! result
9699 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9700 </p>
9701 !! end
9702
9703 # The following cases were bug 51081 in the PHP parser.
9704 # Note that there are some other nestable tags (b, i, etc) which are
9705 # not covered; see bug 51081 for discussion.
9706 !! test
9707 Nesting of <em>
9708 !! input
9709 <em>X<em>Y</em>Z</em>
9710 !! result
9711 <p><em>X<em>Y</em>Z</em>
9712 </p>
9713 !! end
9714
9715 !! test
9716 Nesting of <strong>
9717 !! input
9718 <strong>X<strong>Y</strong>Z</strong>
9719 !! result
9720 <p><strong>X<strong>Y</strong>Z</strong>
9721 </p>
9722 !! end
9723
9724 !! test
9725 Nesting of <q>
9726 !! input
9727 <q>X<q>Y</q>Z</q>
9728 !! result
9729 <p><q>X<q>Y</q>Z</q>
9730 </p>
9731 !! end
9732
9733 !! test
9734 Nesting of <ruby>
9735 !! input
9736 <ruby>X<ruby>Y</ruby>Z</ruby>
9737 !! result
9738 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9739 </p>
9740 !! end
9741
9742 !! test
9743 Nesting of <bdo>
9744 !! input
9745 <bdo>X<bdo>Y</bdo>Z</bdo>
9746 !! result
9747 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9748 </p>
9749 !! end
9750
9751
9752 ###
9753 ### Media links
9754 ###
9755
9756 !! test
9757 Media link
9758 !! input
9759 [[Media:Foobar.jpg]]
9760 !! result
9761 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9762 </p>
9763 !! end
9764
9765 !! test
9766 Media link with text
9767 !! input
9768 [[Media:Foobar.jpg|A neat file to look at]]
9769 !! result
9770 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9771 </p>
9772 !! end
9773
9774 # FIXME: this is still bad HTML tag nesting
9775 !! test
9776 Media link with nasty text
9777 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9778 !! input
9779 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9780 !! result
9781 <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>
9782
9783 !! end
9784
9785 !! test
9786 Media link to nonexistent file (bug 1702)
9787 !! input
9788 [[Media:No such.jpg]]
9789 !! result
9790 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9791 </p>
9792 !! end
9793
9794 !! test
9795 Image link to nonexistent file (bug 1850 - good)
9796 !! input
9797 [[Image:No such.jpg]]
9798 !! result
9799 <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>
9800 </p>
9801 !! end
9802
9803 !! test
9804 :Image link to nonexistent file (bug 1850 - bad)
9805 !! input
9806 [[:Image:No such.jpg]]
9807 !! result
9808 <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>
9809 </p>
9810 !! end
9811
9812
9813
9814 !! test
9815 Character reference normalization in link text (bug 1938)
9816 !! input
9817 [[Main Page|this&that]]
9818 !! result
9819 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9820 </p>
9821 !!end
9822
9823 !! article
9824 אַ
9825 !! text
9826 Test for unicode normalization
9827
9828 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9829 !! endarticle
9830
9831 !! test
9832 (bug 19451) Links should refer to the normalized form.
9833 !! input
9834 [[&#xFB2E;]]
9835 [[&#x5d0;&#x5b7;]]
9836 [[&#x5d0;ַ]]
9837 [[א&#x5b7;]]
9838 [[אַ]]
9839 !! result
9840 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9841 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9842 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9843 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9844 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9845 </p>
9846 !! end
9847
9848 !! test
9849 Empty attribute crash test (bug 2067)
9850 !! input
9851 <font color="">foo</font>
9852 !! result
9853 <p><font color="">foo</font>
9854 </p>
9855 !! end
9856
9857 !! test
9858 Empty attribute crash test single-quotes (bug 2067)
9859 !! input
9860 <font color=''>foo</font>
9861 !! result
9862 <p><font color="">foo</font>
9863 </p>
9864 !! end
9865
9866 !! test
9867 Attribute test: equals, then nothing
9868 !! input
9869 <font color=>foo</font>
9870 !! result
9871 <p><font>foo</font>
9872 </p>
9873 !! end
9874
9875 !! test
9876 Attribute test: unquoted value
9877 !! input
9878 <font color=x>foo</font>
9879 !! result
9880 <p><font color="x">foo</font>
9881 </p>
9882 !! end
9883
9884 !! test
9885 Attribute test: unquoted but illegal value (hash)
9886 !! input
9887 <font color=#x>foo</font>
9888 !! result
9889 <p><font color="#x">foo</font>
9890 </p>
9891 !! end
9892
9893 !! test
9894 Attribute test: no value
9895 !! input
9896 <font color>foo</font>
9897 !! result
9898 <p><font color="color">foo</font>
9899 </p>
9900 !! end
9901
9902 !! test
9903 Bug 2095: link with three closing brackets
9904 !! input
9905 [[Main Page]]]
9906 !! result
9907 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9908 </p>
9909 !! end
9910
9911 !! test
9912 Bug 2095: link with pipe and three closing brackets
9913 !! input
9914 [[Main Page|link]]]
9915 !! result
9916 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9917 </p>
9918 !! end
9919
9920 !! test
9921 Bug 2095: link with pipe and three closing brackets, version 2
9922 !! input
9923 [[Main Page|[http://example.com/]]]
9924 !! result
9925 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9926 </p>
9927 !! end
9928
9929
9930 ###
9931 ### Safety
9932 ###
9933
9934 !! article
9935 Template:Dangerous attribute
9936 !! text
9937 " onmouseover="alert(document.cookie)
9938 !! endarticle
9939
9940 !! article
9941 Template:Dangerous style attribute
9942 !! text
9943 border-size: expression(alert(document.cookie))
9944 !! endarticle
9945
9946 !! article
9947 Template:Div style
9948 !! text
9949 <div style="float: right; {{{1}}}">Magic div</div>
9950 !! endarticle
9951
9952 !! test
9953 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9954 !! input
9955 <div title="{{test}}"></div>
9956 !! result
9957 <div title="This is a test template"></div>
9958
9959 !! end
9960
9961 !! test
9962 Bug 2304: HTML attribute safety (dangerous template; 2309)
9963 !! input
9964 <div title="{{dangerous attribute}}"></div>
9965 !! result
9966 <div title=""></div>
9967
9968 !! end
9969
9970 !! test
9971 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9972 !! input
9973 <div style="{{dangerous style attribute}}"></div>
9974 !! result
9975 <div style="/* insecure input */"></div>
9976
9977 !! end
9978
9979 !! test
9980 Bug 2304: HTML attribute safety (safe parameter; 2309)
9981 !! input
9982 {{div style|width: 200px}}
9983 !! result
9984 <div style="float: right; width: 200px">Magic div</div>
9985
9986 !! end
9987
9988 !! test
9989 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9990 !! input
9991 {{div style|width: expression(alert(document.cookie))}}
9992 !! result
9993 <div style="/* insecure input */">Magic div</div>
9994
9995 !! end
9996
9997 !! test
9998 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9999 !! input
10000 {{div style|"><script>alert(document.cookie)</script>}}
10001 !! result
10002 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10003
10004 !! end
10005
10006 !! test
10007 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10008 !! input
10009 {{div style|" ><script>alert(document.cookie)</script>}}
10010 !! result
10011 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10012
10013 !! end
10014
10015 !! test
10016 Bug 2304: HTML attribute safety (link)
10017 !! input
10018 <div title="[[Main Page]]"></div>
10019 !! result
10020 <div title="&#91;&#91;Main Page]]"></div>
10021
10022 !! end
10023
10024 !! test
10025 Bug 2304: HTML attribute safety (italics)
10026 !! input
10027 <div title="''foobar''"></div>
10028 !! result
10029 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10030
10031 !! end
10032
10033 !! test
10034 Bug 2304: HTML attribute safety (bold)
10035 !! input
10036 <div title="'''foobar'''"></div>
10037 !! result
10038 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10039
10040 !! end
10041
10042
10043 !! test
10044 Bug 2304: HTML attribute safety (ISBN)
10045 !! input
10046 <div title="ISBN 1234567890"></div>
10047 !! result
10048 <div title="&#73;SBN 1234567890"></div>
10049
10050 !! end
10051
10052 !! test
10053 Bug 2304: HTML attribute safety (RFC)
10054 !! input
10055 <div title="RFC 1234"></div>
10056 !! result
10057 <div title="&#82;FC 1234"></div>
10058
10059 !! end
10060
10061 !! test
10062 Bug 2304: HTML attribute safety (PMID)
10063 !! input
10064 <div title="PMID 1234567890"></div>
10065 !! result
10066 <div title="&#80;MID 1234567890"></div>
10067
10068 !! end
10069
10070 !! test
10071 Bug 2304: HTML attribute safety (web link)
10072 !! input
10073 <div title="http://example.com/"></div>
10074 !! result
10075 <div title="http&#58;//example.com/"></div>
10076
10077 !! end
10078
10079 !! test
10080 Bug 2304: HTML attribute safety (named web link)
10081 !! input
10082 <div title="[http://example.com/ link]"></div>
10083 !! result
10084 <div title="&#91;http&#58;//example.com/ link]"></div>
10085
10086 !! end
10087
10088 !! test
10089 Bug 3244: HTML attribute safety (extension; safe)
10090 !! input
10091 <div style="<nowiki>background:blue</nowiki>"></div>
10092 !! result
10093 <div style="background:blue"></div>
10094
10095 !! end
10096
10097 !! test
10098 Bug 3244: HTML attribute safety (extension; unsafe)
10099 !! input
10100 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10101 !! result
10102 <div style="/* insecure input */"></div>
10103
10104 !! end
10105
10106 # More MSIE fun discovered by Tom Gilder
10107
10108 !! test
10109 MSIE CSS safety test: spurious slash
10110 !! input
10111 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10112 !! result
10113 <div style="/* insecure input */">evil</div>
10114
10115 !! end
10116
10117 !! test
10118 MSIE CSS safety test: hex code
10119 !! input
10120 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10121 !! result
10122 <div style="/* insecure input */">evil</div>
10123
10124 !! end
10125
10126 !! test
10127 MSIE CSS safety test: comment in url
10128 !! input
10129 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10130 !! result
10131 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10132
10133 !! end
10134
10135 !! test
10136 MSIE CSS safety test: comment in expression
10137 !! input
10138 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10139 !! result
10140 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10141
10142 !! end
10143
10144
10145 !! test
10146 Table attribute legitimate extension
10147 !! input
10148 {|
10149 !+ style="<nowiki>color:blue</nowiki>"| status
10150 |}
10151 !! result
10152 <table>
10153 <tr>
10154 <th style="color:blue"> status
10155 </th></tr></table>
10156
10157 !!end
10158
10159 !! test
10160 Table attribute safety
10161 !! input
10162 {|
10163 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10164 |}
10165 !! result
10166 <table>
10167 <tr>
10168 <th style="/* insecure input */"> status
10169 </th></tr></table>
10170
10171 !! end
10172
10173 !! test
10174 CSS line continuation 1
10175 !! input
10176 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10177 !! result
10178 <div style="/* insecure input */"></div>
10179
10180 !! end
10181
10182 !! test
10183 CSS line continuation 2
10184 !! input
10185 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10186 !! result
10187 <div style="/* insecure input */"></div>
10188
10189 !! end
10190
10191 !! article
10192 Template:Identity
10193 !! text
10194 {{{1}}}
10195 !! endarticle
10196
10197 !! test
10198 Expansion of multi-line templates in attribute values (bug 6255)
10199 !! input
10200 <div style="background: {{identity|#00FF00}}">-</div>
10201 !! result
10202 <div style="background: #00FF00">-</div>
10203
10204 !! end
10205
10206
10207 !! test
10208 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10209 !! input
10210 <div style="background:
10211 #00FF00">-</div>
10212 !! result
10213 <div style="background: #00FF00">-</div>
10214
10215 !! end
10216
10217 !! test
10218 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10219 !! input
10220 <div style="background: &#10;#00FF00">-</div>
10221 !! result
10222 <div style="background: &#10;#00FF00">-</div>
10223
10224 !! end
10225
10226 ###
10227 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10228 ###
10229 !! test
10230 Parser hook: empty input
10231 !! input
10232 <tag></tag>
10233 !! result
10234 <pre>
10235 ''
10236 array (
10237 )
10238 </pre>
10239
10240 !! end
10241
10242 !! test
10243 Parser hook: empty input using terminated empty elements
10244 !! input
10245 <tag/>
10246 !! result
10247 <pre>
10248 NULL
10249 array (
10250 )
10251 </pre>
10252
10253 !! end
10254
10255 !! test
10256 Parser hook: empty input using terminated empty elements (space before)
10257 !! input
10258 <tag />
10259 !! result
10260 <pre>
10261 NULL
10262 array (
10263 )
10264 </pre>
10265
10266 !! end
10267
10268 !! test
10269 Parser hook: basic input
10270 !! input
10271 <tag>input</tag>
10272 !! result
10273 <pre>
10274 'input'
10275 array (
10276 )
10277 </pre>
10278
10279 !! end
10280
10281
10282 !! test
10283 Parser hook: case insensitive
10284 !! input
10285 <TAG>input</TAG>
10286 !! result
10287 <pre>
10288 'input'
10289 array (
10290 )
10291 </pre>
10292
10293 !! end
10294
10295
10296 !! test
10297 Parser hook: case insensitive, redux
10298 !! input
10299 <TaG>input</TAg>
10300 !! result
10301 <pre>
10302 'input'
10303 array (
10304 )
10305 </pre>
10306
10307 !! end
10308
10309 !! test
10310 Parser hook: nested tags
10311 !! options
10312 noxml
10313 !! input
10314 <tag><tag></tag></tag>
10315 !! result
10316 <pre>
10317 '<tag>'
10318 array (
10319 )
10320 </pre>&lt;/tag&gt;
10321
10322 !! end
10323
10324 !! test
10325 Parser hook: basic arguments
10326 !! input
10327 <tag width=200 height = "100" depth = '50' square></tag>
10328 !! result
10329 <pre>
10330 ''
10331 array (
10332 'width' => '200',
10333 'height' => '100',
10334 'depth' => '50',
10335 'square' => 'square',
10336 )
10337 </pre>
10338
10339 !! end
10340
10341 !! test
10342 Parser hook: argument containing a forward slash (bug 5344)
10343 !! input
10344 <tag filename='/tmp/bla'></tag>
10345 !! result
10346 <pre>
10347 ''
10348 array (
10349 'filename' => '/tmp/bla',
10350 )
10351 </pre>
10352
10353 !! end
10354
10355 !! test
10356 Parser hook: empty input using terminated empty elements (bug 2374)
10357 !! input
10358 <tag foo=bar/>text
10359 !! result
10360 <pre>
10361 NULL
10362 array (
10363 'foo' => 'bar',
10364 )
10365 </pre>text
10366
10367 !! end
10368
10369 # </tag> should be output literally since there is no matching tag that begins it
10370 !! test
10371 Parser hook: basic arguments using terminated empty elements (bug 2374)
10372 !! input
10373 <tag width=200 height = "100" depth = '50' square/>
10374 other stuff
10375 </tag>
10376 !! result
10377 <pre>
10378 NULL
10379 array (
10380 'width' => '200',
10381 'height' => '100',
10382 'depth' => '50',
10383 'square' => 'square',
10384 )
10385 </pre>
10386 <p>other stuff
10387 &lt;/tag&gt;
10388 </p>
10389 !! end
10390
10391 ###
10392 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10393 ###
10394
10395 !! test
10396 Parser hook: static parser hook not inside a comment
10397 !! input
10398 <statictag>hello, world</statictag>
10399 <statictag action=flush/>
10400 !! result
10401 <p>hello, world
10402 </p>
10403 !! end
10404
10405
10406 !! test
10407 Parser hook: static parser hook inside a comment
10408 !! input
10409 <!-- <statictag>hello, world</statictag> -->
10410 <statictag action=flush/>
10411 !! result
10412 <p><br />
10413 </p>
10414 !! end
10415
10416 # Nested template calls; this case was broken by Parser.php rev 1.506,
10417 # since reverted.
10418
10419 !! article
10420 Template:One-parameter
10421 !! text
10422 (My parameter is: {{{1}}})
10423 !! endarticle
10424
10425 !! article
10426 Template:Map-one-parameter
10427 !! text
10428 {{{{{1}}}|{{{2}}}}}
10429 !! endarticle
10430
10431 !! test
10432 Nested template calls
10433 !! input
10434 {{Map-one-parameter|One-parameter|param}}
10435 !! result
10436 <p>(My parameter is: param)
10437 </p>
10438 !! end
10439
10440
10441 ###
10442 ### Sanitizer
10443 ###
10444 !! test
10445 Sanitizer: Closing of open tags
10446 !! input
10447 <s></s><table></table>
10448 !! result
10449 <s></s><table></table>
10450
10451 !! end
10452
10453 !! test
10454 Sanitizer: Closing of open but not closed tags
10455 !! input
10456 <s>foo
10457 !! result
10458 <p><s>foo</s>
10459 </p>
10460 !! end
10461
10462 !! test
10463 Sanitizer: Closing of closed but not open tags
10464 !! input
10465 </s>
10466 !! result
10467 <p>&lt;/s&gt;
10468 </p>
10469 !! end
10470
10471 !! test
10472 Sanitizer: Closing of closed but not open table tags
10473 !! input
10474 Table not started</td></tr></table>
10475 !! result
10476 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10477 </p>
10478 !! end
10479
10480 !! test
10481 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10482 !! input
10483 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10484 !! result
10485 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10486 </p>
10487 !! end
10488
10489 !! test
10490 Sanitizer: Validating the contents of the id attribute (bug 4515)
10491 !! options
10492 disabled
10493 !! input
10494 <br id=9 />
10495 !! result
10496 Something, but definitely not <br id="9" />...
10497 !! end
10498
10499 !! test
10500 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10501 !! options
10502 disabled
10503 !! input
10504 <br id="foo" /><br id="foo" />
10505 !! result
10506 Something need to be done. foo-2 ?
10507 !! end
10508
10509 !! test
10510 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10511 !! input
10512 <div itemscope>
10513 <meta itemprop="hello" content="world">
10514 <meta http-equiv="refresh" content="5">
10515 <meta itemprop="hello" http-equiv="refresh" content="5">
10516 <link itemprop="hello" href="{{SERVER}}">
10517 <link rel="stylesheet" href="{{SERVER}}">
10518 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10519 </div>
10520 !! result
10521 <div itemscope="itemscope">
10522 <p> <meta itemprop="hello" content="world" />
10523 &lt;meta http-equiv="refresh" content="5"&gt;
10524 <meta itemprop="hello" content="5" />
10525 </p>
10526 <link itemprop="hello" href="http&#58;//example.org" />
10527 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10528 <link itemprop="hello" href="http&#58;//example.org" />
10529 </div>
10530
10531 !! end
10532
10533 !! test
10534 Language converter: output gets cut off unexpectedly (bug 5757)
10535 !! options
10536 language=zh
10537 !! input
10538 this bit is safe: }-
10539
10540 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10541
10542 then we get cut off here: }-
10543
10544 all additional text is vanished
10545 !! result
10546 <p>this bit is safe: }-
10547 </p><p>but if we add a conversion instance: xxx
10548 </p><p>then we get cut off here: }-
10549 </p><p>all additional text is vanished
10550 </p>
10551 !! end
10552
10553 !! test
10554 Self closed html pairs (bug 5487)
10555 !! options
10556 !! input
10557 <center><font id="bug" />Centered text</center>
10558 <div><font id="bug2" />In div text</div>
10559 !! result
10560 <center>&lt;font id="bug" /&gt;Centered text</center>
10561 <div>&lt;font id="bug2" /&gt;In div text</div>
10562
10563 !! end
10564
10565 #
10566 #
10567 #
10568
10569 !! test
10570 Punctuation: nbsp before exclamation
10571 !! input
10572 C'est grave !
10573 !! result
10574 <p>C'est grave&#160;!
10575 </p>
10576 !! end
10577
10578 !! test
10579 Punctuation: CSS !important (bug 11874)
10580 !! input
10581 <div style="width:50% !important">important</div>
10582 !! result
10583 <div style="width:50% !important">important</div>
10584
10585 !!end
10586
10587 !! test
10588 Punctuation: CSS ! important (bug 11874; with space after)
10589 !! input
10590 <div style="width:50% ! important">important</div>
10591 !! result
10592 <div style="width:50% ! important">important</div>
10593
10594 !!end
10595
10596
10597 !! test
10598 HTML bullet list, closed tags (bug 5497)
10599 !! input
10600 <ul>
10601 <li>One</li>
10602 <li>Two</li>
10603 </ul>
10604 !! result
10605 <ul>
10606 <li>One</li>
10607 <li>Two</li>
10608 </ul>
10609
10610 !! end
10611
10612 !! test
10613 HTML bullet list, unclosed tags (bug 5497)
10614 !! options
10615 disabled
10616 !! input
10617 <ul>
10618 <li>One
10619 <li>Two
10620 </ul>
10621 !! result
10622 <ul>
10623 <li>One
10624 </li><li>Two
10625 </li></ul>
10626
10627 !! end
10628
10629 !! test
10630 HTML ordered list, closed tags (bug 5497)
10631 !! input
10632 <ol>
10633 <li>One</li>
10634 <li>Two</li>
10635 </ol>
10636 !! result
10637 <ol>
10638 <li>One</li>
10639 <li>Two</li>
10640 </ol>
10641
10642 !! end
10643
10644 !! test
10645 HTML ordered list, unclosed tags (bug 5497)
10646 !! options
10647 disabled
10648 !! input
10649 <ol>
10650 <li>One
10651 <li>Two
10652 </ol>
10653 !! result
10654 <ol>
10655 <li>One
10656 </li><li>Two
10657 </li></ol>
10658
10659 !! end
10660
10661 !! test
10662 HTML nested bullet list, closed tags (bug 5497)
10663 !! input
10664 <ul>
10665 <li>One</li>
10666 <li>Two:
10667 <ul>
10668 <li>Sub-one</li>
10669 <li>Sub-two</li>
10670 </ul>
10671 </li>
10672 </ul>
10673 !! result
10674 <ul>
10675 <li>One</li>
10676 <li>Two:
10677 <ul>
10678 <li>Sub-one</li>
10679 <li>Sub-two</li>
10680 </ul>
10681 </li>
10682 </ul>
10683
10684 !! end
10685
10686 !! test
10687 HTML nested bullet list, open tags (bug 5497)
10688 !! options
10689 disabled
10690 !! input
10691 <ul>
10692 <li>One
10693 <li>Two:
10694 <ul>
10695 <li>Sub-one
10696 <li>Sub-two
10697 </ul>
10698 </ul>
10699 !! result
10700 <ul>
10701 <li>One
10702 </li><li>Two:
10703 <ul>
10704 <li>Sub-one
10705 </li><li>Sub-two
10706 </li></ul>
10707 </li></ul>
10708
10709 !! end
10710
10711 !! test
10712 HTML nested ordered list, closed tags (bug 5497)
10713 !! input
10714 <ol>
10715 <li>One</li>
10716 <li>Two:
10717 <ol>
10718 <li>Sub-one</li>
10719 <li>Sub-two</li>
10720 </ol>
10721 </li>
10722 </ol>
10723 !! result
10724 <ol>
10725 <li>One</li>
10726 <li>Two:
10727 <ol>
10728 <li>Sub-one</li>
10729 <li>Sub-two</li>
10730 </ol>
10731 </li>
10732 </ol>
10733
10734 !! end
10735
10736 !! test
10737 HTML nested ordered list, open tags (bug 5497)
10738 !! options
10739 disabled
10740 !! input
10741 <ol>
10742 <li>One
10743 <li>Two:
10744 <ol>
10745 <li>Sub-one
10746 <li>Sub-two
10747 </ol>
10748 </ol>
10749 !! result
10750 <ol>
10751 <li>One
10752 </li><li>Two:
10753 <ol>
10754 <li>Sub-one
10755 </li><li>Sub-two
10756 </li></ol>
10757 </li></ol>
10758
10759 !! end
10760
10761 !! test
10762 HTML ordered list item with parameters oddity
10763 !! input
10764 <ol><li id="fragment">One</li></ol>
10765 !! result
10766 <ol><li id="fragment">One</li></ol>
10767
10768 !! end
10769
10770 !!test
10771 bug 5918: autonumbering
10772 !! input
10773 [http://first/] [http://second] [ftp://ftp]
10774
10775 ftp://inlineftp
10776
10777 [mailto:enclosed@mail.tld With target]
10778
10779 [mailto:enclosed@mail.tld]
10780
10781 mailto:inline@mail.tld
10782 !! result
10783 <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>
10784 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10785 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10786 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10787 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10788 </p>
10789 !! end
10790
10791
10792 #
10793 # Security and HTML correctness
10794 # From Nick Jenkins' fuzz testing
10795 #
10796
10797 !! test
10798 Fuzz testing: Parser13
10799 !! input
10800 {|
10801 | http://a|
10802 !! result
10803 <table>
10804 <tr>
10805 <td>
10806 </td>
10807 </tr>
10808 </table>
10809
10810 !! end
10811
10812 !! test
10813 Fuzz testing: Parser14
10814 !! input
10815 == onmouseover= ==
10816 http://__TOC__
10817 !! result
10818 <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>
10819 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10820 <ul>
10821 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10822 </ul>
10823 </div>
10824
10825 !! end
10826
10827 !! test
10828 Fuzz testing: Parser14-table
10829 !! input
10830 ==a==
10831 {| STYLE=__TOC__
10832 !! result
10833 <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>
10834 <table style="&#95;_TOC&#95;_">
10835 <tr><td></td></tr>
10836 </table>
10837
10838 !! end
10839
10840 # Known to produce bogus xml (extra </td>)
10841 !! test
10842 Fuzz testing: Parser16
10843 !! options
10844 noxml
10845 !! input
10846 {|
10847 !https://||||||
10848 !! result
10849 <table>
10850 <tr>
10851 <th>https://</th>
10852 <th></th>
10853 <th></th>
10854 <th>
10855 </td>
10856 </tr>
10857 </table>
10858
10859 !! end
10860
10861 !! test
10862 Fuzz testing: Parser21
10863 !! input
10864 {|
10865 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10866 |
10867 !! result
10868 <table>
10869 <tr>
10870 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10871 </th>
10872 <td>
10873 </td>
10874 </tr>
10875 </table>
10876
10877 !! end
10878
10879 !! test
10880 Fuzz testing: Parser22
10881 !! input
10882 http://===r:::https://b
10883
10884 {|
10885 !!result
10886 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10887 </p>
10888 <table>
10889 <tr><td></td></tr>
10890 </table>
10891
10892 !! end
10893
10894 # Known to produce bad XML for now
10895 !! test
10896 Fuzz testing: Parser24
10897 !! options
10898 noxml
10899 !! input
10900 {|
10901 {{{|
10902 <u CLASS=
10903 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10904 <br style="onmouseover='alert(document.cookie);' " />
10905
10906 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10907 |
10908 !! result
10909 <table>
10910 {{{|
10911 <u class="&#124;">}}}} &gt;
10912 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10913
10914 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10915 <tr>
10916 <td></u>
10917 </td>
10918 </tr>
10919 </table>
10920
10921 !! end
10922
10923 # Note: the current result listed for this is not what the original one was,
10924 # but the original bug was JavaScript injection, which is fixed in any case.
10925 # It's not clear that the original result listed was any more correct than the
10926 # current one. Original result:
10927 # <p>{{{|
10928 # </p>
10929 # <li class="&#124;&#124;">
10930 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10931 !!test
10932 Fuzz testing: Parser25 (bug 6055)
10933 !! input
10934 {{{
10935 |
10936 <LI CLASS=||
10937 >
10938 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10939 !! result
10940 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10941 </p>
10942 !! end
10943
10944 !!test
10945 Fuzz testing: URL adjacent extension (with space, clean)
10946 !! options
10947 !! input
10948 http://example.com <nowiki>junk</nowiki>
10949 !! result
10950 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10951 </p>
10952 !!end
10953
10954 !!test
10955 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10956 !! options
10957 !! input
10958 http://example.com<nowiki>junk</nowiki>
10959 !! result
10960 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10961 </p>
10962 !!end
10963
10964 !!test
10965 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10966 !! options
10967 !! input
10968 http://example.com<pre>junk</pre>
10969 !! result
10970 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10971
10972 !!end
10973
10974 !!test
10975 Fuzz testing: image with bogus manual thumbnail
10976 !!input
10977 [[Image:foobar.jpg|thumbnail= ]]
10978 !!result
10979 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10980
10981 !!end
10982
10983 !! test
10984 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10985 !! input
10986 <pre dir="&#10;"></pre>
10987 !! result
10988 <pre dir="&#10;"></pre>
10989
10990 !! end
10991
10992 !! test
10993 Parsing optional HTML elements (Bug 6171)
10994 !! options
10995 !! input
10996 <table>
10997 <tr>
10998 <td> Some tabular data</td>
10999 <td> More tabular data ...
11000 <td> And yet som tabular data</td>
11001 </tr>
11002 </table>
11003 !! result
11004 <table>
11005 <tr>
11006 <td> Some tabular data</td>
11007 <td> More tabular data ...
11008 </td><td> And yet som tabular data</td>
11009 </tr>
11010 </table>
11011
11012 !! end
11013
11014 !! test
11015 Correct handling of <td>, <tr> (Bug 6171)
11016 !! options
11017 !! input
11018 <table>
11019 <tr>
11020 <td> Some tabular data</td>
11021 <td> More tabular data ...</td>
11022 <td> And yet som tabular data</td>
11023 </tr>
11024 </table>
11025 !! result
11026 <table>
11027 <tr>
11028 <td> Some tabular data</td>
11029 <td> More tabular data ...</td>
11030 <td> And yet som tabular data</td>
11031 </tr>
11032 </table>
11033
11034 !! end
11035
11036
11037 !! test
11038 Parsing crashing regression (fr:JavaScript)
11039 !! input
11040 </body></x>
11041 !! result
11042 <p>&lt;/body&gt;&lt;/x&gt;
11043 </p>
11044 !! end
11045
11046 !! test
11047 Inline wiki vs wiki block nesting
11048 !! input
11049 '''Bold paragraph
11050
11051 New wiki paragraph
11052 !! result
11053 <p><b>Bold paragraph</b>
11054 </p><p>New wiki paragraph
11055 </p>
11056 !! end
11057
11058 !! test
11059 Inline HTML vs wiki block nesting
11060 !! options
11061 disabled
11062 !! input
11063 <b>Bold paragraph
11064
11065 New wiki paragraph
11066 !! result
11067 <p><b>Bold paragraph</b>
11068 </p><p>New wiki paragraph
11069 </p>
11070 !! end
11071
11072 # Original result was this:
11073 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11074 # </p>
11075 # While that might be marginally more intuitive, maybe, the six-apostrophe
11076 # construct is clearly pathological and the result stated here (which is what
11077 # the parser actually does) is about as reasonable as anything.
11078 !!test
11079 Mixing markup for italics and bold
11080 !! options
11081 !! input
11082 '''bold''''''bold''bolditalics'''''
11083 !! result
11084 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11085 </p>
11086 !! end
11087
11088
11089 !! article
11090 Xyzzyx
11091 !! text
11092 Article for special page transclusion test
11093 !! endarticle
11094
11095 !! test
11096 Special page transclusion
11097 !! options
11098 !! input
11099 {{Special:Prefixindex/Xyzzyx}}
11100 !! result
11101 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11102
11103 !! end
11104
11105 !! test
11106 Special page transclusion twice (bug 5021)
11107 !! options
11108 !! input
11109 {{Special:Prefixindex/Xyzzyx}}
11110 {{Special:Prefixindex/Xyzzyx}}
11111 !! result
11112 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11113 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11114
11115 !! end
11116
11117 !! test
11118 Transclusion of default MediaWiki message
11119 !! input
11120 {{MediaWiki:Mainpage}}
11121 !!result
11122 <p>Main Page
11123 </p>
11124 !! end
11125
11126 !! test
11127 Transclusion of nonexistent MediaWiki message
11128 !! input
11129 {{MediaWiki:Mainpagexxx}}
11130 !!result
11131 <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>
11132 </p>
11133 !! end
11134
11135 !! test
11136 Transclusion of MediaWiki message with underscore
11137 !! input
11138 {{MediaWiki:history_short}}
11139 !! result
11140 <p>History
11141 </p>
11142 !! end
11143
11144 !! test
11145 Transclusion of MediaWiki message with space
11146 !! input
11147 {{MediaWiki:history short}}
11148 !! result
11149 <p>History
11150 </p>
11151 !! end
11152
11153 !! test
11154 Invalid header with following text
11155 !! input
11156 = x = y
11157 !! result
11158 <p>= x = y
11159 </p>
11160 !! end
11161
11162
11163 !! test
11164 Section extraction test (section 0)
11165 !! options
11166 section=0
11167 !! input
11168 start
11169 ==a==
11170 ===aa===
11171 ====aaa====
11172 ==b==
11173 ===ba===
11174 ===bb===
11175 ====bba====
11176 ===bc===
11177 ==c==
11178 ===ca===
11179 !! result
11180 start
11181 !! end
11182
11183 !! test
11184 Section extraction test (section 1)
11185 !! options
11186 section=1
11187 !! input
11188 start
11189 ==a==
11190 ===aa===
11191 ====aaa====
11192 ==b==
11193 ===ba===
11194 ===bb===
11195 ====bba====
11196 ===bc===
11197 ==c==
11198 ===ca===
11199 !! result
11200 ==a==
11201 ===aa===
11202 ====aaa====
11203 !! end
11204
11205 !! test
11206 Section extraction test (section 2)
11207 !! options
11208 section=2
11209 !! input
11210 start
11211 ==a==
11212 ===aa===
11213 ====aaa====
11214 ==b==
11215 ===ba===
11216 ===bb===
11217 ====bba====
11218 ===bc===
11219 ==c==
11220 ===ca===
11221 !! result
11222 ===aa===
11223 ====aaa====
11224 !! end
11225
11226 !! test
11227 Section extraction test (section 3)
11228 !! options
11229 section=3
11230 !! input
11231 start
11232 ==a==
11233 ===aa===
11234 ====aaa====
11235 ==b==
11236 ===ba===
11237 ===bb===
11238 ====bba====
11239 ===bc===
11240 ==c==
11241 ===ca===
11242 !! result
11243 ====aaa====
11244 !! end
11245
11246 !! test
11247 Section extraction test (section 4)
11248 !! options
11249 section=4
11250 !! input
11251 start
11252 ==a==
11253 ===aa===
11254 ====aaa====
11255 ==b==
11256 ===ba===
11257 ===bb===
11258 ====bba====
11259 ===bc===
11260 ==c==
11261 ===ca===
11262 !! result
11263 ==b==
11264 ===ba===
11265 ===bb===
11266 ====bba====
11267 ===bc===
11268 !! end
11269
11270 !! test
11271 Section extraction test (section 5)
11272 !! options
11273 section=5
11274 !! input
11275 start
11276 ==a==
11277 ===aa===
11278 ====aaa====
11279 ==b==
11280 ===ba===
11281 ===bb===
11282 ====bba====
11283 ===bc===
11284 ==c==
11285 ===ca===
11286 !! result
11287 ===ba===
11288 !! end
11289
11290 !! test
11291 Section extraction test (section 6)
11292 !! options
11293 section=6
11294 !! input
11295 start
11296 ==a==
11297 ===aa===
11298 ====aaa====
11299 ==b==
11300 ===ba===
11301 ===bb===
11302 ====bba====
11303 ===bc===
11304 ==c==
11305 ===ca===
11306 !! result
11307 ===bb===
11308 ====bba====
11309 !! end
11310
11311 !! test
11312 Section extraction test (section 7)
11313 !! options
11314 section=7
11315 !! input
11316 start
11317 ==a==
11318 ===aa===
11319 ====aaa====
11320 ==b==
11321 ===ba===
11322 ===bb===
11323 ====bba====
11324 ===bc===
11325 ==c==
11326 ===ca===
11327 !! result
11328 ====bba====
11329 !! end
11330
11331 !! test
11332 Section extraction test (section 8)
11333 !! options
11334 section=8
11335 !! input
11336 start
11337 ==a==
11338 ===aa===
11339 ====aaa====
11340 ==b==
11341 ===ba===
11342 ===bb===
11343 ====bba====
11344 ===bc===
11345 ==c==
11346 ===ca===
11347 !! result
11348 ===bc===
11349 !! end
11350
11351 !! test
11352 Section extraction test (section 9)
11353 !! options
11354 section=9
11355 !! input
11356 start
11357 ==a==
11358 ===aa===
11359 ====aaa====
11360 ==b==
11361 ===ba===
11362 ===bb===
11363 ====bba====
11364 ===bc===
11365 ==c==
11366 ===ca===
11367 !! result
11368 ==c==
11369 ===ca===
11370 !! end
11371
11372 !! test
11373 Section extraction test (section 10)
11374 !! options
11375 section=10
11376 !! input
11377 start
11378 ==a==
11379 ===aa===
11380 ====aaa====
11381 ==b==
11382 ===ba===
11383 ===bb===
11384 ====bba====
11385 ===bc===
11386 ==c==
11387 ===ca===
11388 !! result
11389 ===ca===
11390 !! end
11391
11392 !! test
11393 Section extraction test (nonexistent section 11)
11394 !! options
11395 section=11
11396 !! input
11397 start
11398 ==a==
11399 ===aa===
11400 ====aaa====
11401 ==b==
11402 ===ba===
11403 ===bb===
11404 ====bba====
11405 ===bc===
11406 ==c==
11407 ===ca===
11408 !! result
11409 !! end
11410
11411 !! test
11412 Section extraction test with bogus heading (section 1)
11413 !! options
11414 section=1
11415 !! input
11416 ==a==
11417 ==bogus== not a legal section
11418 ==b==
11419 !! result
11420 ==a==
11421 ==bogus== not a legal section
11422 !! end
11423
11424 !! test
11425 Section extraction test with bogus heading (section 2)
11426 !! options
11427 section=2
11428 !! input
11429 ==a==
11430 ==bogus== not a legal section
11431 ==b==
11432 !! result
11433 ==b==
11434 !! end
11435
11436 !! test
11437 Section extraction test with comment after heading (section 1)
11438 !! options
11439 section=1
11440 !! input
11441 ==a==
11442 ==b== <!-- -->
11443 ==c==
11444 !! result
11445 ==a==
11446 !! end
11447
11448 !! test
11449 Section extraction test with comment after heading (section 2)
11450 !! options
11451 section=2
11452 !! input
11453 ==a==
11454 ==b== <!-- -->
11455 ==c==
11456 !! result
11457 ==b== <!-- -->
11458 !! end
11459
11460 !! test
11461 Section extraction test with bogus <nowiki> heading (section 1)
11462 !! options
11463 section=1
11464 !! input
11465 ==a==
11466 ==bogus== <nowiki>not a legal section</nowiki>
11467 ==b==
11468 !! result
11469 ==a==
11470 ==bogus== <nowiki>not a legal section</nowiki>
11471 !! end
11472
11473 !! test
11474 Section extraction test with bogus <nowiki> heading (section 2)
11475 !! options
11476 section=2
11477 !! input
11478 ==a==
11479 ==bogus== <nowiki>not a legal section</nowiki>
11480 ==b==
11481 !! result
11482 ==b==
11483 !! end
11484
11485
11486 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11487 # instead of respecting commented sections
11488 !! test
11489 Section extraction prefixed by comment (section 1)
11490 !! options
11491 section=1
11492 !! input
11493 <!-- -->==sec1==
11494 ==sec2==
11495 !!result
11496 ==sec2==
11497 !!end
11498
11499 !! test
11500 Section extraction prefixed by comment (section 2)
11501 !! options
11502 section=2
11503 !! input
11504 <!-- -->==sec1==
11505 ==sec2==
11506 !!result
11507
11508 !!end
11509
11510
11511 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11512 # instead of respecting HTML-style headings
11513 !! test
11514 Section extraction, mixed wiki and html (section 1)
11515 !! options
11516 section=1
11517 !! input
11518 <h2>unmarked</h2>
11519 unmarked
11520 ==1==
11521 one
11522 ==2==
11523 two
11524 !! result
11525 ==1==
11526 one
11527 !! end
11528
11529 !! test
11530 Section extraction, mixed wiki and html (section 2)
11531 !! options
11532 section=2
11533 !! input
11534 <h2>unmarked</h2>
11535 unmarked
11536 ==1==
11537 one
11538 ==2==
11539 two
11540 !! result
11541 ==2==
11542 two
11543 !! end
11544
11545
11546 # Formerly testing for bug 3342
11547 !! test
11548 Section extraction, heading surrounded by <noinclude>
11549 !! options
11550 section=1
11551 !! input
11552 <noinclude>==unmarked==</noinclude>
11553 ==marked==
11554 !! result
11555 ==marked==
11556 !!end
11557
11558 # Test behavior of bug 19910
11559 !! test
11560 Sectiion with all-equals
11561 !! options
11562 section=2
11563 !! input
11564 ===
11565 The line above must have a trailing space
11566 === <!--
11567 --> <!-- -->
11568 But just in case it doesn't...
11569 !! result
11570 === <!--
11571 --> <!-- -->
11572 But just in case it doesn't...
11573 !! end
11574
11575 !! test
11576 Section replacement test (section 0)
11577 !! options
11578 replace=0,"xxx"
11579 !! input
11580 start
11581 ==a==
11582 ===aa===
11583 ====aaa====
11584 ==b==
11585 ===ba===
11586 ===bb===
11587 ====bba====
11588 ===bc===
11589 ==c==
11590 ===ca===
11591 !! result
11592 xxx
11593
11594 ==a==
11595 ===aa===
11596 ====aaa====
11597 ==b==
11598 ===ba===
11599 ===bb===
11600 ====bba====
11601 ===bc===
11602 ==c==
11603 ===ca===
11604 !! end
11605
11606 !! test
11607 Section replacement test (section 1)
11608 !! options
11609 replace=1,"xxx"
11610 !! input
11611 start
11612 ==a==
11613 ===aa===
11614 ====aaa====
11615 ==b==
11616 ===ba===
11617 ===bb===
11618 ====bba====
11619 ===bc===
11620 ==c==
11621 ===ca===
11622 !! result
11623 start
11624 xxx
11625
11626 ==b==
11627 ===ba===
11628 ===bb===
11629 ====bba====
11630 ===bc===
11631 ==c==
11632 ===ca===
11633 !! end
11634
11635 !! test
11636 Section replacement test (section 2)
11637 !! options
11638 replace=2,"xxx"
11639 !! input
11640 start
11641 ==a==
11642 ===aa===
11643 ====aaa====
11644 ==b==
11645 ===ba===
11646 ===bb===
11647 ====bba====
11648 ===bc===
11649 ==c==
11650 ===ca===
11651 !! result
11652 start
11653 ==a==
11654 xxx
11655
11656 ==b==
11657 ===ba===
11658 ===bb===
11659 ====bba====
11660 ===bc===
11661 ==c==
11662 ===ca===
11663 !! end
11664
11665 !! test
11666 Section replacement test (section 3)
11667 !! options
11668 replace=3,"xxx"
11669 !! input
11670 start
11671 ==a==
11672 ===aa===
11673 ====aaa====
11674 ==b==
11675 ===ba===
11676 ===bb===
11677 ====bba====
11678 ===bc===
11679 ==c==
11680 ===ca===
11681 !! result
11682 start
11683 ==a==
11684 ===aa===
11685 xxx
11686
11687 ==b==
11688 ===ba===
11689 ===bb===
11690 ====bba====
11691 ===bc===
11692 ==c==
11693 ===ca===
11694 !! end
11695
11696 !! test
11697 Section replacement test (section 4)
11698 !! options
11699 replace=4,"xxx"
11700 !! input
11701 start
11702 ==a==
11703 ===aa===
11704 ====aaa====
11705 ==b==
11706 ===ba===
11707 ===bb===
11708 ====bba====
11709 ===bc===
11710 ==c==
11711 ===ca===
11712 !! result
11713 start
11714 ==a==
11715 ===aa===
11716 ====aaa====
11717 xxx
11718
11719 ==c==
11720 ===ca===
11721 !! end
11722
11723 !! test
11724 Section replacement test (section 5)
11725 !! options
11726 replace=5,"xxx"
11727 !! input
11728 start
11729 ==a==
11730 ===aa===
11731 ====aaa====
11732 ==b==
11733 ===ba===
11734 ===bb===
11735 ====bba====
11736 ===bc===
11737 ==c==
11738 ===ca===
11739 !! result
11740 start
11741 ==a==
11742 ===aa===
11743 ====aaa====
11744 ==b==
11745 xxx
11746
11747 ===bb===
11748 ====bba====
11749 ===bc===
11750 ==c==
11751 ===ca===
11752 !! end
11753
11754 !! test
11755 Section replacement test (section 6)
11756 !! options
11757 replace=6,"xxx"
11758 !! input
11759 start
11760 ==a==
11761 ===aa===
11762 ====aaa====
11763 ==b==
11764 ===ba===
11765 ===bb===
11766 ====bba====
11767 ===bc===
11768 ==c==
11769 ===ca===
11770 !! result
11771 start
11772 ==a==
11773 ===aa===
11774 ====aaa====
11775 ==b==
11776 ===ba===
11777 xxx
11778
11779 ===bc===
11780 ==c==
11781 ===ca===
11782 !! end
11783
11784 !! test
11785 Section replacement test (section 7)
11786 !! options
11787 replace=7,"xxx"
11788 !! input
11789 start
11790 ==a==
11791 ===aa===
11792 ====aaa====
11793 ==b==
11794 ===ba===
11795 ===bb===
11796 ====bba====
11797 ===bc===
11798 ==c==
11799 ===ca===
11800 !! result
11801 start
11802 ==a==
11803 ===aa===
11804 ====aaa====
11805 ==b==
11806 ===ba===
11807 ===bb===
11808 xxx
11809
11810 ===bc===
11811 ==c==
11812 ===ca===
11813 !! end
11814
11815 !! test
11816 Section replacement test (section 8)
11817 !! options
11818 replace=8,"xxx"
11819 !! input
11820 start
11821 ==a==
11822 ===aa===
11823 ====aaa====
11824 ==b==
11825 ===ba===
11826 ===bb===
11827 ====bba====
11828 ===bc===
11829 ==c==
11830 ===ca===
11831 !! result
11832 start
11833 ==a==
11834 ===aa===
11835 ====aaa====
11836 ==b==
11837 ===ba===
11838 ===bb===
11839 ====bba====
11840 xxx
11841
11842 ==c==
11843 ===ca===
11844 !!end
11845
11846 !! test
11847 Section replacement test (section 9)
11848 !! options
11849 replace=9,"xxx"
11850 !! input
11851 start
11852 ==a==
11853 ===aa===
11854 ====aaa====
11855 ==b==
11856 ===ba===
11857 ===bb===
11858 ====bba====
11859 ===bc===
11860 ==c==
11861 ===ca===
11862 !! result
11863 start
11864 ==a==
11865 ===aa===
11866 ====aaa====
11867 ==b==
11868 ===ba===
11869 ===bb===
11870 ====bba====
11871 ===bc===
11872 xxx
11873 !! end
11874
11875 !! test
11876 Section replacement test (section 10)
11877 !! options
11878 replace=10,"xxx"
11879 !! input
11880 start
11881 ==a==
11882 ===aa===
11883 ====aaa====
11884 ==b==
11885 ===ba===
11886 ===bb===
11887 ====bba====
11888 ===bc===
11889 ==c==
11890 ===ca===
11891 !! result
11892 start
11893 ==a==
11894 ===aa===
11895 ====aaa====
11896 ==b==
11897 ===ba===
11898 ===bb===
11899 ====bba====
11900 ===bc===
11901 ==c==
11902 xxx
11903 !! end
11904
11905 !! test
11906 Section replacement test with initial whitespace (bug 13728)
11907 !! options
11908 replace=2,"xxx"
11909 !! input
11910 Preformatted initial line
11911 ==a==
11912 ===a===
11913 !! result
11914 Preformatted initial line
11915 ==a==
11916 xxx
11917 !! end
11918
11919
11920 !! test
11921 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11922 !! options
11923 section=1
11924 !! input
11925 ==a==
11926 a
11927 !! result
11928 ==a==
11929 a
11930 !! end
11931
11932 !! test
11933 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11934 !! options
11935 section=1
11936 !! input
11937 ==a==
11938 a
11939 !! result
11940 ==a==
11941 a
11942 !! end
11943
11944
11945 !! test
11946 Section extraction, <pre> around bogus header (bug 10309)
11947 !! options
11948 noxml section=2
11949 !! input
11950 == Section One ==
11951 <pre>
11952 =======
11953 </pre>
11954
11955 == Section Two ==
11956 stuff
11957 !! result
11958 == Section Two ==
11959 stuff
11960 !! end
11961
11962 !! test
11963 Section replacement, <pre> around bogus header (bug 10309)
11964 !! options
11965 noxml replace=2,"xxx"
11966 !! input
11967 == Section One ==
11968 <pre>
11969 =======
11970 </pre>
11971
11972 == Section Two ==
11973 stuff
11974 !! result
11975 == Section One ==
11976 <pre>
11977 =======
11978 </pre>
11979
11980 xxx
11981 !! end
11982
11983
11984
11985 !! test
11986 Handling of &#x0A; in URLs
11987 !! input
11988 **irc://&#x0A;a
11989 !! result
11990 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11991 </li></ul>
11992 </li></ul>
11993
11994 !!end
11995
11996 !! test
11997 5 quotes, code coverage +1 line (php)
11998 !! options
11999 php
12000 !! input
12001 '''''
12002 !! result
12003 !! end
12004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12005 !! test
12006 5 quotes, code coverage +1 line (parsoid)
12007 !! options
12008 parsoid
12009 !! input
12010 '''''
12011 !! result
12012 <p><i><b></b></i></p>
12013 !! end
12014
12015 !! test
12016 Special:Search page linking.
12017 !! input
12018 {{Special:search}}
12019 !! result
12020 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12021 </p>
12022 !! end
12023
12024 !! test
12025 Say the magic word
12026 !! input
12027 * {{PAGENAME}}
12028 * {{BASEPAGENAME}}
12029 * {{SUBPAGENAME}}
12030 * {{SUBPAGENAMEE}}
12031 * {{ROOTPAGENAME}}
12032 * {{ROOTPAGENAMEE}}
12033 * {{BASEPAGENAME}}
12034 * {{BASEPAGENAMEE}}
12035 * {{TALKPAGENAME}}
12036 * {{TALKPAGENAMEE}}
12037 * {{SUBJECTPAGENAME}}
12038 * {{SUBJECTPAGENAMEE}}
12039 * {{NAMESPACEE}}
12040 * {{NAMESPACE}}
12041 * {{TALKSPACE}}
12042 * {{TALKSPACEE}}
12043 * {{SUBJECTSPACE}}
12044 * {{SUBJECTSPACEE}}
12045 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12046 !! result
12047 <ul><li> Parser test
12048 </li><li> Parser test
12049 </li><li> Parser test
12050 </li><li> Parser_test
12051 </li><li> Parser test
12052 </li><li> Parser_test
12053 </li><li> Parser test
12054 </li><li> Parser_test
12055 </li><li> Talk:Parser test
12056 </li><li> Talk:Parser_test
12057 </li><li> Parser test
12058 </li><li> Parser_test
12059 </li><li>
12060 </li><li>
12061 </li><li> Talk
12062 </li><li> Talk
12063 </li><li>
12064 </li><li>
12065 </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>
12066 </li></ul>
12067
12068 !! end
12069 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12070
12071 !! test
12072 Gallery
12073 !! input
12074 <gallery>
12075 image1.png |
12076 image2.gif|||||
12077
12078 image3|
12079 image4 |300px| centre
12080 image5.svg| http://///////
12081 [[x|xx]]]]
12082 * image6
12083 </gallery>
12084 !! result
12085 <ul class="gallery">
12086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12087 <div style="height: 150px;">Image1.png</div>
12088 <div class="gallerytext">
12089 </div>
12090 </div></li>
12091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12092 <div style="height: 150px;">Image2.gif</div>
12093 <div class="gallerytext">
12094 <p>||||
12095 </p>
12096 </div>
12097 </div></li>
12098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12099 <div style="height: 150px;">Image3</div>
12100 <div class="gallerytext">
12101 </div>
12102 </div></li>
12103 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12104 <div style="height: 150px;">Image4</div>
12105 <div class="gallerytext">
12106 <p>300px| centre
12107 </p>
12108 </div>
12109 </div></li>
12110 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12111 <div style="height: 150px;">Image5.svg</div>
12112 <div class="gallerytext">
12113 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12114 </p>
12115 </div>
12116 </div></li>
12117 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12118 <div style="height: 150px;">* image6</div>
12119 <div class="gallerytext">
12120 </div>
12121 </div></li>
12122 </ul>
12123
12124 !! end
12125
12126 !! test
12127 Gallery (with options)
12128 !! input
12129 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12130 File:Nonexistant.jpg|caption
12131 File:Nonexistant.jpg
12132 image:foobar.jpg|some '''caption''' [[Main Page]]
12133 image:foobar.jpg
12134 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12135 </gallery>
12136 !! result
12137 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12138 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12139 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12140 <div style="height: 70px;">Nonexistant.jpg</div>
12141 <div class="gallerytext">
12142 <p>caption
12143 </p>
12144 </div>
12145 </div></li>
12146 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12147 <div style="height: 70px;">Nonexistant.jpg</div>
12148 <div class="gallerytext">
12149 </div>
12150 </div></li>
12151 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12152 <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>
12153 <div class="gallerytext">
12154 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12155 </p>
12156 </div>
12157 </div></li>
12158 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12159 <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>
12160 <div class="gallerytext">
12161 </div>
12162 </div></li>
12163 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12164 <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>
12165 <div class="gallerytext">
12166 <p>Blabla|blabla.
12167 </p>
12168 </div>
12169 </div></li>
12170 </ul>
12171
12172 !! end
12173
12174 !! test
12175 Gallery with wikitext inside caption
12176 !! input
12177 <gallery>
12178 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12179 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12180 </gallery>
12181 !! result
12182 <ul class="gallery">
12183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12184 <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>
12185 <div class="gallerytext">
12186 <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>
12187 </p>
12188 </div>
12189 </div></li>
12190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12191 <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>
12192 <div class="gallerytext">
12193 <p>This is a test template
12194 </p>
12195 </div>
12196 </div></li>
12197 </ul>
12198
12199 !! end
12200
12201 !! test
12202 gallery (with showfilename option)
12203 !! input
12204 <gallery showfilename>
12205 File:Nonexistant.jpg|caption
12206 File:Nonexistant.jpg
12207 image:foobar.jpg|some '''caption''' [[Main Page]]
12208 File:Foobar.jpg
12209 </gallery>
12210 !! result
12211 <ul class="gallery">
12212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12213 <div style="height: 150px;">Nonexistant.jpg</div>
12214 <div class="gallerytext">
12215 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12216 caption
12217 </p>
12218 </div>
12219 </div></li>
12220 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12221 <div style="height: 150px;">Nonexistant.jpg</div>
12222 <div class="gallerytext">
12223 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12224 </p>
12225 </div>
12226 </div></li>
12227 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12228 <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>
12229 <div class="gallerytext">
12230 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12231 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12232 </p>
12233 </div>
12234 </div></li>
12235 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12236 <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>
12237 <div class="gallerytext">
12238 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12239 </p>
12240 </div>
12241 </div></li>
12242 </ul>
12243
12244 !! end
12245
12246 !! test
12247 Gallery (with namespace-less filenames)
12248 !! input
12249 <gallery>
12250 File:Nonexistant.jpg
12251 Nonexistant.jpg
12252 image:foobar.jpg
12253 foobar.jpg
12254 </gallery>
12255 !! result
12256 <ul class="gallery">
12257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12258 <div style="height: 150px;">Nonexistant.jpg</div>
12259 <div class="gallerytext">
12260 </div>
12261 </div></li>
12262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12263 <div style="height: 150px;">Nonexistant.jpg</div>
12264 <div class="gallerytext">
12265 </div>
12266 </div></li>
12267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12268 <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>
12269 <div class="gallerytext">
12270 </div>
12271 </div></li>
12272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12273 <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>
12274 <div class="gallerytext">
12275 </div>
12276 </div></li>
12277 </ul>
12278
12279 !! end
12280
12281 !! test
12282 HTML Hex character encoding (spells the word "JavaScript")
12283 !! input
12284 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12285 !! result
12286 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12287 </p>
12288 !! end
12289
12290 !! test
12291 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12292 !! input
12293 &#xsee;&#XSEE;
12294 !! result
12295 <p>&amp;#xsee;&amp;#XSEE;
12296 </p>
12297 !! end
12298
12299 !! test
12300 HTML Hex character encoding mixed case
12301 !! input
12302 &#xEE;&#Xee;
12303 !! result
12304 <p>&#xee;&#xee;
12305 </p>
12306 !! end
12307
12308 !! test
12309 __FORCETOC__ override
12310 !! input
12311 __NEWSECTIONLINK__
12312 __FORCETOC__
12313 !! result
12314 <p><br />
12315 </p>
12316 !! end
12317
12318 !! test
12319 ISBN code coverage
12320 !! input
12321 ISBN 978-0-1234-56&#x20;789
12322 !! result
12323 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12324 </p>
12325 !! end
12326
12327 !! test
12328 ISBN followed by 5 spaces
12329 !! input
12330 ISBN
12331 !! result
12332 <p>ISBN
12333 </p>
12334 !! end
12335
12336 !! test
12337 Double ISBN
12338 !! input
12339 ISBN ISBN 1234567890
12340 !! result
12341 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12342 </p>
12343 !! end
12344
12345 !! test
12346 Bug 22905: <abbr> followed by ISBN followed by </a>
12347 !! input
12348 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12349 !! result
12350 <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>
12351 </p>
12352 !! end
12353
12354 !! test
12355 Double RFC
12356 !! input
12357 RFC RFC 1234
12358 !! result
12359 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12360 </p>
12361 !! end
12362
12363 !! test
12364 Double RFC with a wiki link
12365 !! input
12366 RFC [[RFC 1234]]
12367 !! result
12368 <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>
12369 </p>
12370 !! end
12371
12372 !! test
12373 RFC code coverage
12374 !! input
12375 RFC 983&#x20;987
12376 !! result
12377 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12378 </p>
12379 !! end
12380
12381 !! test
12382 Centre-aligned image
12383 !! input
12384 [[Image:foobar.jpg|centre]]
12385 !! result
12386 <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>
12387
12388 !!end
12389
12390 !! test
12391 None-aligned image
12392 !! input
12393 [[Image:foobar.jpg|none]]
12394 !! result
12395 <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>
12396
12397 !!end
12398
12399 !! test
12400 Width + Height sized image (using px) (height is ignored)
12401 !! input
12402 [[Image:foobar.jpg|640x480px]]
12403 !! result
12404 <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>
12405 </p>
12406 !!end
12407
12408 !! test
12409 Width-sized image (using px, no following whitespace)
12410 !! input
12411 [[Image:foobar.jpg|640px]]
12412 !! result
12413 <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>
12414 </p>
12415 !!end
12416
12417 !! test
12418 Width-sized image (using px, with following whitespace - test regression from r39467)
12419 !! input
12420 [[Image:foobar.jpg|640px ]]
12421 !! result
12422 <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>
12423 </p>
12424 !!end
12425
12426 !! test
12427 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12428 !! input
12429 [[Image:foobar.jpg| 640px]]
12430 !! result
12431 <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>
12432 </p>
12433 !!end
12434
12435 !! test
12436 Another italics / bold test
12437 !! input
12438 ''' ''x'
12439 !! result
12440 <pre>'<i> </i>x'
12441 </pre>
12442 !!end
12443
12444 # Note the results may be incorrect, as parserTest output included this:
12445 # XML error: Mismatched tag at byte 6120:
12446 # ...<dd> </dt></dl> </dd...
12447 !! test
12448 dt/dd/dl test
12449 !! options
12450 disabled
12451 !! input
12452 :;;;::
12453 !! result
12454 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12455 </dd></dl>
12456 </dd></dl>
12457 </dt></dl>
12458 </dt></dl>
12459 </dt></dl>
12460 </dd></dl>
12461
12462 !!end
12463
12464
12465 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12466 !! test
12467 Images with the "|" character in the comment
12468 !! input
12469 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12470 !! result
12471 <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>
12472
12473 !!end
12474
12475 !! test
12476 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12477 !! input
12478 <html><script>alert(1);</script></html>
12479 !! result
12480 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12481 </p>
12482 !! end
12483
12484 !! test
12485 HTML with raw HTML ($wgRawHtml==true)
12486 !! options
12487 wgRawHtml=1
12488 !! input
12489 <html><script>alert(1);</script></html>
12490 !! result
12491 <p><script>alert(1);</script>
12492 </p>
12493 !! end
12494
12495 !! test
12496 Parents of subpages, one level up
12497 !! options
12498 subpage title=[[Subpage test/L1/L2/L3]]
12499 !! input
12500 [[../|L2]]
12501 !! result
12502 <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>
12503 </p>
12504 !! end
12505
12506
12507 !! test
12508 Parents of subpages, one level up, not named
12509 !! options
12510 subpage title=[[Subpage test/L1/L2/L3]]
12511 !! input
12512 [[../]]
12513 !! result
12514 <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>
12515 </p>
12516 !! end
12517
12518
12519
12520 !! test
12521 Parents of subpages, two levels up
12522 !! options
12523 subpage title=[[Subpage test/L1/L2/L3]]
12524 !! input
12525 [[../../|L1]]2
12526
12527 [[../../|L1]]l
12528 !! result
12529 <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
12530 </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>
12531 </p>
12532 !! end
12533
12534 !! test
12535 Parents of subpages, two levels up, without trailing slash or name.
12536 !! options
12537 subpage title=[[Subpage test/L1/L2/L3]]
12538 !! input
12539 [[../..]]
12540 !! result
12541 <p>[[../..]]
12542 </p>
12543 !! end
12544
12545 !! test
12546 Parents of subpages, two levels up, with lots of extra trailing slashes.
12547 !! options
12548 subpage title=[[Subpage test/L1/L2/L3]]
12549 !! input
12550 [[../../////]]
12551 !! result
12552 <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>
12553 </p>
12554 !! end
12555
12556 !! article
12557 Subpage test/L1/L2/L3Sibling
12558 !! text
12559 Sibling article
12560 !! endarticle
12561
12562 !! test
12563 Transclusion of a sibling page (one level up)
12564 !! options
12565 subpage title=[[Subpage test/L1/L2/L3]]
12566 !! input
12567 {{../L3Sibling}}
12568 !! result
12569 <p>Sibling article
12570 </p>
12571 !! end
12572
12573 !! test
12574 Transclusion of a child page
12575 !! options
12576 subpage title=[[Subpage test/L1/L2]]
12577 !! input
12578 {{/L3Sibling}}
12579 !! result
12580 <p>Sibling article
12581 </p>
12582 !! end
12583
12584 !! test
12585 Non-transclusion because of too many up levels
12586 !! options
12587 subpage title=[[Subpage test/L1/L2/L3]]
12588 !! input
12589 {{../../../../More than parent}}
12590 !! result
12591 <p>{{../../../../More than parent}}
12592 </p>
12593 !! end
12594
12595 !! test
12596 Definition list code coverage
12597 !! input
12598 ; title : def
12599 ; title : def
12600 ;title: def
12601 !! result
12602 <dl><dt> title &#160;</dt><dd> def
12603 </dd><dt> title&#160;</dt><dd> def
12604 </dd><dt>title</dt><dd> def
12605 </dd></dl>
12606
12607 !! end
12608
12609 !! test
12610 Don't fall for the self-closing div
12611 !! input
12612 <div>hello world</div/>
12613 !! result
12614 <div>hello world</div>
12615
12616 !! end
12617
12618 !! test
12619 MSGNW magic word
12620 !! input
12621 {{MSGNW:msg}}
12622 !! result
12623 <p>&#91;&#91;:Template:Msg&#93;&#93;
12624 </p>
12625 !! end
12626
12627 !! test
12628 RAW magic word
12629 !! input
12630 {{RAW:QUERTY}}
12631 !! result
12632 <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>
12633 </p>
12634 !! end
12635
12636 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12637 !! test
12638 Always escape literal '>' in output, not just after '<'
12639 !! input
12640 ><>
12641 !! result
12642 <p>&gt;&lt;&gt;
12643 </p>
12644 !! end
12645
12646 !! test
12647 Template caching
12648 !! input
12649 {{Test}}
12650 {{Test}}
12651 !! result
12652 <p>This is a test template
12653 This is a test template
12654 </p>
12655 !! end
12656
12657
12658 !! article
12659 MediaWiki:Fake
12660 !! text
12661 ==header==
12662 !! endarticle
12663
12664 !! test
12665 Inclusion of !userCanEdit() content
12666 !! input
12667 {{MediaWiki:Fake}}
12668 !! result
12669 <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>
12670
12671 !! end
12672
12673
12674 !! test
12675 Out-of-order TOC heading levels
12676 !! input
12677 ==2==
12678 ======6======
12679 ===3===
12680 =1=
12681 =====5=====
12682 ==2==
12683 !! result
12684 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12685 <ul>
12686 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12687 <ul>
12688 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12689 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12690 </ul>
12691 </li>
12692 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12693 <ul>
12694 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12695 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12696 </ul>
12697 </li>
12698 </ul>
12699 </div>
12700 <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>
12701 <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>
12702 <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>
12703 <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>
12704 <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>
12705 <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>
12706
12707 !! end
12708
12709
12710 !! test
12711 ISBN with a dummy number
12712 !! input
12713 ISBN ---
12714 !! result
12715 <p>ISBN ---
12716 </p>
12717 !! end
12718
12719
12720 !! test
12721 ISBN with space-delimited number
12722 !! input
12723 ISBN 92 9017 032 8
12724 !! result
12725 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12726 </p>
12727 !! end
12728
12729
12730 !! test
12731 ISBN with multiple spaces, no number
12732 !! input
12733 ISBN foo
12734 !! result
12735 <p>ISBN foo
12736 </p>
12737 !! end
12738
12739
12740 !! test
12741 ISBN length
12742 !! input
12743 ISBN 123456789
12744
12745 ISBN 1234567890
12746
12747 ISBN 12345678901
12748 !! result
12749 <p>ISBN 123456789
12750 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12751 </p><p>ISBN 12345678901
12752 </p>
12753 !! end
12754
12755
12756 !! test
12757 ISBN with trailing year (bug 8110)
12758 !! input
12759 ISBN 1-234-56789-0 - 2006
12760
12761 ISBN 1 234 56789 0 - 2006
12762 !! result
12763 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12764 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12765 </p>
12766 !! end
12767
12768
12769 !! test
12770 anchorencode
12771 !! input
12772 {{anchorencode:foo bar©#%n}}
12773 !! result
12774 <p>foo_bar.C2.A9.23.25n
12775 </p>
12776 !! end
12777
12778 !! test
12779 anchorencode trims spaces
12780 !! input
12781 {{anchorencode: __pretty__please__}}
12782 !! result
12783 <p>pretty_please
12784 </p>
12785 !! end
12786
12787 !! test
12788 anchorencode deals with links
12789 !! input
12790 {{anchorencode: [[hello|world]] [[hi]]}}
12791 !! result
12792 <p>world_hi
12793 </p>
12794 !! end
12795
12796 !! test
12797 anchorencode deals with templates
12798 !! input
12799 {{anchorencode: {{Foo}} }}
12800 !! result
12801 <p>FOO
12802 </p>
12803 !! end
12804
12805 !! test
12806 anchorencode encodes like the TOC generator: (bug 18431)
12807 !! input
12808 === _ +:.3A%3A&&amp;]] ===
12809 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12810 __NOEDITSECTION__
12811 !! result
12812 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12813 <p>.2B:.3A.253A.26.26.5D.5D
12814 </p>
12815 !! end
12816
12817 # Expected output in the following test is not necessarily expected (there
12818 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12819 # only testing for well-formedness.
12820 !! test
12821 Bug 6200: blockquotes and paragraph formatting
12822 !! input
12823 <blockquote>
12824 foo
12825 </blockquote>
12826
12827 bar
12828
12829 baz
12830 !! result
12831 <blockquote>
12832 foo
12833 </blockquote>
12834 <p>bar
12835 </p>
12836 <pre>baz
12837 </pre>
12838 !! end
12839
12840 !! test
12841 Bug 8293: Use of center tag ruins paragraph formatting
12842 !! input
12843 <center>
12844 foo
12845 </center>
12846
12847 bar
12848
12849 baz
12850 !! result
12851 <center>
12852 <p>foo
12853 </p>
12854 </center>
12855 <p>bar
12856 </p>
12857 <pre>baz
12858 </pre>
12859 !! end
12860
12861 !!test
12862 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12863 !!options
12864 php
12865 !!input
12866 <span><s>x</span></s>
12867 !!result
12868 <p><span><s>x&lt;/span&gt;</s></span>
12869 </p>
12870 !!end
12871
12872 !!test
12873 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12874 !!options
12875 parsoid
12876 !!input
12877 <span><s>x</span></s>
12878 !!result
12879 <p><span><s>x</s></span><s></s>
12880 </p>
12881 !!end
12882
12883 ###
12884 ### Language variants related tests
12885 ###
12886 !! test
12887 Self-link in language variants
12888 !! options
12889 title=[[Dunav]] language=sr
12890 !! input
12891 Both [[Dunav]] and [[Дунав]] are names for this river.
12892 !! result
12893 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12894 </p>
12895 !!end
12896
12897 !! article
12898 Дуна
12899 !! text
12900 content
12901 !! endarticle
12902
12903 !! test
12904 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12905 !! options
12906 title=[[Duna]] language=sr
12907 !! input
12908 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12909 !! result
12910 <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.
12911 </p>
12912 !! end
12913
12914 !! test
12915 Link to pages in language variants
12916 !! options
12917 language=sr
12918 !! input
12919 Main Page can be written as [[Маин Паге]]
12920 !! result
12921 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12922 </p>
12923 !!end
12924
12925
12926 !! test
12927 Multiple links to pages in language variants
12928 !! options
12929 language=sr
12930 !! input
12931 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12932 !! result
12933 <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>.
12934 </p>
12935 !!end
12936
12937
12938 !! test
12939 Simple template in language variants
12940 !! options
12941 language=sr
12942 !! input
12943 {{тест}}
12944 !! result
12945 <p>This is a test template
12946 </p>
12947 !! end
12948
12949
12950 !! test
12951 Template with explicit namespace in language variants
12952 !! options
12953 language=sr
12954 !! input
12955 {{Template:тест}}
12956 !! result
12957 <p>This is a test template
12958 </p>
12959 !! end
12960
12961
12962 !! test
12963 Basic test for template parameter in language variants
12964 !! options
12965 language=sr
12966 !! input
12967 {{парамтест|param=foo}}
12968 !! result
12969 <p>This is a test template with parameter foo
12970 </p>
12971 !! end
12972
12973
12974 !! test
12975 Simple category in language variants
12976 !! options
12977 language=sr cat
12978 !! input
12979 [[Category:МедиаWики Усер'с Гуиде]]
12980 !! result
12981 <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>
12982 !! end
12983
12984
12985 !! article
12986 Category:分类
12987 !! text
12988 blah
12989 !! endarticle
12990
12991 !! article
12992 Category:分類
12993 !! text
12994 blah
12995 !! endarticle
12996
12997 !! test
12998 Don't convert blue categorylinks to another variant (bug 33210)
12999 !! options
13000 language=zh cat
13001 !! input
13002 [[A]][[Category:分类]]
13003 !! result
13004 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13005 !! end
13006
13007
13008 !! test
13009 Stripping -{}- tags (language variants)
13010 !! options
13011 language=sr
13012 !! input
13013 Latin proverb: -{Ne nuntium necare}-
13014 !! result
13015 <p>Latin proverb: Ne nuntium necare
13016 </p>
13017 !! end
13018
13019
13020 !! test
13021 Prevent conversion with -{}- tags (language variants)
13022 !! options
13023 language=sr variant=sr-ec
13024 !! input
13025 Latinski: -{Ne nuntium necare}-
13026 !! result
13027 <p>Латински: Ne nuntium necare
13028 </p>
13029 !! end
13030
13031
13032 !! test
13033 Prevent conversion of text with -{}- tags (language variants)
13034 !! options
13035 language=sr variant=sr-ec
13036 !! input
13037 Latinski: -{Ne nuntium necare}-
13038 !! result
13039 <p>Латински: Ne nuntium necare
13040 </p>
13041 !! end
13042
13043
13044 !! test
13045 Prevent conversion of links with -{}- tags (language variants)
13046 !! options
13047 language=sr variant=sr-ec
13048 !! input
13049 -{[[Main Page]]}-
13050 !! result
13051 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13052 </p>
13053 !! end
13054
13055
13056 !! test
13057 -{}- tags within headlines (within html for parserConvert())
13058 !! options
13059 language=sr variant=sr-ec
13060 !! input
13061 == -{Naslov}- ==
13062 !! result
13063 <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>
13064
13065 !! end
13066
13067
13068 !! test
13069 Explicit definition of language variant alternatives
13070 !! options
13071 language=zh variant=zh-tw
13072 !! input
13073 -{zh:China;zh-tw:Taiwan}-, not China
13074 !! result
13075 <p>Taiwan, not China
13076 </p>
13077 !! end
13078
13079
13080 !! test
13081 Conversion around HTML tags
13082 !! options
13083 language=sr variant=sr-ec
13084 !! input
13085 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13086 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13087 !! result
13088 <p>
13089 <span title="ЛаCтин">ски</span>
13090 </p>
13091 !! end
13092
13093
13094 !! test
13095 Explicit session-wise language variant mapping (A flag and - flag)
13096 !! options
13097 language=zh variant=zh-tw
13098 !! input
13099 Taiwan is not China.
13100 But -{A|zh:China;zh-tw:Taiwan}- is China,
13101 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13102 and -{China}- is China.
13103 !! result
13104 <p>Taiwan is not China.
13105 But Taiwan is Taiwan,
13106 (This should be stripped!)
13107 and China is China.
13108 </p>
13109 !! end
13110
13111 !! test
13112 Explicit session-wise language variant mapping (H flag for hide)
13113 !! options
13114 language=zh variant=zh-tw
13115 !! input
13116 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13117 Taiwan is China.
13118 !! result
13119 <p>(This should be stripped!)
13120 Taiwan is Taiwan.
13121 </p>
13122 !! end
13123
13124 !! test
13125 Adding explicit conversion rule for title (T flag)
13126 !! options
13127 language=zh variant=zh-tw showtitle
13128 !! input
13129 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13130 !! result
13131 Taiwan
13132 <p>Should be stripped!
13133 </p>
13134 !! end
13135
13136 !! test
13137 Testing that changing the language variant here in the tests actually works
13138 !! options
13139 language=zh variant=zh showtitle
13140 !! input
13141 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13142 !! result
13143 China
13144 <p>Should be stripped!
13145 </p>
13146 !! end
13147
13148 !! test
13149 Recursive conversion of alt and title attrs shouldn't clear converter state
13150 !! options
13151 language=zh variant=zh-cn showtitle
13152 !! input
13153 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13154 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13155 !! result
13156 China
13157 <p>
13158 Should be stripped<span title="Exclamation">!</span>
13159 </p>
13160 !! end
13161
13162 !! test
13163 Bug 24072: more test on conversion rule for title
13164 !! options
13165 language=zh variant=zh-tw showtitle
13166 !! input
13167 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13168 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13169 !! result
13170 Taiwan
13171 <p>This should be stripped!
13172 This won't take interferes with the title rule.
13173 </p>
13174 !! end
13175
13176 !! test
13177 Partly disable title conversion if variant == main language code
13178 !! options
13179 language=zh variant=zh title=[[ZH]] showtitle
13180 !! input
13181 -{T|zh-cn:CN;zh-tw:TW}-
13182 !! result
13183 ZH
13184 <p>
13185 </p>
13186 !! end
13187
13188 !! test
13189 Partly disable title conversion if variant == main language code, more
13190 !! options
13191 language=zh variant=zh title=[[ZH]] showtitle
13192 !! input
13193 -{T|TW}-
13194 !! result
13195 ZH
13196 <p>
13197 </p>
13198 !! end
13199
13200 !! test
13201 Raw output of variant escape tags (R flag)
13202 !! options
13203 language=zh variant=zh-tw
13204 !! input
13205 Raw: -{R|zh:China;zh-tw:Taiwan}-
13206 !! result
13207 <p>Raw: zh:China;zh-tw:Taiwan
13208 </p>
13209 !! end
13210
13211 !! test
13212 Nested using of manual convert syntax
13213 !! options
13214 language=zh variant=zh-hk
13215 !! input
13216 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13217 !! result
13218 <p>Nested: Hello Hong Kong!
13219 </p>
13220 !! end
13221
13222 !! test
13223 Proper conversion of text in external links
13224 !! options
13225 language=sr variant=sr-ec
13226 !! input
13227 http://www.google.com
13228 gopher://www.google.com
13229 [http://www.google.com http://www.google.com]
13230 [gopher://www.google.com gopher://www.google.com]
13231 [https://www.google.com irc://www.google.com]
13232 [ftp://www.google.com www.google.com/ftp://dir]
13233 [//www.google.com www.google.com]
13234 !! result
13235 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13236 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13237 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13238 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13239 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13240 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13241 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13242 </p>
13243 !! end
13244
13245 !! test
13246 Do not convert roman numbers to language variants
13247 !! options
13248 language=sr variant=sr-ec
13249 !! input
13250 Fridrih IV je car.
13251 !! result
13252 <p>Фридрих IV је цар.
13253 </p>
13254 !! end
13255
13256 !! test
13257 Unclosed language converter markup "-{"
13258 !! options
13259 language=sr
13260 !! input
13261 -{T|hello
13262 !! result
13263 <p>-{T|hello
13264 </p>
13265 !! end
13266
13267 !! test
13268 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13269 !! options
13270 language=sr
13271 !! input
13272 -{R|=&gt;}-
13273 !! result
13274 <p>=&gt;
13275 </p>
13276 !!end
13277
13278 !!article
13279 Template:Bullet
13280 !!text
13281 * Bar
13282 !!endarticle
13283
13284 !! test
13285 Bug 529: Uncovered bullet
13286 !! input
13287 * Foo {{bullet}}
13288 !! result
13289 <ul><li> Foo
13290 </li><li> Bar
13291 </li></ul>
13292
13293 !! end
13294
13295 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13296 # Templates in Wikipedia rely on this behavior, as tidy has always been
13297 # enabled there. These tests are normally run *without* tidy, so specify the
13298 # full output here.
13299 # To test realistic parsing behavior, apply a tidy-like transformation to both
13300 # the expected output and your parser's output.
13301 !! test
13302 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13303 !! input
13304 ******* Foo {{bullet}}
13305 !! result
13306 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13307 </li></ul>
13308 </li></ul>
13309 </li></ul>
13310 </li></ul>
13311 </li></ul>
13312 </li></ul>
13313 </li><li> Bar
13314 </li></ul>
13315
13316 !! end
13317
13318 !! test
13319 Bug 529: Uncovered table already at line-start
13320 !! input
13321 x
13322
13323 {{table}}
13324 y
13325 !! result
13326 <p>x
13327 </p>
13328 <table>
13329 <tr>
13330 <td> 1 </td>
13331 <td> 2
13332 </td></tr>
13333 <tr>
13334 <td> 3 </td>
13335 <td> 4
13336 </td></tr></table>
13337 <p>y
13338 </p>
13339 !! end
13340
13341 !! test
13342 Bug 529: Uncovered bullet in parser function result
13343 !! input
13344 * Foo {{lc:{{bullet}} }}
13345 !! result
13346 <ul><li> Foo
13347 </li><li> bar
13348 </li></ul>
13349
13350 !! end
13351
13352 !! test
13353 Bug 5678: Double-parsed template argument
13354 !! input
13355 {{lc:{{{1}}}|hello}}
13356 !! result
13357 <p>{{{1}}}
13358 </p>
13359 !! end
13360
13361 !! test
13362 Bug 5678: Double-parsed template invocation
13363 !! input
13364 {{lc:{{paramtest {{!}} param = hello }} }}
13365 !! result
13366 <p>{{paramtest | param = hello }}
13367 </p>
13368 !! end
13369
13370 !! test
13371 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13372 !! options
13373 language=cs
13374 title=[[Main Page]]
13375 !! input
13376 {{PRVNÍVELKÉ:ěščř}}
13377 {{prvnívelké:ěščř}}
13378 {{PRVNÍMALÉ:ěščř}}
13379 {{prvnímalé:ěščř}}
13380 {{MALÁ:ěščř}}
13381 {{malá:ěščř}}
13382 {{VELKÁ:ěščř}}
13383 {{velká:ěščř}}
13384 !! result
13385 <p>Ěščř
13386 Ěščř
13387 ěščř
13388 ěščř
13389 ěščř
13390 ěščř
13391 ĚŠČŘ
13392 ĚŠČŘ
13393 </p>
13394 !! end
13395
13396 !! test
13397 Morwen/13: Unclosed link followed by heading
13398 !! input
13399 [[link
13400 ==heading==
13401 !! result
13402 <p>[[link
13403 </p>
13404 <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>
13405
13406 !! end
13407
13408 !! test
13409 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13410 !! input
13411 {{foo|
13412 =heading=
13413 !! result
13414 <p>{{foo|
13415 </p>
13416 <h1><span class="mw-headline" id="heading">heading</span></h1>
13417
13418 !! end
13419
13420 !! test
13421 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13422 !! input
13423 {{foo|
13424 ==heading==
13425 !! result
13426 <p>{{foo|
13427 </p>
13428 <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>
13429
13430 !! end
13431
13432 !! test
13433 Tildes in comments
13434 !! options
13435 pst
13436 !! input
13437 <!-- ~~~~ -->
13438 !! result
13439 <!-- ~~~~ -->
13440 !! end
13441
13442 !! test
13443 Paragraphs inside divs (no extra line breaks)
13444 !! input
13445 <div>Line one
13446
13447 Line two</div>
13448 !! result
13449 <div>Line one
13450 Line two</div>
13451
13452 !! end
13453
13454 !! test
13455 Paragraphs inside divs (extra line break on open)
13456 !! input
13457 <div>
13458 Line one
13459
13460 Line two</div>
13461 !! result
13462 <div>
13463 <p>Line one
13464 </p>
13465 Line two</div>
13466
13467 !! end
13468
13469 !! test
13470 Paragraphs inside divs (extra line break on close)
13471 !! input
13472 <div>Line one
13473
13474 Line two
13475 </div>
13476 !! result
13477 <div>Line one
13478 <p>Line two
13479 </p>
13480 </div>
13481
13482 !! end
13483
13484 !! test
13485 Paragraphs inside divs (extra line break on open and close)
13486 !! input
13487 <div>
13488 Line one
13489
13490 Line two
13491 </div>
13492 !! result
13493 <div>
13494 <p>Line one
13495 </p><p>Line two
13496 </p>
13497 </div>
13498
13499 !! end
13500
13501 !! test
13502 Nesting tags, paragraphs on lines which begin with <div>
13503 !! options
13504 disabled
13505 !! input
13506 <div></div><strong>A
13507 B</strong>
13508 !! result
13509 <div></div>
13510 <p><strong>A
13511 B</strong>
13512 </p>
13513 !! end
13514
13515 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13516 !! test
13517 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13518 !! options
13519 disabled
13520 !! input
13521 <blockquote>Line one
13522
13523 Line two</blockquote>
13524 !! result
13525 <blockquote>Line one
13526 Line two</blockquote>
13527
13528 !! end
13529
13530 !! test
13531 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13532 !! options
13533 disabled
13534 !! input
13535 <blockquote>
13536 Line one
13537
13538 Line two</blockquote>
13539 !! result
13540 <blockquote>
13541 <p>Line one
13542 </p>
13543 Line two</blockquote>
13544
13545 !! end
13546
13547 !! test
13548 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13549 !! options
13550 disabled
13551 !! input
13552 <blockquote>Line one
13553
13554 Line two
13555 </blockquote>
13556 !! result
13557 <blockquote>Line one
13558 <p>Line two
13559 </p>
13560 </blockquote>
13561
13562 !! end
13563
13564 !! test
13565 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13566 !! options
13567 disabled
13568 !! input
13569 <blockquote>
13570 Line one
13571
13572 Line two
13573 </blockquote>
13574 !! result
13575 <blockquote>
13576 <p>Line one
13577 </p><p>Line two
13578 </p>
13579 </blockquote>
13580
13581 !! end
13582
13583 !! test
13584 Paragraphs inside blockquotes/divs (no extra line breaks)
13585 !! input
13586 <blockquote><div>Line one
13587
13588 Line two</div></blockquote>
13589 !! result
13590 <blockquote><div>Line one
13591 Line two</div></blockquote>
13592
13593 !! end
13594
13595 !! test
13596 Paragraphs inside blockquotes/divs (extra line break on open)
13597 !! input
13598 <blockquote><div>
13599 Line one
13600
13601 Line two</div></blockquote>
13602 !! result
13603 <blockquote><div>
13604 <p>Line one
13605 </p>
13606 Line two</div></blockquote>
13607
13608 !! end
13609
13610 !! test
13611 Paragraphs inside blockquotes/divs (extra line break on close)
13612 !! input
13613 <blockquote><div>Line one
13614
13615 Line two
13616 </div></blockquote>
13617 !! result
13618 <blockquote><div>Line one
13619 <p>Line two
13620 </p>
13621 </div></blockquote>
13622
13623 !! end
13624
13625 !! test
13626 Paragraphs inside blockquotes/divs (extra line break on open and close)
13627 !! input
13628 <blockquote><div>
13629 Line one
13630
13631 Line two
13632 </div></blockquote>
13633 !! result
13634 <blockquote><div>
13635 <p>Line one
13636 </p><p>Line two
13637 </p>
13638 </div></blockquote>
13639
13640 !! end
13641
13642 !! test
13643 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13644 !! options
13645 wgLinkHolderBatchSize=0
13646 !! input
13647 [[meatball:1]]
13648 [[meatball:2]]
13649 [[meatball:3]]
13650 !! result
13651 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13652 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13653 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13654 </p>
13655 !! end
13656
13657 !! test
13658 Free external link invading image caption
13659 !! input
13660 [[Image:Foobar.jpg|thumb|http://x|hello]]
13661 !! result
13662 <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>
13663
13664 !! end
13665
13666 !! test
13667 Bug 15196: localised external link numbers
13668 !! options
13669 language=fa
13670 !! input
13671 [http://en.wikipedia.org/]
13672 !! result
13673 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13674 </p>
13675 !! end
13676
13677 !! test
13678 Multibyte character in padleft
13679 !! input
13680 {{padleft:-Hello|7|Æ}}
13681 !! result
13682 <p>Æ-Hello
13683 </p>
13684 !! end
13685
13686 !! test
13687 Multibyte character in padright
13688 !! input
13689 {{padright:Hello-|7|Æ}}
13690 !! result
13691 <p>Hello-Æ
13692 </p>
13693 !! end
13694
13695 !!test
13696 formatdate parser function
13697 !!input
13698 {{#formatdate:2009-03-24}}
13699 !! result
13700 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13701 </p>
13702 !! end
13703
13704 !!test
13705 formatdate parser function, with default format
13706 !!input
13707 {{#formatdate:2009-03-24|mdy}}
13708 !! result
13709 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13710 </p>
13711 !! end
13712
13713 !! test
13714 Spacing of numbers in formatted dates
13715 !! input
13716 {{#formatdate:January 15}}
13717 !! result
13718 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13719 </p>
13720 !! end
13721
13722 !! test
13723 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
13724 !! options
13725 language=nl title=[[MediaWiki:Common.css]]
13726 !! input
13727 {{#formatdate:2009-03-24|dmy}}
13728 !! result
13729 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13730 </p>
13731 !! end
13732
13733 #
13734 #
13735 #
13736
13737 #
13738 # Edit comments
13739 #
13740
13741 !! test
13742 Edit comment with link
13743 !! options
13744 comment
13745 !! input
13746 I like the [[Main Page]] a lot
13747 !! result
13748 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13749 !!end
13750
13751 !! test
13752 Edit comment with link and link text
13753 !! options
13754 comment
13755 !! input
13756 I like the [[Main Page|best pages]] a lot
13757 !! result
13758 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13759 !!end
13760
13761 !! test
13762 Edit comment with link and link text with suffix
13763 !! options
13764 comment
13765 !! input
13766 I like the [[Main Page|best page]]s a lot
13767 !! result
13768 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13769 !!end
13770
13771 !! test
13772 Edit comment with section link (non-local, eg in history list)
13773 !! options
13774 comment title=[[Main Page]]
13775 !! input
13776 /* External links */ removed bogus entries
13777 !! result
13778 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13779 !!end
13780
13781 !! test
13782 Edit comment with section link and text before it (non-local, eg in history list)
13783 !! options
13784 comment title=[[Main Page]]
13785 !! input
13786 pre-comment text /* External links */ removed bogus entries
13787 !! result
13788 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>
13789 !!end
13790
13791 !! test
13792 Edit comment with section link (local, eg in diff view)
13793 !! options
13794 comment local title=[[Main Page]]
13795 !! input
13796 /* External links */ removed bogus entries
13797 !! result
13798 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13799 !!end
13800
13801 !! test
13802 Edit comment with subpage link (bug 14080)
13803 !! options
13804 comment
13805 subpage
13806 title=[[Subpage test]]
13807 !! input
13808 Poked at a [[/subpage]] here...
13809 !! result
13810 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13811 !!end
13812
13813 !! test
13814 Edit comment with subpage link and link text (bug 14080)
13815 !! options
13816 comment
13817 subpage
13818 title=[[Subpage test]]
13819 !! input
13820 Poked at a [[/subpage|neat little page]] here...
13821 !! result
13822 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13823 !!end
13824
13825 !! test
13826 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13827 !! options
13828 comment
13829 title=[[Subpage test]]
13830 !! input
13831 Poked at a [[/subpage]] here...
13832 !! result
13833 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...
13834 !!end
13835
13836 !! test
13837 Edit comment with bare anchor link (local, as on diff)
13838 !! options
13839 comment
13840 local
13841 title=[[Main Page]]
13842 !!input
13843 [[#section]]
13844 !! result
13845 <a href="#section">#section</a>
13846 !! end
13847
13848 !! test
13849 Edit comment with bare anchor link (non-local, as on history)
13850 !! options
13851 comment
13852 title=[[Main Page]]
13853 !!input
13854 [[#section]]
13855 !! result
13856 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13857 !! end
13858
13859 !! test
13860 Anchor starting with underscore
13861 !!input
13862 [[#_ref|One]]
13863 !! result
13864 <p><a href="#_ref">One</a>
13865 </p>
13866 !! end
13867
13868 !! test
13869 Id starting with underscore
13870 !!input
13871 <div id="_ref"></div>
13872 !! result
13873 <div id="_ref"></div>
13874
13875 !! end
13876
13877 !! test
13878 Space normalisation on autocomment (bug 22784)
13879 !! options
13880 comment
13881 title=[[Main Page]]
13882 !!input
13883 /* __hello__world__ */
13884 !! result
13885 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13886 !! end
13887
13888 !! test
13889 percent-encoding and + signs in comments (Bug 26410)
13890 !! options
13891 comment
13892 !!input
13893 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13894 !! result
13895 <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>
13896 !! end
13897
13898 !! test
13899 Bad images - basic functionality
13900 !! options
13901 disabled
13902 !! input
13903 [[File:Bad.jpg]]
13904 !! result
13905 !! end
13906
13907 !! test
13908 Bad images - bug 16039: text after bad image disappears
13909 !! options
13910 disabled
13911 !! input
13912 Foo bar
13913 [[File:Bad.jpg]]
13914 Bar foo
13915 !! result
13916 <p>Foo bar
13917 </p><p>Bar foo
13918 </p>
13919 !! end
13920
13921 !! test
13922 Verify that displaytitle works (bug #22501) no displaytitle
13923 !! options
13924 showtitle
13925 !! config
13926 wgAllowDisplayTitle=true
13927 wgRestrictDisplayTitle=false
13928 !! input
13929 this is not the the title
13930 !! result
13931 Parser test
13932 <p>this is not the the title
13933 </p>
13934 !! end
13935
13936 !! test
13937 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13938 !! options
13939 showtitle
13940 title=[[Screen]]
13941 !! config
13942 wgAllowDisplayTitle=true
13943 wgRestrictDisplayTitle=false
13944 !! input
13945 this is not the the title
13946 {{DISPLAYTITLE:whatever}}
13947 !! result
13948 whatever
13949 <p>this is not the the title
13950 </p>
13951 !! end
13952
13953 !! test
13954 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13955 !! options
13956 showtitle
13957 title=[[Screen]]
13958 !! config
13959 wgAllowDisplayTitle=true
13960 wgRestrictDisplayTitle=true
13961 !! input
13962 this is not the the title
13963 {{DISPLAYTITLE:whatever}}
13964 !! result
13965 Screen
13966 <p>this is not the the title
13967 </p>
13968 !! end
13969
13970 !! test
13971 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13972 !! options
13973 showtitle
13974 title=[[Screen]]
13975 !! config
13976 wgAllowDisplayTitle=true
13977 wgRestrictDisplayTitle=true
13978 !! input
13979 this is not the the title
13980 {{DISPLAYTITLE:screen}}
13981 !! result
13982 screen
13983 <p>this is not the the title
13984 </p>
13985 !! end
13986
13987 !! test
13988 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13989 !! options
13990 showtitle
13991 title=[[Screen]]
13992 !! config
13993 wgAllowDisplayTitle=false
13994 !! input
13995 this is not the the title
13996 {{DISPLAYTITLE:screen}}
13997 !! result
13998 Screen
13999 <p>this is not the the title
14000 <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>
14001 </p>
14002 !! end
14003
14004 !! test
14005 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14006 !! options
14007 showtitle
14008 title=[[Screen]]
14009 !! config
14010 wgAllowDisplayTitle=false
14011 !! input
14012 this is not the the title
14013 !! result
14014 Screen
14015 <p>this is not the the title
14016 </p>
14017 !! end
14018
14019 !! test
14020 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14021 !! options
14022 showtitle
14023 title=[[Screen]]
14024 !! config
14025 wgAllowDisplayTitle=true
14026 wgRestrictDisplayTitle=true
14027 !! input
14028 this is not the the title
14029 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14030 !! result
14031 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14032 <p>this is not the the title
14033 </p>
14034 !! end
14035
14036 !! test
14037 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14038 !! options
14039 showtitle
14040 title=[[Screen]]
14041 !! config
14042 wgAllowDisplayTitle=true
14043 wgRestrictDisplayTitle=true
14044 !! input
14045 this is not the the title
14046 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14047 !! result
14048 <span style="color: red;">s</span>creen
14049 <p>this is not the the title
14050 </p>
14051 !! end
14052
14053 !! test
14054 preload: check <noinclude> and <includeonly>
14055 !! options
14056 preload
14057 !! input
14058 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14059 !! result
14060 Hello kind world.
14061 !! end
14062
14063 !! test
14064 preload: check <onlyinclude>
14065 !! options
14066 preload
14067 !! input
14068 Goodbye <onlyinclude>Hello world</onlyinclude>
14069 !! result
14070 Hello world
14071 !! end
14072
14073 !! test
14074 preload: can pass tags through if we want to
14075 !! options
14076 preload
14077 !! input
14078 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14079 !! result
14080 <includeonly>Hello world</includeonly>
14081 !! end
14082
14083 !! test
14084 preload: check that it doesn't try to do tricks
14085 !! options
14086 preload
14087 !! input
14088 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14089 !! result
14090 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14091 !! end
14092
14093 !! test
14094 Play a bit with r67090 and bug 3158
14095 !! options
14096 disabled
14097 !! input
14098 <div style="width:50% !important">&nbsp;</div>
14099 <div style="width:50%&nbsp;!important">&nbsp;</div>
14100 <div style="width:50%&#160;!important">&nbsp;</div>
14101 <div style="border : solid;">&nbsp;</div>
14102 !! result
14103 <div style="width:50% !important">&nbsp;</div>
14104 <div style="width:50% !important">&nbsp;</div>
14105 <div style="width:50% !important">&nbsp;</div>
14106 <div style="border&#160;: solid;">&nbsp;</div>
14107
14108 !! end
14109
14110 !! test
14111 HTML5 data attributes
14112 !! input
14113 <span data-foo="bar">Baz</span>
14114 <p data-abc-def_hij="">Quuz</p>
14115 !! result
14116 <p><span data-foo="bar">Baz</span>
14117 </p>
14118 <p data-abc-def_hij="">Quuz</p>
14119
14120 !! end
14121
14122 !! test
14123 percent-encoding and + signs in internal links (Bug 26410)
14124 !! input
14125 [[User:+%]] [[Page+title%]]
14126 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14127 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14128 [[%33%45]] [[%33%45+]]
14129 !! result
14130 <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>
14131 <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>
14132 <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>
14133 <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>
14134 </p>
14135 !! end
14136
14137 !! test
14138 Special characters in embedded file links (bug 27679)
14139 !! input
14140 [[File:Contains & ampersand.jpg]]
14141 [[File:Does not exist.jpg|Title with & ampersand]]
14142 !! result
14143 <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>
14144 <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>
14145 </p>
14146 !! end
14147
14148
14149 !! test
14150 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14151 !! input
14152 Text&apos;s been normalized?
14153 !! result
14154 <p>Text&#39;s been normalized?
14155 </p>
14156 !! end
14157
14158 !! test
14159 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14160 !! input
14161 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14162 !! result
14163 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14164 </p>
14165 !! end
14166
14167 !! test
14168 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14169 !! input
14170 [http://www.example.org/ ideograms]
14171 !! result
14172 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14173 </p>
14174 !! end
14175
14176 !! test
14177 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14178 !! input
14179 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14180 !! result
14181 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14182 </p>
14183 !! end
14184
14185 !! article
14186 Mediawiki:loop1
14187 !! text
14188 {{Identical|A}}
14189 !! endarticle
14190
14191 !! article
14192 Mediawiki:loop2
14193 !! text
14194 {{Identical|B}}
14195 !! endarticle
14196
14197 !! article
14198 Template:Identical
14199 !! text
14200 {{int:loop1}}
14201 {{int:loop2}}
14202 !! endarticle
14203
14204 !! test
14205 Bug 31098 Template which includes system messages which includes the template
14206 !! input
14207 {{Identical}}
14208 !! result
14209 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14210 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14211 </p>
14212 !! end
14213
14214 !! test
14215 Bug31490 Turkish: ucfirst 'blah'
14216 !! options
14217 language=tr
14218 !! input
14219 {{ucfirst:blah}}
14220 !! result
14221 <p>Blah
14222 </p>
14223 !! end
14224
14225 !! test
14226 Bug31490 Turkish: ucfirst 'ix'
14227 !! options
14228 language=tr
14229 !! input
14230 {{ucfirst:ix}}
14231 !! result
14232 <p>İx
14233 </p>
14234 !! end
14235
14236 !! test
14237 Bug31490 Turkish: lcfirst 'BLAH'
14238 !! options
14239 language=tr
14240 !! input
14241 {{lcfirst:BLAH}}
14242 !! result
14243 <p>bLAH
14244 </p>
14245 !! end
14246
14247 !! test
14248 Bug31490 Turkish: ucfırst (with a dotless i)
14249 !! options
14250 language=tr
14251 !! input
14252 {{ucfırst:blah}}
14253 !! result
14254 <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>
14255 </p>
14256 !! end
14257
14258 !! test
14259 Bug31490 ucfırst (with a dotless i) with English language
14260 !! options
14261 language=en
14262 !! input
14263 {{ucfırst:blah}}
14264 !! result
14265 <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>
14266 </p>
14267 !! end
14268
14269 !! test
14270 Bug 26375: TOC with italics
14271 !! options
14272 title=[[Main Page]]
14273 !! input
14274 __TOC__
14275 == ''Lost'' episodes ==
14276 !! result
14277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14278 <ul>
14279 <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>
14280 </ul>
14281 </div>
14282 <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>
14283
14284 !! end
14285
14286 !! test
14287 Bug 26375: TOC with bold
14288 !! options
14289 title=[[Main Page]]
14290 !! input
14291 __TOC__
14292 == '''should be bold''' then normal text ==
14293 !! result
14294 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14295 <ul>
14296 <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>
14297 </ul>
14298 </div>
14299 <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>
14300
14301 !! end
14302
14303 !! test
14304 Bug 33845: Headings become cursive in TOC when they contain an image
14305 !! options
14306 title=[[Main Page]]
14307 !! input
14308 __TOC__
14309 == Image [[Image:foobar.jpg]] ==
14310 !! result
14311 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14312 <ul>
14313 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14314 </ul>
14315 </div>
14316 <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>
14317
14318 !! end
14319
14320 !! test
14321 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14322 !! options
14323 title=[[Main Page]]
14324 !! input
14325 __TOC__
14326 == <blockquote>Quote</blockquote> ==
14327 !! result
14328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14329 <ul>
14330 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14331 </ul>
14332 </div>
14333 <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>
14334
14335 !! end
14336
14337 !! test
14338 Unclosed tags in TOC
14339 !! options
14340 title=[[Main Page]]
14341 !! input
14342 __TOC__
14343 == Proof: 2 < 3 ==
14344 <small>Hanc marginis exiguitas non caperet.</small>
14345 QED
14346 !! result
14347 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14348 <ul>
14349 <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>
14350 </ul>
14351 </div>
14352 <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>
14353 <p><small>Hanc marginis exiguitas non caperet.</small>
14354 QED
14355 </p>
14356 !! end
14357
14358 !! test
14359 Multiple tags in TOC
14360 !! input
14361 __TOC__
14362 == <i>Foo</i> <b>Bar</b> ==
14363
14364 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14365 !! result
14366 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14367 <ul>
14368 <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>
14369 <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>
14370 </ul>
14371 </div>
14372 <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>
14373 <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>
14374
14375 !! end
14376
14377 !! test
14378 Tags with parameters in TOC
14379 !! input
14380 __TOC__
14381 == <sup class="in-h2">Hello</sup> ==
14382
14383 == <sup class="a > b">Evilbye</sup> ==
14384 !! result
14385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14386 <ul>
14387 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14388 <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>
14389 </ul>
14390 </div>
14391 <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>
14392 <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>
14393
14394 !! end
14395
14396 !! test
14397 span tags with directionality in TOC
14398 !! input
14399 __TOC__
14400 == <span dir="ltr">C++</span> ==
14401
14402 == <span dir="rtl">זבנג!</span> ==
14403
14404 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14405
14406 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14407
14408 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14409 !! result
14410 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14411 <ul>
14412 <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>
14413 <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>
14414 <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>
14415 <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>
14416 <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>
14417 </ul>
14418 </div>
14419 <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>
14420 <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>
14421 <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>
14422 <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>
14423 <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>
14424
14425 !! end
14426
14427 !! article
14428 MediaWiki:Bug32057
14429 !! text
14430 == {{int:headline_sample}} ==
14431 !! endarticle
14432
14433 !! test
14434 Bug 32057: Title needed when expanding <h> nodes.
14435 !! options
14436 title=[[Main Page]]
14437 !! input
14438 {{int:Bug32057}}
14439 !! result
14440 <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>
14441
14442 !! end
14443
14444 !! test
14445 Strip marker in urlencode
14446 !! input
14447 {{urlencode:x<nowiki/>y}}
14448 {{urlencode:x<nowiki/>y|wiki}}
14449 {{urlencode:x<nowiki/>y|path}}
14450 !! result
14451 <p>xy
14452 xy
14453 xy
14454 </p>
14455 !! end
14456
14457 !! test
14458 Strip marker in lc
14459 !! input
14460 {{lc:x<nowiki/>y}}
14461 !! result
14462 <p>xy
14463 </p>
14464 !! end
14465
14466 !! test
14467 Strip marker in uc
14468 !! input
14469 {{uc:x<nowiki/>y}}
14470 !! result
14471 <p>XY
14472 </p>
14473 !! end
14474
14475 !! test
14476 Strip marker in formatNum
14477 !! input
14478 {{formatnum:1<nowiki/>2}}
14479 {{formatnum:1<nowiki/>2|R}}
14480 !! result
14481 <p>12
14482 12
14483 </p>
14484 !! end
14485
14486 !! test
14487 Check noCommafy in formatNum
14488 !! options
14489 language=be-tarask
14490 !! input
14491 {{formatnum:123456.78}}
14492 {{formatnum:123456.78|NOSEP}}
14493 !! result
14494 <p>123 456,78
14495 123456.78
14496 </p>
14497 !! end
14498
14499 !! test
14500 Strip marker in grammar
14501 !! options
14502 language=fi
14503 !! input
14504 {{grammar:elative|foo<nowiki/>bar}}
14505 !! result
14506 <p>foobarista
14507 </p>
14508 !! end
14509
14510 !! test
14511 Strip marker in padleft
14512 !! input
14513 {{padleft:|2|x<nowiki/>y}}
14514 !! result
14515 <p>xy
14516 </p>
14517 !! end
14518
14519 !! test
14520 Strip marker in padright
14521 !! input
14522 {{padright:|2|x<nowiki/>y}}
14523 !! result
14524 <p>xy
14525 </p>
14526 !! end
14527
14528 !! test
14529 Strip marker in anchorencode
14530 !! input
14531 {{anchorencode:x<nowiki/>y}}
14532 !! result
14533 <p>xy
14534 </p>
14535 !! end
14536
14537 !! test
14538 nowiki inside link inside heading (bug 18295)
14539 !! input
14540 ==[[foo|x<nowiki>y</nowiki>z]]==
14541 !! result
14542 <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>
14543
14544 !! end
14545
14546 !! test
14547 new support for bdi element (bug 31817)
14548 !! input
14549 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14550 !! result
14551 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14552
14553 !!end
14554
14555 !! test
14556 Ignore pipe between table row attributes
14557 !! input
14558 {|
14559 | quux
14560 |- id=foo | style='color: red'
14561 | bar
14562 |}
14563 !! result
14564 <table>
14565 <tr>
14566 <td> quux
14567 </td></tr>
14568 <tr id="foo" style="color: red">
14569 <td> bar
14570 </td></tr></table>
14571
14572 !! end
14573
14574 !!test
14575 Gallery override link with WikiLink (bug 34852)
14576 !! input
14577 <gallery>
14578 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14579 </gallery>
14580 !! result
14581 <ul class="gallery">
14582 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14583 <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>
14584 <div class="gallerytext">
14585 <p>caption
14586 </p>
14587 </div>
14588 </div></li>
14589 </ul>
14590
14591 !! end
14592
14593 !!test
14594 Gallery override link with absolute external link (bug 34852)
14595 !! input
14596 <gallery>
14597 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14598 </gallery>
14599 !! result
14600 <ul class="gallery">
14601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14602 <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>
14603 <div class="gallerytext">
14604 <p>caption
14605 </p>
14606 </div>
14607 </div></li>
14608 </ul>
14609
14610 !! end
14611
14612 !!test
14613 Gallery override link with malicious javascript (bug 34852)
14614 !! input
14615 <gallery>
14616 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14617 </gallery>
14618 !! result
14619 <ul class="gallery">
14620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14621 <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>
14622 <div class="gallerytext">
14623 <p>caption
14624 </p>
14625 </div>
14626 </div></li>
14627 </ul>
14628
14629 !! end
14630
14631 !!test
14632 Gallery with invalid title as link (bug 43964)
14633 !! input
14634 <gallery>
14635 File:foobar.jpg|link=<
14636 </gallery>
14637 !! result
14638 <ul class="gallery">
14639 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14640 <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>
14641 <div class="gallerytext">
14642 </div>
14643 </div></li>
14644 </ul>
14645
14646 !! end
14647
14648 !!test
14649 Language parser function
14650 !! input
14651 {{#language:ar}}
14652 !! result
14653 <p>العربية
14654 </p>
14655 !! end
14656
14657 !!test
14658 Padleft and padright as substr
14659 !! input
14660 {{padleft:|3|abcde}}
14661 {{padright:|3|abcde}}
14662 !! result
14663 <p>abc
14664 abc
14665 </p>
14666 !! end
14667
14668 !!test
14669 Special parser function
14670 !! input
14671 {{#special:RandomPage}}
14672 {{#special:BaDtItLe}}
14673 {{#special:Foobar}}
14674 !! result
14675 <p>Special:Random
14676 Special:Badtitle
14677 Special:Foobar
14678 </p>
14679 !! end
14680
14681 !!test
14682 Bug 34939 - Case insensitive link parsing ([HttP://])
14683 !! input
14684 [HttP://MediaWiki.Org/]
14685 !! result
14686 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14687 </p>
14688 !! end
14689
14690 !!test
14691 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14692 !! input
14693 [HttP://MediaWiki.Org/ MediaWiki]
14694 !! result
14695 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14696 </p>
14697 !! end
14698
14699 !!test
14700 Bug 34939 - Case insensitive link parsing (HttP://)
14701 !! input
14702 HttP://MediaWiki.Org/
14703 !! result
14704 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14705 </p>
14706 !! end
14707
14708
14709 ###
14710 ### Parsoids-specific tests
14711 ### Parsoid-PHP parser incompatibilities
14712 ###
14713 !!test
14714 1. SOL-sensitive wikitext tokens as template-args
14715 !!options
14716 parsoid=wt2html,wt2wt
14717 !!input
14718 {{echo|*a}}
14719 {{echo|#a}}
14720 {{echo|:a}}
14721 !!result
14722 <span about="#mwt1" typeof="mw:Transclusion">
14723 </span><ul about="#mwt1"><li>a</li></ul>
14724 <span about="#mwt2" typeof="mw:Transclusion">
14725 </span><ol about="#mwt2"><li>a</li></ol>
14726 <span about="#mwt3" typeof="mw:Transclusion">
14727 </span><dl about="#mwt3"><dd>a</dd></dl>
14728 !!end
14729
14730 #### ----------------------------------------------------------------
14731 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14732 #### tags. Parsoid's output for these tags differs from that of the
14733 #### PHP parser.
14734 #### ----------------------------------------------------------------
14735
14736 !!test
14737 Ref: 1. ref-location should be replaced with an index span
14738 !!options
14739 parsoid
14740 !!input
14741 A <ref>foo</ref>
14742 B <ref name="x">foo</ref>
14743 C <ref name="y" />
14744 !!result
14745 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14746 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>
14747 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>
14748 !!end
14749
14750 !!test
14751 Ref: 2. ref-tags with identical names should all get the same index
14752 !!options
14753 parsoid
14754 !!input
14755 A <ref name="x">foo</ref>
14756 B <ref name="x" />
14757 !!result
14758 <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>
14759 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>
14760 !!end
14761
14762 !!test
14763 Ref: 3. spaces in ref-names should be ignored
14764 !!options
14765 parsoid
14766 !!input
14767 A <ref name="x">foo</ref>
14768 B <ref name=" x " />
14769 C <ref name= x />
14770 !!result
14771 <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>
14772 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>
14773 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>
14774 !!end
14775
14776 !!test
14777 Ref: 4. 'constructor' should be accepted as a valid ref-name
14778 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14779 !!options
14780 parsoid
14781 !!input
14782 A <ref name="constructor">foo</ref>
14783 !!result
14784 <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>
14785 !!end
14786
14787 !!test
14788 Ref: 5. body should accept generic wikitext
14789 !!options
14790 parsoid
14791 !!input
14792 A <ref>
14793 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14794 </ref>
14795
14796 <references />
14797 !!result
14798 <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>
14799
14800 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14801 <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>
14802 </li></ol>
14803 !!end
14804
14805 !!test
14806 Ref: 6. indent-pres should not be output in ref-body
14807 !!options
14808 parsoid
14809 !!input
14810 A <ref>
14811 foo
14812 bar
14813 baz
14814 </ref>
14815
14816 <references />
14817 !!result
14818 <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>
14819
14820 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14821 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14822 bar
14823 baz
14824 </li></ol>
14825 !!end
14826
14827 !!test
14828 Ref: 6. No p-wrapping in ref-body
14829 !!options
14830 parsoid
14831 !!input
14832 A <ref>
14833 foo
14834
14835 bar
14836
14837
14838 baz
14839
14840
14841
14842 booz
14843 </ref>
14844
14845 <references />
14846 !!result
14847 <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>
14848
14849 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14850 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14851
14852 bar
14853
14854
14855 baz
14856
14857
14858
14859 booz
14860 </li></ol>
14861 !!end
14862
14863 !!test
14864 Ref: 8. transclusion wikitext has lower precedence
14865 !!options
14866 parsoid
14867 !!input
14868 A <ref> foo {{echo|</ref> B C}}
14869
14870 <references />
14871 !!result
14872 <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>
14873
14874 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14875 <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>
14876 !!end
14877
14878 !!test
14879 Ref: 9. unclosed comments should not leak out of ref-body
14880 !!options
14881 parsoid
14882 !!input
14883 A <ref> foo <!--</ref> B C
14884
14885 <references />
14886 !!result
14887 <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>
14888
14889 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14890 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14891 !!end
14892
14893 !!test
14894 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14895 !!options
14896 parsoid
14897 !!input
14898 A <ref> <b> foo </ref> B C
14899
14900 <references />
14901 !!result
14902 <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>
14903
14904 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14905 <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>
14906 !!end
14907
14908 !!test
14909 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14910 !!options
14911 parsoid
14912 !!input
14913 A <ref>foo</ref> B
14914 C <ref>bar</ref> D
14915 !!result
14916 <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
14917 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>
14918 !!end
14919
14920 !!test
14921 Ref: 12. ref-tags act as trailing newline migration barrier
14922 !!options
14923 parsoid
14924 !!input
14925 <!--the newline at the end of this line moves out of the p-tag-->a
14926
14927 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14928 <ref />
14929
14930 c
14931 !!result
14932 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14933
14934
14935 <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>
14936 <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>
14937
14938
14939 <p>c</p>
14940 !!end
14941
14942 !!test
14943 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14944 !!options
14945 parsoid
14946 !!input
14947 <ref>foo</ref> A
14948 <ref>bar
14949 </ref> B
14950 !!result
14951 <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
14952 <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>
14953 !!end
14954
14955 !!test
14956 Ref: 14. A nested ref-tag should be emitted as plain text
14957 !!options
14958 parsoid
14959 !!input
14960 <ref>foo <ref>bar</ref> baz</ref>
14961
14962 <references />
14963 !!result
14964 <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>
14965
14966 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
14967 <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>
14968 !!end
14969
14970 !!test
14971 Ref: 15. ref-tags with identical names should get identical indexes
14972 !!options
14973 parsoid
14974 !!input
14975 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14976 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14977
14978 <references />
14979 !!result
14980 <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>
14981 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>
14982
14983 <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>
14984 !!end
14985
14986 !!test
14987 References: 1. references tag without any refs should be handled properly
14988 !!options
14989 parsoid
14990 !!input
14991 <references />
14992 !!result
14993 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14994 !!end
14995
14996 !!test
14997 References: 2. references tag with group only outputs references from that group
14998 !!options
14999 parsoid
15000 !!input
15001 A <ref group="a">foo</ref>
15002 B <ref group="b">bar</ref>
15003
15004 <references group='a' />
15005 !!result
15006 <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>
15007 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>
15008
15009 <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>
15010 !!end
15011
15012 !!test
15013 References: 3. ref list should be cleared after processing references
15014 !!options
15015 parsoid
15016 !!input
15017 A <ref>foo</ref>
15018
15019 <references />
15020
15021 B <ref>bar</ref>
15022
15023 <references />
15024 !!result
15025 <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>
15026
15027 <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>
15028
15029 <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>
15030
15031 <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>
15032 !!end
15033
15034 !!test
15035 References: 4. only referenced group should be cleared after processing references
15036 !!options
15037 parsoid
15038 !!input
15039 A <ref group="a">afoo</ref>
15040 B <ref>bfoo</ref>
15041
15042 <references group="a"/>
15043
15044 C <ref>cfoo</ref>
15045
15046 <references />
15047 !!result
15048 <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>
15049 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>
15050
15051 <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>
15052
15053 <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>
15054
15055 <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>
15056 !!end
15057
15058 !!test
15059 References: 5. ref tags in references should be processed while ignoring all other content
15060 !!options
15061 parsoid
15062 !!input
15063 A <ref name="a" />
15064 B <ref name="b">bar</ref>
15065
15066 <references>
15067 <ref name="a">foo</ref>
15068 This should just get lost.
15069 </references>
15070 !!result
15071 <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>
15072 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>
15073
15074 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>"},"attrs":{}}'><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>
15075 !!end
15076
15077 !!test
15078 References: 6. <references /> from a transclusion
15079 !!options
15080 parsoid
15081 !!input
15082 {{echo|<references />}}
15083 !!result
15084 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15085 !!end
15086
15087 !! test
15088 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15089 !! options
15090 parsoid
15091 !! input
15092 A <ref>foo bar for a</ref>
15093 B <ref name="b" />
15094
15095 <references />
15096
15097 <references>
15098 <ref name="b">foo</ref>
15099 </references>
15100 !! result
15101 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
15102 B <span about="#mwt4" 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></p>
15103
15104 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</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> </li></ol>
15105
15106 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
15107
15108 !! end
15109
15110 #### ----------------------------------------------------------------
15111 #### The following section of tests are primarily to test
15112 #### wikitext escaping capabilities of Parsoid. Given that
15113 #### escaping can be done any number of ways, the wikitext (input)
15114 #### is always adjusted to reflect how Parsoid adds nowiki
15115 #### escape tags.
15116 ####
15117 #### We are marking several tests as parsoid-only since the
15118 #### HTML in the result section is different from what the
15119 #### PHP parser generates for it.
15120 #### ----------------------------------------------------------------
15121
15122
15123 #### --------------- Headings ---------------
15124 #### 0. Unnested
15125 #### 1. Nested inside html <h1>=foo=</h1>
15126 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15127 #### 3. Nested inside html with wikitext split by html tags
15128 #### 4. No escape needed
15129 #### 5. Empty headings <h1></h1>
15130 #### 6. Heading chars in SOL context
15131 #### ----------------------------------------
15132 !! test
15133 Headings: 0. Unnested
15134 !! options
15135 parsoid
15136 !! input
15137 <nowiki>=foo=</nowiki>
15138
15139 <nowiki> =foo= </nowiki>
15140 <!--cmt-->
15141 <nowiki>=foo=</nowiki>
15142
15143 =foo''a''<nowiki>=</nowiki>
15144 !! result
15145 <p><span typeof="mw:Nowiki">=foo=</span></p>
15146
15147 <p><span typeof="mw:Nowiki"> =foo= </span>
15148 <!--cmt-->
15149 <span typeof="mw:Nowiki">=foo=</span></p>
15150
15151 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15152 !!end
15153
15154 !! test
15155 Headings: 1. Nested inside html
15156 !! options
15157 parsoid
15158 !! input
15159 =<nowiki>=foo=</nowiki>=
15160
15161 ==<nowiki>=foo=</nowiki>==
15162
15163 ===<nowiki>=foo=</nowiki>===
15164
15165 ====<nowiki>=foo=</nowiki>====
15166
15167 =====<nowiki>=foo=</nowiki>=====
15168
15169 ======<nowiki>=foo=</nowiki>======
15170 !! result
15171 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15172 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15173 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15174 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15175 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15176 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15177 !!end
15178
15179 !! test
15180 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15181 !! options
15182 parsoid
15183 !! input
15184 =foo=
15185 <nowiki>*</nowiki>bar
15186
15187 =foo=
15188 =bar
15189
15190 =foo=
15191 <nowiki>=bar=</nowiki>
15192 !! result
15193 <h1>foo</h1>*bar
15194 <h1>foo</h1>=bar
15195 <h1>foo</h1>=bar=
15196 !!end
15197
15198 !! test
15199 Headings: 3. Nested inside html with wikitext split by html tags
15200 !! options
15201 parsoid
15202 !! input
15203 =='''bold'''<nowiki>foo=</nowiki>=
15204 !! result
15205 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15206 !!end
15207
15208 !! test
15209 Headings: 4a. No escaping needed (testing just h1 and h2)
15210 !! options
15211 parsoid
15212 !! input
15213 ==foo=
15214
15215 =foo==
15216
15217 = =foo= =
15218
15219 ==foo= bar=
15220
15221 ===foo==
15222
15223 ==foo===
15224
15225 =''=''foo==
15226
15227 =<nowiki>=</nowiki>=
15228 !! result
15229 <h1>=foo</h1>
15230 <h1>foo=</h1>
15231 <h1> =foo= </h1>
15232 <h1>=foo= bar</h1>
15233 <h2>=foo</h2>
15234 <h2>foo=</h2>
15235 <h1><i>=</i>foo=</h1>
15236 <h1><span typeof="mw:Nowiki">=</span></h1>
15237 !!end
15238
15239 !! test
15240 Headings: 4b. No escaping needed (inside p-tags)
15241 !! options
15242 parsoid
15243 !! input
15244 ===
15245 =foo= x
15246 =foo= <s></s>
15247 !! result
15248 <p>===
15249 =foo= x
15250 =foo= <s></s>
15251 </p>
15252 !!end
15253
15254 !! test
15255 Headings: 5. Empty headings
15256 !! options
15257 parsoid
15258 !! input
15259 =<nowiki/>=
15260
15261 ==<nowiki/>==
15262
15263 ===<nowiki/>===
15264
15265 ====<nowiki/>====
15266
15267 =====<nowiki/>=====
15268
15269 ======<nowiki/>======
15270 !! result
15271 <h1></h1>
15272 <h2></h2>
15273 <h3></h3>
15274 <h4></h4>
15275 <h5></h5>
15276 <h6></h6>
15277 !!end
15278
15279 !! test
15280 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15281 !! options
15282 parsoid
15283 !! input
15284 <nowiki>=a=</nowiki>
15285
15286 <nowiki>=a=</nowiki>
15287
15288 <nowiki>=a=</nowiki>
15289
15290 <nowiki>=a=</nowiki>
15291 !! result
15292 <p>=a=</p>
15293 <p>=a= </p>
15294 <p>=a= </p>
15295 <p>=a= </p>
15296 !!end
15297
15298 !! test
15299 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15300 !! options
15301 parsoid
15302 !! input
15303 <nowiki>=a=
15304 b</nowiki>
15305
15306 <nowiki>=a=
15307 b</nowiki>
15308
15309 <nowiki>=a=
15310 b</nowiki>
15311
15312 <nowiki>=a=
15313 b</nowiki>
15314 !! result
15315 <p>=a=
15316 b</p>
15317 <p>=a=
15318 b</p>
15319 <p>=a=
15320 b</p>
15321 <p>=a=
15322 b</p>
15323 </p>
15324 !!end
15325
15326 !! test
15327 Headings: 6c. Heading chars in SOL context (leading newline break)
15328 !! options
15329 parsoid
15330 !! input
15331 a
15332 <nowiki>=b=</nowiki>
15333 !! result
15334 <p>a
15335 =b=</p>
15336 !!end
15337
15338 !! test
15339 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15340 !! options
15341 parsoid
15342 !! input
15343 <!--c0--><nowiki>=a=</nowiki>
15344 <!--c1-->
15345 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15346 !! result
15347 <p><!--c0-->=a=</p>
15348 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15349 !!end
15350
15351 !! test
15352 Headings: 6d. Heading chars in SOL context (No escaping needed)
15353 !! options
15354 parsoid=html2wt
15355 !! input
15356 =a=<div>b</div>
15357 !! result
15358 =a=<div>b</div>
15359 !!end
15360
15361 #### --------------- Lists ---------------
15362 #### 0. Outside nests (*foo, etc.)
15363 #### 1. Nested inside html <ul><li>*foo</li></ul>
15364 #### 2. Inside definition lists
15365 #### 3. Only bullets at start should be escaped
15366 #### 4. No escapes needed
15367 #### 5. No unnecessary escapes
15368 #### 6. Escape bullets in SOL position
15369 #### 7. Escape bullets in a multi-line context
15370 #### ----------------------------------------
15371
15372 !! test
15373 Lists: 0. Outside nests
15374 !! input
15375 <nowiki>*</nowiki>foo
15376
15377 <nowiki>#</nowiki>foo
15378 !! result
15379 <p>*foo
15380 </p><p>#foo
15381 </p>
15382 !!end
15383
15384 !! test
15385 Lists: 1. Nested inside html
15386 !! input
15387 *<nowiki>*foo</nowiki>
15388
15389 *<nowiki>#foo</nowiki>
15390
15391 *<nowiki>:foo</nowiki>
15392
15393 *<nowiki>;foo</nowiki>
15394
15395 #<nowiki>*foo</nowiki>
15396
15397 #<nowiki>#foo</nowiki>
15398
15399 #<nowiki>:foo</nowiki>
15400
15401 #<nowiki>;foo</nowiki>
15402 !! result
15403 <ul><li>*foo
15404 </li></ul>
15405 <ul><li>#foo
15406 </li></ul>
15407 <ul><li>:foo
15408 </li></ul>
15409 <ul><li>;foo
15410 </li></ul>
15411 <ol><li>*foo
15412 </li></ol>
15413 <ol><li>#foo
15414 </li></ol>
15415 <ol><li>:foo
15416 </li></ol>
15417 <ol><li>;foo
15418 </li></ol>
15419
15420 !!end
15421
15422 !! test
15423 Lists: 2. Inside definition lists
15424 !! input
15425 ;<nowiki>;foo</nowiki>
15426
15427 ;<nowiki>:foo</nowiki>
15428
15429 ;<nowiki>:foo</nowiki>
15430 :bar
15431
15432 :<nowiki>:foo</nowiki>
15433 !! result
15434 <dl><dt>;foo
15435 </dt></dl>
15436 <dl><dt>:foo
15437 </dt></dl>
15438 <dl><dt>:foo
15439 </dt><dd>bar
15440 </dd></dl>
15441 <dl><dd>:foo
15442 </dd></dl>
15443
15444 !!end
15445
15446 !! test
15447 Lists: 3. Only bullets at start of text should be escaped
15448 !! input
15449 *<nowiki>*foo*bar</nowiki>
15450
15451 *<nowiki>*foo</nowiki>''it''*bar
15452 !! result
15453 <ul><li>*foo*bar
15454 </li></ul>
15455 <ul><li>*foo<i>it</i>*bar
15456 </li></ul>
15457
15458 !!end
15459
15460 !! test
15461 Lists: 4. No escapes needed
15462 !! options
15463 parsoid
15464 !! input
15465 *foo*bar
15466
15467 *''foo''*bar
15468
15469 *[[Foo]]: bar
15470 !! result
15471 <ul><li>foo*bar
15472 </li></ul>
15473 <ul><li><i>foo</i>*bar
15474 </li></ul>
15475 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15476 </li></ul>
15477 !!end
15478
15479 !! test
15480 Lists: 5. No unnecessary escapes
15481 !! input
15482 * bar <span><nowiki>[[foo]]</nowiki></span>
15483
15484 *=bar <span><nowiki>[[foo]]</nowiki></span>
15485
15486 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15487
15488 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15489
15490 *=bar <span>foo]]</span>=
15491
15492 * <s></s>: a
15493 !! result
15494 <ul><li> bar <span>[[foo]]</span>
15495 </li></ul>
15496 <ul><li>=bar <span>[[foo]]</span>
15497 </li></ul>
15498 <ul><li>[[bar <span>[[foo]]</span>
15499 </li></ul>
15500 <ul><li>]]bar <span>[[foo]]</span>
15501 </li></ul>
15502 <ul><li>=bar <span>foo]]</span>=
15503 </li></ul>
15504 <ul><li> <s></s>: a
15505 </li></ul>
15506
15507 !!end
15508
15509 !! test
15510 Lists: 6. Escape bullets in SOL position
15511 !! options
15512 parsoid
15513 !! input
15514 <!--cmt--><nowiki>*foo</nowiki>
15515 !! result
15516 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15517 !!end
15518
15519 !! test
15520 Lists: 7. Escape bullets in a multi-line context
15521 !! input
15522 a
15523 <nowiki>*</nowiki>b
15524 !! result
15525 <p>a
15526 *b
15527 </p>
15528 !!end
15529
15530 #### --------------- HRs ---------------
15531 #### 1. Single line
15532 #### -----------------------------------
15533
15534 !! test
15535 HRs: 1. Single line
15536 !! options
15537 parsoid
15538 !! input
15539 ----<nowiki>----</nowiki>
15540 ----=foo=
15541 ----*foo
15542 !! result
15543 <hr><span typeof="mw:Nowiki">----</span>
15544 <hr>=foo=
15545 <hr>*foo
15546 !! end
15547
15548 #### --------------- Tables ---------------
15549 #### 1a. Simple example
15550 #### 1b. No escaping needed (!foo)
15551 #### 1c. No escaping needed (|foo)
15552 #### 1d. No escaping needed (|}foo)
15553 ####
15554 #### 2a. Nested in td (<td>foo|bar</td>)
15555 #### 2b. Nested in td (<td>foo||bar</td>)
15556 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15557 ####
15558 #### 3a. Nested in th (<th>foo!bar</th>)
15559 #### 3b. Nested in th (<th>foo!!bar</th>)
15560 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15561 ####
15562 #### 4a. Escape -
15563 #### 4b. Escape +
15564 #### 4c. No escaping needed
15565 #### --------------------------------------
15566
15567 !! test
15568 Tables: 1a. Simple example
15569 !! input
15570 <nowiki>{|
15571 |}</nowiki>
15572 !! result
15573 <p>{|
15574 |}
15575 </p>
15576 !! end
15577
15578 !! test
15579 Tables: 1b. No escaping needed
15580 !! input
15581 !foo
15582 !! result
15583 <p>!foo
15584 </p>
15585 !! end
15586
15587 !! test
15588 Tables: 1c. No escaping needed
15589 !! input
15590 |foo
15591 !! result
15592 <p>|foo
15593 </p>
15594 !! end
15595
15596 !! test
15597 Tables: 1d. No escaping needed
15598 !! input
15599 |}foo
15600 !! result
15601 <p>|}foo
15602 </p>
15603 !! end
15604
15605 !! test
15606 Tables: 2a. Nested in td
15607 !! options
15608 parsoid
15609 !! input
15610 {|
15611 |<nowiki>foo|bar</nowiki>
15612 |}
15613 !! result
15614 <table><tbody><tr>
15615 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15616 !! end
15617
15618 !! test
15619 Tables: 2b. Nested in td
15620 !! options
15621 parsoid
15622 !! input
15623 {|
15624 |<nowiki>foo||bar</nowiki>
15625 |''it''<nowiki>foo||bar</nowiki>
15626 |}
15627 !! result
15628 <table><tbody><tr>
15629 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15630 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15631 !! end
15632
15633 !! test
15634 Tables: 2c. Nested in td -- no escaping needed
15635 !! options
15636 parsoid
15637 !! input
15638 {|
15639 |foo!!bar
15640 |}
15641 !! result
15642 <table><tbody><tr><td>foo!!bar
15643 </td></tr></tbody></table>
15644
15645 !! end
15646
15647 !! test
15648 Tables: 3a. Nested in th
15649 !! options
15650 parsoid
15651 !! input
15652 {|
15653 !foo!bar
15654 |}
15655 !! result
15656 <table><tbody><tr><th>foo!bar
15657 </th></tr></tbody></table>
15658
15659 !! end
15660
15661 !! test
15662 Tables: 3b. Nested in th
15663 !! options
15664 parsoid
15665 !! input
15666 {|
15667 !<nowiki>foo!!bar</nowiki>
15668 |}
15669 !! result
15670 <table>
15671 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15672 </tbody></table>
15673 !! end
15674
15675 !! test
15676 Tables: 3c. Nested in th -- no escaping needed
15677 !! options
15678 parsoid
15679 !! input
15680 {|
15681 !<nowiki>foo||bar</nowiki>
15682 |}
15683 !! result
15684 <table><tbody><tr>
15685 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15686 !! end
15687
15688 !! test
15689 Tables: 4a. Escape -
15690 !! options
15691 parsoid
15692 !! input
15693 {|
15694 |-
15695 !-bar
15696 |-
15697 |<nowiki>-bar</nowiki>
15698 |}
15699 !! result
15700 <table><tbody>
15701 <tr><th>-bar</th></tr>
15702 <tr>
15703 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15704 !! end
15705
15706 !! test
15707 Tables: 4b. Escape +
15708 !! options
15709 parsoid
15710 !! input
15711 {|
15712 |-
15713 !+bar
15714 |-
15715 |<nowiki>+bar</nowiki>
15716 |}
15717 !! result
15718 <table><tbody>
15719 <tr><th>+bar</th></tr>
15720 <tr>
15721 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15722 !! end
15723
15724 !! test
15725 Tables: 4c. No escaping needed
15726 !! options
15727 parsoid
15728 !! input
15729 {|
15730 |-
15731 |foo-bar
15732 |foo+bar
15733 |-
15734 |''foo''-bar
15735 |''foo''+bar
15736 |-
15737 |foo
15738 bar|baz
15739 +bar
15740 -bar
15741 |}
15742 !! result
15743 <table><tbody>
15744 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15745 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15746 <tr><td>foo
15747 <p>bar|baz
15748 +bar
15749 -bar</p></td></tr>
15750 </tbody></table>
15751 !! end
15752
15753 ### SSS FIXME: Disabled right now because accurate html2wt
15754 ### on this snippet requires data-parsoid flags that we've
15755 ### stripped out of these tests. We should scheme how we
15756 ### we want to handle these kind of tests that require
15757 ### data-parsoid flags for accurate html2wt serialization
15758
15759 !! test
15760 Tables: 4d. No escaping needed
15761 !! options
15762 disabled
15763 !! input
15764 {|
15765 ||+1
15766 ||-2
15767 |}
15768 !! result
15769 <table>
15770 <tr>
15771 <td>+1
15772 </td>
15773 <td>-2
15774 </td></tr></table>
15775
15776 !! end
15777
15778 #### --------------- Links ----------------
15779 #### 1. Quote marks in link text
15780 #### 2. Wikilinks: Escapes needed
15781 #### 3. Wikilinks: No escapes needed
15782 #### 4. Extlinks: Escapes needed
15783 #### 5. Extlinks: No escapes needed
15784 #### --------------------------------------
15785 !! test
15786 Links 1. Quote marks in link text
15787 !! options
15788 parsoid
15789 !! input
15790 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15791 !! result
15792 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15793 !! end
15794
15795 !! test
15796 Links 2. WikiLinks: Escapes needed
15797 !! options
15798 parsoid
15799 !! input
15800 [[Foo|<nowiki>[Foobar]</nowiki>]]
15801 [[Foo|<nowiki>Foobar]</nowiki>]]
15802 [[Foo|x [Foobar] x]]
15803 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15804 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15805 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15806 [[Foo|<nowiki>|Bar</nowiki>]]
15807 [[Foo|<nowiki>]]bar</nowiki>]]
15808 [[Foo|<nowiki>[[bar</nowiki>]]
15809 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15810 !! result
15811 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15812 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15813 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15814 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15815 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15816 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15817 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15818 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15819 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15820 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15821 !! end
15822
15823 !! test
15824 Links 3. WikiLinks: No escapes needed
15825 !! options
15826 parsoid
15827 !! input
15828 [[Foo|[Foobar]]
15829 [[Foo|foo|bar]]
15830 !! result
15831 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15832 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15833 !! end
15834
15835 !! test
15836 Links 4. ExtLinks: Escapes needed
15837 !! options
15838 parsoid
15839 !! input
15840 [http://google.com <nowiki>[google]</nowiki>]
15841 [http://google.com <nowiki>google]</nowiki>]
15842 !! result
15843 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15844 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15845 !! end
15846
15847 !! test
15848 Links 5. ExtLinks: No escapes needed
15849 !! options
15850 parsoid
15851 !! input
15852 [http://google.com [google]
15853 !! result
15854 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15855 !! end
15856
15857 #### --------------- Quotes ---------------
15858 #### 1. Quotes inside <b> and <i>
15859 #### 2. Link fragments separated by <i> and <b> tags
15860 #### 3. Link fragments inside <i> and <b>
15861 #### 4. No escaping needed
15862 #### --------------------------------------
15863 !! test
15864 1. Quotes inside <b> and <i>
15865 !! options
15866 parsoid=html2wt,wt2wt
15867 !! input
15868 ''<nowiki>'foo'</nowiki>''
15869 ''<nowiki>''foo''</nowiki>''
15870 ''<nowiki>'''foo'''</nowiki>''
15871 ''foo''<nowiki/>'s
15872 '''<nowiki>'foo'</nowiki>'''
15873 '''<nowiki>''foo''</nowiki>'''
15874 '''<nowiki>'''foo'''</nowiki>'''
15875 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15876 '''foo'''<nowiki/>'s
15877 '''foo''
15878 ''foo''<nowiki/>'
15879 '<nowiki/>''foo''<nowiki/>'
15880 ''''foo'''
15881 '''foo'''<nowiki/>'
15882 '<nowiki/>'''foo'''<nowiki/>'
15883 !! result
15884 <p><i>'foo'</i>
15885 <i>''foo''</i>
15886 <i>'''foo'''</i>
15887 <i>foo</i>'s
15888 <b>'foo'</b>
15889 <b>''foo''</b>
15890 <b>'''foo'''</b>
15891 <b>foo'<i>bar'</i>baz</b>
15892 <b>foo</b>'s
15893 '<i>foo</i>
15894 <i>foo</i>'
15895 '<i>foo</i>'
15896 '<b>foo</b>
15897 <b>foo</b>'
15898 '<b>foo</b>'</p>
15899 !! end
15900
15901 !! test
15902 2. Link fragments separated by <i> and <b> tags
15903 !! input
15904 [[''foo''<nowiki>hello]]</nowiki>
15905
15906 [['''foo'''<nowiki>hello]]</nowiki>
15907 !! result
15908 <p>[[<i>foo</i>hello]]
15909 </p><p>[[<b>foo</b>hello]]
15910 </p>
15911 !! end
15912
15913 !! test
15914 3. Link fragments inside <i> and <b>
15915 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15916 this is one of the shortcomings of this format)
15917 !! input
15918 ''[[foo''<nowiki>]]</nowiki>
15919
15920 '''[[foo'''<nowiki>]]</nowiki>
15921 !! result
15922 <p><i>[[foo</i>]]
15923 </p><p><b>[[foo</b>]]
15924 </p>
15925 !! end
15926
15927 !! test
15928 4. No escaping needed
15929 !! input
15930 '<span>''bar''</span>'
15931 '<span>'''bar'''</span>'
15932 !! result
15933 <p>'<span><i>bar</i></span>'
15934 '<span><b>bar</b></span>'
15935 </p>
15936 !! end
15937
15938 #### ----------- Paragraphs ---------------
15939 #### 1. No unnecessary escapes
15940 #### --------------------------------------
15941
15942 !! test
15943 1. No unnecessary escapes
15944 !! input
15945 bar <span><nowiki>[[foo]]</nowiki></span>
15946
15947 =bar <span><nowiki>[[foo]]</nowiki></span>
15948
15949 [[bar <span><nowiki>[[foo]]</nowiki></span>
15950
15951 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15952
15953 =bar <span>foo]]</span><nowiki>=</nowiki>
15954 !! result
15955 <p>bar <span>[[foo]]</span>
15956 </p><p>=bar <span>[[foo]]</span>
15957 </p><p>[[bar <span>[[foo]]</span>
15958 </p><p>]]bar <span>[[foo]]</span>
15959 </p><p>=bar <span>foo]]</span>=
15960 </p>
15961 !!end
15962
15963 #### ----------------------- PRE --------------------------
15964 #### 1. Leading whitespace in SOL context should be escaped
15965 #### ------------------------------------------------------
15966 !! test
15967 1. Leading whitespace in SOL context should be escaped
15968 !! options
15969 parsoid
15970 !! input
15971 <nowiki> </nowiki>a
15972
15973 <nowiki> </nowiki> a
15974
15975 <nowiki> </nowiki>a(tab)
15976
15977 <nowiki> </nowiki> a
15978 <!--cmt-->
15979 <nowiki> </nowiki> a
15980
15981 a
15982 <nowiki> </nowiki>b
15983
15984 a
15985 <nowiki> </nowiki>b
15986
15987 a
15988 <nowiki> </nowiki> b
15989 !! result
15990 <p> a</p>
15991 <p> a</p>
15992 <p> a(tab)</p>
15993 <p> a</p>
15994 <p><!--cmt--> a</p>
15995 <p>a
15996 b</p>
15997 <p>a
15998 b</p>
15999 <p>a
16000 b</p>
16001 !! end
16002
16003 #### --------------- HTML tags ---------------
16004 #### 1. a tags
16005 #### 2. other tags
16006 #### 3. multi-line html tag
16007 #### -----------------------------------------
16008 !! test
16009 1. a tags
16010 !! options
16011 parsoid
16012 !! input
16013 <a href="http://google.com">google</a>
16014 !! result
16015 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16016 !! end
16017
16018 !! test
16019 2. other tags
16020 !! input
16021 <nowiki><div>foo</div>
16022 <div style="color:red">foo</div></nowiki>
16023 !! result
16024 <p>&lt;div&gt;foo&lt;/div&gt;
16025 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16026 </p>
16027 !! end
16028
16029 !! test
16030 3. multi-line html tag
16031 !! input
16032 <nowiki><div
16033 >foo</div
16034 ></nowiki>
16035 !! result
16036 <p>&lt;div
16037 &gt;foo&lt;/div
16038 &gt;
16039 </p>
16040 !! end
16041
16042 !! test
16043 4. extension tags
16044 !! input
16045 <nowiki><ref>foo</ref></nowiki>
16046 !! result
16047 <p>&lt;ref&gt;foo&lt;/ref&gt;
16048 </p>
16049 !! end
16050
16051 #### --------------- Others ---------------
16052 !! test
16053 Escaping nowikis
16054 !! input
16055 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16056 !! result
16057 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16058 </p>
16059 !! end
16060
16061 ## The quote-char in the input is necessary for triggering the bug
16062 !! test
16063 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16064 !! options
16065 parsoid=wt2wt,html2wt
16066 !! input
16067 foo's bar :
16068 !! result
16069 <p>foo's bar :</p>
16070 !! end
16071
16072 !! test
16073
16074 Tag-like HTML structures are passed through as text
16075 !! input
16076 <x y>
16077
16078 <x.y>
16079
16080 <x-y>
16081
16082 1>2
16083
16084 x<y
16085
16086 a>b
16087
16088 1<d e>f
16089 !! result
16090 <p>&lt;x y&gt;
16091 </p><p>&lt;x.y&gt;
16092 </p><p>&lt;x-y&gt;
16093 </p><p>1&gt;2
16094 </p><p>x&lt;y
16095 </p><p>a&gt;b
16096 </p><p>1&lt;d e&gt;f
16097 </p>
16098 !! end
16099
16100
16101 # This fails in the PHP parser (see bug 40670,
16102 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
16103 !! test
16104 Tag names followed by punctuation should not be recognized as tags
16105 !! options
16106 parsoid
16107 !! input
16108 <s.ome> text
16109 !! result
16110 <p>&lt;s.ome&gt; text
16111 </p>
16112 !! end
16113
16114 !! test
16115 HTML tag with necessary entities in attributes
16116 !! input
16117 <span title="&amp;amp;">foo</span>
16118 !! result
16119 <p><span title="&amp;amp;">foo</span>
16120 </p>
16121 !! end
16122
16123 !! test
16124 HTML tag with 'unnecessary' entity encoding in attributes
16125 !! input
16126 <span title="&amp;">foo</span>
16127 !! result
16128 <p><span title="&amp;">foo</span>
16129 </p>
16130 !! end
16131
16132 !! test
16133 HTML tag with broken attribute value quoting
16134 !! input
16135 <span title="Hello world>Foo</span>
16136 !! result
16137 <p><span>Foo</span>
16138 </p>
16139 !! end
16140
16141 !! test
16142 Parsoid-only: HTML tag with broken attribute value quoting
16143 !! options
16144 parsoid
16145 !! input
16146 <span title="Hello world>Foo</span>
16147 !! result
16148 <p><span title="Hello world">Foo</span>
16149 </p>
16150 !! end
16151
16152 !! test
16153 Table with broken attribute value quoting
16154 !! input
16155 {|
16156 | title="Hello world|Foo
16157 |}
16158 !! result
16159 <table>
16160 <tr>
16161 <td>Foo
16162 </td></tr></table>
16163
16164 !! end
16165
16166 !! test
16167 Table with broken attribute value quoting on consecutive lines
16168 !! input
16169 {|
16170 | title="Hello world|Foo
16171 | style="color:red|Bar
16172 |}
16173 !! result
16174 <table>
16175 <tr>
16176 <td>Foo
16177 </td>
16178 <td>Bar
16179 </td></tr></table>
16180
16181 !! end
16182
16183 !! test
16184 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16185 !! options
16186 parsoid
16187 !! input
16188 {|
16189 | title="Hello world|Foo
16190 | style="color:red|Bar
16191 |}
16192 !! result
16193 <table><tbody>
16194 <tr>
16195 <td title="Hello world">Foo
16196 </td><td style="color: red">Bar
16197 </td></tr></tbody></table>
16198
16199 !! end
16200
16201 !! test
16202 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16203 !! options
16204 parsoid
16205 !! input
16206 {{}}
16207 !! result
16208 {{}}
16209 !! end
16210
16211 !! test
16212 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16213 !! options
16214 parsoid
16215 !! input
16216 }}{{
16217 !! result
16218 }}{{
16219 !! end
16220
16221 !!test
16222 Accept empty td cell attribute
16223 !!input
16224 {|
16225 | align="center" | foo || |
16226 |}
16227 !!result
16228 <table>
16229 <tr>
16230 <td align="center"> foo </td>
16231 <td>
16232 </td></tr></table>
16233
16234 !!end
16235
16236 !!test
16237 Non-empty attributes in th-cells
16238 !!input
16239 {|
16240 ! Foo !! style="color: red" | Bar
16241 |}
16242 !!result
16243 <table>
16244 <tr>
16245 <th> Foo </th>
16246 <th style="color: red"> Bar
16247 </th></tr></table>
16248
16249 !!end
16250
16251 !!test
16252 Accept empty attributes in th-cells
16253 !!input
16254 {|
16255 !| foo !!| bar
16256 |}
16257 !!result
16258 <table>
16259 <tr>
16260 <th> foo </th>
16261 <th> bar
16262 </th></tr></table>
16263
16264 !!end
16265
16266 !!test
16267 Empty table rows go away
16268 !!input
16269 {|
16270 | Hello
16271 | there
16272 |- class="foo"
16273 |-
16274 |}
16275 !! result
16276 <table>
16277 <tr>
16278 <td> Hello
16279 </td>
16280 <td> there
16281 </td></tr>
16282
16283 </table>
16284
16285 !! end
16286
16287 ###
16288 ### Parsoid-centric tests for testing RTing of inter-element separators
16289 ### Edge cases not tested by existing parser tests and specific to
16290 ### Parsoid-specific serialization strategies.
16291 ###
16292
16293 !!test
16294 RT-ed inter-element separators should be valid separators
16295 !!input
16296 {|
16297 |- [[foo]]
16298 |}
16299 !!result
16300 <table>
16301
16302 </table>
16303
16304 !!end
16305
16306 !!test
16307 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16308 (Parsoid-only since PHP parser relies on Tidy for correct output)
16309 !!options
16310 parsoid
16311 !!input
16312 {|
16313 |<small>foo
16314 bar
16315 |}
16316
16317 {|
16318 |<small>foo<small>
16319 |}
16320 !!result
16321 !!end
16322
16323 !!test
16324 Empty TD followed by TD with tpl-generated attribute
16325 !!input
16326 {|
16327 |-
16328 |
16329 |{{echo|style='color:red'}}|foo
16330 |}
16331 !!result
16332 <table>
16333
16334 <tr>
16335 <td>
16336 </td>
16337 <td>foo
16338 </td></tr></table>
16339
16340 !!end
16341
16342 !!test
16343 Indented table with an empty td
16344 !!input
16345 {|
16346 |-
16347 |
16348 |foo
16349 |}
16350 !!result
16351 <table>
16352
16353 <tr>
16354 <td>
16355 </td>
16356 <td>foo
16357 </td></tr></table>
16358
16359 !!end
16360
16361 !!test
16362 Empty TR followed by a template-generated TR
16363 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16364 !!options
16365 parsoid=wt2html,wt2wt
16366 !!input
16367 {|
16368 |-
16369 {{echo|<tr><td>foo</td></tr>}}
16370 |}
16371 !!result
16372 <table>
16373 <tbody>
16374 <tr></tr>
16375 <tr typeof="mw:Transclusion">
16376 <td>foo</td></tr></tbody></table>
16377 !!end
16378
16379 ## PHP and parsoid output differ for this, and since this is primarily
16380 ## for testing Parsoid's serializer, marking this Parsoid only
16381 !!test
16382 Empty TR followed by mixed-ws-comment line should RT correctly
16383 !!options
16384 parsoid
16385 !!input
16386 {|
16387 |-
16388 <!--c-->
16389 |-
16390 <!--c--> <!--d-->
16391 |}
16392 !!result
16393 <table>
16394 <tbody>
16395 <tr>
16396 <td> <!--c--></td></tr>
16397 <tr>
16398 <td><!--c--> <!--d--></td></tr>
16399 </tbody></table>
16400
16401 !!end
16402
16403 !!test
16404 Multi-line image caption generated by templates with/without trailing newlines
16405 !!options
16406 parsoid
16407 !!input
16408 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16409 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16410 !!result
16411 <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>
16412 <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>
16413
16414 !!end
16415
16416 ## PHP emits broken html for this, and since this is primarily
16417 ## a Parsoid serializer test, marking this Parsoid only
16418 !!test
16419 Improperly nested inline or quotes tags with whitespace in between
16420 !!options
16421 parsoid
16422 !!input
16423 <span> <s>x</span> </s>
16424 ''' ''x''' ''
16425 !!result
16426 <p><span> <s>x</s></span><s> </s>
16427 <b> <i>x</i></b><i> </i>
16428 </p>
16429 !!end
16430
16431 !!test
16432 Encapsulate protected attributes from wt
16433 !!options
16434 parsoid
16435 !!input
16436 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16437 !!result
16438 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
16439 </body>
16440 !!end
16441
16442 # -----------------------------------------------------------------
16443 # The following section of tests are primarily to spec requirements
16444 # around serialization of new/edited content.
16445 #
16446 # All these tests are marked Parsoid html2wt and html2html only
16447 # ----------------------------------------------------------------
16448
16449 !! test
16450 Image: Modifying size of an image
16451 !! options
16452 parsoid=html2wt
16453 !! input
16454 [[Image:Wiki.png|230x230px]]
16455 !! result
16456 <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>
16457 !!end
16458
16459 !! test
16460 Image: New block level image should have \n before and after
16461 !! options
16462 parsoid=html2wt
16463 !! input
16464 123
16465 [[File:Wiki.png|right|thumb|150x150px]]
16466 456
16467 !! result
16468 <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>
16469 !!end
16470
16471 !! test
16472 Lists: Add space after bullets
16473 !! options
16474 parsoid=html2wt
16475 !! input
16476
16477 * foo
16478 * bar
16479 * <span> baz</span>
16480 !! result
16481 <ul>
16482 <li>foo</li>
16483 <li> bar</li>
16484 <li><span> baz</span></li>
16485 </ul>
16486 !! end
16487
16488 !! test
16489 Parsoid: Serialize positional parameters with = in them as named parameter
16490 !! options
16491 parsoid=html2wt
16492 !! input
16493 {{echo|1 = f=oo}}
16494 !! result
16495 <p about="#mwt1" typeof="mw:Transclusion"
16496 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16497 >foo</p>
16498 !! end
16499
16500 # -----------------------------------------------------------------
16501 # End of section for Parsoid-only html2wt tests for serialization
16502 # of new content
16503 # -----------------------------------------------------------------
16504
16505 TODO:
16506 more images
16507 more tables
16508 character entities
16509 and much more
16510 Try for 100% code coverage