Merge "Non-word characters don't terminate tag names."
[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 !! test
869 <wbr> isn't (yet) valid wikitext (bug 52468)
870 !! input
871 <wbr>
872 !! result
873 <p>&lt;wbr&gt;
874 </p>
875 !! end
876
877 # <strike> is HTML4, <s> is HTML4/5.
878 !! test
879 <s> or <strike> for strikethrough
880 !! input
881 <strike>strike</strike>
882
883 <s>s</s>
884 !! result
885 <p><strike>strike</strike>
886 </p><p><s>s</s>
887 </p>
888 !! end
889
890 !! test
891 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
892 !! input
893 <b→> doesn't work! </b>
894
895 <bä> doesn't work! </b>
896
897 <boo> works fine </b>
898
899 <s.foo>foo</s>
900
901 <s.foo>s.foo</s.foo>
902
903 <sub-ID#1>
904 !! result
905 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
906 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
907 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
908 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
909 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
910 </p><p>&lt;sub-ID#1&gt;
911 </p>
912 !! end
913
914 ###
915 ### Special characters
916 ###
917
918 !! test
919 Bare pipe character (bug 52363)
920 !! input
921 |
922 !! result
923 <p>|
924 </p>
925 !! end
926
927 !! test
928 Bare pipe character from a template (bug 52363)
929 !! input
930 {{pipe}}
931 !! result
932 <p>|
933 </p>
934 !! end
935
936 ###
937 ### <nowiki> test cases
938 ###
939
940 !! test
941 <nowiki> unordered list
942 !! input
943 <nowiki>* This is not an unordered list item.</nowiki>
944 !! result
945 <p>* This is not an unordered list item.
946 </p>
947 !! end
948
949 !! test
950 <nowiki> spacing
951 !! input
952 <nowiki>Lorem ipsum dolor
953
954 sed abit.
955 sed nullum.
956
957 :and a colon
958 </nowiki>
959 !! result
960 <p>Lorem ipsum dolor
961
962 sed abit.
963 sed nullum.
964
965 :and a colon
966
967 </p>
968 !! end
969
970 !! test
971 nowiki 3
972 !! input
973 :There is not nowiki.
974 :There is <nowiki>nowiki</nowiki>.
975
976 #There is not nowiki.
977 #There is <nowiki>nowiki</nowiki>.
978
979 *There is not nowiki.
980 *There is <nowiki>nowiki</nowiki>.
981 !! result
982 <dl><dd>There is not nowiki.
983 </dd><dd>There is nowiki.
984 </dd></dl>
985 <ol><li>There is not nowiki.
986 </li><li>There is nowiki.
987 </li></ol>
988 <ul><li>There is not nowiki.
989 </li><li>There is nowiki.
990 </li></ul>
991
992 !! end
993
994 !! test
995 Entities inside <nowiki>
996 !! input
997 <nowiki>&lt;</nowiki>
998 !! result
999 <p>&lt;
1000 </p>
1001 !! end
1002
1003 !! test
1004 Entities inside template parameters
1005 !! options
1006 parsoid
1007 !! input
1008 {{echo|&ndash;}}
1009 !! result
1010 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1011 </p>
1012 !! end
1013
1014 ###
1015 ### Comments
1016 ###
1017 !! test
1018 Comments and Indent-Pre
1019 !! input
1020 <!-- comment 1 --> asdf
1021
1022 <!-- comment 1 --> asdf
1023 <!-- comment 2 -->
1024
1025 <!-- comment 1 --> asdf
1026 <!-- comment 2 -->xyz
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 --> xyz
1030 !! result
1031 <pre>asdf
1032 </pre>
1033 <pre>asdf
1034 </pre>
1035 <pre>asdf
1036 </pre>
1037 <p>xyz
1038 </p>
1039 <pre>asdf
1040 xyz
1041 </pre>
1042 !! end
1043
1044 !! test
1045 Comment test 2a
1046 !! input
1047 asdf
1048 <!-- comment 1 -->
1049 jkl
1050 !! result
1051 <p>asdf
1052 jkl
1053 </p>
1054 !! end
1055
1056 !! test
1057 Comment test 2b
1058 !! input
1059 asdf
1060 <!-- comment 1 -->
1061
1062 jkl
1063 !! result
1064 <p>asdf
1065 </p><p>jkl
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment test 3
1071 !! input
1072 asdf
1073 <!-- comment 1 -->
1074 <!-- comment 2 -->
1075 jkl
1076 !! result
1077 <p>asdf
1078 jkl
1079 </p>
1080 !! end
1081
1082 !! test
1083 Comment test 4
1084 !! input
1085 asdf<!-- comment 1 -->jkl
1086 !! result
1087 <p>asdfjkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment spacing
1093 !! input
1094 a
1095 <!-- foo --> b <!-- bar -->
1096 c
1097 !! result
1098 <p>a
1099 </p>
1100 <pre> b
1101 </pre>
1102 <p>c
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment whitespace
1108 !! input
1109 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1110 !! result
1111
1112 !! end
1113
1114 !! test
1115 Comment semantics and delimiters
1116 !! input
1117 <!-- --><!----><!-----><!------>
1118 !! result
1119
1120 !! end
1121
1122 !! test
1123 Comment semantics and delimiters, redux
1124 !! input
1125 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1126 -- foo -- funky huh? ... -->
1127 !! result
1128
1129 !! end
1130
1131 !! test
1132 Comment semantics and delimiters: directors cut
1133 !! input
1134 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1135 everything starting with < followed by !-- until the first -- and > we see,
1136 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1137 -->-->
1138 !! result
1139 <p>--&gt;
1140 </p>
1141 !! end
1142
1143 !! test
1144 Comment semantics: nesting
1145 !! input
1146 <!--<!-- no, we're not going to do anything fancy here -->-->
1147 !! result
1148 <p>--&gt;
1149 </p>
1150 !! end
1151
1152 !! test
1153 Comment semantics: unclosed comment at end
1154 !! input
1155 <!--This comment will run out to the end of the document
1156 !! result
1157
1158 !! end
1159
1160 !! test
1161 Comment in template title
1162 !! input
1163 {{f<!---->oo}}
1164 !! result
1165 <p>FOO
1166 </p>
1167 !! end
1168
1169 !! test
1170 Comment on its own line post-expand
1171 !! input
1172 a
1173 {{blank}}<!---->
1174 b
1175 !! result
1176 <p>a
1177 </p><p>b
1178 </p>
1179 !! end
1180
1181 !! test
1182 Comment on its own line post-expand with non-significant whitespace
1183 !! input
1184 a
1185 {{blank}} <!---->
1186 b
1187 !! result
1188 <p>a
1189 </p><p>b
1190 </p>
1191 !! end
1192
1193 ###
1194 ### paragraph wrapping tests
1195 ###
1196 !! test
1197 No block tags
1198 !! input
1199 a
1200
1201 b
1202 !! result
1203 <p>a
1204 </p><p>b
1205 </p>
1206 !! end
1207 !! test
1208 Block tag on one line
1209 !! input
1210 a <div>foo</div>
1211
1212 b
1213 !! result
1214 a <div>foo</div>
1215 <p>b
1216 </p>
1217 !! end
1218
1219 !! test
1220 Block tag on both lines
1221 !! input
1222 a <div>foo</div>
1223
1224 b <div>foo</div>
1225 !! result
1226 a <div>foo</div>
1227 b <div>foo</div>
1228
1229 !! end
1230
1231 !! test
1232 Multiple lines without block tags
1233 !! input
1234 <div>foo</div> a
1235 b
1236 c
1237 d<!--foo--> e
1238 x <div>foo</div> z
1239 !! result
1240 <div>foo</div> a
1241 <p>b
1242 c
1243 d e
1244 </p>
1245 x <div>foo</div> z
1246
1247 !! end
1248
1249 !! test
1250 Empty lines between lines with block tags
1251 !! input
1252 <div></div>
1253
1254
1255 <div></div>a
1256
1257 b
1258 <div>a</div>b
1259
1260 <div>b</div>d
1261
1262
1263 <div>e</div>
1264 !! result
1265 <div></div>
1266 <p><br />
1267 </p>
1268 <div></div>a
1269 <p>b
1270 </p>
1271 <div>a</div>b
1272 <div>b</div>d
1273 <p><br />
1274 </p>
1275 <div>e</div>
1276
1277 !! end
1278
1279 ###
1280 ### Preformatted text
1281 ###
1282 !! test
1283 Preformatted text
1284 !! input
1285 This is some
1286 Preformatted text
1287 With ''italic''
1288 And '''bold'''
1289 And a [[Main Page|link]]
1290 !! result
1291 <pre>This is some
1292 Preformatted text
1293 With <i>italic</i>
1294 And <b>bold</b>
1295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1296 </pre>
1297 !! end
1298
1299 !! test
1300 Ident preformatting with inline content
1301 !! input
1302 a
1303 ''b''
1304 !! result
1305 <pre>a
1306 <i>b</i>
1307 </pre>
1308 !! end
1309
1310 !! test
1311 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1312 !! input
1313 <pre><nowiki>
1314 <b>
1315 <cite>
1316 <em>
1317 </nowiki></pre>
1318 !! result
1319 <pre>
1320 &lt;b&gt;
1321 &lt;cite&gt;
1322 &lt;em&gt;
1323 </pre>
1324
1325 !! end
1326
1327 !! test
1328 Regression with preformatted in <center>
1329 !! input
1330 <center>
1331 Blah
1332 </center>
1333 !! result
1334 <center>
1335 <pre>Blah
1336 </pre>
1337 </center>
1338
1339 !! end
1340
1341 # Expected output in the following test is not really expected (there should be
1342 # <pre> in the output) -- it's only testing for well-formedness.
1343 !! test
1344 Bug 6200: Preformatted in <blockquote>
1345 !! input
1346 <blockquote>
1347 Blah
1348 </blockquote>
1349 !! result
1350 <blockquote>
1351 Blah
1352 </blockquote>
1353
1354 !! end
1355
1356 !! test
1357 <pre> with attributes (bug 3202)
1358 !! input
1359 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1360 !! result
1361 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1362
1363 !! end
1364
1365 !! test
1366 <pre> with width attribute (bug 3202)
1367 !! input
1368 <pre width="8">Narrow screen goodies</pre>
1369 !! result
1370 <pre width="8">Narrow screen goodies</pre>
1371
1372 !! end
1373
1374 !! test
1375 <pre> with forbidden attribute (bug 3202)
1376 !! input
1377 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1378 !! result
1379 <pre width="8">Narrow screen goodies</pre>
1380
1381 !! end
1382
1383 !! test
1384 Entities inside <pre>
1385 !! input
1386 <pre>&lt;</pre>
1387 !! result
1388 <pre>&lt;</pre>
1389
1390 !! end
1391
1392 !! test
1393 <pre> with forbidden attribute values (bug 3202)
1394 !! input
1395 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1396 !! result
1397 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1398
1399 !! end
1400
1401 !! test
1402 <nowiki> inside <pre> (bug 13238)
1403 !! input
1404 <pre>
1405 <nowiki>
1406 </pre>
1407 <pre>
1408 <nowiki></nowiki>
1409 </pre>
1410 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1411 !! result
1412 <pre>
1413 &lt;nowiki&gt;
1414 </pre>
1415 <pre>
1416
1417 </pre>
1418 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1419
1420 !! end
1421
1422 !! test
1423 <nowiki> and <pre> preference (first one wins)
1424 !! input
1425 <pre>
1426 <nowiki>
1427 </pre>
1428 </nowiki>
1429 </pre>
1430
1431 <nowiki>
1432 <pre>
1433 <nowiki>
1434 </pre>
1435 </nowiki>
1436 </pre>
1437
1438 !! result
1439 <pre>
1440 &lt;nowiki&gt;
1441 </pre>
1442 <p>&lt;/nowiki&gt;
1443 &lt;/pre&gt;
1444 </p><p>
1445 &lt;pre&gt;
1446 &lt;nowiki&gt;
1447 &lt;/pre&gt;
1448
1449 &lt;/pre&gt;
1450 </p>
1451 !! end
1452
1453 !! test
1454 </pre> inside nowiki
1455 !! input
1456 <nowiki></pre></nowiki>
1457 !! result
1458 <p>&lt;/pre&gt;
1459 </p>
1460 !! end
1461
1462 !!test
1463 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1464 !!input
1465 {{echo|}}
1466 !!result
1467
1468 !!end
1469
1470 !!test
1471 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1472 !!input
1473 {{echo|
1474 foo}}
1475 !!result
1476 <p>foo
1477 </p>
1478 !!end
1479
1480 !! test
1481 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1482 !! input
1483 {{echo|a
1484 b}}
1485 !!result
1486 <pre>a
1487 </pre>
1488 <p>b
1489 </p>
1490 !!end
1491
1492 !! test
1493 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1494 !! input
1495 {{echo|a
1496 b
1497 c
1498 d
1499 e
1500 }}
1501 !!result
1502 <pre>a
1503 </pre>
1504 <p>b
1505 c
1506 </p>
1507 <pre>d
1508 </pre>
1509 <p>e
1510 </p>
1511 !!end
1512
1513 !!test
1514 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1515 !!input
1516 {{echo| foo}}
1517
1518 {{echo| foo}}{{echo| bar}}
1519
1520 {{echo| foo}}
1521 {{echo| bar}}
1522
1523 {{echo|<!--cmt--> foo}}
1524
1525 <!--cmt-->{{echo| foo}}
1526
1527 {{echo|{{echo| }}bar}}
1528 !!result
1529 <pre>foo
1530 </pre>
1531 <pre>foo bar
1532 </pre>
1533 <pre>foo
1534 bar
1535 </pre>
1536 <pre>foo
1537 </pre>
1538 <pre>foo
1539 </pre>
1540 <pre>bar
1541 </pre>
1542 !!end
1543
1544 !! test
1545 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1546 !! input
1547 {{echo| }}a
1548
1549 {{echo|
1550 }}a
1551
1552 {{echo|
1553 b}}
1554
1555 {{echo|a
1556 }}b
1557
1558 {{echo|a
1559 }} b
1560 !!result
1561 <pre>a
1562 </pre>
1563 <p><br />
1564 </p>
1565 <pre>a
1566 </pre>
1567 <p><br />
1568 </p>
1569 <pre>b
1570 </pre>
1571 <p>a
1572 </p>
1573 <pre>b
1574 </pre>
1575 <p>a
1576 </p>
1577 <pre>b
1578 </pre>
1579 !!end
1580
1581 !! test
1582 Templates: Single-line variant of parameter whitespace stripping test
1583 !! input
1584 {{echo| a}}
1585
1586 {{echo|1= a}}
1587
1588 {{echo|{{echo| a}}}}
1589
1590 {{echo|1={{echo| a}}}}
1591 !! result
1592 <pre>a
1593 </pre>
1594 <p>a
1595 </p>
1596 <pre>a
1597 </pre>
1598 <p>a
1599 </p>
1600 !! end
1601
1602 !! test
1603 Templates: Strip whitespace from named parameters, but not positional ones
1604 !! input
1605 {{echo|
1606 foo}}
1607
1608 {{echo|
1609 * foo}}
1610
1611 {{echo| 1 =
1612 foo}}
1613
1614 {{echo| 1 =
1615 * foo}}
1616 !! result
1617 <pre>foo
1618 </pre>
1619 <p><br />
1620 </p>
1621 <ul><li> foo
1622 </li></ul>
1623 <p>foo
1624 </p>
1625 <ul><li> foo
1626 </li></ul>
1627
1628 !! end
1629
1630 !! test
1631 Templates: Dont strip whitespace from whitespace/comment-only arguments
1632 !! input
1633 {{echo| }}
1634 {{echo|<!--cmt-->}}
1635 {{echo| <!--cmt--> }}
1636 !! result
1637 <p><br />
1638 </p>
1639 !! end
1640
1641 !! test
1642 Templates: Parsoid parameter escaping test 1
1643 !! options
1644 parsoid
1645 !! input
1646 {{echo|[foo]|{{echo|[bar]}}}}
1647 !! result
1648 <p about="#mwt1" typeof="mw:Transclusion"
1649 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>
1650 !! end
1651
1652 !! test
1653 Parsoid: Pipes in external links in template parameter
1654 !! options
1655 parsoid
1656 !! input
1657 {{echo|[{{echo|http://example.com}} link]}}
1658 !! result
1659 <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>
1660 !! end
1661
1662 !! test
1663 Parsoid: pipe in transclusion parameter
1664 !! options
1665 parsoid
1666 !! input
1667 {{echo|http://foo.com/a&#124;b}}
1668 !! result
1669 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1670 typeof="mw:Transclusion"
1671 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>
1672 !! end
1673
1674 !! test
1675 Parsoid: Pipe in external link target and content in template parameter
1676 !! options
1677 parsoid=html2wt,wt2wt
1678 !! input
1679 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1680 !! result
1681 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1682 typeof="mw:Transclusion"
1683 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1684 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1685 !! end
1686
1687 !! test
1688 Templates: Dont escape already nowiki-escaped text in template parameters
1689 !! options
1690 parsoid=html2wt,wt2wt
1691 !! input
1692 {{echo|foo<nowiki>|</nowiki>bar}}
1693 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1694 {{echo|<nowiki></nowiki>}}
1695 !! result
1696 <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>
1697 <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>
1698 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1699 </p>
1700 !! end
1701
1702 ###
1703 ### Parsoid-centric tests for testing RT edge cases for pre
1704 ###
1705
1706 !!test
1707 1a. Indent-Pre and Comments
1708 !!input
1709 a
1710 <!--a-->
1711 c
1712 !!result
1713 <pre>a
1714 </pre>
1715 <p>c
1716 </p>
1717 !!end
1718
1719 !!test
1720 1b. Indent-Pre and Comments
1721 !!input
1722 a
1723 <!--a-->
1724 c
1725 !!result
1726 <pre>a
1727 </pre>
1728 <p>c
1729 </p>
1730 !!end
1731
1732 !!test
1733 1c. Indent-Pre and Comments
1734 !!input
1735 <!--a--> a
1736
1737 <!--a--> a
1738 !!result
1739 <pre> a
1740 </pre>
1741 <pre> a
1742 </pre>
1743 !!end
1744
1745 !!test
1746 2a. Indent-Pre and tables
1747 !!input
1748 {|
1749 |-
1750 !h1!!h2
1751 |foo||bar
1752 |}
1753 !!result
1754 <table>
1755
1756 <tr>
1757 <th>h1</th>
1758 <th>h2
1759 </th>
1760 <td>foo</td>
1761 <td>bar
1762 </td></tr></table>
1763
1764 !!end
1765
1766 !!test
1767 2b. Indent-Pre and tables
1768 !!input
1769 {|
1770 |-
1771 |foo
1772 |}
1773 !!result
1774 <table>
1775
1776 <tr>
1777 <td>foo
1778 </td></tr></table>
1779
1780 !!end
1781
1782 !!test
1783 2c. Indent-Pre and tables (bug 42252)
1784 !!input
1785 {|
1786 |+ foo
1787 ! | bar
1788 |}
1789 !!result
1790 <table>
1791 <caption> foo
1792 </caption>
1793 <tr>
1794 <th> bar
1795 </th></tr></table>
1796
1797 !!end
1798
1799 !!test
1800 3a. Indent-Pre and block tags (single-line html)
1801 !!input
1802 <p> foo </p>
1803 <div> foo </div>
1804 <span> foo </span>
1805 !!result
1806 <p> foo </p>
1807 <div> foo </div>
1808 <pre><span> foo </span>
1809 </pre>
1810 !!end
1811
1812 !!test
1813 3b. Indent-Pre and block tags (pre-content on separate line)
1814 !!input
1815 <p>
1816 foo
1817 </p>
1818
1819 <div>
1820 foo
1821 </div>
1822
1823 <center>
1824 foo
1825 </center>
1826
1827 <blockquote>
1828 foo
1829 </blockquote>
1830
1831 <table><tr><td>
1832 foo
1833 </td></tr></table>
1834
1835 <ul><li>
1836 foo
1837 </li></ul>
1838
1839 !!result
1840 <p>
1841 foo
1842 </p>
1843 <div>
1844 <pre>foo
1845 </pre>
1846 </div>
1847 <center>
1848 <pre>foo
1849 </pre>
1850 </center>
1851 <blockquote>
1852 foo
1853 </blockquote>
1854 <table><tr><td>
1855 <pre>foo
1856 </pre>
1857 </td></tr></table>
1858 <ul><li>
1859 foo
1860 </li></ul>
1861
1862 !!end
1863
1864 !!test
1865 4. Multiple spaces at start-of-line
1866 !!input
1867 <p> foo </p>
1868 foo
1869 {|
1870 |foo
1871 |}
1872 !!result
1873 <p> foo </p>
1874 <pre> foo
1875 </pre>
1876 <table>
1877 <tr>
1878 <td>foo
1879 </td></tr></table>
1880
1881 !!end
1882
1883 !! test
1884 5. White-space in indent-pre
1885 NOTE: the white-space char on 2nd line is significant
1886 !! input
1887 a<br/>
1888
1889 b
1890 !! result
1891 <pre>a<br />
1892
1893 b
1894 </pre>
1895 !! end
1896
1897 ###
1898 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1899 ###
1900
1901 !!test
1902 HTML-pre: 1. embedded newlines
1903 !!input
1904 <pre>foo</pre>
1905
1906 <pre>
1907 foo
1908 </pre>
1909
1910 <pre>
1911
1912 foo
1913 </pre>
1914
1915 <pre>
1916
1917
1918 foo
1919 </pre>
1920 !!result
1921 <pre>foo</pre>
1922 <pre>
1923 foo
1924 </pre>
1925 <pre>
1926
1927 foo
1928 </pre>
1929 <pre>
1930
1931
1932 foo
1933 </pre>
1934
1935 !!end
1936
1937 !!test
1938 HTML-pre: 2: indented text
1939 !!input
1940 <pre>
1941 foo
1942 </pre>
1943 !!result
1944 <pre>
1945 foo
1946 </pre>
1947
1948 !!end
1949
1950 !!test
1951 HTML-pre: 3: other wikitext
1952 !!input
1953 <pre>
1954 * foo
1955 # bar
1956 = no-h =
1957 '' no-italic ''
1958 [[ NoLink ]]
1959 </pre>
1960 !!result
1961 <pre>
1962 * foo
1963 # bar
1964 = no-h =
1965 '' no-italic ''
1966 [[ NoLink ]]
1967 </pre>
1968
1969 !!end
1970
1971 ###
1972 ### Definition lists
1973 ###
1974 !! test
1975 Simple definition
1976 !! input
1977 ; name : Definition
1978 !! result
1979 <dl><dt> name&#160;</dt><dd> Definition
1980 </dd></dl>
1981
1982 !! end
1983
1984 !! test
1985 Definition list for indentation only
1986 !! input
1987 : Indented text
1988 !! result
1989 <dl><dd> Indented text
1990 </dd></dl>
1991
1992 !! end
1993
1994 !! test
1995 Definition list with no space
1996 !! input
1997 ;name:Definition
1998 !! result
1999 <dl><dt>name</dt><dd>Definition
2000 </dd></dl>
2001
2002 !!end
2003
2004 !! test
2005 Definition list with URL link
2006 !! input
2007 ; http://example.com/ : definition
2008 !! result
2009 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2010 </dd></dl>
2011
2012 !! end
2013
2014 !! test
2015 Definition list with bracketed URL link
2016 !! input
2017 ;[http://www.example.com/ Example]:Something about it
2018 !! result
2019 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2020 </dd></dl>
2021
2022 !! end
2023
2024 !! test
2025 Definition list with wikilink containing colon
2026 !! input
2027 ; [[Help:FAQ]]: The least-read page on Wikipedia
2028 !! result
2029 <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
2030 </dd></dl>
2031
2032 !! end
2033
2034 # At Brion's and JeLuF's insistence... :)
2035 !! test
2036 Definition list with news link containing colon
2037 !! input
2038 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2039 !! result
2040 <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!
2041 </dd></dl>
2042
2043 !! end
2044
2045 !! test
2046 Malformed definition list with colon
2047 !! input
2048 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2049 !! result
2050 <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
2051 </dt></dl>
2052
2053 !! end
2054
2055 !! test
2056 Definition lists: colon in external link text
2057 !! input
2058 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2059 !! result
2060 <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
2061 </dd></dl>
2062
2063 !! end
2064
2065 !! test
2066 Definition lists: colon in HTML attribute
2067 !! input
2068 ;<b style="display: inline">bold</b>
2069 !! result
2070 <dl><dt><b style="display: inline">bold</b>
2071 </dt></dl>
2072
2073 !! end
2074
2075 !! test
2076 Definition lists: self-closed tag
2077 !! input
2078 ;one<br/>two : two-line fun
2079 !! result
2080 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2081 </dd></dl>
2082
2083 !! end
2084
2085 !! test
2086 Bug 11748: Literal closing tags
2087 !! input
2088 <dl>
2089 <dt>test 1</dt>
2090 <dd>test test test test test</dd>
2091 <dt>test 2</dt>
2092 <dd>test test test test test</dd>
2093 </dl>
2094 !! result
2095 <dl>
2096 <dt>test 1</dt>
2097 <dd>test test test test test</dd>
2098 <dt>test 2</dt>
2099 <dd>test test test test test</dd>
2100 </dl>
2101
2102 !! end
2103
2104 !! test
2105 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2106 !! input
2107 <ul><li>
2108 ; term : description
2109 * unordered
2110 </li>
2111 </ul>
2112 !! result
2113 <ul><li>
2114 <dl><dt> term&#160;</dt><dd> description
2115 </dd></dl>
2116 <ul><li> unordered
2117 </li></ul>
2118 </li>
2119 </ul>
2120
2121 !! end
2122
2123 !! test
2124
2125 Definition list with empty definition and following paragraph
2126 !! input
2127 ; term:
2128 Paragraph text
2129 !! result
2130 <dl><dt> term</dt><dd>
2131 </dd></dl>
2132 <p>Paragraph text
2133 </p>
2134 !! end
2135
2136 !! test
2137 Nested definition lists using html syntax
2138 !! input
2139 <dl><dd>
2140 <dl>
2141 <dd>Foo</dd>
2142 </dl>
2143 </dd></dl>
2144 !! result
2145 <dl><dd>
2146 <dl>
2147 <dd>Foo</dd>
2148 </dl>
2149 </dd></dl>
2150
2151 !! end
2152
2153 !! test
2154 Definition Lists: No nesting: Multiple dd's
2155 !! input
2156 ;x
2157 :a
2158 :b
2159 !! result
2160 <dl><dt>x
2161 </dt><dd>a
2162 </dd><dd>b
2163 </dd></dl>
2164
2165 !! end
2166
2167 !! test
2168 Definition Lists: Indentation: Regular
2169 !! input
2170 :i1
2171 ::i2
2172 :::i3
2173 !! result
2174 <dl><dd>i1
2175 <dl><dd>i2
2176 <dl><dd>i3
2177 </dd></dl>
2178 </dd></dl>
2179 </dd></dl>
2180
2181 !! end
2182
2183 !! test
2184 Definition Lists: Indentation: Missing 1st level
2185 !! input
2186 ::i2
2187 :::i3
2188 !! result
2189 <dl><dd><dl><dd>i2
2190 <dl><dd>i3
2191 </dd></dl>
2192 </dd></dl>
2193 </dd></dl>
2194
2195 !! end
2196
2197 !! test
2198 Definition Lists: Indentation: Multi-level indent
2199 !! input
2200 :::i3
2201 !! result
2202 <dl><dd><dl><dd><dl><dd>i3
2203 </dd></dl>
2204 </dd></dl>
2205 </dd></dl>
2206
2207 !! end
2208
2209 !! test
2210 Definition Lists: Hacky use to indent tables
2211 !! input
2212 ::{|
2213 |foo
2214 |bar
2215 |}
2216 this text
2217 should be left alone
2218 !! result
2219 <dl><dd><dl><dd><table>
2220 <tr>
2221 <td>foo
2222 </td>
2223 <td>bar
2224 </td></tr></table></dd></dl></dd></dl>
2225 <p>this text
2226 should be left alone
2227 </p>
2228 !! end
2229 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2230 ## as an empty dt item. It also ignores all but the last ";" when followed
2231 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2232 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2233 ## ";"s.
2234 ##
2235 ## Ex: ";;t2 ::d2" is transformed into:
2236 ##
2237 ## <dl>
2238 ## <dt>t2 </dt>
2239 ## <dd>
2240 ## <dl>
2241 ## <dt></dt>
2242 ## <dd>d2</dd>
2243 ## </dl>
2244 ## </dd>
2245 ## </dl>
2246 ##
2247 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2248 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2249 ##
2250 ## <dl>
2251 ## <dt>
2252 ## <dl>
2253 ## <dt>t2 </dt>
2254 ## <dd>:d2</dd>
2255 ## </dl>
2256 ## </dt>
2257 ## </dl>
2258 ##
2259 ## All Parsoid only definition list tests have this difference.
2260 ##
2261 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2262 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2263
2264 !! test
2265 Table / list interaction: indented table with lists in table contents
2266 !! input
2267 :{|
2268 |-
2269 | a
2270 * b
2271 |-
2272 | c
2273 * d
2274 |}
2275 !! result
2276 <dl><dd><table>
2277
2278 <tr>
2279 <td> a
2280 <ul><li> b
2281 </li></ul>
2282 </td></tr>
2283 <tr>
2284 <td> c
2285 <ul><li> d
2286 </li></ul>
2287 </td></tr></table></dd></dl>
2288
2289 !! end
2290
2291 !!test
2292 Table / list interaction: lists nested in tables nested in indented lists
2293 !!input
2294 :{|
2295 |
2296 :a
2297 :b
2298 |
2299 *c
2300 *d
2301 |}
2302
2303 *e
2304 *f
2305 !!result
2306 <dl><dd><table>
2307 <tr>
2308 <td>
2309 <dl><dd>a
2310 </dd><dd>b
2311 </dd></dl>
2312 </td>
2313 <td>
2314 <ul><li>c
2315 </li><li>d
2316 </li></ul>
2317 </td></tr></table></dd></dl>
2318 <ul><li>e
2319 </li><li>f
2320 </li></ul>
2321
2322 !!end
2323
2324 !! test
2325 Definition Lists: Nesting: Multi-level (Parsoid only)
2326 !! options
2327 parsoid
2328 !! input
2329 ;t1 :d1
2330 ;;t2 ::d2
2331 ;;;t3 :::d3
2332 !! result
2333 <dl>
2334 <dt>t1 </dt>
2335 <dd>d1</dd>
2336 <dt>
2337 <dl>
2338 <dt>t2 </dt>
2339 <dd>:d2</dd>
2340 <dt>
2341 <dl>
2342 <dt>t3 </dt>
2343 <dd>::d3</dd>
2344 </dl>
2345 </dt>
2346 </dl>
2347 </dt>
2348 </dl>
2349
2350
2351 !! end
2352
2353
2354 !! test
2355 Definition Lists: Nesting: Test 2 (Parsoid only)
2356 !! options
2357 parsoid
2358 !! input
2359 ;t1
2360 ::d2
2361 !! result
2362 <dl>
2363 <dt>t1</dt>
2364 <dd>
2365 <dl>
2366 <dd>d2</dd>
2367 </dl>
2368 </dd>
2369 </dl>
2370
2371 !! end
2372
2373
2374 !! test
2375 Definition Lists: Nesting: Test 3 (Parsoid only)
2376 !! options
2377 parsoid
2378 !! input
2379 :;t1
2380 ::::d2
2381 !! result
2382 <dl>
2383 <dd>
2384 <dl>
2385 <dt>t1</dt>
2386 <dd>
2387 <dl>
2388 <dd>
2389 <dl>
2390 <dd>d2</dd>
2391 </dl>
2392 </dd>
2393 </dl>
2394 </dd>
2395 </dl>
2396 </dd>
2397 </dl>
2398
2399 !! end
2400
2401
2402 !! test
2403 Definition Lists: Nesting: Test 4
2404 !! input
2405 ::;t3
2406 :::d3
2407 !! result
2408 <dl><dd><dl><dd><dl><dt>t3
2409 </dt><dd>d3
2410 </dd></dl>
2411 </dd></dl>
2412 </dd></dl>
2413
2414 !! end
2415
2416
2417 ## The Parsoid team believes the following three test exposes a
2418 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2419 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2420 !! test
2421 Definition Lists: Mixed Lists: Test 1 (php)
2422 !! options
2423 php
2424 !! input
2425 :;* foo
2426 ::* bar
2427 :; baz
2428 !! result
2429 <dl><dd><dl><dt><ul><li> foo
2430 </li><li> bar
2431 </li></ul>
2432 </dt></dl>
2433 <dl><dt> baz
2434 </dt></dl>
2435 </dd></dl>
2436
2437 !! end
2438 !! test
2439 Definition Lists: Mixed Lists: Test 1 (parsoid)
2440 !! options
2441 parsoid
2442 !! input
2443 :;* foo
2444 ::* bar
2445 :; baz
2446 !! result
2447 <dl><dd><dl><dt><ul><li> foo
2448 </li></ul></dt><dd><ul><li> bar
2449 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2450 !! end
2451
2452 !! test
2453 Definition Lists: Mixed Lists: Test 2
2454 !! input
2455 *: d1
2456 *: d2
2457 !! result
2458 <ul><li><dl><dd> d1
2459 </dd><dd> d2
2460 </dd></dl>
2461 </li></ul>
2462
2463 !! end
2464
2465
2466 !! test
2467 Definition Lists: Mixed Lists: Test 3
2468 !! input
2469 *::: d1
2470 *::: d2
2471 !! result
2472 <ul><li><dl><dd><dl><dd><dl><dd> d1
2473 </dd><dd> d2
2474 </dd></dl>
2475 </dd></dl>
2476 </dd></dl>
2477 </li></ul>
2478
2479 !! end
2480
2481
2482 !! test
2483 Definition Lists: Mixed Lists: Test 4
2484 !! input
2485 *;d1 :d2
2486 *;d3 :d4
2487 !! result
2488 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2489 </dd><dt>d3&#160;</dt><dd>d4
2490 </dd></dl>
2491 </li></ul>
2492
2493 !! end
2494
2495
2496 !! test
2497 Definition Lists: Mixed Lists: Test 5
2498 !! input
2499 *:d1
2500 *:: d2
2501 !! result
2502 <ul><li><dl><dd>d1
2503 <dl><dd> d2
2504 </dd></dl>
2505 </dd></dl>
2506 </li></ul>
2507
2508 !! end
2509
2510
2511 !! test
2512 Definition Lists: Mixed Lists: Test 6
2513 !! input
2514 #*:d1
2515 #*::: d3
2516 !! result
2517 <ol><li><ul><li><dl><dd>d1
2518 <dl><dd><dl><dd> d3
2519 </dd></dl>
2520 </dd></dl>
2521 </dd></dl>
2522 </li></ul>
2523 </li></ol>
2524
2525 !! end
2526
2527
2528 !! test
2529 Definition Lists: Mixed Lists: Test 7
2530 !! input
2531 :* d1
2532 :* d2
2533 !! result
2534 <dl><dd><ul><li> d1
2535 </li><li> d2
2536 </li></ul>
2537 </dd></dl>
2538
2539 !! end
2540
2541
2542 !! test
2543 Definition Lists: Mixed Lists: Test 8
2544 !! input
2545 :* d1
2546 ::* d2
2547 !! result
2548 <dl><dd><ul><li> d1
2549 </li></ul>
2550 <dl><dd><ul><li> d2
2551 </li></ul>
2552 </dd></dl>
2553 </dd></dl>
2554
2555 !! end
2556
2557
2558 !! test
2559 Definition Lists: Mixed Lists: Test 9
2560 !! input
2561 *;foo :bar
2562 !! result
2563 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2564 </dd></dl>
2565 </li></ul>
2566
2567 !! end
2568
2569
2570 !! test
2571 Definition Lists: Mixed Lists: Test 10
2572 !! input
2573 *#;foo :bar
2574 !! result
2575 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2576 </dd></dl>
2577 </li></ol>
2578 </li></ul>
2579
2580 !! end
2581
2582 # The Parsoid team disagrees with the PHP parser's seemingly-random
2583 # rules regarding dd/dt on the next two tests. Parsoid is more
2584 # consistent, and recognizes the shared nesting and keeps the
2585 # still-open tags around until the nesting is complete.
2586
2587 !! test
2588 Definition Lists: Mixed Lists: Test 11 (php)
2589 !! options
2590 php
2591 !! input
2592 *#*#;*;;foo :bar
2593 *#*#;boo :baz
2594 !! result
2595 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2596 </dt></dl>
2597 </dd></dl>
2598 </li></ul>
2599 </dd></dl>
2600 <dl><dt>boo&#160;</dt><dd>baz
2601 </dd></dl>
2602 </li></ol>
2603 </li></ul>
2604 </li></ol>
2605 </li></ul>
2606
2607 !! end
2608 !! test
2609 Definition Lists: Mixed Lists: Test 11 (parsoid)
2610 !! options
2611 parsoid
2612 !! input
2613 *#*#;*;;foo :bar
2614 *#*#;boo :baz
2615 !! result
2616 <ul>
2617 <li>
2618 <ol>
2619 <li>
2620 <ul>
2621 <li>
2622 <ol>
2623 <li>
2624 <dl>
2625 <dt>
2626 <ul>
2627 <li>
2628 <dl>
2629 <dt>
2630 <dl>
2631 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2632 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2633 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2634 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2635 !! end
2636
2637
2638 !! test
2639 Definition Lists: Weird Ones: Test 1 (php)
2640 !! options
2641 php
2642 !! input
2643 *#;*::;; foo : bar (who uses this?)
2644 !! result
2645 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2646 </dt></dl>
2647 </dd></dl>
2648 </dd></dl>
2649 </dd></dl>
2650 </li></ul>
2651 </dd></dl>
2652 </li></ol>
2653 </li></ul>
2654
2655 !! end
2656 !! test
2657 Definition Lists: Weird Ones: Test 1 (parsoid)
2658 !! options
2659 parsoid
2660 !! input
2661 *#;*::;; foo : bar (who uses this?)
2662 !! result
2663 <ul>
2664 <li>
2665 <ol>
2666 <li>
2667 <dl>
2668 <dt>
2669 <ul>
2670 <li>
2671 <dl>
2672 <dd>
2673 <dl>
2674 <dd>
2675 <dl>
2676 <dt>
2677 <dl>
2678 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2679 <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>
2680 !! end
2681
2682 ###
2683 ### External links
2684 ###
2685 !! test
2686 External links: non-bracketed
2687 !! input
2688 Non-bracketed: http://example.com
2689 !! result
2690 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2691 </p>
2692 !! end
2693
2694 !! test
2695 External links: numbered
2696 !! input
2697 Numbered: [http://example.com]
2698 Numbered: [http://example.net]
2699 Numbered: [http://example.com]
2700 !! result
2701 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2702 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2703 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2704 </p>
2705 !!end
2706
2707 !! test
2708 External links: specified text
2709 !! input
2710 Specified text: [http://example.com link]
2711 !! result
2712 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2713 </p>
2714 !!end
2715
2716 !! test
2717 External links: trail
2718 !! input
2719 Linktrails should not work for external links: [http://example.com link]s
2720 !! result
2721 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2722 </p>
2723 !! end
2724
2725 !! test
2726 External links: dollar sign in URL
2727 !! input
2728 http://example.com/1$2345
2729 !! result
2730 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2731 </p>
2732 !! end
2733
2734 !! test
2735 External links: dollar sign in URL (named)
2736 !! input
2737 [http://example.com/1$2345]
2738 !! result
2739 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2740 </p>
2741 !!end
2742
2743 !! test
2744 External links: open square bracket forbidden in URL (bug 4377)
2745 !! input
2746 http://example.com/1[2345
2747 !! result
2748 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2749 </p>
2750 !! end
2751
2752 !! test
2753 External links: open square bracket forbidden in URL (named) (bug 4377)
2754 !! input
2755 [http://example.com/1[2345]
2756 !! result
2757 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2758 </p>
2759 !!end
2760
2761 !! test
2762 External links: nowiki in URL link text (bug 6230)
2763 !!input
2764 [http://example.com/ <nowiki>''example site''</nowiki>]
2765 !! result
2766 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2767 </p>
2768 !! end
2769
2770 !! test
2771 External links: newline forbidden in text (bug 6230 regression check)
2772 !! input
2773 [http://example.com/ first
2774 second]
2775 !! result
2776 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2777 second]
2778 </p>
2779 !!end
2780
2781 !! test
2782 External links: Pipe char between url and text
2783 !! input
2784 [http://example.com | link]
2785 !! result
2786 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2787 </p>
2788 !!end
2789
2790 !! test
2791 External links: protocol-relative URL in brackets
2792 !! input
2793 [//example.com/ Test]
2794 !! result
2795 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2796 </p>
2797 !! end
2798
2799 !! test
2800 External links: protocol-relative URL in brackets without text
2801 !! input
2802 [//example.com]
2803 !! result
2804 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2805 </p>
2806 !! end
2807
2808 !! test
2809 External links: protocol-relative URL in free text is left alone
2810 !! input
2811 //example.com/Foo
2812 !! result
2813 <p>//example.com/Foo
2814 </p>
2815 !!end
2816
2817 !! test
2818 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2819 !! input
2820 foo//example.com/Foo
2821 !! result
2822 <p>foo//example.com/Foo
2823 </p>
2824 !! end
2825
2826 !! test
2827 External image
2828 !! input
2829 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2830 !! result
2831 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2832 </p>
2833 !! end
2834
2835 !! test
2836 External image from https
2837 !! input
2838 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2839 !! result
2840 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2841 </p>
2842 !! end
2843
2844 !! test
2845 External image (when not allowed)
2846 !! options
2847 wgAllowExternalImages=0
2848 !! input
2849 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2850 !! result
2851 <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>
2852 </p>
2853 !! end
2854
2855 !! test
2856 Link to non-http image, no img tag
2857 !! input
2858 Link to non-http image, no img tag: ftp://example.com/test.jpg
2859 !! result
2860 <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>
2861 </p>
2862 !! end
2863
2864 !! test
2865 External links: terminating separator
2866 !! input
2867 Terminating separator: http://example.com/thing,
2868 !! result
2869 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2870 </p>
2871 !! end
2872
2873 !! test
2874 External links: intervening separator
2875 !! input
2876 Intervening separator: http://example.com/1,2,3
2877 !! result
2878 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2879 </p>
2880 !! end
2881
2882 !! test
2883 External links: old bug with URL in query
2884 !! input
2885 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2886 !! result
2887 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2888 </p>
2889 !! end
2890
2891 !! test
2892 External links: old URL-in-URL bug, mixed protocols
2893 !! input
2894 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2895 !! result
2896 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2897 </p>
2898 !!end
2899
2900 !! test
2901 External links: URL in text
2902 !! input
2903 URL in text: [http://example.com http://example.com]
2904 !! result
2905 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2906 </p>
2907 !! end
2908
2909 !! test
2910 External links: Clickable images
2911 !! input
2912 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2913 !! result
2914 <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>
2915 </p>
2916 !!end
2917
2918 !! test
2919 External links: raw ampersand
2920 !! input
2921 Old &amp; use: http://x&y
2922 !! result
2923 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2924 </p>
2925 !! end
2926
2927 !! test
2928 External links: encoded ampersand
2929 !! input
2930 Old &amp; use: http://x&amp;y
2931 !! result
2932 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2933 </p>
2934 !! end
2935
2936 !! test
2937 External links: encoded equals (bug 6102)
2938 !! input
2939 http://example.com/?foo&#61;bar
2940 !! result
2941 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2942 </p>
2943 !! end
2944
2945 !! test
2946 External links: [raw ampersand]
2947 !! input
2948 Old &amp; use: [http://x&y]
2949 !! result
2950 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2951 </p>
2952 !! end
2953
2954 !! test
2955 External links: [encoded ampersand]
2956 !! input
2957 Old &amp; use: [http://x&amp;y]
2958 !! result
2959 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2960 </p>
2961 !! end
2962
2963 !! test
2964 External links: [encoded equals] (bug 6102)
2965 !! input
2966 [http://example.com/?foo&#61;bar]
2967 !! result
2968 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2969 </p>
2970 !! end
2971
2972 !! test
2973 External links: [IDN ignored character reference in hostname; strip it right off]
2974 !! input
2975 [http://e&zwnj;xample.com/]
2976 !! result
2977 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2978 </p>
2979 !! end
2980
2981 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2982 # Where an external link could easily circumvent the sanitization of the text of
2983 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2984 # test demands a higher standard. That's a bit strange.
2985 #
2986 # Example:
2987 #
2988 # http://e‌xample.com -> [http://example.com|http://example.com]
2989 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2990 #
2991 # The first example is sanitized, but the second is not. Any security benefits
2992 # from this production are trivial to circumvent. Either remove this test and
2993 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2994 # the test accordingly.
2995 #
2996 # All our love,
2997 # The Parsoid team.
2998 !! test
2999 External links: IDN ignored character reference in hostname; strip it right off
3000 !! input
3001 http://e&zwnj;xample.com/
3002 !! result
3003 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3004 </p>
3005 !! end
3006
3007 !! test
3008 External links: www.jpeg.org (bug 554)
3009 !! input
3010 http://www.jpeg.org
3011 !!result
3012 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3013 </p>
3014 !! end
3015
3016 !! test
3017 External links: URL within URL (original bug 2)
3018 !! input
3019 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3020 !! result
3021 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3022 </p>
3023 !! end
3024
3025 !! test
3026 BUG 361: URL inside bracketed URL
3027 !! input
3028 [http://www.example.com/foo http://www.example.com/bar]
3029 !! result
3030 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3031 </p>
3032 !! end
3033
3034 !! test
3035 BUG 361: URL within URL, not bracketed
3036 !! input
3037 http://www.example.com/foo?=http://www.example.com/bar
3038 !! result
3039 <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>
3040 </p>
3041 !! end
3042
3043 !! test
3044 BUG 289: ">"-token in URL-tail
3045 !! input
3046 http://www.example.com/<hello>
3047 !! result
3048 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3049 </p>
3050 !!end
3051
3052 !! test
3053 BUG 289: literal ">"-token in URL-tail
3054 !! input
3055 http://www.example.com/<b>html</b>
3056 !! result
3057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3058 </p>
3059 !!end
3060
3061 !! test
3062 BUG 289: ">"-token in bracketed URL
3063 !! input
3064 [http://www.example.com/<hello> stuff]
3065 !! result
3066 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3067 </p>
3068 !!end
3069
3070 !! test
3071 BUG 289: literal ">"-token in bracketed URL
3072 !! input
3073 [http://www.example.com/<b>html</b> stuff]
3074 !! result
3075 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3076 </p>
3077 !!end
3078
3079 !! test
3080 BUG 289: literal double quote at end of URL
3081 !! input
3082 http://www.example.com/"hello"
3083 !! result
3084 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3085 </p>
3086 !!end
3087
3088 !! test
3089 BUG 289: literal double quote in bracketed URL
3090 !! input
3091 [http://www.example.com/"hello" stuff]
3092 !! result
3093 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3094 </p>
3095 !!end
3096
3097 !! test
3098 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3099 !! input
3100 [http://www.example.com test]
3101 !! result
3102 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3103 </p>
3104 !! end
3105
3106 !! test
3107 External links: link text with spaces
3108 !! input
3109 [http://www.example.com a b c]
3110 [http://www.example.com ''a'' ''b'']
3111 !! result
3112 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3113 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3114 </p>
3115 !! end
3116
3117 !! test
3118 External links: wiki links within external link (Bug 3695)
3119 !! input
3120 [http://example.com [[wikilink]] embedded in ext link]
3121 !! result
3122 <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>
3123 </p>
3124 !! end
3125
3126 !! test
3127 BUG 787: Links with one slash after the url protocol are invalid
3128 !! input
3129 http:/example.com
3130
3131 [http:/example.com title]
3132 !! result
3133 <p>http:/example.com
3134 </p><p>[http:/example.com title]
3135 </p>
3136 !! end
3137
3138 !! test
3139 Bracketed external links with template-generated invalid target
3140 !! input
3141 [{{echo|http:/example.com}} title]
3142 !! result
3143 <p>[http:/example.com title]
3144 </p>
3145 !! end
3146
3147 !! test
3148 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3149 !! input
3150 ''[http://example.com text'']
3151 [http://example.com '''text]'''
3152 ''Something [http://example.com in italic'']
3153 ''Something [http://example.com mixed''''', even bold]'''
3154 '''''Now [http://example.com both''''']
3155 !! result
3156 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3157 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3158 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3159 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3160 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3161 </p>
3162 !! end
3163
3164
3165 !! test
3166 Bug 4781: %26 in URL
3167 !! input
3168 http://www.example.com/?title=AT%26T
3169 !! result
3170 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3171 </p>
3172 !! end
3173
3174 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3175 # % is actually legal in HTML5. Any change in output would need testing though.
3176 !! test
3177 Bug 4781, 5267: %25 in URL
3178 !! input
3179 http://www.example.com/?title=100%25_Bran
3180 !! result
3181 <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>
3182 </p>
3183 !! end
3184
3185 !! test
3186 Bug 4781, 5267: %28, %29 in URL
3187 !! input
3188 http://www.example.com/?title=Ben-Hur_%281959_film%29
3189 !! result
3190 <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>
3191 </p>
3192 !! end
3193
3194
3195 !! test
3196 Bug 4781: %26 in autonumber URL
3197 !! input
3198 [http://www.example.com/?title=AT%26T]
3199 !! result
3200 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3201 </p>
3202 !! end
3203
3204 !! test
3205 Bug 4781, 5267: %26 in autonumber URL
3206 !! input
3207 [http://www.example.com/?title=100%25_Bran]
3208 !! result
3209 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3210 </p>
3211 !! end
3212
3213 !! test
3214 Bug 4781, 5267: %28, %29 in autonumber URL
3215 !! input
3216 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3217 !! result
3218 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3219 </p>
3220 !! end
3221
3222
3223 !! test
3224 Bug 4781: %26 in bracketed URL
3225 !! input
3226 [http://www.example.com/?title=AT%26T link]
3227 !! result
3228 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3229 </p>
3230 !! end
3231
3232 !! test
3233 Bug 4781, 5267: %26 in bracketed URL
3234 !! input
3235 [http://www.example.com/?title=100%25_Bran link]
3236 !! result
3237 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3238 </p>
3239 !! end
3240
3241 !! test
3242 Bug 4781, 5267: %28, %29 in bracketed URL
3243 !! input
3244 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3245 !! result
3246 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3247 </p>
3248 !! end
3249
3250 !! test
3251 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3252 !! input
3253 Some [http://example.com/ pretty ''italics'' and stuff]!
3254 !! result
3255 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3256 </p>
3257 !! end
3258
3259 !! test
3260 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3261 !! input
3262 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3263 !! result
3264 <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>
3265 </p>
3266 !! end
3267
3268 !! test
3269 External link containing double-single-quotes with no space separating the url from text in italics
3270 !! input
3271 [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]].]
3272 !! result
3273 <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>
3274 </p>
3275 !! end
3276
3277 !! test
3278 External link with comments in link text
3279 !! input
3280 [http://www.google.com Google <!-- comment -->]
3281 !! result
3282 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3283 </p>
3284 !! end
3285
3286 !! test
3287 URL-encoding in URL functions (single parameter)
3288 !! input
3289 {{localurl:Some page|amp=&}}
3290 !! result
3291 <p>/index.php?title=Some_page&amp;amp=&amp;
3292 </p>
3293 !! end
3294
3295 !! test
3296 URL-encoding in URL functions (multiple parameters)
3297 !! input
3298 {{localurl:Some page|q=?&amp=&}}
3299 !! result
3300 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3301 </p>
3302 !! end
3303
3304 !! test
3305 Brackets in urls
3306 !! input
3307 http://example.com/index.php?foozoid%5B%5D=bar
3308
3309 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3310 !! result
3311 <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>
3312 </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>
3313 </p>
3314 !! end
3315
3316 !! test
3317 IPv6 urls (bug 21261)
3318 !! options
3319 disabled
3320 !! input
3321 http://[2404:130:0:1000::187:2]/index.php
3322 !! result
3323 <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>
3324 </p>
3325 !! end
3326
3327 !! test
3328 Non-extlinks in brackets
3329 !! input
3330 [foo]
3331 [foo bar]
3332 [foo ''bar'']
3333 [fool's] errand
3334 [fool's errand]
3335 [{{echo|foo}}]
3336 [{{echo|foo}} bar]
3337 [{{echo|foo}} ''bar'']
3338 [{{echo|foo}}l's] errand
3339 [{{echo|foo}}l's errand]
3340 [url={{echo|foo}}]
3341 [url=http://example.com]
3342 !! result
3343 <p>[foo]
3344 [foo bar]
3345 [foo <i>bar</i>]
3346 [fool's] errand
3347 [fool's errand]
3348 [foo]
3349 [foo bar]
3350 [foo <i>bar</i>]
3351 [fool's] errand
3352 [fool's errand]
3353 [url=foo]
3354 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3355 </p>
3356 !! end
3357
3358 !! test
3359 Parsoid: Percent encoding in external links
3360 !! options
3361 parsoid
3362 !! input
3363 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3364 !! result
3365 <p><a rel="mw:ExtLink"
3366 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3367 !! end
3368
3369 !! test
3370 Parsoid: use url link syntax for links where the content is equal the link
3371 target
3372 !! options
3373 parsoid
3374 !! input
3375 http://example.com
3376 !! result
3377 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3378 !! end
3379
3380 ###
3381 ### Quotes
3382 ###
3383
3384 !! test
3385 Quotes
3386 !! input
3387 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3388
3389 Normal text. '''''Bold italic text.''''' Normal text.
3390 !!result
3391 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3392 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3393 </p>
3394 !! end
3395
3396
3397 !! test
3398 Unclosed and unmatched quotes (php)
3399 !! options
3400 php
3401 !! input
3402 '''''Bold italic text '''with bold deactivated''' in between.'''''
3403
3404 '''''Bold italic text ''with italic deactivated'' in between.'''''
3405
3406 '''Bold text..
3407
3408 ..spanning two paragraphs (should not work).'''
3409
3410 '''Bold tag left open
3411
3412 ''Italic tag left open
3413
3414 Normal text.
3415
3416 <!-- Unmatching number of opening, closing tags: -->
3417 '''This year''''s election ''should'' beat '''last year''''s.
3418
3419 ''Tom'''s car is bigger than ''Susan'''s.
3420
3421 Plain ''italic'''s plain
3422 !! result
3423 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3424 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3425 </p><p><b>Bold text..</b>
3426 </p><p>..spanning two paragraphs (should not work).
3427 </p><p><b>Bold tag left open</b>
3428 </p><p><i>Italic tag left open</i>
3429 </p><p>Normal text.
3430 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3431 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3432 </p><p>Plain <i>italic'</i>s plain
3433 </p>
3434 !! end
3435 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3436 # parser strips. The wikitext contains just the first half of the bold
3437 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3438 # differently than the PHP parser.)
3439 !! test
3440 Unclosed and unmatched quotes (parsoid)
3441 !! options
3442 parsoid
3443 !! input
3444 '''''Bold italic text '''with bold deactivated''' in between.'''''
3445
3446 '''''Bold italic text ''with italic deactivated'' in between.'''''
3447
3448 '''Bold text..
3449
3450 ..spanning two paragraphs (should not work).'''
3451
3452 '''Bold tag left open
3453
3454 ''Italic tag left open
3455
3456 Normal text.
3457
3458 <!-- Unmatching number of opening, closing tags: -->
3459 '''This year''''s election ''should'' beat '''last year''''s.
3460
3461 ''Tom'''s car is bigger than ''Susan'''s.
3462
3463 Plain ''italic'''s plain
3464 !! result
3465 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3466 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3467 </p><p><b>Bold text..</b>
3468 </p><p>..spanning two paragraphs (should not work).<b></b>
3469 </p><p><b>Bold tag left open</b>
3470 </p><p><i>Italic tag left open</i>
3471 </p><p>Normal text.
3472 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3473 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3474 </p><p>Plain <i>italic'</i>s plain
3475 </p>
3476 !! end
3477
3478 ###
3479 ### Tables
3480 ###
3481 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3482 ###
3483
3484 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3485 # is the bare minimum required by the spec, see:
3486 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3487 !! test
3488 A table with no data. (php)
3489 !! options
3490 php
3491 !! input
3492 {||}
3493 !! result
3494 !! end
3495 # Parsoid team replies: empty table tags are legal in HTML5
3496 !! test
3497 A table with no data. (parsoid)
3498 !! options
3499 parsoid
3500 !! input
3501 {||}
3502 !! result
3503 <table></table>
3504 !! end
3505
3506 # A table with nothing but a caption is invalid XHTML, we might want to render
3507 # this as <p>caption</p>
3508 !! test
3509 A table with nothing but a caption (php)
3510 !! options
3511 php
3512 !! input
3513 {|
3514 |+ caption
3515 |}
3516 !! result
3517 <table>
3518 <caption> caption
3519 </caption><tr><td></td></tr></table>
3520
3521 !! end
3522 # Parsoid team replies: table with only a caption is legal in HTML5
3523 !! test
3524 A table with nothing but a caption (parsoid)
3525 !! options
3526 parsoid
3527 !! input
3528 {|
3529 |+ caption
3530 |}
3531 !! result
3532 <table><caption> caption</caption></table>
3533 !! end
3534
3535 !! test
3536 A table with caption with default-spaced attributes and a table row
3537 !! input
3538 {|
3539 |+ style="color: red;" | caption1
3540 |-
3541 | foo
3542 |}
3543 !! result
3544 <table>
3545 <caption style="color: red;"> caption1
3546 </caption>
3547 <tr>
3548 <td> foo
3549 </td></tr></table>
3550
3551 !! end
3552
3553 !! test
3554 A table with captions with non-default spaced attributes and a table row
3555 !! input
3556 {|
3557 |+style="color: red;"|caption2
3558 |+ style="color: red;"| caption3
3559 |-
3560 | foo
3561 |}
3562 !! result
3563 <table>
3564 <caption style="color: red;">caption2
3565 </caption>
3566 <caption style="color: red;"> caption3
3567 </caption>
3568 <tr>
3569 <td> foo
3570 </td></tr></table>
3571
3572 !! end
3573
3574 !! test
3575 Table td-cell syntax variations
3576 !! input
3577 {|
3578 | foo bar foo | baz
3579 | foo bar foo || baz
3580 | style='color:red;' | baz
3581 | style='color:red;' || baz
3582 |}
3583 !! result
3584 <table>
3585 <tr>
3586 <td> baz
3587 </td>
3588 <td> foo bar foo </td>
3589 <td> baz
3590 </td>
3591 <td style="color:red;"> baz
3592 </td>
3593 <td> style='color:red;' </td>
3594 <td> baz
3595 </td></tr></table>
3596
3597 !! end
3598
3599 !! test
3600 Simple table
3601 !! input
3602 {|
3603 | 1 || 2
3604 |-
3605 | 3 || 4
3606 |}
3607 !! result
3608 <table>
3609 <tr>
3610 <td> 1 </td>
3611 <td> 2
3612 </td></tr>
3613 <tr>
3614 <td> 3 </td>
3615 <td> 4
3616 </td></tr></table>
3617
3618 !! end
3619
3620 !! test
3621 Simple table but with multiple dashes for row wikitext
3622 !! input
3623 {|
3624 | foo
3625 |-----
3626 | bar
3627 |}
3628 !! result
3629 <table>
3630 <tr>
3631 <td> foo
3632 </td></tr>
3633 <tr>
3634 <td> bar
3635 </td></tr></table>
3636
3637 !! end
3638 !! test
3639 Multiplication table
3640 !! input
3641 {| border="1" cellpadding="2"
3642 |+Multiplication table
3643 |-
3644 ! &times; !! 1 !! 2 !! 3
3645 |-
3646 ! 1
3647 | 1 || 2 || 3
3648 |-
3649 ! 2
3650 | 2 || 4 || 6
3651 |-
3652 ! 3
3653 | 3 || 6 || 9
3654 |-
3655 ! 4
3656 | 4 || 8 || 12
3657 |-
3658 ! 5
3659 | 5 || 10 || 15
3660 |}
3661 !! result
3662 <table border="1" cellpadding="2">
3663 <caption>Multiplication table
3664 </caption>
3665 <tr>
3666 <th> &#215; </th>
3667 <th> 1 </th>
3668 <th> 2 </th>
3669 <th> 3
3670 </th></tr>
3671 <tr>
3672 <th> 1
3673 </th>
3674 <td> 1 </td>
3675 <td> 2 </td>
3676 <td> 3
3677 </td></tr>
3678 <tr>
3679 <th> 2
3680 </th>
3681 <td> 2 </td>
3682 <td> 4 </td>
3683 <td> 6
3684 </td></tr>
3685 <tr>
3686 <th> 3
3687 </th>
3688 <td> 3 </td>
3689 <td> 6 </td>
3690 <td> 9
3691 </td></tr>
3692 <tr>
3693 <th> 4
3694 </th>
3695 <td> 4 </td>
3696 <td> 8 </td>
3697 <td> 12
3698 </td></tr>
3699 <tr>
3700 <th> 5
3701 </th>
3702 <td> 5 </td>
3703 <td> 10 </td>
3704 <td> 15
3705 </td></tr></table>
3706
3707 !! end
3708
3709 !! test
3710 Accept "||" in table headings
3711 !! input
3712 {|
3713 !h1 || h2
3714 |}
3715 !! result
3716 <table>
3717 <tr>
3718 <th>h1 </th>
3719 <th> h2
3720 </th></tr></table>
3721
3722 !! end
3723
3724 !! test
3725 Accept "||" in indented table headings
3726 !! input
3727 :{|
3728 !h1 || h2
3729 |}
3730 !! result
3731 <dl><dd><table>
3732 <tr>
3733 <th>h1 </th>
3734 <th> h2
3735 </th></tr></table></dd></dl>
3736
3737 !! end
3738
3739 !! test
3740 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3741 !! input
3742 {|
3743 !| h1
3744 || a
3745 |}
3746 !! result
3747 <table>
3748 <tr>
3749 <th> h1
3750 </th>
3751 <td> a
3752 </td></tr></table>
3753
3754 !! end
3755
3756 !!test
3757 Accept "| !" at start of line in tables (ignore !-attribute)
3758 !!input
3759 {|
3760 |-
3761 | !style="color:red" | bar
3762 |}
3763 !!result
3764 <table>
3765
3766 <tr>
3767 <td> bar
3768 </td></tr></table>
3769
3770 !!end
3771
3772 !!test
3773 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 +/-
3774 !!input
3775 {|
3776 |-
3777 |style='color:red;'|+1
3778 |style='color:blue;'|-1
3779 |-
3780 | 1 || 2 || 3
3781 | 1 ||+2 ||-3
3782 |-
3783 | +1
3784 | -1
3785 |}
3786 !!result
3787 <table>
3788
3789 <tr>
3790 <td style="color:red;">+1
3791 </td>
3792 <td style="color:blue;">-1
3793 </td></tr>
3794 <tr>
3795 <td> 1 </td>
3796 <td> 2 </td>
3797 <td> 3
3798 </td>
3799 <td> 1 </td>
3800 <td>+2 </td>
3801 <td>-3
3802 </td></tr>
3803 <tr>
3804 <td> +1
3805 </td>
3806 <td> -1
3807 </td></tr></table>
3808
3809 !!end
3810
3811 !! test
3812 Table rowspan
3813 !! input
3814 {| border=1
3815 | Cell 1, row 1
3816 |rowspan=2| Cell 2, row 1 (and 2)
3817 | Cell 3, row 1
3818 |-
3819 | Cell 1, row 2
3820 | Cell 3, row 2
3821 |}
3822 !! result
3823 <table border="1">
3824 <tr>
3825 <td> Cell 1, row 1
3826 </td>
3827 <td rowspan="2"> Cell 2, row 1 (and 2)
3828 </td>
3829 <td> Cell 3, row 1
3830 </td></tr>
3831 <tr>
3832 <td> Cell 1, row 2
3833 </td>
3834 <td> Cell 3, row 2
3835 </td></tr></table>
3836
3837 !! end
3838
3839 !! test
3840 Nested table
3841 !! input
3842 {| border=1
3843 | &alpha;
3844 |
3845 {| bgcolor=#ABCDEF border=2
3846 |nested
3847 |-
3848 |table
3849 |}
3850 |the original table again
3851 |}
3852 !! result
3853 <table border="1">
3854 <tr>
3855 <td> &#945;
3856 </td>
3857 <td>
3858 <table bgcolor="#ABCDEF" border="2">
3859 <tr>
3860 <td>nested
3861 </td></tr>
3862 <tr>
3863 <td>table
3864 </td></tr></table>
3865 </td>
3866 <td>the original table again
3867 </td></tr></table>
3868
3869 !! end
3870
3871 !! test
3872 Invalid attributes in table cell (bug 1830)
3873 !! input
3874 {|
3875 |Cell:|broken
3876 |}
3877 !! result
3878 <table>
3879 <tr>
3880 <td>broken
3881 </td></tr></table>
3882
3883 !! end
3884
3885
3886 !! test
3887 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3888 !! input
3889 {|
3890 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3891 !! result
3892 <table>
3893 <tr>
3894 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3895 <td>]" onmouseover="alert(document.cookie)"&gt;test
3896 </td>
3897 </tr>
3898 </table>
3899
3900 !! end
3901
3902
3903 !! test
3904 Indented table markup mixed with indented pre content (proposed in bug 6200)
3905 !! input
3906 <table>
3907 <tr>
3908 <td>
3909 Text that should be rendered preformatted
3910 </td>
3911 </tr>
3912 </table>
3913 !! result
3914 <table>
3915 <tr>
3916 <td>
3917 <pre>Text that should be rendered preformatted
3918 </pre>
3919 </td>
3920 </tr>
3921 </table>
3922
3923 !! end
3924
3925 !! test
3926 Template-generated table cell attributes and cell content
3927 !! input
3928 {|
3929 |{{table_attribs}}
3930 |}
3931 !! result
3932 <table>
3933 <tr>
3934 <td style="color: red"> Foo
3935 </td></tr></table>
3936
3937 !! end
3938
3939 !! test
3940 Template-generated table cell attributes and cell content (2)
3941 !! input
3942 {|
3943 |align=center {{table_attribs}}
3944 |}
3945 !! result
3946 <table>
3947 <tr>
3948 <td align="center" style="color: red"> Foo
3949 </td></tr></table>
3950
3951 !! end
3952
3953 !! test
3954 Template-generated table cell attributes and cell content (3)
3955 !! input
3956 {|
3957 |align=center {{table_cells}}
3958 |}
3959 !! result
3960 <table>
3961 <tr>
3962 <td align="center" style="color: red"> Foo </td>
3963 <td> Bar </td>
3964 <td> Baz
3965 </td></tr></table>
3966
3967 !! end
3968
3969 !! test
3970 Table with row followed by newlines and table heading
3971 !! input
3972 {|
3973 |-
3974
3975 ! foo
3976 |}
3977 !! result
3978 <table>
3979
3980
3981 <tr>
3982 <th> foo
3983 </th></tr></table>
3984
3985 !! end
3986
3987 !! test
3988 Table with empty line following the start tag
3989 !! input
3990 {|
3991
3992 |-
3993 | foo
3994 |}
3995 !! result
3996 <table>
3997
3998
3999 <tr>
4000 <td> foo
4001 </td></tr></table>
4002
4003 !! end
4004
4005 # FIXME: Preserve the attribute properly (with an empty string as value) in
4006 # the PHP parser. Parsoid implements the behavior below.
4007 !! test
4008 Table attributes with empty value
4009 !! options
4010 parsoid
4011 !! input
4012 {|
4013 | style=| hello
4014 |}
4015 !! result
4016 <table>
4017 <tbody>
4018 <tr>
4019 <td style=""> hello
4020 </td></tr></tbody></table>
4021
4022 !! end
4023
4024 !! test
4025 Wikitext table with a lot of comments
4026 !! input
4027 {|
4028 <!-- c0 -->
4029 | foo
4030 <!-- c1 -->
4031 |- <!-- c2 -->
4032 <!-- c3 -->
4033 |<!-- c4 -->
4034 <!-- c5 -->
4035 |}
4036 !! result
4037 <table>
4038 <tr>
4039 <td> foo
4040 </td></tr>
4041 <tr>
4042 <td>
4043 </td></tr></table>
4044
4045 !! end
4046
4047 !! test
4048 Wikitext table with double-line table cell
4049 !! input
4050 {|
4051 |a
4052 b
4053 |}
4054 !! result
4055 <table>
4056 <tr>
4057 <td>a
4058 <p>b
4059 </p>
4060 </td></tr></table>
4061
4062 !! end
4063
4064 !! test
4065 Table cell with a single comment
4066 !! input
4067 {|
4068 | <!-- c1 -->
4069 | a
4070 |}
4071 !! result
4072 <table>
4073 <tr>
4074 <td>
4075 </td>
4076 <td> a
4077 </td></tr></table>
4078
4079 !! end
4080
4081 # The expected HTML structure in this test is debatable. The PHP parser does
4082 # not parse this kind of table at all. The main focus for Parsoid is on
4083 # round-tripping, so this output is ok for now. TODO: revisit!
4084 !! test
4085 Wikitext table with html-syntax row (Parsoid)
4086 !! options
4087 parsoid
4088 !! input
4089 {|
4090 |-
4091 <td>foo</td>
4092 |}
4093 !! result
4094 <table>
4095 <tbody>
4096 <tr>
4097 <td>foo</td></tr></tbody></table>
4098 !! end
4099
4100 !! test
4101 Implicit <td> after a |-
4102 (PHP parser relies on Tidy to add the missing <td> tags)
4103 !! options
4104 parsoid=wt2html,wt2wt
4105 !! input
4106 {|
4107 |-
4108 a
4109 |}
4110 !! result
4111 <table>
4112 <tr><td>a</td></tr>
4113 </table>
4114 !! end
4115
4116 !! test
4117 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4118 (PHP parser relies on Tidy to add the missing <td> tags)
4119 !! options
4120 parsoid=wt2html,wt2wt
4121 !! input
4122 {|
4123 |-
4124 |
4125 a
4126 |-
4127 b
4128 |}
4129 !! result
4130 <table>
4131 <tbody>
4132 <tr><td><pre>a</pre></td></tr>
4133 <tr><td> b</td></tr>
4134 </tbody>
4135 </table>
4136 !! end
4137
4138 !! test
4139 Lists should be recognized in an implicit <td> context
4140 (PHP parser relies on Tidy to add the missing <td> tags)
4141 !! options
4142 parsoid=wt2html,wt2wt
4143 !! input
4144 {|
4145 |-
4146 *a
4147 |}
4148 !! result
4149 <table>
4150 <tr>
4151 <td><ul><li>a</li></ul></td>
4152 </tr>
4153 </table>
4154 !! end
4155
4156 ###
4157 ### Internal links
4158 ###
4159 !! test
4160 Plain link, capitalized
4161 !! input
4162 [[Main Page]]
4163 !! result
4164 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4165 </p>
4166 !! end
4167
4168 !! test
4169 Plain link, uncapitalized
4170 !! input
4171 [[main Page]]
4172 !! result
4173 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4174 </p>
4175 !! end
4176
4177 !! test
4178 Piped link
4179 !! input
4180 [[Main Page|The Main Page]]
4181 !! result
4182 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4183 </p>
4184 !! end
4185
4186 !! test
4187 Piped link with comment in link text
4188 !! input
4189 [[Main Page|The Main<!--front--> Page]]
4190 !! result
4191 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4192 </p>
4193 !! end
4194
4195 !! test
4196 Broken link
4197 !! input
4198 [[Zigzagzogzagzig]]
4199 !! result
4200 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4201 </p>
4202 !! end
4203
4204 !! test
4205 Broken link with fragment
4206 !! input
4207 [[Zigzagzogzagzig#zug]]
4208 !! result
4209 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4210 </p>
4211 !! end
4212
4213 !! test
4214 Special page link with fragment
4215 !! input
4216 [[Special:Version#anchor]]
4217 !! result
4218 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4219 </p>
4220 !! end
4221
4222 !! test
4223 Nonexistent special page link with fragment
4224 !! input
4225 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4226 !! result
4227 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Link with prefix
4233 !! input
4234 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4235 !! result
4236 <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>
4237 </p>
4238 !! end
4239
4240 !! test
4241 Link with suffix
4242 !! input
4243 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4244 !! result
4245 <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>!!!
4246 </p>
4247 !! end
4248
4249 !! article
4250 prefixed article
4251 !! text
4252 Some text
4253 !! endarticle
4254
4255 !! test
4256 Bug 43661: Piped links with identical prefixes
4257 !! input
4258 [[prefixed article|prefixed articles with spaces]]
4259
4260 [[prefixed article|prefixed articlesaoeu]]
4261
4262 [[Main Page|Main Page test]]
4263 !! result
4264 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4265 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4266 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4267 </p>
4268 !! end
4269
4270
4271 !! test
4272 Link with HTML entity in suffix / tail
4273 !! input
4274 [[Main Page]]&quot;, [[Main Page]]&#97;
4275 !! result
4276 <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;
4277 </p>
4278 !! end
4279
4280 !! test
4281 Link with 3 brackets
4282 !! input
4283 [[[main page]]]
4284 !! result
4285 <p>[[[main page]]]
4286 </p>
4287 !! end
4288
4289 !! test
4290 Piped link with 3 brackets
4291 !! input
4292 [[[main page|the main page]]]
4293 !! result
4294 <p>[[[main page|the main page]]]
4295 </p>
4296 !! end
4297
4298 !! test
4299 Link with multiple pipes
4300 !! input
4301 [[Main Page|The|Main|Page]]
4302 !! result
4303 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4304 </p>
4305 !! end
4306
4307 !! test
4308 Link to namespaces
4309 !! input
4310 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4311 !! result
4312 <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>
4313 </p>
4314 !! end
4315
4316 !! test
4317 Piped link to namespace
4318 !! input
4319 [[Meta:Disclaimers|The disclaimers]]
4320 !! result
4321 <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>
4322 </p>
4323 !! end
4324
4325 !! test
4326 Link containing }
4327 !! input
4328 [[Usually caused by a typo (oops}]]
4329 !! result
4330 <p>[[Usually caused by a typo (oops}]]
4331 </p>
4332 !! end
4333
4334 !! test
4335 Link containing % (not as a hex sequence)
4336 !! input
4337 [[7% Solution]]
4338 !! result
4339 <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>
4340 </p>
4341 !! end
4342
4343 !! test
4344 Link containing % as a single hex sequence interpreted to char
4345 !! input
4346 [[7%25 Solution]]
4347 !! result
4348 <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>
4349 </p>
4350 !!end
4351
4352 !! test
4353 Link containing % as a double hex sequence interpreted to hex sequence
4354 !! input
4355 [[7%2525 Solution]]
4356 !! result
4357 <p>[[7%2525 Solution]]
4358 </p>
4359 !!end
4360
4361 !! test
4362 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4363 Example for such a section: == < ==
4364 !! input
4365 [[%23%3c]][[%23%3e]]
4366 !! result
4367 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4368 </p>
4369 !! end
4370
4371 !! test
4372 Link containing "<#" and ">#" as a hex sequences
4373 !! input
4374 [[%3c%23]][[%3e%23]]
4375 !! result
4376 <p>[[%3c%23]][[%3e%23]]
4377 </p>
4378 !! end
4379
4380 !! test
4381 Link containing an equals sign
4382 !! input
4383 [[Special:BookSources/isbn=4-00-026157-6]]
4384 !! result
4385 <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>
4386 </p>
4387 !! end
4388
4389 !! article
4390 Foo~bar
4391 !! text
4392 Just a test of an article title containing a tilde.
4393 !! endarticle
4394
4395 # note that links containing signatures, like [[Foo~~~~]], are
4396 # massaged by the pre-save transform (PST) and so the tildes are never
4397 # seen by the parser.
4398 !! test
4399 Link containing a tilde
4400 !! input
4401 [[Foo~bar]]
4402 !! result
4403 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4404 </p>
4405 !! end
4406
4407 !! test
4408 Link containing double-single-quotes '' (bug 4598)
4409 !! input
4410 [[Lista d''e paise d''o munno]]
4411 !! result
4412 <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>
4413 </p>
4414 !! end
4415
4416 !! test
4417 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4418 !! input
4419 Some [[Link|pretty ''italics'' and stuff]]!
4420 !! result
4421 <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>!
4422 </p>
4423 !! end
4424
4425 !! test
4426 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4427 !! input
4428 ''Some [[Link|pretty ''italics'' and stuff]]!
4429 !! result
4430 <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>
4431 </p>
4432 !! end
4433
4434 !! test
4435 Link with double quotes in title part (literal) and alternate part (interpreted)
4436 !! input
4437 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4438
4439 [[''Pentecoste'']]
4440
4441 [[''Pentecoste''|Pentecoste]]
4442
4443 [[''Pentecoste''|''Pentecoste'']]
4444 !! result
4445 <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>
4446 </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>
4447 </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>
4448 </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>
4449 </p>
4450 !! end
4451
4452 !! test
4453 Broken image links with HTML captions (bug 39700)
4454 !! input
4455 [[File:Nonexistent|<script></script>]]
4456 [[File:Nonexistent|100px|<script></script>]]
4457 [[File:Nonexistent|&lt;]]
4458 [[File:Nonexistent|a<i>b</i>c]]
4459 !! result
4460 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4461 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4462 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4463 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4464 </p>
4465 !! end
4466
4467 !! test
4468 Plain link to URL
4469 !! input
4470 [[http://www.example.com]]
4471 !! result
4472 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4473 </p>
4474 !! end
4475
4476 !! test
4477 Plain link to URL with link text
4478 !! input
4479 [[http://www.example.com Link text]]
4480 !! result
4481 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4482 </p>
4483 !! end
4484
4485 !! test
4486 Plain link to protocol-relative URL
4487 !! input
4488 [[//www.example.com]]
4489 !! result
4490 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4491 </p>
4492 !! end
4493
4494 !! test
4495 Plain link to protocol-relative URL with link text
4496 !! input
4497 [[//www.example.com Link text]]
4498 !! result
4499 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4500 </p>
4501 !! end
4502
4503 !! test
4504 Plain link to page with question mark in title
4505 !! input
4506 [[A?b]]
4507
4508 [[A?b|Baz]]
4509 !! result
4510 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4511 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4512 </p>
4513 !! end
4514
4515
4516 # I'm fairly sure the expected result here is wrong.
4517 # We want these to be URL links, not pseudo-pages with URLs for titles....
4518 # However the current output is also pretty screwy.
4519 #
4520 # ----
4521 # I'm changing it to match the current output--it arguably makes more
4522 # sense in the light of the test above. Old expected result was:
4523 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4524 #</p>
4525 # But I think this test is bordering on "garbage in, garbage out" anyway.
4526 # -- wtm
4527 !! test
4528 Piped link to URL
4529 !! input
4530 Piped link to URL: [[http://www.example.com|an example URL]]
4531 !! result
4532 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4533 </p>
4534 !! end
4535
4536 !! test
4537 BUG 2: [[page|http://url/]] should link to page, not http://url/
4538 !! input
4539 [[Main Page|http://url/]]
4540 !! result
4541 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4542 </p>
4543 !! end
4544
4545 !! test
4546 BUG 337: Escaped self-links should be bold
4547 !! options
4548 title=[[Bug462]]
4549 !! input
4550 [[Bu&#103;462]] [[Bug462]]
4551 !! result
4552 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4553 </p>
4554 !! end
4555
4556 !! test
4557 Self-link to section should not be bold
4558 !! options
4559 title=[[Main Page]]
4560 !! input
4561 [[Main Page#section]]
4562 !! result
4563 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4564 </p>
4565 !! end
4566
4567 !! article
4568 00
4569 !! text
4570 This is 00.
4571 !! endarticle
4572
4573 !!test
4574 Self-link to numeric title
4575 !!options
4576 title=[[0]]
4577 !!input
4578 [[0]]
4579 !!result
4580 <p><strong class="selflink">0</strong>
4581 </p>
4582 !!end
4583
4584 !!test
4585 Link to numeric-equivalent title
4586 !!options
4587 title=[[0]]
4588 !!input
4589 [[00]]
4590 !!result
4591 <p><a href="/wiki/00" title="00">00</a>
4592 </p>
4593 !!end
4594
4595 !! test
4596 <nowiki> inside a link
4597 !! input
4598 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4599 !! result
4600 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4601 </p>
4602 !! end
4603
4604 !! test
4605 Non-breaking spaces in title
4606 !! input
4607 [[&nbsp; Main &nbsp; Page &nbsp;]]
4608 !! result
4609 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4610 </p>
4611 !!end
4612
4613 !! test
4614 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4615 !! options
4616 language=ca
4617 !! input
4618 '''[[Main Page]]'''
4619 !! result
4620 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4621 </p>
4622 !! end
4623
4624 !! test
4625 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4626 !! options
4627 language=ca
4628 !! input
4629 ''[[Main Page]]''
4630 !! result
4631 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4632 </p>
4633 !! end
4634
4635 !! test
4636 Internal link with en linktrail: no apostrophes (bug 27473)
4637 !! options
4638 language=en
4639 !! input
4640 [[Something]]'nice
4641 !! result
4642 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4643 </p>
4644 !! end
4645
4646 !! test
4647 Internal link with ca linktrail with apostrophes (bug 27473)
4648 !! options
4649 language=ca
4650 !! input
4651 [[Something]]'nice
4652 !! result
4653 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4654 </p>
4655 !! end
4656
4657 !! test
4658 Internal link with kaa linktrail with apostrophes (bug 27473)
4659 !! options
4660 language=kaa
4661 !! input
4662 [[Something]]'nice
4663 !! result
4664 <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>
4665 </p>
4666 !! end
4667
4668 !! article
4669 Söfnuður
4670 !! text
4671 Test.
4672 !! endarticle
4673
4674 !! test
4675 Internal link with is link prefix
4676 !! options
4677 language=is
4678 !! input
4679 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4680 !! result
4681 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4682 </p>
4683 !! end
4684
4685 !! article
4686 Mótmælendatrú
4687 !! text
4688 Test.
4689 !! endarticle
4690
4691 !! test
4692 Internal link with is link trail and link prefix
4693 !! options
4694 language=is
4695 !! input
4696 [[mótmælendatrú|xxx]]ar
4697 [[mótmælendatrú]]ar
4698 mótmælenda[[söfnuður]]
4699 mótmælenda[[söfnuður|söfnuðir]]
4700 mótmælenda[[söfnuður|söfnuðir]]xxx
4701 !! result
4702 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4703 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4704 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4705 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4706 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4707 </p>
4708 !! end
4709
4710 !! test
4711 Parsoid link trail escaping
4712 !! options
4713 parsoid=html2wt,html2html
4714 !! input
4715 [[apple]]<nowiki/>s
4716 !! result
4717 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4718 !! end
4719
4720 !! test
4721 Parsoid link prefix escaping
4722 !! options
4723 language=is
4724 parsoid=html2wt,html2html
4725 !! input
4726 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4727 !! result
4728 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4729 !! end
4730
4731 !! test
4732 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4733 !! input
4734 [[Foo| bar]]
4735
4736 [[Foo| ''bar'']]
4737
4738 [http://wp.org foo]
4739
4740 [http://wp.org ''foo'']
4741 !! result
4742 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4743 </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>
4744 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4745 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4746 </p>
4747 !! end
4748
4749 ###
4750 ### Interwiki links (see maintenance/interwiki.sql)
4751 ###
4752
4753 !! test
4754 Inline interwiki link
4755 !! input
4756 [[MeatBall:SoftSecurity]]
4757 !! result
4758 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4759 </p>
4760 !! end
4761
4762 !! test
4763 Inline interwiki link with empty title (bug 2372)
4764 !! input
4765 [[MeatBall:]]
4766 !! result
4767 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4768 </p>
4769 !! end
4770
4771 !! test
4772 Interwiki link encoding conversion (bug 1636)
4773 !! input
4774 *[[Wikipedia:ro:Olteni&#0355;a]]
4775 *[[Wikipedia:ro:Olteni&#355;a]]
4776 !! result
4777 <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>
4778 </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>
4779 </li></ul>
4780
4781 !! end
4782
4783 !! test
4784 Interwiki link with fragment (bug 2130)
4785 !! input
4786 [[MeatBall:SoftSecurity#foo]]
4787 !! result
4788 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 Interlanguage link
4794 !! input
4795 Blah blah blah
4796 [[zh:Chinese]]
4797 !!result
4798 <p>Blah blah blah
4799 </p>
4800 !! end
4801
4802 !! test
4803 Double interlanguage link
4804 !! input
4805 Blah blah blah
4806 [[es:Spanish]]
4807 [[zh:Chinese]]
4808 !!result
4809 <p>Blah blah blah
4810 </p>
4811 !! end
4812
4813 !! test
4814 Interlanguage link, with prefix links
4815 !! options
4816 language=ln
4817 !! input
4818 Blah blah blah
4819 [[zh:Chinese]]
4820 !!result
4821 <p>Blah blah blah
4822 </p>
4823 !! end
4824
4825 !! test
4826 Double interlanguage link, with prefix links (bug 8897)
4827 !! options
4828 language=ln
4829 !! input
4830 Blah blah blah
4831 [[es:Spanish]]
4832 [[zh:Chinese]]
4833 !!result
4834 <p>Blah blah blah
4835 </p>
4836 !! end
4837
4838 !! test
4839 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4840 !! options
4841 language=ln
4842 !! input
4843 [[WW&nbsp;II]]
4844 !!result
4845 <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>
4846 </p>
4847 !! end
4848
4849 !! test
4850 Parsoid: handle constructor well
4851 !! options
4852 parsoid
4853 !! input
4854 [[constructor]]
4855
4856 [[constructor:foo]]
4857 !! result
4858 <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>
4859
4860
4861 <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>
4862 !! end
4863
4864 ##
4865 ## Redirects, Parsoid-only
4866 ##
4867 !! test
4868 Simple redirect to page
4869 !! options
4870 parsoid
4871 !! input
4872 #REDIRECT [[Main Page]]
4873 !! result
4874 <link rel="mw:PageProp/redirect" href="./Main_Page">
4875 !! end
4876
4877 !! test
4878 Redirect to category
4879 !! options
4880 parsoid=wt2html
4881 !! input
4882 #REDIRECT [[Category:Foo]]
4883 !! result
4884 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4885 !! end
4886
4887 !! test
4888 Redirect to category page
4889 !! options
4890 parsoid=wt2html,html2html
4891 !! input
4892 #REDIRECT [[:Category:Foo]]
4893 !! result
4894 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4895 !! end
4896
4897 !! test
4898 Redirect to image page
4899 !! options
4900 parsoid
4901 !! input
4902 #REDIRECT [[File:Wiki.png]]
4903 !! result
4904 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4905 !! end
4906
4907 !! test
4908 Redirect to language
4909 !! options
4910 parsoid
4911 !! input
4912 #REDIRECT [[en:File:Wiki.png]]
4913 !! result
4914 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4915 !! end
4916
4917 !! test
4918 Redirect to interwiki
4919 !! options
4920 parsoid
4921 !! input
4922 #REDIRECT [[meatball:File:Wiki.png]]
4923 !! result
4924 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4925 !! end
4926
4927 ##
4928 ## XHTML tidiness
4929 ###
4930
4931 !! test
4932 <br> to <br />
4933 !! input
4934 1<br>2<br />3
4935 !! result
4936 <p>1<br />2<br />3
4937 </p>
4938 !! end
4939
4940 !! test
4941 Broken br tag sanitization
4942 !! options
4943 php
4944 !! input
4945 </br>
4946 !! result
4947 <p>&lt;/br&gt;
4948 </p>
4949 !! end
4950
4951 # TODO: Fix html2html mode (bug 51055)!
4952 !! test
4953 Parsoid: Broken br tag recognition
4954 !! options
4955 parsoid=wt2html
4956 !! input
4957 </br>
4958 !! result
4959 <p><br></p>
4960 !! end
4961
4962 !! test
4963 Incorrecly removing closing slashes from correctly formed XHTML
4964 !! input
4965 <br style="clear:both;" />
4966 !! result
4967 <p><br style="clear:both;" />
4968 </p>
4969 !! end
4970
4971 !! test
4972 Failing to transform badly formed HTML into correct XHTML
4973 !! input
4974 <br style="clear: left;">
4975 <br style="clear: right;">
4976 <br style="clear: both;">
4977 !! result
4978 <p><br style="clear: left;" />
4979 <br style="clear: right;" />
4980 <br style="clear: both;" />
4981 </p>
4982 !!end
4983
4984 !! test
4985 Handling html with a div self-closing tag
4986 !! input
4987 <div title />
4988 <div title/>
4989 <div title/ >
4990 <div title=bar />
4991 <div title=bar/>
4992 <div title=bar/ >
4993 !! result
4994 <p>&lt;div title /&gt;
4995 &lt;div title/&gt;
4996 </p>
4997 <div>
4998 <p>&lt;div title=bar /&gt;
4999 &lt;div title=bar/&gt;
5000 </p>
5001 <div title="bar/"></div>
5002 </div>
5003
5004 !! end
5005
5006 !! test
5007 Handling html with a br self-closing tag
5008 !! input
5009 <br title />
5010 <br title/>
5011 <br title/ >
5012 <br title=bar />
5013 <br title=bar/>
5014 <br title=bar/ >
5015 !! result
5016 <p><br title="title" />
5017 <br title="title" />
5018 <br />
5019 <br title="bar" />
5020 <br title="bar" />
5021 <br title="bar/" />
5022 </p>
5023 !! end
5024
5025 !! test
5026 Horizontal ruler (should it add that extra space?)
5027 !! input
5028 <hr>
5029 <hr >
5030 foo <hr
5031 > bar
5032 !! result
5033 <hr />
5034 <hr />
5035 foo <hr /> bar
5036
5037 !! end
5038
5039 !! test
5040 Horizontal ruler -- 4+ dashes render hr
5041 !! input
5042 ----
5043 !! result
5044 <hr />
5045
5046 !! end
5047
5048 !! test
5049 Horizontal ruler -- eats additional dashes on the same line
5050 !! input
5051 ---------
5052 !! result
5053 <hr />
5054
5055 !! end
5056
5057 !! test
5058 Horizontal ruler -- does not collapse dashes on consecutive lines
5059 !! input
5060 ----
5061 ----
5062 !! result
5063 <hr />
5064 <hr />
5065
5066 !! end
5067
5068 !! test
5069 Horizontal ruler -- <4 dashes render as plain text
5070 !! input
5071 ---
5072 !! result
5073 <p>---
5074 </p>
5075 !! end
5076
5077 !! test
5078 Horizontal ruler -- Supports content following dashes on same line
5079 !! input
5080 ---- Foo
5081 !! result
5082 <hr /> Foo
5083
5084 !! end
5085
5086 ###
5087 ### Block-level elements
5088 ###
5089 !! test
5090 Common list
5091 !! input
5092 *Common list
5093 * item 2
5094 *item 3
5095 !! result
5096 <ul><li>Common list
5097 </li><li> item 2
5098 </li><li>item 3
5099 </li></ul>
5100
5101 !! end
5102
5103 !! test
5104 Numbered list
5105 !! input
5106 #Numbered list
5107 #item 2
5108 # item 3
5109 !! result
5110 <ol><li>Numbered list
5111 </li><li>item 2
5112 </li><li> item 3
5113 </li></ol>
5114
5115 !! end
5116
5117 !! test
5118 Mixed list
5119 !! input
5120 *Mixed list
5121 *# with numbers
5122 ** and bullets
5123 *# and numbers
5124 *bullets again
5125 **bullet level 2
5126 ***bullet level 3
5127 ***#Number on level 4
5128 **bullet level 2
5129 **#Number on level 3
5130 **#Number on level 3
5131 *#number level 2
5132 *Level 1
5133 *** Level 3
5134 #** Level 3, but ordered
5135 !! result
5136 <ul><li>Mixed list
5137 <ol><li> with numbers
5138 </li></ol>
5139 <ul><li> and bullets
5140 </li></ul>
5141 <ol><li> and numbers
5142 </li></ol>
5143 </li><li>bullets again
5144 <ul><li>bullet level 2
5145 <ul><li>bullet level 3
5146 <ol><li>Number on level 4
5147 </li></ol>
5148 </li></ul>
5149 </li><li>bullet level 2
5150 <ol><li>Number on level 3
5151 </li><li>Number on level 3
5152 </li></ol>
5153 </li></ul>
5154 <ol><li>number level 2
5155 </li></ol>
5156 </li><li>Level 1
5157 <ul><li><ul><li> Level 3
5158 </li></ul>
5159 </li></ul>
5160 </li></ul>
5161 <ol><li><ul><li><ul><li> Level 3, but ordered
5162 </li></ul>
5163 </li></ul>
5164 </li></ol>
5165
5166 !! end
5167
5168 !! test
5169 Nested lists 1
5170 !! input
5171 *foo
5172 **bar
5173 !! result
5174 <ul><li>foo
5175 <ul><li>bar
5176 </li></ul>
5177 </li></ul>
5178
5179 !! end
5180
5181 !! test
5182 Nested lists 2
5183 !! input
5184 **foo
5185 *bar
5186 !! result
5187 <ul><li><ul><li>foo
5188 </li></ul>
5189 </li><li>bar
5190 </li></ul>
5191
5192 !! end
5193
5194 !! test
5195 Nested lists 3 (first element empty)
5196 !! input
5197 *
5198 **bar
5199 !! result
5200 <ul><li>
5201 <ul><li>bar
5202 </li></ul>
5203 </li></ul>
5204
5205 !! end
5206
5207 !! test
5208 Nested lists 4 (first element empty)
5209 !! input
5210 **
5211 *bar
5212 !! result
5213 <ul><li><ul><li>
5214 </li></ul>
5215 </li><li>bar
5216 </li></ul>
5217
5218 !! end
5219
5220 !! test
5221 Nested lists 5 (both elements empty)
5222 !! input
5223 **
5224 *
5225 !! result
5226 <ul><li><ul><li>
5227 </li></ul>
5228 </li><li>
5229 </li></ul>
5230
5231 !! end
5232
5233 !! test
5234 Nested lists 6 (both elements empty)
5235 !! input
5236 *
5237 **
5238 !! result
5239 <ul><li>
5240 <ul><li>
5241 </li></ul>
5242 </li></ul>
5243
5244 !! end
5245
5246 !! test
5247 Nested lists 7 (skip initial nesting levels)
5248 !! input
5249 *** foo
5250 !! result
5251 <ul><li><ul><li><ul><li> foo
5252 </li></ul>
5253 </li></ul>
5254 </li></ul>
5255
5256 !! end
5257
5258 !! test
5259 Nested lists 8 (multiple nesting transitions)
5260 !! input
5261 * foo
5262 *** bar
5263 ** baz
5264 * boo
5265 !! result
5266 <ul><li> foo
5267 <ul><li><ul><li> bar
5268 </li></ul>
5269 </li><li> baz
5270 </li></ul>
5271 </li><li> boo
5272 </li></ul>
5273
5274 !! end
5275
5276 !! test
5277 1. Lists with start-of-line-transparent tokens before bullets: Comments
5278 !! input
5279 *foo
5280 *<!--cmt-->bar
5281 <!--cmt-->*baz
5282 !! result
5283 <ul><li>foo
5284 </li><li>bar
5285 </li><li>baz
5286 </li></ul>
5287
5288 !! end
5289
5290 !! test
5291 2. Lists with start-of-line-transparent tokens before bullets: Template close
5292 !! input
5293 *foo {{echo|bar
5294 }}*baz
5295 !! result
5296 <ul><li>foo bar
5297 </li><li>baz
5298 </li></ul>
5299
5300 !! end
5301
5302 !! test
5303 List items are not parsed correctly following a <pre> block (bug 785)
5304 !! input
5305 * <pre>foo</pre>
5306 * <pre>bar</pre>
5307 * zar
5308 !! result
5309 <ul><li> <pre>foo</pre>
5310 </li><li> <pre>bar</pre>
5311 </li><li> zar
5312 </li></ul>
5313
5314 !! end
5315
5316 !! test
5317 List items from template
5318 !! input
5319
5320 {{inner list}}
5321 * item 2
5322
5323 * item 0
5324 {{inner list}}
5325 * item 2
5326
5327 * item 0
5328 * notSOL{{inner list}}
5329 * item 2
5330 !! result
5331 <ul><li> item 1
5332 </li><li> item 2
5333 </li></ul>
5334 <ul><li> item 0
5335 </li><li> item 1
5336 </li><li> item 2
5337 </li></ul>
5338 <ul><li> item 0
5339 </li><li> notSOL
5340 </li><li> item 1
5341 </li><li> item 2
5342 </li></ul>
5343
5344 !! end
5345
5346 !! test
5347 List interrupted by empty line or heading
5348 !! input
5349 * foo
5350
5351 ** bar
5352 == A heading ==
5353 * Another list item
5354 !! result
5355 <ul><li> foo
5356 </li></ul>
5357 <ul><li><ul><li> bar
5358 </li></ul>
5359 </li></ul>
5360 <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>
5361 <ul><li> Another list item
5362 </li></ul>
5363
5364 !!end
5365
5366 !!test
5367 Multiple list tags generated by templates
5368 !!input
5369 {{echo|<li>}}a
5370 {{echo|<li>}}b
5371 {{echo|<li>}}c
5372 !!result
5373 <li>a
5374 <li>b
5375 <li>c</li>
5376 </li>
5377 </li>
5378
5379 !!end
5380
5381 !!test
5382 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5383 !!input
5384 *a
5385 <!--This line will NOT split the list-->
5386 *b
5387 <!--This line will NOT split the list either-->
5388 *c
5389 <!--foo--> <!--This line with more than 1 comment will split the list-->
5390 *d
5391 !!result
5392 <ul><li>a
5393 </li><li>b
5394 </li><li>c
5395 </li></ul>
5396 <ul><li>d
5397 </li></ul>
5398
5399 !!end
5400
5401 !!test
5402 Test the li-hack
5403 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5404 !!options
5405 parsoid=wt2html,wt2wt
5406 !!input
5407 * foo
5408 * <li>li-hack
5409 * {{echo|<li>templated li-hack}}
5410 * <!--foo--> <li> unsupported li-hack with preceding comments
5411
5412 <ul>
5413 <li><li>not a li-hack
5414 </li>
5415 </ul>
5416 !!result
5417 <ul><li> foo</li>
5418 <li>li-hack</li>
5419 <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>
5420 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5421
5422 <ul>
5423 <li></li><li>not a li-hack
5424 </li>
5425 </ul>
5426 !!end
5427
5428 !! test
5429 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5430 !! options
5431 parsoid
5432 !! input
5433 # foo
5434 ## bar
5435 * foo
5436 ** bar
5437 : foo
5438 :: bar
5439 !! result
5440 <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>
5441 !! end
5442
5443 # ------------------------------------------------------------------------
5444 # The next set of tests are about Parsoid's ability to handle badly nested
5445 # tags (parse, minimize scope of fixup, and roundtrip back)
5446 # ------------------------------------------------------------------------
5447
5448 !! test
5449 Unbalanced closing block tags break a list
5450 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5451 !! options
5452 parsoid
5453 !! input
5454 <div>
5455 *a</div><div>
5456 *b</div>
5457 !! result
5458 <div>
5459 <ul><li>a
5460 </li></ul></div><div>
5461 <ul><li>b
5462 </li></ul></div>
5463 !! end
5464
5465 !! test
5466 Unbalanced closing non-block tags don't break a list
5467 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5468 !! options
5469 parsoid
5470 !! input
5471 <span>
5472 *a</span><span>
5473 *b</span>
5474 !! result
5475 <p><span></span>
5476 </p>
5477 <ul><li>a<span></span>
5478 </li><li>b
5479 </li></ul>
5480 !! end
5481
5482 !! test
5483 Unclosed formatting tags that straddle lists are closed and reopened
5484 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5485 !! options
5486 parsoid
5487 !! input
5488 # <s> a
5489 # b </s>
5490 !! result
5491 <ol><li> <s> a </s>
5492 </li><li> <s> b </s>
5493 </li></ol>
5494 !! end
5495
5496 !!test
5497 List embedded in a non-block tag
5498 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5499 !! options
5500 parsoid
5501 !!input
5502 <small>
5503 * foo
5504 </small>
5505 !!result
5506 <p><small></small></p>
5507 <small>
5508 <ul>
5509 <li> foo</li>
5510 </ul>
5511 </small>
5512 <p><small></small></p>
5513 !!end
5514
5515 ###
5516 ### Magic Words
5517 ###
5518
5519 !! test
5520 Magic Word: {{CURRENTDAY}}
5521 !! input
5522 {{CURRENTDAY}}
5523 !! result
5524 <p>1
5525 </p>
5526 !! end
5527
5528 !! test
5529 Magic Word: {{CURRENTDAY2}}
5530 !! input
5531 {{CURRENTDAY2}}
5532 !! result
5533 <p>01
5534 </p>
5535 !! end
5536
5537 !! test
5538 Magic Word: {{CURRENTDAYNAME}}
5539 !! input
5540 {{CURRENTDAYNAME}}
5541 !! result
5542 <p>Thursday
5543 </p>
5544 !! end
5545
5546 !! test
5547 Magic Word: {{CURRENTDOW}}
5548 !! input
5549 {{CURRENTDOW}}
5550 !! result
5551 <p>4
5552 </p>
5553 !! end
5554
5555 !! test
5556 Magic Word: {{CURRENTMONTH}}
5557 !! input
5558 {{CURRENTMONTH}}
5559 !! result
5560 <p>01
5561 </p>
5562 !! end
5563
5564 !! test
5565 Magic Word: {{CURRENTMONTHABBREV}}
5566 !! input
5567 {{CURRENTMONTHABBREV}}
5568 !! result
5569 <p>Jan
5570 </p>
5571 !! end
5572
5573 !! test
5574 Magic Word: {{CURRENTMONTHNAME}}
5575 !! input
5576 {{CURRENTMONTHNAME}}
5577 !! result
5578 <p>January
5579 </p>
5580 !! end
5581
5582 !! test
5583 Magic Word: {{CURRENTMONTHNAMEGEN}}
5584 !! input
5585 {{CURRENTMONTHNAMEGEN}}
5586 !! result
5587 <p>January
5588 </p>
5589 !! end
5590
5591 !! test
5592 Magic Word: {{CURRENTTIME}}
5593 !! input
5594 {{CURRENTTIME}}
5595 !! result
5596 <p>00:02
5597 </p>
5598 !! end
5599
5600 !! test
5601 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5602 !! input
5603 {{CURRENTWEEK}}
5604 !! result
5605 <p>1
5606 </p>
5607 !! end
5608
5609 !! test
5610 Magic Word: {{CURRENTYEAR}}
5611 !! input
5612 {{CURRENTYEAR}}
5613 !! result
5614 <p>1970
5615 </p>
5616 !! end
5617
5618 !! test
5619 Magic Word: {{FULLPAGENAME}}
5620 !! options
5621 title=[[User:Ævar Arnfjörð Bjarmason]]
5622 !! input
5623 {{FULLPAGENAME}}
5624 !! result
5625 <p>User:Ævar Arnfjörð Bjarmason
5626 </p>
5627 !! end
5628
5629 !! test
5630 Magic Word: {{FULLPAGENAMEE}}
5631 !! options
5632 title=[[User:Ævar Arnfjörð Bjarmason]]
5633 !! input
5634 {{FULLPAGENAMEE}}
5635 !! result
5636 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5637 </p>
5638 !! end
5639
5640 !! test
5641 Magic Word: {{NAMESPACE}}
5642 !! options
5643 title=[[User:Ævar Arnfjörð Bjarmason]]
5644 !! input
5645 {{NAMESPACE}}
5646 !! result
5647 <p>User
5648 </p>
5649 !! end
5650
5651 !! test
5652 Magic Word: {{NAMESPACEE}}
5653 !! options
5654 title=[[User:Ævar Arnfjörð Bjarmason]]
5655 !! input
5656 {{NAMESPACEE}}
5657 !! result
5658 <p>User
5659 </p>
5660 !! end
5661
5662 !! test
5663 Magic Word: {{NAMESPACENUMBER}}
5664 !! options
5665 title=[[User:Ævar Arnfjörð Bjarmason]]
5666 !! input
5667 {{NAMESPACENUMBER}}
5668 !! result
5669 <p>2
5670 </p>
5671 !! end
5672
5673 !! test
5674 Magic Word: {{NUMBEROFFILES}}
5675 !! input
5676 {{NUMBEROFFILES}}
5677 !! result
5678 <p>4
5679 </p>
5680 !! end
5681
5682 !! test
5683 Magic Word: {{PAGENAME}}
5684 !! options
5685 title=[[User:Ævar Arnfjörð Bjarmason]]
5686 !! input
5687 {{PAGENAME}}
5688 !! result
5689 <p>Ævar Arnfjörð Bjarmason
5690 </p>
5691 !! end
5692
5693 !! test
5694 Magic Word: {{PAGENAME}} with metacharacters
5695 !! options
5696 title=[['foo & bar = baz']]
5697 !! input
5698 ''{{PAGENAME}}''
5699 !! result
5700 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5701 </p>
5702 !! end
5703
5704 !! test
5705 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5706 !! options
5707 title=[[*RFC 1234 http://example.com/]]
5708 !! input
5709 {{PAGENAME}}
5710 !! result
5711 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5712 </p>
5713 !! end
5714
5715 !! test
5716 Magic Word: {{PAGENAMEE}}
5717 !! options
5718 title=[[User:Ævar Arnfjörð Bjarmason]]
5719 !! input
5720 {{PAGENAMEE}}
5721 !! result
5722 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5723 </p>
5724 !! end
5725
5726 !! test
5727 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5728 !! options
5729 title=[[*RFC 1234 http://example.com/]]
5730 !! input
5731 {{PAGENAMEE}}
5732 !! result
5733 <p>&#42;RFC_1234_http&#58;//example.com/
5734 </p>
5735 !! end
5736
5737 !! test
5738 Magic Word: {{REVISIONID}}
5739 !! input
5740 {{REVISIONID}}
5741 !! result
5742 <p>1337
5743 </p>
5744 !! end
5745
5746 !! test
5747 Magic Word: {{SCRIPTPATH}}
5748 !! input
5749 {{SCRIPTPATH}}
5750 !! result
5751 <p>/
5752 </p>
5753 !! end
5754
5755 !! test
5756 Magic Word: {{SERVER}}
5757 !! input
5758 {{SERVER}}
5759 !! result
5760 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5761 </p>
5762 !! end
5763
5764 !! test
5765 Magic Word: {{SERVERNAME}}
5766 !! input
5767 {{SERVERNAME}}
5768 !! result
5769 <p>example.org
5770 </p>
5771 !! end
5772
5773 !! test
5774 Magic Word: {{SITENAME}}
5775 !! input
5776 {{SITENAME}}
5777 !! result
5778 <p>MediaWiki
5779 </p>
5780 !! end
5781
5782 !! test
5783 Case-sensitive magic words, when cased differently, should just be template transclusions
5784 !! input
5785 {{CurrentMonth}}
5786 {{currentday}}
5787 {{cURreNTweEK}}
5788 {{currentHour}}
5789 !! result
5790 <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>
5791 <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>
5792 <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>
5793 <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>
5794 </p>
5795 !! end
5796
5797 !! test
5798 Case-insensitive magic words should still work with weird casing.
5799 !! input
5800 {{sErVeRNaMe}}
5801 {{LCFirst:AOEU}}
5802 {{ucFIRST:aoeu}}
5803 {{SERver}}
5804 !! result
5805 <p>example.org
5806 aOEU
5807 Aoeu
5808 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5809 </p>
5810 !! end
5811
5812 !! test
5813 Namespace 1 {{ns:1}}
5814 !! input
5815 {{ns:1}}
5816 !! result
5817 <p>Talk
5818 </p>
5819 !! end
5820
5821 !! test
5822 Namespace 1 {{ns:01}}
5823 !! input
5824 {{ns:01}}
5825 !! result
5826 <p>Talk
5827 </p>
5828 !! end
5829
5830 !! test
5831 Namespace 0 {{ns:0}} (bug 4783)
5832 !! input
5833 {{ns:0}}
5834 !! result
5835
5836 !! end
5837
5838 !! test
5839 Namespace 0 {{ns:00}} (bug 4783)
5840 !! input
5841 {{ns:00}}
5842 !! result
5843
5844 !! end
5845
5846 !! test
5847 Namespace -1 {{ns:-1}}
5848 !! input
5849 {{ns:-1}}
5850 !! result
5851 <p>Special
5852 </p>
5853 !! end
5854
5855 !! test
5856 Namespace User {{ns:User}}
5857 !! input
5858 {{ns:User}}
5859 !! result
5860 <p>User
5861 </p>
5862 !! end
5863
5864 !! test
5865 Namespace User talk {{ns:User_talk}}
5866 !! input
5867 {{ns:User_talk}}
5868 !! result
5869 <p>User talk
5870 </p>
5871 !! end
5872
5873 !! test
5874 Namespace User talk {{ns:uSeR tAlK}}
5875 !! input
5876 {{ns:uSeR tAlK}}
5877 !! result
5878 <p>User talk
5879 </p>
5880 !! end
5881
5882 !! test
5883 Namespace File {{ns:File}}
5884 !! input
5885 {{ns:File}}
5886 !! result
5887 <p>File
5888 </p>
5889 !! end
5890
5891 !! test
5892 Namespace File {{ns:Image}}
5893 !! input
5894 {{ns:Image}}
5895 !! result
5896 <p>File
5897 </p>
5898 !! end
5899
5900 !! test
5901 Namespace (lang=de) Benutzer {{ns:User}}
5902 !! options
5903 language=de
5904 !! input
5905 {{ns:User}}
5906 !! result
5907 <p>Benutzer
5908 </p>
5909 !! end
5910
5911 !! test
5912 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5913 !! options
5914 language=de
5915 !! input
5916 {{ns:3}}
5917 !! result
5918 <p>Benutzer Diskussion
5919 </p>
5920 !! end
5921
5922
5923 !! test
5924 Urlencode
5925 !! input
5926 {{urlencode:hi world?!}}
5927 {{urlencode:hi world?!|WIKI}}
5928 {{urlencode:hi world?!|PATH}}
5929 {{urlencode:hi world?!|QUERY}}
5930 !! result
5931 <p>hi+world%3F%21
5932 hi_world%3F!
5933 hi%20world%3F%21
5934 hi+world%3F%21
5935 </p>
5936 !! end
5937
5938 ###
5939 ### Magic links
5940 ###
5941 !! test
5942 Magic links: internal link to RFC (bug 479)
5943 !! input
5944 [[RFC 123]]
5945 !! result
5946 <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>
5947 </p>
5948 !! end
5949
5950 !! test
5951 Magic links: RFC (bug 479)
5952 !! input
5953 RFC 822
5954 !! result
5955 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5956 </p>
5957 !! end
5958
5959 !! test
5960 Magic links: ISBN (bug 1937)
5961 !! input
5962 ISBN 0-306-40615-2
5963 !! result
5964 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5965 </p>
5966 !! end
5967
5968 !! test
5969 Magic links: PMID incorrectly converts space to underscore
5970 !! input
5971 PMID 1234
5972 !! result
5973 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5974 </p>
5975 !! end
5976
5977 ###
5978 ### Templates
5979 ####
5980
5981 !! test
5982 Nonexistent template
5983 !! input
5984 {{thistemplatedoesnotexist}}
5985 !! result
5986 <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>
5987 </p>
5988 !! end
5989
5990 !! test
5991 Template with invalid target containing tags
5992 !! input
5993 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5994 !! result
5995 <p>{{a<b>b</b>|foo|a=b|a = b}}
5996 </p>
5997 !! end
5998
5999 !! test
6000 Template with invalid target containing unclosed tag
6001 !! input
6002 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6003 !! result
6004 <p>{{a<b>|foo|a=b|a = b}}</b>
6005 </p>
6006 !! end
6007
6008 !! article
6009 Template:test
6010 !! text
6011 This is a test template
6012 !! endarticle
6013
6014 !! test
6015 Simple template
6016 !! input
6017 {{test}}
6018 !! result
6019 <p>This is a test template
6020 </p>
6021 !! end
6022
6023 !! test
6024 Template with explicit namespace
6025 !! input
6026 {{Template:test}}
6027 !! result
6028 <p>This is a test template
6029 </p>
6030 !! end
6031
6032
6033 !! article
6034 Template:paramtest
6035 !! text
6036 This is a test template with parameter {{{param}}}
6037 !! endarticle
6038
6039 !! test
6040 Template parameter
6041 !! input
6042 {{paramtest|param=foo}}
6043 !! result
6044 <p>This is a test template with parameter foo
6045 </p>
6046 !! end
6047
6048 !! article
6049 Template:paramtestnum
6050 !! text
6051 [[{{{1}}}|{{{2}}}]]
6052 !! endarticle
6053
6054 !! test
6055 Template unnamed parameter
6056 !! input
6057 {{paramtestnum|Main Page|the main page}}
6058 !! result
6059 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6060 </p>
6061 !! end
6062
6063 !! article
6064 Template:templatesimple
6065 !! text
6066 (test)
6067 !! endarticle
6068
6069 !! article
6070 Template:templateredirect
6071 !! text
6072 #redirect [[Template:templatesimple]]
6073 !! endarticle
6074
6075 !! article
6076 Template:templateasargtestnum
6077 !! text
6078 {{{{{1}}}}}
6079 !! endarticle
6080
6081 !! article
6082 Template:templateasargtest
6083 !! text
6084 {{template{{{templ}}}}}
6085 !! endarticle
6086
6087 !! article
6088 Template:templateasargtest2
6089 !! text
6090 {{{{{templ}}}}}
6091 !! endarticle
6092
6093 !! test
6094 Template with template name as unnamed argument
6095 !! input
6096 {{templateasargtestnum|templatesimple}}
6097 !! result
6098 <p>(test)
6099 </p>
6100 !! end
6101
6102 !! test
6103 Template with template name as argument
6104 !! input
6105 {{templateasargtest|templ=simple}}
6106 !! result
6107 <p>(test)
6108 </p>
6109 !! end
6110
6111 !! test
6112 Template with template name as argument (2)
6113 !! input
6114 {{templateasargtest2|templ=templatesimple}}
6115 !! result
6116 <p>(test)
6117 </p>
6118 !! end
6119
6120 !! article
6121 Template:templateasargtestdefault
6122 !! text
6123 {{{{{templ|templatesimple}}}}}
6124 !! endarticle
6125
6126 !! article
6127 Template:templa
6128 !! text
6129 '''templ'''
6130 !! endarticle
6131
6132 !! test
6133 Template with default value
6134 !! input
6135 {{templateasargtestdefault}}
6136 !! result
6137 <p>(test)
6138 </p>
6139 !! end
6140
6141 !! test
6142 Template with default value (value set)
6143 !! input
6144 {{templateasargtestdefault|templ=templa}}
6145 !! result
6146 <p><b>templ</b>
6147 </p>
6148 !! end
6149
6150 !! test
6151 Template redirect
6152 !! input
6153 {{templateredirect}}
6154 !! result
6155 <p>(test)
6156 </p>
6157 !! end
6158
6159 !! test
6160 Template with argument in separate line
6161 !! input
6162 {{ templateasargtest |
6163 templ = simple }}
6164 !! result
6165 <p>(test)
6166 </p>
6167 !! end
6168
6169 !! test
6170 Template with complex template as argument
6171 !! input
6172 {{paramtest|
6173 param ={{ templateasargtest |
6174 templ = simple }}}}
6175 !! result
6176 <p>This is a test template with parameter (test)
6177 </p>
6178 !! end
6179
6180 !! test
6181 Template with thumb image (with link in description)
6182 !! input
6183 {{paramtest|
6184 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6185 !! result
6186 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>
6187
6188 !! end
6189
6190 !! article
6191 Template:complextemplate
6192 !! text
6193 {{{1}}} {{paramtest|
6194 param ={{{param}}}}}
6195 !! endarticle
6196
6197 !! test
6198 Template with complex arguments
6199 !! input
6200 {{complextemplate|
6201 param ={{ templateasargtest |
6202 templ = simple }}|[[Template:complextemplate|link]]}}
6203 !! result
6204 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6205 </p>
6206 !! end
6207
6208 !! test
6209 BUG 553: link with two variables in a piped link
6210 !! input
6211 {|
6212 |[[{{{1}}}|{{{2}}}]]
6213 |}
6214 !! result
6215 <table>
6216 <tr>
6217 <td>[[{{{1}}}|{{{2}}}]]
6218 </td></tr></table>
6219
6220 !! end
6221
6222 !! test
6223 Magic variable as template parameter
6224 !! input
6225 {{paramtest|param={{SITENAME}}}}
6226 !! result
6227 <p>This is a test template with parameter MediaWiki
6228 </p>
6229 !! end
6230
6231 !! article
6232 Template:linktest
6233 !! text
6234 [[{{{param}}}|link]]
6235 !! endarticle
6236
6237 !! test
6238 Template parameter as link source
6239 !! input
6240 {{linktest|param=Main Page}}
6241 !! result
6242 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6243 </p>
6244 !! end
6245
6246 !!test
6247 Template-generated attribute string (k='v')
6248 !!input
6249 <span {{attr_str|id|v1}}>bar</span>
6250 !!result
6251 <p><span id="v1">bar</span>
6252 </p>
6253 !!end
6254
6255 !!article
6256 Template:paramtest2
6257 !! text
6258 including another template, {{paramtest|param={{{arg}}}}}
6259 !! endarticle
6260
6261 !! test
6262 Template passing argument to another template
6263 !! input
6264 {{paramtest2|arg='hmm'}}
6265 !! result
6266 <p>including another template, This is a test template with parameter 'hmm'
6267 </p>
6268 !! end
6269
6270 !! article
6271 Template:Linktest2
6272 !! text
6273 Main Page
6274 !! endarticle
6275
6276 !! test
6277 Template as link source
6278 !! input
6279 [[{{linktest2}}]]
6280
6281 [[{{linktest2}}|Main Page]]
6282
6283 [[{{linktest2}}]]Page
6284 !! result
6285 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6286 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6287 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6288 </p>
6289 !! end
6290
6291
6292 !! article
6293 Template:loop1
6294 !! text
6295 {{loop2}}
6296 !! endarticle
6297
6298 !! article
6299 Template:loop2
6300 !! text
6301 {{loop1}}
6302 !! endarticle
6303
6304 !! test
6305 Template infinite loop
6306 !! input
6307 {{loop1}}
6308 !! result
6309 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6310 </p>
6311 !! end
6312
6313 !! test
6314 Template from main namespace
6315 !! input
6316 {{:Main Page}}
6317 !! result
6318 <p>blah blah
6319 </p>
6320 !! end
6321
6322 !! article
6323 Template:table
6324 !! text
6325 {|
6326 | 1 || 2
6327 |-
6328 | 3 || 4
6329 |}
6330 !! endarticle
6331
6332 !! test
6333 BUG 529: Template with table, not included at beginning of line
6334 !! input
6335 foo {{table}}
6336 !! result
6337 <p>foo
6338 </p>
6339 <table>
6340 <tr>
6341 <td> 1 </td>
6342 <td> 2
6343 </td></tr>
6344 <tr>
6345 <td> 3 </td>
6346 <td> 4
6347 </td></tr></table>
6348
6349 !! end
6350
6351 !! test
6352 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6353 !! input
6354 foo
6355 {{table}}
6356 !! result
6357 <p>foo
6358 </p>
6359 <table>
6360 <tr>
6361 <td> 1 </td>
6362 <td> 2
6363 </td></tr>
6364 <tr>
6365 <td> 3 </td>
6366 <td> 4
6367 </td></tr></table>
6368
6369 !! end
6370
6371 !! test
6372 BUG 41: Template parameters shown as broken links
6373 !! input
6374 {{{parameter}}}
6375 !! result
6376 <p>{{{parameter}}}
6377 </p>
6378 !! end
6379
6380 !! test
6381 Template with targets containing wikilinks
6382 !! input
6383 {{[[foo]]}}
6384
6385 {{[[{{echo|foo}}]]}}
6386
6387 {{{{echo|[[foo}}]]}}
6388 !! result
6389 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6390 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6391 </p><p>{{[[foo}}]]
6392 </p>
6393 !! end
6394
6395 !! article
6396 Template:MSGNW test
6397 !! text
6398 ''None'' of '''this''' should be
6399 * interpreted
6400 but rather passed unmodified
6401 {{test}}
6402 !! endarticle
6403
6404 # hmm, fix this or just deprecate msgnw and document its behavior?
6405 !! test
6406 msgnw keyword
6407 !! options
6408 disabled
6409 !! input
6410 {{msgnw:MSGNW test}}
6411 !! result
6412 <p>''None'' of '''this''' should be
6413 * interpreted
6414 but rather passed unmodified
6415 {{test}}
6416 </p>
6417 !! end
6418
6419 !! test
6420 int keyword
6421 !! input
6422 {{int:youhavenewmessages|lots of money|not!}}
6423 !! result
6424 <p>You have lots of money (not!).
6425 </p>
6426 !! end
6427
6428 !! article
6429 Template:Includes
6430 !! text
6431 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6432 !! endarticle
6433
6434 !! test
6435 <includeonly> and <noinclude> being included
6436 !! input
6437 {{Includes}}
6438 !! result
6439 <p>Foobar
6440 </p>
6441 !! end
6442
6443 !! article
6444 Template:Includes2
6445 !! text
6446 <onlyinclude>Foo</onlyinclude>bar
6447 !! endarticle
6448
6449 !! test
6450 <onlyinclude> being included
6451 !! input
6452 {{Includes2}}
6453 !! result
6454 <p>Foo
6455 </p>
6456 !! end
6457
6458
6459 !! article
6460 Template:Includes3
6461 !! text
6462 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6463 !! endarticle
6464
6465 !! test
6466 <onlyinclude> and <includeonly> being included
6467 !! input
6468 {{Includes3}}
6469 !! result
6470 <p>Foo
6471 </p>
6472 !! end
6473
6474 !! test
6475 <includeonly> and <noinclude> on a page
6476 !! input
6477 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6478 !! result
6479 <p>Foozar
6480 </p>
6481 !! end
6482
6483 !! test
6484 Un-closed <noinclude>
6485 !! input
6486 <noinclude>
6487 !! result
6488 !! end
6489
6490 !! test
6491 <onlyinclude> on a page
6492 !! input
6493 <onlyinclude>Foo</onlyinclude>bar
6494 !! result
6495 <p>Foobar
6496 </p>
6497 !! end
6498
6499 !! test
6500 Un-closed <onlyinclude>
6501 !! input
6502 <onlyinclude>
6503 !! result
6504 !! end
6505
6506 !!test
6507 Self-closed noinclude, includeonly, onlyinclude tags
6508 !!input
6509 <noinclude />
6510 <includeonly />
6511 <onlyinclude />
6512 !!result
6513 <p><br />
6514 </p>
6515 !!end
6516
6517 !!test
6518 Unbalanced includeonly and noinclude tags
6519 !!input
6520 {|
6521 |a</noinclude>
6522 |b</noinclude></noinclude>
6523 |c</noinclude></includeonly>
6524 |d</includeonly></includeonly>
6525 |}
6526 !!result
6527 <table>
6528 <tr>
6529 <td>a
6530 </td>
6531 <td>b
6532 </td>
6533 <td>c&lt;/includeonly&gt;
6534 </td>
6535 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6536 </td></tr></table>
6537
6538 !!end
6539
6540 !! article
6541 Template:Includeonly section
6542 !! text
6543 <includeonly>
6544 ==Includeonly section==
6545 </includeonly>
6546 ==Section T-1==
6547 !!endarticle
6548
6549 !! test
6550 Bug 6563: Edit link generation for section shown by <includeonly>
6551 !! input
6552 {{includeonly section}}
6553 !! result
6554 <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>
6555 <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>
6556
6557 !! end
6558
6559 # Uses same input as the contents of [[Template:Includeonly section]]
6560 !! test
6561 Bug 6563: Section extraction for section shown by <includeonly>
6562 !! options
6563 section=T-2
6564 !! input
6565 <includeonly>
6566 ==Includeonly section==
6567 </includeonly>
6568 ==Section T-2==
6569 !! result
6570 ==Section T-2==
6571 !! end
6572
6573 !! test
6574 Bug 6563: Edit link generation for section suppressed by <includeonly>
6575 !! input
6576 <includeonly>
6577 ==Includeonly section==
6578 </includeonly>
6579 ==Section 1==
6580 !! result
6581 <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>
6582
6583 !! end
6584
6585 !! test
6586 Bug 6563: Section extraction for section suppressed by <includeonly>
6587 !! options
6588 section=1
6589 !! input
6590 <includeonly>
6591 ==Includeonly section==
6592 </includeonly>
6593 ==Section 1==
6594 !! result
6595 ==Section 1==
6596 !! end
6597
6598 !! test
6599 Un-closed <includeonly>
6600 !! input
6601 <includeonly>
6602 !! result
6603 !! end
6604
6605 # TODO: test with DOM fragment reuse!
6606 !! test
6607 Parsoid: DOM fragment reuse
6608 !! options
6609 parsoid=wt2wt,wt2html
6610 !! input
6611 a{{echo|b<table></table>c}}d
6612
6613 a{{echo|b
6614 <table></table>
6615 c}}d
6616
6617 {{echo|a
6618
6619 <table></table>
6620
6621 b}}
6622 !! result
6623 a<span typeof="mw:Transclusion">b</span>
6624 <table></table><span>c</span>d
6625 <p typeof="mw:Transclusion">ab</p>
6626 <table></table>
6627 <p>cd</p>
6628 <p typeof="mw:Transclusion">a</p>
6629 <table></table>
6630 <p>b</p>
6631 !! end
6632
6633 ###
6634 ### <includeonly> and <noinclude> in attributes
6635 ###
6636 !!test
6637 0. includeonly around the entire attribute
6638 !!input
6639 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6640 !!result
6641 <p><span id="v2">bar</span>
6642 </p>
6643 !!end
6644
6645 !!test
6646 1. includeonly in html attr key
6647 !!input
6648 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6649 !!result
6650 <p><span id="foo">bar</span>
6651 </p>
6652 !!end
6653
6654 !!test
6655 2. includeonly in html attr value
6656 !!input
6657 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6658 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6659 !!result
6660 <p><span id="v1">bar</span>
6661 <span id="v1">bar</span>
6662 </p>
6663 !!end
6664
6665 !!test
6666 3. includeonly in part of an attr value
6667 !!input
6668 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6669 !!result
6670 <p><span style="color:red;">bar</span>
6671 </p>
6672 !!end
6673
6674 ###
6675 ### Testing parsing of templates where a template arg
6676 ### has the same name as the template itself.
6677 ###
6678
6679 !! article
6680 Template:quote
6681 !! text
6682 {{{quote|{{{1}}}}}}
6683 !! endarticle
6684
6685 !!test
6686 Templates: Template Name/Arg clash: 1. Use of positional param
6687 !!input
6688 {{quote|foo}}
6689 !!result
6690 <p>foo
6691 </p>
6692 !!end
6693
6694 !!test
6695 Templates: Template Name/Arg clash: 2. Use of named param
6696 !!input
6697 {{quote|quote=foo}}
6698 !!result
6699 <p>foo
6700 </p>
6701 !!end
6702
6703 !!test
6704 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6705 !!input
6706 {{quote|quote}}
6707 !!result
6708 <p>quote
6709 </p>
6710 !!end
6711
6712 ###
6713 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6714 ###
6715
6716 !!test
6717 Templates: 1. Simple use
6718 !!input
6719 {{echo|Foo}}
6720 !!result
6721 <p>Foo
6722 </p>
6723 !!end
6724
6725 !!test
6726 Templates: 2. Inside a block tag
6727 !!input
6728 <div>{{echo|Foo}}</div>
6729 !!result
6730 <div>Foo</div>
6731
6732 !!end
6733
6734 !!test
6735 Templates: P-wrapping: 1a. Templates on consecutive lines
6736 !!input
6737 {{echo|Foo}}
6738 {{echo|bar}}
6739 !!result
6740 <p>Foo
6741 bar
6742 </p>
6743 !!end
6744
6745 !!test
6746 Templates: P-wrapping: 1b. Templates on consecutive lines
6747 !!input
6748 Foo
6749
6750 {{echo|bar}}
6751 {{echo|baz}}
6752 !!result
6753 <p>Foo
6754 </p><p>bar
6755 baz
6756 </p>
6757 !!end
6758
6759 !!test
6760 Templates: P-wrapping: 1c. Templates on consecutive lines
6761 !!input
6762 {{echo|Foo}}
6763 {{echo|bar}} <div>baz</div>
6764 !!result
6765 <p>Foo
6766 </p>
6767 bar <div>baz</div>
6768
6769 !!end
6770
6771 !!test
6772 Templates: P-wrapping: 1d. Template preceded by comment-only line
6773 !!options
6774 parsoid=wt2html,wt2wt
6775 !!input
6776 <!-- foo -->
6777 {{echo|Bar}}
6778 !!result
6779 <!-- foo -->
6780 <p typeof="mw:Transclusion">Bar
6781 </p>
6782 !!end
6783
6784 !!test
6785 Templates: Inline Text: 1. Multiple tmeplate uses
6786 !!input
6787 {{echo|Foo}}bar{{echo|baz}}
6788 !!result
6789 <p>Foobarbaz
6790 </p>
6791 !!end
6792
6793 !!test
6794 Templates: Inline Text: 2. Back-to-back template uses
6795 !!input
6796 {{echo|Foo}}{{echo|bar}}
6797 !!result
6798 <p>Foobar
6799 </p>
6800 !!end
6801
6802 !!test
6803 Templates: Block Tags: 1. Multiple template uses
6804 !!input
6805 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6806 !!result
6807 <div>Foo</div><div>bar</div><div>baz</div>
6808
6809 !!end
6810
6811 !!test
6812 Templates: Block Tags: 2. Back-to-back template uses
6813 !!input
6814 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6815 !!result
6816 <div>Foo</div><div>bar</div>
6817
6818 !!end
6819
6820 !!test
6821 Templates: Links: 1. Simple example
6822 !!input
6823 {{echo|[[Foo|bar]]}}
6824 !!result
6825 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6826 </p>
6827 !!end
6828
6829 !!test
6830 Templates: Links: 2. Generation of link href
6831 !!input
6832 [[{{echo|Foo}}|bar]]
6833 !!result
6834 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6835 </p>
6836 !!end
6837
6838 !!test
6839 Templates: Links: 3. Generation of part of a link href
6840 !!input
6841 [[Fo{{echo|o}}|bar]]
6842
6843 [[Foo{{echo|bar}}]]
6844
6845 [[Foo{{echo|bar}}baz]]
6846
6847 [[Foo{{echo|bar}}|bar]]
6848
6849 [[:Foo{{echo|bar}}]]
6850
6851 [[:Foo{{echo|bar}}|bar]]
6852 !!result
6853 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6854 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6855 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6856 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6857 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6858 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6859 </p>
6860 !!end
6861
6862 !!test
6863 Templates: Links: 4. Multiple templates generating link href
6864 !!input
6865 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6866 !!result
6867 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6868 </p>
6869 !!end
6870
6871 !!test
6872 Templates: Links: 5. Generation of link text
6873 !!input
6874 [[Foo|{{echo|bar}}]]
6875 !!result
6876 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6877 </p>
6878 !!end
6879
6880 !!test
6881 Templates: Links: 5. Nested templates (only outermost template should be marked)
6882 !!input
6883 {{echo|[[{{echo|Foo}}|bar]]}}
6884 !!result
6885 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6886 </p>
6887 !!end
6888
6889 !!test
6890 Templates: HTML Tag: 1. Generation of HTML attr. key
6891 !!input
6892 <div {{echo|style}}="color:red;">foo</div>
6893 !!result
6894 <div style="color:red;">foo</div>
6895
6896 !!end
6897
6898 !!test
6899 Templates: HTML Tag: 2. Generation of HTML attr. value
6900 !!input
6901 <div style={{echo|'color:red;'}}>foo</div>
6902 !!result
6903 <div style="color:red;">foo</div>
6904
6905 !!end
6906
6907 !!test
6908 Templates: HTML Tag: 3. Generation of HTML attr key and value
6909 !!input
6910 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6911 !!result
6912 <div style="color:red;">foo</div>
6913
6914 !!end
6915
6916 !!test
6917 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6918 !!input
6919 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6920 !!result
6921 <div title="This is a long title with just one piece templated">foo</div>
6922
6923 !!end
6924
6925 !!test
6926 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6927 !!input
6928 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6929 !!result
6930 <div title="This is a long title with just one piece templated">foo</div>
6931
6932 !!end
6933
6934 !!test
6935 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6936 !!input
6937 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6938 !!result
6939 <div title="This is a long title with just one piece templated">foo</div>
6940
6941 !!end
6942
6943 !!test
6944 Templates: HTML Tag: 7. Generation of partial attribute key string
6945 !!input
6946 <div st{{echo|yle}}="color:red;">foo</div>
6947 !!result
6948 <div style="color:red;">foo</div>
6949
6950 !!end
6951
6952 !!test
6953 Templates: HTML Tables: 1. Generating start of a HTML table
6954 !!input
6955 {{echo|<table><tr><td>foo</td>}}</tr></table>
6956 !!result
6957 <table><tr><td>foo</td></tr></table>
6958
6959 !!end
6960
6961 !!test
6962 Templates: HTML Tables: 2a. Generating middle of a HTML table
6963 !!input
6964 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6965 !!result
6966 <table><tr><td>foo</td></tr></table>
6967
6968 !!end
6969
6970 !!test
6971 Templates: HTML Tables: 2b. Generating middle of a HTML table
6972 !!input
6973 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6974 !!result
6975 <table><tr><td>foo</td></tr></table>
6976
6977 !!end
6978
6979 !!test
6980 Templates: HTML Tables: 3. Generating end of a HTML table
6981 !!input
6982 <table><tr>{{echo|<td>foo</td></tr></table>}}
6983 !!result
6984 <table><tr><td>foo</td></tr></table>
6985
6986 !!end
6987
6988 !!test
6989 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6990 !!input
6991 {{echo|<table>}}<tr><td>foo</td></tr></table>
6992 !!result
6993 <table><tr><td>foo</td></tr></table>
6994
6995 !!end
6996
6997 !!test
6998 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6999 !!input
7000 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7001 !!result
7002 <table><tr><td>foo</td></tr></table>
7003
7004 !!end
7005
7006 !!test
7007 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7008 !!input
7009 <table><tr>{{echo|<td>}}foo</td></tr></table>
7010 !!result
7011 <table><tr><td>foo</td></tr></table>
7012
7013 !!end
7014
7015 !!test
7016 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7017 !!input
7018 <table><tr><td>foo{{echo|</td>}}</tr></table>
7019 !!result
7020 <table><tr><td>foo</td></tr></table>
7021
7022 !!end
7023
7024 !!test
7025 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7026 !!input
7027 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7028 !!result
7029 <table><tr><td>foo</td></tr></table>
7030
7031 !!end
7032
7033 !!test
7034 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7035 !!input
7036 <table><tr><td>foo</td></tr>{{echo|</table>}}
7037 !!result
7038 <table><tr><td>foo</td></tr></table>
7039
7040 !!end
7041
7042 !!test
7043 Templates: HTML Tables: 5. Proper fostering of categories from inside
7044 !!options
7045 parsoid=wt2html,wt2wt
7046 !!input
7047 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7048 <!--Two categories (Bug 50330)-->
7049 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7050 !!result
7051 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7052 <!--Two categories (Bug 50330)-->
7053 <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>
7054 !!end
7055
7056 !!test
7057 Templates: Wiki Tables: 1a. Fostering of entire template content
7058 !!input
7059 {|
7060 {{echo|a}}
7061 |}
7062 !!result
7063 <table>
7064 a
7065 <tr><td></td></tr></table>
7066
7067 !!end
7068
7069 !!test
7070 Templates: Wiki Tables: 1b. Fostering of entire template content
7071 !!input
7072 {|
7073 {{echo|<div>}}
7074 foo
7075 {{echo|</div>}}
7076 |}
7077 !!result
7078 <table>
7079 <div>
7080 <p>foo
7081 </p>
7082 </div>
7083 <tr><td></td></tr></table>
7084
7085 !!end
7086
7087 !!test
7088 Templates: Wiki Tables: 2. Fostering of partial template content
7089 !!input
7090 {|
7091 {{echo|a
7092 <div>b</div>}}
7093 |}
7094 !!result
7095 <table>
7096 a
7097 <div>b</div>
7098 <tr><td></td></tr></table>
7099
7100 !!end
7101
7102 !!test
7103 Templates: Wiki Tables: 3. td-content via multiple templates
7104 !!input
7105 {|
7106 {{echo|{{pipe}}a}}{{echo|b}}
7107 |}
7108 !!result
7109 <table>
7110 <tr>
7111 <td>ab
7112 </td></tr></table>
7113
7114 !!end
7115
7116 !!test
7117 Templates: Wiki Tables: 4. Templated tags, no content
7118 !!input
7119 {{tbl-start}}
7120 {{tbl-end}}
7121 !!result
7122 <table>
7123 <tr><td></td></tr></table>
7124
7125 !!end
7126
7127 !!test
7128 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7129 !!input
7130 {{tbl-start}}
7131 |foo
7132 {{tbl-end}}
7133 !!result
7134 <table>
7135 <tr>
7136 <td>foo
7137 </td></tr></table>
7138
7139 !!end
7140
7141 !!test
7142 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7143 !!input
7144 {{tbl-start}}
7145 {{!}}foo
7146 {{tbl-end}}
7147 !!result
7148 <table>
7149 <tr>
7150 <td>foo
7151 </td></tr></table>
7152
7153 !!end
7154
7155 !!test
7156 Templates: Lists: Multi-line list-items via templates
7157 !!input
7158 *{{echo|a {{nonexistent|
7159 unused}}}}
7160 *{{echo|b {{nonexistent|
7161 unused}}}}
7162 !!result
7163 <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>
7164 </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>
7165 </li></ul>
7166
7167 !!end
7168
7169 !!test
7170 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7171 !!input
7172 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7173 !!result
7174 <p><i>ab</i>c<i>d</i>e
7175 </p>
7176 !!end
7177
7178 !!test
7179 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7180 (PHP parser generates misnested html)
7181 !! options
7182 parsoid=wt2html,wt2wt
7183 !!input
7184 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7185 !!result
7186 <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>
7187 !!end
7188
7189 !!test
7190 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7191 (PHP parser generates misnested html)
7192 !! options
7193 parsoid=wt2html,wt2wt
7194 !!input
7195 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7196 !!result
7197 <div typeof="mw:Transclusion"><i>a</i></div>
7198 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7199 <div typeof="mw:Transclusion">e</div>
7200 !!end
7201
7202 !!test
7203 Templates: Ugly nesting: 4. Divs opened/closed across templates
7204 !!input
7205 a<div>b{{echo|c</div>d}}e
7206 !!result
7207 a<div>bc</div>de
7208
7209 !!end
7210
7211 !!test
7212 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7213 (Parsoid-centric)
7214 !! options
7215 parsoid
7216 !!input
7217 {|
7218 |{{echo|foo</table>}}
7219 |bar
7220 |}
7221 !!result
7222 <table typeof="mw:Transclusion">
7223 <tbody>
7224 <tr>
7225 <td>foo</td></tr></tbody></table><span>bar</span>
7226 !!end
7227
7228 !!test
7229 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7230 (Parsoid-centric)
7231 !! options
7232 parsoid
7233 !!input
7234 <table>
7235 <tr>
7236 <td>
7237 <table>
7238 <tr>
7239 <td>1. {{echo|foo </table>}}</td>
7240 <td> bar </td>
7241 <td>2. {{echo|baz </table>}}</td>
7242 </tr>
7243 <tr>
7244 <td>abc</td>
7245 </tr>
7246 </table>
7247 </td>
7248 </tr>
7249 <tr>
7250 <td>xyz</td>
7251 </tr>
7252 </table>
7253 !!result
7254 <table about="#mwt1" typeof="mw:Transclusion">
7255 <tbody><tr >
7256 <td >
7257 <table >
7258 <tbody><tr >
7259 <td >1. foo </td></tr></tbody></table></td>
7260 <td > bar </td>
7261 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7262 </span><span about="#mwt1">
7263
7264 abc</span><span about="#mwt1">
7265 </span><span about="#mwt1">
7266 </span><span about="#mwt1">
7267 </span><span about="#mwt1">
7268 </span><span about="#mwt1">
7269
7270 xyz</span><span about="#mwt1">
7271 </span><span about="#mwt1">
7272 </span>
7273 !!end
7274
7275 !! test
7276 Templates: Ugly templates: 3. newline-only template parameter
7277 !! input
7278 foo {{echo|
7279 }}
7280 !! result
7281 <p>foo
7282 </p>
7283 !! end
7284
7285 # This looks like a bug: a single newline triggers p/br for some reason.
7286 !! test
7287 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7288 !! input
7289 {{echo|
7290 }}
7291 !! result
7292 <p><br />
7293 </p>
7294 !! end
7295
7296
7297 !!test
7298 Parser Functions: 1. Simple example
7299 !!input
7300 {{uc:foo}}
7301 !!result
7302 <p>FOO
7303 </p>
7304 !!end
7305
7306 !!test
7307 Parser Functions: 2. Nested use (only outermost should be marked up)
7308 !!input
7309 {{uc:{{lc:FOO}}}}
7310 !!result
7311 <p>FOO
7312 </p>
7313 !!end
7314
7315 ###
7316 ### Pre-save transform tests
7317 ###
7318 !! test
7319 pre-save transform: subst:
7320 !! options
7321 PST
7322 !! input
7323 {{subst:test}}
7324 !! result
7325 This is a test template
7326 !! end
7327
7328 !! test
7329 pre-save transform: normal template
7330 !! options
7331 PST
7332 !! input
7333 {{test}}
7334 !! result
7335 {{test}}
7336 !! end
7337
7338 !! test
7339 pre-save transform: nonexistent template
7340 !! options
7341 PST
7342 !! input
7343 {{thistemplatedoesnotexist}}
7344 !! result
7345 {{thistemplatedoesnotexist}}
7346 !! end
7347
7348
7349 !! test
7350 pre-save transform: subst magic variables
7351 !! options
7352 PST
7353 !! input
7354 {{subst:SITENAME}}
7355 !! result
7356 MediaWiki
7357 !! end
7358
7359 # This is bug 89, which I fixed. -- wtm
7360 !! test
7361 pre-save transform: subst: templates with parameters
7362 !! options
7363 pst
7364 !! input
7365 {{subst:paramtest|param="something else"}}
7366 !! result
7367 This is a test template with parameter "something else"
7368 !! end
7369
7370 !! article
7371 Template:nowikitest
7372 !! text
7373 <nowiki>'''not wiki'''</nowiki>
7374 !! endarticle
7375
7376 !! test
7377 pre-save transform: nowiki in subst (bug 1188)
7378 !! options
7379 pst
7380 !! input
7381 {{subst:nowikitest}}
7382 !! result
7383 <nowiki>'''not wiki'''</nowiki>
7384 !! end
7385
7386
7387 !! article
7388 Template:commenttest
7389 !! text
7390 This template has <!-- a comment --> in it.
7391 !! endarticle
7392
7393 !! test
7394 pre-save transform: comment in subst (bug 1936)
7395 !! options
7396 pst
7397 !! input
7398 {{subst:commenttest}}
7399 !! result
7400 This template has <!-- a comment --> in it.
7401 !! end
7402
7403 !! test
7404 pre-save transform: unclosed tag
7405 !! options
7406 pst noxml
7407 !! input
7408 <nowiki>'''not wiki'''
7409 !! result
7410 <nowiki>'''not wiki'''
7411 !! end
7412
7413 !! test
7414 pre-save transform: mixed tag case
7415 !! options
7416 pst noxml
7417 !! input
7418 <NOwiki>'''not wiki'''</noWIKI>
7419 !! result
7420 <NOwiki>'''not wiki'''</noWIKI>
7421 !! end
7422
7423 !! test
7424 pre-save transform: unclosed comment in <nowiki>
7425 !! options
7426 pst noxml
7427 !! input
7428 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7429 !! result
7430 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7431 !!end
7432
7433 # Leading @ in this template definition works around a limitation
7434 # in parsoid's parserTests which otherwise strips the <span> from the
7435 # result (confusing it for a template wrapper)
7436 !! article
7437 Template:dangerous
7438 !!text
7439 @<span onmouseover="alert('crap')">Oh no</span>
7440 !!endarticle
7441
7442 !!test
7443 (confirming safety of fix for subst bug 1936)
7444 !! input
7445 {{Template:dangerous}}
7446 !! result
7447 <p>@<span>Oh no</span>
7448 </p>
7449 !! end
7450
7451 !! test
7452 pre-save transform: comment containing gallery (bug 5024)
7453 !! options
7454 pst
7455 !! input
7456 <!-- <gallery>data</gallery> -->
7457 !!result
7458 <!-- <gallery>data</gallery> -->
7459 !!end
7460
7461 !! test
7462 pre-save transform: comment containing extension
7463 !! options
7464 pst
7465 !! input
7466 <!-- <tag>data</tag> -->
7467 !!result
7468 <!-- <tag>data</tag> -->
7469 !!end
7470
7471 !! test
7472 pre-save transform: comment containing nowiki
7473 !! options
7474 pst
7475 !! input
7476 <!-- <nowiki>data</nowiki> -->
7477 !!result
7478 <!-- <nowiki>data</nowiki> -->
7479 !!end
7480
7481 !! test
7482 pre-save transform: <noinclude> in subst (bug 3298)
7483 !! options
7484 pst
7485 !! input
7486 {{subst:Includes}}
7487 !! result
7488 Foobar
7489 !! end
7490
7491 !! test
7492 pre-save transform: <onlyinclude> in subst (bug 3298)
7493 !! options
7494 pst
7495 !! input
7496 {{subst:Includes2}}
7497 !! result
7498 Foo
7499 !! end
7500
7501 !! article
7502 Template:SubstTest
7503 !!text
7504 {{<includeonly>subst:</includeonly>Includes}}
7505 !! endarticle
7506
7507 !! article
7508 Template:SafeSubstTest
7509 !! text
7510 {{<includeonly>safesubst:</includeonly>Includes}}
7511 !! endarticle
7512
7513 !! test
7514 bug 22297: safesubst: works during PST
7515 !! options
7516 pst
7517 !! input
7518 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7519 !! result
7520 FoobarFoobar
7521 !! end
7522
7523 !! test
7524 bug 22297: safesubst: works during normal parse
7525 !! input
7526 {{SafeSubstTest}}
7527 !! result
7528 <p>Foobar
7529 </p>
7530 !! end
7531
7532 !! test:
7533 subst: does not work during normal parse
7534 !! input
7535 {{SubstTest}}
7536 !! result
7537 <p>{{subst:Includes}}
7538 </p>
7539 !! end
7540
7541 !! test
7542 pre-save transform: context links ("pipe trick")
7543 !! options
7544 pst
7545 !! input
7546 [[Article (context)|]]
7547 [[Bar:Article|]]
7548 [[:Bar:Article|]]
7549 [[Bar:Article (context)|]]
7550 [[:Bar:Article (context)|]]
7551 [[|Article]]
7552 [[|Article (context)]]
7553 [[Bar:X (Y) Z|]]
7554 [[:Bar:X (Y) Z|]]
7555 !! result
7556 [[Article (context)|Article]]
7557 [[Bar:Article|Article]]
7558 [[:Bar:Article|Article]]
7559 [[Bar:Article (context)|Article]]
7560 [[:Bar:Article (context)|Article]]
7561 [[Article]]
7562 [[Article (context)]]
7563 [[Bar:X (Y) Z|X (Y) Z]]
7564 [[:Bar:X (Y) Z|X (Y) Z]]
7565 !! end
7566
7567 !! test
7568 pre-save transform: context links ("pipe trick") with interwiki prefix
7569 !! options
7570 pst
7571 !! input
7572 [[interwiki:Article|]]
7573 [[:interwiki:Article|]]
7574 [[interwiki:Bar:Article|]]
7575 [[:interwiki:Bar:Article|]]
7576 !! result
7577 [[interwiki:Article|Article]]
7578 [[:interwiki:Article|Article]]
7579 [[interwiki:Bar:Article|Bar:Article]]
7580 [[:interwiki:Bar:Article|Bar:Article]]
7581 !! end
7582
7583 !! test
7584 pre-save transform: context links ("pipe trick") with parens in title
7585 !! options
7586 pst title=[[Somearticle (context)]]
7587 !! input
7588 [[|Article]]
7589 !! result
7590 [[Article (context)|Article]]
7591 !! end
7592
7593 !! test
7594 pre-save transform: context links ("pipe trick") with comma in title
7595 !! options
7596 pst title=[[Someplace, Somewhere]]
7597 !! input
7598 [[|Otherplace]]
7599 [[Otherplace, Elsewhere|]]
7600 [[Otherplace, Elsewhere, Anywhere|]]
7601 !! result
7602 [[Otherplace, Somewhere|Otherplace]]
7603 [[Otherplace, Elsewhere|Otherplace]]
7604 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7605 !! end
7606
7607 !! test
7608 pre-save transform: context links ("pipe trick") with parens and comma
7609 !! options
7610 pst title=[[Someplace (IGNORED), Somewhere]]
7611 !! input
7612 [[|Otherplace]]
7613 [[Otherplace (place), Elsewhere|]]
7614 !! result
7615 [[Otherplace, Somewhere|Otherplace]]
7616 [[Otherplace (place), Elsewhere|Otherplace]]
7617 !! end
7618
7619 !! test
7620 pre-save transform: context links ("pipe trick") with comma and parens
7621 !! options
7622 pst title=[[Who, me? (context)]]
7623 !! input
7624 [[|Yes, you.]]
7625 [[Me, Myself, and I (1937 song)|]]
7626 !! result
7627 [[Yes, you. (context)|Yes, you.]]
7628 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7629 !! end
7630
7631 !! test
7632 pre-save transform: context links ("pipe trick") with namespace
7633 !! options
7634 pst title=[[Ns:Somearticle]]
7635 !! input
7636 [[|Article]]
7637 !! result
7638 [[Ns:Article|Article]]
7639 !! end
7640
7641 !! test
7642 pre-save transform: context links ("pipe trick") with namespace and parens
7643 !! options
7644 pst title=[[Ns:Somearticle (context)]]
7645 !! input
7646 [[|Article]]
7647 !! result
7648 [[Ns:Article (context)|Article]]
7649 !! end
7650
7651 !! test
7652 pre-save transform: context links ("pipe trick") with namespace and comma
7653 !! options
7654 pst title=[[Ns:Somearticle, Context, Whatever]]
7655 !! input
7656 [[|Article]]
7657 !! result
7658 [[Ns:Article, Context, Whatever|Article]]
7659 !! end
7660
7661 !! test
7662 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7663 !! options
7664 pst title=[[Ns:Somearticle, Context (context)]]
7665 !! input
7666 [[|Article]]
7667 !! result
7668 [[Ns:Article (context)|Article]]
7669 !! end
7670
7671 !! test
7672 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7673 !! options
7674 pst title=[[Ns:Somearticle (IGNORED), Context]]
7675 !! input
7676 [[|Article]]
7677 !! result
7678 [[Ns:Article, Context|Article]]
7679 !! end
7680
7681 !! test
7682 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7683 !! options
7684 pst
7685 !! input
7686 [[Article(context)|]]
7687 [[Bar:Article(context)|]]
7688 [[:Bar:Article(context)|]]
7689 [[|Article(context)]]
7690 [[Bar:X(Y)Z|]]
7691 [[:Bar:X(Y)Z|]]
7692 !! result
7693 [[Article(context)|Article]]
7694 [[Bar:Article(context)|Article]]
7695 [[:Bar:Article(context)|Article]]
7696 [[Article(context)]]
7697 [[Bar:X(Y)Z|X(Y)Z]]
7698 [[:Bar:X(Y)Z|X(Y)Z]]
7699 !! end
7700
7701 !! test
7702 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7703 !! options
7704 pst
7705 !! input
7706 [[Article (context)|]]
7707 [[Bar:Article (context)|]]
7708 [[:Bar:Article (context)|]]
7709 [[|Article (context)]]
7710 [[Bar:X (Y) Z|]]
7711 [[:Bar:X (Y) Z|]]
7712 !! result
7713 [[Article (context)|Article]]
7714 [[Bar:Article (context)|Article]]
7715 [[:Bar:Article (context)|Article]]
7716 [[Article (context)]]
7717 [[Bar:X (Y) Z|X (Y) Z]]
7718 [[:Bar:X (Y) Z|X (Y) Z]]
7719 !! end
7720
7721 !! test
7722 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7723 !! options
7724 pst
7725 !! input
7726 [[Article(context)|]]
7727 [[Bar:Article(context)|]]
7728 [[:Bar:Article(context)|]]
7729 [[|Article(context)]]
7730 [[Bar:X(Y)Z|]]
7731 [[:Bar:X(Y)Z|]]
7732 !! result
7733 [[Article(context)|Article]]
7734 [[Bar:Article(context)|Article]]
7735 [[:Bar:Article(context)|Article]]
7736 [[Article(context)]]
7737 [[Bar:X(Y)Z|X(Y)Z]]
7738 [[:Bar:X(Y)Z|X(Y)Z]]
7739 !! end
7740
7741 !! test
7742 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7743 !! options
7744 pst
7745 !! input
7746 [[Article (context), context|]]
7747 [[Article (context),context|]]
7748 [[Bar:Article (context), context|]]
7749 [[Bar:Article (context),context|]]
7750 [[:Bar:Article (context), context|]]
7751 [[:Bar:Article (context),context|]]
7752 !! result
7753 [[Article (context), context|Article]]
7754 [[Article (context),context|Article]]
7755 [[Bar:Article (context), context|Article]]
7756 [[Bar:Article (context),context|Article]]
7757 [[:Bar:Article (context), context|Article]]
7758 [[:Bar:Article (context),context|Article]]
7759 !! end
7760
7761 !! test
7762 pre-save transform: trim trailing empty lines
7763 !! options
7764 pst
7765 !! input
7766 Empty lines are trimmed
7767
7768
7769
7770
7771 !! result
7772 Empty lines are trimmed
7773 !! end
7774
7775 !! test
7776 pre-save transform: Signature expansion
7777 !! options
7778 pst
7779 !! input
7780 * ~~~
7781 * <noinclude>~~~</noinclude>
7782 * <includeonly>~~~</includeonly>
7783 * <onlyinclude>~~~</onlyinclude>
7784 !! result
7785 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7786 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7787 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7788 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7789 !! end
7790
7791
7792 !! test
7793 pre-save transform: Signature expansion in nowiki tags (bug 93)
7794 !! options
7795 pst disabled
7796 !! input
7797 Shall not expand:
7798
7799 <nowiki>~~~~</nowiki>
7800
7801 <includeonly><nowiki>~~~~</nowiki></includeonly>
7802
7803 <noinclude><nowiki>~~~~</nowiki></noinclude>
7804
7805 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7806
7807 {{subst:Foo}} shall be converted to FOO
7808
7809 As well as inside noinclude/onlyinclude
7810 <noinclude>{{subst:Foo}}</noinclude>
7811 <onlyinclude>{{subst:Foo}}</onlyinclude>
7812
7813 But not inside includeonly
7814 <includeonly>{{subst:Foo}}</includeonly>
7815 !! result
7816 Shall not expand:
7817
7818 <nowiki>~~~~</nowiki>
7819
7820 <includeonly><nowiki>~~~~</nowiki></includeonly>
7821
7822 <noinclude><nowiki>~~~~</nowiki></noinclude>
7823
7824 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7825
7826 FOO shall be converted to FOO
7827
7828 As well as inside noinclude/onlyinclude
7829 <noinclude>FOO</noinclude>
7830 <onlyinclude>FOO</onlyinclude>
7831
7832 But not inside includeonly
7833 <includeonly>{{subst:Foo}}</includeonly>
7834 !! end
7835
7836 !! test
7837 Parsoid: Recognize nowiki with trailing space in tags
7838 !! options
7839 parsoid=wt2html
7840 !! input
7841 <nowiki ><div>[[foo]]</nowiki >
7842
7843 a<nowiki / >b
7844
7845 c<nowiki />d
7846
7847 e<nowiki/ >f
7848 !! result
7849 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7850 <p>ab</p>
7851 <p>cd</p>
7852 <p>ef</p>
7853 !! end
7854
7855 !! test
7856 Parsoid: Recognize nowiki with odd capitalization
7857 !! options
7858 parsoid=wt2html
7859 !! input
7860 <noWikI ><div>[[foo]]</Nowiki >
7861 !! result
7862 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7863 !! end
7864
7865
7866 !! test
7867 Parsoid: Escape nowiki with trailing space in tags
7868 !! options
7869 parsoid=html2wt
7870 !! input
7871 &lt;nowiki &gt; foo &lt;/nowiki &gt;
7872
7873 a&lt;nowiki /&gt;b
7874
7875 c&lt;nowiki/ &gt;d
7876 !! result
7877 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
7878 <p>a&lt;nowiki /&gt;b</p>
7879 <p>c&lt;nowiki/ &gt;d</p>
7880 !! end
7881
7882 !! test
7883 Parsoid: Escape weird noWikI capitalizations
7884 !! options
7885 parsoid=html2wt
7886 !! input
7887 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
7888 !! result
7889 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
7890 !! end
7891
7892 ###
7893 ### Message transform tests
7894 ###
7895 !! test
7896 message transform: magic variables
7897 !! options
7898 msg
7899 !! input
7900 {{SITENAME}}
7901 !! result
7902 MediaWiki
7903 !! end
7904
7905 !! test
7906 message transform: should not transform wiki markup
7907 !! options
7908 msg
7909 !! input
7910 ''test''
7911 !! result
7912 ''test''
7913 !! end
7914
7915 !! test
7916 message transform: <noinclude> in transcluded template (bug 4926)
7917 !! options
7918 msg
7919 !! input
7920 {{Includes}}
7921 !! result
7922 Foobar
7923 !! end
7924
7925 !! test
7926 message transform: <onlyinclude> in transcluded template (bug 4926)
7927 !! options
7928 msg
7929 !! input
7930 {{Includes2}}
7931 !! result
7932 Foo
7933 !! end
7934
7935 !! test
7936 {{#special:}} page name, known
7937 !! options
7938 msg
7939 !! input
7940 {{#special:Recentchanges}}
7941 !! result
7942 Special:RecentChanges
7943 !! end
7944
7945 !! test
7946 {{#special:}} page name with subpage, known
7947 !! options
7948 msg
7949 !! input
7950 {{#special:Recentchanges/param}}
7951 !! result
7952 Special:RecentChanges/param
7953 !! end
7954
7955 !! test
7956 {{#special:}} page name, unknown
7957 !! options
7958 msg
7959 !! input
7960 {{#special:foobar nonexistent}}
7961 !! result
7962 Special:Foobar nonexistent
7963 !! end
7964
7965 !! test
7966 {{#speciale:}} page name, known
7967 !! options
7968 msg
7969 !! input
7970 {{#speciale:Recentchanges}}
7971 !! result
7972 Special:RecentChanges
7973 !! end
7974
7975 !! test
7976 {{#speciale:}} page name with subpage, known
7977 !! options
7978 msg
7979 !! input
7980 {{#speciale:Recentchanges/param}}
7981 !! result
7982 Special:RecentChanges/param
7983 !! end
7984
7985 !! test
7986 {{#speciale:}} page name, unknown
7987 !! options
7988 msg
7989 !! input
7990 {{#speciale:foobar nonexistent}}
7991 !! result
7992 Special:Foobar_nonexistent
7993 !! end
7994
7995 ###
7996 ### Images
7997 ###
7998 !! test
7999 Simple image
8000 !! input
8001 [[Image:foobar.jpg]]
8002 !! result
8003 <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>
8004 </p>
8005 !! end
8006
8007 !! test
8008 Right-aligned image
8009 !! input
8010 [[Image:foobar.jpg|right]]
8011 !! result
8012 <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>
8013
8014 !! end
8015
8016 !! test
8017 Simple image (using File: namespace, now canonical)
8018 !! input
8019 [[File:foobar.jpg]]
8020 !! result
8021 <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>
8022 </p>
8023 !! end
8024
8025 !! test
8026 Image with caption
8027 !! input
8028 [[Image:foobar.jpg|right|Caption text]]
8029 !! result
8030 <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>
8031
8032 !! end
8033
8034 !! test
8035 Image with empty attribute
8036 !! input
8037 [[Image:foobar.jpg|right||Caption text]]
8038 !! result
8039 <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>
8040
8041 !! end
8042
8043 !! test
8044 Image with attributes from template.
8045 !! input
8046 [[Image:foobar.jpg|{{image_attribs}}]]
8047 !! result
8048 <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>
8049
8050 !! end
8051
8052 !! test
8053 Image with link tails
8054 !! input
8055 123[[Image:foobar.jpg]]456
8056 123[[Image:foobar.jpg|right]]456
8057 123[[Image:foobar.jpg|thumb]]456
8058 !! result
8059 <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
8060 </p>
8061 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
8062 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
8063
8064 !! end
8065
8066 !! test
8067 Image with multiple captions -- only last one is accepted
8068 !! input
8069 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8070 !! result
8071 <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>
8072
8073 !! end
8074
8075 !! test
8076 Image with width attribute at different positions
8077 !! input
8078 [[Image:foobar.jpg|200px|right|Caption]]
8079 [[Image:foobar.jpg|right|200px|Caption]]
8080 [[Image:foobar.jpg|right|Caption|200px]]
8081 !! result
8082 <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>
8083 <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>
8084 <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>
8085
8086 !! end
8087
8088 !! test
8089 Image with link parameter, wiki target
8090 !! input
8091 [[Image:foobar.jpg|link=Target page]]
8092 !! result
8093 <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>
8094 </p>
8095 !! end
8096
8097 !! test
8098 Image with link parameter, URL target
8099 !! input
8100 [[Image:foobar.jpg|link=http://example.com/]]
8101 !! result
8102 <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>
8103 </p>
8104 !! end
8105
8106 !! test
8107 Image with link parameter, wgExternalLinkTarget
8108 !! input
8109 [[Image:foobar.jpg|link=http://example.com/]]
8110 !! config
8111 wgExternalLinkTarget='foobar'
8112 !! result
8113 <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>
8114 </p>
8115 !! end
8116
8117 !! test
8118 Image with link parameter, wgNoFollowLinks set to false
8119 !! input
8120 [[Image:foobar.jpg|link=http://example.com/]]
8121 !! config
8122 wgNoFollowLinks=false
8123 !! result
8124 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8125 </p>
8126 !! end
8127
8128 !! test
8129 Image with link parameter, wgNoFollowDomainExceptions
8130 !! input
8131 [[Image:foobar.jpg|link=http://example.com/]]
8132 !! config
8133 wgNoFollowDomainExceptions='example.com'
8134 !! result
8135 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8136 </p>
8137 !! end
8138
8139 !! test
8140 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8141 !! input
8142 [[Image:foobar.jpg|link=http://example.com/|Title]]
8143 !! config
8144 wgExternalLinkTarget='foobar'
8145 !! result
8146 <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>
8147 </p>
8148 !! end
8149
8150 !! test
8151 Image with empty link parameter
8152 !! input
8153 [[Image:foobar.jpg|link=]]
8154 !! result
8155 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8156 </p>
8157 !! end
8158
8159 !! test
8160 Image with link parameter (wiki target) and unnamed parameter
8161 !! input
8162 [[Image:foobar.jpg|link=Target page|Title]]
8163 !! result
8164 <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>
8165 </p>
8166 !! end
8167
8168 !! test
8169 Image with link parameter (URL target) and unnamed parameter
8170 !! input
8171 [[Image:foobar.jpg|link=http://example.com/|Title]]
8172 !! result
8173 <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>
8174 </p>
8175 !! end
8176
8177 !! test
8178 Thumbnail image with link parameter
8179 !! options
8180 php
8181 !! input
8182 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8183 !! result
8184 <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>
8185
8186 !! end
8187
8188 !! test
8189 Manually-specified thumbnail image
8190 !! options
8191 php
8192 !! input
8193 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8194 !! result
8195 <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>
8196
8197 !! end
8198
8199 !! test
8200 Manually-specified thumbnail image with explicit link to wiki page
8201 !! options
8202 php
8203 !! input
8204 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8205 !! result
8206 <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>
8207
8208 !! end
8209
8210 !! test
8211 Manually-specified thumbnail image with explicit link to url
8212 !! options
8213 php
8214 !! input
8215 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8216 !! result
8217 <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>
8218
8219 !! end
8220
8221 !! test
8222 Manually-specified thumbnail image with explicit no link
8223 !! options
8224 php
8225 !! input
8226 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8227 !! result
8228 <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>
8229
8230 !! end
8231
8232 !! test
8233 Manually-specified thumbnail image with explicit link and alt text
8234 !! options
8235 php
8236 !! input
8237 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8238 !! result
8239 <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>
8240
8241 !! end
8242
8243 !! test
8244 Image with frame and link
8245 !! input
8246 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8247 !! result
8248 <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>
8249
8250 !! end
8251
8252 !! test
8253 Image with frame and link and explicit alt
8254 !! input
8255 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8256 !! result
8257 <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>
8258
8259 !! end
8260
8261 !! test
8262 Image with wiki markup in implicit alt
8263 !! input
8264 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8265 !! result
8266 <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>
8267 </p>
8268 !! end
8269
8270 !! test
8271 Image with wiki markup in explicit alt
8272 !! input
8273 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8274 !! result
8275 <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>
8276 </p>
8277 !! end
8278
8279 !! test
8280 Link to image page- image page normally doesn't exists, hence edit link
8281 Add test with existing image page
8282 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8283 !! input
8284 [[:Image:test]]
8285 !! result
8286 <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>
8287 </p>
8288 !! end
8289
8290 !! test
8291 bug 18784 Link to non-existent image page with caption should use caption as link text
8292 !! input
8293 [[:Image:test|caption]]
8294 !! result
8295 <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>
8296 </p>
8297 !! end
8298
8299 !! test
8300 Frameless image caption with a free URL
8301 !! input
8302 [[Image:foobar.jpg|http://example.com]]
8303 !! result
8304 <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>
8305 </p>
8306 !! end
8307
8308 !! test
8309 Thumbnail image caption with a free URL
8310 !! input
8311 [[Image:foobar.jpg|thumb|http://example.com]]
8312 !! result
8313 <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>
8314
8315 !! end
8316
8317 !! test
8318 Thumbnail image caption with a free URL and explicit alt
8319 !! input
8320 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8321 !! result
8322 <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>
8323
8324 !! end
8325
8326 !! test
8327 SVG thumbnails with no language set
8328 !! options
8329 !! input
8330 [[File:Foobar.svg|thumb|width=200]]
8331 !! result
8332 <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>
8333
8334 !! end
8335
8336 !! test
8337 SVG thumbnails with language de
8338 !! options
8339 !! input
8340 [[File:Foobar.svg|thumb|width=200|lang=de]]
8341 !! result
8342 <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>
8343
8344 !! end
8345
8346 !! test
8347 SVG thumbnails with invalid language code
8348 !! options
8349 !! input
8350 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8351 !! result
8352 <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>
8353
8354 !! end
8355
8356 !! test
8357 BUG 1887: A ISBN with a thumbnail
8358 !! input
8359 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8360 !! result
8361 <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>
8362
8363 !! end
8364
8365 !! test
8366 BUG 1887: A RFC with a thumbnail
8367 !! input
8368 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8369 !! result
8370 <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>
8371
8372 !! end
8373
8374 !! test
8375 BUG 1887: A mailto link with a thumbnail
8376 !! input
8377 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8378 !! result
8379 <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>
8380
8381 !! end
8382
8383 # Pending resolution to bug 368
8384 !! test
8385 BUG 648: Frameless image caption with a link
8386 !! input
8387 [[Image:foobar.jpg|text with a [[link]] in it]]
8388 !! result
8389 <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>
8390 </p>
8391 !! end
8392
8393 !! test
8394 BUG 648: Frameless image caption with a link (suffix)
8395 !! input
8396 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8397 !! result
8398 <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>
8399 </p>
8400 !! end
8401
8402 !! test
8403 BUG 648: Frameless image caption with an interwiki link
8404 !! input
8405 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8406 !! result
8407 <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>
8408 </p>
8409 !! end
8410
8411 !! test
8412 BUG 648: Frameless image caption with a piped interwiki link
8413 !! input
8414 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8415 !! result
8416 <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>
8417 </p>
8418 !! end
8419
8420 !! test
8421 Escape HTML special chars in image alt text
8422 !! input
8423 [[Image:foobar.jpg|& < > "]]
8424 !! result
8425 <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>
8426 </p>
8427 !! end
8428
8429 !! test
8430 BUG 499: Alt text should have &#1234;, not &amp;1234;
8431 !! input
8432 [[Image:foobar.jpg|&#9792;]]
8433 !! result
8434 <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>
8435 </p>
8436 !! end
8437
8438 !! test
8439 Broken image caption with link
8440 !! input
8441 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8442 !! result
8443 <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.
8444 </p>
8445 !! end
8446
8447 !! test
8448 Image caption containing another image
8449 !! input
8450 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8451 !! result
8452 <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>
8453
8454 !! end
8455
8456 !! test
8457 Image caption containing a newline
8458 !! input
8459 [[Image:Foobar.jpg|This
8460 *is some text]]
8461 !! result
8462 <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>
8463 </p>
8464 !!end
8465
8466 !!test
8467 Parsoid: Image caption containing leading space
8468 (The leading space should not trigger nowiki escaping in wt2wt mode)
8469 !! input
8470 [[Image:Foobar.jpg|thumb| bar]]
8471 !! result
8472 <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>
8473
8474 !!end
8475
8476 !! test
8477 Bug 3090: External links other than http: in image captions
8478 !! input
8479 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8480 !! result
8481 <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>
8482
8483 !! end
8484
8485 !! test
8486 Custom class
8487 !! input
8488 [[Image:foobar.jpg|a|class=b]]
8489 !! result
8490 <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>
8491 </p>
8492 !! end
8493
8494 !! test
8495 Localized image handling (1).
8496 !! options
8497 language=es
8498 !! input
8499 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8500 !! result
8501 <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>
8502
8503 !! end
8504
8505 !! test
8506 Localized image handling (2).
8507 !! options
8508 language=es
8509 !! input
8510 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8511 !! result
8512 <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>
8513
8514 !! end
8515
8516 !! test
8517 "border", "frameless" and "class" attributes on an image.
8518 !! input
8519 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8520 !! result
8521 <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>
8522 </p>
8523 !! end
8524
8525 !! article
8526 File:Barfoo.jpg
8527 !! text
8528 #REDIRECT [[File:Barfoo.jpg]]
8529 !! endarticle
8530
8531 !! test
8532 Redirected image
8533 !! input
8534 [[Image:Barfoo.jpg]]
8535 !! result
8536 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8537 </p>
8538 !! end
8539
8540 !! test
8541 Missing image with uploads disabled
8542 !! options
8543 wgEnableUploads=0
8544 !! input
8545 [[Image:Foobaz.jpg]]
8546 !! result
8547 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8548 </p>
8549 !! end
8550
8551 # Parsoid-specific testing for images
8552 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8553 # Currently imperfect due to a flaw in the Parsoid testrunner
8554 # Work in progress
8555
8556 !! test
8557 Parsoid-specific image handling - simple image
8558 !! options
8559 parsoid
8560 !! input
8561 [[Image:Foobar.jpg]]
8562 !! result
8563 <p>
8564 <span class="mw-default-size" typeof="mw:Image">
8565 <a href="File:Foobar.jpg">
8566 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8567 </a>
8568 </span>
8569 </p>
8570 !! end
8571
8572 !! test
8573 Parsoid-specific image handling - simple image without link
8574 !! options
8575 parsoid
8576 !! input
8577 [[Image:Foobar.jpg|link=]]
8578 !! result
8579 <p>
8580 <span class="mw-default-size" typeof="mw:Image">
8581 <span>
8582 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8583 </span>
8584 </span>
8585 </p>
8586 !! end
8587
8588 !! test
8589 Parsoid-specific image handling - simple image with specific link
8590 !! options
8591 parsoid
8592 !! input
8593 [[Image:Foobar.jpg|link=Main Page]]
8594 !! result
8595 <p>
8596 <span class="mw-default-size" typeof="mw:Image">
8597 <a href="Main_Page">
8598 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8599 </a>
8600 </span>
8601 </p>
8602 !! end
8603
8604 !! test
8605 Parsoid-specific image handling - simple image with size and middle alignment
8606 !! options
8607 parsoid
8608 !! input
8609 [[Image:Foobar.jpg|50px|middle]]
8610 !! result
8611 <p>
8612 <span class="mw-valign-middle" typeof="mw:Image">
8613 <a href="File:Foobar.jpg">
8614 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8615 </a>
8616 </span>
8617 </p>
8618 !! end
8619
8620 !! test
8621 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8622 !! options
8623 parsoid
8624 !! input
8625 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8626 !! result
8627 <p>
8628 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8629 <a href="File:Foobar.jpg">
8630 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8631 </a>
8632 </span>
8633 </p>
8634 !! end
8635
8636 !! test
8637 Parsoid-specific image handling - simple image with border and size spec
8638 !! options
8639 parsoid
8640 !! input
8641 [[Image:Foobar.jpg|50px|border|caption]]
8642 !! result
8643 <p>
8644 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8645 <a href="File:Foobar.jpg">
8646 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8647 </a>
8648 </span>
8649 </p>
8650 !! end
8651
8652 !! test
8653 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8654 !! options
8655 parsoid
8656 !! input
8657 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8658 !! result
8659 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8660 <a href="File:Foobar.jpg">
8661 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8662 </a>
8663 <figcaption>caption content</figcaption>
8664 </figure>
8665 !! end
8666
8667 !! test
8668 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8669 !! options
8670 parsoid
8671 !! input
8672 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8673 !! result
8674 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8675 <a href="File:Foobar.jpg">
8676 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8677 </a>
8678 <figcaption>caption</figcaption>
8679 </figure>
8680 !! end
8681
8682 !! test
8683 Parsoid-specific image handling - framed image with specific size and caption
8684 !! options
8685 parsoid
8686 !! input
8687 [[Image:Foobar.jpg|500x50px|frame|caption]]
8688 !! result
8689 <figure typeof="mw:Image/Frame">
8690 <a href="File:Foobar.jpg">
8691 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8692 </a>
8693 <figcaption>caption</figcaption>
8694 </figure>
8695 !! end
8696
8697 !! test
8698 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8699 !! options
8700 parsoid
8701 !! input
8702 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8703 !! result
8704 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8705 <a href="File:Foobar.jpg">
8706 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8707 </a>
8708 <figcaption>caption</figcaption>
8709 </figure>
8710 !! end
8711
8712 !! test
8713 Parsoid-specific image handling - frameless image with specific size, border, and caption
8714 !! options
8715 parsoid
8716 !! input
8717 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8718 !! result
8719 <p>
8720 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8721 <a href="File:Foobar.jpg">
8722 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8723 </a>
8724 </p>
8725 !! end
8726
8727 #!! test
8728 #Parsoid-specific image handling - simple image with a formatted caption
8729 #!! options
8730 #parsoid
8731 #!! input
8732 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8733 #!! result
8734 #<p>
8735 #<span typeof="mw:Image">
8736 #<a class="mw-default-size" href="Image:Foobar.jpg">
8737 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8738 #</a>
8739 #<span>abc</span>
8740 #</span>
8741 #</p>
8742
8743
8744 ###
8745 ### Subpages
8746 ###
8747 !! article
8748 Subpage test/subpage
8749 !! text
8750 foo
8751 !! endarticle
8752
8753 !! test
8754 Subpage link
8755 !! options
8756 subpage title=[[Subpage test]]
8757 !! input
8758 [[/subpage]]
8759 !! result
8760 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8761 </p>
8762 !! end
8763
8764 !! test
8765 Subpage noslash link
8766 !! options
8767 subpage title=[[Subpage test]]
8768 !!input
8769 [[/subpage/]]
8770 !! result
8771 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8772 </p>
8773 !! end
8774
8775 # TODO: make this PHP-parser compatible!
8776 !! test
8777 Relative subpage noslash link
8778 !! options
8779 parsoid=wt2wt,wt2html,html2html
8780 subpage title=[[Subpage test/1/2/3/4]]
8781 !!input
8782 [[../../subpage/]]
8783
8784 [[../../subpage]]
8785 !! result
8786 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8787 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8788 !! end
8789
8790 # TODO: make this PHP-parser compatible!
8791 !! test
8792 Parsoid: dot-slash prefixed wikilinks
8793 !! options
8794 parsoid=wt2wt,wt2html,html2html
8795 !!input
8796 [[./foo]]
8797
8798 [[././bar]]
8799
8800 [[././baz/]]
8801 !! result
8802 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8803 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8804 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8805 !! end
8806
8807 !! test
8808 Disabled subpages
8809 !! input
8810 [[/subpage]]
8811 !! result
8812 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8813 </p>
8814 !! end
8815
8816 !! test
8817 BUG 561: {{/Subpage}}
8818 !! options
8819 subpage title=[[Page]]
8820 !! input
8821 {{/Subpage}}
8822 !! result
8823 <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>
8824 </p>
8825 !! end
8826
8827 ###
8828 ### Categories
8829 ###
8830 !! article
8831 Category:MediaWiki User's Guide
8832 !! text
8833 blah
8834 !! endarticle
8835
8836 !! test
8837 Link to category
8838 !! input
8839 [[:Category:MediaWiki User's Guide]]
8840 !! result
8841 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8842 </p>
8843 !! end
8844
8845 !! test
8846 Simple category
8847 !! options
8848 cat
8849 !! input
8850 [[Category:MediaWiki User's Guide]]
8851 !! result
8852 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8853 !! end
8854
8855 !! test
8856 PAGESINCATEGORY invalid title fatal (r33546 fix)
8857 !! input
8858 {{PAGESINCATEGORY:<bogus>}}
8859 !! result
8860 <p>0
8861 </p>
8862 !! end
8863
8864 !! test
8865 Category with different sort key
8866 !! options
8867 cat
8868 !! input
8869 [[Category:MediaWiki User's Guide|Foo]]
8870 !! result
8871 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8872 !! end
8873
8874 !! test
8875 Category with identical sort key
8876 !! options
8877 cat
8878 !! input
8879 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8880 !! result
8881 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8882 !! end
8883
8884 !! test
8885 Category with empty sort key
8886 !! options
8887 cat
8888 pst
8889 !! input
8890 [[Category:MediaWiki User's Guide|]]
8891 !! result
8892 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8893 !! end
8894
8895 !! test
8896 Category with empty sort key and parentheses
8897 !! options
8898 cat
8899 pst
8900 !! input
8901 [[Category:Foo (bar)|]]
8902 !! result
8903 [[Category:Foo (bar)|Foo]]
8904 !! end
8905
8906 !! test
8907 Category with link tail
8908 !! options
8909 cat
8910 pst
8911 !! input
8912 123[[Category:Foo]]456
8913 !! result
8914 123[[Category:Foo]]456
8915 !! end
8916
8917 !! test
8918 Category with template
8919 !! options
8920 cat
8921 pst
8922 !! input
8923 [[Category:{{echo|Foo}}]]
8924 !! result
8925 [[Category:{{echo|Foo}}]]
8926 !! end
8927
8928 !! test
8929 Category with template in sort key
8930 !! options
8931 cat
8932 pst
8933 !! input
8934 [[Category:Foo|{{echo|Bar}}]]
8935 !! result
8936 [[Category:Foo|{{echo|Bar}}]]
8937 !! end
8938
8939 !! test
8940 Category with template in sort key and title
8941 !! options
8942 cat
8943 pst
8944 !! input
8945 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8946 !! result
8947 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8948 !! end
8949
8950 !! test
8951 Category / paragraph interactions
8952 !! input
8953 Foo [[Category:Baz]] Bar
8954
8955 Foo [[Category:Baz]]
8956 Bar
8957
8958 Foo
8959 [[Category:Baz]]
8960 Bar
8961
8962 Foo
8963 [[Category:Baz]] Bar
8964
8965 Foo
8966 [[Category:Baz]]
8967 [[Category:Baz]]
8968 [[Category:Baz]]
8969 Bar
8970
8971 [[Category:Baz]]
8972 [[Category:Baz]]
8973 [[Category:Baz]]
8974
8975 [[Category:Baz]]
8976 {{echo|[[Category:Baz]]}}
8977 [[Category:Baz]]
8978 !! result
8979 <p>Foo Bar
8980 </p><p>Foo
8981 Bar
8982 </p><p>Foo
8983 Bar
8984 </p><p>Foo Bar
8985 </p><p>Foo
8986 Bar
8987 </p>
8988 !! end
8989
8990 !! test
8991 Parsoid: Serialize link to category page with colon escape
8992 !! options
8993 parsoid
8994 !! input
8995
8996 [[:Category:Foo]]
8997 [[:Category:Foo|Bar]]
8998 !! result
8999 <p>
9000 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9001 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9002 </p>
9003 !! end
9004
9005 !! test
9006 Parsoid: Link prefix/suffixes aren't applied to category links
9007 !! options
9008 parsoid=wt2html,wt2wt,html2html
9009 language=is
9010 !! input
9011 x[[Category:Foo]]y
9012 !! result
9013 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9014 !! end
9015
9016 !! test
9017 Parsoid: Serialize link to file page with colon escape
9018 !! options
9019 parsoid
9020 !! input
9021
9022 [[:File:Foo.png]]
9023 [[:File:Foo.png|Bar]]
9024 !! result
9025 <p>
9026 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9027 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9028 </p>
9029 !! end
9030
9031 !! test
9032 Parsoid: Serialize a genuine category link without colon escape
9033 !! options
9034 parsoid
9035 !! input
9036 [[Category:Foo]]
9037 [[Category:Foo|Bar]]
9038 !! result
9039 <link rel="mw:WikiLink/Category" href="Category:Foo">
9040 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9041 !! end
9042
9043 ###
9044 ### Inter-language links
9045 ###
9046 !! test
9047 Inter-language links
9048 !! options
9049 ill
9050 !! input
9051 [[es:Alimento]]
9052 [[fr:Nourriture]]
9053 [[zh:&#39135;&#21697;]]
9054 !! result
9055 es:Alimento fr:Nourriture zh:食品
9056 !! end
9057
9058 !! test
9059 Duplicate interlanguage links (bug 24502)
9060 !! options
9061 ill
9062 !! input
9063 [[es:1]]
9064 [[es:2]]
9065 [[fr:1]]
9066 [[fr:2]]
9067 !! result
9068 es:1 fr:1
9069 !! end
9070
9071 ###
9072 ### Sections
9073 ###
9074 !! test
9075 Basic section headings
9076 !! input
9077 == Headline 1 ==
9078 Some text
9079
9080 ==Headline 2==
9081 More
9082 ===Smaller headline===
9083 Blah blah
9084 !! result
9085 <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>
9086 <p>Some text
9087 </p>
9088 <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>
9089 <p>More
9090 </p>
9091 <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>
9092 <p>Blah blah
9093 </p>
9094 !! end
9095
9096 !! test
9097 Section headings with TOC
9098 !! input
9099 == Headline 1 ==
9100 === Subheadline 1 ===
9101 ===== Skipping a level =====
9102 ====== Skipping a level ======
9103
9104 == Headline 2 ==
9105 Some text
9106 ===Another headline===
9107 !! result
9108 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9109 <ul>
9110 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9111 <ul>
9112 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9113 <ul>
9114 <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>
9115 <ul>
9116 <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>
9117 </ul>
9118 </li>
9119 </ul>
9120 </li>
9121 </ul>
9122 </li>
9123 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9124 <ul>
9125 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9126 </ul>
9127 </li>
9128 </ul>
9129 </div>
9130 <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>
9131 <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>
9132 <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>
9133 <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>
9134 <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>
9135 <p>Some text
9136 </p>
9137 <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>
9138
9139 !! end
9140
9141 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9142 !! test
9143 Handling of sections up to level 6 and beyond
9144 !! input
9145 = Level 1 Heading=
9146 == Level 2 Heading==
9147 === Level 3 Heading===
9148 ==== Level 4 Heading====
9149 ===== Level 5 Heading=====
9150 ====== Level 6 Heading======
9151 ======= Level 7 Heading=======
9152 ======== Level 8 Heading========
9153 ========= Level 9 Heading=========
9154 ========== Level 10 Heading==========
9155 !! result
9156 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9157 <ul>
9158 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9159 <ul>
9160 <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>
9161 <ul>
9162 <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>
9163 <ul>
9164 <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>
9165 <ul>
9166 <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>
9167 <ul>
9168 <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>
9169 <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>
9170 <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>
9171 <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>
9172 <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>
9173 </ul>
9174 </li>
9175 </ul>
9176 </li>
9177 </ul>
9178 </li>
9179 </ul>
9180 </li>
9181 </ul>
9182 </li>
9183 </ul>
9184 </div>
9185 <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>
9186 <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>
9187 <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>
9188 <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>
9189 <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>
9190 <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>
9191 <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>
9192 <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>
9193 <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>
9194 <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>
9195
9196 !! end
9197
9198 !! test
9199 TOC regression (bug 9764)
9200 !! input
9201 == title 1 ==
9202 === title 1.1 ===
9203 ==== title 1.1.1 ====
9204 === title 1.2 ===
9205 == title 2 ==
9206 === title 2.1 ===
9207 !! result
9208 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9209 <ul>
9210 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9211 <ul>
9212 <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>
9213 <ul>
9214 <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>
9215 </ul>
9216 </li>
9217 <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>
9218 </ul>
9219 </li>
9220 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9221 <ul>
9222 <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>
9223 </ul>
9224 </li>
9225 </ul>
9226 </div>
9227 <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>
9228 <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>
9229 <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>
9230 <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>
9231 <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>
9232 <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>
9233
9234 !! end
9235
9236 !! test
9237 TOC with wgMaxTocLevel=3 (bug 6204)
9238 !! options
9239 wgMaxTocLevel=3
9240 !! input
9241 == title 1 ==
9242 === title 1.1 ===
9243 ==== title 1.1.1 ====
9244 === title 1.2 ===
9245 == title 2 ==
9246 === title 2.1 ===
9247 !! result
9248 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9249 <ul>
9250 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9251 <ul>
9252 <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>
9253 <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>
9254 </ul>
9255 </li>
9256 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9257 <ul>
9258 <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>
9259 </ul>
9260 </li>
9261 </ul>
9262 </div>
9263 <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>
9264 <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>
9265 <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>
9266 <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>
9267 <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>
9268 <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>
9269
9270 !! end
9271
9272 !! test
9273 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9274 !! options
9275 wgMaxTocLevel=3
9276 !! input
9277 ==Section 1==
9278 ===Section 1.1===
9279 ====Section 1.1.1====
9280 ====Section 1.1.1.1====
9281 ==Section 2==
9282 !! result
9283 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9284 <ul>
9285 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9286 <ul>
9287 <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>
9288 </ul>
9289 </li>
9290 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9291 </ul>
9292 </div>
9293 <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>
9294 <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>
9295 <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>
9296 <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>
9297 <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>
9298
9299 !! end
9300
9301
9302 !! test
9303 Resolving duplicate section names
9304 !! input
9305 == Foo bar ==
9306 == Foo bar ==
9307 !! result
9308 <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>
9309 <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>
9310
9311 !! end
9312
9313 !! test
9314 Resolving duplicate section names with differing case (bug 10721)
9315 !! input
9316 == Foo bar ==
9317 == Foo Bar ==
9318 !! result
9319 <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>
9320 <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>
9321
9322 !! end
9323
9324 !! article
9325 Template:sections
9326 !! text
9327 ===Section 1===
9328 ==Section 2==
9329 !! endarticle
9330
9331 !! test
9332 Template with sections, __NOTOC__
9333 !! input
9334 __NOTOC__
9335 ==Section 0==
9336 {{sections}}
9337 ==Section 4==
9338 !! result
9339 <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>
9340 <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>
9341 <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>
9342 <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>
9343
9344 !! end
9345
9346 !! test
9347 __NOEDITSECTION__ keyword
9348 !! input
9349 __NOEDITSECTION__
9350 ==Section 1==
9351 ==Section 2==
9352 !! result
9353 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9354 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9355
9356 !! end
9357
9358 !! test
9359 Link inside a section heading
9360 !! input
9361 ==Section with a [[Main Page|link]] in it==
9362 !! result
9363 <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>
9364
9365 !! end
9366
9367 !! test
9368 TOC regression (bug 12077)
9369 !! input
9370 __TOC__
9371 == title 1 ==
9372 === title 1.1 ===
9373 == title 2 ==
9374 !! result
9375 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9376 <ul>
9377 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9378 <ul>
9379 <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>
9380 </ul>
9381 </li>
9382 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9383 </ul>
9384 </div>
9385 <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>
9386 <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>
9387 <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>
9388
9389 !! end
9390
9391 !! test
9392 BUG 1219 URL next to image (good)
9393 !! input
9394 http://example.com [[Image:foobar.jpg]]
9395 !! result
9396 <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>
9397 </p>
9398 !!end
9399
9400 !! test
9401 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9402 !! input
9403 ===
9404 The line above must have a trailing space!
9405 === <!--
9406 --> <!-- -->
9407 But just in case it doesn't...
9408 !! result
9409 <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>
9410 <p>The line above must have a trailing space!
9411 </p>
9412 <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>
9413 <p>But just in case it doesn't...
9414 </p>
9415 !! end
9416
9417 !! test
9418 Header with special characters (bug 25462)
9419 !! input
9420 The tooltips shall not show entities to the user (ie. be double escaped)
9421
9422 == text > text ==
9423 section 1
9424
9425 == text < text ==
9426 section 2
9427
9428 == text & text ==
9429 section 3
9430
9431 == text ' text ==
9432 section 4
9433
9434 == text " text ==
9435 section 5
9436 !! result
9437 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9438 </p>
9439 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9440 <ul>
9441 <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>
9442 <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>
9443 <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>
9444 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9445 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9446 </ul>
9447 </div>
9448 <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>
9449 <p>section 1
9450 </p>
9451 <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>
9452 <p>section 2
9453 </p>
9454 <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>
9455 <p>section 3
9456 </p>
9457 <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>
9458 <p>section 4
9459 </p>
9460 <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>
9461 <p>section 5
9462 </p>
9463 !! end
9464
9465 !! test
9466 Headers with excess '=' characters
9467 (Are similar tests necessary beyond the 1st level?)
9468 !! input
9469 =foo==
9470 ==foo=
9471 =''italic'' heading==
9472 ==''italic'' heading=
9473 !! result
9474 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9475 <ul>
9476 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9477 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9478 <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>
9479 <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>
9480 </ul>
9481 </div>
9482 <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>
9483 <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>
9484 <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>
9485 <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>
9486
9487 !! end
9488
9489 !! test
9490 HTML headers vs TOC (bug 23393)
9491 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9492 !! input
9493 <h1>Header 1</h1>
9494 == Header 1.1 ==
9495 == Header 1.2 ==
9496
9497 <h1>Header 2
9498 </h1>
9499 == Header 2.1 ==
9500 == Header 2.2 ==
9501 __NOEDITSECTION__
9502 !! result
9503 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9504 <ul>
9505 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9506 <ul>
9507 <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>
9508 <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>
9509 </ul>
9510 </li>
9511 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9512 <ul>
9513 <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>
9514 <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>
9515 </ul>
9516 </li>
9517 </ul>
9518 </div>
9519 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9520 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9521 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9522 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9523 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9524 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9525
9526 !! end
9527
9528 !! test
9529 BUG 1219 URL next to image (broken)
9530 !! input
9531 http://example.com[[Image:foobar.jpg]]
9532 !! result
9533 <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>
9534 </p>
9535 !!end
9536
9537 !! test
9538 Bug 1186 news: in the middle of text
9539 !! input
9540 http://en.wikinews.org/wiki/Wikinews:Workplace
9541 !! result
9542 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9543 </p>
9544 !!end
9545
9546
9547 !! test
9548 Namespaced link must have a title
9549 !! input
9550 [[Project:]]
9551 !! result
9552 <p>[[Project:]]
9553 </p>
9554 !!end
9555
9556 !! test
9557 Namespaced link must have a title (bad fragment version)
9558 !! input
9559 [[Project:#fragment]]
9560 !! result
9561 <p>[[Project:#fragment]]
9562 </p>
9563 !!end
9564
9565
9566 ###
9567 ### HTML tags and HTML attributes
9568 ###
9569
9570 !! test
9571 div with no attributes
9572 !! input
9573 <div>HTML rocks</div>
9574 !! result
9575 <div>HTML rocks</div>
9576
9577 !! end
9578
9579 !! test
9580 div with double-quoted attribute
9581 !! input
9582 <div id="rock">HTML rocks</div>
9583 !! result
9584 <div id="rock">HTML rocks</div>
9585
9586 !! end
9587
9588 !! test
9589 div with single-quoted attribute
9590 !! input
9591 <div id='rock'>HTML rocks</div>
9592 !! result
9593 <div id="rock">HTML rocks</div>
9594
9595 !! end
9596
9597 !! test
9598 div with unquoted attribute
9599 !! input
9600 <div id=rock>HTML rocks</div>
9601 !! result
9602 <div id="rock">HTML rocks</div>
9603
9604 !! end
9605
9606 !! test
9607 div with illegal double attributes
9608 !! input
9609 <div id="a" id="b">HTML rocks</div>
9610 !! result
9611 <div id="b">HTML rocks</div>
9612
9613 !!end
9614
9615 # FIXME: produce empty string instead of "class" in the PHP parser, following
9616 # the HTML5 spec.
9617 !! test
9618 div with empty attribute value, space before equals
9619 !! options
9620 parsoid
9621 !! input
9622 <div class =>HTML rocks</div>
9623 !! result
9624 <div class="">HTML rocks</div>
9625
9626 !! end
9627
9628 # The PHP parser escapes the opening brace to &#123; for some reason, so
9629 # disabled this test for it.
9630 !! test
9631 div with braces in attribute value
9632 !! options
9633 parsoid
9634 !! input
9635 <div title="{}">Foo</div>
9636 !! result
9637 <div title="{}">Foo</div>
9638 !! end
9639
9640 # This it very inconsistent in the PHP parser: it returns
9641 # class="class" if there is a space between the name and the equal sign (see
9642 # 'div with empty attribute value, space before equals'), but strips the
9643 # attribute completely if the space is missing. We hope that not much content
9644 # depends on this, so are implementing the behavior below in Parsoid for
9645 # consistencies' sake. Disabled for the PHP parser.
9646 # FIXME: fix this behavior in the PHP parser?
9647 !! test
9648 div with empty attribute value, no space before equals
9649 !! options
9650 parsoid
9651 !! input
9652 <div class=>HTML rocks</div>
9653 !! result
9654 <div class="">HTML rocks</div>
9655
9656 !! end
9657
9658 !! test
9659 HTML multiple attributes correction
9660 !! input
9661 <p class="error" class="awesome">Awesome!</p>
9662 !! result
9663 <p class="awesome">Awesome!</p>
9664
9665 !!end
9666
9667 !! test
9668 Table multiple attributes correction
9669 !! input
9670 {|
9671 !+ class="error" class="awesome"| status
9672 |}
9673 !! result
9674 <table>
9675 <tr>
9676 <th class="awesome"> status
9677 </th></tr></table>
9678
9679 !!end
9680
9681 !! test
9682 DIV IN UPPERCASE
9683 !! input
9684 <DIV ID="x">HTML ROCKS</DIV>
9685 !! result
9686 <div id="x">HTML ROCKS</div>
9687
9688 !!end
9689
9690 !! test
9691 Non-ASCII pseudo-tags are rendered as text
9692 !! input
9693 <khyô>
9694 !! result
9695 <p>&lt;khyô&gt;
9696 </p>
9697 !! end
9698
9699 !! test
9700 Pseudo-tag with URL 'name' renders as url link
9701 !! input
9702 <http://example.com/>
9703 !! result
9704 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9705 </p>
9706 !! end
9707
9708 !! test
9709 text with amp in the middle of nowhere
9710 !! input
9711 Remember AT&T?
9712 !!result
9713 <p>Remember AT&amp;T?
9714 </p>
9715 !! end
9716
9717 !! test
9718 text with character entity: eacute
9719 !! input
9720 I always thought &eacute; was a cute letter.
9721 !! result
9722 <p>I always thought &#233; was a cute letter.
9723 </p>
9724 !! end
9725
9726 !! test
9727 text with entity-escaped character entity-like string: eacute
9728 !! input
9729 I always thought &amp;eacute; was a cute letter.
9730 !! result
9731 <p>I always thought &amp;eacute; was a cute letter.
9732 </p>
9733 !! end
9734
9735 !! test
9736 text with undefined character entity: xacute
9737 !! input
9738 I always thought &xacute; was a cute letter.
9739 !! result
9740 <p>I always thought &amp;xacute; was a cute letter.
9741 </p>
9742 !! end
9743
9744
9745 ###
9746 ### Nesting tests (see bug 41545, 50604, 51081)
9747 ###
9748
9749 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9750 # Note that html2wt is considerably more difficult if we use <b> in
9751 # the test case, instead of <big>
9752 !! test
9753 Ensure that HTML adoption agency algorithm is properly implemented.
9754 !! input
9755 <big>X<big>Y</big>Z</big>
9756 !! result
9757 <p><big>X<big>Y</big>Z</big>
9758 </p>
9759 !! end
9760
9761 # This was bug 41545 in the PHP parser.
9762 !! test
9763 Nesting of <kbd>
9764 !! input
9765 <kbd>X<kbd>Y</kbd>Z</kbd>
9766 !! result
9767 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9768 </p>
9769 !! end
9770
9771 # The following cases were bug 51081 in the PHP parser.
9772 # Note that there are some other nestable tags (b, i, etc) which are
9773 # not covered; see bug 51081 for discussion.
9774 !! test
9775 Nesting of <em>
9776 !! input
9777 <em>X<em>Y</em>Z</em>
9778 !! result
9779 <p><em>X<em>Y</em>Z</em>
9780 </p>
9781 !! end
9782
9783 !! test
9784 Nesting of <strong>
9785 !! input
9786 <strong>X<strong>Y</strong>Z</strong>
9787 !! result
9788 <p><strong>X<strong>Y</strong>Z</strong>
9789 </p>
9790 !! end
9791
9792 !! test
9793 Nesting of <q>
9794 !! input
9795 <q>X<q>Y</q>Z</q>
9796 !! result
9797 <p><q>X<q>Y</q>Z</q>
9798 </p>
9799 !! end
9800
9801 !! test
9802 Nesting of <ruby>
9803 !! input
9804 <ruby>X<ruby>Y</ruby>Z</ruby>
9805 !! result
9806 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9807 </p>
9808 !! end
9809
9810 !! test
9811 Nesting of <bdo>
9812 !! input
9813 <bdo>X<bdo>Y</bdo>Z</bdo>
9814 !! result
9815 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9816 </p>
9817 !! end
9818
9819
9820 ###
9821 ### Media links
9822 ###
9823
9824 !! test
9825 Media link
9826 !! input
9827 [[Media:Foobar.jpg]]
9828 !! result
9829 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9830 </p>
9831 !! end
9832
9833 !! test
9834 Media link with text
9835 !! input
9836 [[Media:Foobar.jpg|A neat file to look at]]
9837 !! result
9838 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9839 </p>
9840 !! end
9841
9842 # FIXME: this is still bad HTML tag nesting
9843 !! test
9844 Media link with nasty text
9845 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9846 !! input
9847 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9848 !! result
9849 <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>
9850
9851 !! end
9852
9853 !! test
9854 Media link to nonexistent file (bug 1702)
9855 !! input
9856 [[Media:No such.jpg]]
9857 !! result
9858 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9859 </p>
9860 !! end
9861
9862 !! test
9863 Image link to nonexistent file (bug 1850 - good)
9864 !! input
9865 [[Image:No such.jpg]]
9866 !! result
9867 <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>
9868 </p>
9869 !! end
9870
9871 !! test
9872 :Image link to nonexistent file (bug 1850 - bad)
9873 !! input
9874 [[:Image:No such.jpg]]
9875 !! result
9876 <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>
9877 </p>
9878 !! end
9879
9880
9881
9882 !! test
9883 Character reference normalization in link text (bug 1938)
9884 !! input
9885 [[Main Page|this&that]]
9886 !! result
9887 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9888 </p>
9889 !!end
9890
9891 !! article
9892 אַ
9893 !! text
9894 Test for unicode normalization
9895
9896 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9897 !! endarticle
9898
9899 !! test
9900 (bug 19451) Links should refer to the normalized form.
9901 !! input
9902 [[&#xFB2E;]]
9903 [[&#x5d0;&#x5b7;]]
9904 [[&#x5d0;ַ]]
9905 [[א&#x5b7;]]
9906 [[אַ]]
9907 !! result
9908 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9909 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9910 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9911 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9912 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9913 </p>
9914 !! end
9915
9916 !! test
9917 Empty attribute crash test (bug 2067)
9918 !! input
9919 <font color="">foo</font>
9920 !! result
9921 <p><font color="">foo</font>
9922 </p>
9923 !! end
9924
9925 !! test
9926 Empty attribute crash test single-quotes (bug 2067)
9927 !! input
9928 <font color=''>foo</font>
9929 !! result
9930 <p><font color="">foo</font>
9931 </p>
9932 !! end
9933
9934 !! test
9935 Attribute test: equals, then nothing
9936 !! input
9937 <font color=>foo</font>
9938 !! result
9939 <p><font>foo</font>
9940 </p>
9941 !! end
9942
9943 !! test
9944 Attribute test: unquoted value
9945 !! input
9946 <font color=x>foo</font>
9947 !! result
9948 <p><font color="x">foo</font>
9949 </p>
9950 !! end
9951
9952 !! test
9953 Attribute test: unquoted but illegal value (hash)
9954 !! input
9955 <font color=#x>foo</font>
9956 !! result
9957 <p><font color="#x">foo</font>
9958 </p>
9959 !! end
9960
9961 !! test
9962 Attribute test: no value
9963 !! input
9964 <font color>foo</font>
9965 !! result
9966 <p><font color="color">foo</font>
9967 </p>
9968 !! end
9969
9970 !! test
9971 Bug 2095: link with three closing brackets
9972 !! input
9973 [[Main Page]]]
9974 !! result
9975 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9976 </p>
9977 !! end
9978
9979 !! test
9980 Bug 2095: link with pipe and three closing brackets
9981 !! input
9982 [[Main Page|link]]]
9983 !! result
9984 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9985 </p>
9986 !! end
9987
9988 !! test
9989 Bug 2095: link with pipe and three closing brackets, version 2
9990 !! input
9991 [[Main Page|[http://example.com/]]]
9992 !! result
9993 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9994 </p>
9995 !! end
9996
9997
9998 ###
9999 ### Safety
10000 ###
10001
10002 !! article
10003 Template:Dangerous attribute
10004 !! text
10005 " onmouseover="alert(document.cookie)
10006 !! endarticle
10007
10008 !! article
10009 Template:Dangerous style attribute
10010 !! text
10011 border-size: expression(alert(document.cookie))
10012 !! endarticle
10013
10014 !! article
10015 Template:Div style
10016 !! text
10017 <div style="float: right; {{{1}}}">Magic div</div>
10018 !! endarticle
10019
10020 !! test
10021 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10022 !! input
10023 <div title="{{test}}"></div>
10024 !! result
10025 <div title="This is a test template"></div>
10026
10027 !! end
10028
10029 !! test
10030 Bug 2304: HTML attribute safety (dangerous template; 2309)
10031 !! input
10032 <div title="{{dangerous attribute}}"></div>
10033 !! result
10034 <div title=""></div>
10035
10036 !! end
10037
10038 !! test
10039 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10040 !! input
10041 <div style="{{dangerous style attribute}}"></div>
10042 !! result
10043 <div style="/* insecure input */"></div>
10044
10045 !! end
10046
10047 !! test
10048 Bug 2304: HTML attribute safety (safe parameter; 2309)
10049 !! input
10050 {{div style|width: 200px}}
10051 !! result
10052 <div style="float: right; width: 200px">Magic div</div>
10053
10054 !! end
10055
10056 !! test
10057 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10058 !! input
10059 {{div style|width: expression(alert(document.cookie))}}
10060 !! result
10061 <div style="/* insecure input */">Magic div</div>
10062
10063 !! end
10064
10065 !! test
10066 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10067 !! input
10068 {{div style|"><script>alert(document.cookie)</script>}}
10069 !! result
10070 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10071
10072 !! end
10073
10074 !! test
10075 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10076 !! input
10077 {{div style|" ><script>alert(document.cookie)</script>}}
10078 !! result
10079 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10080
10081 !! end
10082
10083 !! test
10084 Bug 2304: HTML attribute safety (link)
10085 !! input
10086 <div title="[[Main Page]]"></div>
10087 !! result
10088 <div title="&#91;&#91;Main Page]]"></div>
10089
10090 !! end
10091
10092 !! test
10093 Bug 2304: HTML attribute safety (italics)
10094 !! input
10095 <div title="''foobar''"></div>
10096 !! result
10097 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10098
10099 !! end
10100
10101 !! test
10102 Bug 2304: HTML attribute safety (bold)
10103 !! input
10104 <div title="'''foobar'''"></div>
10105 !! result
10106 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10107
10108 !! end
10109
10110
10111 !! test
10112 Bug 2304: HTML attribute safety (ISBN)
10113 !! input
10114 <div title="ISBN 1234567890"></div>
10115 !! result
10116 <div title="&#73;SBN 1234567890"></div>
10117
10118 !! end
10119
10120 !! test
10121 Bug 2304: HTML attribute safety (RFC)
10122 !! input
10123 <div title="RFC 1234"></div>
10124 !! result
10125 <div title="&#82;FC 1234"></div>
10126
10127 !! end
10128
10129 !! test
10130 Bug 2304: HTML attribute safety (PMID)
10131 !! input
10132 <div title="PMID 1234567890"></div>
10133 !! result
10134 <div title="&#80;MID 1234567890"></div>
10135
10136 !! end
10137
10138 !! test
10139 Bug 2304: HTML attribute safety (web link)
10140 !! input
10141 <div title="http://example.com/"></div>
10142 !! result
10143 <div title="http&#58;//example.com/"></div>
10144
10145 !! end
10146
10147 !! test
10148 Bug 2304: HTML attribute safety (named web link)
10149 !! input
10150 <div title="[http://example.com/ link]"></div>
10151 !! result
10152 <div title="&#91;http&#58;//example.com/ link]"></div>
10153
10154 !! end
10155
10156 !! test
10157 Bug 3244: HTML attribute safety (extension; safe)
10158 !! input
10159 <div style="<nowiki>background:blue</nowiki>"></div>
10160 !! result
10161 <div style="background:blue"></div>
10162
10163 !! end
10164
10165 !! test
10166 Bug 3244: HTML attribute safety (extension; unsafe)
10167 !! input
10168 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10169 !! result
10170 <div style="/* insecure input */"></div>
10171
10172 !! end
10173
10174 # More MSIE fun discovered by Tom Gilder
10175
10176 !! test
10177 MSIE CSS safety test: spurious slash
10178 !! input
10179 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10180 !! result
10181 <div style="/* insecure input */">evil</div>
10182
10183 !! end
10184
10185 !! test
10186 MSIE CSS safety test: hex code
10187 !! input
10188 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10189 !! result
10190 <div style="/* insecure input */">evil</div>
10191
10192 !! end
10193
10194 !! test
10195 MSIE CSS safety test: comment in url
10196 !! input
10197 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10198 !! result
10199 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10200
10201 !! end
10202
10203 !! test
10204 MSIE CSS safety test: comment in expression
10205 !! input
10206 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10207 !! result
10208 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10209
10210 !! end
10211
10212
10213 !! test
10214 Table attribute legitimate extension
10215 !! input
10216 {|
10217 !+ style="<nowiki>color:blue</nowiki>"| status
10218 |}
10219 !! result
10220 <table>
10221 <tr>
10222 <th style="color:blue"> status
10223 </th></tr></table>
10224
10225 !!end
10226
10227 !! test
10228 Table attribute safety
10229 !! input
10230 {|
10231 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10232 |}
10233 !! result
10234 <table>
10235 <tr>
10236 <th style="/* insecure input */"> status
10237 </th></tr></table>
10238
10239 !! end
10240
10241 !! test
10242 CSS line continuation 1
10243 !! input
10244 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10245 !! result
10246 <div style="/* insecure input */"></div>
10247
10248 !! end
10249
10250 !! test
10251 CSS line continuation 2
10252 !! input
10253 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10254 !! result
10255 <div style="/* insecure input */"></div>
10256
10257 !! end
10258
10259 !! article
10260 Template:Identity
10261 !! text
10262 {{{1}}}
10263 !! endarticle
10264
10265 !! test
10266 Expansion of multi-line templates in attribute values (bug 6255)
10267 !! input
10268 <div style="background: {{identity|#00FF00}}">-</div>
10269 !! result
10270 <div style="background: #00FF00">-</div>
10271
10272 !! end
10273
10274
10275 !! test
10276 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10277 !! input
10278 <div style="background:
10279 #00FF00">-</div>
10280 !! result
10281 <div style="background: #00FF00">-</div>
10282
10283 !! end
10284
10285 !! test
10286 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10287 !! input
10288 <div style="background: &#10;#00FF00">-</div>
10289 !! result
10290 <div style="background: &#10;#00FF00">-</div>
10291
10292 !! end
10293
10294 ###
10295 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10296 ###
10297 !! test
10298 Parser hook: empty input
10299 !! input
10300 <tag></tag>
10301 !! result
10302 <pre>
10303 ''
10304 array (
10305 )
10306 </pre>
10307
10308 !! end
10309
10310 !! test
10311 Parser hook: empty input using terminated empty elements
10312 !! input
10313 <tag/>
10314 !! result
10315 <pre>
10316 NULL
10317 array (
10318 )
10319 </pre>
10320
10321 !! end
10322
10323 !! test
10324 Parser hook: empty input using terminated empty elements (space before)
10325 !! input
10326 <tag />
10327 !! result
10328 <pre>
10329 NULL
10330 array (
10331 )
10332 </pre>
10333
10334 !! end
10335
10336 !! test
10337 Parser hook: basic input
10338 !! input
10339 <tag>input</tag>
10340 !! result
10341 <pre>
10342 'input'
10343 array (
10344 )
10345 </pre>
10346
10347 !! end
10348
10349
10350 !! test
10351 Parser hook: case insensitive
10352 !! input
10353 <TAG>input</TAG>
10354 !! result
10355 <pre>
10356 'input'
10357 array (
10358 )
10359 </pre>
10360
10361 !! end
10362
10363
10364 !! test
10365 Parser hook: case insensitive, redux
10366 !! input
10367 <TaG>input</TAg>
10368 !! result
10369 <pre>
10370 'input'
10371 array (
10372 )
10373 </pre>
10374
10375 !! end
10376
10377 !! test
10378 Parser hook: nested tags
10379 !! options
10380 noxml
10381 !! input
10382 <tag><tag></tag></tag>
10383 !! result
10384 <pre>
10385 '<tag>'
10386 array (
10387 )
10388 </pre>&lt;/tag&gt;
10389
10390 !! end
10391
10392 !! test
10393 Parser hook: basic arguments
10394 !! input
10395 <tag width=200 height = "100" depth = '50' square></tag>
10396 !! result
10397 <pre>
10398 ''
10399 array (
10400 'width' => '200',
10401 'height' => '100',
10402 'depth' => '50',
10403 'square' => 'square',
10404 )
10405 </pre>
10406
10407 !! end
10408
10409 !! test
10410 Parser hook: argument containing a forward slash (bug 5344)
10411 !! input
10412 <tag filename='/tmp/bla'></tag>
10413 !! result
10414 <pre>
10415 ''
10416 array (
10417 'filename' => '/tmp/bla',
10418 )
10419 </pre>
10420
10421 !! end
10422
10423 !! test
10424 Parser hook: empty input using terminated empty elements (bug 2374)
10425 !! input
10426 <tag foo=bar/>text
10427 !! result
10428 <pre>
10429 NULL
10430 array (
10431 'foo' => 'bar',
10432 )
10433 </pre>text
10434
10435 !! end
10436
10437 # </tag> should be output literally since there is no matching tag that begins it
10438 !! test
10439 Parser hook: basic arguments using terminated empty elements (bug 2374)
10440 !! input
10441 <tag width=200 height = "100" depth = '50' square/>
10442 other stuff
10443 </tag>
10444 !! result
10445 <pre>
10446 NULL
10447 array (
10448 'width' => '200',
10449 'height' => '100',
10450 'depth' => '50',
10451 'square' => 'square',
10452 )
10453 </pre>
10454 <p>other stuff
10455 &lt;/tag&gt;
10456 </p>
10457 !! end
10458
10459 ###
10460 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10461 ###
10462
10463 !! test
10464 Parser hook: static parser hook not inside a comment
10465 !! input
10466 <statictag>hello, world</statictag>
10467 <statictag action=flush/>
10468 !! result
10469 <p>hello, world
10470 </p>
10471 !! end
10472
10473
10474 !! test
10475 Parser hook: static parser hook inside a comment
10476 !! input
10477 <!-- <statictag>hello, world</statictag> -->
10478 <statictag action=flush/>
10479 !! result
10480 <p><br />
10481 </p>
10482 !! end
10483
10484 # Nested template calls; this case was broken by Parser.php rev 1.506,
10485 # since reverted.
10486
10487 !! article
10488 Template:One-parameter
10489 !! text
10490 (My parameter is: {{{1}}})
10491 !! endarticle
10492
10493 !! article
10494 Template:Map-one-parameter
10495 !! text
10496 {{{{{1}}}|{{{2}}}}}
10497 !! endarticle
10498
10499 !! test
10500 Nested template calls
10501 !! input
10502 {{Map-one-parameter|One-parameter|param}}
10503 !! result
10504 <p>(My parameter is: param)
10505 </p>
10506 !! end
10507
10508
10509 ###
10510 ### Sanitizer
10511 ###
10512 !! test
10513 Sanitizer: Closing of open tags
10514 !! input
10515 <s></s><table></table>
10516 !! result
10517 <s></s><table></table>
10518
10519 !! end
10520
10521 !! test
10522 Sanitizer: Closing of open but not closed tags
10523 !! input
10524 <s>foo
10525 !! result
10526 <p><s>foo</s>
10527 </p>
10528 !! end
10529
10530 !! test
10531 Sanitizer: Closing of closed but not open tags
10532 !! input
10533 </s>
10534 !! result
10535 <p>&lt;/s&gt;
10536 </p>
10537 !! end
10538
10539 !! test
10540 Sanitizer: Closing of closed but not open table tags
10541 !! input
10542 Table not started</td></tr></table>
10543 !! result
10544 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10545 </p>
10546 !! end
10547
10548 !! test
10549 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10550 !! input
10551 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10552 !! result
10553 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10554 </p>
10555 !! end
10556
10557 !! test
10558 Sanitizer: Validating the contents of the id attribute (bug 4515)
10559 !! options
10560 disabled
10561 !! input
10562 <br id=9 />
10563 !! result
10564 Something, but definitely not <br id="9" />...
10565 !! end
10566
10567 !! test
10568 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10569 !! options
10570 disabled
10571 !! input
10572 <br id="foo" /><br id="foo" />
10573 !! result
10574 Something need to be done. foo-2 ?
10575 !! end
10576
10577 !! test
10578 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10579 !! input
10580 <div itemscope>
10581 <meta itemprop="hello" content="world">
10582 <meta http-equiv="refresh" content="5">
10583 <meta itemprop="hello" http-equiv="refresh" content="5">
10584 <link itemprop="hello" href="{{SERVER}}">
10585 <link rel="stylesheet" href="{{SERVER}}">
10586 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10587 </div>
10588 !! result
10589 <div itemscope="itemscope">
10590 <p> <meta itemprop="hello" content="world" />
10591 &lt;meta http-equiv="refresh" content="5"&gt;
10592 <meta itemprop="hello" content="5" />
10593 </p>
10594 <link itemprop="hello" href="http&#58;//example.org" />
10595 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10596 <link itemprop="hello" href="http&#58;//example.org" />
10597 </div>
10598
10599 !! end
10600
10601 !! test
10602 Language converter: output gets cut off unexpectedly (bug 5757)
10603 !! options
10604 language=zh
10605 !! input
10606 this bit is safe: }-
10607
10608 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10609
10610 then we get cut off here: }-
10611
10612 all additional text is vanished
10613 !! result
10614 <p>this bit is safe: }-
10615 </p><p>but if we add a conversion instance: xxx
10616 </p><p>then we get cut off here: }-
10617 </p><p>all additional text is vanished
10618 </p>
10619 !! end
10620
10621 !! test
10622 Self closed html pairs (bug 5487)
10623 !! options
10624 !! input
10625 <center><font id="bug" />Centered text</center>
10626 <div><font id="bug2" />In div text</div>
10627 !! result
10628 <center>&lt;font id="bug" /&gt;Centered text</center>
10629 <div>&lt;font id="bug2" /&gt;In div text</div>
10630
10631 !! end
10632
10633 #
10634 #
10635 #
10636
10637 !! test
10638 Punctuation: nbsp before exclamation
10639 !! input
10640 C'est grave !
10641 !! result
10642 <p>C'est grave&#160;!
10643 </p>
10644 !! end
10645
10646 !! test
10647 Punctuation: CSS !important (bug 11874)
10648 !! input
10649 <div style="width:50% !important">important</div>
10650 !! result
10651 <div style="width:50% !important">important</div>
10652
10653 !!end
10654
10655 !! test
10656 Punctuation: CSS ! important (bug 11874; with space after)
10657 !! input
10658 <div style="width:50% ! important">important</div>
10659 !! result
10660 <div style="width:50% ! important">important</div>
10661
10662 !!end
10663
10664
10665 !! test
10666 HTML bullet list, closed tags (bug 5497)
10667 !! input
10668 <ul>
10669 <li>One</li>
10670 <li>Two</li>
10671 </ul>
10672 !! result
10673 <ul>
10674 <li>One</li>
10675 <li>Two</li>
10676 </ul>
10677
10678 !! end
10679
10680 !! test
10681 HTML bullet list, unclosed tags (bug 5497)
10682 !! options
10683 disabled
10684 !! input
10685 <ul>
10686 <li>One
10687 <li>Two
10688 </ul>
10689 !! result
10690 <ul>
10691 <li>One
10692 </li><li>Two
10693 </li></ul>
10694
10695 !! end
10696
10697 !! test
10698 HTML ordered list, closed tags (bug 5497)
10699 !! input
10700 <ol>
10701 <li>One</li>
10702 <li>Two</li>
10703 </ol>
10704 !! result
10705 <ol>
10706 <li>One</li>
10707 <li>Two</li>
10708 </ol>
10709
10710 !! end
10711
10712 !! test
10713 HTML ordered list, unclosed tags (bug 5497)
10714 !! options
10715 disabled
10716 !! input
10717 <ol>
10718 <li>One
10719 <li>Two
10720 </ol>
10721 !! result
10722 <ol>
10723 <li>One
10724 </li><li>Two
10725 </li></ol>
10726
10727 !! end
10728
10729 !! test
10730 HTML nested bullet list, closed tags (bug 5497)
10731 !! input
10732 <ul>
10733 <li>One</li>
10734 <li>Two:
10735 <ul>
10736 <li>Sub-one</li>
10737 <li>Sub-two</li>
10738 </ul>
10739 </li>
10740 </ul>
10741 !! result
10742 <ul>
10743 <li>One</li>
10744 <li>Two:
10745 <ul>
10746 <li>Sub-one</li>
10747 <li>Sub-two</li>
10748 </ul>
10749 </li>
10750 </ul>
10751
10752 !! end
10753
10754 !! test
10755 HTML nested bullet list, open tags (bug 5497)
10756 !! options
10757 disabled
10758 !! input
10759 <ul>
10760 <li>One
10761 <li>Two:
10762 <ul>
10763 <li>Sub-one
10764 <li>Sub-two
10765 </ul>
10766 </ul>
10767 !! result
10768 <ul>
10769 <li>One
10770 </li><li>Two:
10771 <ul>
10772 <li>Sub-one
10773 </li><li>Sub-two
10774 </li></ul>
10775 </li></ul>
10776
10777 !! end
10778
10779 !! test
10780 HTML nested ordered list, closed tags (bug 5497)
10781 !! input
10782 <ol>
10783 <li>One</li>
10784 <li>Two:
10785 <ol>
10786 <li>Sub-one</li>
10787 <li>Sub-two</li>
10788 </ol>
10789 </li>
10790 </ol>
10791 !! result
10792 <ol>
10793 <li>One</li>
10794 <li>Two:
10795 <ol>
10796 <li>Sub-one</li>
10797 <li>Sub-two</li>
10798 </ol>
10799 </li>
10800 </ol>
10801
10802 !! end
10803
10804 !! test
10805 HTML nested ordered list, open tags (bug 5497)
10806 !! options
10807 disabled
10808 !! input
10809 <ol>
10810 <li>One
10811 <li>Two:
10812 <ol>
10813 <li>Sub-one
10814 <li>Sub-two
10815 </ol>
10816 </ol>
10817 !! result
10818 <ol>
10819 <li>One
10820 </li><li>Two:
10821 <ol>
10822 <li>Sub-one
10823 </li><li>Sub-two
10824 </li></ol>
10825 </li></ol>
10826
10827 !! end
10828
10829 !! test
10830 HTML ordered list item with parameters oddity
10831 !! input
10832 <ol><li id="fragment">One</li></ol>
10833 !! result
10834 <ol><li id="fragment">One</li></ol>
10835
10836 !! end
10837
10838 !!test
10839 bug 5918: autonumbering
10840 !! input
10841 [http://first/] [http://second] [ftp://ftp]
10842
10843 ftp://inlineftp
10844
10845 [mailto:enclosed@mail.tld With target]
10846
10847 [mailto:enclosed@mail.tld]
10848
10849 mailto:inline@mail.tld
10850 !! result
10851 <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>
10852 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10853 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10854 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10855 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10856 </p>
10857 !! end
10858
10859
10860 #
10861 # Security and HTML correctness
10862 # From Nick Jenkins' fuzz testing
10863 #
10864
10865 !! test
10866 Fuzz testing: Parser13
10867 !! input
10868 {|
10869 | http://a|
10870 !! result
10871 <table>
10872 <tr>
10873 <td>
10874 </td>
10875 </tr>
10876 </table>
10877
10878 !! end
10879
10880 !! test
10881 Fuzz testing: Parser14
10882 !! input
10883 == onmouseover= ==
10884 http://__TOC__
10885 !! result
10886 <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>
10887 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10888 <ul>
10889 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10890 </ul>
10891 </div>
10892
10893 !! end
10894
10895 !! test
10896 Fuzz testing: Parser14-table
10897 !! input
10898 ==a==
10899 {| STYLE=__TOC__
10900 !! result
10901 <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>
10902 <table style="&#95;_TOC&#95;_">
10903 <tr><td></td></tr>
10904 </table>
10905
10906 !! end
10907
10908 # Known to produce bogus xml (extra </td>)
10909 !! test
10910 Fuzz testing: Parser16
10911 !! options
10912 noxml
10913 !! input
10914 {|
10915 !https://||||||
10916 !! result
10917 <table>
10918 <tr>
10919 <th>https://</th>
10920 <th></th>
10921 <th></th>
10922 <th>
10923 </td>
10924 </tr>
10925 </table>
10926
10927 !! end
10928
10929 !! test
10930 Fuzz testing: Parser21
10931 !! input
10932 {|
10933 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10934 |
10935 !! result
10936 <table>
10937 <tr>
10938 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10939 </th>
10940 <td>
10941 </td>
10942 </tr>
10943 </table>
10944
10945 !! end
10946
10947 !! test
10948 Fuzz testing: Parser22
10949 !! input
10950 http://===r:::https://b
10951
10952 {|
10953 !!result
10954 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10955 </p>
10956 <table>
10957 <tr><td></td></tr>
10958 </table>
10959
10960 !! end
10961
10962 # Known to produce bad XML for now
10963 !! test
10964 Fuzz testing: Parser24
10965 !! options
10966 noxml
10967 !! input
10968 {|
10969 {{{|
10970 <u CLASS=
10971 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10972 <br style="onmouseover='alert(document.cookie);' " />
10973
10974 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10975 |
10976 !! result
10977 <table>
10978 {{{|
10979 <u class="&#124;">}}}} &gt;
10980 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10981
10982 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10983 <tr>
10984 <td></u>
10985 </td>
10986 </tr>
10987 </table>
10988
10989 !! end
10990
10991 # Note: the current result listed for this is not what the original one was,
10992 # but the original bug was JavaScript injection, which is fixed in any case.
10993 # It's not clear that the original result listed was any more correct than the
10994 # current one. Original result:
10995 # <p>{{{|
10996 # </p>
10997 # <li class="&#124;&#124;">
10998 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10999 !!test
11000 Fuzz testing: Parser25 (bug 6055)
11001 !! input
11002 {{{
11003 |
11004 <LI CLASS=||
11005 >
11006 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11007 !! result
11008 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11009 </p>
11010 !! end
11011
11012 !!test
11013 Fuzz testing: URL adjacent extension (with space, clean)
11014 !! options
11015 !! input
11016 http://example.com <nowiki>junk</nowiki>
11017 !! result
11018 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11019 </p>
11020 !!end
11021
11022 !!test
11023 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11024 !! options
11025 !! input
11026 http://example.com<nowiki>junk</nowiki>
11027 !! result
11028 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11029 </p>
11030 !!end
11031
11032 !!test
11033 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11034 !! options
11035 !! input
11036 http://example.com<pre>junk</pre>
11037 !! result
11038 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11039
11040 !!end
11041
11042 !!test
11043 Fuzz testing: image with bogus manual thumbnail
11044 !!input
11045 [[Image:foobar.jpg|thumbnail= ]]
11046 !!result
11047 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11048
11049 !!end
11050
11051 !! test
11052 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11053 !! input
11054 <pre dir="&#10;"></pre>
11055 !! result
11056 <pre dir="&#10;"></pre>
11057
11058 !! end
11059
11060 !! test
11061 Parsing optional HTML elements (Bug 6171)
11062 !! options
11063 !! input
11064 <table>
11065 <tr>
11066 <td> Some tabular data</td>
11067 <td> More tabular data ...
11068 <td> And yet som tabular data</td>
11069 </tr>
11070 </table>
11071 !! result
11072 <table>
11073 <tr>
11074 <td> Some tabular data</td>
11075 <td> More tabular data ...
11076 </td><td> And yet som tabular data</td>
11077 </tr>
11078 </table>
11079
11080 !! end
11081
11082 !! test
11083 Correct handling of <td>, <tr> (Bug 6171)
11084 !! options
11085 !! input
11086 <table>
11087 <tr>
11088 <td> Some tabular data</td>
11089 <td> More tabular data ...</td>
11090 <td> And yet som tabular data</td>
11091 </tr>
11092 </table>
11093 !! result
11094 <table>
11095 <tr>
11096 <td> Some tabular data</td>
11097 <td> More tabular data ...</td>
11098 <td> And yet som tabular data</td>
11099 </tr>
11100 </table>
11101
11102 !! end
11103
11104
11105 !! test
11106 Parsing crashing regression (fr:JavaScript)
11107 !! input
11108 </body></x>
11109 !! result
11110 <p>&lt;/body&gt;&lt;/x&gt;
11111 </p>
11112 !! end
11113
11114 !! test
11115 Inline wiki vs wiki block nesting
11116 !! input
11117 '''Bold paragraph
11118
11119 New wiki paragraph
11120 !! result
11121 <p><b>Bold paragraph</b>
11122 </p><p>New wiki paragraph
11123 </p>
11124 !! end
11125
11126 !! test
11127 Inline HTML vs wiki block nesting
11128 !! options
11129 disabled
11130 !! input
11131 <b>Bold paragraph
11132
11133 New wiki paragraph
11134 !! result
11135 <p><b>Bold paragraph</b>
11136 </p><p>New wiki paragraph
11137 </p>
11138 !! end
11139
11140 # Original result was this:
11141 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11142 # </p>
11143 # While that might be marginally more intuitive, maybe, the six-apostrophe
11144 # construct is clearly pathological and the result stated here (which is what
11145 # the parser actually does) is about as reasonable as anything.
11146 !!test
11147 Mixing markup for italics and bold
11148 !! options
11149 !! input
11150 '''bold''''''bold''bolditalics'''''
11151 !! result
11152 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11153 </p>
11154 !! end
11155
11156
11157 !! article
11158 Xyzzyx
11159 !! text
11160 Article for special page transclusion test
11161 !! endarticle
11162
11163 !! test
11164 Special page transclusion
11165 !! options
11166 !! input
11167 {{Special:Prefixindex/Xyzzyx}}
11168 !! result
11169 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11170
11171 !! end
11172
11173 !! test
11174 Special page transclusion twice (bug 5021)
11175 !! options
11176 !! input
11177 {{Special:Prefixindex/Xyzzyx}}
11178 {{Special:Prefixindex/Xyzzyx}}
11179 !! result
11180 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11181 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11182
11183 !! end
11184
11185 !! test
11186 Transclusion of default MediaWiki message
11187 !! input
11188 {{MediaWiki:Mainpage}}
11189 !!result
11190 <p>Main Page
11191 </p>
11192 !! end
11193
11194 !! test
11195 Transclusion of nonexistent MediaWiki message
11196 !! input
11197 {{MediaWiki:Mainpagexxx}}
11198 !!result
11199 <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>
11200 </p>
11201 !! end
11202
11203 !! test
11204 Transclusion of MediaWiki message with underscore
11205 !! input
11206 {{MediaWiki:history_short}}
11207 !! result
11208 <p>History
11209 </p>
11210 !! end
11211
11212 !! test
11213 Transclusion of MediaWiki message with space
11214 !! input
11215 {{MediaWiki:history short}}
11216 !! result
11217 <p>History
11218 </p>
11219 !! end
11220
11221 !! test
11222 Invalid header with following text
11223 !! input
11224 = x = y
11225 !! result
11226 <p>= x = y
11227 </p>
11228 !! end
11229
11230
11231 !! test
11232 Section extraction test (section 0)
11233 !! options
11234 section=0
11235 !! input
11236 start
11237 ==a==
11238 ===aa===
11239 ====aaa====
11240 ==b==
11241 ===ba===
11242 ===bb===
11243 ====bba====
11244 ===bc===
11245 ==c==
11246 ===ca===
11247 !! result
11248 start
11249 !! end
11250
11251 !! test
11252 Section extraction test (section 1)
11253 !! options
11254 section=1
11255 !! input
11256 start
11257 ==a==
11258 ===aa===
11259 ====aaa====
11260 ==b==
11261 ===ba===
11262 ===bb===
11263 ====bba====
11264 ===bc===
11265 ==c==
11266 ===ca===
11267 !! result
11268 ==a==
11269 ===aa===
11270 ====aaa====
11271 !! end
11272
11273 !! test
11274 Section extraction test (section 2)
11275 !! options
11276 section=2
11277 !! input
11278 start
11279 ==a==
11280 ===aa===
11281 ====aaa====
11282 ==b==
11283 ===ba===
11284 ===bb===
11285 ====bba====
11286 ===bc===
11287 ==c==
11288 ===ca===
11289 !! result
11290 ===aa===
11291 ====aaa====
11292 !! end
11293
11294 !! test
11295 Section extraction test (section 3)
11296 !! options
11297 section=3
11298 !! input
11299 start
11300 ==a==
11301 ===aa===
11302 ====aaa====
11303 ==b==
11304 ===ba===
11305 ===bb===
11306 ====bba====
11307 ===bc===
11308 ==c==
11309 ===ca===
11310 !! result
11311 ====aaa====
11312 !! end
11313
11314 !! test
11315 Section extraction test (section 4)
11316 !! options
11317 section=4
11318 !! input
11319 start
11320 ==a==
11321 ===aa===
11322 ====aaa====
11323 ==b==
11324 ===ba===
11325 ===bb===
11326 ====bba====
11327 ===bc===
11328 ==c==
11329 ===ca===
11330 !! result
11331 ==b==
11332 ===ba===
11333 ===bb===
11334 ====bba====
11335 ===bc===
11336 !! end
11337
11338 !! test
11339 Section extraction test (section 5)
11340 !! options
11341 section=5
11342 !! input
11343 start
11344 ==a==
11345 ===aa===
11346 ====aaa====
11347 ==b==
11348 ===ba===
11349 ===bb===
11350 ====bba====
11351 ===bc===
11352 ==c==
11353 ===ca===
11354 !! result
11355 ===ba===
11356 !! end
11357
11358 !! test
11359 Section extraction test (section 6)
11360 !! options
11361 section=6
11362 !! input
11363 start
11364 ==a==
11365 ===aa===
11366 ====aaa====
11367 ==b==
11368 ===ba===
11369 ===bb===
11370 ====bba====
11371 ===bc===
11372 ==c==
11373 ===ca===
11374 !! result
11375 ===bb===
11376 ====bba====
11377 !! end
11378
11379 !! test
11380 Section extraction test (section 7)
11381 !! options
11382 section=7
11383 !! input
11384 start
11385 ==a==
11386 ===aa===
11387 ====aaa====
11388 ==b==
11389 ===ba===
11390 ===bb===
11391 ====bba====
11392 ===bc===
11393 ==c==
11394 ===ca===
11395 !! result
11396 ====bba====
11397 !! end
11398
11399 !! test
11400 Section extraction test (section 8)
11401 !! options
11402 section=8
11403 !! input
11404 start
11405 ==a==
11406 ===aa===
11407 ====aaa====
11408 ==b==
11409 ===ba===
11410 ===bb===
11411 ====bba====
11412 ===bc===
11413 ==c==
11414 ===ca===
11415 !! result
11416 ===bc===
11417 !! end
11418
11419 !! test
11420 Section extraction test (section 9)
11421 !! options
11422 section=9
11423 !! input
11424 start
11425 ==a==
11426 ===aa===
11427 ====aaa====
11428 ==b==
11429 ===ba===
11430 ===bb===
11431 ====bba====
11432 ===bc===
11433 ==c==
11434 ===ca===
11435 !! result
11436 ==c==
11437 ===ca===
11438 !! end
11439
11440 !! test
11441 Section extraction test (section 10)
11442 !! options
11443 section=10
11444 !! input
11445 start
11446 ==a==
11447 ===aa===
11448 ====aaa====
11449 ==b==
11450 ===ba===
11451 ===bb===
11452 ====bba====
11453 ===bc===
11454 ==c==
11455 ===ca===
11456 !! result
11457 ===ca===
11458 !! end
11459
11460 !! test
11461 Section extraction test (nonexistent section 11)
11462 !! options
11463 section=11
11464 !! input
11465 start
11466 ==a==
11467 ===aa===
11468 ====aaa====
11469 ==b==
11470 ===ba===
11471 ===bb===
11472 ====bba====
11473 ===bc===
11474 ==c==
11475 ===ca===
11476 !! result
11477 !! end
11478
11479 !! test
11480 Section extraction test with bogus heading (section 1)
11481 !! options
11482 section=1
11483 !! input
11484 ==a==
11485 ==bogus== not a legal section
11486 ==b==
11487 !! result
11488 ==a==
11489 ==bogus== not a legal section
11490 !! end
11491
11492 !! test
11493 Section extraction test with bogus heading (section 2)
11494 !! options
11495 section=2
11496 !! input
11497 ==a==
11498 ==bogus== not a legal section
11499 ==b==
11500 !! result
11501 ==b==
11502 !! end
11503
11504 !! test
11505 Section extraction test with comment after heading (section 1)
11506 !! options
11507 section=1
11508 !! input
11509 ==a==
11510 ==b== <!-- -->
11511 ==c==
11512 !! result
11513 ==a==
11514 !! end
11515
11516 !! test
11517 Section extraction test with comment after heading (section 2)
11518 !! options
11519 section=2
11520 !! input
11521 ==a==
11522 ==b== <!-- -->
11523 ==c==
11524 !! result
11525 ==b== <!-- -->
11526 !! end
11527
11528 !! test
11529 Section extraction test with bogus <nowiki> heading (section 1)
11530 !! options
11531 section=1
11532 !! input
11533 ==a==
11534 ==bogus== <nowiki>not a legal section</nowiki>
11535 ==b==
11536 !! result
11537 ==a==
11538 ==bogus== <nowiki>not a legal section</nowiki>
11539 !! end
11540
11541 !! test
11542 Section extraction test with bogus <nowiki> heading (section 2)
11543 !! options
11544 section=2
11545 !! input
11546 ==a==
11547 ==bogus== <nowiki>not a legal section</nowiki>
11548 ==b==
11549 !! result
11550 ==b==
11551 !! end
11552
11553
11554 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11555 # instead of respecting commented sections
11556 !! test
11557 Section extraction prefixed by comment (section 1)
11558 !! options
11559 section=1
11560 !! input
11561 <!-- -->==sec1==
11562 ==sec2==
11563 !!result
11564 ==sec2==
11565 !!end
11566
11567 !! test
11568 Section extraction prefixed by comment (section 2)
11569 !! options
11570 section=2
11571 !! input
11572 <!-- -->==sec1==
11573 ==sec2==
11574 !!result
11575
11576 !!end
11577
11578
11579 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11580 # instead of respecting HTML-style headings
11581 !! test
11582 Section extraction, mixed wiki and html (section 1)
11583 !! options
11584 section=1
11585 !! input
11586 <h2>unmarked</h2>
11587 unmarked
11588 ==1==
11589 one
11590 ==2==
11591 two
11592 !! result
11593 ==1==
11594 one
11595 !! end
11596
11597 !! test
11598 Section extraction, mixed wiki and html (section 2)
11599 !! options
11600 section=2
11601 !! input
11602 <h2>unmarked</h2>
11603 unmarked
11604 ==1==
11605 one
11606 ==2==
11607 two
11608 !! result
11609 ==2==
11610 two
11611 !! end
11612
11613
11614 # Formerly testing for bug 3342
11615 !! test
11616 Section extraction, heading surrounded by <noinclude>
11617 !! options
11618 section=1
11619 !! input
11620 <noinclude>==unmarked==</noinclude>
11621 ==marked==
11622 !! result
11623 ==marked==
11624 !!end
11625
11626 # Test behavior of bug 19910
11627 !! test
11628 Sectiion with all-equals
11629 !! options
11630 section=2
11631 !! input
11632 ===
11633 The line above must have a trailing space
11634 === <!--
11635 --> <!-- -->
11636 But just in case it doesn't...
11637 !! result
11638 === <!--
11639 --> <!-- -->
11640 But just in case it doesn't...
11641 !! end
11642
11643 !! test
11644 Section replacement test (section 0)
11645 !! options
11646 replace=0,"xxx"
11647 !! input
11648 start
11649 ==a==
11650 ===aa===
11651 ====aaa====
11652 ==b==
11653 ===ba===
11654 ===bb===
11655 ====bba====
11656 ===bc===
11657 ==c==
11658 ===ca===
11659 !! result
11660 xxx
11661
11662 ==a==
11663 ===aa===
11664 ====aaa====
11665 ==b==
11666 ===ba===
11667 ===bb===
11668 ====bba====
11669 ===bc===
11670 ==c==
11671 ===ca===
11672 !! end
11673
11674 !! test
11675 Section replacement test (section 1)
11676 !! options
11677 replace=1,"xxx"
11678 !! input
11679 start
11680 ==a==
11681 ===aa===
11682 ====aaa====
11683 ==b==
11684 ===ba===
11685 ===bb===
11686 ====bba====
11687 ===bc===
11688 ==c==
11689 ===ca===
11690 !! result
11691 start
11692 xxx
11693
11694 ==b==
11695 ===ba===
11696 ===bb===
11697 ====bba====
11698 ===bc===
11699 ==c==
11700 ===ca===
11701 !! end
11702
11703 !! test
11704 Section replacement test (section 2)
11705 !! options
11706 replace=2,"xxx"
11707 !! input
11708 start
11709 ==a==
11710 ===aa===
11711 ====aaa====
11712 ==b==
11713 ===ba===
11714 ===bb===
11715 ====bba====
11716 ===bc===
11717 ==c==
11718 ===ca===
11719 !! result
11720 start
11721 ==a==
11722 xxx
11723
11724 ==b==
11725 ===ba===
11726 ===bb===
11727 ====bba====
11728 ===bc===
11729 ==c==
11730 ===ca===
11731 !! end
11732
11733 !! test
11734 Section replacement test (section 3)
11735 !! options
11736 replace=3,"xxx"
11737 !! input
11738 start
11739 ==a==
11740 ===aa===
11741 ====aaa====
11742 ==b==
11743 ===ba===
11744 ===bb===
11745 ====bba====
11746 ===bc===
11747 ==c==
11748 ===ca===
11749 !! result
11750 start
11751 ==a==
11752 ===aa===
11753 xxx
11754
11755 ==b==
11756 ===ba===
11757 ===bb===
11758 ====bba====
11759 ===bc===
11760 ==c==
11761 ===ca===
11762 !! end
11763
11764 !! test
11765 Section replacement test (section 4)
11766 !! options
11767 replace=4,"xxx"
11768 !! input
11769 start
11770 ==a==
11771 ===aa===
11772 ====aaa====
11773 ==b==
11774 ===ba===
11775 ===bb===
11776 ====bba====
11777 ===bc===
11778 ==c==
11779 ===ca===
11780 !! result
11781 start
11782 ==a==
11783 ===aa===
11784 ====aaa====
11785 xxx
11786
11787 ==c==
11788 ===ca===
11789 !! end
11790
11791 !! test
11792 Section replacement test (section 5)
11793 !! options
11794 replace=5,"xxx"
11795 !! input
11796 start
11797 ==a==
11798 ===aa===
11799 ====aaa====
11800 ==b==
11801 ===ba===
11802 ===bb===
11803 ====bba====
11804 ===bc===
11805 ==c==
11806 ===ca===
11807 !! result
11808 start
11809 ==a==
11810 ===aa===
11811 ====aaa====
11812 ==b==
11813 xxx
11814
11815 ===bb===
11816 ====bba====
11817 ===bc===
11818 ==c==
11819 ===ca===
11820 !! end
11821
11822 !! test
11823 Section replacement test (section 6)
11824 !! options
11825 replace=6,"xxx"
11826 !! input
11827 start
11828 ==a==
11829 ===aa===
11830 ====aaa====
11831 ==b==
11832 ===ba===
11833 ===bb===
11834 ====bba====
11835 ===bc===
11836 ==c==
11837 ===ca===
11838 !! result
11839 start
11840 ==a==
11841 ===aa===
11842 ====aaa====
11843 ==b==
11844 ===ba===
11845 xxx
11846
11847 ===bc===
11848 ==c==
11849 ===ca===
11850 !! end
11851
11852 !! test
11853 Section replacement test (section 7)
11854 !! options
11855 replace=7,"xxx"
11856 !! input
11857 start
11858 ==a==
11859 ===aa===
11860 ====aaa====
11861 ==b==
11862 ===ba===
11863 ===bb===
11864 ====bba====
11865 ===bc===
11866 ==c==
11867 ===ca===
11868 !! result
11869 start
11870 ==a==
11871 ===aa===
11872 ====aaa====
11873 ==b==
11874 ===ba===
11875 ===bb===
11876 xxx
11877
11878 ===bc===
11879 ==c==
11880 ===ca===
11881 !! end
11882
11883 !! test
11884 Section replacement test (section 8)
11885 !! options
11886 replace=8,"xxx"
11887 !! input
11888 start
11889 ==a==
11890 ===aa===
11891 ====aaa====
11892 ==b==
11893 ===ba===
11894 ===bb===
11895 ====bba====
11896 ===bc===
11897 ==c==
11898 ===ca===
11899 !! result
11900 start
11901 ==a==
11902 ===aa===
11903 ====aaa====
11904 ==b==
11905 ===ba===
11906 ===bb===
11907 ====bba====
11908 xxx
11909
11910 ==c==
11911 ===ca===
11912 !!end
11913
11914 !! test
11915 Section replacement test (section 9)
11916 !! options
11917 replace=9,"xxx"
11918 !! input
11919 start
11920 ==a==
11921 ===aa===
11922 ====aaa====
11923 ==b==
11924 ===ba===
11925 ===bb===
11926 ====bba====
11927 ===bc===
11928 ==c==
11929 ===ca===
11930 !! result
11931 start
11932 ==a==
11933 ===aa===
11934 ====aaa====
11935 ==b==
11936 ===ba===
11937 ===bb===
11938 ====bba====
11939 ===bc===
11940 xxx
11941 !! end
11942
11943 !! test
11944 Section replacement test (section 10)
11945 !! options
11946 replace=10,"xxx"
11947 !! input
11948 start
11949 ==a==
11950 ===aa===
11951 ====aaa====
11952 ==b==
11953 ===ba===
11954 ===bb===
11955 ====bba====
11956 ===bc===
11957 ==c==
11958 ===ca===
11959 !! result
11960 start
11961 ==a==
11962 ===aa===
11963 ====aaa====
11964 ==b==
11965 ===ba===
11966 ===bb===
11967 ====bba====
11968 ===bc===
11969 ==c==
11970 xxx
11971 !! end
11972
11973 !! test
11974 Section replacement test with initial whitespace (bug 13728)
11975 !! options
11976 replace=2,"xxx"
11977 !! input
11978 Preformatted initial line
11979 ==a==
11980 ===a===
11981 !! result
11982 Preformatted initial line
11983 ==a==
11984 xxx
11985 !! end
11986
11987
11988 !! test
11989 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11990 !! options
11991 section=1
11992 !! input
11993 ==a==
11994 a
11995 !! result
11996 ==a==
11997 a
11998 !! end
11999
12000 !! test
12001 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12002 !! options
12003 section=1
12004 !! input
12005 ==a==
12006 a
12007 !! result
12008 ==a==
12009 a
12010 !! end
12011
12012
12013 !! test
12014 Section extraction, <pre> around bogus header (bug 10309)
12015 !! options
12016 noxml section=2
12017 !! input
12018 == Section One ==
12019 <pre>
12020 =======
12021 </pre>
12022
12023 == Section Two ==
12024 stuff
12025 !! result
12026 == Section Two ==
12027 stuff
12028 !! end
12029
12030 !! test
12031 Section replacement, <pre> around bogus header (bug 10309)
12032 !! options
12033 noxml replace=2,"xxx"
12034 !! input
12035 == Section One ==
12036 <pre>
12037 =======
12038 </pre>
12039
12040 == Section Two ==
12041 stuff
12042 !! result
12043 == Section One ==
12044 <pre>
12045 =======
12046 </pre>
12047
12048 xxx
12049 !! end
12050
12051
12052
12053 !! test
12054 Handling of &#x0A; in URLs
12055 !! input
12056 **irc://&#x0A;a
12057 !! result
12058 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12059 </li></ul>
12060 </li></ul>
12061
12062 !!end
12063
12064 !! test
12065 5 quotes, code coverage +1 line (php)
12066 !! options
12067 php
12068 !! input
12069 '''''
12070 !! result
12071 !! end
12072 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12073 !! test
12074 5 quotes, code coverage +1 line (parsoid)
12075 !! options
12076 parsoid
12077 !! input
12078 '''''
12079 !! result
12080 <p><i><b></b></i></p>
12081 !! end
12082
12083 !! test
12084 Special:Search page linking.
12085 !! input
12086 {{Special:search}}
12087 !! result
12088 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12089 </p>
12090 !! end
12091
12092 !! test
12093 Say the magic word
12094 !! input
12095 * {{PAGENAME}}
12096 * {{BASEPAGENAME}}
12097 * {{SUBPAGENAME}}
12098 * {{SUBPAGENAMEE}}
12099 * {{ROOTPAGENAME}}
12100 * {{ROOTPAGENAMEE}}
12101 * {{BASEPAGENAME}}
12102 * {{BASEPAGENAMEE}}
12103 * {{TALKPAGENAME}}
12104 * {{TALKPAGENAMEE}}
12105 * {{SUBJECTPAGENAME}}
12106 * {{SUBJECTPAGENAMEE}}
12107 * {{NAMESPACEE}}
12108 * {{NAMESPACE}}
12109 * {{TALKSPACE}}
12110 * {{TALKSPACEE}}
12111 * {{SUBJECTSPACE}}
12112 * {{SUBJECTSPACEE}}
12113 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12114 !! result
12115 <ul><li> Parser test
12116 </li><li> Parser test
12117 </li><li> Parser test
12118 </li><li> Parser_test
12119 </li><li> Parser test
12120 </li><li> Parser_test
12121 </li><li> Parser test
12122 </li><li> Parser_test
12123 </li><li> Talk:Parser test
12124 </li><li> Talk:Parser_test
12125 </li><li> Parser test
12126 </li><li> Parser_test
12127 </li><li>
12128 </li><li>
12129 </li><li> Talk
12130 </li><li> Talk
12131 </li><li>
12132 </li><li>
12133 </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>
12134 </li></ul>
12135
12136 !! end
12137 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12138
12139 !! test
12140 Gallery
12141 !! input
12142 <gallery>
12143 image1.png |
12144 image2.gif|||||
12145
12146 image3|
12147 image4 |300px| centre
12148 image5.svg| http://///////
12149 [[x|xx]]]]
12150 * image6
12151 </gallery>
12152 !! result
12153 <ul class="gallery">
12154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12155 <div style="height: 150px;">Image1.png</div>
12156 <div class="gallerytext">
12157 </div>
12158 </div></li>
12159 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12160 <div style="height: 150px;">Image2.gif</div>
12161 <div class="gallerytext">
12162 <p>||||
12163 </p>
12164 </div>
12165 </div></li>
12166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12167 <div style="height: 150px;">Image3</div>
12168 <div class="gallerytext">
12169 </div>
12170 </div></li>
12171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12172 <div style="height: 150px;">Image4</div>
12173 <div class="gallerytext">
12174 <p>300px| centre
12175 </p>
12176 </div>
12177 </div></li>
12178 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12179 <div style="height: 150px;">Image5.svg</div>
12180 <div class="gallerytext">
12181 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12182 </p>
12183 </div>
12184 </div></li>
12185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12186 <div style="height: 150px;">* image6</div>
12187 <div class="gallerytext">
12188 </div>
12189 </div></li>
12190 </ul>
12191
12192 !! end
12193
12194 !! test
12195 Gallery (with options)
12196 !! input
12197 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12198 File:Nonexistant.jpg|caption
12199 File:Nonexistant.jpg
12200 image:foobar.jpg|some '''caption''' [[Main Page]]
12201 image:foobar.jpg
12202 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12203 </gallery>
12204 !! result
12205 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12206 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12207 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12208 <div style="height: 70px;">Nonexistant.jpg</div>
12209 <div class="gallerytext">
12210 <p>caption
12211 </p>
12212 </div>
12213 </div></li>
12214 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12215 <div style="height: 70px;">Nonexistant.jpg</div>
12216 <div class="gallerytext">
12217 </div>
12218 </div></li>
12219 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12220 <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>
12221 <div class="gallerytext">
12222 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12223 </p>
12224 </div>
12225 </div></li>
12226 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12227 <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>
12228 <div class="gallerytext">
12229 </div>
12230 </div></li>
12231 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12232 <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>
12233 <div class="gallerytext">
12234 <p>Blabla|blabla.
12235 </p>
12236 </div>
12237 </div></li>
12238 </ul>
12239
12240 !! end
12241
12242 !! test
12243 Gallery with wikitext inside caption
12244 !! input
12245 <gallery>
12246 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12247 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12248 </gallery>
12249 !! result
12250 <ul class="gallery">
12251 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12252 <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>
12253 <div class="gallerytext">
12254 <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>
12255 </p>
12256 </div>
12257 </div></li>
12258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12259 <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>
12260 <div class="gallerytext">
12261 <p>This is a test template
12262 </p>
12263 </div>
12264 </div></li>
12265 </ul>
12266
12267 !! end
12268
12269 !! test
12270 gallery (with showfilename option)
12271 !! input
12272 <gallery showfilename>
12273 File:Nonexistant.jpg|caption
12274 File:Nonexistant.jpg
12275 image:foobar.jpg|some '''caption''' [[Main Page]]
12276 File:Foobar.jpg
12277 </gallery>
12278 !! result
12279 <ul class="gallery">
12280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12281 <div style="height: 150px;">Nonexistant.jpg</div>
12282 <div class="gallerytext">
12283 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12284 caption
12285 </p>
12286 </div>
12287 </div></li>
12288 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12289 <div style="height: 150px;">Nonexistant.jpg</div>
12290 <div class="gallerytext">
12291 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12292 </p>
12293 </div>
12294 </div></li>
12295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12296 <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>
12297 <div class="gallerytext">
12298 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12299 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12300 </p>
12301 </div>
12302 </div></li>
12303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12304 <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>
12305 <div class="gallerytext">
12306 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12307 </p>
12308 </div>
12309 </div></li>
12310 </ul>
12311
12312 !! end
12313
12314 !! test
12315 Gallery (with namespace-less filenames)
12316 !! input
12317 <gallery>
12318 File:Nonexistant.jpg
12319 Nonexistant.jpg
12320 image:foobar.jpg
12321 foobar.jpg
12322 </gallery>
12323 !! result
12324 <ul class="gallery">
12325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12326 <div style="height: 150px;">Nonexistant.jpg</div>
12327 <div class="gallerytext">
12328 </div>
12329 </div></li>
12330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12331 <div style="height: 150px;">Nonexistant.jpg</div>
12332 <div class="gallerytext">
12333 </div>
12334 </div></li>
12335 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12336 <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>
12337 <div class="gallerytext">
12338 </div>
12339 </div></li>
12340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12341 <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>
12342 <div class="gallerytext">
12343 </div>
12344 </div></li>
12345 </ul>
12346
12347 !! end
12348
12349 !! test
12350 HTML Hex character encoding (spells the word "JavaScript")
12351 !! input
12352 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12353 !! result
12354 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12355 </p>
12356 !! end
12357
12358 !! test
12359 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12360 !! input
12361 &#xsee;&#XSEE;
12362 !! result
12363 <p>&amp;#xsee;&amp;#XSEE;
12364 </p>
12365 !! end
12366
12367 !! test
12368 HTML Hex character encoding mixed case
12369 !! input
12370 &#xEE;&#Xee;
12371 !! result
12372 <p>&#xee;&#xee;
12373 </p>
12374 !! end
12375
12376 !! test
12377 __FORCETOC__ override
12378 !! input
12379 __NEWSECTIONLINK__
12380 __FORCETOC__
12381 !! result
12382 <p><br />
12383 </p>
12384 !! end
12385
12386 !! test
12387 ISBN code coverage
12388 !! input
12389 ISBN 978-0-1234-56&#x20;789
12390 !! result
12391 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12392 </p>
12393 !! end
12394
12395 !! test
12396 ISBN followed by 5 spaces
12397 !! input
12398 ISBN
12399 !! result
12400 <p>ISBN
12401 </p>
12402 !! end
12403
12404 !! test
12405 Double ISBN
12406 !! input
12407 ISBN ISBN 1234567890
12408 !! result
12409 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12410 </p>
12411 !! end
12412
12413 !! test
12414 Bug 22905: <abbr> followed by ISBN followed by </a>
12415 !! input
12416 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12417 !! result
12418 <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>
12419 </p>
12420 !! end
12421
12422 !! test
12423 Double RFC
12424 !! input
12425 RFC RFC 1234
12426 !! result
12427 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12428 </p>
12429 !! end
12430
12431 !! test
12432 Double RFC with a wiki link
12433 !! input
12434 RFC [[RFC 1234]]
12435 !! result
12436 <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>
12437 </p>
12438 !! end
12439
12440 !! test
12441 RFC code coverage
12442 !! input
12443 RFC 983&#x20;987
12444 !! result
12445 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12446 </p>
12447 !! end
12448
12449 !! test
12450 Centre-aligned image
12451 !! input
12452 [[Image:foobar.jpg|centre]]
12453 !! result
12454 <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>
12455
12456 !!end
12457
12458 !! test
12459 None-aligned image
12460 !! input
12461 [[Image:foobar.jpg|none]]
12462 !! result
12463 <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>
12464
12465 !!end
12466
12467 !! test
12468 Width + Height sized image (using px) (height is ignored)
12469 !! input
12470 [[Image:foobar.jpg|640x480px]]
12471 !! result
12472 <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>
12473 </p>
12474 !!end
12475
12476 !! test
12477 Width-sized image (using px, no following whitespace)
12478 !! input
12479 [[Image:foobar.jpg|640px]]
12480 !! result
12481 <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>
12482 </p>
12483 !!end
12484
12485 !! test
12486 Width-sized image (using px, with following whitespace - test regression from r39467)
12487 !! input
12488 [[Image:foobar.jpg|640px ]]
12489 !! result
12490 <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>
12491 </p>
12492 !!end
12493
12494 !! test
12495 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12496 !! input
12497 [[Image:foobar.jpg| 640px]]
12498 !! result
12499 <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>
12500 </p>
12501 !!end
12502
12503 !! test
12504 Another italics / bold test
12505 !! input
12506 ''' ''x'
12507 !! result
12508 <pre>'<i> </i>x'
12509 </pre>
12510 !!end
12511
12512 # Note the results may be incorrect, as parserTest output included this:
12513 # XML error: Mismatched tag at byte 6120:
12514 # ...<dd> </dt></dl> </dd...
12515 !! test
12516 dt/dd/dl test
12517 !! options
12518 disabled
12519 !! input
12520 :;;;::
12521 !! result
12522 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12523 </dd></dl>
12524 </dd></dl>
12525 </dt></dl>
12526 </dt></dl>
12527 </dt></dl>
12528 </dd></dl>
12529
12530 !!end
12531
12532
12533 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12534 !! test
12535 Images with the "|" character in the comment
12536 !! input
12537 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12538 !! result
12539 <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>
12540
12541 !!end
12542
12543 !! test
12544 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12545 !! input
12546 <html><script>alert(1);</script></html>
12547 !! result
12548 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12549 </p>
12550 !! end
12551
12552 !! test
12553 HTML with raw HTML ($wgRawHtml==true)
12554 !! options
12555 wgRawHtml=1
12556 !! input
12557 <html><script>alert(1);</script></html>
12558 !! result
12559 <p><script>alert(1);</script>
12560 </p>
12561 !! end
12562
12563 !! test
12564 Parents of subpages, one level up
12565 !! options
12566 subpage title=[[Subpage test/L1/L2/L3]]
12567 !! input
12568 [[../|L2]]
12569 !! result
12570 <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>
12571 </p>
12572 !! end
12573
12574
12575 !! test
12576 Parents of subpages, one level up, not named
12577 !! options
12578 subpage title=[[Subpage test/L1/L2/L3]]
12579 !! input
12580 [[../]]
12581 !! result
12582 <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>
12583 </p>
12584 !! end
12585
12586
12587
12588 !! test
12589 Parents of subpages, two levels up
12590 !! options
12591 subpage title=[[Subpage test/L1/L2/L3]]
12592 !! input
12593 [[../../|L1]]2
12594
12595 [[../../|L1]]l
12596 !! result
12597 <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
12598 </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>
12599 </p>
12600 !! end
12601
12602 !! test
12603 Parents of subpages, two levels up, without trailing slash or name.
12604 !! options
12605 subpage title=[[Subpage test/L1/L2/L3]]
12606 !! input
12607 [[../..]]
12608 !! result
12609 <p>[[../..]]
12610 </p>
12611 !! end
12612
12613 !! test
12614 Parents of subpages, two levels up, with lots of extra trailing slashes.
12615 !! options
12616 subpage title=[[Subpage test/L1/L2/L3]]
12617 !! input
12618 [[../../////]]
12619 !! result
12620 <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>
12621 </p>
12622 !! end
12623
12624 !! article
12625 Subpage test/L1/L2/L3Sibling
12626 !! text
12627 Sibling article
12628 !! endarticle
12629
12630 !! test
12631 Transclusion of a sibling page (one level up)
12632 !! options
12633 subpage title=[[Subpage test/L1/L2/L3]]
12634 !! input
12635 {{../L3Sibling}}
12636 !! result
12637 <p>Sibling article
12638 </p>
12639 !! end
12640
12641 !! test
12642 Transclusion of a child page
12643 !! options
12644 subpage title=[[Subpage test/L1/L2]]
12645 !! input
12646 {{/L3Sibling}}
12647 !! result
12648 <p>Sibling article
12649 </p>
12650 !! end
12651
12652 !! test
12653 Non-transclusion because of too many up levels
12654 !! options
12655 subpage title=[[Subpage test/L1/L2/L3]]
12656 !! input
12657 {{../../../../More than parent}}
12658 !! result
12659 <p>{{../../../../More than parent}}
12660 </p>
12661 !! end
12662
12663 !! test
12664 Definition list code coverage
12665 !! input
12666 ; title : def
12667 ; title : def
12668 ;title: def
12669 !! result
12670 <dl><dt> title &#160;</dt><dd> def
12671 </dd><dt> title&#160;</dt><dd> def
12672 </dd><dt>title</dt><dd> def
12673 </dd></dl>
12674
12675 !! end
12676
12677 !! test
12678 Don't fall for the self-closing div
12679 !! input
12680 <div>hello world</div/>
12681 !! result
12682 <div>hello world</div>
12683
12684 !! end
12685
12686 !! test
12687 MSGNW magic word
12688 !! input
12689 {{MSGNW:msg}}
12690 !! result
12691 <p>&#91;&#91;:Template:Msg&#93;&#93;
12692 </p>
12693 !! end
12694
12695 !! test
12696 RAW magic word
12697 !! input
12698 {{RAW:QUERTY}}
12699 !! result
12700 <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>
12701 </p>
12702 !! end
12703
12704 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12705 !! test
12706 Always escape literal '>' in output, not just after '<'
12707 !! input
12708 ><>
12709 !! result
12710 <p>&gt;&lt;&gt;
12711 </p>
12712 !! end
12713
12714 !! test
12715 Template caching
12716 !! input
12717 {{Test}}
12718 {{Test}}
12719 !! result
12720 <p>This is a test template
12721 This is a test template
12722 </p>
12723 !! end
12724
12725
12726 !! article
12727 MediaWiki:Fake
12728 !! text
12729 ==header==
12730 !! endarticle
12731
12732 !! test
12733 Inclusion of !userCanEdit() content
12734 !! input
12735 {{MediaWiki:Fake}}
12736 !! result
12737 <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>
12738
12739 !! end
12740
12741
12742 !! test
12743 Out-of-order TOC heading levels
12744 !! input
12745 ==2==
12746 ======6======
12747 ===3===
12748 =1=
12749 =====5=====
12750 ==2==
12751 !! result
12752 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12753 <ul>
12754 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12755 <ul>
12756 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12757 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12758 </ul>
12759 </li>
12760 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12761 <ul>
12762 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12763 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12764 </ul>
12765 </li>
12766 </ul>
12767 </div>
12768 <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>
12769 <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>
12770 <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>
12771 <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>
12772 <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>
12773 <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>
12774
12775 !! end
12776
12777
12778 !! test
12779 ISBN with a dummy number
12780 !! input
12781 ISBN ---
12782 !! result
12783 <p>ISBN ---
12784 </p>
12785 !! end
12786
12787
12788 !! test
12789 ISBN with space-delimited number
12790 !! input
12791 ISBN 92 9017 032 8
12792 !! result
12793 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12794 </p>
12795 !! end
12796
12797
12798 !! test
12799 ISBN with multiple spaces, no number
12800 !! input
12801 ISBN foo
12802 !! result
12803 <p>ISBN foo
12804 </p>
12805 !! end
12806
12807
12808 !! test
12809 ISBN length
12810 !! input
12811 ISBN 123456789
12812
12813 ISBN 1234567890
12814
12815 ISBN 12345678901
12816 !! result
12817 <p>ISBN 123456789
12818 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12819 </p><p>ISBN 12345678901
12820 </p>
12821 !! end
12822
12823
12824 !! test
12825 ISBN with trailing year (bug 8110)
12826 !! input
12827 ISBN 1-234-56789-0 - 2006
12828
12829 ISBN 1 234 56789 0 - 2006
12830 !! result
12831 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12832 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12833 </p>
12834 !! end
12835
12836
12837 !! test
12838 anchorencode
12839 !! input
12840 {{anchorencode:foo bar©#%n}}
12841 !! result
12842 <p>foo_bar.C2.A9.23.25n
12843 </p>
12844 !! end
12845
12846 !! test
12847 anchorencode trims spaces
12848 !! input
12849 {{anchorencode: __pretty__please__}}
12850 !! result
12851 <p>pretty_please
12852 </p>
12853 !! end
12854
12855 !! test
12856 anchorencode deals with links
12857 !! input
12858 {{anchorencode: [[hello|world]] [[hi]]}}
12859 !! result
12860 <p>world_hi
12861 </p>
12862 !! end
12863
12864 !! test
12865 anchorencode deals with templates
12866 !! input
12867 {{anchorencode: {{Foo}} }}
12868 !! result
12869 <p>FOO
12870 </p>
12871 !! end
12872
12873 !! test
12874 anchorencode encodes like the TOC generator: (bug 18431)
12875 !! input
12876 === _ +:.3A%3A&&amp;]] ===
12877 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12878 __NOEDITSECTION__
12879 !! result
12880 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12881 <p>.2B:.3A.253A.26.26.5D.5D
12882 </p>
12883 !! end
12884
12885 # Expected output in the following test is not necessarily expected (there
12886 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12887 # only testing for well-formedness.
12888 !! test
12889 Bug 6200: blockquotes and paragraph formatting
12890 !! input
12891 <blockquote>
12892 foo
12893 </blockquote>
12894
12895 bar
12896
12897 baz
12898 !! result
12899 <blockquote>
12900 foo
12901 </blockquote>
12902 <p>bar
12903 </p>
12904 <pre>baz
12905 </pre>
12906 !! end
12907
12908 !! test
12909 Bug 8293: Use of center tag ruins paragraph formatting
12910 !! input
12911 <center>
12912 foo
12913 </center>
12914
12915 bar
12916
12917 baz
12918 !! result
12919 <center>
12920 <p>foo
12921 </p>
12922 </center>
12923 <p>bar
12924 </p>
12925 <pre>baz
12926 </pre>
12927 !! end
12928
12929 !!test
12930 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12931 !!options
12932 php
12933 !!input
12934 <span><s>x</span></s>
12935 !!result
12936 <p><span><s>x&lt;/span&gt;</s></span>
12937 </p>
12938 !!end
12939
12940 !!test
12941 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12942 !!options
12943 parsoid
12944 !!input
12945 <span><s>x</span></s>
12946 !!result
12947 <p><span><s>x</s></span><s></s>
12948 </p>
12949 !!end
12950
12951 ###
12952 ### Language variants related tests
12953 ###
12954 !! test
12955 Self-link in language variants
12956 !! options
12957 title=[[Dunav]] language=sr
12958 !! input
12959 Both [[Dunav]] and [[Дунав]] are names for this river.
12960 !! result
12961 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12962 </p>
12963 !!end
12964
12965 !! article
12966 Дуна
12967 !! text
12968 content
12969 !! endarticle
12970
12971 !! test
12972 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12973 !! options
12974 title=[[Duna]] language=sr
12975 !! input
12976 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12977 !! result
12978 <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.
12979 </p>
12980 !! end
12981
12982 !! test
12983 Link to pages in language variants
12984 !! options
12985 language=sr
12986 !! input
12987 Main Page can be written as [[Маин Паге]]
12988 !! result
12989 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12990 </p>
12991 !!end
12992
12993
12994 !! test
12995 Multiple links to pages in language variants
12996 !! options
12997 language=sr
12998 !! input
12999 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13000 !! result
13001 <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>.
13002 </p>
13003 !!end
13004
13005
13006 !! test
13007 Simple template in language variants
13008 !! options
13009 language=sr
13010 !! input
13011 {{тест}}
13012 !! result
13013 <p>This is a test template
13014 </p>
13015 !! end
13016
13017
13018 !! test
13019 Template with explicit namespace in language variants
13020 !! options
13021 language=sr
13022 !! input
13023 {{Template:тест}}
13024 !! result
13025 <p>This is a test template
13026 </p>
13027 !! end
13028
13029
13030 !! test
13031 Basic test for template parameter in language variants
13032 !! options
13033 language=sr
13034 !! input
13035 {{парамтест|param=foo}}
13036 !! result
13037 <p>This is a test template with parameter foo
13038 </p>
13039 !! end
13040
13041
13042 !! test
13043 Simple category in language variants
13044 !! options
13045 language=sr cat
13046 !! input
13047 [[Category:МедиаWики Усер'с Гуиде]]
13048 !! result
13049 <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>
13050 !! end
13051
13052
13053 !! article
13054 Category:分类
13055 !! text
13056 blah
13057 !! endarticle
13058
13059 !! article
13060 Category:分類
13061 !! text
13062 blah
13063 !! endarticle
13064
13065 !! test
13066 Don't convert blue categorylinks to another variant (bug 33210)
13067 !! options
13068 language=zh cat
13069 !! input
13070 [[A]][[Category:分类]]
13071 !! result
13072 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13073 !! end
13074
13075
13076 !! test
13077 Stripping -{}- tags (language variants)
13078 !! options
13079 language=sr
13080 !! input
13081 Latin proverb: -{Ne nuntium necare}-
13082 !! result
13083 <p>Latin proverb: Ne nuntium necare
13084 </p>
13085 !! end
13086
13087
13088 !! test
13089 Prevent conversion with -{}- tags (language variants)
13090 !! options
13091 language=sr variant=sr-ec
13092 !! input
13093 Latinski: -{Ne nuntium necare}-
13094 !! result
13095 <p>Латински: Ne nuntium necare
13096 </p>
13097 !! end
13098
13099
13100 !! test
13101 Prevent conversion of text with -{}- tags (language variants)
13102 !! options
13103 language=sr variant=sr-ec
13104 !! input
13105 Latinski: -{Ne nuntium necare}-
13106 !! result
13107 <p>Латински: Ne nuntium necare
13108 </p>
13109 !! end
13110
13111
13112 !! test
13113 Prevent conversion of links with -{}- tags (language variants)
13114 !! options
13115 language=sr variant=sr-ec
13116 !! input
13117 -{[[Main Page]]}-
13118 !! result
13119 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13120 </p>
13121 !! end
13122
13123
13124 !! test
13125 -{}- tags within headlines (within html for parserConvert())
13126 !! options
13127 language=sr variant=sr-ec
13128 !! input
13129 == -{Naslov}- ==
13130 !! result
13131 <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>
13132
13133 !! end
13134
13135
13136 !! test
13137 Explicit definition of language variant alternatives
13138 !! options
13139 language=zh variant=zh-tw
13140 !! input
13141 -{zh:China;zh-tw:Taiwan}-, not China
13142 !! result
13143 <p>Taiwan, not China
13144 </p>
13145 !! end
13146
13147
13148 !! test
13149 Conversion around HTML tags
13150 !! options
13151 language=sr variant=sr-ec
13152 !! input
13153 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13154 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13155 !! result
13156 <p>
13157 <span title="ЛаCтин">ски</span>
13158 </p>
13159 !! end
13160
13161
13162 !! test
13163 Explicit session-wise language variant mapping (A flag and - flag)
13164 !! options
13165 language=zh variant=zh-tw
13166 !! input
13167 Taiwan is not China.
13168 But -{A|zh:China;zh-tw:Taiwan}- is China,
13169 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13170 and -{China}- is China.
13171 !! result
13172 <p>Taiwan is not China.
13173 But Taiwan is Taiwan,
13174 (This should be stripped!)
13175 and China is China.
13176 </p>
13177 !! end
13178
13179 !! test
13180 Explicit session-wise language variant mapping (H flag for hide)
13181 !! options
13182 language=zh variant=zh-tw
13183 !! input
13184 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13185 Taiwan is China.
13186 !! result
13187 <p>(This should be stripped!)
13188 Taiwan is Taiwan.
13189 </p>
13190 !! end
13191
13192 !! test
13193 Adding explicit conversion rule for title (T flag)
13194 !! options
13195 language=zh variant=zh-tw showtitle
13196 !! input
13197 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13198 !! result
13199 Taiwan
13200 <p>Should be stripped!
13201 </p>
13202 !! end
13203
13204 !! test
13205 Testing that changing the language variant here in the tests actually works
13206 !! options
13207 language=zh variant=zh showtitle
13208 !! input
13209 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13210 !! result
13211 China
13212 <p>Should be stripped!
13213 </p>
13214 !! end
13215
13216 !! test
13217 Recursive conversion of alt and title attrs shouldn't clear converter state
13218 !! options
13219 language=zh variant=zh-cn showtitle
13220 !! input
13221 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13222 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13223 !! result
13224 China
13225 <p>
13226 Should be stripped<span title="Exclamation">!</span>
13227 </p>
13228 !! end
13229
13230 !! test
13231 Bug 24072: more test on conversion rule for title
13232 !! options
13233 language=zh variant=zh-tw showtitle
13234 !! input
13235 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13236 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13237 !! result
13238 Taiwan
13239 <p>This should be stripped!
13240 This won't take interferes with the title rule.
13241 </p>
13242 !! end
13243
13244 !! test
13245 Partly disable title conversion if variant == main language code
13246 !! options
13247 language=zh variant=zh title=[[ZH]] showtitle
13248 !! input
13249 -{T|zh-cn:CN;zh-tw:TW}-
13250 !! result
13251 ZH
13252 <p>
13253 </p>
13254 !! end
13255
13256 !! test
13257 Partly disable title conversion if variant == main language code, more
13258 !! options
13259 language=zh variant=zh title=[[ZH]] showtitle
13260 !! input
13261 -{T|TW}-
13262 !! result
13263 ZH
13264 <p>
13265 </p>
13266 !! end
13267
13268 !! test
13269 Raw output of variant escape tags (R flag)
13270 !! options
13271 language=zh variant=zh-tw
13272 !! input
13273 Raw: -{R|zh:China;zh-tw:Taiwan}-
13274 !! result
13275 <p>Raw: zh:China;zh-tw:Taiwan
13276 </p>
13277 !! end
13278
13279 !! test
13280 Nested using of manual convert syntax
13281 !! options
13282 language=zh variant=zh-hk
13283 !! input
13284 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13285 !! result
13286 <p>Nested: Hello Hong Kong!
13287 </p>
13288 !! end
13289
13290 !! test
13291 Proper conversion of text in external links
13292 !! options
13293 language=sr variant=sr-ec
13294 !! input
13295 http://www.google.com
13296 gopher://www.google.com
13297 [http://www.google.com http://www.google.com]
13298 [gopher://www.google.com gopher://www.google.com]
13299 [https://www.google.com irc://www.google.com]
13300 [ftp://www.google.com www.google.com/ftp://dir]
13301 [//www.google.com www.google.com]
13302 !! result
13303 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13304 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13305 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13306 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13307 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13308 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13309 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13310 </p>
13311 !! end
13312
13313 !! test
13314 Do not convert roman numbers to language variants
13315 !! options
13316 language=sr variant=sr-ec
13317 !! input
13318 Fridrih IV je car.
13319 !! result
13320 <p>Фридрих IV је цар.
13321 </p>
13322 !! end
13323
13324 !! test
13325 Unclosed language converter markup "-{"
13326 !! options
13327 language=sr
13328 !! input
13329 -{T|hello
13330 !! result
13331 <p>-{T|hello
13332 </p>
13333 !! end
13334
13335 !! test
13336 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13337 !! options
13338 language=sr
13339 !! input
13340 -{R|=&gt;}-
13341 !! result
13342 <p>=&gt;
13343 </p>
13344 !!end
13345
13346 !!article
13347 Template:Bullet
13348 !!text
13349 * Bar
13350 !!endarticle
13351
13352 !! test
13353 Bug 529: Uncovered bullet
13354 !! input
13355 * Foo {{bullet}}
13356 !! result
13357 <ul><li> Foo
13358 </li><li> Bar
13359 </li></ul>
13360
13361 !! end
13362
13363 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13364 # Templates in Wikipedia rely on this behavior, as tidy has always been
13365 # enabled there. These tests are normally run *without* tidy, so specify the
13366 # full output here.
13367 # To test realistic parsing behavior, apply a tidy-like transformation to both
13368 # the expected output and your parser's output.
13369 !! test
13370 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13371 !! input
13372 ******* Foo {{bullet}}
13373 !! result
13374 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13375 </li></ul>
13376 </li></ul>
13377 </li></ul>
13378 </li></ul>
13379 </li></ul>
13380 </li></ul>
13381 </li><li> Bar
13382 </li></ul>
13383
13384 !! end
13385
13386 !! test
13387 Bug 529: Uncovered table already at line-start
13388 !! input
13389 x
13390
13391 {{table}}
13392 y
13393 !! result
13394 <p>x
13395 </p>
13396 <table>
13397 <tr>
13398 <td> 1 </td>
13399 <td> 2
13400 </td></tr>
13401 <tr>
13402 <td> 3 </td>
13403 <td> 4
13404 </td></tr></table>
13405 <p>y
13406 </p>
13407 !! end
13408
13409 !! test
13410 Bug 529: Uncovered bullet in parser function result
13411 !! input
13412 * Foo {{lc:{{bullet}} }}
13413 !! result
13414 <ul><li> Foo
13415 </li><li> bar
13416 </li></ul>
13417
13418 !! end
13419
13420 !! test
13421 Bug 5678: Double-parsed template argument
13422 !! input
13423 {{lc:{{{1}}}|hello}}
13424 !! result
13425 <p>{{{1}}}
13426 </p>
13427 !! end
13428
13429 !! test
13430 Bug 5678: Double-parsed template invocation
13431 !! input
13432 {{lc:{{paramtest {{!}} param = hello }} }}
13433 !! result
13434 <p>{{paramtest | param = hello }}
13435 </p>
13436 !! end
13437
13438 !! test
13439 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13440 !! options
13441 language=cs
13442 title=[[Main Page]]
13443 !! input
13444 {{PRVNÍVELKÉ:ěščř}}
13445 {{prvnívelké:ěščř}}
13446 {{PRVNÍMALÉ:ěščř}}
13447 {{prvnímalé:ěščř}}
13448 {{MALÁ:ěščř}}
13449 {{malá:ěščř}}
13450 {{VELKÁ:ěščř}}
13451 {{velká:ěščř}}
13452 !! result
13453 <p>Ěščř
13454 Ěščř
13455 ěščř
13456 ěščř
13457 ěščř
13458 ěščř
13459 ĚŠČŘ
13460 ĚŠČŘ
13461 </p>
13462 !! end
13463
13464 !! test
13465 Morwen/13: Unclosed link followed by heading
13466 !! input
13467 [[link
13468 ==heading==
13469 !! result
13470 <p>[[link
13471 </p>
13472 <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>
13473
13474 !! end
13475
13476 !! test
13477 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13478 !! input
13479 {{foo|
13480 =heading=
13481 !! result
13482 <p>{{foo|
13483 </p>
13484 <h1><span class="mw-headline" id="heading">heading</span></h1>
13485
13486 !! end
13487
13488 !! test
13489 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13490 !! input
13491 {{foo|
13492 ==heading==
13493 !! result
13494 <p>{{foo|
13495 </p>
13496 <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>
13497
13498 !! end
13499
13500 !! test
13501 Tildes in comments
13502 !! options
13503 pst
13504 !! input
13505 <!-- ~~~~ -->
13506 !! result
13507 <!-- ~~~~ -->
13508 !! end
13509
13510 !! test
13511 Paragraphs inside divs (no extra line breaks)
13512 !! input
13513 <div>Line one
13514
13515 Line two</div>
13516 !! result
13517 <div>Line one
13518 Line two</div>
13519
13520 !! end
13521
13522 !! test
13523 Paragraphs inside divs (extra line break on open)
13524 !! input
13525 <div>
13526 Line one
13527
13528 Line two</div>
13529 !! result
13530 <div>
13531 <p>Line one
13532 </p>
13533 Line two</div>
13534
13535 !! end
13536
13537 !! test
13538 Paragraphs inside divs (extra line break on close)
13539 !! input
13540 <div>Line one
13541
13542 Line two
13543 </div>
13544 !! result
13545 <div>Line one
13546 <p>Line two
13547 </p>
13548 </div>
13549
13550 !! end
13551
13552 !! test
13553 Paragraphs inside divs (extra line break on open and close)
13554 !! input
13555 <div>
13556 Line one
13557
13558 Line two
13559 </div>
13560 !! result
13561 <div>
13562 <p>Line one
13563 </p><p>Line two
13564 </p>
13565 </div>
13566
13567 !! end
13568
13569 !! test
13570 Nesting tags, paragraphs on lines which begin with <div>
13571 !! options
13572 disabled
13573 !! input
13574 <div></div><strong>A
13575 B</strong>
13576 !! result
13577 <div></div>
13578 <p><strong>A
13579 B</strong>
13580 </p>
13581 !! end
13582
13583 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13584 !! test
13585 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13586 !! options
13587 disabled
13588 !! input
13589 <blockquote>Line one
13590
13591 Line two</blockquote>
13592 !! result
13593 <blockquote>Line one
13594 Line two</blockquote>
13595
13596 !! end
13597
13598 !! test
13599 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13600 !! options
13601 disabled
13602 !! input
13603 <blockquote>
13604 Line one
13605
13606 Line two</blockquote>
13607 !! result
13608 <blockquote>
13609 <p>Line one
13610 </p>
13611 Line two</blockquote>
13612
13613 !! end
13614
13615 !! test
13616 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13617 !! options
13618 disabled
13619 !! input
13620 <blockquote>Line one
13621
13622 Line two
13623 </blockquote>
13624 !! result
13625 <blockquote>Line one
13626 <p>Line two
13627 </p>
13628 </blockquote>
13629
13630 !! end
13631
13632 !! test
13633 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13634 !! options
13635 disabled
13636 !! input
13637 <blockquote>
13638 Line one
13639
13640 Line two
13641 </blockquote>
13642 !! result
13643 <blockquote>
13644 <p>Line one
13645 </p><p>Line two
13646 </p>
13647 </blockquote>
13648
13649 !! end
13650
13651 !! test
13652 Paragraphs inside blockquotes/divs (no extra line breaks)
13653 !! input
13654 <blockquote><div>Line one
13655
13656 Line two</div></blockquote>
13657 !! result
13658 <blockquote><div>Line one
13659 Line two</div></blockquote>
13660
13661 !! end
13662
13663 !! test
13664 Paragraphs inside blockquotes/divs (extra line break on open)
13665 !! input
13666 <blockquote><div>
13667 Line one
13668
13669 Line two</div></blockquote>
13670 !! result
13671 <blockquote><div>
13672 <p>Line one
13673 </p>
13674 Line two</div></blockquote>
13675
13676 !! end
13677
13678 !! test
13679 Paragraphs inside blockquotes/divs (extra line break on close)
13680 !! input
13681 <blockquote><div>Line one
13682
13683 Line two
13684 </div></blockquote>
13685 !! result
13686 <blockquote><div>Line one
13687 <p>Line two
13688 </p>
13689 </div></blockquote>
13690
13691 !! end
13692
13693 !! test
13694 Paragraphs inside blockquotes/divs (extra line break on open and close)
13695 !! input
13696 <blockquote><div>
13697 Line one
13698
13699 Line two
13700 </div></blockquote>
13701 !! result
13702 <blockquote><div>
13703 <p>Line one
13704 </p><p>Line two
13705 </p>
13706 </div></blockquote>
13707
13708 !! end
13709
13710 !! test
13711 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13712 !! options
13713 wgLinkHolderBatchSize=0
13714 !! input
13715 [[meatball:1]]
13716 [[meatball:2]]
13717 [[meatball:3]]
13718 !! result
13719 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13720 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13721 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13722 </p>
13723 !! end
13724
13725 !! test
13726 Free external link invading image caption
13727 !! input
13728 [[Image:Foobar.jpg|thumb|http://x|hello]]
13729 !! result
13730 <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>
13731
13732 !! end
13733
13734 !! test
13735 Bug 15196: localised external link numbers
13736 !! options
13737 language=fa
13738 !! input
13739 [http://en.wikipedia.org/]
13740 !! result
13741 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13742 </p>
13743 !! end
13744
13745 !! test
13746 Multibyte character in padleft
13747 !! input
13748 {{padleft:-Hello|7|Æ}}
13749 !! result
13750 <p>Æ-Hello
13751 </p>
13752 !! end
13753
13754 !! test
13755 Multibyte character in padright
13756 !! input
13757 {{padright:Hello-|7|Æ}}
13758 !! result
13759 <p>Hello-Æ
13760 </p>
13761 !! end
13762
13763 !!test
13764 formatdate parser function
13765 !!input
13766 {{#formatdate:2009-03-24}}
13767 !! result
13768 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13769 </p>
13770 !! end
13771
13772 !!test
13773 formatdate parser function, with default format
13774 !!input
13775 {{#formatdate:2009-03-24|mdy}}
13776 !! result
13777 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13778 </p>
13779 !! end
13780
13781 !! test
13782 Spacing of numbers in formatted dates
13783 !! input
13784 {{#formatdate:January 15}}
13785 !! result
13786 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13787 </p>
13788 !! end
13789
13790 !! test
13791 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
13792 !! options
13793 language=nl title=[[MediaWiki:Common.css]]
13794 !! input
13795 {{#formatdate:2009-03-24|dmy}}
13796 !! result
13797 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13798 </p>
13799 !! end
13800
13801 #
13802 #
13803 #
13804
13805 #
13806 # Edit comments
13807 #
13808
13809 !! test
13810 Edit comment with link
13811 !! options
13812 comment
13813 !! input
13814 I like the [[Main Page]] a lot
13815 !! result
13816 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13817 !!end
13818
13819 !! test
13820 Edit comment with link and link text
13821 !! options
13822 comment
13823 !! input
13824 I like the [[Main Page|best pages]] a lot
13825 !! result
13826 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13827 !!end
13828
13829 !! test
13830 Edit comment with link and link text with suffix
13831 !! options
13832 comment
13833 !! input
13834 I like the [[Main Page|best page]]s a lot
13835 !! result
13836 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13837 !!end
13838
13839 !! test
13840 Edit comment with section link (non-local, eg in history list)
13841 !! options
13842 comment title=[[Main Page]]
13843 !! input
13844 /* External links */ removed bogus entries
13845 !! result
13846 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13847 !!end
13848
13849 !! test
13850 Edit comment with section link and text before it (non-local, eg in history list)
13851 !! options
13852 comment title=[[Main Page]]
13853 !! input
13854 pre-comment text /* External links */ removed bogus entries
13855 !! result
13856 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>
13857 !!end
13858
13859 !! test
13860 Edit comment with section link (local, eg in diff view)
13861 !! options
13862 comment local title=[[Main Page]]
13863 !! input
13864 /* External links */ removed bogus entries
13865 !! result
13866 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13867 !!end
13868
13869 !! test
13870 Edit comment with subpage link (bug 14080)
13871 !! options
13872 comment
13873 subpage
13874 title=[[Subpage test]]
13875 !! input
13876 Poked at a [[/subpage]] here...
13877 !! result
13878 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13879 !!end
13880
13881 !! test
13882 Edit comment with subpage link and link text (bug 14080)
13883 !! options
13884 comment
13885 subpage
13886 title=[[Subpage test]]
13887 !! input
13888 Poked at a [[/subpage|neat little page]] here...
13889 !! result
13890 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13891 !!end
13892
13893 !! test
13894 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13895 !! options
13896 comment
13897 title=[[Subpage test]]
13898 !! input
13899 Poked at a [[/subpage]] here...
13900 !! result
13901 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...
13902 !!end
13903
13904 !! test
13905 Edit comment with bare anchor link (local, as on diff)
13906 !! options
13907 comment
13908 local
13909 title=[[Main Page]]
13910 !!input
13911 [[#section]]
13912 !! result
13913 <a href="#section">#section</a>
13914 !! end
13915
13916 !! test
13917 Edit comment with bare anchor link (non-local, as on history)
13918 !! options
13919 comment
13920 title=[[Main Page]]
13921 !!input
13922 [[#section]]
13923 !! result
13924 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13925 !! end
13926
13927 !! test
13928 Anchor starting with underscore
13929 !!input
13930 [[#_ref|One]]
13931 !! result
13932 <p><a href="#_ref">One</a>
13933 </p>
13934 !! end
13935
13936 !! test
13937 Id starting with underscore
13938 !!input
13939 <div id="_ref"></div>
13940 !! result
13941 <div id="_ref"></div>
13942
13943 !! end
13944
13945 !! test
13946 Space normalisation on autocomment (bug 22784)
13947 !! options
13948 comment
13949 title=[[Main Page]]
13950 !!input
13951 /* __hello__world__ */
13952 !! result
13953 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13954 !! end
13955
13956 !! test
13957 percent-encoding and + signs in comments (Bug 26410)
13958 !! options
13959 comment
13960 !!input
13961 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13962 !! result
13963 <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>
13964 !! end
13965
13966 !! test
13967 Bad images - basic functionality
13968 !! options
13969 disabled
13970 !! input
13971 [[File:Bad.jpg]]
13972 !! result
13973 !! end
13974
13975 !! test
13976 Bad images - bug 16039: text after bad image disappears
13977 !! options
13978 disabled
13979 !! input
13980 Foo bar
13981 [[File:Bad.jpg]]
13982 Bar foo
13983 !! result
13984 <p>Foo bar
13985 </p><p>Bar foo
13986 </p>
13987 !! end
13988
13989 !! test
13990 Verify that displaytitle works (bug #22501) no displaytitle
13991 !! options
13992 showtitle
13993 !! config
13994 wgAllowDisplayTitle=true
13995 wgRestrictDisplayTitle=false
13996 !! input
13997 this is not the the title
13998 !! result
13999 Parser test
14000 <p>this is not the the title
14001 </p>
14002 !! end
14003
14004 !! test
14005 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14006 !! options
14007 showtitle
14008 title=[[Screen]]
14009 !! config
14010 wgAllowDisplayTitle=true
14011 wgRestrictDisplayTitle=false
14012 !! input
14013 this is not the the title
14014 {{DISPLAYTITLE:whatever}}
14015 !! result
14016 whatever
14017 <p>this is not the the title
14018 </p>
14019 !! end
14020
14021 !! test
14022 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14023 !! options
14024 showtitle
14025 title=[[Screen]]
14026 !! config
14027 wgAllowDisplayTitle=true
14028 wgRestrictDisplayTitle=true
14029 !! input
14030 this is not the the title
14031 {{DISPLAYTITLE:whatever}}
14032 !! result
14033 Screen
14034 <p>this is not the the title
14035 </p>
14036 !! end
14037
14038 !! test
14039 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14040 !! options
14041 showtitle
14042 title=[[Screen]]
14043 !! config
14044 wgAllowDisplayTitle=true
14045 wgRestrictDisplayTitle=true
14046 !! input
14047 this is not the the title
14048 {{DISPLAYTITLE:screen}}
14049 !! result
14050 screen
14051 <p>this is not the the title
14052 </p>
14053 !! end
14054
14055 !! test
14056 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14057 !! options
14058 showtitle
14059 title=[[Screen]]
14060 !! config
14061 wgAllowDisplayTitle=false
14062 !! input
14063 this is not the the title
14064 {{DISPLAYTITLE:screen}}
14065 !! result
14066 Screen
14067 <p>this is not the the title
14068 <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>
14069 </p>
14070 !! end
14071
14072 !! test
14073 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14074 !! options
14075 showtitle
14076 title=[[Screen]]
14077 !! config
14078 wgAllowDisplayTitle=false
14079 !! input
14080 this is not the the title
14081 !! result
14082 Screen
14083 <p>this is not the the title
14084 </p>
14085 !! end
14086
14087 !! test
14088 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14089 !! options
14090 showtitle
14091 title=[[Screen]]
14092 !! config
14093 wgAllowDisplayTitle=true
14094 wgRestrictDisplayTitle=true
14095 !! input
14096 this is not the the title
14097 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14098 !! result
14099 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14100 <p>this is not the the title
14101 </p>
14102 !! end
14103
14104 !! test
14105 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14106 !! options
14107 showtitle
14108 title=[[Screen]]
14109 !! config
14110 wgAllowDisplayTitle=true
14111 wgRestrictDisplayTitle=true
14112 !! input
14113 this is not the the title
14114 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14115 !! result
14116 <span style="color: red;">s</span>creen
14117 <p>this is not the the title
14118 </p>
14119 !! end
14120
14121 !! test
14122 preload: check <noinclude> and <includeonly>
14123 !! options
14124 preload
14125 !! input
14126 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14127 !! result
14128 Hello kind world.
14129 !! end
14130
14131 !! test
14132 preload: check <onlyinclude>
14133 !! options
14134 preload
14135 !! input
14136 Goodbye <onlyinclude>Hello world</onlyinclude>
14137 !! result
14138 Hello world
14139 !! end
14140
14141 !! test
14142 preload: can pass tags through if we want to
14143 !! options
14144 preload
14145 !! input
14146 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14147 !! result
14148 <includeonly>Hello world</includeonly>
14149 !! end
14150
14151 !! test
14152 preload: check that it doesn't try to do tricks
14153 !! options
14154 preload
14155 !! input
14156 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14157 !! result
14158 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14159 !! end
14160
14161 !! test
14162 Play a bit with r67090 and bug 3158
14163 !! options
14164 disabled
14165 !! input
14166 <div style="width:50% !important">&nbsp;</div>
14167 <div style="width:50%&nbsp;!important">&nbsp;</div>
14168 <div style="width:50%&#160;!important">&nbsp;</div>
14169 <div style="border : solid;">&nbsp;</div>
14170 !! result
14171 <div style="width:50% !important">&nbsp;</div>
14172 <div style="width:50% !important">&nbsp;</div>
14173 <div style="width:50% !important">&nbsp;</div>
14174 <div style="border&#160;: solid;">&nbsp;</div>
14175
14176 !! end
14177
14178 !! test
14179 HTML5 data attributes
14180 !! input
14181 <span data-foo="bar">Baz</span>
14182 <p data-abc-def_hij="">Quuz</p>
14183 !! result
14184 <p><span data-foo="bar">Baz</span>
14185 </p>
14186 <p data-abc-def_hij="">Quuz</p>
14187
14188 !! end
14189
14190 !! test
14191 percent-encoding and + signs in internal links (Bug 26410)
14192 !! input
14193 [[User:+%]] [[Page+title%]]
14194 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14195 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14196 [[%33%45]] [[%33%45+]]
14197 !! result
14198 <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>
14199 <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>
14200 <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>
14201 <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>
14202 </p>
14203 !! end
14204
14205 !! test
14206 Special characters in embedded file links (bug 27679)
14207 !! input
14208 [[File:Contains & ampersand.jpg]]
14209 [[File:Does not exist.jpg|Title with & ampersand]]
14210 !! result
14211 <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>
14212 <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>
14213 </p>
14214 !! end
14215
14216
14217 !! test
14218 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14219 !! input
14220 Text&apos;s been normalized?
14221 !! result
14222 <p>Text&#39;s been normalized?
14223 </p>
14224 !! end
14225
14226 !! test
14227 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14228 !! input
14229 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14230 !! result
14231 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14232 </p>
14233 !! end
14234
14235 !! test
14236 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14237 !! input
14238 [http://www.example.org/ ideograms]
14239 !! result
14240 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14241 </p>
14242 !! end
14243
14244 !! test
14245 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14246 !! input
14247 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14248 !! result
14249 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14250 </p>
14251 !! end
14252
14253 !! article
14254 Mediawiki:loop1
14255 !! text
14256 {{Identical|A}}
14257 !! endarticle
14258
14259 !! article
14260 Mediawiki:loop2
14261 !! text
14262 {{Identical|B}}
14263 !! endarticle
14264
14265 !! article
14266 Template:Identical
14267 !! text
14268 {{int:loop1}}
14269 {{int:loop2}}
14270 !! endarticle
14271
14272 !! test
14273 Bug 31098 Template which includes system messages which includes the template
14274 !! input
14275 {{Identical}}
14276 !! result
14277 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14278 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14279 </p>
14280 !! end
14281
14282 !! test
14283 Bug31490 Turkish: ucfirst 'blah'
14284 !! options
14285 language=tr
14286 !! input
14287 {{ucfirst:blah}}
14288 !! result
14289 <p>Blah
14290 </p>
14291 !! end
14292
14293 !! test
14294 Bug31490 Turkish: ucfirst 'ix'
14295 !! options
14296 language=tr
14297 !! input
14298 {{ucfirst:ix}}
14299 !! result
14300 <p>İx
14301 </p>
14302 !! end
14303
14304 !! test
14305 Bug31490 Turkish: lcfirst 'BLAH'
14306 !! options
14307 language=tr
14308 !! input
14309 {{lcfirst:BLAH}}
14310 !! result
14311 <p>bLAH
14312 </p>
14313 !! end
14314
14315 !! test
14316 Bug31490 Turkish: ucfırst (with a dotless i)
14317 !! options
14318 language=tr
14319 !! input
14320 {{ucfırst:blah}}
14321 !! result
14322 <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>
14323 </p>
14324 !! end
14325
14326 !! test
14327 Bug31490 ucfırst (with a dotless i) with English language
14328 !! options
14329 language=en
14330 !! input
14331 {{ucfırst:blah}}
14332 !! result
14333 <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>
14334 </p>
14335 !! end
14336
14337 !! test
14338 Bug 26375: TOC with italics
14339 !! options
14340 title=[[Main Page]]
14341 !! input
14342 __TOC__
14343 == ''Lost'' episodes ==
14344 !! result
14345 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14346 <ul>
14347 <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>
14348 </ul>
14349 </div>
14350 <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>
14351
14352 !! end
14353
14354 !! test
14355 Bug 26375: TOC with bold
14356 !! options
14357 title=[[Main Page]]
14358 !! input
14359 __TOC__
14360 == '''should be bold''' then normal text ==
14361 !! result
14362 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14363 <ul>
14364 <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>
14365 </ul>
14366 </div>
14367 <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>
14368
14369 !! end
14370
14371 !! test
14372 Bug 33845: Headings become cursive in TOC when they contain an image
14373 !! options
14374 title=[[Main Page]]
14375 !! input
14376 __TOC__
14377 == Image [[Image:foobar.jpg]] ==
14378 !! result
14379 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14380 <ul>
14381 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14382 </ul>
14383 </div>
14384 <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>
14385
14386 !! end
14387
14388 !! test
14389 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14390 !! options
14391 title=[[Main Page]]
14392 !! input
14393 __TOC__
14394 == <blockquote>Quote</blockquote> ==
14395 !! result
14396 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14397 <ul>
14398 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14399 </ul>
14400 </div>
14401 <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>
14402
14403 !! end
14404
14405 !! test
14406 Unclosed tags in TOC
14407 !! options
14408 title=[[Main Page]]
14409 !! input
14410 __TOC__
14411 == Proof: 2 < 3 ==
14412 <small>Hanc marginis exiguitas non caperet.</small>
14413 QED
14414 !! result
14415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14416 <ul>
14417 <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>
14418 </ul>
14419 </div>
14420 <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>
14421 <p><small>Hanc marginis exiguitas non caperet.</small>
14422 QED
14423 </p>
14424 !! end
14425
14426 !! test
14427 Multiple tags in TOC
14428 !! input
14429 __TOC__
14430 == <i>Foo</i> <b>Bar</b> ==
14431
14432 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14433 !! result
14434 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14435 <ul>
14436 <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>
14437 <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>
14438 </ul>
14439 </div>
14440 <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>
14441 <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>
14442
14443 !! end
14444
14445 !! test
14446 Tags with parameters in TOC
14447 !! input
14448 __TOC__
14449 == <sup class="in-h2">Hello</sup> ==
14450
14451 == <sup class="a > b">Evilbye</sup> ==
14452 !! result
14453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14454 <ul>
14455 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14456 <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>
14457 </ul>
14458 </div>
14459 <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>
14460 <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>
14461
14462 !! end
14463
14464 !! test
14465 span tags with directionality in TOC
14466 !! input
14467 __TOC__
14468 == <span dir="ltr">C++</span> ==
14469
14470 == <span dir="rtl">זבנג!</span> ==
14471
14472 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14473
14474 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14475
14476 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14477 !! result
14478 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14479 <ul>
14480 <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>
14481 <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>
14482 <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>
14483 <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>
14484 <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>
14485 </ul>
14486 </div>
14487 <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>
14488 <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>
14489 <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>
14490 <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>
14491 <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>
14492
14493 !! end
14494
14495 !! article
14496 MediaWiki:Bug32057
14497 !! text
14498 == {{int:headline_sample}} ==
14499 !! endarticle
14500
14501 !! test
14502 Bug 32057: Title needed when expanding <h> nodes.
14503 !! options
14504 title=[[Main Page]]
14505 !! input
14506 {{int:Bug32057}}
14507 !! result
14508 <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>
14509
14510 !! end
14511
14512 !! test
14513 Strip marker in urlencode
14514 !! input
14515 {{urlencode:x<nowiki/>y}}
14516 {{urlencode:x<nowiki/>y|wiki}}
14517 {{urlencode:x<nowiki/>y|path}}
14518 !! result
14519 <p>xy
14520 xy
14521 xy
14522 </p>
14523 !! end
14524
14525 !! test
14526 Strip marker in lc
14527 !! input
14528 {{lc:x<nowiki/>y}}
14529 !! result
14530 <p>xy
14531 </p>
14532 !! end
14533
14534 !! test
14535 Strip marker in uc
14536 !! input
14537 {{uc:x<nowiki/>y}}
14538 !! result
14539 <p>XY
14540 </p>
14541 !! end
14542
14543 !! test
14544 Strip marker in formatNum
14545 !! input
14546 {{formatnum:1<nowiki/>2}}
14547 {{formatnum:1<nowiki/>2|R}}
14548 !! result
14549 <p>12
14550 12
14551 </p>
14552 !! end
14553
14554 !! test
14555 Check noCommafy in formatNum
14556 !! options
14557 language=be-tarask
14558 !! input
14559 {{formatnum:123456.78}}
14560 {{formatnum:123456.78|NOSEP}}
14561 !! result
14562 <p>123 456,78
14563 123456.78
14564 </p>
14565 !! end
14566
14567 !! test
14568 Strip marker in grammar
14569 !! options
14570 language=fi
14571 !! input
14572 {{grammar:elative|foo<nowiki/>bar}}
14573 !! result
14574 <p>foobarista
14575 </p>
14576 !! end
14577
14578 !! test
14579 Strip marker in padleft
14580 !! input
14581 {{padleft:|2|x<nowiki/>y}}
14582 !! result
14583 <p>xy
14584 </p>
14585 !! end
14586
14587 !! test
14588 Strip marker in padright
14589 !! input
14590 {{padright:|2|x<nowiki/>y}}
14591 !! result
14592 <p>xy
14593 </p>
14594 !! end
14595
14596 !! test
14597 Strip marker in anchorencode
14598 !! input
14599 {{anchorencode:x<nowiki/>y}}
14600 !! result
14601 <p>xy
14602 </p>
14603 !! end
14604
14605 !! test
14606 nowiki inside link inside heading (bug 18295)
14607 !! input
14608 ==[[foo|x<nowiki>y</nowiki>z]]==
14609 !! result
14610 <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>
14611
14612 !! end
14613
14614 !! test
14615 new support for bdi element (bug 31817)
14616 !! input
14617 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14618 !! result
14619 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14620
14621 !!end
14622
14623 !! test
14624 Ignore pipe between table row attributes
14625 !! input
14626 {|
14627 | quux
14628 |- id=foo | style='color: red'
14629 | bar
14630 |}
14631 !! result
14632 <table>
14633 <tr>
14634 <td> quux
14635 </td></tr>
14636 <tr id="foo" style="color: red">
14637 <td> bar
14638 </td></tr></table>
14639
14640 !! end
14641
14642 !!test
14643 Gallery override link with WikiLink (bug 34852)
14644 !! input
14645 <gallery>
14646 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14647 </gallery>
14648 !! result
14649 <ul class="gallery">
14650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14651 <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>
14652 <div class="gallerytext">
14653 <p>caption
14654 </p>
14655 </div>
14656 </div></li>
14657 </ul>
14658
14659 !! end
14660
14661 !!test
14662 Gallery override link with absolute external link (bug 34852)
14663 !! input
14664 <gallery>
14665 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14666 </gallery>
14667 !! result
14668 <ul class="gallery">
14669 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14670 <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>
14671 <div class="gallerytext">
14672 <p>caption
14673 </p>
14674 </div>
14675 </div></li>
14676 </ul>
14677
14678 !! end
14679
14680 !!test
14681 Gallery override link with malicious javascript (bug 34852)
14682 !! input
14683 <gallery>
14684 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14685 </gallery>
14686 !! result
14687 <ul class="gallery">
14688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14689 <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>
14690 <div class="gallerytext">
14691 <p>caption
14692 </p>
14693 </div>
14694 </div></li>
14695 </ul>
14696
14697 !! end
14698
14699 !!test
14700 Gallery with invalid title as link (bug 43964)
14701 !! input
14702 <gallery>
14703 File:foobar.jpg|link=<
14704 </gallery>
14705 !! result
14706 <ul class="gallery">
14707 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14708 <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>
14709 <div class="gallerytext">
14710 </div>
14711 </div></li>
14712 </ul>
14713
14714 !! end
14715
14716 !!test
14717 Language parser function
14718 !! input
14719 {{#language:ar}}
14720 !! result
14721 <p>العربية
14722 </p>
14723 !! end
14724
14725 !!test
14726 Padleft and padright as substr
14727 !! input
14728 {{padleft:|3|abcde}}
14729 {{padright:|3|abcde}}
14730 !! result
14731 <p>abc
14732 abc
14733 </p>
14734 !! end
14735
14736 !!test
14737 Special parser function
14738 !! input
14739 {{#special:RandomPage}}
14740 {{#special:BaDtItLe}}
14741 {{#special:Foobar}}
14742 !! result
14743 <p>Special:Random
14744 Special:Badtitle
14745 Special:Foobar
14746 </p>
14747 !! end
14748
14749 !!test
14750 Bug 34939 - Case insensitive link parsing ([HttP://])
14751 !! input
14752 [HttP://MediaWiki.Org/]
14753 !! result
14754 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14755 </p>
14756 !! end
14757
14758 !!test
14759 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14760 !! input
14761 [HttP://MediaWiki.Org/ MediaWiki]
14762 !! result
14763 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14764 </p>
14765 !! end
14766
14767 !!test
14768 Bug 34939 - Case insensitive link parsing (HttP://)
14769 !! input
14770 HttP://MediaWiki.Org/
14771 !! result
14772 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14773 </p>
14774 !! end
14775
14776
14777 ###
14778 ### Parsoids-specific tests
14779 ### Parsoid-PHP parser incompatibilities
14780 ###
14781 !!test
14782 1. SOL-sensitive wikitext tokens as template-args
14783 !!options
14784 parsoid=wt2html,wt2wt
14785 !!input
14786 {{echo|*a}}
14787 {{echo|#a}}
14788 {{echo|:a}}
14789 !!result
14790 <span about="#mwt1" typeof="mw:Transclusion">
14791 </span><ul about="#mwt1"><li>a</li></ul>
14792 <span about="#mwt2" typeof="mw:Transclusion">
14793 </span><ol about="#mwt2"><li>a</li></ol>
14794 <span about="#mwt3" typeof="mw:Transclusion">
14795 </span><dl about="#mwt3"><dd>a</dd></dl>
14796 !!end
14797
14798 #### ----------------------------------------------------------------
14799 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14800 #### tags. Parsoid's output for these tags differs from that of the
14801 #### PHP parser.
14802 #### ----------------------------------------------------------------
14803
14804 !!test
14805 Ref: 1. ref-location should be replaced with an index span
14806 !!options
14807 parsoid
14808 !!input
14809 A <ref>foo</ref>
14810 B <ref name="x">foo</ref>
14811 C <ref name="y" />
14812 !!result
14813 <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>
14814 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>
14815 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>
14816 !!end
14817
14818 !!test
14819 Ref: 2. ref-tags with identical names should all get the same index
14820 !!options
14821 parsoid
14822 !!input
14823 A <ref name="x">foo</ref>
14824 B <ref name="x" />
14825 !!result
14826 <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>
14827 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>
14828 !!end
14829
14830 !!test
14831 Ref: 3. spaces in ref-names should be ignored
14832 !!options
14833 parsoid
14834 !!input
14835 A <ref name="x">foo</ref>
14836 B <ref name=" x " />
14837 C <ref name= x />
14838 !!result
14839 <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>
14840 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>
14841 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>
14842 !!end
14843
14844 !!test
14845 Ref: 4. 'constructor' should be accepted as a valid ref-name
14846 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14847 !!options
14848 parsoid
14849 !!input
14850 A <ref name="constructor">foo</ref>
14851 !!result
14852 <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>
14853 !!end
14854
14855 !!test
14856 Ref: 5. body should accept generic wikitext
14857 !!options
14858 parsoid
14859 !!input
14860 A <ref>
14861 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14862 </ref>
14863
14864 <references />
14865 !!result
14866 <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>
14867
14868 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14869 <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>
14870 </li></ol>
14871 !!end
14872
14873 !!test
14874 Ref: 6. indent-pres should not be output in ref-body
14875 !!options
14876 parsoid
14877 !!input
14878 A <ref>
14879 foo
14880 bar
14881 baz
14882 </ref>
14883
14884 <references />
14885 !!result
14886 <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>
14887
14888 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14889 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14890 bar
14891 baz
14892 </li></ol>
14893 !!end
14894
14895 !!test
14896 Ref: 6. No p-wrapping in ref-body
14897 !!options
14898 parsoid
14899 !!input
14900 A <ref>
14901 foo
14902
14903 bar
14904
14905
14906 baz
14907
14908
14909
14910 booz
14911 </ref>
14912
14913 <references />
14914 !!result
14915 <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>
14916
14917 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14918 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14919
14920 bar
14921
14922
14923 baz
14924
14925
14926
14927 booz
14928 </li></ol>
14929 !!end
14930
14931 !!test
14932 Ref: 8. transclusion wikitext has lower precedence
14933 !!options
14934 parsoid
14935 !!input
14936 A <ref> foo {{echo|</ref> B C}}
14937
14938 <references />
14939 !!result
14940 <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>
14941
14942 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14943 <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>
14944 !!end
14945
14946 !!test
14947 Ref: 9. unclosed comments should not leak out of ref-body
14948 !!options
14949 parsoid
14950 !!input
14951 A <ref> foo <!--</ref> B C
14952
14953 <references />
14954 !!result
14955 <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>
14956
14957 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14958 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14959 !!end
14960
14961 !!test
14962 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14963 !!options
14964 parsoid
14965 !!input
14966 A <ref> <b> foo </ref> B C
14967
14968 <references />
14969 !!result
14970 <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>
14971
14972 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14973 <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>
14974 !!end
14975
14976 !!test
14977 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14978 !!options
14979 parsoid
14980 !!input
14981 A <ref>foo</ref> B
14982 C <ref>bar</ref> D
14983 !!result
14984 <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
14985 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>
14986 !!end
14987
14988 !!test
14989 Ref: 12. ref-tags act as trailing newline migration barrier
14990 !!options
14991 parsoid
14992 !!input
14993 <!--the newline at the end of this line moves out of the p-tag-->a
14994
14995 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14996 <ref />
14997
14998 c
14999 !!result
15000 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15001
15002
15003 <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>
15004 <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>
15005
15006
15007 <p>c</p>
15008 !!end
15009
15010 !!test
15011 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15012 !!options
15013 parsoid
15014 !!input
15015 <ref>foo</ref> A
15016 <ref>bar
15017 </ref> B
15018 !!result
15019 <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
15020 <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>
15021 !!end
15022
15023 !!test
15024 Ref: 14. A nested ref-tag should be emitted as plain text
15025 !!options
15026 parsoid
15027 !!input
15028 <ref>foo <ref>bar</ref> baz</ref>
15029
15030 <references />
15031 !!result
15032 <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>
15033
15034 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15035 <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>
15036 !!end
15037
15038 !!test
15039 Ref: 15. ref-tags with identical names should get identical indexes
15040 !!options
15041 parsoid
15042 !!input
15043 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15044 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15045
15046 <references />
15047 !!result
15048 <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>
15049 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>
15050
15051 <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>
15052 !!end
15053
15054 !!test
15055 References: 1. references tag without any refs should be handled properly
15056 !!options
15057 parsoid
15058 !!input
15059 <references />
15060 !!result
15061 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15062 !!end
15063
15064 !!test
15065 References: 2. references tag with group only outputs references from that group
15066 !!options
15067 parsoid
15068 !!input
15069 A <ref group="a">foo</ref>
15070 B <ref group="b">bar</ref>
15071
15072 <references group='a' />
15073 !!result
15074 <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>
15075 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>
15076
15077 <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>
15078 !!end
15079
15080 !!test
15081 References: 3. ref list should be cleared after processing references
15082 !!options
15083 parsoid
15084 !!input
15085 A <ref>foo</ref>
15086
15087 <references />
15088
15089 B <ref>bar</ref>
15090
15091 <references />
15092 !!result
15093 <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>
15094
15095 <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>
15096
15097 <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>
15098
15099 <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>
15100 !!end
15101
15102 !!test
15103 References: 4. only referenced group should be cleared after processing references
15104 !!options
15105 parsoid
15106 !!input
15107 A <ref group="a">afoo</ref>
15108 B <ref>bfoo</ref>
15109
15110 <references group="a"/>
15111
15112 C <ref>cfoo</ref>
15113
15114 <references />
15115 !!result
15116 <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>
15117 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>
15118
15119 <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>
15120
15121 <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>
15122
15123 <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>
15124 !!end
15125
15126 !!test
15127 References: 5. ref tags in references should be processed while ignoring all other content
15128 !!options
15129 parsoid
15130 !!input
15131 A <ref name="a" />
15132 B <ref name="b">bar</ref>
15133
15134 <references>
15135 <ref name="a">foo</ref>
15136 This should just get lost.
15137 </references>
15138 !!result
15139 <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>
15140 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>
15141
15142 <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>
15143 !!end
15144
15145 !!test
15146 References: 6. <references /> from a transclusion
15147 !!options
15148 parsoid
15149 !!input
15150 {{echo|<references />}}
15151 !!result
15152 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15153 !!end
15154
15155 !! test
15156 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15157 !! options
15158 parsoid
15159 !! input
15160 A <ref>foo bar for a</ref>
15161 B <ref name="b" />
15162
15163 <references />
15164
15165 <references>
15166 <ref name="b">foo</ref>
15167 </references>
15168 !! result
15169 <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>
15170 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>
15171
15172 <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>
15173
15174 <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>
15175
15176 !! end
15177
15178 #### ----------------------------------------------------------------
15179 #### The following section of tests are primarily to test
15180 #### wikitext escaping capabilities of Parsoid. Given that
15181 #### escaping can be done any number of ways, the wikitext (input)
15182 #### is always adjusted to reflect how Parsoid adds nowiki
15183 #### escape tags.
15184 ####
15185 #### We are marking several tests as parsoid-only since the
15186 #### HTML in the result section is different from what the
15187 #### PHP parser generates for it.
15188 #### ----------------------------------------------------------------
15189
15190
15191 #### --------------- Headings ---------------
15192 #### 0. Unnested
15193 #### 1. Nested inside html <h1>=foo=</h1>
15194 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15195 #### 3. Nested inside html with wikitext split by html tags
15196 #### 4. No escape needed
15197 #### 5. Empty headings <h1></h1>
15198 #### 6. Heading chars in SOL context
15199 #### ----------------------------------------
15200 !! test
15201 Headings: 0. Unnested
15202 !! options
15203 parsoid
15204 !! input
15205 <nowiki>=foo=</nowiki>
15206
15207 <nowiki> =foo= </nowiki>
15208 <!--cmt-->
15209 <nowiki>=foo=</nowiki>
15210
15211 =foo''a''<nowiki>=</nowiki>
15212 !! result
15213 <p><span typeof="mw:Nowiki">=foo=</span></p>
15214
15215 <p><span typeof="mw:Nowiki"> =foo= </span>
15216 <!--cmt-->
15217 <span typeof="mw:Nowiki">=foo=</span></p>
15218
15219 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15220 !!end
15221
15222 !! test
15223 Headings: 1. Nested inside html
15224 !! options
15225 parsoid
15226 !! input
15227 =<nowiki>=foo=</nowiki>=
15228
15229 ==<nowiki>=foo=</nowiki>==
15230
15231 ===<nowiki>=foo=</nowiki>===
15232
15233 ====<nowiki>=foo=</nowiki>====
15234
15235 =====<nowiki>=foo=</nowiki>=====
15236
15237 ======<nowiki>=foo=</nowiki>======
15238 !! result
15239 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15240 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15241 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15242 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15243 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15244 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15245 !!end
15246
15247 !! test
15248 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15249 !! options
15250 parsoid
15251 !! input
15252 =foo=
15253 <nowiki>*</nowiki>bar
15254
15255 =foo=
15256 =bar
15257
15258 =foo=
15259 <nowiki>=bar=</nowiki>
15260 !! result
15261 <h1>foo</h1>*bar
15262 <h1>foo</h1>=bar
15263 <h1>foo</h1>=bar=
15264 !!end
15265
15266 !! test
15267 Headings: 3. Nested inside html with wikitext split by html tags
15268 !! options
15269 parsoid
15270 !! input
15271 =='''bold'''<nowiki>foo=</nowiki>=
15272 !! result
15273 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15274 !!end
15275
15276 !! test
15277 Headings: 4a. No escaping needed (testing just h1 and h2)
15278 !! options
15279 parsoid
15280 !! input
15281 ==foo=
15282
15283 =foo==
15284
15285 = =foo= =
15286
15287 ==foo= bar=
15288
15289 ===foo==
15290
15291 ==foo===
15292
15293 =''=''foo==
15294
15295 =<nowiki>=</nowiki>=
15296 !! result
15297 <h1>=foo</h1>
15298 <h1>foo=</h1>
15299 <h1> =foo= </h1>
15300 <h1>=foo= bar</h1>
15301 <h2>=foo</h2>
15302 <h2>foo=</h2>
15303 <h1><i>=</i>foo=</h1>
15304 <h1><span typeof="mw:Nowiki">=</span></h1>
15305 !!end
15306
15307 !! test
15308 Headings: 4b. No escaping needed (inside p-tags)
15309 !! options
15310 parsoid
15311 !! input
15312 ===
15313 =foo= x
15314 =foo= <s></s>
15315 !! result
15316 <p>===
15317 =foo= x
15318 =foo= <s></s>
15319 </p>
15320 !!end
15321
15322 !! test
15323 Headings: 5. Empty headings
15324 !! options
15325 parsoid
15326 !! input
15327 =<nowiki/>=
15328
15329 ==<nowiki/>==
15330
15331 ===<nowiki/>===
15332
15333 ====<nowiki/>====
15334
15335 =====<nowiki/>=====
15336
15337 ======<nowiki/>======
15338 !! result
15339 <h1></h1>
15340 <h2></h2>
15341 <h3></h3>
15342 <h4></h4>
15343 <h5></h5>
15344 <h6></h6>
15345 !!end
15346
15347 !! test
15348 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15349 !! options
15350 parsoid
15351 !! input
15352 <nowiki>=a=</nowiki>
15353
15354 <nowiki>=a=</nowiki>
15355
15356 <nowiki>=a=</nowiki>
15357
15358 <nowiki>=a=</nowiki>
15359 !! result
15360 <p>=a=</p>
15361 <p>=a= </p>
15362 <p>=a= </p>
15363 <p>=a= </p>
15364 !!end
15365
15366 !! test
15367 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15368 !! options
15369 parsoid
15370 !! input
15371 <nowiki>=a=
15372 b</nowiki>
15373
15374 <nowiki>=a=
15375 b</nowiki>
15376
15377 <nowiki>=a=
15378 b</nowiki>
15379
15380 <nowiki>=a=
15381 b</nowiki>
15382 !! result
15383 <p>=a=
15384 b</p>
15385 <p>=a=
15386 b</p>
15387 <p>=a=
15388 b</p>
15389 <p>=a=
15390 b</p>
15391 </p>
15392 !!end
15393
15394 !! test
15395 Headings: 6c. Heading chars in SOL context (leading newline break)
15396 !! options
15397 parsoid
15398 !! input
15399 a
15400 <nowiki>=b=</nowiki>
15401 !! result
15402 <p>a
15403 =b=</p>
15404 !!end
15405
15406 !! test
15407 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15408 !! options
15409 parsoid
15410 !! input
15411 <!--c0--><nowiki>=a=</nowiki>
15412 <!--c1-->
15413 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15414 !! result
15415 <p><!--c0-->=a=</p>
15416 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15417 !!end
15418
15419 !! test
15420 Headings: 6d. Heading chars in SOL context (No escaping needed)
15421 !! options
15422 parsoid=html2wt
15423 !! input
15424 =a=<div>b</div>
15425 !! result
15426 =a=<div>b</div>
15427 !!end
15428
15429 #### --------------- Lists ---------------
15430 #### 0. Outside nests (*foo, etc.)
15431 #### 1. Nested inside html <ul><li>*foo</li></ul>
15432 #### 2. Inside definition lists
15433 #### 3. Only bullets at start should be escaped
15434 #### 4. No escapes needed
15435 #### 5. No unnecessary escapes
15436 #### 6. Escape bullets in SOL position
15437 #### 7. Escape bullets in a multi-line context
15438 #### ----------------------------------------
15439
15440 !! test
15441 Lists: 0. Outside nests
15442 !! input
15443 <nowiki>*</nowiki>foo
15444
15445 <nowiki>#</nowiki>foo
15446 !! result
15447 <p>*foo
15448 </p><p>#foo
15449 </p>
15450 !!end
15451
15452 !! test
15453 Lists: 1. Nested inside html
15454 !! input
15455 *<nowiki>*foo</nowiki>
15456
15457 *<nowiki>#foo</nowiki>
15458
15459 *<nowiki>:foo</nowiki>
15460
15461 *<nowiki>;foo</nowiki>
15462
15463 #<nowiki>*foo</nowiki>
15464
15465 #<nowiki>#foo</nowiki>
15466
15467 #<nowiki>:foo</nowiki>
15468
15469 #<nowiki>;foo</nowiki>
15470 !! result
15471 <ul><li>*foo
15472 </li></ul>
15473 <ul><li>#foo
15474 </li></ul>
15475 <ul><li>:foo
15476 </li></ul>
15477 <ul><li>;foo
15478 </li></ul>
15479 <ol><li>*foo
15480 </li></ol>
15481 <ol><li>#foo
15482 </li></ol>
15483 <ol><li>:foo
15484 </li></ol>
15485 <ol><li>;foo
15486 </li></ol>
15487
15488 !!end
15489
15490 !! test
15491 Lists: 2. Inside definition lists
15492 !! input
15493 ;<nowiki>;foo</nowiki>
15494
15495 ;<nowiki>:foo</nowiki>
15496
15497 ;<nowiki>:foo</nowiki>
15498 :bar
15499
15500 :<nowiki>:foo</nowiki>
15501 !! result
15502 <dl><dt>;foo
15503 </dt></dl>
15504 <dl><dt>:foo
15505 </dt></dl>
15506 <dl><dt>:foo
15507 </dt><dd>bar
15508 </dd></dl>
15509 <dl><dd>:foo
15510 </dd></dl>
15511
15512 !!end
15513
15514 !! test
15515 Lists: 3. Only bullets at start of text should be escaped
15516 !! input
15517 *<nowiki>*foo*bar</nowiki>
15518
15519 *<nowiki>*foo</nowiki>''it''*bar
15520 !! result
15521 <ul><li>*foo*bar
15522 </li></ul>
15523 <ul><li>*foo<i>it</i>*bar
15524 </li></ul>
15525
15526 !!end
15527
15528 !! test
15529 Lists: 4. No escapes needed
15530 !! options
15531 parsoid
15532 !! input
15533 *foo*bar
15534
15535 *''foo''*bar
15536
15537 *[[Foo]]: bar
15538 !! result
15539 <ul><li>foo*bar
15540 </li></ul>
15541 <ul><li><i>foo</i>*bar
15542 </li></ul>
15543 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15544 </li></ul>
15545 !!end
15546
15547 !! test
15548 Lists: 5. No unnecessary escapes
15549 !! input
15550 * bar <span><nowiki>[[foo]]</nowiki></span>
15551
15552 *=bar <span><nowiki>[[foo]]</nowiki></span>
15553
15554 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15555
15556 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15557
15558 *=bar <span>foo]]</span>=
15559
15560 * <s></s>: a
15561 !! result
15562 <ul><li> bar <span>[[foo]]</span>
15563 </li></ul>
15564 <ul><li>=bar <span>[[foo]]</span>
15565 </li></ul>
15566 <ul><li>[[bar <span>[[foo]]</span>
15567 </li></ul>
15568 <ul><li>]]bar <span>[[foo]]</span>
15569 </li></ul>
15570 <ul><li>=bar <span>foo]]</span>=
15571 </li></ul>
15572 <ul><li> <s></s>: a
15573 </li></ul>
15574
15575 !!end
15576
15577 !! test
15578 Lists: 6. Escape bullets in SOL position
15579 !! options
15580 parsoid
15581 !! input
15582 <!--cmt--><nowiki>*foo</nowiki>
15583 !! result
15584 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15585 !!end
15586
15587 !! test
15588 Lists: 7. Escape bullets in a multi-line context
15589 !! input
15590 a
15591 <nowiki>*</nowiki>b
15592 !! result
15593 <p>a
15594 *b
15595 </p>
15596 !!end
15597
15598 #### --------------- HRs ---------------
15599 #### 1. Single line
15600 #### -----------------------------------
15601
15602 !! test
15603 HRs: 1. Single line
15604 !! options
15605 parsoid
15606 !! input
15607 ----<nowiki>----</nowiki>
15608 ----=foo=
15609 ----*foo
15610 !! result
15611 <hr><span typeof="mw:Nowiki">----</span>
15612 <hr>=foo=
15613 <hr>*foo
15614 !! end
15615
15616 #### --------------- Tables ---------------
15617 #### 1a. Simple example
15618 #### 1b. No escaping needed (!foo)
15619 #### 1c. No escaping needed (|foo)
15620 #### 1d. No escaping needed (|}foo)
15621 ####
15622 #### 2a. Nested in td (<td>foo|bar</td>)
15623 #### 2b. Nested in td (<td>foo||bar</td>)
15624 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15625 ####
15626 #### 3a. Nested in th (<th>foo!bar</th>)
15627 #### 3b. Nested in th (<th>foo!!bar</th>)
15628 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15629 ####
15630 #### 4a. Escape -
15631 #### 4b. Escape +
15632 #### 4c. No escaping needed
15633 #### --------------------------------------
15634
15635 !! test
15636 Tables: 1a. Simple example
15637 !! input
15638 <nowiki>{|
15639 |}</nowiki>
15640 !! result
15641 <p>{|
15642 |}
15643 </p>
15644 !! end
15645
15646 !! test
15647 Tables: 1b. No escaping needed
15648 !! input
15649 !foo
15650 !! result
15651 <p>!foo
15652 </p>
15653 !! end
15654
15655 !! test
15656 Tables: 1c. No escaping needed
15657 !! input
15658 |foo
15659 !! result
15660 <p>|foo
15661 </p>
15662 !! end
15663
15664 !! test
15665 Tables: 1d. No escaping needed
15666 !! input
15667 |}foo
15668 !! result
15669 <p>|}foo
15670 </p>
15671 !! end
15672
15673 !! test
15674 Tables: 2a. Nested in td
15675 !! options
15676 parsoid
15677 !! input
15678 {|
15679 |<nowiki>foo|bar</nowiki>
15680 |}
15681 !! result
15682 <table><tbody><tr>
15683 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15684 !! end
15685
15686 !! test
15687 Tables: 2b. Nested in td
15688 !! options
15689 parsoid
15690 !! input
15691 {|
15692 |<nowiki>foo||bar</nowiki>
15693 |''it''<nowiki>foo||bar</nowiki>
15694 |}
15695 !! result
15696 <table><tbody><tr>
15697 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15698 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15699 !! end
15700
15701 !! test
15702 Tables: 2c. Nested in td -- no escaping needed
15703 !! options
15704 parsoid
15705 !! input
15706 {|
15707 |foo!!bar
15708 |}
15709 !! result
15710 <table><tbody><tr><td>foo!!bar
15711 </td></tr></tbody></table>
15712
15713 !! end
15714
15715 !! test
15716 Tables: 3a. Nested in th
15717 !! options
15718 parsoid
15719 !! input
15720 {|
15721 !foo!bar
15722 |}
15723 !! result
15724 <table><tbody><tr><th>foo!bar
15725 </th></tr></tbody></table>
15726
15727 !! end
15728
15729 !! test
15730 Tables: 3b. Nested in th
15731 !! options
15732 parsoid
15733 !! input
15734 {|
15735 !<nowiki>foo!!bar</nowiki>
15736 |}
15737 !! result
15738 <table>
15739 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15740 </tbody></table>
15741 !! end
15742
15743 !! test
15744 Tables: 3c. Nested in th -- no escaping needed
15745 !! options
15746 parsoid
15747 !! input
15748 {|
15749 !<nowiki>foo||bar</nowiki>
15750 |}
15751 !! result
15752 <table><tbody><tr>
15753 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15754 !! end
15755
15756 !! test
15757 Tables: 4a. Escape -
15758 !! options
15759 parsoid
15760 !! input
15761 {|
15762 |-
15763 !-bar
15764 |-
15765 |<nowiki>-bar</nowiki>
15766 |}
15767 !! result
15768 <table><tbody>
15769 <tr><th>-bar</th></tr>
15770 <tr>
15771 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15772 !! end
15773
15774 !! test
15775 Tables: 4b. Escape +
15776 !! options
15777 parsoid
15778 !! input
15779 {|
15780 |-
15781 !+bar
15782 |-
15783 |<nowiki>+bar</nowiki>
15784 |}
15785 !! result
15786 <table><tbody>
15787 <tr><th>+bar</th></tr>
15788 <tr>
15789 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15790 !! end
15791
15792 !! test
15793 Tables: 4c. No escaping needed
15794 !! options
15795 parsoid
15796 !! input
15797 {|
15798 |-
15799 |foo-bar
15800 |foo+bar
15801 |-
15802 |''foo''-bar
15803 |''foo''+bar
15804 |-
15805 |foo
15806 bar|baz
15807 +bar
15808 -bar
15809 |}
15810 !! result
15811 <table><tbody>
15812 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15813 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15814 <tr><td>foo
15815 <p>bar|baz
15816 +bar
15817 -bar</p></td></tr>
15818 </tbody></table>
15819 !! end
15820
15821 ### SSS FIXME: Disabled right now because accurate html2wt
15822 ### on this snippet requires data-parsoid flags that we've
15823 ### stripped out of these tests. We should scheme how we
15824 ### we want to handle these kind of tests that require
15825 ### data-parsoid flags for accurate html2wt serialization
15826
15827 !! test
15828 Tables: 4d. No escaping needed
15829 !! options
15830 disabled
15831 !! input
15832 {|
15833 ||+1
15834 ||-2
15835 |}
15836 !! result
15837 <table>
15838 <tr>
15839 <td>+1
15840 </td>
15841 <td>-2
15842 </td></tr></table>
15843
15844 !! end
15845
15846 #### --------------- Links ----------------
15847 #### 1. Quote marks in link text
15848 #### 2. Wikilinks: Escapes needed
15849 #### 3. Wikilinks: No escapes needed
15850 #### 4. Extlinks: Escapes needed
15851 #### 5. Extlinks: No escapes needed
15852 #### --------------------------------------
15853 !! test
15854 Links 1. Quote marks in link text
15855 !! options
15856 parsoid
15857 !! input
15858 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15859 !! result
15860 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15861 !! end
15862
15863 !! test
15864 Links 2. WikiLinks: Escapes needed
15865 !! options
15866 parsoid
15867 !! input
15868 [[Foo|<nowiki>[Foobar]</nowiki>]]
15869 [[Foo|<nowiki>Foobar]</nowiki>]]
15870 [[Foo|x [Foobar] x]]
15871 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15872 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15873 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15874 [[Foo|<nowiki>|Bar</nowiki>]]
15875 [[Foo|<nowiki>]]bar</nowiki>]]
15876 [[Foo|<nowiki>[[bar</nowiki>]]
15877 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15878 !! result
15879 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15880 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15881 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15882 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15883 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15884 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15885 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15886 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15887 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15888 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15889 !! end
15890
15891 !! test
15892 Links 3. WikiLinks: No escapes needed
15893 !! options
15894 parsoid
15895 !! input
15896 [[Foo|[Foobar]]
15897 [[Foo|foo|bar]]
15898 !! result
15899 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15900 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15901 !! end
15902
15903 !! test
15904 Links 4. ExtLinks: Escapes needed
15905 !! options
15906 parsoid
15907 !! input
15908 [http://google.com <nowiki>[google]</nowiki>]
15909 [http://google.com <nowiki>google]</nowiki>]
15910 !! result
15911 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15912 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15913 !! end
15914
15915 !! test
15916 Links 5. ExtLinks: No escapes needed
15917 !! options
15918 parsoid
15919 !! input
15920 [http://google.com [google]
15921 !! result
15922 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15923 !! end
15924
15925 #### --------------- Quotes ---------------
15926 #### 1. Quotes inside <b> and <i>
15927 #### 2. Link fragments separated by <i> and <b> tags
15928 #### 3. Link fragments inside <i> and <b>
15929 #### 4. No escaping needed
15930 #### --------------------------------------
15931 !! test
15932 1. Quotes inside <b> and <i>
15933 !! options
15934 parsoid=html2wt,wt2wt
15935 !! input
15936 ''<nowiki>'foo'</nowiki>''
15937 ''<nowiki>''foo''</nowiki>''
15938 ''<nowiki>'''foo'''</nowiki>''
15939 ''foo''<nowiki/>'s
15940 '''<nowiki>'foo'</nowiki>'''
15941 '''<nowiki>''foo''</nowiki>'''
15942 '''<nowiki>'''foo'''</nowiki>'''
15943 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15944 '''foo'''<nowiki/>'s
15945 '''foo''
15946 ''foo''<nowiki/>'
15947 '<nowiki/>''foo''<nowiki/>'
15948 ''''foo'''
15949 '''foo'''<nowiki/>'
15950 '<nowiki/>'''foo'''<nowiki/>'
15951 !! result
15952 <p><i>'foo'</i>
15953 <i>''foo''</i>
15954 <i>'''foo'''</i>
15955 <i>foo</i>'s
15956 <b>'foo'</b>
15957 <b>''foo''</b>
15958 <b>'''foo'''</b>
15959 <b>foo'<i>bar'</i>baz</b>
15960 <b>foo</b>'s
15961 '<i>foo</i>
15962 <i>foo</i>'
15963 '<i>foo</i>'
15964 '<b>foo</b>
15965 <b>foo</b>'
15966 '<b>foo</b>'</p>
15967 !! end
15968
15969 !! test
15970 2. Link fragments separated by <i> and <b> tags
15971 !! input
15972 [[''foo''<nowiki>hello]]</nowiki>
15973
15974 [['''foo'''<nowiki>hello]]</nowiki>
15975 !! result
15976 <p>[[<i>foo</i>hello]]
15977 </p><p>[[<b>foo</b>hello]]
15978 </p>
15979 !! end
15980
15981 !! test
15982 3. Link fragments inside <i> and <b>
15983 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15984 this is one of the shortcomings of this format)
15985 !! input
15986 ''[[foo''<nowiki>]]</nowiki>
15987
15988 '''[[foo'''<nowiki>]]</nowiki>
15989 !! result
15990 <p><i>[[foo</i>]]
15991 </p><p><b>[[foo</b>]]
15992 </p>
15993 !! end
15994
15995 !! test
15996 4. No escaping needed
15997 !! input
15998 '<span>''bar''</span>'
15999 '<span>'''bar'''</span>'
16000 !! result
16001 <p>'<span><i>bar</i></span>'
16002 '<span><b>bar</b></span>'
16003 </p>
16004 !! end
16005
16006 #### ----------- Paragraphs ---------------
16007 #### 1. No unnecessary escapes
16008 #### --------------------------------------
16009
16010 !! test
16011 1. No unnecessary escapes
16012 !! input
16013 bar <span><nowiki>[[foo]]</nowiki></span>
16014
16015 =bar <span><nowiki>[[foo]]</nowiki></span>
16016
16017 [[bar <span><nowiki>[[foo]]</nowiki></span>
16018
16019 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16020
16021 =bar <span>foo]]</span><nowiki>=</nowiki>
16022 !! result
16023 <p>bar <span>[[foo]]</span>
16024 </p><p>=bar <span>[[foo]]</span>
16025 </p><p>[[bar <span>[[foo]]</span>
16026 </p><p>]]bar <span>[[foo]]</span>
16027 </p><p>=bar <span>foo]]</span>=
16028 </p>
16029 !!end
16030
16031 #### ----------------------- PRE --------------------------
16032 #### 1. Leading whitespace in SOL context should be escaped
16033 #### ------------------------------------------------------
16034 !! test
16035 1. Leading whitespace in SOL context should be escaped
16036 !! options
16037 parsoid
16038 !! input
16039 <nowiki> </nowiki>a
16040
16041 <nowiki> </nowiki> a
16042
16043 <nowiki> </nowiki>a(tab)
16044
16045 <nowiki> </nowiki> a
16046 <!--cmt-->
16047 <nowiki> </nowiki> a
16048
16049 a
16050 <nowiki> </nowiki>b
16051
16052 a
16053 <nowiki> </nowiki>b
16054
16055 a
16056 <nowiki> </nowiki> b
16057 !! result
16058 <p> a</p>
16059 <p> a</p>
16060 <p> a(tab)</p>
16061 <p> a</p>
16062 <p><!--cmt--> a</p>
16063 <p>a
16064 b</p>
16065 <p>a
16066 b</p>
16067 <p>a
16068 b</p>
16069 !! end
16070
16071 #### --------------- HTML tags ---------------
16072 #### 1. a tags
16073 #### 2. other tags
16074 #### 3. multi-line html tag
16075 #### -----------------------------------------
16076 !! test
16077 1. a tags
16078 !! options
16079 parsoid
16080 !! input
16081 <a href="http://google.com">google</a>
16082 !! result
16083 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16084 !! end
16085
16086 !! test
16087 2. other tags
16088 !! input
16089 <nowiki><div>foo</div>
16090 <div style="color:red">foo</div></nowiki>
16091 !! result
16092 <p>&lt;div&gt;foo&lt;/div&gt;
16093 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16094 </p>
16095 !! end
16096
16097 !! test
16098 3. multi-line html tag
16099 !! input
16100 <nowiki><div
16101 >foo</div
16102 ></nowiki>
16103 !! result
16104 <p>&lt;div
16105 &gt;foo&lt;/div
16106 &gt;
16107 </p>
16108 !! end
16109
16110 !! test
16111 4. extension tags
16112 !! input
16113 <nowiki><ref>foo</ref></nowiki>
16114 !! result
16115 <p>&lt;ref&gt;foo&lt;/ref&gt;
16116 </p>
16117 !! end
16118
16119 #### --------------- Others ---------------
16120 !! test
16121 Escaping nowikis
16122 !! input
16123 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16124 !! result
16125 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16126 </p>
16127 !! end
16128
16129 ## The quote-char in the input is necessary for triggering the bug
16130 !! test
16131 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16132 !! options
16133 parsoid=wt2wt,html2wt
16134 !! input
16135 foo's bar :
16136 !! result
16137 <p>foo's bar :</p>
16138 !! end
16139
16140 !! test
16141
16142 Tag-like HTML structures are passed through as text
16143 !! input
16144 <x y>
16145
16146 <x.y>
16147
16148 <x-y>
16149
16150 1>2
16151
16152 x<y
16153
16154 a>b
16155
16156 1<d e>f
16157 !! result
16158 <p>&lt;x y&gt;
16159 </p><p>&lt;x.y&gt;
16160 </p><p>&lt;x-y&gt;
16161 </p><p>1&gt;2
16162 </p><p>x&lt;y
16163 </p><p>a&gt;b
16164 </p><p>1&lt;d e&gt;f
16165 </p>
16166 !! end
16167
16168
16169 # This was a bug in the PHP parser (see bug 17663 and its dups,
16170 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16171 !! test
16172 Tag names followed by punctuation should not be recognized as tags
16173 !! input
16174 <s.ome> text
16175 !! result
16176 <p>&lt;s.ome&gt; text
16177 </p>
16178 !! end
16179
16180 !! test
16181 HTML tag with necessary entities in attributes
16182 !! input
16183 <span title="&amp;amp;">foo</span>
16184 !! result
16185 <p><span title="&amp;amp;">foo</span>
16186 </p>
16187 !! end
16188
16189 !! test
16190 HTML tag with 'unnecessary' entity encoding in attributes
16191 !! input
16192 <span title="&amp;">foo</span>
16193 !! result
16194 <p><span title="&amp;">foo</span>
16195 </p>
16196 !! end
16197
16198 !! test
16199 HTML tag with broken attribute value quoting
16200 !! input
16201 <span title="Hello world>Foo</span>
16202 !! result
16203 <p><span>Foo</span>
16204 </p>
16205 !! end
16206
16207 !! test
16208 Parsoid-only: HTML tag with broken attribute value quoting
16209 !! options
16210 parsoid
16211 !! input
16212 <span title="Hello world>Foo</span>
16213 !! result
16214 <p><span title="Hello world">Foo</span>
16215 </p>
16216 !! end
16217
16218 !! test
16219 Table with broken attribute value quoting
16220 !! input
16221 {|
16222 | title="Hello world|Foo
16223 |}
16224 !! result
16225 <table>
16226 <tr>
16227 <td>Foo
16228 </td></tr></table>
16229
16230 !! end
16231
16232 !! test
16233 Table with broken attribute value quoting on consecutive lines
16234 !! input
16235 {|
16236 | title="Hello world|Foo
16237 | style="color:red|Bar
16238 |}
16239 !! result
16240 <table>
16241 <tr>
16242 <td>Foo
16243 </td>
16244 <td>Bar
16245 </td></tr></table>
16246
16247 !! end
16248
16249 !! test
16250 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16251 !! options
16252 parsoid
16253 !! input
16254 {|
16255 | title="Hello world|Foo
16256 | style="color:red|Bar
16257 |}
16258 !! result
16259 <table><tbody>
16260 <tr>
16261 <td title="Hello world">Foo
16262 </td><td style="color: red">Bar
16263 </td></tr></tbody></table>
16264
16265 !! end
16266
16267 !! test
16268 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16269 !! options
16270 parsoid
16271 !! input
16272 {{}}
16273 !! result
16274 {{}}
16275 !! end
16276
16277 !! test
16278 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16279 !! options
16280 parsoid
16281 !! input
16282 }}{{
16283 !! result
16284 }}{{
16285 !! end
16286
16287 !!test
16288 Accept empty td cell attribute
16289 !!input
16290 {|
16291 | align="center" | foo || |
16292 |}
16293 !!result
16294 <table>
16295 <tr>
16296 <td align="center"> foo </td>
16297 <td>
16298 </td></tr></table>
16299
16300 !!end
16301
16302 !!test
16303 Non-empty attributes in th-cells
16304 !!input
16305 {|
16306 ! Foo !! style="color: red" | Bar
16307 |}
16308 !!result
16309 <table>
16310 <tr>
16311 <th> Foo </th>
16312 <th style="color: red"> Bar
16313 </th></tr></table>
16314
16315 !!end
16316
16317 !!test
16318 Accept empty attributes in th-cells
16319 !!input
16320 {|
16321 !| foo !!| bar
16322 |}
16323 !!result
16324 <table>
16325 <tr>
16326 <th> foo </th>
16327 <th> bar
16328 </th></tr></table>
16329
16330 !!end
16331
16332 !!test
16333 Empty table rows go away
16334 !!input
16335 {|
16336 | Hello
16337 | there
16338 |- class="foo"
16339 |-
16340 |}
16341 !! result
16342 <table>
16343 <tr>
16344 <td> Hello
16345 </td>
16346 <td> there
16347 </td></tr>
16348
16349 </table>
16350
16351 !! end
16352
16353 ###
16354 ### Parsoid-centric tests for testing RTing of inter-element separators
16355 ### Edge cases not tested by existing parser tests and specific to
16356 ### Parsoid-specific serialization strategies.
16357 ###
16358
16359 !!test
16360 RT-ed inter-element separators should be valid separators
16361 !!input
16362 {|
16363 |- [[foo]]
16364 |}
16365 !!result
16366 <table>
16367
16368 </table>
16369
16370 !!end
16371
16372 !!test
16373 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16374 (Parsoid-only since PHP parser relies on Tidy for correct output)
16375 !!options
16376 parsoid
16377 !!input
16378 {|
16379 |<small>foo
16380 bar
16381 |}
16382
16383 {|
16384 |<small>foo<small>
16385 |}
16386 !!result
16387 !!end
16388
16389 !!test
16390 Empty TD followed by TD with tpl-generated attribute
16391 !!input
16392 {|
16393 |-
16394 |
16395 |{{echo|style='color:red'}}|foo
16396 |}
16397 !!result
16398 <table>
16399
16400 <tr>
16401 <td>
16402 </td>
16403 <td>foo
16404 </td></tr></table>
16405
16406 !!end
16407
16408 !!test
16409 Indented table with an empty td
16410 !!input
16411 {|
16412 |-
16413 |
16414 |foo
16415 |}
16416 !!result
16417 <table>
16418
16419 <tr>
16420 <td>
16421 </td>
16422 <td>foo
16423 </td></tr></table>
16424
16425 !!end
16426
16427 !!test
16428 Empty TR followed by a template-generated TR
16429 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16430 !!options
16431 parsoid=wt2html,wt2wt
16432 !!input
16433 {|
16434 |-
16435 {{echo|<tr><td>foo</td></tr>}}
16436 |}
16437 !!result
16438 <table>
16439 <tbody>
16440 <tr></tr>
16441 <tr typeof="mw:Transclusion">
16442 <td>foo</td></tr></tbody></table>
16443 !!end
16444
16445 ## PHP and parsoid output differ for this, and since this is primarily
16446 ## for testing Parsoid's serializer, marking this Parsoid only
16447 !!test
16448 Empty TR followed by mixed-ws-comment line should RT correctly
16449 !!options
16450 parsoid
16451 !!input
16452 {|
16453 |-
16454 <!--c-->
16455 |-
16456 <!--c--> <!--d-->
16457 |}
16458 !!result
16459 <table>
16460 <tbody>
16461 <tr>
16462 <td> <!--c--></td></tr>
16463 <tr>
16464 <td><!--c--> <!--d--></td></tr>
16465 </tbody></table>
16466
16467 !!end
16468
16469 !!test
16470 Multi-line image caption generated by templates with/without trailing newlines
16471 !!options
16472 parsoid
16473 !!input
16474 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16475 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16476 !!result
16477 <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>
16478 <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>
16479
16480 !!end
16481
16482 ## PHP emits broken html for this, and since this is primarily
16483 ## a Parsoid serializer test, marking this Parsoid only
16484 !!test
16485 Improperly nested inline or quotes tags with whitespace in between
16486 !!options
16487 parsoid
16488 !!input
16489 <span> <s>x</span> </s>
16490 ''' ''x''' ''
16491 !!result
16492 <p><span> <s>x</s></span><s> </s>
16493 <b> <i>x</i></b><i> </i>
16494 </p>
16495 !!end
16496
16497 !!test
16498 Encapsulate protected attributes from wt
16499 !!options
16500 parsoid
16501 !!input
16502 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16503 !!result
16504 <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>
16505 </body>
16506 !!end
16507
16508 # -----------------------------------------------------------------
16509 # The following section of tests are primarily to spec requirements
16510 # around serialization of new/edited content.
16511 #
16512 # All these tests are marked Parsoid html2wt and html2html only
16513 # ----------------------------------------------------------------
16514
16515 !! test
16516 Image: Modifying size of an image
16517 !! options
16518 parsoid=html2wt
16519 !! input
16520 [[Image:Wiki.png|230x230px]]
16521 !! result
16522 <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>
16523 !!end
16524
16525 !! test
16526 Image: New block level image should have \n before and after
16527 !! options
16528 parsoid=html2wt
16529 !! input
16530 123
16531 [[File:Wiki.png|right|thumb|150x150px]]
16532 456
16533 !! result
16534 <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>
16535 !!end
16536
16537 !! test
16538 Lists: Add space after bullets
16539 !! options
16540 parsoid=html2wt
16541 !! input
16542
16543 * foo
16544 * bar
16545 * <span> baz</span>
16546 !! result
16547 <ul>
16548 <li>foo</li>
16549 <li> bar</li>
16550 <li><span> baz</span></li>
16551 </ul>
16552 !! end
16553
16554 !! test
16555 Parsoid: Serialize positional parameters with = in them as named parameter
16556 !! options
16557 parsoid=html2wt
16558 !! input
16559 {{echo|1 = f=oo}}
16560 !! result
16561 <p about="#mwt1" typeof="mw:Transclusion"
16562 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16563 >foo</p>
16564 !! end
16565
16566 # -----------------------------------------------------------------
16567 # End of section for Parsoid-only html2wt tests for serialization
16568 # of new content
16569 # -----------------------------------------------------------------
16570
16571 TODO:
16572 more images
16573 more tables
16574 character entities
16575 and much more
16576 Try for 100% code coverage