Add a parserTest documenting interaction of tabs and preformatted text.
[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 !!article
143 Template:Bullet
144 !!text
145 * Bar
146 !!endarticle
147
148 ###
149 ### Basic tests
150 ###
151 !! test
152 Blank input
153 !! input
154 !! result
155 !! end
156
157
158 !! test
159 Simple paragraph
160 !! input
161 This is a simple paragraph.
162 !! result
163 <p>This is a simple paragraph.
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with extra newline spacing
169 !! input
170 foo
171
172 bar
173
174
175 baz
176
177
178
179 booz
180 !! result
181 <p>foo
182 </p><p>bar
183 </p><p><br />
184 baz
185 </p><p><br />
186 </p><p>booz
187 </p>
188 !! end
189
190 !! test
191 Paragraphs with newline spacing with comment lines in between
192 !! input
193 ----
194 a
195 <!--foo-->
196 b
197 ----
198 a
199 <!--foo--><!--More than 1 comment, still stripped-->
200 b
201 ----
202 a
203 <!--foo--> <!----> <!-- bar -->
204 b
205 ----
206 a
207 <!--foo-->
208
209 b
210 ----
211 a
212
213 <!--foo-->
214 b
215 ----
216 a
217 <!--foo-->
218
219
220 b
221 ----
222 a
223
224
225 <!--foo-->
226 b
227 ----
228 !! result
229 <hr />
230 <p>a
231 b
232 </p>
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 </p><p>b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p><br />
252 b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty white-space lines in between
265 !! input
266 ----
267 a
268
269 b
270 ----
271 a
272
273
274 b
275 ----
276 !! result
277 <hr />
278 <p>a
279 </p><p>b
280 </p>
281 <hr />
282 <p>a
283 </p><p><br />
284 b
285 </p>
286 <hr />
287
288 !! end
289
290 !! test
291 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
292 !! input
293 ----
294 a
295 <!--foo-->
296 b
297 ----
298 a
299 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306 b
307 ----
308 a
309
310 <!--foo-->
311 <!--bar-->
312
313 b
314 ----
315 !! result
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 </p><p>b
327 </p>
328 <hr />
329 <p>a
330 </p><p><br />
331 b
332 </p>
333 <hr />
334
335 !! end
336
337 !! test
338 Extra newlines: More paragraphs with indented comment
339 !! input
340 a
341
342 <!--boo-->
343
344 b
345 !!result
346 <p>a
347 </p><p><br />
348 b
349 </p>
350 !!end
351
352 !! test
353 Extra newlines followed by heading
354 !! input
355 a
356
357
358
359 =b=
360 [[a]]
361
362
363 =b=
364 !! result
365 <p>a
366 </p><p><br />
367 </p>
368 <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>
369 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
370 </p><p><br />
371 </p>
372 <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>
373
374 !! end
375
376 !! test
377 Extra newlines between heading and content are swallowed
378 !! input
379 =b=
380
381
382
383 [[a]]
384 !! result
385 <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>
386 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
387 </p>
388 !! end
389
390 !! test
391 Parsing an URL
392 !! input
393 http://fr.wikipedia.org/wiki/🍺
394 <!-- EasterEgg we love beer, better be able be able to link to it -->
395 !! result
396 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
397 </p>
398 !! end
399
400 !! test
401 Simple list
402 !! input
403 * Item 1
404 * Item 2
405 !! result
406 <ul><li> Item 1
407 </li><li> Item 2
408 </li></ul>
409
410 !! end
411
412 !! test
413 Italics and bold
414 !! input
415 * plain
416 * plain''italic''plain
417 * plain''italic''plain''italic''plain
418 * plain'''bold'''plain
419 * plain'''bold'''plain'''bold'''plain
420 * plain''italic''plain'''bold'''plain
421 * plain'''bold'''plain''italic''plain
422 * plain''italic'''bold-italic'''italic''plain
423 * plain'''bold''bold-italic''bold'''plain
424 * plain'''''bold-italic'''italic''plain
425 * plain'''''bold-italic''bold'''plain
426 * plain''italic'''bold-italic'''''plain
427 * plain'''bold''bold-italic'''''plain
428 * plain l'''italic''plain
429 * plain l''''bold''' plain
430 !! result
431 <ul><li> plain
432 </li><li> plain<i>italic</i>plain
433 </li><li> plain<i>italic</i>plain<i>italic</i>plain
434 </li><li> plain<b>bold</b>plain
435 </li><li> plain<b>bold</b>plain<b>bold</b>plain
436 </li><li> plain<i>italic</i>plain<b>bold</b>plain
437 </li><li> plain<b>bold</b>plain<i>italic</i>plain
438 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
439 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
440 </li><li> plain<i><b>bold-italic</b>italic</i>plain
441 </li><li> plain<b><i>bold-italic</i>bold</b>plain
442 </li><li> plain<i>italic<b>bold-italic</b></i>plain
443 </li><li> plain<b>bold<i>bold-italic</i></b>plain
444 </li><li> plain l'<i>italic</i>plain
445 </li><li> plain l'<b>bold</b> plain
446 </li></ul>
447
448 !! end
449
450 # this example taken from the simple/Moon article
451 !! test
452 Italics and possessives
453 !! input
454 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
455 !! result
456 <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
457 </p>
458 !! end
459
460 ###
461 ### 2-quote opening sequence tests
462 ###
463 !! test
464 Italics and bold: 2-quote opening sequence: (2,2)
465 !! input
466 ''foo''
467 !! result
468 <p><i>foo</i>
469 </p>
470 !!end
471
472
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,3)
475 !! input
476 ''foo'''
477 !! result
478 <p><i>foo'</i>
479 </p>
480 !!end
481
482
483 !! test
484 Italics and bold: 2-quote opening sequence: (2,4)
485 !! input
486 ''foo''''
487 !! result
488 <p><i>foo''</i>
489 </p>
490 !!end
491
492
493 !! test
494 Italics and bold: 2-quote opening sequence: (2,5) (php)
495 !! options
496 php
497 !! input
498 ''foo'''''
499 !! result
500 <p><i>foo</i>
501 </p>
502 !!end
503 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
506 !! options
507 parsoid
508 !! input
509 ''foo'''''
510 !! result
511 <p><i>foo</i><b></b>
512 </p>
513 !!end
514
515
516 ###
517 ### 3-quote opening sequence tests
518 ###
519
520 !! test
521 Italics and bold: 3-quote opening sequence: (3,2)
522 !! input
523 '''foo''
524 !! result
525 <p>'<i>foo</i>
526 </p>
527 !!end
528
529
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,3)
532 !! input
533 '''foo'''
534 !! result
535 <p><b>foo</b>
536 </p>
537 !!end
538
539
540 !! test
541 Italics and bold: 3-quote opening sequence: (3,4)
542 !! input
543 '''foo''''
544 !! result
545 <p><b>foo'</b>
546 </p>
547 !!end
548
549
550 !! test
551 Italics and bold: 3-quote opening sequence: (3,5) (php)
552 !! options
553 php
554 !! input
555 '''foo'''''
556 !! result
557 <p><b>foo</b>
558 </p>
559 !!end
560 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''foo'''''
567 !! result
568 <p><b>foo<i></i></b>
569 </p>
570 !!end
571
572
573 ###
574 ### 4-quote opening sequence tests
575 ###
576
577 !! test
578 Italics and bold: 4-quote opening sequence: (4,2)
579 !! input
580 ''''foo''
581 !! result
582 <p>''<i>foo</i>
583 </p>
584 !!end
585
586
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,3)
589 !! input
590 ''''foo'''
591 !! result
592 <p>'<b>foo</b>
593 </p>
594 !!end
595
596
597 !! test
598 Italics and bold: 4-quote opening sequence: (4,4)
599 !! input
600 ''''foo''''
601 !! result
602 <p>'<b>foo'</b>
603 </p>
604 !!end
605
606
607 !! test
608 Italics and bold: 4-quote opening sequence: (4,5) (php)
609 !! options
610 php
611 !! input
612 ''''foo'''''
613 !! result
614 <p>'<b>foo</b>
615 </p>
616 !!end
617 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
620 !! options
621 parsoid
622 !! input
623 ''''foo'''''
624 !! result
625 <p>'<b>foo<i></i></b>
626 </p>
627 !!end
628
629
630 ###
631 ### 5-quote opening sequence tests
632 ###
633
634 !! test
635 Italics and bold: 5-quote opening sequence: (5,2) (php)
636 !! options
637 php
638 !! input
639 '''''foo''
640 !! result
641 <p><b><i>foo</i></b>
642 </p>
643 !!end
644 # Parsoid reverses the nesting order, compared to the PHP parser
645 !! test
646 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
647 !! options
648 parsoid
649 !! input
650 '''''foo''
651 !! result
652 <p><i><b>foo</b></i>
653 </p>
654 !!end
655
656
657 !! test
658 Italics and bold: 5-quote opening sequence: (5,3)
659 !! input
660 '''''foo'''
661 !! result
662 <p><i><b>foo</b></i>
663 </p>
664 !!end
665
666
667 !! test
668 Italics and bold: 5-quote opening sequence: (5,4)
669 !! input
670 '''''foo''''
671 !! result
672 <p><i><b>foo'</b></i>
673 </p>
674 !!end
675
676
677 !! test
678 Italics and bold: 5-quote opening sequence: (5,5)
679 !! input
680 '''''foo'''''
681 !! result
682 <p><i><b>foo</b></i>
683 </p>
684 !!end
685
686 ###
687 ### multiple quote sequences in a line
688 ###
689 !! test
690 Italics and bold: multiple quote sequences: (2,4,2)
691 !! input
692 ''foo''''bar''
693 !! result
694 <p><i>foo'<b>bar</b></i>
695 </p>
696 !!end
697
698
699 !! test
700 Italics and bold: multiple quote sequences: (2,4,3)
701 !! input
702 ''foo''''bar'''
703 !! result
704 <p><i>foo'<b>bar</b></i>
705 </p>
706 !!end
707
708
709 !! test
710 Italics and bold: multiple quote sequences: (2,4,4)
711 !! input
712 ''foo''''bar''''
713 !! result
714 <p><i>foo'<b>bar'</b></i>
715 </p>
716 !!end
717
718
719 !! test
720 Italics and bold: multiple quote sequences: (3,4,2) (php)
721 !! options
722 php
723 !! input
724 '''foo''''bar''
725 !! result
726 <p><b>foo'</b>bar
727 </p>
728 !!end
729 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
730 !! test
731 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
732 !! options
733 parsoid
734 !! input
735 '''foo''''bar''
736 !! result
737 <p><b>foo'</b>bar<i></i>
738 </p>
739 !!end
740
741
742 !! test
743 Italics and bold: multiple quote sequences: (3,4,3) (php)
744 !! options
745 php
746 !! input
747 '''foo''''bar'''
748 !! result
749 <p><b>foo'</b>bar
750 </p>
751 !!end
752 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
753 !! test
754 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
755 !! options
756 parsoid
757 !! input
758 '''foo''''bar'''
759 !! result
760 <p><b>foo'</b>bar<b></b>
761 </p>
762 !!end
763
764 ###
765 ### other quote tests
766 ###
767 !! test
768 Italics and bold: other quote tests: (2,3,5)
769 !! input
770 ''this is about '''foo's family'''''
771 !! result
772 <p><i>this is about <b>foo's family</b></i>
773 </p>
774 !!end
775
776
777 !! test
778 Italics and bold: other quote tests: (2,(3,3),2)
779 !! input
780 ''this is about '''foo's''' family''
781 !! result
782 <p><i>this is about <b>foo's</b> family</i>
783 </p>
784 !!end
785
786
787 !! test
788 Italics and bold: other quote tests: (3,2,3,2)
789 !! input
790 '''this is about ''foo'''s family''
791 !! result
792 <p><b>this is about <i>foo</i></b><i>s family</i>
793 </p>
794 !!end
795
796
797 # The Parsoid team believes the PHP parser's output on this test is wrong.
798 # It only checks for convert-to-bold-on-single-character-word when the word
799 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
800 # This means that the bold token in position 2 (0-indexed) gets converted by
801 # parsoid, but doesn't get changed by the PHP parser.
802 !! test
803 Italics and bold: other quote tests: (3,2,3,3) (php)
804 !! options
805 php
806 !! input
807 '''this is about ''foo'''s family'''
808 !! result
809 <p>'<i>this is about </i>foo<b>s family</b>
810 </p>
811 !!end
812 # This is the output the Parsoid team believes to be correct.
813 !! test
814 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
815 !! options
816 parsoid
817 !! input
818 '''this is about ''foo'''s family'''
819 !! result
820 <p><b>this is about <i>foo'</i>s family</b>
821 </p>
822 !!end
823
824
825 !! test
826 Italics and bold: other quote tests: (3,(2,2),3)
827 !! input
828 '''this is about ''foo's'' family'''
829 !! result
830 <p><b>this is about <i>foo's</i> family</b>
831 </p>
832 !!end
833
834
835 !! test
836 Italicized possessive
837 !! input
838 The ''[[Main Page]]'''s talk page.
839 !! result
840 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
841 </p>
842 !! end
843
844 !! test
845 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
846 (Requires tidy for PHP parser output to be fixed up)
847 !! options
848 parsoid=wt2html,wt2wt
849 !! input
850 {|
851 !''a!!''b
852 |''a||''b
853 |}
854 !! result
855 <table>
856 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
857 <td><i>a</i></td><td><i>b</i></td></tr>
858 </tbody></table>
859 !! end
860
861 ###
862 ### Non-html5 tags
863 ###
864
865 !! test
866 Non-html5 tags should be accepted
867 !! input
868 <center>''foo''</center>
869 <big>''foo''</big>
870 <font>''foo''</font>
871 <strike>''foo''</strike>
872 <tt>''foo''</tt>
873 !! result
874 <center><i>foo</i></center>
875 <p><big><i>foo</i></big>
876 <font><i>foo</i></font>
877 <strike><i>foo</i></strike>
878 <tt><i>foo</i></tt>
879 </p>
880 !! end
881
882 !! test
883 <wbr> is valid wikitext (bug 52468)
884 !! input
885 <wbr>
886 !! result
887 <p><wbr />
888 </p>
889 !! end
890
891 # <strike> is HTML4, <s> is HTML4/5.
892 !! test
893 <s> or <strike> for strikethrough
894 !! input
895 <strike>strike</strike>
896
897 <s>s</s>
898 !! result
899 <p><strike>strike</strike>
900 </p><p><s>s</s>
901 </p>
902 !! end
903
904 !! test
905 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
906 !! input
907 <b→> doesn't work! </b>
908
909 <bä> doesn't work! </b>
910
911 <boo> works fine </b>
912
913 <s.foo>foo</s>
914
915 <s.foo>s.foo</s.foo>
916
917 <sub-ID#1>
918 !! result
919 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
920 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
921 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
922 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
923 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
924 </p><p>&lt;sub-ID#1&gt;
925 </p>
926 !! end
927
928 ###
929 ### Special characters
930 ###
931
932 !! test
933 Bare pipe character (bug 52363)
934 !! input
935 |
936 !! result
937 <p>|
938 </p>
939 !! end
940
941 !! test
942 Bare pipe character from a template (bug 52363)
943 !! input
944 {{pipe}}
945 !! result
946 <p>|
947 </p>
948 !! end
949
950 ###
951 ### <nowiki> test cases
952 ###
953
954 !! test
955 <nowiki> unordered list
956 !! input
957 <nowiki>* This is not an unordered list item.</nowiki>
958 !! result
959 <p>* This is not an unordered list item.
960 </p>
961 !! end
962
963 !! test
964 <nowiki> spacing
965 !! input
966 <nowiki>Lorem ipsum dolor
967
968 sed abit.
969 sed nullum.
970
971 :and a colon
972 </nowiki>
973 !! result
974 <p>Lorem ipsum dolor
975
976 sed abit.
977 sed nullum.
978
979 :and a colon
980
981 </p>
982 !! end
983
984 !! test
985 nowiki 3
986 !! input
987 :There is not nowiki.
988 :There is <nowiki>nowiki</nowiki>.
989
990 #There is not nowiki.
991 #There is <nowiki>nowiki</nowiki>.
992
993 *There is not nowiki.
994 *There is <nowiki>nowiki</nowiki>.
995 !! result
996 <dl><dd>There is not nowiki.
997 </dd><dd>There is nowiki.
998 </dd></dl>
999 <ol><li>There is not nowiki.
1000 </li><li>There is nowiki.
1001 </li></ol>
1002 <ul><li>There is not nowiki.
1003 </li><li>There is nowiki.
1004 </li></ul>
1005
1006 !! end
1007
1008 !! test
1009 Entities inside <nowiki>
1010 !! input
1011 <nowiki>&lt;</nowiki>
1012 !! result
1013 <p>&lt;
1014 </p>
1015 !! end
1016
1017 !! test
1018 Entities inside template parameters
1019 !! options
1020 parsoid
1021 !! input
1022 {{echo|&ndash;}}
1023 !! result
1024 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1025 </p>
1026 !! end
1027
1028 ###
1029 ### Comments
1030 ###
1031 !! test
1032 Comments and Indent-Pre
1033 !! input
1034 <!-- comment 1 --> asdf
1035
1036 <!-- comment 1 --> asdf
1037 <!-- comment 2 -->
1038
1039 <!-- comment 1 --> asdf
1040 <!-- comment 2 -->xyz
1041
1042 <!-- comment 1 --> asdf
1043 <!-- comment 2 --> xyz
1044 !! result
1045 <pre>asdf
1046 </pre>
1047 <pre>asdf
1048 </pre>
1049 <pre>asdf
1050 </pre>
1051 <p>xyz
1052 </p>
1053 <pre>asdf
1054 xyz
1055 </pre>
1056 !! end
1057
1058 !! test
1059 Comment test 2a
1060 !! input
1061 asdf
1062 <!-- comment 1 -->
1063 jkl
1064 !! result
1065 <p>asdf
1066 jkl
1067 </p>
1068 !! end
1069
1070 !! test
1071 Comment test 2b
1072 !! input
1073 asdf
1074 <!-- comment 1 -->
1075
1076 jkl
1077 !! result
1078 <p>asdf
1079 </p><p>jkl
1080 </p>
1081 !! end
1082
1083 !! test
1084 Comment test 3
1085 !! input
1086 asdf
1087 <!-- comment 1 -->
1088 <!-- comment 2 -->
1089 jkl
1090 !! result
1091 <p>asdf
1092 jkl
1093 </p>
1094 !! end
1095
1096 !! test
1097 Comment test 4
1098 !! input
1099 asdf<!-- comment 1 -->jkl
1100 !! result
1101 <p>asdfjkl
1102 </p>
1103 !! end
1104
1105 !! test
1106 Comment spacing
1107 !! input
1108 a
1109 <!-- foo --> b <!-- bar -->
1110 c
1111 !! result
1112 <p>a
1113 </p>
1114 <pre> b
1115 </pre>
1116 <p>c
1117 </p>
1118 !! end
1119
1120 !! test
1121 Comment whitespace
1122 !! input
1123 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1124 !! result
1125
1126 !! end
1127
1128 !! test
1129 Comment semantics and delimiters
1130 !! input
1131 <!-- --><!----><!-----><!------>
1132 !! result
1133
1134 !! end
1135
1136 !! test
1137 Comment semantics and delimiters, redux
1138 !! input
1139 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1140 -- foo -- funky huh? ... -->
1141 !! result
1142
1143 !! end
1144
1145 !! test
1146 Comment semantics and delimiters: directors cut
1147 !! input
1148 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1149 everything starting with < followed by !-- until the first -- and > we see,
1150 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1151 -->-->
1152 !! result
1153 <p>--&gt;
1154 </p>
1155 !! end
1156
1157 !! test
1158 Comment semantics: nesting
1159 !! input
1160 <!--<!-- no, we're not going to do anything fancy here -->-->
1161 !! result
1162 <p>--&gt;
1163 </p>
1164 !! end
1165
1166 !! test
1167 Comment semantics: unclosed comment at end
1168 !! input
1169 <!--This comment will run out to the end of the document
1170 !! result
1171
1172 !! end
1173
1174 !! test
1175 Comment in template title
1176 !! input
1177 {{f<!---->oo}}
1178 !! result
1179 <p>FOO
1180 </p>
1181 !! end
1182
1183 !! test
1184 Comment on its own line post-expand
1185 !! input
1186 a
1187 {{blank}}<!---->
1188 b
1189 !! result
1190 <p>a
1191 </p><p>b
1192 </p>
1193 !! end
1194
1195 !! test
1196 Comment on its own line post-expand with non-significant whitespace
1197 !! input
1198 a
1199 {{blank}} <!---->
1200 b
1201 !! result
1202 <p>a
1203 </p><p>b
1204 </p>
1205 !! end
1206
1207 ###
1208 ### paragraph wrapping tests
1209 ###
1210 !! test
1211 No block tags
1212 !! input
1213 a
1214
1215 b
1216 !! result
1217 <p>a
1218 </p><p>b
1219 </p>
1220 !! end
1221 !! test
1222 Block tag on one line
1223 !! input
1224 a <div>foo</div>
1225
1226 b
1227 !! result
1228 a <div>foo</div>
1229 <p>b
1230 </p>
1231 !! end
1232
1233 !! test
1234 Block tag on both lines
1235 !! input
1236 a <div>foo</div>
1237
1238 b <div>foo</div>
1239 !! result
1240 a <div>foo</div>
1241 b <div>foo</div>
1242
1243 !! end
1244
1245 !! test
1246 Multiple lines without block tags
1247 !! input
1248 <div>foo</div> a
1249 b
1250 c
1251 d<!--foo--> e
1252 x <div>foo</div> z
1253 !! result
1254 <div>foo</div> a
1255 <p>b
1256 c
1257 d e
1258 </p>
1259 x <div>foo</div> z
1260
1261 !! end
1262
1263 !! test
1264 Empty lines between lines with block tags
1265 !! input
1266 <div></div>
1267
1268
1269 <div></div>a
1270
1271 b
1272 <div>a</div>b
1273
1274 <div>b</div>d
1275
1276
1277 <div>e</div>
1278 !! result
1279 <div></div>
1280 <p><br />
1281 </p>
1282 <div></div>a
1283 <p>b
1284 </p>
1285 <div>a</div>b
1286 <div>b</div>d
1287 <p><br />
1288 </p>
1289 <div>e</div>
1290
1291 !! end
1292
1293 ###
1294 ### Preformatted text
1295 ###
1296 !! test
1297 Preformatted text
1298 !! input
1299 This is some
1300 Preformatted text
1301 With ''italic''
1302 And '''bold'''
1303 And a [[Main Page|link]]
1304 !! result
1305 <pre>This is some
1306 Preformatted text
1307 With <i>italic</i>
1308 And <b>bold</b>
1309 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1310 </pre>
1311 !! end
1312
1313 !! test
1314 Tabs don't trigger preformatted text
1315 !! input
1316 This is not
1317 preformatted text.
1318 This is preformatted text.
1319 So is this.
1320 !! result
1321 <p> This is not
1322 preformatted text.
1323 </p>
1324 <pre>This is preformatted text.
1325 So is this.
1326 </pre>
1327 !! end
1328
1329 !! test
1330 Ident preformatting with inline content
1331 !! input
1332 a
1333 ''b''
1334 !! result
1335 <pre>a
1336 <i>b</i>
1337 </pre>
1338 !! end
1339
1340 !! test
1341 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1342 !! input
1343 <pre><nowiki>
1344 <b>
1345 <cite>
1346 <em>
1347 </nowiki></pre>
1348 !! result
1349 <pre>
1350 &lt;b&gt;
1351 &lt;cite&gt;
1352 &lt;em&gt;
1353 </pre>
1354
1355 !! end
1356
1357 !! test
1358 Regression with preformatted in <center>
1359 !! input
1360 <center>
1361 Blah
1362 </center>
1363 !! result
1364 <center>
1365 <pre>Blah
1366 </pre>
1367 </center>
1368
1369 !! end
1370
1371 # Expected output in the following test is not really expected (there should be
1372 # <pre> in the output) -- it's only testing for well-formedness.
1373 !! test
1374 Bug 6200: Preformatted in <blockquote>
1375 !! input
1376 <blockquote>
1377 Blah
1378 </blockquote>
1379 !! result
1380 <blockquote>
1381 Blah
1382 </blockquote>
1383
1384 !! end
1385
1386 !! test
1387 <pre> with attributes (bug 3202)
1388 !! input
1389 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1390 !! result
1391 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1392
1393 !! end
1394
1395 !! test
1396 <pre> with width attribute (bug 3202)
1397 !! input
1398 <pre width="8">Narrow screen goodies</pre>
1399 !! result
1400 <pre width="8">Narrow screen goodies</pre>
1401
1402 !! end
1403
1404 !! test
1405 <pre> with forbidden attribute (bug 3202)
1406 !! input
1407 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1408 !! result
1409 <pre width="8">Narrow screen goodies</pre>
1410
1411 !! end
1412
1413 !! test
1414 Entities inside <pre>
1415 !! input
1416 <pre>&lt;</pre>
1417 !! result
1418 <pre>&lt;</pre>
1419
1420 !! end
1421
1422 !! test
1423 <pre> with forbidden attribute values (bug 3202)
1424 !! input
1425 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1426 !! result
1427 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1428
1429 !! end
1430
1431 !! test
1432 <nowiki> inside <pre> (bug 13238)
1433 !! input
1434 <pre>
1435 <nowiki>
1436 </pre>
1437 <pre>
1438 <nowiki></nowiki>
1439 </pre>
1440 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1441 !! result
1442 <pre>
1443 &lt;nowiki&gt;
1444 </pre>
1445 <pre>
1446
1447 </pre>
1448 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1449
1450 !! end
1451
1452 !! test
1453 <nowiki> and <pre> preference (first one wins)
1454 !! input
1455 <pre>
1456 <nowiki>
1457 </pre>
1458 </nowiki>
1459 </pre>
1460
1461 <nowiki>
1462 <pre>
1463 <nowiki>
1464 </pre>
1465 </nowiki>
1466 </pre>
1467
1468 !! result
1469 <pre>
1470 &lt;nowiki&gt;
1471 </pre>
1472 <p>&lt;/nowiki&gt;
1473 &lt;/pre&gt;
1474 </p><p>
1475 &lt;pre&gt;
1476 &lt;nowiki&gt;
1477 &lt;/pre&gt;
1478
1479 &lt;/pre&gt;
1480 </p>
1481 !! end
1482
1483 !! test
1484 </pre> inside nowiki
1485 !! input
1486 <nowiki></pre></nowiki>
1487 !! result
1488 <p>&lt;/pre&gt;
1489 </p>
1490 !! end
1491
1492 !!test
1493 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1494 !!input
1495 {{echo|}}
1496 !!result
1497
1498 !!end
1499
1500 !!test
1501 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1502 !!input
1503 {{echo|
1504 foo}}
1505 !!result
1506 <p>foo
1507 </p>
1508 !!end
1509
1510 !! test
1511 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1512 !! input
1513 {{echo|a
1514 b}}
1515 !!result
1516 <pre>a
1517 </pre>
1518 <p>b
1519 </p>
1520 !!end
1521
1522 !! test
1523 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1524 !! input
1525 {{echo|a
1526 b
1527 c
1528 d
1529 e
1530 }}
1531 !!result
1532 <pre>a
1533 </pre>
1534 <p>b
1535 c
1536 </p>
1537 <pre>d
1538 </pre>
1539 <p>e
1540 </p>
1541 !!end
1542
1543 !!test
1544 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1545 !!input
1546 {{echo| foo}}
1547
1548 {{echo| foo}}{{echo| bar}}
1549
1550 {{echo| foo}}
1551 {{echo| bar}}
1552
1553 {{echo|<!--cmt--> foo}}
1554
1555 <!--cmt-->{{echo| foo}}
1556
1557 {{echo|{{echo| }}bar}}
1558 !!result
1559 <pre>foo
1560 </pre>
1561 <pre>foo bar
1562 </pre>
1563 <pre>foo
1564 bar
1565 </pre>
1566 <pre>foo
1567 </pre>
1568 <pre>foo
1569 </pre>
1570 <pre>bar
1571 </pre>
1572 !!end
1573
1574 !! test
1575 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1576 !! input
1577 {{echo| }}a
1578
1579 {{echo|
1580 }}a
1581
1582 {{echo|
1583 b}}
1584
1585 {{echo|a
1586 }}b
1587
1588 {{echo|a
1589 }} b
1590 !!result
1591 <pre>a
1592 </pre>
1593 <p><br />
1594 </p>
1595 <pre>a
1596 </pre>
1597 <p><br />
1598 </p>
1599 <pre>b
1600 </pre>
1601 <p>a
1602 </p>
1603 <pre>b
1604 </pre>
1605 <p>a
1606 </p>
1607 <pre>b
1608 </pre>
1609 !!end
1610
1611 !! test
1612 Templates: Single-line variant of parameter whitespace stripping test
1613 !! input
1614 {{echo| a}}
1615
1616 {{echo|1= a}}
1617
1618 {{echo|{{echo| a}}}}
1619
1620 {{echo|1={{echo| a}}}}
1621 !! result
1622 <pre>a
1623 </pre>
1624 <p>a
1625 </p>
1626 <pre>a
1627 </pre>
1628 <p>a
1629 </p>
1630 !! end
1631
1632 !! test
1633 Templates: Strip whitespace from named parameters, but not positional ones
1634 !! input
1635 {{echo|
1636 foo}}
1637
1638 {{echo|
1639 * foo}}
1640
1641 {{echo| 1 =
1642 foo}}
1643
1644 {{echo| 1 =
1645 * foo}}
1646 !! result
1647 <pre>foo
1648 </pre>
1649 <p><br />
1650 </p>
1651 <ul><li> foo
1652 </li></ul>
1653 <p>foo
1654 </p>
1655 <ul><li> foo
1656 </li></ul>
1657
1658 !! end
1659
1660 !! test
1661 Templates: Dont strip whitespace from whitespace/comment-only arguments
1662 !! input
1663 {{echo| }}
1664 {{echo|<!--cmt-->}}
1665 {{echo| <!--cmt--> }}
1666 !! result
1667 <p><br />
1668 </p>
1669 !! end
1670
1671 !! test
1672 Templates: Parsoid parameter escaping test 1
1673 !! options
1674 parsoid
1675 !! input
1676 {{echo|[foo]|{{echo|[bar]}}}}
1677 !! result
1678 <p about="#mwt1" typeof="mw:Transclusion"
1679 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>
1680 !! end
1681
1682 !! test
1683 Parsoid: Pipes in external links in template parameter
1684 !! options
1685 parsoid
1686 !! input
1687 {{echo|[{{echo|http://example.com}} link]}}
1688 !! result
1689 <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>
1690 !! end
1691
1692 !! test
1693 Parsoid: pipe in transclusion parameter
1694 !! options
1695 parsoid
1696 !! input
1697 {{echo|http://foo.com/a&#124;b}}
1698 !! result
1699 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1700 typeof="mw:Transclusion"
1701 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>
1702 !! end
1703
1704 !! test
1705 Parsoid: Pipe in external link target and content in template parameter
1706 !! options
1707 parsoid=html2wt,wt2wt
1708 !! input
1709 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1710 !! result
1711 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1712 typeof="mw:Transclusion"
1713 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1714 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1715 !! end
1716
1717 !! test
1718 Templates: Dont escape already nowiki-escaped text in template parameters
1719 !! options
1720 parsoid=html2wt,wt2wt
1721 !! input
1722 {{echo|foo<nowiki>|</nowiki>bar}}
1723 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1724 {{echo|<nowiki></nowiki>}}
1725 !! result
1726 <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>
1727 <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>
1728 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1729 </p>
1730 !! end
1731
1732 ###
1733 ### Parsoid-centric tests for testing RT edge cases for pre
1734 ###
1735
1736 !!test
1737 1a. Indent-Pre and Comments
1738 !!input
1739 a
1740 <!--a-->
1741 c
1742 !!result
1743 <pre>a
1744 </pre>
1745 <p>c
1746 </p>
1747 !!end
1748
1749 !!test
1750 1b. Indent-Pre and Comments
1751 !!input
1752 a
1753 <!--a-->
1754 c
1755 !!result
1756 <pre>a
1757 </pre>
1758 <p>c
1759 </p>
1760 !!end
1761
1762 !!test
1763 1c. Indent-Pre and Comments
1764 !!input
1765 <!--a--> a
1766
1767 <!--a--> a
1768 !!result
1769 <pre> a
1770 </pre>
1771 <pre> a
1772 </pre>
1773 !!end
1774
1775 !!test
1776 1d. Indent-Pre and Comments
1777 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1778 !!input
1779 <!--a--> a
1780
1781 <!--b-->b
1782 !!result
1783 <pre>a
1784 </pre>
1785 <pre>b
1786 </pre>
1787 !!end
1788
1789 !!test
1790 2a. Indent-Pre and tables
1791 !!input
1792 {|
1793 |-
1794 !h1!!h2
1795 |foo||bar
1796 |}
1797 !!result
1798 <table>
1799
1800 <tr>
1801 <th>h1</th>
1802 <th>h2
1803 </th>
1804 <td>foo</td>
1805 <td>bar
1806 </td></tr></table>
1807
1808 !!end
1809
1810 !!test
1811 2b. Indent-Pre and tables
1812 !!input
1813 {|
1814 |-
1815 |foo
1816 |}
1817 !!result
1818 <table>
1819
1820 <tr>
1821 <td>foo
1822 </td></tr></table>
1823
1824 !!end
1825
1826 !!test
1827 2c. Indent-Pre and tables (bug 42252)
1828 !!input
1829 {|
1830 |+ foo
1831 ! | bar
1832 |}
1833 !!result
1834 <table>
1835 <caption> foo
1836 </caption>
1837 <tr>
1838 <th> bar
1839 </th></tr></table>
1840
1841 !!end
1842
1843 !!test
1844 3a. Indent-Pre and block tags (single-line html)
1845 !!input
1846 <p> foo </p>
1847 <div> foo </div>
1848 <span> foo </span>
1849 !!result
1850 <p> foo </p>
1851 <div> foo </div>
1852 <pre><span> foo </span>
1853 </pre>
1854 !!end
1855
1856 !!test
1857 3b. Indent-Pre and block tags (pre-content on separate line)
1858 !!input
1859 <p>
1860 foo
1861 </p>
1862
1863 <div>
1864 foo
1865 </div>
1866
1867 <center>
1868 foo
1869 </center>
1870
1871 <blockquote>
1872 foo
1873 </blockquote>
1874
1875 <table><tr><td>
1876 foo
1877 </td></tr></table>
1878
1879 <ul><li>
1880 foo
1881 </li></ul>
1882
1883 !!result
1884 <p>
1885 foo
1886 </p>
1887 <div>
1888 <pre>foo
1889 </pre>
1890 </div>
1891 <center>
1892 <pre>foo
1893 </pre>
1894 </center>
1895 <blockquote>
1896 foo
1897 </blockquote>
1898 <table><tr><td>
1899 <pre>foo
1900 </pre>
1901 </td></tr></table>
1902 <ul><li>
1903 foo
1904 </li></ul>
1905
1906 !!end
1907
1908 !!test
1909 4. Multiple spaces at start-of-line
1910 !!input
1911 <p> foo </p>
1912 foo
1913 {|
1914 |foo
1915 |}
1916 !!result
1917 <p> foo </p>
1918 <pre> foo
1919 </pre>
1920 <table>
1921 <tr>
1922 <td>foo
1923 </td></tr></table>
1924
1925 !!end
1926
1927 !! test
1928 5. White-space in indent-pre
1929 NOTE: the white-space char on 2nd line is significant
1930 !! input
1931 a<br/>
1932
1933 b
1934 !! result
1935 <pre>a<br />
1936
1937 b
1938 </pre>
1939 !! end
1940
1941 !! test
1942 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1943 !! input
1944 a
1945
1946 <!-- continue -->
1947 b
1948
1949 c
1950
1951 d
1952 !! result
1953 <pre>a
1954
1955 b
1956 </pre>
1957 <pre>c
1958
1959 </pre>
1960 <p>d
1961 </p>
1962 !! end
1963
1964 !! test
1965 7a. Indent-pre and category links
1966 !! options
1967 parsoid=wt2html,wt2wt
1968 !! input
1969 [[Category:foo]] <!-- No pre-wrapping -->
1970 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
1971 !! result
1972 <span typeof="mw:Transclusion"> </span>
1973 !! end
1974
1975 !! test
1976 7b. Indent-pre and category links
1977 !! options
1978 parsoid=wt2html,wt2wt
1979 !! input
1980 [[Category:foo]] a
1981 [[Category:foo]] {{echo|b}}
1982 !! result
1983 <pre> a <span typeof="mw:Transclusion">b</span>
1984 </pre>
1985 !! end
1986
1987 ###
1988 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1989 ###
1990
1991 !!test
1992 HTML-pre: 1. embedded newlines
1993 !!input
1994 <pre>foo</pre>
1995
1996 <pre>
1997 foo
1998 </pre>
1999
2000 <pre>
2001
2002 foo
2003 </pre>
2004
2005 <pre>
2006
2007
2008 foo
2009 </pre>
2010 !!result
2011 <pre>foo</pre>
2012 <pre>
2013 foo
2014 </pre>
2015 <pre>
2016
2017 foo
2018 </pre>
2019 <pre>
2020
2021
2022 foo
2023 </pre>
2024
2025 !!end
2026
2027 !!test
2028 HTML-pre: 2: indented text
2029 !!input
2030 <pre>
2031 foo
2032 </pre>
2033 !!result
2034 <pre>
2035 foo
2036 </pre>
2037
2038 !!end
2039
2040 !!test
2041 HTML-pre: 3: other wikitext
2042 !!input
2043 <pre>
2044 * foo
2045 # bar
2046 = no-h =
2047 '' no-italic ''
2048 [[ NoLink ]]
2049 </pre>
2050 !!result
2051 <pre>
2052 * foo
2053 # bar
2054 = no-h =
2055 '' no-italic ''
2056 [[ NoLink ]]
2057 </pre>
2058
2059 !!end
2060
2061 ###
2062 ### Definition lists
2063 ###
2064 !! test
2065 Simple definition
2066 !! input
2067 ; name : Definition
2068 !! result
2069 <dl><dt> name&#160;</dt><dd> Definition
2070 </dd></dl>
2071
2072 !! end
2073
2074 !! test
2075 Definition list for indentation only
2076 !! input
2077 : Indented text
2078 !! result
2079 <dl><dd> Indented text
2080 </dd></dl>
2081
2082 !! end
2083
2084 !! test
2085 Definition list with no space
2086 !! input
2087 ;name:Definition
2088 !! result
2089 <dl><dt>name</dt><dd>Definition
2090 </dd></dl>
2091
2092 !!end
2093
2094 !! test
2095 Definition list with URL link
2096 !! input
2097 ; http://example.com/ : definition
2098 !! result
2099 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2100 </dd></dl>
2101
2102 !! end
2103
2104 !! test
2105 Definition list with bracketed URL link
2106 !! input
2107 ;[http://www.example.com/ Example]:Something about it
2108 !! result
2109 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2110 </dd></dl>
2111
2112 !! end
2113
2114 !! test
2115 Definition list with wikilink containing colon
2116 !! input
2117 ; [[Help:FAQ]]: The least-read page on Wikipedia
2118 !! result
2119 <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
2120 </dd></dl>
2121
2122 !! end
2123
2124 # At Brion's and JeLuF's insistence... :)
2125 !! test
2126 Definition list with news link containing colon
2127 !! input
2128 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2129 !! result
2130 <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!
2131 </dd></dl>
2132
2133 !! end
2134
2135 !! test
2136 Malformed definition list with colon
2137 !! input
2138 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2139 !! result
2140 <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
2141 </dt></dl>
2142
2143 !! end
2144
2145 !! test
2146 Definition lists: colon in external link text
2147 !! input
2148 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2149 !! result
2150 <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
2151 </dd></dl>
2152
2153 !! end
2154
2155 !! test
2156 Definition lists: colon in HTML attribute
2157 !! input
2158 ;<b style="display: inline">bold</b>
2159 !! result
2160 <dl><dt><b style="display: inline">bold</b>
2161 </dt></dl>
2162
2163 !! end
2164
2165 !! test
2166 Definition lists: self-closed tag
2167 !! input
2168 ;one<br/>two : two-line fun
2169 !! result
2170 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2171 </dd></dl>
2172
2173 !! end
2174
2175 !! test
2176 Bug 11748: Literal closing tags
2177 !! input
2178 <dl>
2179 <dt>test 1</dt>
2180 <dd>test test test test test</dd>
2181 <dt>test 2</dt>
2182 <dd>test test test test test</dd>
2183 </dl>
2184 !! result
2185 <dl>
2186 <dt>test 1</dt>
2187 <dd>test test test test test</dd>
2188 <dt>test 2</dt>
2189 <dd>test test test test test</dd>
2190 </dl>
2191
2192 !! end
2193
2194 !! test
2195 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2196 !! input
2197 <ul><li>
2198 ; term : description
2199 * unordered
2200 </li>
2201 </ul>
2202 !! result
2203 <ul><li>
2204 <dl><dt> term&#160;</dt><dd> description
2205 </dd></dl>
2206 <ul><li> unordered
2207 </li></ul>
2208 </li>
2209 </ul>
2210
2211 !! end
2212
2213 !! test
2214
2215 Definition list with empty definition and following paragraph
2216 !! input
2217 ; term:
2218 Paragraph text
2219 !! result
2220 <dl><dt> term</dt><dd>
2221 </dd></dl>
2222 <p>Paragraph text
2223 </p>
2224 !! end
2225
2226 !! test
2227 Nested definition lists using html syntax
2228 !! input
2229 <dl><dd>
2230 <dl>
2231 <dd>Foo</dd>
2232 </dl>
2233 </dd></dl>
2234 !! result
2235 <dl><dd>
2236 <dl>
2237 <dd>Foo</dd>
2238 </dl>
2239 </dd></dl>
2240
2241 !! end
2242
2243 !! test
2244 Definition Lists: No nesting: Multiple dd's
2245 !! input
2246 ;x
2247 :a
2248 :b
2249 !! result
2250 <dl><dt>x
2251 </dt><dd>a
2252 </dd><dd>b
2253 </dd></dl>
2254
2255 !! end
2256
2257 !! test
2258 Definition Lists: Indentation: Regular
2259 !! input
2260 :i1
2261 ::i2
2262 :::i3
2263 !! result
2264 <dl><dd>i1
2265 <dl><dd>i2
2266 <dl><dd>i3
2267 </dd></dl>
2268 </dd></dl>
2269 </dd></dl>
2270
2271 !! end
2272
2273 !! test
2274 Definition Lists: Indentation: Missing 1st level
2275 !! input
2276 ::i2
2277 :::i3
2278 !! result
2279 <dl><dd><dl><dd>i2
2280 <dl><dd>i3
2281 </dd></dl>
2282 </dd></dl>
2283 </dd></dl>
2284
2285 !! end
2286
2287 !! test
2288 Definition Lists: Indentation: Multi-level indent
2289 !! input
2290 :::i3
2291 !! result
2292 <dl><dd><dl><dd><dl><dd>i3
2293 </dd></dl>
2294 </dd></dl>
2295 </dd></dl>
2296
2297 !! end
2298
2299 !! test
2300 Definition Lists: Hacky use to indent tables
2301 !! input
2302 ::{|
2303 |foo
2304 |bar
2305 |}
2306 this text
2307 should be left alone
2308 !! result
2309 <dl><dd><dl><dd><table>
2310 <tr>
2311 <td>foo
2312 </td>
2313 <td>bar
2314 </td></tr></table></dd></dl></dd></dl>
2315 <p>this text
2316 should be left alone
2317 </p>
2318 !! end
2319 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2320 ## as an empty dt item. It also ignores all but the last ";" when followed
2321 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2322 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2323 ## ";"s.
2324 ##
2325 ## Ex: ";;t2 ::d2" is transformed into:
2326 ##
2327 ## <dl>
2328 ## <dt>t2 </dt>
2329 ## <dd>
2330 ## <dl>
2331 ## <dt></dt>
2332 ## <dd>d2</dd>
2333 ## </dl>
2334 ## </dd>
2335 ## </dl>
2336 ##
2337 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2338 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2339 ##
2340 ## <dl>
2341 ## <dt>
2342 ## <dl>
2343 ## <dt>t2 </dt>
2344 ## <dd>:d2</dd>
2345 ## </dl>
2346 ## </dt>
2347 ## </dl>
2348 ##
2349 ## All Parsoid only definition list tests have this difference.
2350 ##
2351 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2352 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2353
2354 !! test
2355 Table / list interaction: indented table with lists in table contents
2356 !! input
2357 :{|
2358 |-
2359 | a
2360 * b
2361 |-
2362 | c
2363 * d
2364 |}
2365 !! result
2366 <dl><dd><table>
2367
2368 <tr>
2369 <td> a
2370 <ul><li> b
2371 </li></ul>
2372 </td></tr>
2373 <tr>
2374 <td> c
2375 <ul><li> d
2376 </li></ul>
2377 </td></tr></table></dd></dl>
2378
2379 !! end
2380
2381 !!test
2382 Table / list interaction: lists nested in tables nested in indented lists
2383 !!input
2384 :{|
2385 |
2386 :a
2387 :b
2388 |
2389 *c
2390 *d
2391 |}
2392
2393 *e
2394 *f
2395 !!result
2396 <dl><dd><table>
2397 <tr>
2398 <td>
2399 <dl><dd>a
2400 </dd><dd>b
2401 </dd></dl>
2402 </td>
2403 <td>
2404 <ul><li>c
2405 </li><li>d
2406 </li></ul>
2407 </td></tr></table></dd></dl>
2408 <ul><li>e
2409 </li><li>f
2410 </li></ul>
2411
2412 !!end
2413
2414 !! test
2415 Definition Lists: Nesting: Multi-level (Parsoid only)
2416 !! options
2417 parsoid
2418 !! input
2419 ;t1 :d1
2420 ;;t2 ::d2
2421 ;;;t3 :::d3
2422 !! result
2423 <dl>
2424 <dt>t1 </dt>
2425 <dd>d1</dd>
2426 <dt>
2427 <dl>
2428 <dt>t2 </dt>
2429 <dd>:d2</dd>
2430 <dt>
2431 <dl>
2432 <dt>t3 </dt>
2433 <dd>::d3</dd>
2434 </dl>
2435 </dt>
2436 </dl>
2437 </dt>
2438 </dl>
2439
2440
2441 !! end
2442
2443
2444 !! test
2445 Definition Lists: Nesting: Test 2 (Parsoid only)
2446 !! options
2447 parsoid
2448 !! input
2449 ;t1
2450 ::d2
2451 !! result
2452 <dl>
2453 <dt>t1</dt>
2454 <dd>
2455 <dl>
2456 <dd>d2</dd>
2457 </dl>
2458 </dd>
2459 </dl>
2460
2461 !! end
2462
2463
2464 !! test
2465 Definition Lists: Nesting: Test 3 (Parsoid only)
2466 !! options
2467 parsoid
2468 !! input
2469 :;t1
2470 ::::d2
2471 !! result
2472 <dl>
2473 <dd>
2474 <dl>
2475 <dt>t1</dt>
2476 <dd>
2477 <dl>
2478 <dd>
2479 <dl>
2480 <dd>d2</dd>
2481 </dl>
2482 </dd>
2483 </dl>
2484 </dd>
2485 </dl>
2486 </dd>
2487 </dl>
2488
2489 !! end
2490
2491
2492 !! test
2493 Definition Lists: Nesting: Test 4
2494 !! input
2495 ::;t3
2496 :::d3
2497 !! result
2498 <dl><dd><dl><dd><dl><dt>t3
2499 </dt><dd>d3
2500 </dd></dl>
2501 </dd></dl>
2502 </dd></dl>
2503
2504 !! end
2505
2506
2507 ## The Parsoid team believes the following three test exposes a
2508 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2509 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2510 !! test
2511 Definition Lists: Mixed Lists: Test 1 (php)
2512 !! options
2513 php
2514 !! input
2515 :;* foo
2516 ::* bar
2517 :; baz
2518 !! result
2519 <dl><dd><dl><dt><ul><li> foo
2520 </li><li> bar
2521 </li></ul>
2522 </dt></dl>
2523 <dl><dt> baz
2524 </dt></dl>
2525 </dd></dl>
2526
2527 !! end
2528 !! test
2529 Definition Lists: Mixed Lists: Test 1 (parsoid)
2530 !! options
2531 parsoid
2532 !! input
2533 :;* foo
2534 ::* bar
2535 :; baz
2536 !! result
2537 <dl><dd><dl><dt><ul><li> foo
2538 </li></ul></dt><dd><ul><li> bar
2539 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2540 !! end
2541
2542 !! test
2543 Definition Lists: Mixed Lists: Test 2
2544 !! input
2545 *: d1
2546 *: d2
2547 !! result
2548 <ul><li><dl><dd> d1
2549 </dd><dd> d2
2550 </dd></dl>
2551 </li></ul>
2552
2553 !! end
2554
2555
2556 !! test
2557 Definition Lists: Mixed Lists: Test 3
2558 !! input
2559 *::: d1
2560 *::: d2
2561 !! result
2562 <ul><li><dl><dd><dl><dd><dl><dd> d1
2563 </dd><dd> d2
2564 </dd></dl>
2565 </dd></dl>
2566 </dd></dl>
2567 </li></ul>
2568
2569 !! end
2570
2571
2572 !! test
2573 Definition Lists: Mixed Lists: Test 4
2574 !! input
2575 *;d1 :d2
2576 *;d3 :d4
2577 !! result
2578 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2579 </dd><dt>d3&#160;</dt><dd>d4
2580 </dd></dl>
2581 </li></ul>
2582
2583 !! end
2584
2585
2586 !! test
2587 Definition Lists: Mixed Lists: Test 5
2588 !! input
2589 *:d1
2590 *:: d2
2591 !! result
2592 <ul><li><dl><dd>d1
2593 <dl><dd> d2
2594 </dd></dl>
2595 </dd></dl>
2596 </li></ul>
2597
2598 !! end
2599
2600
2601 !! test
2602 Definition Lists: Mixed Lists: Test 6
2603 !! input
2604 #*:d1
2605 #*::: d3
2606 !! result
2607 <ol><li><ul><li><dl><dd>d1
2608 <dl><dd><dl><dd> d3
2609 </dd></dl>
2610 </dd></dl>
2611 </dd></dl>
2612 </li></ul>
2613 </li></ol>
2614
2615 !! end
2616
2617
2618 !! test
2619 Definition Lists: Mixed Lists: Test 7
2620 !! input
2621 :* d1
2622 :* d2
2623 !! result
2624 <dl><dd><ul><li> d1
2625 </li><li> d2
2626 </li></ul>
2627 </dd></dl>
2628
2629 !! end
2630
2631
2632 !! test
2633 Definition Lists: Mixed Lists: Test 8
2634 !! input
2635 :* d1
2636 ::* d2
2637 !! result
2638 <dl><dd><ul><li> d1
2639 </li></ul>
2640 <dl><dd><ul><li> d2
2641 </li></ul>
2642 </dd></dl>
2643 </dd></dl>
2644
2645 !! end
2646
2647
2648 !! test
2649 Definition Lists: Mixed Lists: Test 9
2650 !! input
2651 *;foo :bar
2652 !! result
2653 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2654 </dd></dl>
2655 </li></ul>
2656
2657 !! end
2658
2659
2660 !! test
2661 Definition Lists: Mixed Lists: Test 10
2662 !! input
2663 *#;foo :bar
2664 !! result
2665 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2666 </dd></dl>
2667 </li></ol>
2668 </li></ul>
2669
2670 !! end
2671
2672 # The Parsoid team disagrees with the PHP parser's seemingly-random
2673 # rules regarding dd/dt on the next two tests. Parsoid is more
2674 # consistent, and recognizes the shared nesting and keeps the
2675 # still-open tags around until the nesting is complete.
2676
2677 !! test
2678 Definition Lists: Mixed Lists: Test 11 (php)
2679 !! options
2680 php
2681 !! input
2682 *#*#;*;;foo :bar
2683 *#*#;boo :baz
2684 !! result
2685 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2686 </dt></dl>
2687 </dd></dl>
2688 </li></ul>
2689 </dd></dl>
2690 <dl><dt>boo&#160;</dt><dd>baz
2691 </dd></dl>
2692 </li></ol>
2693 </li></ul>
2694 </li></ol>
2695 </li></ul>
2696
2697 !! end
2698 !! test
2699 Definition Lists: Mixed Lists: Test 11 (parsoid)
2700 !! options
2701 parsoid
2702 !! input
2703 *#*#;*;;foo :bar
2704 *#*#;boo :baz
2705 !! result
2706 <ul>
2707 <li>
2708 <ol>
2709 <li>
2710 <ul>
2711 <li>
2712 <ol>
2713 <li>
2714 <dl>
2715 <dt>
2716 <ul>
2717 <li>
2718 <dl>
2719 <dt>
2720 <dl>
2721 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2722 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2723 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2724 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2725 !! end
2726
2727
2728 !! test
2729 Definition Lists: Weird Ones: Test 1 (php)
2730 !! options
2731 php
2732 !! input
2733 *#;*::;; foo : bar (who uses this?)
2734 !! result
2735 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2736 </dt></dl>
2737 </dd></dl>
2738 </dd></dl>
2739 </dd></dl>
2740 </li></ul>
2741 </dd></dl>
2742 </li></ol>
2743 </li></ul>
2744
2745 !! end
2746 !! test
2747 Definition Lists: Weird Ones: Test 1 (parsoid)
2748 !! options
2749 parsoid
2750 !! input
2751 *#;*::;; foo : bar (who uses this?)
2752 !! result
2753 <ul>
2754 <li>
2755 <ol>
2756 <li>
2757 <dl>
2758 <dt>
2759 <ul>
2760 <li>
2761 <dl>
2762 <dd>
2763 <dl>
2764 <dd>
2765 <dl>
2766 <dt>
2767 <dl>
2768 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2769 <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>
2770 !! end
2771
2772 ###
2773 ### External links
2774 ###
2775 !! test
2776 External links: non-bracketed
2777 !! input
2778 Non-bracketed: http://example.com
2779 !! result
2780 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2781 </p>
2782 !! end
2783
2784 !! test
2785 External links: numbered
2786 !! input
2787 Numbered: [http://example.com]
2788 Numbered: [http://example.net]
2789 Numbered: [http://example.com]
2790 !! result
2791 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2792 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2793 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2794 </p>
2795 !!end
2796
2797 !! test
2798 External links: specified text
2799 !! input
2800 Specified text: [http://example.com link]
2801 !! result
2802 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2803 </p>
2804 !!end
2805
2806 !! test
2807 External links: trail
2808 !! input
2809 Linktrails should not work for external links: [http://example.com link]s
2810 !! result
2811 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2812 </p>
2813 !! end
2814
2815 !! test
2816 External links: dollar sign in URL
2817 !! input
2818 http://example.com/1$2345
2819 !! result
2820 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2821 </p>
2822 !! end
2823
2824 !! test
2825 External links: dollar sign in URL (named)
2826 !! input
2827 [http://example.com/1$2345]
2828 !! result
2829 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2830 </p>
2831 !!end
2832
2833 !! test
2834 External links: open square bracket forbidden in URL (bug 4377)
2835 !! input
2836 http://example.com/1[2345
2837 !! result
2838 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2839 </p>
2840 !! end
2841
2842 !! test
2843 External links: open square bracket forbidden in URL (named) (bug 4377)
2844 !! input
2845 [http://example.com/1[2345]
2846 !! result
2847 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2848 </p>
2849 !!end
2850
2851 !! test
2852 External links: nowiki in URL link text (bug 6230)
2853 !!input
2854 [http://example.com/ <nowiki>''example site''</nowiki>]
2855 !! result
2856 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2857 </p>
2858 !! end
2859
2860 !! test
2861 External links: newline forbidden in text (bug 6230 regression check)
2862 !! input
2863 [http://example.com/ first
2864 second]
2865 !! result
2866 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2867 second]
2868 </p>
2869 !!end
2870
2871 !! test
2872 External links: Pipe char between url and text
2873 !! input
2874 [http://example.com | link]
2875 !! result
2876 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2877 </p>
2878 !!end
2879
2880 !! test
2881 External links: protocol-relative URL in brackets
2882 !! input
2883 [//example.com/ Test]
2884 !! result
2885 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2886 </p>
2887 !! end
2888
2889 !! test
2890 External links: protocol-relative URL in brackets without text
2891 !! input
2892 [//example.com]
2893 !! result
2894 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2895 </p>
2896 !! end
2897
2898 !! test
2899 External links: protocol-relative URL in free text is left alone
2900 !! input
2901 //example.com/Foo
2902 !! result
2903 <p>//example.com/Foo
2904 </p>
2905 !!end
2906
2907 !! test
2908 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2909 !! input
2910 foo//example.com/Foo
2911 !! result
2912 <p>foo//example.com/Foo
2913 </p>
2914 !! end
2915
2916 !! test
2917 External image
2918 !! input
2919 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2920 !! result
2921 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2922 </p>
2923 !! end
2924
2925 !! test
2926 External image from https
2927 !! input
2928 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2929 !! result
2930 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2931 </p>
2932 !! end
2933
2934 !! test
2935 External image (when not allowed)
2936 !! options
2937 wgAllowExternalImages=0
2938 !! input
2939 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2940 !! result
2941 <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>
2942 </p>
2943 !! end
2944
2945 !! test
2946 Link to non-http image, no img tag
2947 !! input
2948 Link to non-http image, no img tag: ftp://example.com/test.jpg
2949 !! result
2950 <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>
2951 </p>
2952 !! end
2953
2954 !! test
2955 External links: terminating separator
2956 !! input
2957 Terminating separator: http://example.com/thing,
2958 !! result
2959 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2960 </p>
2961 !! end
2962
2963 !! test
2964 External links: intervening separator
2965 !! input
2966 Intervening separator: http://example.com/1,2,3
2967 !! result
2968 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2969 </p>
2970 !! end
2971
2972 !! test
2973 External links: old bug with URL in query
2974 !! input
2975 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2976 !! result
2977 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2978 </p>
2979 !! end
2980
2981 !! test
2982 External links: old URL-in-URL bug, mixed protocols
2983 !! input
2984 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2985 !! result
2986 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2987 </p>
2988 !!end
2989
2990 !! test
2991 External links: URL in text
2992 !! input
2993 URL in text: [http://example.com http://example.com]
2994 !! result
2995 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2996 </p>
2997 !! end
2998
2999 !! test
3000 External links: Clickable images
3001 !! input
3002 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3003 !! result
3004 <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>
3005 </p>
3006 !!end
3007
3008 !! test
3009 External links: raw ampersand
3010 !! input
3011 Old &amp; use: http://x&y
3012 !! result
3013 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3014 </p>
3015 !! end
3016
3017 !! test
3018 External links: encoded ampersand
3019 !! input
3020 Old &amp; use: http://x&amp;y
3021 !! result
3022 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 External links: encoded equals (bug 6102)
3028 !! input
3029 http://example.com/?foo&#61;bar
3030 !! result
3031 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3032 </p>
3033 !! end
3034
3035 !! test
3036 External links: [raw ampersand]
3037 !! input
3038 Old &amp; use: [http://x&y]
3039 !! result
3040 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3041 </p>
3042 !! end
3043
3044 !! test
3045 External links: [encoded ampersand]
3046 !! input
3047 Old &amp; use: [http://x&amp;y]
3048 !! result
3049 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3050 </p>
3051 !! end
3052
3053 !! test
3054 External links: [encoded equals] (bug 6102)
3055 !! input
3056 [http://example.com/?foo&#61;bar]
3057 !! result
3058 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3059 </p>
3060 !! end
3061
3062 !! test
3063 External links: [IDN ignored character reference in hostname; strip it right off]
3064 !! input
3065 [http://e&zwnj;xample.com/]
3066 !! result
3067 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3068 </p>
3069 !! end
3070
3071 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3072 # Where an external link could easily circumvent the sanitization of the text of
3073 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3074 # test demands a higher standard. That's a bit strange.
3075 #
3076 # Example:
3077 #
3078 # http://e‌xample.com -> [http://example.com|http://example.com]
3079 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3080 #
3081 # The first example is sanitized, but the second is not. Any security benefits
3082 # from this production are trivial to circumvent. Either remove this test and
3083 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3084 # the test accordingly.
3085 #
3086 # All our love,
3087 # The Parsoid team.
3088 !! test
3089 External links: IDN ignored character reference in hostname; strip it right off
3090 !! input
3091 http://e&zwnj;xample.com/
3092 !! result
3093 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3094 </p>
3095 !! end
3096
3097 !! test
3098 External links: www.jpeg.org (bug 554)
3099 !! input
3100 http://www.jpeg.org
3101 !!result
3102 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3103 </p>
3104 !! end
3105
3106 !! test
3107 External links: URL within URL (original bug 2)
3108 !! input
3109 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3110 !! result
3111 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3112 </p>
3113 !! end
3114
3115 !! test
3116 BUG 361: URL inside bracketed URL
3117 !! input
3118 [http://www.example.com/foo http://www.example.com/bar]
3119 !! result
3120 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3121 </p>
3122 !! end
3123
3124 !! test
3125 BUG 361: URL within URL, not bracketed
3126 !! input
3127 http://www.example.com/foo?=http://www.example.com/bar
3128 !! result
3129 <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>
3130 </p>
3131 !! end
3132
3133 !! test
3134 BUG 289: ">"-token in URL-tail
3135 !! input
3136 http://www.example.com/<hello>
3137 !! result
3138 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3139 </p>
3140 !!end
3141
3142 !! test
3143 BUG 289: literal ">"-token in URL-tail
3144 !! input
3145 http://www.example.com/<b>html</b>
3146 !! result
3147 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3148 </p>
3149 !!end
3150
3151 !! test
3152 BUG 289: ">"-token in bracketed URL
3153 !! input
3154 [http://www.example.com/<hello> stuff]
3155 !! result
3156 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3157 </p>
3158 !!end
3159
3160 !! test
3161 BUG 289: literal ">"-token in bracketed URL
3162 !! input
3163 [http://www.example.com/<b>html</b> stuff]
3164 !! result
3165 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3166 </p>
3167 !!end
3168
3169 !! test
3170 BUG 289: literal double quote at end of URL
3171 !! input
3172 http://www.example.com/"hello"
3173 !! result
3174 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3175 </p>
3176 !!end
3177
3178 !! test
3179 BUG 289: literal double quote in bracketed URL
3180 !! input
3181 [http://www.example.com/"hello" stuff]
3182 !! result
3183 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3184 </p>
3185 !!end
3186
3187 !! test
3188 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3189 !! input
3190 [http://www.example.com test]
3191 !! result
3192 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3193 </p>
3194 !! end
3195
3196 !! test
3197 External links: link text with spaces
3198 !! input
3199 [http://www.example.com a b c]
3200 [http://www.example.com ''a'' ''b'']
3201 !! result
3202 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3203 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3204 </p>
3205 !! end
3206
3207 !! test
3208 External links: wiki links within external link (Bug 3695)
3209 !! input
3210 [http://example.com [[wikilink]] embedded in ext link]
3211 !! result
3212 <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>
3213 </p>
3214 !! end
3215
3216 !! test
3217 BUG 787: Links with one slash after the url protocol are invalid
3218 !! input
3219 http:/example.com
3220
3221 [http:/example.com title]
3222 !! result
3223 <p>http:/example.com
3224 </p><p>[http:/example.com title]
3225 </p>
3226 !! end
3227
3228 !! test
3229 Bracketed external links with template-generated invalid target
3230 !! input
3231 [{{echo|http:/example.com}} title]
3232 !! result
3233 <p>[http:/example.com title]
3234 </p>
3235 !! end
3236
3237 !! test
3238 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3239 !! input
3240 ''[http://example.com text'']
3241 [http://example.com '''text]'''
3242 ''Something [http://example.com in italic'']
3243 ''Something [http://example.com mixed''''', even bold]'''
3244 '''''Now [http://example.com both''''']
3245 !! result
3246 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3247 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3248 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3249 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3250 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3251 </p>
3252 !! end
3253
3254
3255 !! test
3256 Bug 4781: %26 in URL
3257 !! input
3258 http://www.example.com/?title=AT%26T
3259 !! result
3260 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3261 </p>
3262 !! end
3263
3264 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3265 # % is actually legal in HTML5. Any change in output would need testing though.
3266 !! test
3267 Bug 4781, 5267: %25 in URL
3268 !! input
3269 http://www.example.com/?title=100%25_Bran
3270 !! result
3271 <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>
3272 </p>
3273 !! end
3274
3275 !! test
3276 Bug 4781, 5267: %28, %29 in URL
3277 !! input
3278 http://www.example.com/?title=Ben-Hur_%281959_film%29
3279 !! result
3280 <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>
3281 </p>
3282 !! end
3283
3284
3285 !! test
3286 Bug 4781: %26 in autonumber URL
3287 !! input
3288 [http://www.example.com/?title=AT%26T]
3289 !! result
3290 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 Bug 4781, 5267: %26 in autonumber URL
3296 !! input
3297 [http://www.example.com/?title=100%25_Bran]
3298 !! result
3299 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 Bug 4781, 5267: %28, %29 in autonumber URL
3305 !! input
3306 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3307 !! result
3308 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3309 </p>
3310 !! end
3311
3312
3313 !! test
3314 Bug 4781: %26 in bracketed URL
3315 !! input
3316 [http://www.example.com/?title=AT%26T link]
3317 !! result
3318 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3319 </p>
3320 !! end
3321
3322 !! test
3323 Bug 4781, 5267: %26 in bracketed URL
3324 !! input
3325 [http://www.example.com/?title=100%25_Bran link]
3326 !! result
3327 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3328 </p>
3329 !! end
3330
3331 !! test
3332 Bug 4781, 5267: %28, %29 in bracketed URL
3333 !! input
3334 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3335 !! result
3336 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3337 </p>
3338 !! end
3339
3340 !! test
3341 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3342 !! input
3343 Some [http://example.com/ pretty ''italics'' and stuff]!
3344 !! result
3345 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3346 </p>
3347 !! end
3348
3349 !! test
3350 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3351 !! input
3352 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3353 !! result
3354 <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>
3355 </p>
3356 !! end
3357
3358 !! test
3359 External link containing double-single-quotes with no space separating the url from text in italics
3360 !! input
3361 [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]].]
3362 !! result
3363 <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>
3364 </p>
3365 !! end
3366
3367 !! test
3368 External link with comments in link text
3369 !! input
3370 [http://www.google.com Google <!-- comment -->]
3371 !! result
3372 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3373 </p>
3374 !! end
3375
3376 !! test
3377 URL-encoding in URL functions (single parameter)
3378 !! input
3379 {{localurl:Some page|amp=&}}
3380 !! result
3381 <p>/index.php?title=Some_page&amp;amp=&amp;
3382 </p>
3383 !! end
3384
3385 !! test
3386 URL-encoding in URL functions (multiple parameters)
3387 !! input
3388 {{localurl:Some page|q=?&amp=&}}
3389 !! result
3390 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3391 </p>
3392 !! end
3393
3394 !! test
3395 Brackets in urls
3396 !! input
3397 http://example.com/index.php?foozoid%5B%5D=bar
3398
3399 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3400 !! result
3401 <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>
3402 </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>
3403 </p>
3404 !! end
3405
3406 !! test
3407 IPv6 urls (bug 21261)
3408 !! options
3409 disabled
3410 !! input
3411 http://[2404:130:0:1000::187:2]/index.php
3412 !! result
3413 <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>
3414 </p>
3415 !! end
3416
3417 !! test
3418 Non-extlinks in brackets
3419 !! input
3420 [foo]
3421 [foo bar]
3422 [foo ''bar'']
3423 [fool's] errand
3424 [fool's errand]
3425 [{{echo|foo}}]
3426 [{{echo|foo}} bar]
3427 [{{echo|foo}} ''bar'']
3428 [{{echo|foo}}l's] errand
3429 [{{echo|foo}}l's errand]
3430 [url={{echo|foo}}]
3431 [url=http://example.com]
3432 !! result
3433 <p>[foo]
3434 [foo bar]
3435 [foo <i>bar</i>]
3436 [fool's] errand
3437 [fool's errand]
3438 [foo]
3439 [foo bar]
3440 [foo <i>bar</i>]
3441 [fool's] errand
3442 [fool's errand]
3443 [url=foo]
3444 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3445 </p>
3446 !! end
3447
3448 !! test
3449 Parsoid: Percent encoding in external links
3450 !! options
3451 parsoid
3452 !! input
3453 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3454 !! result
3455 <p><a rel="mw:ExtLink"
3456 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3457 !! end
3458
3459 !! test
3460 Parsoid: use url link syntax for links where the content is equal the link
3461 target
3462 !! options
3463 parsoid
3464 !! input
3465 http://example.com
3466 !! result
3467 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3468 !! end
3469
3470 ###
3471 ### Quotes
3472 ###
3473
3474 !! test
3475 Quotes
3476 !! input
3477 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3478
3479 Normal text. '''''Bold italic text.''''' Normal text.
3480 !!result
3481 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3482 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3483 </p>
3484 !! end
3485
3486
3487 !! test
3488 Unclosed and unmatched quotes (php)
3489 !! options
3490 php
3491 !! input
3492 '''''Bold italic text '''with bold deactivated''' in between.'''''
3493
3494 '''''Bold italic text ''with italic deactivated'' in between.'''''
3495
3496 '''Bold text..
3497
3498 ..spanning two paragraphs (should not work).'''
3499
3500 '''Bold tag left open
3501
3502 ''Italic tag left open
3503
3504 Normal text.
3505
3506 <!-- Unmatching number of opening, closing tags: -->
3507 '''This year''''s election ''should'' beat '''last year''''s.
3508
3509 ''Tom'''s car is bigger than ''Susan'''s.
3510
3511 Plain ''italic'''s plain
3512 !! result
3513 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3514 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3515 </p><p><b>Bold text..</b>
3516 </p><p>..spanning two paragraphs (should not work).
3517 </p><p><b>Bold tag left open</b>
3518 </p><p><i>Italic tag left open</i>
3519 </p><p>Normal text.
3520 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3521 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3522 </p><p>Plain <i>italic'</i>s plain
3523 </p>
3524 !! end
3525 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3526 # parser strips. The wikitext contains just the first half of the bold
3527 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3528 # differently than the PHP parser.)
3529 !! test
3530 Unclosed and unmatched quotes (parsoid)
3531 !! options
3532 parsoid
3533 !! input
3534 '''''Bold italic text '''with bold deactivated''' in between.'''''
3535
3536 '''''Bold italic text ''with italic deactivated'' in between.'''''
3537
3538 '''Bold text..
3539
3540 ..spanning two paragraphs (should not work).'''
3541
3542 '''Bold tag left open
3543
3544 ''Italic tag left open
3545
3546 Normal text.
3547
3548 <!-- Unmatching number of opening, closing tags: -->
3549 '''This year''''s election ''should'' beat '''last year''''s.
3550
3551 ''Tom'''s car is bigger than ''Susan'''s.
3552
3553 Plain ''italic'''s plain
3554 !! result
3555 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3556 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3557 </p><p><b>Bold text..</b>
3558 </p><p>..spanning two paragraphs (should not work).<b></b>
3559 </p><p><b>Bold tag left open</b>
3560 </p><p><i>Italic tag left open</i>
3561 </p><p>Normal text.
3562 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3563 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3564 </p><p>Plain <i>italic'</i>s plain
3565 </p>
3566 !! end
3567
3568 ###
3569 ### Tables
3570 ###
3571 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3572 ###
3573
3574 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3575 # is the bare minimum required by the spec, see:
3576 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3577 !! test
3578 A table with no data. (php)
3579 !! options
3580 php
3581 !! input
3582 {||}
3583 !! result
3584 !! end
3585 # Parsoid team replies: empty table tags are legal in HTML5
3586 !! test
3587 A table with no data. (parsoid)
3588 !! options
3589 parsoid
3590 !! input
3591 {||}
3592 !! result
3593 <table></table>
3594 !! end
3595
3596 # A table with nothing but a caption is invalid XHTML, we might want to render
3597 # this as <p>caption</p>
3598 !! test
3599 A table with nothing but a caption (php)
3600 !! options
3601 php
3602 !! input
3603 {|
3604 |+ caption
3605 |}
3606 !! result
3607 <table>
3608 <caption> caption
3609 </caption><tr><td></td></tr></table>
3610
3611 !! end
3612 # Parsoid team replies: table with only a caption is legal in HTML5
3613 !! test
3614 A table with nothing but a caption (parsoid)
3615 !! options
3616 parsoid
3617 !! input
3618 {|
3619 |+ caption
3620 |}
3621 !! result
3622 <table><caption> caption</caption></table>
3623 !! end
3624
3625 !! test
3626 A table with caption with default-spaced attributes and a table row
3627 !! input
3628 {|
3629 |+ style="color: red;" | caption1
3630 |-
3631 | foo
3632 |}
3633 !! result
3634 <table>
3635 <caption style="color: red;"> caption1
3636 </caption>
3637 <tr>
3638 <td> foo
3639 </td></tr></table>
3640
3641 !! end
3642
3643 !! test
3644 A table with captions with non-default spaced attributes and a table row
3645 !! input
3646 {|
3647 |+style="color: red;"|caption2
3648 |+ style="color: red;"| caption3
3649 |-
3650 | foo
3651 |}
3652 !! result
3653 <table>
3654 <caption style="color: red;">caption2
3655 </caption>
3656 <caption style="color: red;"> caption3
3657 </caption>
3658 <tr>
3659 <td> foo
3660 </td></tr></table>
3661
3662 !! end
3663
3664 !! test
3665 Table td-cell syntax variations
3666 !! input
3667 {|
3668 | foo bar foo | baz
3669 | foo bar foo || baz
3670 | style='color:red;' | baz
3671 | style='color:red;' || baz
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td> baz
3677 </td>
3678 <td> foo bar foo </td>
3679 <td> baz
3680 </td>
3681 <td style="color:red;"> baz
3682 </td>
3683 <td> style='color:red;' </td>
3684 <td> baz
3685 </td></tr></table>
3686
3687 !! end
3688
3689 !! test
3690 Simple table
3691 !! input
3692 {|
3693 | 1 || 2
3694 |-
3695 | 3 || 4
3696 |}
3697 !! result
3698 <table>
3699 <tr>
3700 <td> 1 </td>
3701 <td> 2
3702 </td></tr>
3703 <tr>
3704 <td> 3 </td>
3705 <td> 4
3706 </td></tr></table>
3707
3708 !! end
3709
3710 !! test
3711 Simple table but with multiple dashes for row wikitext
3712 !! input
3713 {|
3714 | foo
3715 |-----
3716 | bar
3717 |}
3718 !! result
3719 <table>
3720 <tr>
3721 <td> foo
3722 </td></tr>
3723 <tr>
3724 <td> bar
3725 </td></tr></table>
3726
3727 !! end
3728 !! test
3729 Multiplication table
3730 !! input
3731 {| border="1" cellpadding="2"
3732 |+Multiplication table
3733 |-
3734 ! &times; !! 1 !! 2 !! 3
3735 |-
3736 ! 1
3737 | 1 || 2 || 3
3738 |-
3739 ! 2
3740 | 2 || 4 || 6
3741 |-
3742 ! 3
3743 | 3 || 6 || 9
3744 |-
3745 ! 4
3746 | 4 || 8 || 12
3747 |-
3748 ! 5
3749 | 5 || 10 || 15
3750 |}
3751 !! result
3752 <table border="1" cellpadding="2">
3753 <caption>Multiplication table
3754 </caption>
3755 <tr>
3756 <th> &#215; </th>
3757 <th> 1 </th>
3758 <th> 2 </th>
3759 <th> 3
3760 </th></tr>
3761 <tr>
3762 <th> 1
3763 </th>
3764 <td> 1 </td>
3765 <td> 2 </td>
3766 <td> 3
3767 </td></tr>
3768 <tr>
3769 <th> 2
3770 </th>
3771 <td> 2 </td>
3772 <td> 4 </td>
3773 <td> 6
3774 </td></tr>
3775 <tr>
3776 <th> 3
3777 </th>
3778 <td> 3 </td>
3779 <td> 6 </td>
3780 <td> 9
3781 </td></tr>
3782 <tr>
3783 <th> 4
3784 </th>
3785 <td> 4 </td>
3786 <td> 8 </td>
3787 <td> 12
3788 </td></tr>
3789 <tr>
3790 <th> 5
3791 </th>
3792 <td> 5 </td>
3793 <td> 10 </td>
3794 <td> 15
3795 </td></tr></table>
3796
3797 !! end
3798
3799 !! test
3800 Accept "||" in table headings
3801 !! input
3802 {|
3803 !h1 || h2
3804 |}
3805 !! result
3806 <table>
3807 <tr>
3808 <th>h1 </th>
3809 <th> h2
3810 </th></tr></table>
3811
3812 !! end
3813
3814 !! test
3815 Accept "||" in indented table headings
3816 !! input
3817 :{|
3818 !h1 || h2
3819 |}
3820 !! result
3821 <dl><dd><table>
3822 <tr>
3823 <th>h1 </th>
3824 <th> h2
3825 </th></tr></table></dd></dl>
3826
3827 !! end
3828
3829 !! test
3830 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3831 !! input
3832 {|
3833 !| h1
3834 || a
3835 |}
3836 !! result
3837 <table>
3838 <tr>
3839 <th> h1
3840 </th>
3841 <td> a
3842 </td></tr></table>
3843
3844 !! end
3845
3846 !!test
3847 Accept "| !" at start of line in tables (ignore !-attribute)
3848 !!input
3849 {|
3850 |-
3851 | !style="color:red" | bar
3852 |}
3853 !!result
3854 <table>
3855
3856 <tr>
3857 <td> bar
3858 </td></tr></table>
3859
3860 !!end
3861
3862 !!test
3863 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 +/-
3864 !!input
3865 {|
3866 |-
3867 |style='color:red;'|+1
3868 |style='color:blue;'|-1
3869 |-
3870 | 1 || 2 || 3
3871 | 1 ||+2 ||-3
3872 |-
3873 | +1
3874 | -1
3875 |}
3876 !!result
3877 <table>
3878
3879 <tr>
3880 <td style="color:red;">+1
3881 </td>
3882 <td style="color:blue;">-1
3883 </td></tr>
3884 <tr>
3885 <td> 1 </td>
3886 <td> 2 </td>
3887 <td> 3
3888 </td>
3889 <td> 1 </td>
3890 <td>+2 </td>
3891 <td>-3
3892 </td></tr>
3893 <tr>
3894 <td> +1
3895 </td>
3896 <td> -1
3897 </td></tr></table>
3898
3899 !!end
3900
3901 !! test
3902 Table rowspan
3903 !! input
3904 {| border=1
3905 | Cell 1, row 1
3906 |rowspan=2| Cell 2, row 1 (and 2)
3907 | Cell 3, row 1
3908 |-
3909 | Cell 1, row 2
3910 | Cell 3, row 2
3911 |}
3912 !! result
3913 <table border="1">
3914 <tr>
3915 <td> Cell 1, row 1
3916 </td>
3917 <td rowspan="2"> Cell 2, row 1 (and 2)
3918 </td>
3919 <td> Cell 3, row 1
3920 </td></tr>
3921 <tr>
3922 <td> Cell 1, row 2
3923 </td>
3924 <td> Cell 3, row 2
3925 </td></tr></table>
3926
3927 !! end
3928
3929 !! test
3930 Nested table
3931 !! input
3932 {| border=1
3933 | &alpha;
3934 |
3935 {| bgcolor=#ABCDEF border=2
3936 |nested
3937 |-
3938 |table
3939 |}
3940 |the original table again
3941 |}
3942 !! result
3943 <table border="1">
3944 <tr>
3945 <td> &#945;
3946 </td>
3947 <td>
3948 <table bgcolor="#ABCDEF" border="2">
3949 <tr>
3950 <td>nested
3951 </td></tr>
3952 <tr>
3953 <td>table
3954 </td></tr></table>
3955 </td>
3956 <td>the original table again
3957 </td></tr></table>
3958
3959 !! end
3960
3961 !! test
3962 Invalid attributes in table cell (bug 1830)
3963 !! input
3964 {|
3965 |Cell:|broken
3966 |}
3967 !! result
3968 <table>
3969 <tr>
3970 <td>broken
3971 </td></tr></table>
3972
3973 !! end
3974
3975
3976 !! test
3977 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3978 !! input
3979 {|
3980 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3981 !! result
3982 <table>
3983 <tr>
3984 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3985 <td>]" onmouseover="alert(document.cookie)"&gt;test
3986 </td>
3987 </tr>
3988 </table>
3989
3990 !! end
3991
3992
3993 !! test
3994 Indented table markup mixed with indented pre content (proposed in bug 6200)
3995 !! input
3996 <table>
3997 <tr>
3998 <td>
3999 Text that should be rendered preformatted
4000 </td>
4001 </tr>
4002 </table>
4003 !! result
4004 <table>
4005 <tr>
4006 <td>
4007 <pre>Text that should be rendered preformatted
4008 </pre>
4009 </td>
4010 </tr>
4011 </table>
4012
4013 !! end
4014
4015 !! test
4016 Template-generated table cell attributes and cell content
4017 !! input
4018 {|
4019 |{{table_attribs}}
4020 |}
4021 !! result
4022 <table>
4023 <tr>
4024 <td style="color: red"> Foo
4025 </td></tr></table>
4026
4027 !! end
4028
4029 !! test
4030 Template-generated table cell attributes and cell content (2)
4031 !! input
4032 {|
4033 |align=center {{table_attribs}}
4034 |}
4035 !! result
4036 <table>
4037 <tr>
4038 <td align="center" style="color: red"> Foo
4039 </td></tr></table>
4040
4041 !! end
4042
4043 !! test
4044 Template-generated table cell attributes and cell content (3)
4045 !! input
4046 {|
4047 |align=center {{table_cells}}
4048 |}
4049 !! result
4050 <table>
4051 <tr>
4052 <td align="center" style="color: red"> Foo </td>
4053 <td> Bar </td>
4054 <td> Baz
4055 </td></tr></table>
4056
4057 !! end
4058
4059 !! test
4060 Table with row followed by newlines and table heading
4061 !! input
4062 {|
4063 |-
4064
4065 ! foo
4066 |}
4067 !! result
4068 <table>
4069
4070
4071 <tr>
4072 <th> foo
4073 </th></tr></table>
4074
4075 !! end
4076
4077 !! test
4078 Table with empty line following the start tag
4079 !! input
4080 {|
4081
4082 |-
4083 | foo
4084 |}
4085 !! result
4086 <table>
4087
4088
4089 <tr>
4090 <td> foo
4091 </td></tr></table>
4092
4093 !! end
4094
4095 # FIXME: Preserve the attribute properly (with an empty string as value) in
4096 # the PHP parser. Parsoid implements the behavior below.
4097 !! test
4098 Table attributes with empty value
4099 !! options
4100 parsoid
4101 !! input
4102 {|
4103 | style=| hello
4104 |}
4105 !! result
4106 <table>
4107 <tbody>
4108 <tr>
4109 <td style=""> hello
4110 </td></tr></tbody></table>
4111
4112 !! end
4113
4114 !! test
4115 Wikitext table with a lot of comments
4116 !! input
4117 {|
4118 <!-- c0 -->
4119 | foo
4120 <!-- c1 -->
4121 |- <!-- c2 -->
4122 <!-- c3 -->
4123 |<!-- c4 -->
4124 <!-- c5 -->
4125 |}
4126 !! result
4127 <table>
4128 <tr>
4129 <td> foo
4130 </td></tr>
4131 <tr>
4132 <td>
4133 </td></tr></table>
4134
4135 !! end
4136
4137 !! test
4138 Wikitext table with double-line table cell
4139 !! input
4140 {|
4141 |a
4142 b
4143 |}
4144 !! result
4145 <table>
4146 <tr>
4147 <td>a
4148 <p>b
4149 </p>
4150 </td></tr></table>
4151
4152 !! end
4153
4154 !! test
4155 Table cell with a single comment
4156 !! input
4157 {|
4158 | <!-- c1 -->
4159 | a
4160 |}
4161 !! result
4162 <table>
4163 <tr>
4164 <td>
4165 </td>
4166 <td> a
4167 </td></tr></table>
4168
4169 !! end
4170
4171 # The expected HTML structure in this test is debatable. The PHP parser does
4172 # not parse this kind of table at all. The main focus for Parsoid is on
4173 # round-tripping, so this output is ok for now. TODO: revisit!
4174 !! test
4175 Wikitext table with html-syntax row (Parsoid)
4176 !! options
4177 parsoid
4178 !! input
4179 {|
4180 |-
4181 <td>foo</td>
4182 |}
4183 !! result
4184 <table>
4185 <tbody>
4186 <tr>
4187 <td>foo</td></tr></tbody></table>
4188 !! end
4189
4190 !! test
4191 Implicit <td> after a |-
4192 (PHP parser relies on Tidy to add the missing <td> tags)
4193 !! options
4194 parsoid=wt2html,wt2wt
4195 !! input
4196 {|
4197 |-
4198 a
4199 |}
4200 !! result
4201 <table>
4202 <tr><td>a</td></tr>
4203 </table>
4204 !! end
4205
4206 !! test
4207 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4208 (PHP parser relies on Tidy to add the missing <td> tags)
4209 !! options
4210 parsoid=wt2html,wt2wt
4211 !! input
4212 {|
4213 |-
4214 |
4215 a
4216 |-
4217 b
4218 |}
4219 !! result
4220 <table>
4221 <tbody>
4222 <tr><td><pre>a</pre></td></tr>
4223 <tr><td> b</td></tr>
4224 </tbody>
4225 </table>
4226 !! end
4227
4228 !! test
4229 Lists should be recognized in an implicit <td> context
4230 (PHP parser relies on Tidy to add the missing <td> tags)
4231 !! options
4232 parsoid=wt2html,wt2wt
4233 !! input
4234 {|
4235 |-
4236 *a
4237 |}
4238 !! result
4239 <table>
4240 <tr>
4241 <td><ul><li>a</li></ul></td>
4242 </tr>
4243 </table>
4244 !! end
4245
4246 ###
4247 ### Internal links
4248 ###
4249 !! test
4250 Plain link, capitalized
4251 !! input
4252 [[Main Page]]
4253 !! result
4254 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4255 </p>
4256 !! end
4257
4258 !! test
4259 Plain link, uncapitalized
4260 !! input
4261 [[main Page]]
4262 !! result
4263 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4264 </p>
4265 !! end
4266
4267 !! test
4268 Piped link
4269 !! input
4270 [[Main Page|The Main Page]]
4271 !! result
4272 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4273 </p>
4274 !! end
4275
4276 !! test
4277 Piped link with comment in link text
4278 !! input
4279 [[Main Page|The Main<!--front--> Page]]
4280 !! result
4281 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Broken link
4287 !! input
4288 [[Zigzagzogzagzig]]
4289 !! result
4290 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4291 </p>
4292 !! end
4293
4294 !! test
4295 Broken link with fragment
4296 !! input
4297 [[Zigzagzogzagzig#zug]]
4298 !! result
4299 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Special page link with fragment
4305 !! input
4306 [[Special:Version#anchor]]
4307 !! result
4308 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4309 </p>
4310 !! end
4311
4312 !! test
4313 Nonexistent special page link with fragment
4314 !! input
4315 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4316 !! result
4317 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4318 </p>
4319 !! end
4320
4321 !! test
4322 Link with prefix
4323 !! input
4324 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4325 !! result
4326 <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>
4327 </p>
4328 !! end
4329
4330 !! test
4331 Link with suffix
4332 !! input
4333 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4334 !! result
4335 <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>!!!
4336 </p>
4337 !! end
4338
4339 !! article
4340 prefixed article
4341 !! text
4342 Some text
4343 !! endarticle
4344
4345 !! test
4346 Bug 43661: Piped links with identical prefixes
4347 !! input
4348 [[prefixed article|prefixed articles with spaces]]
4349
4350 [[prefixed article|prefixed articlesaoeu]]
4351
4352 [[Main Page|Main Page test]]
4353 !! result
4354 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4355 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4356 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4357 </p>
4358 !! end
4359
4360
4361 !! test
4362 Link with HTML entity in suffix / tail
4363 !! input
4364 [[Main Page]]&quot;, [[Main Page]]&#97;
4365 !! result
4366 <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;
4367 </p>
4368 !! end
4369
4370 !! test
4371 Link with 3 brackets
4372 !! input
4373 [[[main page]]]
4374 !! result
4375 <p>[[[main page]]]
4376 </p>
4377 !! end
4378
4379 !! test
4380 Piped link with 3 brackets
4381 !! input
4382 [[[main page|the main page]]]
4383 !! result
4384 <p>[[[main page|the main page]]]
4385 </p>
4386 !! end
4387
4388 !! test
4389 Link with multiple pipes
4390 !! input
4391 [[Main Page|The|Main|Page]]
4392 !! result
4393 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4394 </p>
4395 !! end
4396
4397 !! test
4398 Link to namespaces
4399 !! input
4400 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4401 !! result
4402 <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>
4403 </p>
4404 !! end
4405
4406 !! test
4407 Piped link to namespace
4408 !! input
4409 [[Meta:Disclaimers|The disclaimers]]
4410 !! result
4411 <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>
4412 </p>
4413 !! end
4414
4415 !! test
4416 Link containing }
4417 !! input
4418 [[Usually caused by a typo (oops}]]
4419 !! result
4420 <p>[[Usually caused by a typo (oops}]]
4421 </p>
4422 !! end
4423
4424 !! test
4425 Link containing % (not as a hex sequence)
4426 !! input
4427 [[7% Solution]]
4428 !! result
4429 <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>
4430 </p>
4431 !! end
4432
4433 !! test
4434 Link containing % as a single hex sequence interpreted to char
4435 !! input
4436 [[7%25 Solution]]
4437 !! result
4438 <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>
4439 </p>
4440 !!end
4441
4442 !! test
4443 Link containing % as a double hex sequence interpreted to hex sequence
4444 !! input
4445 [[7%2525 Solution]]
4446 !! result
4447 <p>[[7%2525 Solution]]
4448 </p>
4449 !!end
4450
4451 !! test
4452 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4453 Example for such a section: == < ==
4454 !! input
4455 [[%23%3c]][[%23%3e]]
4456 !! result
4457 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4458 </p>
4459 !! end
4460
4461 !! test
4462 Link containing "<#" and ">#" as a hex sequences
4463 !! input
4464 [[%3c%23]][[%3e%23]]
4465 !! result
4466 <p>[[%3c%23]][[%3e%23]]
4467 </p>
4468 !! end
4469
4470 !! test
4471 Link containing an equals sign
4472 !! input
4473 [[Special:BookSources/isbn=4-00-026157-6]]
4474 !! result
4475 <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>
4476 </p>
4477 !! end
4478
4479 !! article
4480 Foo~bar
4481 !! text
4482 Just a test of an article title containing a tilde.
4483 !! endarticle
4484
4485 # note that links containing signatures, like [[Foo~~~~]], are
4486 # massaged by the pre-save transform (PST) and so the tildes are never
4487 # seen by the parser.
4488 !! test
4489 Link containing a tilde
4490 !! input
4491 [[Foo~bar]]
4492 !! result
4493 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4494 </p>
4495 !! end
4496
4497 !! test
4498 Link containing double-single-quotes '' (bug 4598)
4499 !! input
4500 [[Lista d''e paise d''o munno]]
4501 !! result
4502 <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>
4503 </p>
4504 !! end
4505
4506 !! test
4507 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4508 !! input
4509 Some [[Link|pretty ''italics'' and stuff]]!
4510 !! result
4511 <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>!
4512 </p>
4513 !! end
4514
4515 !! test
4516 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4517 !! input
4518 ''Some [[Link|pretty ''italics'' and stuff]]!
4519 !! result
4520 <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>
4521 </p>
4522 !! end
4523
4524 !! test
4525 Link with double quotes in title part (literal) and alternate part (interpreted)
4526 !! input
4527 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4528
4529 [[''Pentecoste'']]
4530
4531 [[''Pentecoste''|Pentecoste]]
4532
4533 [[''Pentecoste''|''Pentecoste'']]
4534 !! result
4535 <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>
4536 </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>
4537 </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>
4538 </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>
4539 </p>
4540 !! end
4541
4542 !! test
4543 Broken image links with HTML captions (bug 39700)
4544 !! input
4545 [[File:Nonexistent|<script></script>]]
4546 [[File:Nonexistent|100px|<script></script>]]
4547 [[File:Nonexistent|&lt;]]
4548 [[File:Nonexistent|a<i>b</i>c]]
4549 !! result
4550 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4551 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4552 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4553 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4554 </p>
4555 !! end
4556
4557 !! test
4558 Plain link to URL
4559 !! input
4560 [[http://www.example.com]]
4561 !! result
4562 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4563 </p>
4564 !! end
4565
4566 !! test
4567 Plain link to URL with link text
4568 !! input
4569 [[http://www.example.com Link text]]
4570 !! result
4571 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4572 </p>
4573 !! end
4574
4575 !! test
4576 Plain link to protocol-relative URL
4577 !! input
4578 [[//www.example.com]]
4579 !! result
4580 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4581 </p>
4582 !! end
4583
4584 !! test
4585 Plain link to protocol-relative URL with link text
4586 !! input
4587 [[//www.example.com Link text]]
4588 !! result
4589 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4590 </p>
4591 !! end
4592
4593 !! test
4594 Plain link to page with question mark in title
4595 !! input
4596 [[A?b]]
4597
4598 [[A?b|Baz]]
4599 !! result
4600 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4601 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4602 </p>
4603 !! end
4604
4605
4606 # I'm fairly sure the expected result here is wrong.
4607 # We want these to be URL links, not pseudo-pages with URLs for titles....
4608 # However the current output is also pretty screwy.
4609 #
4610 # ----
4611 # I'm changing it to match the current output--it arguably makes more
4612 # sense in the light of the test above. Old expected result was:
4613 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4614 #</p>
4615 # But I think this test is bordering on "garbage in, garbage out" anyway.
4616 # -- wtm
4617 !! test
4618 Piped link to URL
4619 !! input
4620 Piped link to URL: [[http://www.example.com|an example URL]]
4621 !! result
4622 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4623 </p>
4624 !! end
4625
4626 !! test
4627 BUG 2: [[page|http://url/]] should link to page, not http://url/
4628 !! input
4629 [[Main Page|http://url/]]
4630 !! result
4631 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4632 </p>
4633 !! end
4634
4635 !! test
4636 BUG 337: Escaped self-links should be bold
4637 !! options
4638 title=[[Bug462]]
4639 !! input
4640 [[Bu&#103;462]] [[Bug462]]
4641 !! result
4642 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4643 </p>
4644 !! end
4645
4646 !! test
4647 Self-link to section should not be bold
4648 !! options
4649 title=[[Main Page]]
4650 !! input
4651 [[Main Page#section]]
4652 !! result
4653 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4654 </p>
4655 !! end
4656
4657 !! article
4658 00
4659 !! text
4660 This is 00.
4661 !! endarticle
4662
4663 !!test
4664 Self-link to numeric title
4665 !!options
4666 title=[[0]]
4667 !!input
4668 [[0]]
4669 !!result
4670 <p><strong class="selflink">0</strong>
4671 </p>
4672 !!end
4673
4674 !!test
4675 Link to numeric-equivalent title
4676 !!options
4677 title=[[0]]
4678 !!input
4679 [[00]]
4680 !!result
4681 <p><a href="/wiki/00" title="00">00</a>
4682 </p>
4683 !!end
4684
4685 !! test
4686 <nowiki> inside a link
4687 !! input
4688 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4689 !! result
4690 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4691 </p>
4692 !! end
4693
4694 !! test
4695 Non-breaking spaces in title
4696 !! input
4697 [[&nbsp; Main &nbsp; Page &nbsp;]]
4698 !! result
4699 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4700 </p>
4701 !!end
4702
4703 !! test
4704 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4705 !! options
4706 language=ca
4707 !! input
4708 '''[[Main Page]]'''
4709 !! result
4710 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4711 </p>
4712 !! end
4713
4714 !! test
4715 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4716 !! options
4717 language=ca
4718 !! input
4719 ''[[Main Page]]''
4720 !! result
4721 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4722 </p>
4723 !! end
4724
4725 !! test
4726 Internal link with en linktrail: no apostrophes (bug 27473)
4727 !! options
4728 language=en
4729 !! input
4730 [[Something]]'nice
4731 !! result
4732 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4733 </p>
4734 !! end
4735
4736 !! test
4737 Internal link with ca linktrail with apostrophes (bug 27473)
4738 !! options
4739 language=ca
4740 !! input
4741 [[Something]]'nice
4742 !! result
4743 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4744 </p>
4745 !! end
4746
4747 !! test
4748 Internal link with kaa linktrail with apostrophes (bug 27473)
4749 !! options
4750 language=kaa
4751 !! input
4752 [[Something]]'nice
4753 !! result
4754 <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>
4755 </p>
4756 !! end
4757
4758 !! article
4759 Söfnuður
4760 !! text
4761 Test.
4762 !! endarticle
4763
4764 !! test
4765 Internal link with is link prefix
4766 !! options
4767 language=is
4768 !! input
4769 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4770 !! result
4771 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4772 </p>
4773 !! end
4774
4775 !! article
4776 Mótmælendatrú
4777 !! text
4778 Test.
4779 !! endarticle
4780
4781 !! test
4782 Internal link with is link trail and link prefix
4783 !! options
4784 language=is
4785 !! input
4786 [[mótmælendatrú|xxx]]ar
4787 [[mótmælendatrú]]ar
4788 mótmælenda[[söfnuður]]
4789 mótmælenda[[söfnuður|söfnuðir]]
4790 mótmælenda[[söfnuður|söfnuðir]]xxx
4791 !! result
4792 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4793 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4794 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4795 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4796 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Parsoid link trail escaping
4802 !! options
4803 parsoid=html2wt,html2html
4804 !! input
4805 [[apple]]<nowiki/>s
4806 !! result
4807 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4808 !! end
4809
4810 !! test
4811 Parsoid link prefix escaping
4812 !! options
4813 language=is
4814 parsoid=html2wt,html2html
4815 !! input
4816 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4817 !! result
4818 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4819 !! end
4820
4821 !! test
4822 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4823 !! input
4824 [[Foo| bar]]
4825
4826 [[Foo| ''bar'']]
4827
4828 [http://wp.org foo]
4829
4830 [http://wp.org ''foo'']
4831 !! result
4832 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4833 </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>
4834 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4835 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4836 </p>
4837 !! end
4838
4839 ###
4840 ### Interwiki links (see maintenance/interwiki.sql)
4841 ###
4842
4843 !! test
4844 Inline interwiki link
4845 !! input
4846 [[MeatBall:SoftSecurity]]
4847 !! result
4848 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4849 </p>
4850 !! end
4851
4852 !! test
4853 Inline interwiki link with empty title (bug 2372)
4854 !! input
4855 [[MeatBall:]]
4856 !! result
4857 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4858 </p>
4859 !! end
4860
4861 !! test
4862 Interwiki link encoding conversion (bug 1636)
4863 !! input
4864 *[[Wikipedia:ro:Olteni&#0355;a]]
4865 *[[Wikipedia:ro:Olteni&#355;a]]
4866 !! result
4867 <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>
4868 </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>
4869 </li></ul>
4870
4871 !! end
4872
4873 !! test
4874 Interwiki link with fragment (bug 2130)
4875 !! input
4876 [[MeatBall:SoftSecurity#foo]]
4877 !! result
4878 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 Interlanguage link
4884 !! input
4885 Blah blah blah
4886 [[zh:Chinese]]
4887 !!result
4888 <p>Blah blah blah
4889 </p>
4890 !! end
4891
4892 !! test
4893 Double interlanguage link
4894 !! input
4895 Blah blah blah
4896 [[es:Spanish]]
4897 [[zh:Chinese]]
4898 !!result
4899 <p>Blah blah blah
4900 </p>
4901 !! end
4902
4903 !! test
4904 Interlanguage link, with prefix links
4905 !! options
4906 language=ln
4907 !! input
4908 Blah blah blah
4909 [[zh:Chinese]]
4910 !!result
4911 <p>Blah blah blah
4912 </p>
4913 !! end
4914
4915 !! test
4916 Double interlanguage link, with prefix links (bug 8897)
4917 !! options
4918 language=ln
4919 !! input
4920 Blah blah blah
4921 [[es:Spanish]]
4922 [[zh:Chinese]]
4923 !!result
4924 <p>Blah blah blah
4925 </p>
4926 !! end
4927
4928 !! test
4929 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4930 !! options
4931 language=ln
4932 !! input
4933 [[WW&nbsp;II]]
4934 !!result
4935 <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>
4936 </p>
4937 !! end
4938
4939 !! test
4940 Parsoid: handle constructor well
4941 !! options
4942 parsoid
4943 !! input
4944 [[constructor]]
4945
4946 [[constructor:foo]]
4947 !! result
4948 <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>
4949
4950
4951 <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>
4952 !! end
4953
4954 ##
4955 ## Redirects, Parsoid-only
4956 ##
4957 !! test
4958 Simple redirect to page
4959 !! options
4960 parsoid
4961 !! input
4962 #REDIRECT [[Main Page]]
4963 !! result
4964 <link rel="mw:PageProp/redirect" href="./Main_Page">
4965 !! end
4966
4967 !! test
4968 Optional colon in #REDIRECT
4969 !! options
4970 # the colon is archaic syntax. we support it for wt2html, but we
4971 # don't care that it roundtrips back to the modern syntax.
4972 parsoid=wt2html,html2html
4973 !! input
4974 #REDIRECT:[[Main Page]]
4975 !! result
4976 <link rel="mw:PageProp/redirect" href="./Main_Page">
4977 !! end
4978
4979 !! test
4980 Whitespace in #REDIRECT with optional colon
4981 !! options
4982 # the colon and gratuitous whitespace is archaic syntax. we support
4983 # it for wt2html, but we don't care that it roundtrips back to the
4984 # modern syntax (without extra whitespace)
4985 parsoid=wt2html,html2html
4986 !! input
4987
4988 #REDIRECT
4989 :
4990 [[Main Page]]
4991 !! result
4992 <link rel="mw:PageProp/redirect" href="./Main_Page">
4993 !! end
4994
4995 !! test
4996 Piped link in #REDIRECT
4997 !! options
4998 # content after piped link is ignored. we support this syntax,
4999 # but don't care that the piped link is lost when we roundtrip this.
5000 parsoid=wt2html
5001 !! input
5002 #REDIRECT [[Main Page|bar]]
5003 !! result
5004 <link rel="mw:PageProp/redirect" href="./Main_Page">
5005 !! end
5006
5007 !! test
5008 Redirect to category
5009 !! options
5010 parsoid=wt2html
5011 !! input
5012 #REDIRECT [[Category:Foo]]
5013 !! result
5014 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5015 !! end
5016
5017 !! test
5018 Redirect to category with URL encoding
5019 !! options
5020 parsoid=wt2html
5021 !! input
5022 #REDIRECT [[Category%3AFoo]]
5023 !! result
5024 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5025 !! end
5026
5027 !! test
5028 Redirect to category page
5029 !! options
5030 parsoid=wt2html,html2html
5031 !! input
5032 #REDIRECT [[:Category:Foo]]
5033 !! result
5034 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5035 !! end
5036
5037 !! test
5038 Redirect to image page (1)
5039 !! options
5040 parsoid
5041 !! input
5042 #REDIRECT [[File:Wiki.png]]
5043 !! result
5044 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5045 !! end
5046
5047 !! test
5048 Redirect to image page (2)
5049 !! options
5050 parsoid
5051 !! input
5052 #REDIRECT [[Image:Wiki.png]]
5053 !! result
5054 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5055 !! end
5056
5057 !! test
5058 Redirect to language
5059 !! options
5060 parsoid
5061 !! input
5062 #REDIRECT [[en:File:Wiki.png]]
5063 !! result
5064 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5065 !! end
5066
5067 !! test
5068 Redirect to interwiki
5069 !! options
5070 parsoid
5071 !! input
5072 #REDIRECT [[meatball:File:Wiki.png]]
5073 !! result
5074 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5075 !! end
5076
5077 !! test
5078 Non-English #REDIRECT
5079 !! options
5080 parsoid
5081 language=is
5082 !! input
5083 #TILVÍSUN [[Main Page]]
5084 !! result
5085 <link rel="mw:PageProp/redirect" href="./Main_Page">
5086 !! end
5087
5088 ##
5089 ## XHTML tidiness
5090 ###
5091
5092 !! test
5093 <br> to <br />
5094 !! input
5095 1<br>2<br />3
5096 !! result
5097 <p>1<br />2<br />3
5098 </p>
5099 !! end
5100
5101 !! test
5102 Broken br tag sanitization
5103 !! options
5104 php
5105 !! input
5106 </br>
5107 !! result
5108 <p>&lt;/br&gt;
5109 </p>
5110 !! end
5111
5112 # TODO: Fix html2html mode (bug 51055)!
5113 !! test
5114 Parsoid: Broken br tag recognition
5115 !! options
5116 parsoid=wt2html
5117 !! input
5118 </br>
5119 !! result
5120 <p><br></p>
5121 !! end
5122
5123 !! test
5124 Incorrecly removing closing slashes from correctly formed XHTML
5125 !! input
5126 <br style="clear:both;" />
5127 !! result
5128 <p><br style="clear:both;" />
5129 </p>
5130 !! end
5131
5132 !! test
5133 Failing to transform badly formed HTML into correct XHTML
5134 !! input
5135 <br style="clear: left;">
5136 <br style="clear: right;">
5137 <br style="clear: both;">
5138 !! result
5139 <p><br style="clear: left;" />
5140 <br style="clear: right;" />
5141 <br style="clear: both;" />
5142 </p>
5143 !!end
5144
5145 !! test
5146 Handling html with a div self-closing tag
5147 !! input
5148 <div title />
5149 <div title/>
5150 <div title/ >
5151 <div title=bar />
5152 <div title=bar/>
5153 <div title=bar/ >
5154 !! result
5155 <p>&lt;div title /&gt;
5156 &lt;div title/&gt;
5157 </p>
5158 <div>
5159 <p>&lt;div title=bar /&gt;
5160 &lt;div title=bar/&gt;
5161 </p>
5162 <div title="bar/"></div>
5163 </div>
5164
5165 !! end
5166
5167 !! test
5168 Handling html with a br self-closing tag
5169 !! input
5170 <br title />
5171 <br title/>
5172 <br title/ >
5173 <br title=bar />
5174 <br title=bar/>
5175 <br title=bar/ >
5176 !! result
5177 <p><br title="title" />
5178 <br title="title" />
5179 <br />
5180 <br title="bar" />
5181 <br title="bar" />
5182 <br title="bar/" />
5183 </p>
5184 !! end
5185
5186 !! test
5187 Horizontal ruler (should it add that extra space?)
5188 !! input
5189 <hr>
5190 <hr >
5191 foo <hr
5192 > bar
5193 !! result
5194 <hr />
5195 <hr />
5196 foo <hr /> bar
5197
5198 !! end
5199
5200 !! test
5201 Horizontal ruler -- 4+ dashes render hr
5202 !! input
5203 ----
5204 !! result
5205 <hr />
5206
5207 !! end
5208
5209 !! test
5210 Horizontal ruler -- eats additional dashes on the same line
5211 !! input
5212 ---------
5213 !! result
5214 <hr />
5215
5216 !! end
5217
5218 !! test
5219 Horizontal ruler -- does not collapse dashes on consecutive lines
5220 !! input
5221 ----
5222 ----
5223 !! result
5224 <hr />
5225 <hr />
5226
5227 !! end
5228
5229 !! test
5230 Horizontal ruler -- <4 dashes render as plain text
5231 !! input
5232 ---
5233 !! result
5234 <p>---
5235 </p>
5236 !! end
5237
5238 !! test
5239 Horizontal ruler -- Supports content following dashes on same line
5240 !! input
5241 ---- Foo
5242 !! result
5243 <hr /> Foo
5244
5245 !! end
5246
5247 ###
5248 ### Block-level elements
5249 ###
5250 !! test
5251 Common list
5252 !! input
5253 *Common list
5254 * item 2
5255 *item 3
5256 !! result
5257 <ul><li>Common list
5258 </li><li> item 2
5259 </li><li>item 3
5260 </li></ul>
5261
5262 !! end
5263
5264 !! test
5265 Numbered list
5266 !! input
5267 #Numbered list
5268 #item 2
5269 # item 3
5270 !! result
5271 <ol><li>Numbered list
5272 </li><li>item 2
5273 </li><li> item 3
5274 </li></ol>
5275
5276 !! end
5277
5278 !! test
5279 Mixed list
5280 !! input
5281 *Mixed list
5282 *# with numbers
5283 ** and bullets
5284 *# and numbers
5285 *bullets again
5286 **bullet level 2
5287 ***bullet level 3
5288 ***#Number on level 4
5289 **bullet level 2
5290 **#Number on level 3
5291 **#Number on level 3
5292 *#number level 2
5293 *Level 1
5294 *** Level 3
5295 #** Level 3, but ordered
5296 !! result
5297 <ul><li>Mixed list
5298 <ol><li> with numbers
5299 </li></ol>
5300 <ul><li> and bullets
5301 </li></ul>
5302 <ol><li> and numbers
5303 </li></ol>
5304 </li><li>bullets again
5305 <ul><li>bullet level 2
5306 <ul><li>bullet level 3
5307 <ol><li>Number on level 4
5308 </li></ol>
5309 </li></ul>
5310 </li><li>bullet level 2
5311 <ol><li>Number on level 3
5312 </li><li>Number on level 3
5313 </li></ol>
5314 </li></ul>
5315 <ol><li>number level 2
5316 </li></ol>
5317 </li><li>Level 1
5318 <ul><li><ul><li> Level 3
5319 </li></ul>
5320 </li></ul>
5321 </li></ul>
5322 <ol><li><ul><li><ul><li> Level 3, but ordered
5323 </li></ul>
5324 </li></ul>
5325 </li></ol>
5326
5327 !! end
5328
5329 !! test
5330 Nested lists 1
5331 !! input
5332 *foo
5333 **bar
5334 !! result
5335 <ul><li>foo
5336 <ul><li>bar
5337 </li></ul>
5338 </li></ul>
5339
5340 !! end
5341
5342 !! test
5343 Nested lists 2
5344 !! input
5345 **foo
5346 *bar
5347 !! result
5348 <ul><li><ul><li>foo
5349 </li></ul>
5350 </li><li>bar
5351 </li></ul>
5352
5353 !! end
5354
5355 !! test
5356 Nested lists 3 (first element empty)
5357 !! input
5358 *
5359 **bar
5360 !! result
5361 <ul><li>
5362 <ul><li>bar
5363 </li></ul>
5364 </li></ul>
5365
5366 !! end
5367
5368 !! test
5369 Nested lists 4 (first element empty)
5370 !! input
5371 **
5372 *bar
5373 !! result
5374 <ul><li><ul><li>
5375 </li></ul>
5376 </li><li>bar
5377 </li></ul>
5378
5379 !! end
5380
5381 !! test
5382 Nested lists 5 (both elements empty)
5383 !! input
5384 **
5385 *
5386 !! result
5387 <ul><li><ul><li>
5388 </li></ul>
5389 </li><li>
5390 </li></ul>
5391
5392 !! end
5393
5394 !! test
5395 Nested lists 6 (both elements empty)
5396 !! input
5397 *
5398 **
5399 !! result
5400 <ul><li>
5401 <ul><li>
5402 </li></ul>
5403 </li></ul>
5404
5405 !! end
5406
5407 !! test
5408 Nested lists 7 (skip initial nesting levels)
5409 !! input
5410 *** foo
5411 !! result
5412 <ul><li><ul><li><ul><li> foo
5413 </li></ul>
5414 </li></ul>
5415 </li></ul>
5416
5417 !! end
5418
5419 !! test
5420 Nested lists 8 (multiple nesting transitions)
5421 !! input
5422 * foo
5423 *** bar
5424 ** baz
5425 * boo
5426 !! result
5427 <ul><li> foo
5428 <ul><li><ul><li> bar
5429 </li></ul>
5430 </li><li> baz
5431 </li></ul>
5432 </li><li> boo
5433 </li></ul>
5434
5435 !! end
5436
5437 !! test
5438 1. Lists with start-of-line-transparent tokens before bullets: Comments
5439 !! input
5440 *foo
5441 *<!--cmt-->bar
5442 <!--cmt-->*baz
5443 !! result
5444 <ul><li>foo
5445 </li><li>bar
5446 </li><li>baz
5447 </li></ul>
5448
5449 !! end
5450
5451 !! test
5452 2. Lists with start-of-line-transparent tokens before bullets: Template close
5453 !! input
5454 *foo {{echo|bar
5455 }}*baz
5456 !! result
5457 <ul><li>foo bar
5458 </li><li>baz
5459 </li></ul>
5460
5461 !! end
5462
5463 !! test
5464 List items are not parsed correctly following a <pre> block (bug 785)
5465 !! input
5466 * <pre>foo</pre>
5467 * <pre>bar</pre>
5468 * zar
5469 !! result
5470 <ul><li> <pre>foo</pre>
5471 </li><li> <pre>bar</pre>
5472 </li><li> zar
5473 </li></ul>
5474
5475 !! end
5476
5477 !! test
5478 List items from template
5479 !! input
5480
5481 {{inner list}}
5482 * item 2
5483
5484 * item 0
5485 {{inner list}}
5486 * item 2
5487
5488 * item 0
5489 * notSOL{{inner list}}
5490 * item 2
5491 !! result
5492 <ul><li> item 1
5493 </li><li> item 2
5494 </li></ul>
5495 <ul><li> item 0
5496 </li><li> item 1
5497 </li><li> item 2
5498 </li></ul>
5499 <ul><li> item 0
5500 </li><li> notSOL
5501 </li><li> item 1
5502 </li><li> item 2
5503 </li></ul>
5504
5505 !! end
5506
5507 !! test
5508 List interrupted by empty line or heading
5509 !! input
5510 * foo
5511
5512 ** bar
5513 == A heading ==
5514 * Another list item
5515 !! result
5516 <ul><li> foo
5517 </li></ul>
5518 <ul><li><ul><li> bar
5519 </li></ul>
5520 </li></ul>
5521 <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>
5522 <ul><li> Another list item
5523 </li></ul>
5524
5525 !!end
5526
5527 !!test
5528 Multiple list tags generated by templates
5529 !!input
5530 {{echo|<li>}}a
5531 {{echo|<li>}}b
5532 {{echo|<li>}}c
5533 !!result
5534 <li>a
5535 <li>b
5536 <li>c</li>
5537 </li>
5538 </li>
5539
5540 !!end
5541
5542 !!test
5543 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5544 !!input
5545 *a
5546 <!--This line will NOT split the list-->
5547 *b
5548 <!--This line will NOT split the list either-->
5549 *c
5550 <!--foo--> <!----> <!--This line NOT split the list either-->
5551 *d
5552 !!result
5553 <ul><li>a
5554 </li><li>b
5555 </li><li>c
5556 </li><li>d
5557 </li></ul>
5558
5559 !!end
5560
5561 !!test
5562 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5563 !!input
5564 *a
5565 <!--This line will NOT split the list-->
5566 *b
5567 <!--This line will NOT split the list either-->
5568 *c
5569 <!--foo--> <!----> <!--This line NOT split the list
5570 either-->
5571 *d
5572 !!result
5573 <ul><li>a
5574 </li><li>b
5575 </li><li>c
5576 </li><li>d
5577 </li></ul>
5578
5579 !!end
5580
5581 !!test
5582 Test the li-hack
5583 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5584 !!options
5585 parsoid=wt2html,wt2wt
5586 !!input
5587 * foo
5588 * <li>li-hack
5589 * {{echo|<li>templated li-hack}}
5590 * <!--foo--> <li> unsupported li-hack with preceding comments
5591
5592 <ul>
5593 <li><li>not a li-hack
5594 </li>
5595 </ul>
5596 !!result
5597 <ul><li> foo</li>
5598 <li>li-hack</li>
5599 <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>
5600 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5601
5602 <ul>
5603 <li></li><li>not a li-hack
5604 </li>
5605 </ul>
5606 !!end
5607
5608 !! test
5609 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5610 !! options
5611 parsoid
5612 !! input
5613 # foo
5614 ## bar
5615 * foo
5616 ** bar
5617 : foo
5618 :: bar
5619 !! result
5620 <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>
5621 !! end
5622
5623 !! test
5624 Parsoid: Test of whitespace serialization with Templated bullets
5625 !! options
5626 parsoid
5627 !! input
5628 * {{bullet}}
5629 !! result
5630 <ul>
5631 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5632 </ul>
5633 !! end
5634
5635 # ------------------------------------------------------------------------
5636 # The next set of tests are about Parsoid's ability to handle badly nested
5637 # tags (parse, minimize scope of fixup, and roundtrip back)
5638 # ------------------------------------------------------------------------
5639
5640 !! test
5641 Unbalanced closing block tags break a list
5642 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5643 !! options
5644 parsoid
5645 !! input
5646 <div>
5647 *a</div><div>
5648 *b</div>
5649 !! result
5650 <div>
5651 <ul><li>a
5652 </li></ul></div><div>
5653 <ul><li>b
5654 </li></ul></div>
5655 !! end
5656
5657 !! test
5658 Unbalanced closing non-block tags don't break a list
5659 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5660 !! options
5661 parsoid
5662 !! input
5663 <span>
5664 *a</span><span>
5665 *b</span>
5666 !! result
5667 <p><span></span>
5668 </p>
5669 <ul><li>a<span></span>
5670 </li><li>b
5671 </li></ul>
5672 !! end
5673
5674 !! test
5675 Unclosed formatting tags that straddle lists are closed and reopened
5676 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5677 !! options
5678 parsoid
5679 !! input
5680 # <s> a
5681 # b </s>
5682 !! result
5683 <ol><li> <s> a </s>
5684 </li><li> <s> b </s>
5685 </li></ol>
5686 !! end
5687
5688 !!test
5689 List embedded in a non-block tag
5690 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5691 !! options
5692 parsoid
5693 !!input
5694 <small>
5695 * foo
5696 </small>
5697 !!result
5698 <p><small></small></p>
5699 <small>
5700 <ul>
5701 <li> foo</li>
5702 </ul>
5703 </small>
5704 <p><small></small></p>
5705 !!end
5706
5707 ###
5708 ### Magic Words
5709 ###
5710
5711 # Note that the current date is hard-coded as
5712 # 1970-01-01T00:02:03Z (a Thursday)
5713 # when running parser tests. The timezone is also fixed to GMT, so
5714 # local date will be identical to current date.
5715
5716 !! test
5717 Magic Word: {{CURRENTDAY}}
5718 !! input
5719 {{CURRENTDAY}}
5720 !! result
5721 <p>1
5722 </p>
5723 !! end
5724
5725 !! test
5726 Magic Word: {{CURRENTDAY2}}
5727 !! input
5728 {{CURRENTDAY2}}
5729 !! result
5730 <p>01
5731 </p>
5732 !! end
5733
5734 !! test
5735 Magic Word: {{CURRENTDAYNAME}}
5736 !! input
5737 {{CURRENTDAYNAME}}
5738 !! result
5739 <p>Thursday
5740 </p>
5741 !! end
5742
5743 !! test
5744 Magic Word: {{CURRENTDOW}}
5745 !! input
5746 {{CURRENTDOW}}
5747 !! result
5748 <p>4
5749 </p>
5750 !! end
5751
5752 !! test
5753 Magic Word: {{CURRENTMONTH}}
5754 !! input
5755 {{CURRENTMONTH}}
5756 !! result
5757 <p>01
5758 </p>
5759 !! end
5760
5761 !! test
5762 Magic Word: {{CURRENTMONTH1}}
5763 !! input
5764 {{CURRENTMONTH1}}
5765 !! result
5766 <p>1
5767 </p>
5768 !! end
5769
5770 !! test
5771 Magic Word: {{CURRENTMONTHABBREV}}
5772 !! input
5773 {{CURRENTMONTHABBREV}}
5774 !! result
5775 <p>Jan
5776 </p>
5777 !! end
5778
5779 !! test
5780 Magic Word: {{CURRENTMONTHNAME}}
5781 !! input
5782 {{CURRENTMONTHNAME}}
5783 !! result
5784 <p>January
5785 </p>
5786 !! end
5787
5788 !! test
5789 Magic Word: {{CURRENTMONTHNAMEGEN}}
5790 !! input
5791 {{CURRENTMONTHNAMEGEN}}
5792 !! result
5793 <p>January
5794 </p>
5795 !! end
5796
5797 !! test
5798 Magic Word: {{CURRENTTIME}}
5799 !! input
5800 {{CURRENTTIME}}
5801 !! result
5802 <p>00:02
5803 </p>
5804 !! end
5805
5806 !! test
5807 Magic Word: {{CURRENTHOUR}}
5808 !! input
5809 {{CURRENTHOUR}}
5810 !! result
5811 <p>00
5812 </p>
5813 !! end
5814
5815 !! test
5816 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5817 !! input
5818 {{CURRENTWEEK}}
5819 !! result
5820 <p>1
5821 </p>
5822 !! end
5823
5824 !! test
5825 Magic Word: {{CURRENTYEAR}}
5826 !! input
5827 {{CURRENTYEAR}}
5828 !! result
5829 <p>1970
5830 </p>
5831 !! end
5832
5833 !! test
5834 Magic Word: {{CURRENTTIMESTAMP}}
5835 !! input
5836 {{CURRENTTIMESTAMP}}
5837 !! result
5838 <p>19700101000203
5839 </p>
5840 !! end
5841
5842 !! test
5843 Magic Words LOCAL (UTC)
5844 !! input
5845 * {{LOCALMONTH}}
5846 * {{LOCALMONTH1}}
5847 * {{LOCALMONTHNAME}}
5848 * {{LOCALMONTHNAMEGEN}}
5849 * {{LOCALMONTHABBREV}}
5850 * {{LOCALDAY}}
5851 * {{LOCALDAY2}}
5852 * {{LOCALDAYNAME}}
5853 * {{LOCALYEAR}}
5854 * {{LOCALTIME}}
5855 * {{LOCALHOUR}}
5856 * {{LOCALWEEK}}
5857 * {{LOCALDOW}}
5858 * {{LOCALTIMESTAMP}}
5859 !! result
5860 <ul><li> 01
5861 </li><li> 1
5862 </li><li> January
5863 </li><li> January
5864 </li><li> Jan
5865 </li><li> 1
5866 </li><li> 01
5867 </li><li> Thursday
5868 </li><li> 1970
5869 </li><li> 00:02
5870 </li><li> 00
5871 </li><li> 1
5872 </li><li> 4
5873 </li><li> 19700101000203
5874 </li></ul>
5875
5876 !! end
5877
5878 !! test
5879 Magic Word: {{FULLPAGENAME}}
5880 !! options
5881 title=[[User:Ævar Arnfjörð Bjarmason]]
5882 !! input
5883 {{FULLPAGENAME}}
5884 !! result
5885 <p>User:Ævar Arnfjörð Bjarmason
5886 </p>
5887 !! end
5888
5889 !! test
5890 Magic Word: {{FULLPAGENAMEE}}
5891 !! options
5892 title=[[User:Ævar Arnfjörð Bjarmason]]
5893 !! input
5894 {{FULLPAGENAMEE}}
5895 !! result
5896 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5897 </p>
5898 !! end
5899
5900 !! test
5901 Magic Word: {{TALKSPACE}}
5902 !! options
5903 title=[[User:Ævar Arnfjörð Bjarmason]]
5904 !! input
5905 {{TALKSPACE}}
5906 !! result
5907 <p>User talk
5908 </p>
5909 !! end
5910
5911 !! test
5912 Magic Word: {{TALKSPACE}}, same namespace
5913 !! options
5914 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5915 !! input
5916 {{TALKSPACE}}
5917 !! result
5918 <p>User talk
5919 </p>
5920 !! end
5921
5922 !! test
5923 Magic Word: {{TALKSPACE}}, main namespace
5924 !! options
5925 title=[[Parser Test]]
5926 !! input
5927 {{TALKSPACE}}
5928 !! result
5929 <p>Talk
5930 </p>
5931 !! end
5932
5933 !! test
5934 Magic Word: {{TALKSPACEE}}
5935 !! options
5936 title=[[User:Ævar Arnfjörð Bjarmason]]
5937 !! input
5938 {{TALKSPACEE}}
5939 !! result
5940 <p>User_talk
5941 </p>
5942 !! end
5943
5944 !! test
5945 Magic Word: {{SUBJECTSPACE}}
5946 !! options
5947 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5948 !! input
5949 {{SUBJECTSPACE}}
5950 !! result
5951 <p>User
5952 </p>
5953 !! end
5954
5955 !! test
5956 Magic Word: {{SUBJECTSPACE}}, same namespace
5957 !! options
5958 title=[[User:Ævar Arnfjörð Bjarmason]]
5959 !! input
5960 {{SUBJECTSPACE}}
5961 !! result
5962 <p>User
5963 </p>
5964 !! end
5965
5966 !! test
5967 Magic Word: {{SUBJECTSPACE}}, main namespace
5968 !! options
5969 title=[[Parser Test]]
5970 !! input
5971 {{SUBJECTSPACE}}
5972 !! result
5973
5974 !! end
5975
5976 !! test
5977 Magic Word: {{SUBJECTSPACEE}}
5978 !! options
5979 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5980 !! input
5981 {{SUBJECTSPACEE}}
5982 !! result
5983 <p>User
5984 </p>
5985 !! end
5986
5987 !! test
5988 Magic Word: {{NAMESPACE}}
5989 !! options
5990 title=[[User:Ævar Arnfjörð Bjarmason]]
5991 !! input
5992 {{NAMESPACE}}
5993 !! result
5994 <p>User
5995 </p>
5996 !! end
5997
5998 !! test
5999 Magic Word: {{NAMESPACEE}}
6000 !! options
6001 title=[[User:Ævar Arnfjörð Bjarmason]]
6002 !! input
6003 {{NAMESPACEE}}
6004 !! result
6005 <p>User
6006 </p>
6007 !! end
6008
6009 !! test
6010 Magic Word: {{NAMESPACENUMBER}}
6011 !! options
6012 title=[[User:Ævar Arnfjörð Bjarmason]]
6013 !! input
6014 {{NAMESPACENUMBER}}
6015 !! result
6016 <p>2
6017 </p>
6018 !! end
6019
6020 !! test
6021 Magic Word: {{SUBPAGENAME}}
6022 !! options
6023 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6024 !! input
6025 {{SUBPAGENAME}}
6026 !! result
6027 <p>sub ö
6028 </p>
6029 !! end
6030
6031 !! test
6032 Magic Word: {{SUBPAGENAMEE}}
6033 !! options
6034 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6035 !! input
6036 {{SUBPAGENAMEE}}
6037 !! result
6038 <p>sub_%C3%B6
6039 </p>
6040 !! end
6041
6042 !! test
6043 Magic Word: {{ROOTPAGENAME}}
6044 !! options
6045 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6046 !! input
6047 {{ROOTPAGENAME}}
6048 !! result
6049 <p>Ævar Arnfjörð Bjarmason
6050 </p>
6051 !! end
6052
6053 !! test
6054 Magic Word: {{ROOTPAGENAMEE}}
6055 !! options
6056 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6057 !! input
6058 {{ROOTPAGENAMEE}}
6059 !! result
6060 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6061 </p>
6062 !! end
6063
6064 !! test
6065 Magic Word: {{BASEPAGENAME}}
6066 !! options
6067 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6068 !! input
6069 {{BASEPAGENAME}}
6070 !! result
6071 <p>Ævar Arnfjörð Bjarmason
6072 </p>
6073 !! end
6074
6075 !! test
6076 Magic Word: {{BASEPAGENAMEE}}
6077 !! options
6078 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6079 !! input
6080 {{BASEPAGENAMEE}}
6081 !! result
6082 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6083 </p>
6084 !! end
6085
6086 !! test
6087 Magic Word: {{TALKPAGENAME}}
6088 !! options
6089 title=[[User:Ævar Arnfjörð Bjarmason]]
6090 !! input
6091 {{TALKPAGENAME}}
6092 !! result
6093 <p>User talk:Ævar Arnfjörð Bjarmason
6094 </p>
6095 !! end
6096
6097 !! test
6098 Magic Word: {{TALKPAGENAMEE}}
6099 !! options
6100 title=[[User:Ævar Arnfjörð Bjarmason]]
6101 !! input
6102 {{TALKPAGENAMEE}}
6103 !! result
6104 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6105 </p>
6106 !! end
6107
6108 !! test
6109 Magic Word: {{SUBJECTPAGENAME}}
6110 !! options
6111 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6112 !! input
6113 {{SUBJECTPAGENAME}}
6114 !! result
6115 <p>User:Ævar Arnfjörð Bjarmason
6116 </p>
6117 !! end
6118
6119 !! test
6120 Magic Word: {{SUBJECTPAGENAMEE}}
6121 !! options
6122 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6123 !! input
6124 {{SUBJECTPAGENAMEE}}
6125 !! result
6126 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6127 </p>
6128 !! end
6129
6130 !! test
6131 Magic Word: {{NUMBEROFFILES}}
6132 !! input
6133 {{NUMBEROFFILES}}
6134 !! result
6135 <p>4
6136 </p>
6137 !! end
6138
6139 !! test
6140 Magic Word: {{PAGENAME}}
6141 !! options
6142 title=[[User:Ævar Arnfjörð Bjarmason]]
6143 !! input
6144 {{PAGENAME}}
6145 !! result
6146 <p>Ævar Arnfjörð Bjarmason
6147 </p>
6148 !! end
6149
6150 !! test
6151 Magic Word: {{PAGENAME}} with metacharacters
6152 !! options
6153 title=[['foo & bar = baz']]
6154 !! input
6155 ''{{PAGENAME}}''
6156 !! result
6157 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6158 </p>
6159 !! end
6160
6161 !! test
6162 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6163 !! options
6164 title=[[*RFC 1234 http://example.com/]]
6165 !! input
6166 {{PAGENAME}}
6167 !! result
6168 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6169 </p>
6170 !! end
6171
6172 !! test
6173 Magic Word: {{PAGENAMEE}}
6174 !! options
6175 title=[[User:Ævar Arnfjörð Bjarmason]]
6176 !! input
6177 {{PAGENAMEE}}
6178 !! result
6179 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6180 </p>
6181 !! end
6182
6183 !! test
6184 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6185 !! options
6186 title=[[*RFC 1234 http://example.com/]]
6187 !! input
6188 {{PAGENAMEE}}
6189 !! result
6190 <p>&#42;RFC_1234_http&#58;//example.com/
6191 </p>
6192 !! end
6193
6194 !! test
6195 Magic Word: {{REVISIONID}}
6196 !! input
6197 {{REVISIONID}}
6198 !! result
6199 <p>1337
6200 </p>
6201 !! end
6202
6203 !! test
6204 Magic Word: {{SCRIPTPATH}}
6205 !! input
6206 {{SCRIPTPATH}}
6207 !! result
6208 <p>/
6209 </p>
6210 !! end
6211
6212 !! test
6213 Magic Word: {{STYLEPATH}}
6214 !! input
6215 {{STYLEPATH}}
6216 !! result
6217 <p>/skins
6218 </p>
6219 !! end
6220
6221 !! test
6222 Magic Word: {{SERVER}}
6223 !! input
6224 {{SERVER}}
6225 !! result
6226 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6227 </p>
6228 !! end
6229
6230 !! test
6231 Magic Word: {{SERVERNAME}}
6232 !! input
6233 {{SERVERNAME}}
6234 !! result
6235 <p>example.org
6236 </p>
6237 !! end
6238
6239 !! test
6240 Magic Word: {{SITENAME}}
6241 !! input
6242 {{SITENAME}}
6243 !! result
6244 <p>MediaWiki
6245 </p>
6246 !! end
6247
6248 !! test
6249 Case-sensitive magic words, when cased differently, should just be template transclusions
6250 !! input
6251 {{CurrentMonth}}
6252 {{currentday}}
6253 {{cURreNTweEK}}
6254 {{currentHour}}
6255 !! result
6256 <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>
6257 <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>
6258 <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>
6259 <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>
6260 </p>
6261 !! end
6262
6263 !! test
6264 Case-insensitive magic words should still work with weird casing.
6265 !! input
6266 {{sErVeRNaMe}}
6267 {{LCFirst:AOEU}}
6268 {{ucFIRST:aoeu}}
6269 {{SERver}}
6270 !! result
6271 <p>example.org
6272 aOEU
6273 Aoeu
6274 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6275 </p>
6276 !! end
6277
6278 !! test
6279 Namespace 1 {{ns:1}}
6280 !! input
6281 {{ns:1}}
6282 !! result
6283 <p>Talk
6284 </p>
6285 !! end
6286
6287 !! test
6288 Namespace 1 {{ns:01}}
6289 !! input
6290 {{ns:01}}
6291 !! result
6292 <p>Talk
6293 </p>
6294 !! end
6295
6296 !! test
6297 Namespace 0 {{ns:0}} (bug 4783)
6298 !! input
6299 {{ns:0}}
6300 !! result
6301
6302 !! end
6303
6304 !! test
6305 Namespace 0 {{ns:00}} (bug 4783)
6306 !! input
6307 {{ns:00}}
6308 !! result
6309
6310 !! end
6311
6312 !! test
6313 Namespace -1 {{ns:-1}}
6314 !! input
6315 {{ns:-1}}
6316 !! result
6317 <p>Special
6318 </p>
6319 !! end
6320
6321 !! test
6322 Namespace User {{ns:User}}
6323 !! input
6324 {{ns:User}}
6325 !! result
6326 <p>User
6327 </p>
6328 !! end
6329
6330 !! test
6331 Namespace User talk {{ns:User_talk}}
6332 !! input
6333 {{ns:User_talk}}
6334 !! result
6335 <p>User talk
6336 </p>
6337 !! end
6338
6339 !! test
6340 Namespace User talk {{ns:uSeR tAlK}}
6341 !! input
6342 {{ns:uSeR tAlK}}
6343 !! result
6344 <p>User talk
6345 </p>
6346 !! end
6347
6348 !! test
6349 Namespace File {{ns:File}}
6350 !! input
6351 {{ns:File}}
6352 !! result
6353 <p>File
6354 </p>
6355 !! end
6356
6357 !! test
6358 Namespace File {{ns:Image}}
6359 !! input
6360 {{ns:Image}}
6361 !! result
6362 <p>File
6363 </p>
6364 !! end
6365
6366 !! test
6367 Namespace (lang=de) Benutzer {{ns:User}}
6368 !! options
6369 language=de
6370 !! input
6371 {{ns:User}}
6372 !! result
6373 <p>Benutzer
6374 </p>
6375 !! end
6376
6377 !! test
6378 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6379 !! options
6380 language=de
6381 !! input
6382 {{ns:3}}
6383 !! result
6384 <p>Benutzer Diskussion
6385 </p>
6386 !! end
6387
6388
6389 !! test
6390 Urlencode
6391 !! input
6392 {{urlencode:hi world?!}}
6393 {{urlencode:hi world?!|WIKI}}
6394 {{urlencode:hi world?!|PATH}}
6395 {{urlencode:hi world?!|QUERY}}
6396 !! result
6397 <p>hi+world%3F%21
6398 hi_world%3F!
6399 hi%20world%3F%21
6400 hi+world%3F%21
6401 </p>
6402 !! end
6403
6404 ###
6405 ### Magic links
6406 ###
6407 !! test
6408 Magic links: internal link to RFC (bug 479)
6409 !! input
6410 [[RFC 123]]
6411 !! result
6412 <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>
6413 </p>
6414 !! end
6415
6416 !! test
6417 Magic links: RFC (bug 479)
6418 !! input
6419 RFC 822
6420 !! result
6421 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6422 </p>
6423 !! end
6424
6425 !! test
6426 Magic links: ISBN (bug 1937)
6427 !! input
6428 ISBN 0-306-40615-2
6429 !! result
6430 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6431 </p>
6432 !! end
6433
6434 !! test
6435 Magic links: PMID incorrectly converts space to underscore
6436 !! input
6437 PMID 1234
6438 !! result
6439 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6440 </p>
6441 !! end
6442
6443 ###
6444 ### Templates
6445 ####
6446
6447 !! test
6448 Nonexistent template
6449 !! input
6450 {{thistemplatedoesnotexist}}
6451 !! result
6452 <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>
6453 </p>
6454 !! end
6455
6456 !! test
6457 Template with invalid target containing tags
6458 !! input
6459 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6460 !! result
6461 <p>{{a<b>b</b>|foo|a=b|a = b}}
6462 </p>
6463 !! end
6464
6465 !! test
6466 Template with invalid target containing unclosed tag
6467 !! input
6468 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6469 !! result
6470 <p>{{a<b>|foo|a=b|a = b}}</b>
6471 </p>
6472 !! end
6473
6474 !! article
6475 Template:test
6476 !! text
6477 This is a test template
6478 !! endarticle
6479
6480 !! test
6481 Simple template
6482 !! input
6483 {{test}}
6484 !! result
6485 <p>This is a test template
6486 </p>
6487 !! end
6488
6489 !! test
6490 Template with explicit namespace
6491 !! input
6492 {{Template:test}}
6493 !! result
6494 <p>This is a test template
6495 </p>
6496 !! end
6497
6498
6499 !! article
6500 Template:paramtest
6501 !! text
6502 This is a test template with parameter {{{param}}}
6503 !! endarticle
6504
6505 !! test
6506 Template parameter
6507 !! input
6508 {{paramtest|param=foo}}
6509 !! result
6510 <p>This is a test template with parameter foo
6511 </p>
6512 !! end
6513
6514 !! article
6515 Template:paramtestnum
6516 !! text
6517 [[{{{1}}}|{{{2}}}]]
6518 !! endarticle
6519
6520 !! test
6521 Template unnamed parameter
6522 !! input
6523 {{paramtestnum|Main Page|the main page}}
6524 !! result
6525 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6526 </p>
6527 !! end
6528
6529 !! article
6530 Template:templatesimple
6531 !! text
6532 (test)
6533 !! endarticle
6534
6535 !! article
6536 Template:templateredirect
6537 !! text
6538 #redirect [[Template:templatesimple]]
6539 !! endarticle
6540
6541 !! article
6542 Template:templateasargtestnum
6543 !! text
6544 {{{{{1}}}}}
6545 !! endarticle
6546
6547 !! article
6548 Template:templateasargtest
6549 !! text
6550 {{template{{{templ}}}}}
6551 !! endarticle
6552
6553 !! article
6554 Template:templateasargtest2
6555 !! text
6556 {{{{{templ}}}}}
6557 !! endarticle
6558
6559 !! test
6560 Template with template name as unnamed argument
6561 !! input
6562 {{templateasargtestnum|templatesimple}}
6563 !! result
6564 <p>(test)
6565 </p>
6566 !! end
6567
6568 !! test
6569 Template with template name as argument
6570 !! input
6571 {{templateasargtest|templ=simple}}
6572 !! result
6573 <p>(test)
6574 </p>
6575 !! end
6576
6577 !! test
6578 Template with template name as argument (2)
6579 !! input
6580 {{templateasargtest2|templ=templatesimple}}
6581 !! result
6582 <p>(test)
6583 </p>
6584 !! end
6585
6586 !! article
6587 Template:templateasargtestdefault
6588 !! text
6589 {{{{{templ|templatesimple}}}}}
6590 !! endarticle
6591
6592 !! article
6593 Template:templa
6594 !! text
6595 '''templ'''
6596 !! endarticle
6597
6598 !! test
6599 Template with default value
6600 !! input
6601 {{templateasargtestdefault}}
6602 !! result
6603 <p>(test)
6604 </p>
6605 !! end
6606
6607 !! test
6608 Template with default value (value set)
6609 !! input
6610 {{templateasargtestdefault|templ=templa}}
6611 !! result
6612 <p><b>templ</b>
6613 </p>
6614 !! end
6615
6616 !! test
6617 Template redirect
6618 !! input
6619 {{templateredirect}}
6620 !! result
6621 <p>(test)
6622 </p>
6623 !! end
6624
6625 !! test
6626 Template with argument in separate line
6627 !! input
6628 {{ templateasargtest |
6629 templ = simple }}
6630 !! result
6631 <p>(test)
6632 </p>
6633 !! end
6634
6635 !! test
6636 Template with complex template as argument
6637 !! input
6638 {{paramtest|
6639 param ={{ templateasargtest |
6640 templ = simple }}}}
6641 !! result
6642 <p>This is a test template with parameter (test)
6643 </p>
6644 !! end
6645
6646 !! test
6647 Template with thumb image (with link in description)
6648 !! input
6649 {{paramtest|
6650 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6651 !! result
6652 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>
6653
6654 !! end
6655
6656 !! article
6657 Template:complextemplate
6658 !! text
6659 {{{1}}} {{paramtest|
6660 param ={{{param}}}}}
6661 !! endarticle
6662
6663 !! test
6664 Template with complex arguments
6665 !! input
6666 {{complextemplate|
6667 param ={{ templateasargtest |
6668 templ = simple }}|[[Template:complextemplate|link]]}}
6669 !! result
6670 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6671 </p>
6672 !! end
6673
6674 !! test
6675 BUG 553: link with two variables in a piped link
6676 !! input
6677 {|
6678 |[[{{{1}}}|{{{2}}}]]
6679 |}
6680 !! result
6681 <table>
6682 <tr>
6683 <td>[[{{{1}}}|{{{2}}}]]
6684 </td></tr></table>
6685
6686 !! end
6687
6688 !! test
6689 Magic variable as template parameter
6690 !! input
6691 {{paramtest|param={{SITENAME}}}}
6692 !! result
6693 <p>This is a test template with parameter MediaWiki
6694 </p>
6695 !! end
6696
6697 !! article
6698 Template:linktest
6699 !! text
6700 [[{{{param}}}|link]]
6701 !! endarticle
6702
6703 !! test
6704 Template parameter as link source
6705 !! input
6706 {{linktest|param=Main Page}}
6707 !! result
6708 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6709 </p>
6710 !! end
6711
6712 !!test
6713 Template-generated attribute string (k='v')
6714 !!input
6715 <span {{attr_str|id|v1}}>bar</span>
6716 !!result
6717 <p><span id="v1">bar</span>
6718 </p>
6719 !!end
6720
6721 !!article
6722 Template:paramtest2
6723 !! text
6724 including another template, {{paramtest|param={{{arg}}}}}
6725 !! endarticle
6726
6727 !! test
6728 Template passing argument to another template
6729 !! input
6730 {{paramtest2|arg='hmm'}}
6731 !! result
6732 <p>including another template, This is a test template with parameter 'hmm'
6733 </p>
6734 !! end
6735
6736 !! article
6737 Template:Linktest2
6738 !! text
6739 Main Page
6740 !! endarticle
6741
6742 !! test
6743 Template as link source
6744 !! input
6745 [[{{linktest2}}]]
6746
6747 [[{{linktest2}}|Main Page]]
6748
6749 [[{{linktest2}}]]Page
6750 !! result
6751 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6752 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6753 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6754 </p>
6755 !! end
6756
6757
6758 !! article
6759 Template:loop1
6760 !! text
6761 {{loop2}}
6762 !! endarticle
6763
6764 !! article
6765 Template:loop2
6766 !! text
6767 {{loop1}}
6768 !! endarticle
6769
6770 !! test
6771 Template infinite loop
6772 !! input
6773 {{loop1}}
6774 !! result
6775 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6776 </p>
6777 !! end
6778
6779 !! test
6780 Template from main namespace
6781 !! input
6782 {{:Main Page}}
6783 !! result
6784 <p>blah blah
6785 </p>
6786 !! end
6787
6788 !! article
6789 Template:table
6790 !! text
6791 {|
6792 | 1 || 2
6793 |-
6794 | 3 || 4
6795 |}
6796 !! endarticle
6797
6798 !! test
6799 BUG 529: Template with table, not included at beginning of line
6800 !! input
6801 foo {{table}}
6802 !! result
6803 <p>foo
6804 </p>
6805 <table>
6806 <tr>
6807 <td> 1 </td>
6808 <td> 2
6809 </td></tr>
6810 <tr>
6811 <td> 3 </td>
6812 <td> 4
6813 </td></tr></table>
6814
6815 !! end
6816
6817 !! test
6818 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6819 !! input
6820 foo
6821 {{table}}
6822 !! result
6823 <p>foo
6824 </p>
6825 <table>
6826 <tr>
6827 <td> 1 </td>
6828 <td> 2
6829 </td></tr>
6830 <tr>
6831 <td> 3 </td>
6832 <td> 4
6833 </td></tr></table>
6834
6835 !! end
6836
6837 !! test
6838 BUG 41: Template parameters shown as broken links
6839 !! input
6840 {{{parameter}}}
6841 !! result
6842 <p>{{{parameter}}}
6843 </p>
6844 !! end
6845
6846 !! test
6847 Template with targets containing wikilinks
6848 !! input
6849 {{[[foo]]}}
6850
6851 {{[[{{echo|foo}}]]}}
6852
6853 {{{{echo|[[foo}}]]}}
6854 !! result
6855 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6856 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6857 </p><p>{{[[foo}}]]
6858 </p>
6859 !! end
6860
6861 !! article
6862 Template:MSGNW test
6863 !! text
6864 ''None'' of '''this''' should be
6865 * interpreted
6866 but rather passed unmodified
6867 {{test}}
6868 !! endarticle
6869
6870 # hmm, fix this or just deprecate msgnw and document its behavior?
6871 !! test
6872 msgnw keyword
6873 !! options
6874 disabled
6875 !! input
6876 {{msgnw:MSGNW test}}
6877 !! result
6878 <p>''None'' of '''this''' should be
6879 * interpreted
6880 but rather passed unmodified
6881 {{test}}
6882 </p>
6883 !! end
6884
6885 !! test
6886 int keyword
6887 !! input
6888 {{int:youhavenewmessages|lots of money|not!}}
6889 !! result
6890 <p>You have lots of money (not!).
6891 </p>
6892 !! end
6893
6894 !! article
6895 Template:Includes
6896 !! text
6897 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6898 !! endarticle
6899
6900 !! test
6901 <includeonly> and <noinclude> being included
6902 !! input
6903 {{Includes}}
6904 !! result
6905 <p>Foobar
6906 </p>
6907 !! end
6908
6909 !! article
6910 Template:Includes2
6911 !! text
6912 <onlyinclude>Foo</onlyinclude>bar
6913 !! endarticle
6914
6915 !! test
6916 <onlyinclude> being included
6917 !! input
6918 {{Includes2}}
6919 !! result
6920 <p>Foo
6921 </p>
6922 !! end
6923
6924
6925 !! article
6926 Template:Includes3
6927 !! text
6928 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6929 !! endarticle
6930
6931 !! test
6932 <onlyinclude> and <includeonly> being included
6933 !! input
6934 {{Includes3}}
6935 !! result
6936 <p>Foo
6937 </p>
6938 !! end
6939
6940 !! test
6941 <includeonly> and <noinclude> on a page
6942 !! input
6943 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6944 !! result
6945 <p>Foozar
6946 </p>
6947 !! end
6948
6949 !! test
6950 Un-closed <noinclude>
6951 !! input
6952 <noinclude>
6953 !! result
6954 !! end
6955
6956 !! test
6957 <onlyinclude> on a page
6958 !! input
6959 <onlyinclude>Foo</onlyinclude>bar
6960 !! result
6961 <p>Foobar
6962 </p>
6963 !! end
6964
6965 !! test
6966 Un-closed <onlyinclude>
6967 !! input
6968 <onlyinclude>
6969 !! result
6970 !! end
6971
6972 !!test
6973 Self-closed noinclude, includeonly, onlyinclude tags
6974 !!input
6975 <noinclude />
6976 <includeonly />
6977 <onlyinclude />
6978 !!result
6979 <p><br />
6980 </p>
6981 !!end
6982
6983 !!test
6984 Unbalanced includeonly and noinclude tags
6985 !!input
6986 {|
6987 |a</noinclude>
6988 |b</noinclude></noinclude>
6989 |c</noinclude></includeonly>
6990 |d</includeonly></includeonly>
6991 |}
6992 !!result
6993 <table>
6994 <tr>
6995 <td>a
6996 </td>
6997 <td>b
6998 </td>
6999 <td>c&lt;/includeonly&gt;
7000 </td>
7001 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7002 </td></tr></table>
7003
7004 !!end
7005
7006 !! article
7007 Template:Includeonly section
7008 !! text
7009 <includeonly>
7010 ==Includeonly section==
7011 </includeonly>
7012 ==Section T-1==
7013 !!endarticle
7014
7015 !! test
7016 Bug 6563: Edit link generation for section shown by <includeonly>
7017 !! input
7018 {{includeonly section}}
7019 !! result
7020 <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>
7021 <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>
7022
7023 !! end
7024
7025 # Uses same input as the contents of [[Template:Includeonly section]]
7026 !! test
7027 Bug 6563: Section extraction for section shown by <includeonly>
7028 !! options
7029 section=T-2
7030 !! input
7031 <includeonly>
7032 ==Includeonly section==
7033 </includeonly>
7034 ==Section T-2==
7035 !! result
7036 ==Section T-2==
7037 !! end
7038
7039 !! test
7040 Bug 6563: Edit link generation for section suppressed by <includeonly>
7041 !! input
7042 <includeonly>
7043 ==Includeonly section==
7044 </includeonly>
7045 ==Section 1==
7046 !! result
7047 <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>
7048
7049 !! end
7050
7051 !! test
7052 Bug 6563: Section extraction for section suppressed by <includeonly>
7053 !! options
7054 section=1
7055 !! input
7056 <includeonly>
7057 ==Includeonly section==
7058 </includeonly>
7059 ==Section 1==
7060 !! result
7061 ==Section 1==
7062 !! end
7063
7064 !! test
7065 Un-closed <includeonly>
7066 !! input
7067 <includeonly>
7068 !! result
7069 !! end
7070
7071 # TODO: test with DOM fragment reuse!
7072 !! test
7073 Parsoid: DOM fragment reuse
7074 !! options
7075 parsoid=wt2wt,wt2html
7076 !! input
7077 a{{echo|b<table></table>c}}d
7078
7079 a{{echo|b
7080 <table></table>
7081 c}}d
7082
7083 {{echo|a
7084
7085 <table></table>
7086
7087 b}}
7088 !! result
7089 a<span typeof="mw:Transclusion">b</span>
7090 <table></table><span>c</span>d
7091 <p typeof="mw:Transclusion">ab</p>
7092 <table></table>
7093 <p>cd</p>
7094 <p typeof="mw:Transclusion">a</p>
7095 <table></table>
7096 <p>b</p>
7097 !! end
7098
7099 ###
7100 ### <includeonly> and <noinclude> in attributes
7101 ###
7102 !!test
7103 0. includeonly around the entire attribute
7104 !!input
7105 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7106 !!result
7107 <p><span id="v2">bar</span>
7108 </p>
7109 !!end
7110
7111 !!test
7112 1. includeonly in html attr key
7113 !!input
7114 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7115 !!result
7116 <p><span id="foo">bar</span>
7117 </p>
7118 !!end
7119
7120 !!test
7121 2. includeonly in html attr value
7122 !!input
7123 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7124 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7125 !!result
7126 <p><span id="v1">bar</span>
7127 <span id="v1">bar</span>
7128 </p>
7129 !!end
7130
7131 !!test
7132 3. includeonly in part of an attr value
7133 !!input
7134 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7135 !!result
7136 <p><span style="color:red;">bar</span>
7137 </p>
7138 !!end
7139
7140 ###
7141 ### Testing parsing of templates where a template arg
7142 ### has the same name as the template itself.
7143 ###
7144
7145 !! article
7146 Template:quote
7147 !! text
7148 {{{quote|{{{1}}}}}}
7149 !! endarticle
7150
7151 !!test
7152 Templates: Template Name/Arg clash: 1. Use of positional param
7153 !!input
7154 {{quote|foo}}
7155 !!result
7156 <p>foo
7157 </p>
7158 !!end
7159
7160 !!test
7161 Templates: Template Name/Arg clash: 2. Use of named param
7162 !!input
7163 {{quote|quote=foo}}
7164 !!result
7165 <p>foo
7166 </p>
7167 !!end
7168
7169 !!test
7170 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7171 !!input
7172 {{quote|quote}}
7173 !!result
7174 <p>quote
7175 </p>
7176 !!end
7177
7178 ###
7179 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7180 ###
7181
7182 !!test
7183 Templates: 1. Simple use
7184 !!input
7185 {{echo|Foo}}
7186 !!result
7187 <p>Foo
7188 </p>
7189 !!end
7190
7191 !!test
7192 Templates: 2. Inside a block tag
7193 !!input
7194 <div>{{echo|Foo}}</div>
7195 !!result
7196 <div>Foo</div>
7197
7198 !!end
7199
7200 !!test
7201 Templates: P-wrapping: 1a. Templates on consecutive lines
7202 !!input
7203 {{echo|Foo}}
7204 {{echo|bar}}
7205 !!result
7206 <p>Foo
7207 bar
7208 </p>
7209 !!end
7210
7211 !!test
7212 Templates: P-wrapping: 1b. Templates on consecutive lines
7213 !!input
7214 Foo
7215
7216 {{echo|bar}}
7217 {{echo|baz}}
7218 !!result
7219 <p>Foo
7220 </p><p>bar
7221 baz
7222 </p>
7223 !!end
7224
7225 !!test
7226 Templates: P-wrapping: 1c. Templates on consecutive lines
7227 !!input
7228 {{echo|Foo}}
7229 {{echo|bar}} <div>baz</div>
7230 !!result
7231 <p>Foo
7232 </p>
7233 bar <div>baz</div>
7234
7235 !!end
7236
7237 !!test
7238 Templates: P-wrapping: 1d. Template preceded by comment-only line
7239 !!options
7240 parsoid=wt2html,wt2wt
7241 !!input
7242 <!-- foo -->
7243 {{echo|Bar}}
7244 !!result
7245 <!-- foo -->
7246 <p typeof="mw:Transclusion">Bar
7247 </p>
7248 !!end
7249
7250 !!test
7251 Templates: Inline Text: 1. Multiple tmeplate uses
7252 !!input
7253 {{echo|Foo}}bar{{echo|baz}}
7254 !!result
7255 <p>Foobarbaz
7256 </p>
7257 !!end
7258
7259 !!test
7260 Templates: Inline Text: 2. Back-to-back template uses
7261 !!input
7262 {{echo|Foo}}{{echo|bar}}
7263 !!result
7264 <p>Foobar
7265 </p>
7266 !!end
7267
7268 !!test
7269 Templates: Block Tags: 1. Multiple template uses
7270 !!input
7271 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7272 !!result
7273 <div>Foo</div><div>bar</div><div>baz</div>
7274
7275 !!end
7276
7277 !!test
7278 Templates: Block Tags: 2. Back-to-back template uses
7279 !!input
7280 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7281 !!result
7282 <div>Foo</div><div>bar</div>
7283
7284 !!end
7285
7286 !!test
7287 Templates: Links: 1. Simple example
7288 !!input
7289 {{echo|[[Foo|bar]]}}
7290 !!result
7291 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7292 </p>
7293 !!end
7294
7295 !!test
7296 Templates: Links: 2. Generation of link href
7297 !!input
7298 [[{{echo|Foo}}|bar]]
7299 !!result
7300 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7301 </p>
7302 !!end
7303
7304 !!test
7305 Templates: Links: 3. Generation of part of a link href
7306 !!input
7307 [[Fo{{echo|o}}|bar]]
7308
7309 [[Foo{{echo|bar}}]]
7310
7311 [[Foo{{echo|bar}}baz]]
7312
7313 [[Foo{{echo|bar}}|bar]]
7314
7315 [[:Foo{{echo|bar}}]]
7316
7317 [[:Foo{{echo|bar}}|bar]]
7318 !!result
7319 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7320 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7321 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7322 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7323 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7324 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7325 </p>
7326 !!end
7327
7328 !!test
7329 Templates: Links: 4. Multiple templates generating link href
7330 !!input
7331 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7332 !!result
7333 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7334 </p>
7335 !!end
7336
7337 !!test
7338 Templates: Links: 5. Generation of link text
7339 !!input
7340 [[Foo|{{echo|bar}}]]
7341 !!result
7342 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7343 </p>
7344 !!end
7345
7346 !!test
7347 Templates: Links: 5. Nested templates (only outermost template should be marked)
7348 !!input
7349 {{echo|[[{{echo|Foo}}|bar]]}}
7350 !!result
7351 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7352 </p>
7353 !!end
7354
7355 !!test
7356 Templates: HTML Tag: 1. Generation of HTML attr. key
7357 !!input
7358 <div {{echo|style}}="color:red;">foo</div>
7359 !!result
7360 <div style="color:red;">foo</div>
7361
7362 !!end
7363
7364 !!test
7365 Templates: HTML Tag: 2. Generation of HTML attr. value
7366 !!input
7367 <div style={{echo|'color:red;'}}>foo</div>
7368 !!result
7369 <div style="color:red;">foo</div>
7370
7371 !!end
7372
7373 !!test
7374 Templates: HTML Tag: 3. Generation of HTML attr key and value
7375 !!input
7376 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7377 !!result
7378 <div style="color:red;">foo</div>
7379
7380 !!end
7381
7382 !!test
7383 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7384 !!input
7385 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7386 !!result
7387 <div title="This is a long title with just one piece templated">foo</div>
7388
7389 !!end
7390
7391 !!test
7392 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7393 !!input
7394 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7395 !!result
7396 <div title="This is a long title with just one piece templated">foo</div>
7397
7398 !!end
7399
7400 !!test
7401 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7402 !!input
7403 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7404 !!result
7405 <div title="This is a long title with just one piece templated">foo</div>
7406
7407 !!end
7408
7409 !!test
7410 Templates: HTML Tag: 7. Generation of partial attribute key string
7411 !!input
7412 <div st{{echo|yle}}="color:red;">foo</div>
7413 !!result
7414 <div style="color:red;">foo</div>
7415
7416 !!end
7417
7418 !!test
7419 Templates: HTML Tables: 1. Generating start of a HTML table
7420 !!input
7421 {{echo|<table><tr><td>foo</td>}}</tr></table>
7422 !!result
7423 <table><tr><td>foo</td></tr></table>
7424
7425 !!end
7426
7427 !!test
7428 Templates: HTML Tables: 2a. Generating middle of a HTML table
7429 !!input
7430 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7431 !!result
7432 <table><tr><td>foo</td></tr></table>
7433
7434 !!end
7435
7436 !!test
7437 Templates: HTML Tables: 2b. Generating middle of a HTML table
7438 !!input
7439 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7440 !!result
7441 <table><tr><td>foo</td></tr></table>
7442
7443 !!end
7444
7445 !!test
7446 Templates: HTML Tables: 3. Generating end of a HTML table
7447 !!input
7448 <table><tr>{{echo|<td>foo</td></tr></table>}}
7449 !!result
7450 <table><tr><td>foo</td></tr></table>
7451
7452 !!end
7453
7454 !!test
7455 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7456 !!input
7457 {{echo|<table>}}<tr><td>foo</td></tr></table>
7458 !!result
7459 <table><tr><td>foo</td></tr></table>
7460
7461 !!end
7462
7463 !!test
7464 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7465 !!input
7466 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7467 !!result
7468 <table><tr><td>foo</td></tr></table>
7469
7470 !!end
7471
7472 !!test
7473 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7474 !!input
7475 <table><tr>{{echo|<td>}}foo</td></tr></table>
7476 !!result
7477 <table><tr><td>foo</td></tr></table>
7478
7479 !!end
7480
7481 !!test
7482 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7483 !!input
7484 <table><tr><td>foo{{echo|</td>}}</tr></table>
7485 !!result
7486 <table><tr><td>foo</td></tr></table>
7487
7488 !!end
7489
7490 !!test
7491 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7492 !!input
7493 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7494 !!result
7495 <table><tr><td>foo</td></tr></table>
7496
7497 !!end
7498
7499 !!test
7500 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7501 !!input
7502 <table><tr><td>foo</td></tr>{{echo|</table>}}
7503 !!result
7504 <table><tr><td>foo</td></tr></table>
7505
7506 !!end
7507
7508 !!test
7509 Templates: HTML Tables: 5. Proper fostering of categories from inside
7510 !!options
7511 parsoid=wt2html,wt2wt
7512 !!input
7513 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7514 <!--Two categories (Bug 50330)-->
7515 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7516 !!result
7517 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7518 <!--Two categories (Bug 50330)-->
7519 <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>
7520 !!end
7521
7522 !!test
7523 Templates: Wiki Tables: 1a. Fostering of entire template content
7524 !!input
7525 {|
7526 {{echo|a}}
7527 |}
7528 !!result
7529 <table>
7530 a
7531 <tr><td></td></tr></table>
7532
7533 !!end
7534
7535 !!test
7536 Templates: Wiki Tables: 1b. Fostering of entire template content
7537 !!input
7538 {|
7539 {{echo|<div>}}
7540 foo
7541 {{echo|</div>}}
7542 |}
7543 !!result
7544 <table>
7545 <div>
7546 <p>foo
7547 </p>
7548 </div>
7549 <tr><td></td></tr></table>
7550
7551 !!end
7552
7553 !!test
7554 Templates: Wiki Tables: 2. Fostering of partial template content
7555 !!input
7556 {|
7557 {{echo|a
7558 <div>b</div>}}
7559 |}
7560 !!result
7561 <table>
7562 a
7563 <div>b</div>
7564 <tr><td></td></tr></table>
7565
7566 !!end
7567
7568 !!test
7569 Templates: Wiki Tables: 3. td-content via multiple templates
7570 !!input
7571 {|
7572 {{echo|{{pipe}}a}}{{echo|b}}
7573 |}
7574 !!result
7575 <table>
7576 <tr>
7577 <td>ab
7578 </td></tr></table>
7579
7580 !!end
7581
7582 !!test
7583 Templates: Wiki Tables: 4. Templated tags, no content
7584 !!input
7585 {{tbl-start}}
7586 {{tbl-end}}
7587 !!result
7588 <table>
7589 <tr><td></td></tr></table>
7590
7591 !!end
7592
7593 !!test
7594 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7595 !!input
7596 {{tbl-start}}
7597 |foo
7598 {{tbl-end}}
7599 !!result
7600 <table>
7601 <tr>
7602 <td>foo
7603 </td></tr></table>
7604
7605 !!end
7606
7607 !!test
7608 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7609 !!input
7610 {{tbl-start}}
7611 {{!}}foo
7612 {{tbl-end}}
7613 !!result
7614 <table>
7615 <tr>
7616 <td>foo
7617 </td></tr></table>
7618
7619 !!end
7620
7621 !!test
7622 Templates: Lists: Multi-line list-items via templates
7623 !!input
7624 *{{echo|a {{nonexistent|
7625 unused}}}}
7626 *{{echo|b {{nonexistent|
7627 unused}}}}
7628 !!result
7629 <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>
7630 </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>
7631 </li></ul>
7632
7633 !!end
7634
7635 !!test
7636 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7637 !!input
7638 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7639 !!result
7640 <p><i>ab</i>c<i>d</i>e
7641 </p>
7642 !!end
7643
7644 !!test
7645 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7646 (PHP parser generates misnested html)
7647 !! options
7648 parsoid=wt2html,wt2wt
7649 !!input
7650 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7651 !!result
7652 <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>
7653 !!end
7654
7655 !!test
7656 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7657 (PHP parser generates misnested html)
7658 !! options
7659 parsoid=wt2html,wt2wt
7660 !!input
7661 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7662 !!result
7663 <div typeof="mw:Transclusion"><i>a</i></div>
7664 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7665 <div typeof="mw:Transclusion">e</div>
7666 !!end
7667
7668 !!test
7669 Templates: Ugly nesting: 4. Divs opened/closed across templates
7670 !!input
7671 a<div>b{{echo|c</div>d}}e
7672 !!result
7673 a<div>bc</div>de
7674
7675 !!end
7676
7677 !!test
7678 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7679 (Parsoid-centric)
7680 !! options
7681 parsoid
7682 !!input
7683 {|
7684 |{{echo|foo</table>}}
7685 |bar
7686 |}
7687 !!result
7688 <table typeof="mw:Transclusion">
7689 <tbody>
7690 <tr>
7691 <td>foo</td></tr></tbody></table><span>bar</span>
7692 !!end
7693
7694 !!test
7695 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7696 (Parsoid-centric)
7697 !! options
7698 parsoid
7699 !!input
7700 <table>
7701 <tr>
7702 <td>
7703 <table>
7704 <tr>
7705 <td>1. {{echo|foo </table>}}</td>
7706 <td> bar </td>
7707 <td>2. {{echo|baz </table>}}</td>
7708 </tr>
7709 <tr>
7710 <td>abc</td>
7711 </tr>
7712 </table>
7713 </td>
7714 </tr>
7715 <tr>
7716 <td>xyz</td>
7717 </tr>
7718 </table>
7719 !!result
7720 <table about="#mwt1" typeof="mw:Transclusion">
7721 <tbody><tr >
7722 <td >
7723 <table >
7724 <tbody><tr >
7725 <td >1. foo </td></tr></tbody></table></td>
7726 <td > bar </td>
7727 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7728 </span><span about="#mwt1">
7729
7730 abc</span><span about="#mwt1">
7731 </span><span about="#mwt1">
7732 </span><span about="#mwt1">
7733 </span><span about="#mwt1">
7734 </span><span about="#mwt1">
7735
7736 xyz</span><span about="#mwt1">
7737 </span><span about="#mwt1">
7738 </span>
7739 !!end
7740
7741 !! test
7742 Templates: Ugly templates: 3. newline-only template parameter
7743 !! input
7744 foo {{echo|
7745 }}
7746 !! result
7747 <p>foo
7748 </p>
7749 !! end
7750
7751 # This looks like a bug: a single newline triggers p/br for some reason.
7752 !! test
7753 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7754 !! input
7755 {{echo|
7756 }}
7757 !! result
7758 <p><br />
7759 </p>
7760 !! end
7761
7762
7763 !!test
7764 Parser Functions: 1. Simple example
7765 !!input
7766 {{uc:foo}}
7767 !!result
7768 <p>FOO
7769 </p>
7770 !!end
7771
7772 !!test
7773 Parser Functions: 2. Nested use (only outermost should be marked up)
7774 !!input
7775 {{uc:{{lc:FOO}}}}
7776 !!result
7777 <p>FOO
7778 </p>
7779 !!end
7780
7781 ###
7782 ### Pre-save transform tests
7783 ###
7784 !! test
7785 pre-save transform: subst:
7786 !! options
7787 PST
7788 !! input
7789 {{subst:test}}
7790 !! result
7791 This is a test template
7792 !! end
7793
7794 !! test
7795 pre-save transform: normal template
7796 !! options
7797 PST
7798 !! input
7799 {{test}}
7800 !! result
7801 {{test}}
7802 !! end
7803
7804 !! test
7805 pre-save transform: nonexistent template
7806 !! options
7807 PST
7808 !! input
7809 {{thistemplatedoesnotexist}}
7810 !! result
7811 {{thistemplatedoesnotexist}}
7812 !! end
7813
7814
7815 !! test
7816 pre-save transform: subst magic variables
7817 !! options
7818 PST
7819 !! input
7820 {{subst:SITENAME}}
7821 !! result
7822 MediaWiki
7823 !! end
7824
7825 # This is bug 89, which I fixed. -- wtm
7826 !! test
7827 pre-save transform: subst: templates with parameters
7828 !! options
7829 pst
7830 !! input
7831 {{subst:paramtest|param="something else"}}
7832 !! result
7833 This is a test template with parameter "something else"
7834 !! end
7835
7836 !! article
7837 Template:nowikitest
7838 !! text
7839 <nowiki>'''not wiki'''</nowiki>
7840 !! endarticle
7841
7842 !! test
7843 pre-save transform: nowiki in subst (bug 1188)
7844 !! options
7845 pst
7846 !! input
7847 {{subst:nowikitest}}
7848 !! result
7849 <nowiki>'''not wiki'''</nowiki>
7850 !! end
7851
7852
7853 !! article
7854 Template:commenttest
7855 !! text
7856 This template has <!-- a comment --> in it.
7857 !! endarticle
7858
7859 !! test
7860 pre-save transform: comment in subst (bug 1936)
7861 !! options
7862 pst
7863 !! input
7864 {{subst:commenttest}}
7865 !! result
7866 This template has <!-- a comment --> in it.
7867 !! end
7868
7869 !! test
7870 pre-save transform: unclosed tag
7871 !! options
7872 pst noxml
7873 !! input
7874 <nowiki>'''not wiki'''
7875 !! result
7876 <nowiki>'''not wiki'''
7877 !! end
7878
7879 !! test
7880 pre-save transform: mixed tag case
7881 !! options
7882 pst noxml
7883 !! input
7884 <NOwiki>'''not wiki'''</noWIKI>
7885 !! result
7886 <NOwiki>'''not wiki'''</noWIKI>
7887 !! end
7888
7889 !! test
7890 pre-save transform: unclosed comment in <nowiki>
7891 !! options
7892 pst noxml
7893 !! input
7894 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7895 !! result
7896 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7897 !!end
7898
7899 # Leading @ in this template definition works around a limitation
7900 # in parsoid's parserTests which otherwise strips the <span> from the
7901 # result (confusing it for a template wrapper)
7902 !! article
7903 Template:dangerous
7904 !!text
7905 @<span onmouseover="alert('crap')">Oh no</span>
7906 !!endarticle
7907
7908 !!test
7909 (confirming safety of fix for subst bug 1936)
7910 !! input
7911 {{Template:dangerous}}
7912 !! result
7913 <p>@<span>Oh no</span>
7914 </p>
7915 !! end
7916
7917 !! test
7918 pre-save transform: comment containing gallery (bug 5024)
7919 !! options
7920 pst
7921 !! input
7922 <!-- <gallery>data</gallery> -->
7923 !!result
7924 <!-- <gallery>data</gallery> -->
7925 !!end
7926
7927 !! test
7928 pre-save transform: comment containing extension
7929 !! options
7930 pst
7931 !! input
7932 <!-- <tag>data</tag> -->
7933 !!result
7934 <!-- <tag>data</tag> -->
7935 !!end
7936
7937 !! test
7938 pre-save transform: comment containing nowiki
7939 !! options
7940 pst
7941 !! input
7942 <!-- <nowiki>data</nowiki> -->
7943 !!result
7944 <!-- <nowiki>data</nowiki> -->
7945 !!end
7946
7947 !! test
7948 pre-save transform: <noinclude> in subst (bug 3298)
7949 !! options
7950 pst
7951 !! input
7952 {{subst:Includes}}
7953 !! result
7954 Foobar
7955 !! end
7956
7957 !! test
7958 pre-save transform: <onlyinclude> in subst (bug 3298)
7959 !! options
7960 pst
7961 !! input
7962 {{subst:Includes2}}
7963 !! result
7964 Foo
7965 !! end
7966
7967 !! article
7968 Template:SubstTest
7969 !!text
7970 {{<includeonly>subst:</includeonly>Includes}}
7971 !! endarticle
7972
7973 !! article
7974 Template:SafeSubstTest
7975 !! text
7976 {{<includeonly>safesubst:</includeonly>Includes}}
7977 !! endarticle
7978
7979 !! test
7980 bug 22297: safesubst: works during PST
7981 !! options
7982 pst
7983 !! input
7984 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7985 !! result
7986 FoobarFoobar
7987 !! end
7988
7989 !! test
7990 bug 22297: safesubst: works during normal parse
7991 !! input
7992 {{SafeSubstTest}}
7993 !! result
7994 <p>Foobar
7995 </p>
7996 !! end
7997
7998 !! test:
7999 subst: does not work during normal parse
8000 !! input
8001 {{SubstTest}}
8002 !! result
8003 <p>{{subst:Includes}}
8004 </p>
8005 !! end
8006
8007 !! test
8008 pre-save transform: context links ("pipe trick")
8009 !! options
8010 pst
8011 !! input
8012 [[Article (context)|]]
8013 [[Bar:Article|]]
8014 [[:Bar:Article|]]
8015 [[Bar:Article (context)|]]
8016 [[:Bar:Article (context)|]]
8017 [[|Article]]
8018 [[|Article (context)]]
8019 [[Bar:X (Y) Z|]]
8020 [[:Bar:X (Y) Z|]]
8021 !! result
8022 [[Article (context)|Article]]
8023 [[Bar:Article|Article]]
8024 [[:Bar:Article|Article]]
8025 [[Bar:Article (context)|Article]]
8026 [[:Bar:Article (context)|Article]]
8027 [[Article]]
8028 [[Article (context)]]
8029 [[Bar:X (Y) Z|X (Y) Z]]
8030 [[:Bar:X (Y) Z|X (Y) Z]]
8031 !! end
8032
8033 !! test
8034 pre-save transform: context links ("pipe trick") with interwiki prefix
8035 !! options
8036 pst
8037 !! input
8038 [[interwiki:Article|]]
8039 [[:interwiki:Article|]]
8040 [[interwiki:Bar:Article|]]
8041 [[:interwiki:Bar:Article|]]
8042 !! result
8043 [[interwiki:Article|Article]]
8044 [[:interwiki:Article|Article]]
8045 [[interwiki:Bar:Article|Bar:Article]]
8046 [[:interwiki:Bar:Article|Bar:Article]]
8047 !! end
8048
8049 !! test
8050 pre-save transform: context links ("pipe trick") with parens in title
8051 !! options
8052 pst title=[[Somearticle (context)]]
8053 !! input
8054 [[|Article]]
8055 !! result
8056 [[Article (context)|Article]]
8057 !! end
8058
8059 !! test
8060 pre-save transform: context links ("pipe trick") with comma in title
8061 !! options
8062 pst title=[[Someplace, Somewhere]]
8063 !! input
8064 [[|Otherplace]]
8065 [[Otherplace, Elsewhere|]]
8066 [[Otherplace, Elsewhere, Anywhere|]]
8067 !! result
8068 [[Otherplace, Somewhere|Otherplace]]
8069 [[Otherplace, Elsewhere|Otherplace]]
8070 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8071 !! end
8072
8073 !! test
8074 pre-save transform: context links ("pipe trick") with parens and comma
8075 !! options
8076 pst title=[[Someplace (IGNORED), Somewhere]]
8077 !! input
8078 [[|Otherplace]]
8079 [[Otherplace (place), Elsewhere|]]
8080 !! result
8081 [[Otherplace, Somewhere|Otherplace]]
8082 [[Otherplace (place), Elsewhere|Otherplace]]
8083 !! end
8084
8085 !! test
8086 pre-save transform: context links ("pipe trick") with comma and parens
8087 !! options
8088 pst title=[[Who, me? (context)]]
8089 !! input
8090 [[|Yes, you.]]
8091 [[Me, Myself, and I (1937 song)|]]
8092 !! result
8093 [[Yes, you. (context)|Yes, you.]]
8094 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8095 !! end
8096
8097 !! test
8098 pre-save transform: context links ("pipe trick") with namespace
8099 !! options
8100 pst title=[[Ns:Somearticle]]
8101 !! input
8102 [[|Article]]
8103 !! result
8104 [[Ns:Article|Article]]
8105 !! end
8106
8107 !! test
8108 pre-save transform: context links ("pipe trick") with namespace and parens
8109 !! options
8110 pst title=[[Ns:Somearticle (context)]]
8111 !! input
8112 [[|Article]]
8113 !! result
8114 [[Ns:Article (context)|Article]]
8115 !! end
8116
8117 !! test
8118 pre-save transform: context links ("pipe trick") with namespace and comma
8119 !! options
8120 pst title=[[Ns:Somearticle, Context, Whatever]]
8121 !! input
8122 [[|Article]]
8123 !! result
8124 [[Ns:Article, Context, Whatever|Article]]
8125 !! end
8126
8127 !! test
8128 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8129 !! options
8130 pst title=[[Ns:Somearticle, Context (context)]]
8131 !! input
8132 [[|Article]]
8133 !! result
8134 [[Ns:Article (context)|Article]]
8135 !! end
8136
8137 !! test
8138 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8139 !! options
8140 pst title=[[Ns:Somearticle (IGNORED), Context]]
8141 !! input
8142 [[|Article]]
8143 !! result
8144 [[Ns:Article, Context|Article]]
8145 !! end
8146
8147 !! test
8148 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8149 !! options
8150 pst
8151 !! input
8152 [[Article(context)|]]
8153 [[Bar:Article(context)|]]
8154 [[:Bar:Article(context)|]]
8155 [[|Article(context)]]
8156 [[Bar:X(Y)Z|]]
8157 [[:Bar:X(Y)Z|]]
8158 !! result
8159 [[Article(context)|Article]]
8160 [[Bar:Article(context)|Article]]
8161 [[:Bar:Article(context)|Article]]
8162 [[Article(context)]]
8163 [[Bar:X(Y)Z|X(Y)Z]]
8164 [[:Bar:X(Y)Z|X(Y)Z]]
8165 !! end
8166
8167 !! test
8168 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8169 !! options
8170 pst
8171 !! input
8172 [[Article (context)|]]
8173 [[Bar:Article (context)|]]
8174 [[:Bar:Article (context)|]]
8175 [[|Article (context)]]
8176 [[Bar:X (Y) Z|]]
8177 [[:Bar:X (Y) Z|]]
8178 !! result
8179 [[Article (context)|Article]]
8180 [[Bar:Article (context)|Article]]
8181 [[:Bar:Article (context)|Article]]
8182 [[Article (context)]]
8183 [[Bar:X (Y) Z|X (Y) Z]]
8184 [[:Bar:X (Y) Z|X (Y) Z]]
8185 !! end
8186
8187 !! test
8188 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8189 !! options
8190 pst
8191 !! input
8192 [[Article(context)|]]
8193 [[Bar:Article(context)|]]
8194 [[:Bar:Article(context)|]]
8195 [[|Article(context)]]
8196 [[Bar:X(Y)Z|]]
8197 [[:Bar:X(Y)Z|]]
8198 !! result
8199 [[Article(context)|Article]]
8200 [[Bar:Article(context)|Article]]
8201 [[:Bar:Article(context)|Article]]
8202 [[Article(context)]]
8203 [[Bar:X(Y)Z|X(Y)Z]]
8204 [[:Bar:X(Y)Z|X(Y)Z]]
8205 !! end
8206
8207 !! test
8208 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8209 !! options
8210 pst
8211 !! input
8212 [[Article (context), context|]]
8213 [[Article (context),context|]]
8214 [[Bar:Article (context), context|]]
8215 [[Bar:Article (context),context|]]
8216 [[:Bar:Article (context), context|]]
8217 [[:Bar:Article (context),context|]]
8218 !! result
8219 [[Article (context), context|Article]]
8220 [[Article (context),context|Article]]
8221 [[Bar:Article (context), context|Article]]
8222 [[Bar:Article (context),context|Article]]
8223 [[:Bar:Article (context), context|Article]]
8224 [[:Bar:Article (context),context|Article]]
8225 !! end
8226
8227 !! test
8228 pre-save transform: trim trailing empty lines
8229 !! options
8230 pst
8231 !! input
8232 Empty lines are trimmed
8233
8234
8235
8236
8237 !! result
8238 Empty lines are trimmed
8239 !! end
8240
8241 !! test
8242 pre-save transform: Signature expansion
8243 !! options
8244 pst
8245 !! input
8246 * ~~~
8247 * <noinclude>~~~</noinclude>
8248 * <includeonly>~~~</includeonly>
8249 * <onlyinclude>~~~</onlyinclude>
8250 !! result
8251 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8252 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8253 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8254 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8255 !! end
8256
8257
8258 !! test
8259 pre-save transform: Signature expansion in nowiki tags (bug 93)
8260 !! options
8261 pst disabled
8262 !! input
8263 Shall not expand:
8264
8265 <nowiki>~~~~</nowiki>
8266
8267 <includeonly><nowiki>~~~~</nowiki></includeonly>
8268
8269 <noinclude><nowiki>~~~~</nowiki></noinclude>
8270
8271 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8272
8273 {{subst:Foo}} shall be converted to FOO
8274
8275 As well as inside noinclude/onlyinclude
8276 <noinclude>{{subst:Foo}}</noinclude>
8277 <onlyinclude>{{subst:Foo}}</onlyinclude>
8278
8279 But not inside includeonly
8280 <includeonly>{{subst:Foo}}</includeonly>
8281 !! result
8282 Shall not expand:
8283
8284 <nowiki>~~~~</nowiki>
8285
8286 <includeonly><nowiki>~~~~</nowiki></includeonly>
8287
8288 <noinclude><nowiki>~~~~</nowiki></noinclude>
8289
8290 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8291
8292 FOO shall be converted to FOO
8293
8294 As well as inside noinclude/onlyinclude
8295 <noinclude>FOO</noinclude>
8296 <onlyinclude>FOO</onlyinclude>
8297
8298 But not inside includeonly
8299 <includeonly>{{subst:Foo}}</includeonly>
8300 !! end
8301
8302 !! test
8303 Parsoid: Recognize nowiki with trailing space in tags
8304 !! options
8305 parsoid=wt2html
8306 !! input
8307 <nowiki ><div>[[foo]]</nowiki >
8308
8309 a<nowiki / >b
8310
8311 c<nowiki />d
8312
8313 e<nowiki/ >f
8314 !! result
8315 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8316 <p>ab</p>
8317 <p>cd</p>
8318 <p>ef</p>
8319 !! end
8320
8321 !! test
8322 Parsoid: Recognize nowiki with odd capitalization
8323 !! options
8324 parsoid=wt2html
8325 !! input
8326 <noWikI ><div>[[foo]]</Nowiki >
8327 !! result
8328 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8329 !! end
8330
8331
8332 !! test
8333 Parsoid: Escape nowiki with trailing space in tags
8334 !! options
8335 parsoid=html2wt
8336 !! input
8337 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8338
8339 a&lt;nowiki /&gt;b
8340
8341 c&lt;nowiki/ &gt;d
8342 !! result
8343 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8344 <p>a&lt;nowiki /&gt;b</p>
8345 <p>c&lt;nowiki/ &gt;d</p>
8346 !! end
8347
8348 !! test
8349 Parsoid: Escape weird noWikI capitalizations
8350 !! options
8351 parsoid=html2wt
8352 !! input
8353 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8354 !! result
8355 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8356 !! end
8357
8358 ###
8359 ### Message transform tests
8360 ###
8361 !! test
8362 message transform: magic variables
8363 !! options
8364 msg
8365 !! input
8366 {{SITENAME}}
8367 !! result
8368 MediaWiki
8369 !! end
8370
8371 !! test
8372 message transform: should not transform wiki markup
8373 !! options
8374 msg
8375 !! input
8376 ''test''
8377 !! result
8378 ''test''
8379 !! end
8380
8381 !! test
8382 message transform: <noinclude> in transcluded template (bug 4926)
8383 !! options
8384 msg
8385 !! input
8386 {{Includes}}
8387 !! result
8388 Foobar
8389 !! end
8390
8391 !! test
8392 message transform: <onlyinclude> in transcluded template (bug 4926)
8393 !! options
8394 msg
8395 !! input
8396 {{Includes2}}
8397 !! result
8398 Foo
8399 !! end
8400
8401 !! test
8402 {{#special:}} page name, known
8403 !! options
8404 msg
8405 !! input
8406 {{#special:Recentchanges}}
8407 !! result
8408 Special:RecentChanges
8409 !! end
8410
8411 !! test
8412 {{#special:}} page name with subpage, known
8413 !! options
8414 msg
8415 !! input
8416 {{#special:Recentchanges/param}}
8417 !! result
8418 Special:RecentChanges/param
8419 !! end
8420
8421 !! test
8422 {{#special:}} page name, unknown
8423 !! options
8424 msg
8425 !! input
8426 {{#special:foobar nonexistent}}
8427 !! result
8428 Special:Foobar nonexistent
8429 !! end
8430
8431 !! test
8432 {{#speciale:}} page name, known
8433 !! options
8434 msg
8435 !! input
8436 {{#speciale:Recentchanges}}
8437 !! result
8438 Special:RecentChanges
8439 !! end
8440
8441 !! test
8442 {{#speciale:}} page name with subpage, known
8443 !! options
8444 msg
8445 !! input
8446 {{#speciale:Recentchanges/param}}
8447 !! result
8448 Special:RecentChanges/param
8449 !! end
8450
8451 !! test
8452 {{#speciale:}} page name, unknown
8453 !! options
8454 msg
8455 !! input
8456 {{#speciale:foobar nonexistent}}
8457 !! result
8458 Special:Foobar_nonexistent
8459 !! end
8460
8461 ###
8462 ### Images
8463 ###
8464 ### For Parsoid-specific tests, see
8465 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8466
8467 !! test
8468 Simple image (php)
8469 !! options
8470 php
8471 !! input
8472 [[Image:foobar.jpg]]
8473 !! result
8474 <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>
8475 </p>
8476 !! end
8477
8478 !! test
8479 Simple image (parsoid)
8480 !! options
8481 parsoid=wt2html
8482 !! input
8483 [[Image:foobar.jpg]]
8484 !! result
8485 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
8486 </p>
8487 !! end
8488
8489 !! test
8490 Simple image (using File: namespace, now canonical) (php)
8491 !! options
8492 php
8493 !! input
8494 [[File:foobar.jpg]]
8495 !! result
8496 <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>
8497 </p>
8498 !! end
8499
8500 !! test
8501 Simple image (using File: namespace, now canonical) (parsoid)
8502 !! options
8503 parsoid
8504 !! input
8505 [[File:Foobar.jpg]]
8506 !! result
8507 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
8508 </p>
8509 !! end
8510
8511 !! test
8512 Right-aligned image (php)
8513 !! options
8514 php
8515 !! input
8516 [[Image:foobar.jpg|right]]
8517 !! result
8518 <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>
8519
8520 !! end
8521
8522 !! test
8523 Right-aligned image (parsoid)
8524 !! options
8525 parsoid
8526 !! input
8527 [[File:Foobar.jpg|right]]
8528 !! result
8529 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
8530 !! end
8531
8532 !! test
8533 Image with caption (php)
8534 !! options
8535 php
8536 !! input
8537 [[File:Foobar.jpg|right|Caption text]]
8538 !! result
8539 <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>
8540
8541 !! end
8542
8543 !! test
8544 Image with caption (parsoid)
8545 !! options
8546 parsoid
8547 !! input
8548 [[File:Foobar.jpg|right|Caption text]]
8549 !! result
8550 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8551 !! end
8552
8553 !! test
8554 Image with empty attribute (php)
8555 !! options
8556 php
8557 !! input
8558 [[File:Foobar.jpg|right||Caption text]]
8559 !! result
8560 <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>
8561
8562 !! end
8563
8564 !! test
8565 Image with empty attribute (parsoid)
8566 !! options
8567 parsoid=wt2html
8568 !! input
8569 [[File:Foobar.jpg|right||Caption text]]
8570 !! result
8571 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8572 !! end
8573
8574 !! test
8575 Image with attributes from template (php)
8576 !! options
8577 php
8578 !! input
8579 [[File:Foobar.jpg|{{image_attribs}}]]
8580 !! result
8581 <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>
8582
8583 !! end
8584
8585 !! test
8586 Image with attributes from template (parsoid)
8587 !! options
8588 parsoid
8589 !! input
8590 [[File:Foobar.jpg|{{image_attribs}}]]
8591 !! result
8592 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8593 !! end
8594
8595 !! test
8596 Image with link tails (php)
8597 !! options
8598 php
8599 !! input
8600 123[[File:Foobar.jpg]]456
8601 123[[File:Foobar.jpg|right]]456
8602 123[[File:Foobar.jpg|thumb]]456
8603 !! result
8604 <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
8605 </p>
8606 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
8607 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
8608
8609 !! end
8610
8611 !! test
8612 Image with link tails (parsoid)
8613 !! options
8614 parsoid
8615 !! input
8616 123[[File:Foobar.jpg]]456
8617 123[[File:Foobar.jpg|right]]456
8618 123[[File:Foobar.jpg|thumb]]456
8619 !! result
8620 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p>
8621 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456
8622 123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180"></a></figure>456
8623 !! end
8624
8625 !! test
8626 Image with multiple captions -- only last one is accepted (php)
8627 !! options
8628 php
8629 !! input
8630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8631 !! result
8632 <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>
8633
8634 !! end
8635
8636 !! test
8637 Image with multiple captions -- only last one is accepted (parsoid)
8638 !! options
8639 parsoid
8640 !! input
8641 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8642 !! result
8643 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
8644 !! end
8645
8646 !! test
8647 Image with width attribute at different positions (php)
8648 !! options
8649 php
8650 !! input
8651 [[File:Foobar.jpg|200px|right|Caption]]
8652 [[File:Foobar.jpg|right|200px|Caption]]
8653 [[File:Foobar.jpg|right|Caption|200px]]
8654 !! result
8655 <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>
8656 <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>
8657 <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>
8658
8659 !! end
8660
8661 !! test
8662 Image with width attribute at different positions (parsoid)
8663 !! options
8664 parsoid
8665 !! input
8666 [[File:Foobar.jpg|200px|right|Caption]]
8667 [[File:Foobar.jpg|right|200px|Caption]]
8668 [[File:Foobar.jpg|right|Caption|200px]]
8669 !! result
8670 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
8671 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
8672 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
8673 !! end
8674
8675 !! test
8676 Image with link parameter, wiki target (php)
8677 !! options
8678 php
8679 !! input
8680 [[File:Foobar.jpg|link=Main Page]]
8681 !! result
8682 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8683 </p>
8684 !! end
8685
8686 !! test
8687 Image with link parameter, wiki target (parsoid)
8688 !! options
8689 parsoid
8690 !! input
8691 [[File:Foobar.jpg|link=Main Page]]
8692 !! result
8693 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
8694 !! end
8695
8696 !! test
8697 Image with link parameter, URL target (php)
8698 !! options
8699 php
8700 !! input
8701 [[File:Foobar.jpg|link=http://example.com/]]
8702 !! result
8703 <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>
8704 </p>
8705 !! end
8706
8707 # parsoid bug 49293 (part 1)
8708 !! test
8709 Image with link parameter, URL target (parsoid)
8710 !! options
8711 parsoid
8712 !! input
8713 [[File:Foobar.jpg|link=http://example.com/]]
8714 !! result
8715 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
8716 !! end
8717
8718 !! test
8719 Image with link parameter, protocol-less URL target (php)
8720 !! options
8721 php
8722 !! input
8723 [[File:Foobar.jpg|link=//example.com/]]
8724 !! result
8725 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8726 </p>
8727 !! end
8728
8729 # parsoid bug 49293 (part 2)
8730 !! test
8731 Image with link parameter, protocol-less URL target (parsoid)
8732 !! options
8733 parsoid
8734 !! input
8735 [[File:Foobar.jpg|link=//example.com/]]
8736 !! result
8737 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
8738 !! end
8739
8740 !! test
8741 Image with link parameter, wgExternalLinkTarget
8742 !! input
8743 [[Image:foobar.jpg|link=http://example.com/]]
8744 !! config
8745 wgExternalLinkTarget='foobar'
8746 !! result
8747 <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>
8748 </p>
8749 !! end
8750
8751 !! test
8752 Image with link parameter, wgNoFollowLinks set to false
8753 !! input
8754 [[Image:foobar.jpg|link=http://example.com/]]
8755 !! config
8756 wgNoFollowLinks=false
8757 !! result
8758 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8759 </p>
8760 !! end
8761
8762 !! test
8763 Image with link parameter, wgNoFollowDomainExceptions
8764 !! input
8765 [[Image:foobar.jpg|link=http://example.com/]]
8766 !! config
8767 wgNoFollowDomainExceptions='example.com'
8768 !! result
8769 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8770 </p>
8771 !! end
8772
8773 !! test
8774 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8775 !! input
8776 [[Image:foobar.jpg|link=http://example.com/|Title]]
8777 !! config
8778 wgExternalLinkTarget='foobar'
8779 !! result
8780 <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>
8781 </p>
8782 !! end
8783
8784 !! test
8785 Image with empty link parameter (php)
8786 !! options
8787 php
8788 !! input
8789 [[File:Foobar.jpg|link=]]
8790 !! result
8791 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8792 </p>
8793 !! end
8794
8795 !! test
8796 Image with empty link parameter (parsoid)
8797 !! options
8798 parsoid
8799 !! input
8800 [[File:Foobar.jpg|link=]]
8801 !! result
8802 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
8803 !! end
8804
8805 !! test
8806 Image with link parameter (wiki target) and unnamed parameter (php)
8807 !! options
8808 php
8809 !! input
8810 [[File:Foobar.jpg|link=Main Page|Title]]
8811 !! result
8812 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8813 </p>
8814 !! end
8815
8816 !! test
8817 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8818 !! options
8819 parsoid
8820 !! input
8821 [[File:Foobar.jpg|link=Main Page|Title]]
8822 !! result
8823 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
8824 !! end
8825
8826 !! test
8827 Image with link parameter (URL target) and unnamed parameter (php)
8828 !! options
8829 php
8830 !! input
8831 [[File:Foobar.jpg|link=http://example.com/|Title]]
8832 !! result
8833 <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>
8834 </p>
8835 !! end
8836
8837 !! test
8838 Image with link parameter (URL target) and unnamed parameter (parsoid)
8839 !! options
8840 parsoid
8841 !! input
8842 [[File:Foobar.jpg|link=http://example.com/|Title]]
8843 !! result
8844 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
8845 !! end
8846
8847 !! test
8848 Thumbnail image with link parameter
8849 !! options
8850 php
8851 !! input
8852 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8853 !! result
8854 <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>
8855
8856 !! end
8857
8858 !! test
8859 Manually-specified thumbnail image
8860 !! options
8861 php
8862 !! input
8863 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8864 !! result
8865 <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>
8866
8867 !! end
8868
8869 !! test
8870 Manually-specified thumbnail image with explicit link to wiki page
8871 !! options
8872 php
8873 !! input
8874 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8875 !! result
8876 <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>
8877
8878 !! end
8879
8880 !! test
8881 Manually-specified thumbnail image with explicit link to url
8882 !! options
8883 php
8884 !! input
8885 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8886 !! result
8887 <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>
8888
8889 !! end
8890
8891 !! test
8892 Manually-specified thumbnail image with explicit no link
8893 !! options
8894 php
8895 !! input
8896 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8897 !! result
8898 <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>
8899
8900 !! end
8901
8902 !! test
8903 Manually-specified thumbnail image with explicit link and alt text
8904 !! options
8905 php
8906 !! input
8907 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8908 !! result
8909 <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>
8910
8911 !! end
8912
8913 !! test
8914 Image with frame and link
8915 !! input
8916 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8917 !! result
8918 <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>
8919
8920 !! end
8921
8922 !! test
8923 Image with frame and link and explicit alt
8924 !! input
8925 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8926 !! result
8927 <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>
8928
8929 !! end
8930
8931 !! test
8932 Image with wiki markup in implicit alt
8933 !! input
8934 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8935 !! result
8936 <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>
8937 </p>
8938 !! end
8939
8940 !! test
8941 Image with wiki markup in explicit alt
8942 !! input
8943 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8944 !! result
8945 <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>
8946 </p>
8947 !! end
8948
8949 !! test
8950 Link to image page- image page normally doesn't exists, hence edit link
8951 Add test with existing image page
8952 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8953 !! input
8954 [[:Image:test]]
8955 !! result
8956 <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>
8957 </p>
8958 !! end
8959
8960 !! test
8961 bug 18784 Link to non-existent image page with caption should use caption as link text
8962 !! input
8963 [[:Image:test|caption]]
8964 !! result
8965 <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>
8966 </p>
8967 !! end
8968
8969 !! test
8970 Frameless image caption with a free URL
8971 !! input
8972 [[Image:foobar.jpg|http://example.com]]
8973 !! result
8974 <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>
8975 </p>
8976 !! end
8977
8978 !! test
8979 Thumbnail image caption with a free URL
8980 !! input
8981 [[Image:foobar.jpg|thumb|http://example.com]]
8982 !! result
8983 <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>
8984
8985 !! end
8986
8987 !! test
8988 Thumbnail image caption with a free URL and explicit alt
8989 !! input
8990 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8991 !! result
8992 <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>
8993
8994 !! end
8995
8996 !! test
8997 SVG thumbnails with no language set
8998 !! options
8999 !! input
9000 [[File:Foobar.svg|thumb|width=200]]
9001 !! result
9002 <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>
9003
9004 !! end
9005
9006 !! test
9007 SVG thumbnails with language de
9008 !! options
9009 !! input
9010 [[File:Foobar.svg|thumb|width=200|lang=de]]
9011 !! result
9012 <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>
9013
9014 !! end
9015
9016 !! test
9017 SVG thumbnails with invalid language code
9018 !! options
9019 !! input
9020 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9021 !! result
9022 <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>
9023
9024 !! end
9025
9026 !! test
9027 BUG 1887: A ISBN with a thumbnail
9028 !! input
9029 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9030 !! result
9031 <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>
9032
9033 !! end
9034
9035 !! test
9036 BUG 1887: A RFC with a thumbnail
9037 !! input
9038 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9039 !! result
9040 <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>
9041
9042 !! end
9043
9044 !! test
9045 BUG 1887: A mailto link with a thumbnail
9046 !! input
9047 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9048 !! result
9049 <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>
9050
9051 !! end
9052
9053 # Pending resolution to bug 368
9054 !! test
9055 BUG 648: Frameless image caption with a link
9056 !! input
9057 [[Image:foobar.jpg|text with a [[link]] in it]]
9058 !! result
9059 <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>
9060 </p>
9061 !! end
9062
9063 !! test
9064 BUG 648: Frameless image caption with a link (suffix)
9065 !! input
9066 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9067 !! result
9068 <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>
9069 </p>
9070 !! end
9071
9072 !! test
9073 BUG 648: Frameless image caption with an interwiki link
9074 !! input
9075 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9076 !! result
9077 <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>
9078 </p>
9079 !! end
9080
9081 !! test
9082 BUG 648: Frameless image caption with a piped interwiki link
9083 !! input
9084 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9085 !! result
9086 <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>
9087 </p>
9088 !! end
9089
9090 !! test
9091 Escape HTML special chars in image alt text
9092 !! input
9093 [[Image:foobar.jpg|& < > "]]
9094 !! result
9095 <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>
9096 </p>
9097 !! end
9098
9099 !! test
9100 BUG 499: Alt text should have &#1234;, not &amp;1234;
9101 !! input
9102 [[Image:foobar.jpg|&#9792;]]
9103 !! result
9104 <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>
9105 </p>
9106 !! end
9107
9108 !! test
9109 Broken image caption with link
9110 !! input
9111 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9112 !! result
9113 <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.
9114 </p>
9115 !! end
9116
9117 !! test
9118 Image caption containing another image
9119 !! input
9120 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9121 !! result
9122 <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>
9123
9124 !! end
9125
9126 !! test
9127 Image caption containing a newline
9128 !! input
9129 [[Image:Foobar.jpg|This
9130 *is some text]]
9131 !! result
9132 <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>
9133 </p>
9134 !!end
9135
9136 !!test
9137 Parsoid: Image caption containing leading space
9138 (The leading space should not trigger nowiki escaping in wt2wt mode)
9139 !! input
9140 [[Image:Foobar.jpg|thumb| bar]]
9141 !! result
9142 <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>
9143
9144 !!end
9145
9146 !! test
9147 Bug 3090: External links other than http: in image captions
9148 !! input
9149 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9150 !! result
9151 <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>
9152
9153 !! end
9154
9155 !! test
9156 Custom class
9157 !! input
9158 [[Image:foobar.jpg|a|class=b]]
9159 !! result
9160 <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>
9161 </p>
9162 !! end
9163
9164 !! test
9165 Localized image handling (1).
9166 !! options
9167 language=es
9168 !! input
9169 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9170 !! result
9171 <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>
9172
9173 !! end
9174
9175 !! test
9176 Localized image handling (2).
9177 !! options
9178 language=es
9179 !! input
9180 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9181 !! result
9182 <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>
9183
9184 !! end
9185
9186 !! test
9187 "border", "frameless" and "class" attributes on an image.
9188 !! input
9189 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9190 !! result
9191 <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>
9192 </p>
9193 !! end
9194
9195 !! article
9196 File:Barfoo.jpg
9197 !! text
9198 #REDIRECT [[File:Barfoo.jpg]]
9199 !! endarticle
9200
9201 !! test
9202 Redirected image
9203 !! input
9204 [[Image:Barfoo.jpg]]
9205 !! result
9206 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9207 </p>
9208 !! end
9209
9210 !! test
9211 Missing image with uploads disabled
9212 !! options
9213 wgEnableUploads=0
9214 !! input
9215 [[Image:Foobaz.jpg]]
9216 !! result
9217 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9218 </p>
9219 !! end
9220
9221 # Parsoid-specific testing for images
9222 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9223 # Currently imperfect due to a flaw in the Parsoid testrunner
9224 # Work in progress
9225 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9226 # image tests.
9227
9228 !! test
9229 Parsoid-specific image handling - simple image with size and middle alignment
9230 !! options
9231 parsoid
9232 !! input
9233 [[Image:Foobar.jpg|50px|middle]]
9234 !! result
9235 <p>
9236 <span class="mw-valign-middle" typeof="mw:Image">
9237 <a href="File:Foobar.jpg">
9238 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9239 </a>
9240 </span>
9241 </p>
9242 !! end
9243
9244 !! test
9245 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9246 !! options
9247 parsoid
9248 !! input
9249 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9250 !! result
9251 <p>
9252 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9253 <a href="File:Foobar.jpg">
9254 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9255 </a>
9256 </span>
9257 </p>
9258 !! end
9259
9260 !! test
9261 Parsoid-specific image handling - simple image with border and size spec
9262 !! options
9263 parsoid
9264 !! input
9265 [[Image:Foobar.jpg|50px|border|caption]]
9266 !! result
9267 <p>
9268 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9269 <a href="File:Foobar.jpg">
9270 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9271 </a>
9272 </span>
9273 </p>
9274 !! end
9275
9276 !! test
9277 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9278 !! options
9279 parsoid
9280 !! input
9281 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9282 !! result
9283 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9284 <a href="File:Foobar.jpg">
9285 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9286 </a>
9287 <figcaption>caption content</figcaption>
9288 </figure>
9289 !! end
9290
9291 !! test
9292 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9293 !! options
9294 parsoid
9295 !! input
9296 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9297 !! result
9298 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9299 <a href="File:Foobar.jpg">
9300 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9301 </a>
9302 <figcaption>caption</figcaption>
9303 </figure>
9304 !! end
9305
9306 !! test
9307 Parsoid-specific image handling - framed image with specific size and caption
9308 !! options
9309 parsoid
9310 !! input
9311 [[Image:Foobar.jpg|500x50px|frame|caption]]
9312 !! result
9313 <figure typeof="mw:Image/Frame">
9314 <a href="File:Foobar.jpg">
9315 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9316 </a>
9317 <figcaption>caption</figcaption>
9318 </figure>
9319 !! end
9320
9321 !! test
9322 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9323 !! options
9324 parsoid
9325 !! input
9326 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9327 !! result
9328 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9329 <a href="File:Foobar.jpg">
9330 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9331 </a>
9332 <figcaption>caption</figcaption>
9333 </figure>
9334 !! end
9335
9336 !! test
9337 Parsoid-specific image handling - frameless image with specific size, border, and caption
9338 !! options
9339 parsoid
9340 !! input
9341 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9342 !! result
9343 <p>
9344 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9345 <a href="File:Foobar.jpg">
9346 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9347 </a>
9348 </p>
9349 !! end
9350
9351 #!! test
9352 #Parsoid-specific image handling - simple image with a formatted caption
9353 #!! options
9354 #parsoid
9355 #!! input
9356 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9357 #!! result
9358 #<p>
9359 #<span typeof="mw:Image">
9360 #<a class="mw-default-size" href="Image:Foobar.jpg">
9361 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9362 #</a>
9363 #<span>abc</span>
9364 #</span>
9365 #</p>
9366
9367
9368 ###
9369 ### Subpages
9370 ###
9371 !! article
9372 Subpage test/subpage
9373 !! text
9374 foo
9375 !! endarticle
9376
9377 !! test
9378 Subpage link
9379 !! options
9380 subpage title=[[Subpage test]]
9381 !! input
9382 [[/subpage]]
9383 !! result
9384 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9385 </p>
9386 !! end
9387
9388 !! test
9389 Subpage noslash link
9390 !! options
9391 subpage title=[[Subpage test]]
9392 !!input
9393 [[/subpage/]]
9394 !! result
9395 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9396 </p>
9397 !! end
9398
9399 # TODO: make this PHP-parser compatible!
9400 !! test
9401 Relative subpage noslash link
9402 !! options
9403 parsoid=wt2wt,wt2html,html2html
9404 subpage title=[[Subpage test/1/2/3/4]]
9405 !!input
9406 [[../../subpage/]]
9407
9408 [[../../subpage]]
9409 !! result
9410 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9411 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9412 !! end
9413
9414 # TODO: make this PHP-parser compatible!
9415 !! test
9416 Parsoid: dot-slash prefixed wikilinks
9417 !! options
9418 parsoid=wt2wt,wt2html,html2html
9419 !!input
9420 [[./foo]]
9421
9422 [[././bar]]
9423
9424 [[././baz/]]
9425 !! result
9426 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9427 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9428 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9429 !! end
9430
9431 !! test
9432 Disabled subpages
9433 !! input
9434 [[/subpage]]
9435 !! result
9436 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9437 </p>
9438 !! end
9439
9440 !! test
9441 BUG 561: {{/Subpage}}
9442 !! options
9443 subpage title=[[Page]]
9444 !! input
9445 {{/Subpage}}
9446 !! result
9447 <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>
9448 </p>
9449 !! end
9450
9451 ###
9452 ### Categories
9453 ###
9454 !! article
9455 Category:MediaWiki User's Guide
9456 !! text
9457 blah
9458 !! endarticle
9459
9460 !! test
9461 Link to category
9462 !! input
9463 [[:Category:MediaWiki User's Guide]]
9464 !! result
9465 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9466 </p>
9467 !! end
9468
9469 !! test
9470 Simple category
9471 !! options
9472 cat
9473 !! input
9474 [[Category:MediaWiki User's Guide]]
9475 !! result
9476 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9477 !! end
9478
9479 !! test
9480 PAGESINCATEGORY invalid title fatal (r33546 fix)
9481 !! input
9482 {{PAGESINCATEGORY:<bogus>}}
9483 !! result
9484 <p>0
9485 </p>
9486 !! end
9487
9488 !! test
9489 Category with different sort key
9490 !! options
9491 cat
9492 !! input
9493 [[Category:MediaWiki User's Guide|Foo]]
9494 !! result
9495 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9496 !! end
9497
9498 !! test
9499 Category with identical sort key
9500 !! options
9501 cat
9502 !! input
9503 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9504 !! result
9505 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9506 !! end
9507
9508 !! test
9509 Category with empty sort key
9510 !! options
9511 cat
9512 pst
9513 !! input
9514 [[Category:MediaWiki User's Guide|]]
9515 !! result
9516 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9517 !! end
9518
9519 !! test
9520 Category with empty sort key and parentheses
9521 !! options
9522 cat
9523 pst
9524 !! input
9525 [[Category:Foo (bar)|]]
9526 !! result
9527 [[Category:Foo (bar)|Foo]]
9528 !! end
9529
9530 !! test
9531 Category with link tail
9532 !! options
9533 cat
9534 pst
9535 !! input
9536 123[[Category:Foo]]456
9537 !! result
9538 123[[Category:Foo]]456
9539 !! end
9540
9541 !! test
9542 Category with template
9543 !! options
9544 cat
9545 pst
9546 !! input
9547 [[Category:{{echo|Foo}}]]
9548 !! result
9549 [[Category:{{echo|Foo}}]]
9550 !! end
9551
9552 !! test
9553 Category with template in sort key
9554 !! options
9555 cat
9556 pst
9557 !! input
9558 [[Category:Foo|{{echo|Bar}}]]
9559 !! result
9560 [[Category:Foo|{{echo|Bar}}]]
9561 !! end
9562
9563 !! test
9564 Category with template in sort key and title
9565 !! options
9566 cat
9567 pst
9568 !! input
9569 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9570 !! result
9571 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9572 !! end
9573
9574 !! test
9575 Category / paragraph interactions
9576 !! input
9577 Foo [[Category:Baz]] Bar
9578
9579 Foo [[Category:Baz]]
9580 Bar
9581
9582 Foo
9583 [[Category:Baz]]
9584 Bar
9585
9586 Foo
9587 [[Category:Baz]] Bar
9588
9589 Foo
9590 [[Category:Baz]]
9591 [[Category:Baz]]
9592 [[Category:Baz]]
9593 Bar
9594
9595 [[Category:Baz]]
9596 [[Category:Baz]]
9597 [[Category:Baz]]
9598
9599 [[Category:Baz]]
9600 {{echo|[[Category:Baz]]}}
9601 [[Category:Baz]]
9602 !! result
9603 <p>Foo Bar
9604 </p><p>Foo
9605 Bar
9606 </p><p>Foo
9607 Bar
9608 </p><p>Foo Bar
9609 </p><p>Foo
9610 Bar
9611 </p>
9612 !! end
9613
9614 !! test
9615 Parsoid: Serialize link to category page with colon escape
9616 !! options
9617 parsoid
9618 !! input
9619
9620 [[:Category:Foo]]
9621 [[:Category:Foo|Bar]]
9622 !! result
9623 <p>
9624 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9625 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9626 </p>
9627 !! end
9628
9629 !! test
9630 Parsoid: Link prefix/suffixes aren't applied to category links
9631 !! options
9632 parsoid=wt2html,wt2wt,html2html
9633 language=is
9634 !! input
9635 x[[Category:Foo]]y
9636 !! result
9637 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9638 !! end
9639
9640 !! test
9641 Parsoid: Serialize link to file page with colon escape
9642 !! options
9643 parsoid
9644 !! input
9645
9646 [[:File:Foo.png]]
9647 [[:File:Foo.png|Bar]]
9648 !! result
9649 <p>
9650 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9651 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9652 </p>
9653 !! end
9654
9655 !! test
9656 Parsoid: Serialize a genuine category link without colon escape
9657 !! options
9658 parsoid
9659 !! input
9660 [[Category:Foo]]
9661 [[Category:Foo|Bar]]
9662 !! result
9663 <link rel="mw:WikiLink/Category" href="Category:Foo">
9664 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9665 !! end
9666
9667 ###
9668 ### Inter-language links
9669 ###
9670 !! test
9671 Inter-language links
9672 !! options
9673 ill
9674 !! input
9675 [[es:Alimento]]
9676 [[fr:Nourriture]]
9677 [[zh:&#39135;&#21697;]]
9678 !! result
9679 es:Alimento fr:Nourriture zh:食品
9680 !! end
9681
9682 !! test
9683 Duplicate interlanguage links (bug 24502)
9684 !! options
9685 ill
9686 !! input
9687 [[es:1]]
9688 [[es:2]]
9689 [[fr:1]]
9690 [[fr:2]]
9691 !! result
9692 es:1 fr:1
9693 !! end
9694
9695 ###
9696 ### Sections
9697 ###
9698 !! test
9699 Basic section headings
9700 !! input
9701 == Headline 1 ==
9702 Some text
9703
9704 ==Headline 2==
9705 More
9706 ===Smaller headline===
9707 Blah blah
9708 !! result
9709 <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>
9710 <p>Some text
9711 </p>
9712 <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>
9713 <p>More
9714 </p>
9715 <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>
9716 <p>Blah blah
9717 </p>
9718 !! end
9719
9720 !! test
9721 Section headings with TOC
9722 !! input
9723 == Headline 1 ==
9724 === Subheadline 1 ===
9725 ===== Skipping a level =====
9726 ====== Skipping a level ======
9727
9728 == Headline 2 ==
9729 Some text
9730 ===Another headline===
9731 !! result
9732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9733 <ul>
9734 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9735 <ul>
9736 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9737 <ul>
9738 <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>
9739 <ul>
9740 <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>
9741 </ul>
9742 </li>
9743 </ul>
9744 </li>
9745 </ul>
9746 </li>
9747 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9748 <ul>
9749 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9750 </ul>
9751 </li>
9752 </ul>
9753 </div>
9754 <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>
9755 <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>
9756 <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>
9757 <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>
9758 <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>
9759 <p>Some text
9760 </p>
9761 <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>
9762
9763 !! end
9764
9765 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9766 !! test
9767 Handling of sections up to level 6 and beyond
9768 !! input
9769 = Level 1 Heading=
9770 == Level 2 Heading==
9771 === Level 3 Heading===
9772 ==== Level 4 Heading====
9773 ===== Level 5 Heading=====
9774 ====== Level 6 Heading======
9775 ======= Level 7 Heading=======
9776 ======== Level 8 Heading========
9777 ========= Level 9 Heading=========
9778 ========== Level 10 Heading==========
9779 !! result
9780 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9781 <ul>
9782 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9783 <ul>
9784 <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>
9785 <ul>
9786 <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>
9787 <ul>
9788 <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>
9789 <ul>
9790 <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>
9791 <ul>
9792 <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>
9793 <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>
9794 <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>
9795 <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>
9796 <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>
9797 </ul>
9798 </li>
9799 </ul>
9800 </li>
9801 </ul>
9802 </li>
9803 </ul>
9804 </li>
9805 </ul>
9806 </li>
9807 </ul>
9808 </div>
9809 <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>
9810 <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>
9811 <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>
9812 <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>
9813 <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>
9814 <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>
9815 <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>
9816 <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>
9817 <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>
9818 <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>
9819
9820 !! end
9821
9822 !! test
9823 TOC regression (bug 9764)
9824 !! input
9825 == title 1 ==
9826 === title 1.1 ===
9827 ==== title 1.1.1 ====
9828 === title 1.2 ===
9829 == title 2 ==
9830 === title 2.1 ===
9831 !! result
9832 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9833 <ul>
9834 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9835 <ul>
9836 <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>
9837 <ul>
9838 <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>
9839 </ul>
9840 </li>
9841 <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>
9842 </ul>
9843 </li>
9844 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9845 <ul>
9846 <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>
9847 </ul>
9848 </li>
9849 </ul>
9850 </div>
9851 <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>
9852 <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>
9853 <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>
9854 <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>
9855 <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>
9856 <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>
9857
9858 !! end
9859
9860 !! test
9861 TOC with wgMaxTocLevel=3 (bug 6204)
9862 !! options
9863 wgMaxTocLevel=3
9864 !! input
9865 == title 1 ==
9866 === title 1.1 ===
9867 ==== title 1.1.1 ====
9868 === title 1.2 ===
9869 == title 2 ==
9870 === title 2.1 ===
9871 !! result
9872 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9873 <ul>
9874 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9875 <ul>
9876 <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>
9877 <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>
9878 </ul>
9879 </li>
9880 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9881 <ul>
9882 <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>
9883 </ul>
9884 </li>
9885 </ul>
9886 </div>
9887 <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>
9888 <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>
9889 <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>
9890 <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>
9891 <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>
9892 <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>
9893
9894 !! end
9895
9896 !! test
9897 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9898 !! options
9899 wgMaxTocLevel=3
9900 !! input
9901 ==Section 1==
9902 ===Section 1.1===
9903 ====Section 1.1.1====
9904 ====Section 1.1.1.1====
9905 ==Section 2==
9906 !! result
9907 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9908 <ul>
9909 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9910 <ul>
9911 <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>
9912 </ul>
9913 </li>
9914 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9915 </ul>
9916 </div>
9917 <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>
9918 <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>
9919 <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>
9920 <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>
9921 <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>
9922
9923 !! end
9924
9925
9926 !! test
9927 Resolving duplicate section names
9928 !! input
9929 == Foo bar ==
9930 == Foo bar ==
9931 !! result
9932 <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>
9933 <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>
9934
9935 !! end
9936
9937 !! test
9938 Resolving duplicate section names with differing case (bug 10721)
9939 !! input
9940 == Foo bar ==
9941 == Foo Bar ==
9942 !! result
9943 <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>
9944 <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>
9945
9946 !! end
9947
9948 !! article
9949 Template:sections
9950 !! text
9951 ===Section 1===
9952 ==Section 2==
9953 !! endarticle
9954
9955 !! test
9956 Template with sections, __NOTOC__
9957 !! input
9958 __NOTOC__
9959 ==Section 0==
9960 {{sections}}
9961 ==Section 4==
9962 !! result
9963 <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>
9964 <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>
9965 <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>
9966 <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>
9967
9968 !! end
9969
9970 !! test
9971 __NOEDITSECTION__ keyword
9972 !! input
9973 __NOEDITSECTION__
9974 ==Section 1==
9975 ==Section 2==
9976 !! result
9977 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9978 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9979
9980 !! end
9981
9982 !! test
9983 Link inside a section heading
9984 !! input
9985 ==Section with a [[Main Page|link]] in it==
9986 !! result
9987 <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>
9988
9989 !! end
9990
9991 !! test
9992 TOC regression (bug 12077)
9993 !! input
9994 __TOC__
9995 == title 1 ==
9996 === title 1.1 ===
9997 == title 2 ==
9998 !! result
9999 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10000 <ul>
10001 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10002 <ul>
10003 <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>
10004 </ul>
10005 </li>
10006 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10007 </ul>
10008 </div>
10009 <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>
10010 <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>
10011 <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>
10012
10013 !! end
10014
10015 !! test
10016 BUG 1219 URL next to image (good)
10017 !! input
10018 http://example.com [[Image:foobar.jpg]]
10019 !! result
10020 <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>
10021 </p>
10022 !!end
10023
10024 !! test
10025 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10026 !! input
10027 ===
10028 The line above must have a trailing space!
10029 === <!--
10030 --> <!-- -->
10031 But just in case it doesn't...
10032 !! result
10033 <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>
10034 <p>The line above must have a trailing space!
10035 </p>
10036 <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>
10037 <p>But just in case it doesn't...
10038 </p>
10039 !! end
10040
10041 !! test
10042 Header with special characters (bug 25462)
10043 !! input
10044 The tooltips shall not show entities to the user (ie. be double escaped)
10045
10046 == text > text ==
10047 section 1
10048
10049 == text < text ==
10050 section 2
10051
10052 == text & text ==
10053 section 3
10054
10055 == text ' text ==
10056 section 4
10057
10058 == text " text ==
10059 section 5
10060 !! result
10061 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10062 </p>
10063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10064 <ul>
10065 <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>
10066 <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>
10067 <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>
10068 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10069 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10070 </ul>
10071 </div>
10072 <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>
10073 <p>section 1
10074 </p>
10075 <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>
10076 <p>section 2
10077 </p>
10078 <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>
10079 <p>section 3
10080 </p>
10081 <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>
10082 <p>section 4
10083 </p>
10084 <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>
10085 <p>section 5
10086 </p>
10087 !! end
10088
10089 !! test
10090 Headers with excess '=' characters
10091 (Are similar tests necessary beyond the 1st level?)
10092 !! input
10093 =foo==
10094 ==foo=
10095 =''italic'' heading==
10096 ==''italic'' heading=
10097 !! result
10098 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10099 <ul>
10100 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10101 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10102 <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>
10103 <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>
10104 </ul>
10105 </div>
10106 <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>
10107 <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>
10108 <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>
10109 <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>
10110
10111 !! end
10112
10113 !! test
10114 HTML headers vs TOC (bug 23393)
10115 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10116 !! input
10117 <h1>Header 1</h1>
10118 == Header 1.1 ==
10119 == Header 1.2 ==
10120
10121 <h1>Header 2
10122 </h1>
10123 == Header 2.1 ==
10124 == Header 2.2 ==
10125 __NOEDITSECTION__
10126 !! result
10127 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10128 <ul>
10129 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10130 <ul>
10131 <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>
10132 <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>
10133 </ul>
10134 </li>
10135 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10136 <ul>
10137 <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>
10138 <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>
10139 </ul>
10140 </li>
10141 </ul>
10142 </div>
10143 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10144 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10145 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10146 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10147 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10148 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10149
10150 !! end
10151
10152 !! test
10153 BUG 1219 URL next to image (broken)
10154 !! input
10155 http://example.com[[Image:foobar.jpg]]
10156 !! result
10157 <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>
10158 </p>
10159 !!end
10160
10161 !! test
10162 Bug 1186 news: in the middle of text
10163 !! input
10164 http://en.wikinews.org/wiki/Wikinews:Workplace
10165 !! result
10166 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10167 </p>
10168 !!end
10169
10170
10171 !! test
10172 Namespaced link must have a title
10173 !! input
10174 [[Project:]]
10175 !! result
10176 <p>[[Project:]]
10177 </p>
10178 !!end
10179
10180 !! test
10181 Namespaced link must have a title (bad fragment version)
10182 !! input
10183 [[Project:#fragment]]
10184 !! result
10185 <p>[[Project:#fragment]]
10186 </p>
10187 !!end
10188
10189
10190 ###
10191 ### HTML tags and HTML attributes
10192 ###
10193
10194 !! test
10195 div with no attributes
10196 !! input
10197 <div>HTML rocks</div>
10198 !! result
10199 <div>HTML rocks</div>
10200
10201 !! end
10202
10203 !! test
10204 div with double-quoted attribute
10205 !! input
10206 <div id="rock">HTML rocks</div>
10207 !! result
10208 <div id="rock">HTML rocks</div>
10209
10210 !! end
10211
10212 !! test
10213 div with single-quoted attribute
10214 !! input
10215 <div id='rock'>HTML rocks</div>
10216 !! result
10217 <div id="rock">HTML rocks</div>
10218
10219 !! end
10220
10221 !! test
10222 div with unquoted attribute
10223 !! input
10224 <div id=rock>HTML rocks</div>
10225 !! result
10226 <div id="rock">HTML rocks</div>
10227
10228 !! end
10229
10230 !! test
10231 div with illegal double attributes
10232 !! input
10233 <div id="a" id="b">HTML rocks</div>
10234 !! result
10235 <div id="b">HTML rocks</div>
10236
10237 !!end
10238
10239 # FIXME: produce empty string instead of "class" in the PHP parser, following
10240 # the HTML5 spec.
10241 !! test
10242 div with empty attribute value, space before equals
10243 !! options
10244 parsoid
10245 !! input
10246 <div class =>HTML rocks</div>
10247 !! result
10248 <div class="">HTML rocks</div>
10249
10250 !! end
10251
10252 # The PHP parser escapes the opening brace to &#123; for some reason, so
10253 # disabled this test for it.
10254 !! test
10255 div with braces in attribute value
10256 !! options
10257 parsoid
10258 !! input
10259 <div title="{}">Foo</div>
10260 !! result
10261 <div title="{}">Foo</div>
10262 !! end
10263
10264 # This it very inconsistent in the PHP parser: it returns
10265 # class="class" if there is a space between the name and the equal sign (see
10266 # 'div with empty attribute value, space before equals'), but strips the
10267 # attribute completely if the space is missing. We hope that not much content
10268 # depends on this, so are implementing the behavior below in Parsoid for
10269 # consistencies' sake. Disabled for the PHP parser.
10270 # FIXME: fix this behavior in the PHP parser?
10271 !! test
10272 div with empty attribute value, no space before equals
10273 !! options
10274 parsoid
10275 !! input
10276 <div class=>HTML rocks</div>
10277 !! result
10278 <div class="">HTML rocks</div>
10279
10280 !! end
10281
10282 !! test
10283 HTML multiple attributes correction
10284 !! input
10285 <p class="error" class="awesome">Awesome!</p>
10286 !! result
10287 <p class="awesome">Awesome!</p>
10288
10289 !!end
10290
10291 !! test
10292 Table multiple attributes correction
10293 !! input
10294 {|
10295 !+ class="error" class="awesome"| status
10296 |}
10297 !! result
10298 <table>
10299 <tr>
10300 <th class="awesome"> status
10301 </th></tr></table>
10302
10303 !!end
10304
10305 !! test
10306 DIV IN UPPERCASE
10307 !! input
10308 <DIV ID="x">HTML ROCKS</DIV>
10309 !! result
10310 <div id="x">HTML ROCKS</div>
10311
10312 !!end
10313
10314 !! test
10315 Non-ASCII pseudo-tags are rendered as text
10316 !! input
10317 <khyô>
10318 !! result
10319 <p>&lt;khyô&gt;
10320 </p>
10321 !! end
10322
10323 !! test
10324 Pseudo-tag with URL 'name' renders as url link
10325 !! input
10326 <http://example.com/>
10327 !! result
10328 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10329 </p>
10330 !! end
10331
10332 !! test
10333 text with amp in the middle of nowhere
10334 !! input
10335 Remember AT&T?
10336 !!result
10337 <p>Remember AT&amp;T?
10338 </p>
10339 !! end
10340
10341 !! test
10342 text with character entity: eacute
10343 !! input
10344 I always thought &eacute; was a cute letter.
10345 !! result
10346 <p>I always thought &#233; was a cute letter.
10347 </p>
10348 !! end
10349
10350 !! test
10351 text with entity-escaped character entity-like string: eacute
10352 !! input
10353 I always thought &amp;eacute; was a cute letter.
10354 !! result
10355 <p>I always thought &amp;eacute; was a cute letter.
10356 </p>
10357 !! end
10358
10359 !! test
10360 text with undefined character entity: xacute
10361 !! input
10362 I always thought &xacute; was a cute letter.
10363 !! result
10364 <p>I always thought &amp;xacute; was a cute letter.
10365 </p>
10366 !! end
10367
10368
10369 ###
10370 ### Nesting tests (see bug 41545, 50604, 51081)
10371 ###
10372
10373 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10374 # Note that html2wt is considerably more difficult if we use <b> in
10375 # the test case, instead of <big>
10376 !! test
10377 Ensure that HTML adoption agency algorithm is properly implemented.
10378 !! input
10379 <big>X<big>Y</big>Z</big>
10380 !! result
10381 <p><big>X<big>Y</big>Z</big>
10382 </p>
10383 !! end
10384
10385 # This was bug 41545 in the PHP parser.
10386 !! test
10387 Nesting of <kbd>
10388 !! input
10389 <kbd>X<kbd>Y</kbd>Z</kbd>
10390 !! result
10391 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10392 </p>
10393 !! end
10394
10395 # The following cases were bug 51081 in the PHP parser.
10396 # Note that there are some other nestable tags (b, i, etc) which are
10397 # not covered; see bug 51081 for discussion.
10398 !! test
10399 Nesting of <em>
10400 !! input
10401 <em>X<em>Y</em>Z</em>
10402 !! result
10403 <p><em>X<em>Y</em>Z</em>
10404 </p>
10405 !! end
10406
10407 !! test
10408 Nesting of <strong>
10409 !! input
10410 <strong>X<strong>Y</strong>Z</strong>
10411 !! result
10412 <p><strong>X<strong>Y</strong>Z</strong>
10413 </p>
10414 !! end
10415
10416 !! test
10417 Nesting of <q>
10418 !! input
10419 <q>X<q>Y</q>Z</q>
10420 !! result
10421 <p><q>X<q>Y</q>Z</q>
10422 </p>
10423 !! end
10424
10425 !! test
10426 Nesting of <ruby>
10427 !! input
10428 <ruby>X<ruby>Y</ruby>Z</ruby>
10429 !! result
10430 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10431 </p>
10432 !! end
10433
10434 !! test
10435 Nesting of <bdo>
10436 !! input
10437 <bdo>X<bdo>Y</bdo>Z</bdo>
10438 !! result
10439 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10440 </p>
10441 !! end
10442
10443
10444 ###
10445 ### Media links
10446 ###
10447
10448 !! test
10449 Media link
10450 !! input
10451 [[Media:Foobar.jpg]]
10452 !! result
10453 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10454 </p>
10455 !! end
10456
10457 !! test
10458 Media link with text
10459 !! input
10460 [[Media:Foobar.jpg|A neat file to look at]]
10461 !! result
10462 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10463 </p>
10464 !! end
10465
10466 # FIXME: this is still bad HTML tag nesting
10467 !! test
10468 Media link with nasty text
10469 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10470 !! input
10471 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10472 !! result
10473 <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>
10474
10475 !! end
10476
10477 !! test
10478 Media link to nonexistent file (bug 1702)
10479 !! input
10480 [[Media:No such.jpg]]
10481 !! result
10482 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10483 </p>
10484 !! end
10485
10486 !! test
10487 Image link to nonexistent file (bug 1850 - good)
10488 !! input
10489 [[Image:No such.jpg]]
10490 !! result
10491 <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>
10492 </p>
10493 !! end
10494
10495 !! test
10496 :Image link to nonexistent file (bug 1850 - bad)
10497 !! input
10498 [[:Image:No such.jpg]]
10499 !! result
10500 <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>
10501 </p>
10502 !! end
10503
10504
10505
10506 !! test
10507 Character reference normalization in link text (bug 1938)
10508 !! input
10509 [[Main Page|this&that]]
10510 !! result
10511 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10512 </p>
10513 !!end
10514
10515 !! article
10516 אַ
10517 !! text
10518 Test for unicode normalization
10519
10520 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10521 !! endarticle
10522
10523 !! test
10524 (bug 19451) Links should refer to the normalized form.
10525 !! input
10526 [[&#xFB2E;]]
10527 [[&#x5d0;&#x5b7;]]
10528 [[&#x5d0;ַ]]
10529 [[א&#x5b7;]]
10530 [[אַ]]
10531 !! result
10532 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10533 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10534 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10535 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10536 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10537 </p>
10538 !! end
10539
10540 !! test
10541 Empty attribute crash test (bug 2067)
10542 !! input
10543 <font color="">foo</font>
10544 !! result
10545 <p><font color="">foo</font>
10546 </p>
10547 !! end
10548
10549 !! test
10550 Empty attribute crash test single-quotes (bug 2067)
10551 !! input
10552 <font color=''>foo</font>
10553 !! result
10554 <p><font color="">foo</font>
10555 </p>
10556 !! end
10557
10558 !! test
10559 Attribute test: equals, then nothing
10560 !! input
10561 <font color=>foo</font>
10562 !! result
10563 <p><font>foo</font>
10564 </p>
10565 !! end
10566
10567 !! test
10568 Attribute test: unquoted value
10569 !! input
10570 <font color=x>foo</font>
10571 !! result
10572 <p><font color="x">foo</font>
10573 </p>
10574 !! end
10575
10576 !! test
10577 Attribute test: unquoted but illegal value (hash)
10578 !! input
10579 <font color=#x>foo</font>
10580 !! result
10581 <p><font color="#x">foo</font>
10582 </p>
10583 !! end
10584
10585 !! test
10586 Attribute test: no value
10587 !! input
10588 <font color>foo</font>
10589 !! result
10590 <p><font color="color">foo</font>
10591 </p>
10592 !! end
10593
10594 !! test
10595 Bug 2095: link with three closing brackets
10596 !! input
10597 [[Main Page]]]
10598 !! result
10599 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10600 </p>
10601 !! end
10602
10603 !! test
10604 Bug 2095: link with pipe and three closing brackets
10605 !! input
10606 [[Main Page|link]]]
10607 !! result
10608 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10609 </p>
10610 !! end
10611
10612 !! test
10613 Bug 2095: link with pipe and three closing brackets, version 2
10614 !! input
10615 [[Main Page|[http://example.com/]]]
10616 !! result
10617 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10618 </p>
10619 !! end
10620
10621
10622 ###
10623 ### Safety
10624 ###
10625
10626 !! article
10627 Template:Dangerous attribute
10628 !! text
10629 " onmouseover="alert(document.cookie)
10630 !! endarticle
10631
10632 !! article
10633 Template:Dangerous style attribute
10634 !! text
10635 border-size: expression(alert(document.cookie))
10636 !! endarticle
10637
10638 !! article
10639 Template:Div style
10640 !! text
10641 <div style="float: right; {{{1}}}">Magic div</div>
10642 !! endarticle
10643
10644 !! test
10645 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10646 !! input
10647 <div title="{{test}}"></div>
10648 !! result
10649 <div title="This is a test template"></div>
10650
10651 !! end
10652
10653 !! test
10654 Bug 2304: HTML attribute safety (dangerous template; 2309)
10655 !! input
10656 <div title="{{dangerous attribute}}"></div>
10657 !! result
10658 <div title=""></div>
10659
10660 !! end
10661
10662 !! test
10663 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10664 !! input
10665 <div style="{{dangerous style attribute}}"></div>
10666 !! result
10667 <div style="/* insecure input */"></div>
10668
10669 !! end
10670
10671 !! test
10672 Bug 2304: HTML attribute safety (safe parameter; 2309)
10673 !! input
10674 {{div style|width: 200px}}
10675 !! result
10676 <div style="float: right; width: 200px">Magic div</div>
10677
10678 !! end
10679
10680 !! test
10681 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10682 !! input
10683 {{div style|width: expression(alert(document.cookie))}}
10684 !! result
10685 <div style="/* insecure input */">Magic div</div>
10686
10687 !! end
10688
10689 !! test
10690 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10691 !! input
10692 {{div style|"><script>alert(document.cookie)</script>}}
10693 !! result
10694 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10695
10696 !! end
10697
10698 !! test
10699 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10700 !! input
10701 {{div style|" ><script>alert(document.cookie)</script>}}
10702 !! result
10703 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10704
10705 !! end
10706
10707 !! test
10708 Bug 2304: HTML attribute safety (link)
10709 !! input
10710 <div title="[[Main Page]]"></div>
10711 !! result
10712 <div title="&#91;&#91;Main Page]]"></div>
10713
10714 !! end
10715
10716 !! test
10717 Bug 2304: HTML attribute safety (italics)
10718 !! input
10719 <div title="''foobar''"></div>
10720 !! result
10721 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10722
10723 !! end
10724
10725 !! test
10726 Bug 2304: HTML attribute safety (bold)
10727 !! input
10728 <div title="'''foobar'''"></div>
10729 !! result
10730 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10731
10732 !! end
10733
10734
10735 !! test
10736 Bug 2304: HTML attribute safety (ISBN)
10737 !! input
10738 <div title="ISBN 1234567890"></div>
10739 !! result
10740 <div title="&#73;SBN 1234567890"></div>
10741
10742 !! end
10743
10744 !! test
10745 Bug 2304: HTML attribute safety (RFC)
10746 !! input
10747 <div title="RFC 1234"></div>
10748 !! result
10749 <div title="&#82;FC 1234"></div>
10750
10751 !! end
10752
10753 !! test
10754 Bug 2304: HTML attribute safety (PMID)
10755 !! input
10756 <div title="PMID 1234567890"></div>
10757 !! result
10758 <div title="&#80;MID 1234567890"></div>
10759
10760 !! end
10761
10762 !! test
10763 Bug 2304: HTML attribute safety (web link)
10764 !! input
10765 <div title="http://example.com/"></div>
10766 !! result
10767 <div title="http&#58;//example.com/"></div>
10768
10769 !! end
10770
10771 !! test
10772 Bug 2304: HTML attribute safety (named web link)
10773 !! input
10774 <div title="[http://example.com/ link]"></div>
10775 !! result
10776 <div title="&#91;http&#58;//example.com/ link]"></div>
10777
10778 !! end
10779
10780 !! test
10781 Bug 3244: HTML attribute safety (extension; safe)
10782 !! input
10783 <div style="<nowiki>background:blue</nowiki>"></div>
10784 !! result
10785 <div style="background:blue"></div>
10786
10787 !! end
10788
10789 !! test
10790 Bug 3244: HTML attribute safety (extension; unsafe)
10791 !! input
10792 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10793 !! result
10794 <div style="/* insecure input */"></div>
10795
10796 !! end
10797
10798 # More MSIE fun discovered by Tom Gilder
10799
10800 !! test
10801 MSIE CSS safety test: spurious slash
10802 !! input
10803 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10804 !! result
10805 <div style="/* insecure input */">evil</div>
10806
10807 !! end
10808
10809 !! test
10810 MSIE CSS safety test: hex code
10811 !! input
10812 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10813 !! result
10814 <div style="/* insecure input */">evil</div>
10815
10816 !! end
10817
10818 !! test
10819 MSIE CSS safety test: comment in url
10820 !! input
10821 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10822 !! result
10823 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10824
10825 !! end
10826
10827 !! test
10828 MSIE CSS safety test: comment in expression
10829 !! input
10830 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10831 !! result
10832 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10833
10834 !! end
10835
10836
10837 !! test
10838 Table attribute legitimate extension
10839 !! input
10840 {|
10841 !+ style="<nowiki>color:blue</nowiki>"| status
10842 |}
10843 !! result
10844 <table>
10845 <tr>
10846 <th style="color:blue"> status
10847 </th></tr></table>
10848
10849 !!end
10850
10851 !! test
10852 Table attribute safety
10853 !! input
10854 {|
10855 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10856 |}
10857 !! result
10858 <table>
10859 <tr>
10860 <th style="/* insecure input */"> status
10861 </th></tr></table>
10862
10863 !! end
10864
10865 !! test
10866 CSS line continuation 1
10867 !! input
10868 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10869 !! result
10870 <div style="/* insecure input */"></div>
10871
10872 !! end
10873
10874 !! test
10875 CSS line continuation 2
10876 !! input
10877 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10878 !! result
10879 <div style="/* insecure input */"></div>
10880
10881 !! end
10882
10883 !! article
10884 Template:Identity
10885 !! text
10886 {{{1}}}
10887 !! endarticle
10888
10889 !! test
10890 Expansion of multi-line templates in attribute values (bug 6255)
10891 !! input
10892 <div style="background: {{identity|#00FF00}}">-</div>
10893 !! result
10894 <div style="background: #00FF00">-</div>
10895
10896 !! end
10897
10898
10899 !! test
10900 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10901 !! input
10902 <div style="background:
10903 #00FF00">-</div>
10904 !! result
10905 <div style="background: #00FF00">-</div>
10906
10907 !! end
10908
10909 !! test
10910 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10911 !! input
10912 <div style="background: &#10;#00FF00">-</div>
10913 !! result
10914 <div style="background: &#10;#00FF00">-</div>
10915
10916 !! end
10917
10918 ###
10919 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10920 ###
10921 !! test
10922 Parser hook: empty input
10923 !! input
10924 <tag></tag>
10925 !! result
10926 <pre>
10927 ''
10928 array (
10929 )
10930 </pre>
10931
10932 !! end
10933
10934 !! test
10935 Parser hook: empty input using terminated empty elements
10936 !! input
10937 <tag/>
10938 !! result
10939 <pre>
10940 NULL
10941 array (
10942 )
10943 </pre>
10944
10945 !! end
10946
10947 !! test
10948 Parser hook: empty input using terminated empty elements (space before)
10949 !! input
10950 <tag />
10951 !! result
10952 <pre>
10953 NULL
10954 array (
10955 )
10956 </pre>
10957
10958 !! end
10959
10960 !! test
10961 Parser hook: basic input
10962 !! input
10963 <tag>input</tag>
10964 !! result
10965 <pre>
10966 'input'
10967 array (
10968 )
10969 </pre>
10970
10971 !! end
10972
10973
10974 !! test
10975 Parser hook: case insensitive
10976 !! input
10977 <TAG>input</TAG>
10978 !! result
10979 <pre>
10980 'input'
10981 array (
10982 )
10983 </pre>
10984
10985 !! end
10986
10987
10988 !! test
10989 Parser hook: case insensitive, redux
10990 !! input
10991 <TaG>input</TAg>
10992 !! result
10993 <pre>
10994 'input'
10995 array (
10996 )
10997 </pre>
10998
10999 !! end
11000
11001 !! test
11002 Parser hook: nested tags
11003 !! options
11004 noxml
11005 !! input
11006 <tag><tag></tag></tag>
11007 !! result
11008 <pre>
11009 '<tag>'
11010 array (
11011 )
11012 </pre>&lt;/tag&gt;
11013
11014 !! end
11015
11016 !! test
11017 Parser hook: basic arguments
11018 !! input
11019 <tag width=200 height = "100" depth = '50' square></tag>
11020 !! result
11021 <pre>
11022 ''
11023 array (
11024 'width' => '200',
11025 'height' => '100',
11026 'depth' => '50',
11027 'square' => 'square',
11028 )
11029 </pre>
11030
11031 !! end
11032
11033 !! test
11034 Parser hook: argument containing a forward slash (bug 5344)
11035 !! input
11036 <tag filename='/tmp/bla'></tag>
11037 !! result
11038 <pre>
11039 ''
11040 array (
11041 'filename' => '/tmp/bla',
11042 )
11043 </pre>
11044
11045 !! end
11046
11047 !! test
11048 Parser hook: empty input using terminated empty elements (bug 2374)
11049 !! input
11050 <tag foo=bar/>text
11051 !! result
11052 <pre>
11053 NULL
11054 array (
11055 'foo' => 'bar',
11056 )
11057 </pre>text
11058
11059 !! end
11060
11061 # </tag> should be output literally since there is no matching tag that begins it
11062 !! test
11063 Parser hook: basic arguments using terminated empty elements (bug 2374)
11064 !! input
11065 <tag width=200 height = "100" depth = '50' square/>
11066 other stuff
11067 </tag>
11068 !! result
11069 <pre>
11070 NULL
11071 array (
11072 'width' => '200',
11073 'height' => '100',
11074 'depth' => '50',
11075 'square' => 'square',
11076 )
11077 </pre>
11078 <p>other stuff
11079 &lt;/tag&gt;
11080 </p>
11081 !! end
11082
11083 ###
11084 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11085 ###
11086
11087 !! test
11088 Parser hook: static parser hook not inside a comment
11089 !! input
11090 <statictag>hello, world</statictag>
11091 <statictag action=flush/>
11092 !! result
11093 <p>hello, world
11094 </p>
11095 !! end
11096
11097
11098 !! test
11099 Parser hook: static parser hook inside a comment
11100 !! input
11101 <!-- <statictag>hello, world</statictag> -->
11102 <statictag action=flush/>
11103 !! result
11104 <p><br />
11105 </p>
11106 !! end
11107
11108 # Nested template calls; this case was broken by Parser.php rev 1.506,
11109 # since reverted.
11110
11111 !! article
11112 Template:One-parameter
11113 !! text
11114 (My parameter is: {{{1}}})
11115 !! endarticle
11116
11117 !! article
11118 Template:Map-one-parameter
11119 !! text
11120 {{{{{1}}}|{{{2}}}}}
11121 !! endarticle
11122
11123 !! test
11124 Nested template calls
11125 !! input
11126 {{Map-one-parameter|One-parameter|param}}
11127 !! result
11128 <p>(My parameter is: param)
11129 </p>
11130 !! end
11131
11132
11133 ###
11134 ### Sanitizer
11135 ###
11136 !! test
11137 Sanitizer: Closing of open tags
11138 !! input
11139 <s></s><table></table>
11140 !! result
11141 <s></s><table></table>
11142
11143 !! end
11144
11145 !! test
11146 Sanitizer: Closing of open but not closed tags
11147 !! input
11148 <s>foo
11149 !! result
11150 <p><s>foo</s>
11151 </p>
11152 !! end
11153
11154 !! test
11155 Sanitizer: Closing of closed but not open tags
11156 !! input
11157 </s>
11158 !! result
11159 <p>&lt;/s&gt;
11160 </p>
11161 !! end
11162
11163 !! test
11164 Sanitizer: Closing of closed but not open table tags
11165 !! input
11166 Table not started</td></tr></table>
11167 !! result
11168 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11169 </p>
11170 !! end
11171
11172 !! test
11173 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11174 !! input
11175 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11176 !! result
11177 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11178 </p>
11179 !! end
11180
11181 !! test
11182 Sanitizer: Validating the contents of the id attribute (bug 4515)
11183 !! options
11184 disabled
11185 !! input
11186 <br id=9 />
11187 !! result
11188 Something, but definitely not <br id="9" />...
11189 !! end
11190
11191 !! test
11192 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11193 !! options
11194 disabled
11195 !! input
11196 <br id="foo" /><br id="foo" />
11197 !! result
11198 Something need to be done. foo-2 ?
11199 !! end
11200
11201 !! test
11202 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11203 !! input
11204 <div itemscope>
11205 <meta itemprop="hello" content="world">
11206 <meta http-equiv="refresh" content="5">
11207 <meta itemprop="hello" http-equiv="refresh" content="5">
11208 <link itemprop="hello" href="{{SERVER}}">
11209 <link rel="stylesheet" href="{{SERVER}}">
11210 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11211 </div>
11212 !! result
11213 <div itemscope="itemscope">
11214 <p> <meta itemprop="hello" content="world" />
11215 &lt;meta http-equiv="refresh" content="5"&gt;
11216 <meta itemprop="hello" content="5" />
11217 </p>
11218 <link itemprop="hello" href="http&#58;//example.org" />
11219 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11220 <link itemprop="hello" href="http&#58;//example.org" />
11221 </div>
11222
11223 !! end
11224
11225 !! test
11226 Language converter: output gets cut off unexpectedly (bug 5757)
11227 !! options
11228 language=zh
11229 !! input
11230 this bit is safe: }-
11231
11232 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11233
11234 then we get cut off here: }-
11235
11236 all additional text is vanished
11237 !! result
11238 <p>this bit is safe: }-
11239 </p><p>but if we add a conversion instance: xxx
11240 </p><p>then we get cut off here: }-
11241 </p><p>all additional text is vanished
11242 </p>
11243 !! end
11244
11245 !! test
11246 Self closed html pairs (bug 5487)
11247 !! options
11248 !! input
11249 <center><font id="bug" />Centered text</center>
11250 <div><font id="bug2" />In div text</div>
11251 !! result
11252 <center>&lt;font id="bug" /&gt;Centered text</center>
11253 <div>&lt;font id="bug2" /&gt;In div text</div>
11254
11255 !! end
11256
11257 #
11258 #
11259 #
11260
11261 !! test
11262 Punctuation: nbsp before exclamation
11263 !! input
11264 C'est grave !
11265 !! result
11266 <p>C'est grave&#160;!
11267 </p>
11268 !! end
11269
11270 !! test
11271 Punctuation: CSS !important (bug 11874)
11272 !! input
11273 <div style="width:50% !important">important</div>
11274 !! result
11275 <div style="width:50% !important">important</div>
11276
11277 !!end
11278
11279 !! test
11280 Punctuation: CSS ! important (bug 11874; with space after)
11281 !! input
11282 <div style="width:50% ! important">important</div>
11283 !! result
11284 <div style="width:50% ! important">important</div>
11285
11286 !!end
11287
11288
11289 !! test
11290 HTML bullet list, closed tags (bug 5497)
11291 !! input
11292 <ul>
11293 <li>One</li>
11294 <li>Two</li>
11295 </ul>
11296 !! result
11297 <ul>
11298 <li>One</li>
11299 <li>Two</li>
11300 </ul>
11301
11302 !! end
11303
11304 !! test
11305 HTML bullet list, unclosed tags (bug 5497)
11306 !! options
11307 disabled
11308 !! input
11309 <ul>
11310 <li>One
11311 <li>Two
11312 </ul>
11313 !! result
11314 <ul>
11315 <li>One
11316 </li><li>Two
11317 </li></ul>
11318
11319 !! end
11320
11321 !! test
11322 HTML ordered list, closed tags (bug 5497)
11323 !! input
11324 <ol>
11325 <li>One</li>
11326 <li>Two</li>
11327 </ol>
11328 !! result
11329 <ol>
11330 <li>One</li>
11331 <li>Two</li>
11332 </ol>
11333
11334 !! end
11335
11336 !! test
11337 HTML ordered list, unclosed tags (bug 5497)
11338 !! options
11339 disabled
11340 !! input
11341 <ol>
11342 <li>One
11343 <li>Two
11344 </ol>
11345 !! result
11346 <ol>
11347 <li>One
11348 </li><li>Two
11349 </li></ol>
11350
11351 !! end
11352
11353 !! test
11354 HTML nested bullet list, closed tags (bug 5497)
11355 !! input
11356 <ul>
11357 <li>One</li>
11358 <li>Two:
11359 <ul>
11360 <li>Sub-one</li>
11361 <li>Sub-two</li>
11362 </ul>
11363 </li>
11364 </ul>
11365 !! result
11366 <ul>
11367 <li>One</li>
11368 <li>Two:
11369 <ul>
11370 <li>Sub-one</li>
11371 <li>Sub-two</li>
11372 </ul>
11373 </li>
11374 </ul>
11375
11376 !! end
11377
11378 !! test
11379 HTML nested bullet list, open tags (bug 5497)
11380 !! options
11381 disabled
11382 !! input
11383 <ul>
11384 <li>One
11385 <li>Two:
11386 <ul>
11387 <li>Sub-one
11388 <li>Sub-two
11389 </ul>
11390 </ul>
11391 !! result
11392 <ul>
11393 <li>One
11394 </li><li>Two:
11395 <ul>
11396 <li>Sub-one
11397 </li><li>Sub-two
11398 </li></ul>
11399 </li></ul>
11400
11401 !! end
11402
11403 !! test
11404 HTML nested ordered list, closed tags (bug 5497)
11405 !! input
11406 <ol>
11407 <li>One</li>
11408 <li>Two:
11409 <ol>
11410 <li>Sub-one</li>
11411 <li>Sub-two</li>
11412 </ol>
11413 </li>
11414 </ol>
11415 !! result
11416 <ol>
11417 <li>One</li>
11418 <li>Two:
11419 <ol>
11420 <li>Sub-one</li>
11421 <li>Sub-two</li>
11422 </ol>
11423 </li>
11424 </ol>
11425
11426 !! end
11427
11428 !! test
11429 HTML nested ordered list, open tags (bug 5497)
11430 !! options
11431 disabled
11432 !! input
11433 <ol>
11434 <li>One
11435 <li>Two:
11436 <ol>
11437 <li>Sub-one
11438 <li>Sub-two
11439 </ol>
11440 </ol>
11441 !! result
11442 <ol>
11443 <li>One
11444 </li><li>Two:
11445 <ol>
11446 <li>Sub-one
11447 </li><li>Sub-two
11448 </li></ol>
11449 </li></ol>
11450
11451 !! end
11452
11453 !! test
11454 HTML ordered list item with parameters oddity
11455 !! input
11456 <ol><li id="fragment">One</li></ol>
11457 !! result
11458 <ol><li id="fragment">One</li></ol>
11459
11460 !! end
11461
11462 !!test
11463 bug 5918: autonumbering
11464 !! input
11465 [http://first/] [http://second] [ftp://ftp]
11466
11467 ftp://inlineftp
11468
11469 [mailto:enclosed@mail.tld With target]
11470
11471 [mailto:enclosed@mail.tld]
11472
11473 mailto:inline@mail.tld
11474 !! result
11475 <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>
11476 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11477 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11478 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11479 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11480 </p>
11481 !! end
11482
11483
11484 #
11485 # Security and HTML correctness
11486 # From Nick Jenkins' fuzz testing
11487 #
11488
11489 !! test
11490 Fuzz testing: Parser13
11491 !! input
11492 {|
11493 | http://a|
11494 !! result
11495 <table>
11496 <tr>
11497 <td>
11498 </td>
11499 </tr>
11500 </table>
11501
11502 !! end
11503
11504 !! test
11505 Fuzz testing: Parser14
11506 !! input
11507 == onmouseover= ==
11508 http://__TOC__
11509 !! result
11510 <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>
11511 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11512 <ul>
11513 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11514 </ul>
11515 </div>
11516
11517 !! end
11518
11519 !! test
11520 Fuzz testing: Parser14-table
11521 !! input
11522 ==a==
11523 {| STYLE=__TOC__
11524 !! result
11525 <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>
11526 <table style="&#95;_TOC&#95;_">
11527 <tr><td></td></tr>
11528 </table>
11529
11530 !! end
11531
11532 # Known to produce bogus xml (extra </td>)
11533 !! test
11534 Fuzz testing: Parser16
11535 !! options
11536 noxml
11537 !! input
11538 {|
11539 !https://||||||
11540 !! result
11541 <table>
11542 <tr>
11543 <th>https://</th>
11544 <th></th>
11545 <th></th>
11546 <th>
11547 </td>
11548 </tr>
11549 </table>
11550
11551 !! end
11552
11553 !! test
11554 Fuzz testing: Parser21
11555 !! input
11556 {|
11557 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11558 |
11559 !! result
11560 <table>
11561 <tr>
11562 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11563 </th>
11564 <td>
11565 </td>
11566 </tr>
11567 </table>
11568
11569 !! end
11570
11571 !! test
11572 Fuzz testing: Parser22
11573 !! input
11574 http://===r:::https://b
11575
11576 {|
11577 !!result
11578 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11579 </p>
11580 <table>
11581 <tr><td></td></tr>
11582 </table>
11583
11584 !! end
11585
11586 # Known to produce bad XML for now
11587 !! test
11588 Fuzz testing: Parser24
11589 !! options
11590 noxml
11591 !! input
11592 {|
11593 {{{|
11594 <u CLASS=
11595 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11596 <br style="onmouseover='alert(document.cookie);' " />
11597
11598 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11599 |
11600 !! result
11601 <table>
11602 {{{|
11603 <u class="&#124;">}}}} &gt;
11604 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11605
11606 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11607 <tr>
11608 <td></u>
11609 </td>
11610 </tr>
11611 </table>
11612
11613 !! end
11614
11615 # Note: the current result listed for this is not what the original one was,
11616 # but the original bug was JavaScript injection, which is fixed in any case.
11617 # It's not clear that the original result listed was any more correct than the
11618 # current one. Original result:
11619 # <p>{{{|
11620 # </p>
11621 # <li class="&#124;&#124;">
11622 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11623 !!test
11624 Fuzz testing: Parser25 (bug 6055)
11625 !! input
11626 {{{
11627 |
11628 <LI CLASS=||
11629 >
11630 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11631 !! result
11632 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11633 </p>
11634 !! end
11635
11636 !!test
11637 Fuzz testing: URL adjacent extension (with space, clean)
11638 !! options
11639 !! input
11640 http://example.com <nowiki>junk</nowiki>
11641 !! result
11642 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11643 </p>
11644 !!end
11645
11646 !!test
11647 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11648 !! options
11649 !! input
11650 http://example.com<nowiki>junk</nowiki>
11651 !! result
11652 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11653 </p>
11654 !!end
11655
11656 !!test
11657 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11658 !! options
11659 !! input
11660 http://example.com<pre>junk</pre>
11661 !! result
11662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11663
11664 !!end
11665
11666 !!test
11667 Fuzz testing: image with bogus manual thumbnail
11668 !!input
11669 [[Image:foobar.jpg|thumbnail= ]]
11670 !!result
11671 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11672
11673 !!end
11674
11675 !! test
11676 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11677 !! input
11678 <pre dir="&#10;"></pre>
11679 !! result
11680 <pre dir="&#10;"></pre>
11681
11682 !! end
11683
11684 !! test
11685 Parsing optional HTML elements (Bug 6171)
11686 !! options
11687 !! input
11688 <table>
11689 <tr>
11690 <td> Some tabular data</td>
11691 <td> More tabular data ...
11692 <td> And yet som tabular data</td>
11693 </tr>
11694 </table>
11695 !! result
11696 <table>
11697 <tr>
11698 <td> Some tabular data</td>
11699 <td> More tabular data ...
11700 </td><td> And yet som tabular data</td>
11701 </tr>
11702 </table>
11703
11704 !! end
11705
11706 !! test
11707 Correct handling of <td>, <tr> (Bug 6171)
11708 !! options
11709 !! input
11710 <table>
11711 <tr>
11712 <td> Some tabular data</td>
11713 <td> More tabular data ...</td>
11714 <td> And yet som tabular data</td>
11715 </tr>
11716 </table>
11717 !! result
11718 <table>
11719 <tr>
11720 <td> Some tabular data</td>
11721 <td> More tabular data ...</td>
11722 <td> And yet som tabular data</td>
11723 </tr>
11724 </table>
11725
11726 !! end
11727
11728
11729 !! test
11730 Parsing crashing regression (fr:JavaScript)
11731 !! input
11732 </body></x>
11733 !! result
11734 <p>&lt;/body&gt;&lt;/x&gt;
11735 </p>
11736 !! end
11737
11738 !! test
11739 Inline wiki vs wiki block nesting
11740 !! input
11741 '''Bold paragraph
11742
11743 New wiki paragraph
11744 !! result
11745 <p><b>Bold paragraph</b>
11746 </p><p>New wiki paragraph
11747 </p>
11748 !! end
11749
11750 !! test
11751 Inline HTML vs wiki block nesting
11752 !! options
11753 disabled
11754 !! input
11755 <b>Bold paragraph
11756
11757 New wiki paragraph
11758 !! result
11759 <p><b>Bold paragraph</b>
11760 </p><p>New wiki paragraph
11761 </p>
11762 !! end
11763
11764 # Original result was this:
11765 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11766 # </p>
11767 # While that might be marginally more intuitive, maybe, the six-apostrophe
11768 # construct is clearly pathological and the result stated here (which is what
11769 # the parser actually does) is about as reasonable as anything.
11770 !!test
11771 Mixing markup for italics and bold
11772 !! options
11773 !! input
11774 '''bold''''''bold''bolditalics'''''
11775 !! result
11776 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11777 </p>
11778 !! end
11779
11780
11781 !! article
11782 Xyzzyx
11783 !! text
11784 Article for special page transclusion test
11785 !! endarticle
11786
11787 !! test
11788 Special page transclusion
11789 !! options
11790 !! input
11791 {{Special:Prefixindex/Xyzzyx}}
11792 !! result
11793 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11794
11795 !! end
11796
11797 !! test
11798 Special page transclusion twice (bug 5021)
11799 !! options
11800 !! input
11801 {{Special:Prefixindex/Xyzzyx}}
11802 {{Special:Prefixindex/Xyzzyx}}
11803 !! result
11804 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11805 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11806
11807 !! end
11808
11809 !! test
11810 Transclusion of default MediaWiki message
11811 !! input
11812 {{MediaWiki:Mainpage}}
11813 !!result
11814 <p>Main Page
11815 </p>
11816 !! end
11817
11818 !! test
11819 Transclusion of nonexistent MediaWiki message
11820 !! input
11821 {{MediaWiki:Mainpagexxx}}
11822 !!result
11823 <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>
11824 </p>
11825 !! end
11826
11827 !! test
11828 Transclusion of MediaWiki message with underscore
11829 !! input
11830 {{MediaWiki:history_short}}
11831 !! result
11832 <p>History
11833 </p>
11834 !! end
11835
11836 !! test
11837 Transclusion of MediaWiki message with space
11838 !! input
11839 {{MediaWiki:history short}}
11840 !! result
11841 <p>History
11842 </p>
11843 !! end
11844
11845 !! test
11846 Invalid header with following text
11847 !! input
11848 = x = y
11849 !! result
11850 <p>= x = y
11851 </p>
11852 !! end
11853
11854
11855 !! test
11856 Section extraction test (section 0)
11857 !! options
11858 section=0
11859 !! input
11860 start
11861 ==a==
11862 ===aa===
11863 ====aaa====
11864 ==b==
11865 ===ba===
11866 ===bb===
11867 ====bba====
11868 ===bc===
11869 ==c==
11870 ===ca===
11871 !! result
11872 start
11873 !! end
11874
11875 !! test
11876 Section extraction test (section 1)
11877 !! options
11878 section=1
11879 !! input
11880 start
11881 ==a==
11882 ===aa===
11883 ====aaa====
11884 ==b==
11885 ===ba===
11886 ===bb===
11887 ====bba====
11888 ===bc===
11889 ==c==
11890 ===ca===
11891 !! result
11892 ==a==
11893 ===aa===
11894 ====aaa====
11895 !! end
11896
11897 !! test
11898 Section extraction test (section 2)
11899 !! options
11900 section=2
11901 !! input
11902 start
11903 ==a==
11904 ===aa===
11905 ====aaa====
11906 ==b==
11907 ===ba===
11908 ===bb===
11909 ====bba====
11910 ===bc===
11911 ==c==
11912 ===ca===
11913 !! result
11914 ===aa===
11915 ====aaa====
11916 !! end
11917
11918 !! test
11919 Section extraction test (section 3)
11920 !! options
11921 section=3
11922 !! input
11923 start
11924 ==a==
11925 ===aa===
11926 ====aaa====
11927 ==b==
11928 ===ba===
11929 ===bb===
11930 ====bba====
11931 ===bc===
11932 ==c==
11933 ===ca===
11934 !! result
11935 ====aaa====
11936 !! end
11937
11938 !! test
11939 Section extraction test (section 4)
11940 !! options
11941 section=4
11942 !! input
11943 start
11944 ==a==
11945 ===aa===
11946 ====aaa====
11947 ==b==
11948 ===ba===
11949 ===bb===
11950 ====bba====
11951 ===bc===
11952 ==c==
11953 ===ca===
11954 !! result
11955 ==b==
11956 ===ba===
11957 ===bb===
11958 ====bba====
11959 ===bc===
11960 !! end
11961
11962 !! test
11963 Section extraction test (section 5)
11964 !! options
11965 section=5
11966 !! input
11967 start
11968 ==a==
11969 ===aa===
11970 ====aaa====
11971 ==b==
11972 ===ba===
11973 ===bb===
11974 ====bba====
11975 ===bc===
11976 ==c==
11977 ===ca===
11978 !! result
11979 ===ba===
11980 !! end
11981
11982 !! test
11983 Section extraction test (section 6)
11984 !! options
11985 section=6
11986 !! input
11987 start
11988 ==a==
11989 ===aa===
11990 ====aaa====
11991 ==b==
11992 ===ba===
11993 ===bb===
11994 ====bba====
11995 ===bc===
11996 ==c==
11997 ===ca===
11998 !! result
11999 ===bb===
12000 ====bba====
12001 !! end
12002
12003 !! test
12004 Section extraction test (section 7)
12005 !! options
12006 section=7
12007 !! input
12008 start
12009 ==a==
12010 ===aa===
12011 ====aaa====
12012 ==b==
12013 ===ba===
12014 ===bb===
12015 ====bba====
12016 ===bc===
12017 ==c==
12018 ===ca===
12019 !! result
12020 ====bba====
12021 !! end
12022
12023 !! test
12024 Section extraction test (section 8)
12025 !! options
12026 section=8
12027 !! input
12028 start
12029 ==a==
12030 ===aa===
12031 ====aaa====
12032 ==b==
12033 ===ba===
12034 ===bb===
12035 ====bba====
12036 ===bc===
12037 ==c==
12038 ===ca===
12039 !! result
12040 ===bc===
12041 !! end
12042
12043 !! test
12044 Section extraction test (section 9)
12045 !! options
12046 section=9
12047 !! input
12048 start
12049 ==a==
12050 ===aa===
12051 ====aaa====
12052 ==b==
12053 ===ba===
12054 ===bb===
12055 ====bba====
12056 ===bc===
12057 ==c==
12058 ===ca===
12059 !! result
12060 ==c==
12061 ===ca===
12062 !! end
12063
12064 !! test
12065 Section extraction test (section 10)
12066 !! options
12067 section=10
12068 !! input
12069 start
12070 ==a==
12071 ===aa===
12072 ====aaa====
12073 ==b==
12074 ===ba===
12075 ===bb===
12076 ====bba====
12077 ===bc===
12078 ==c==
12079 ===ca===
12080 !! result
12081 ===ca===
12082 !! end
12083
12084 !! test
12085 Section extraction test (nonexistent section 11)
12086 !! options
12087 section=11
12088 !! input
12089 start
12090 ==a==
12091 ===aa===
12092 ====aaa====
12093 ==b==
12094 ===ba===
12095 ===bb===
12096 ====bba====
12097 ===bc===
12098 ==c==
12099 ===ca===
12100 !! result
12101 !! end
12102
12103 !! test
12104 Section extraction test with bogus heading (section 1)
12105 !! options
12106 section=1
12107 !! input
12108 ==a==
12109 ==bogus== not a legal section
12110 ==b==
12111 !! result
12112 ==a==
12113 ==bogus== not a legal section
12114 !! end
12115
12116 !! test
12117 Section extraction test with bogus heading (section 2)
12118 !! options
12119 section=2
12120 !! input
12121 ==a==
12122 ==bogus== not a legal section
12123 ==b==
12124 !! result
12125 ==b==
12126 !! end
12127
12128 !! test
12129 Section extraction test with comment after heading (section 1)
12130 !! options
12131 section=1
12132 !! input
12133 ==a==
12134 ==b== <!-- -->
12135 ==c==
12136 !! result
12137 ==a==
12138 !! end
12139
12140 !! test
12141 Section extraction test with comment after heading (section 2)
12142 !! options
12143 section=2
12144 !! input
12145 ==a==
12146 ==b== <!-- -->
12147 ==c==
12148 !! result
12149 ==b== <!-- -->
12150 !! end
12151
12152 !! test
12153 Section extraction test with bogus <nowiki> heading (section 1)
12154 !! options
12155 section=1
12156 !! input
12157 ==a==
12158 ==bogus== <nowiki>not a legal section</nowiki>
12159 ==b==
12160 !! result
12161 ==a==
12162 ==bogus== <nowiki>not a legal section</nowiki>
12163 !! end
12164
12165 !! test
12166 Section extraction test with bogus <nowiki> heading (section 2)
12167 !! options
12168 section=2
12169 !! input
12170 ==a==
12171 ==bogus== <nowiki>not a legal section</nowiki>
12172 ==b==
12173 !! result
12174 ==b==
12175 !! end
12176
12177
12178 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12179 # instead of respecting commented sections
12180 !! test
12181 Section extraction prefixed by comment (section 1)
12182 !! options
12183 section=1
12184 !! input
12185 <!-- -->==sec1==
12186 ==sec2==
12187 !!result
12188 ==sec2==
12189 !!end
12190
12191 !! test
12192 Section extraction prefixed by comment (section 2)
12193 !! options
12194 section=2
12195 !! input
12196 <!-- -->==sec1==
12197 ==sec2==
12198 !!result
12199
12200 !!end
12201
12202
12203 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12204 # instead of respecting HTML-style headings
12205 !! test
12206 Section extraction, mixed wiki and html (section 1)
12207 !! options
12208 section=1
12209 !! input
12210 <h2>unmarked</h2>
12211 unmarked
12212 ==1==
12213 one
12214 ==2==
12215 two
12216 !! result
12217 ==1==
12218 one
12219 !! end
12220
12221 !! test
12222 Section extraction, mixed wiki and html (section 2)
12223 !! options
12224 section=2
12225 !! input
12226 <h2>unmarked</h2>
12227 unmarked
12228 ==1==
12229 one
12230 ==2==
12231 two
12232 !! result
12233 ==2==
12234 two
12235 !! end
12236
12237
12238 # Formerly testing for bug 3342
12239 !! test
12240 Section extraction, heading surrounded by <noinclude>
12241 !! options
12242 section=1
12243 !! input
12244 <noinclude>==unmarked==</noinclude>
12245 ==marked==
12246 !! result
12247 ==marked==
12248 !!end
12249
12250 # Test behavior of bug 19910
12251 !! test
12252 Sectiion with all-equals
12253 !! options
12254 section=2
12255 !! input
12256 ===
12257 The line above must have a trailing space
12258 === <!--
12259 --> <!-- -->
12260 But just in case it doesn't...
12261 !! result
12262 === <!--
12263 --> <!-- -->
12264 But just in case it doesn't...
12265 !! end
12266
12267 !! test
12268 Section replacement test (section 0)
12269 !! options
12270 replace=0,"xxx"
12271 !! input
12272 start
12273 ==a==
12274 ===aa===
12275 ====aaa====
12276 ==b==
12277 ===ba===
12278 ===bb===
12279 ====bba====
12280 ===bc===
12281 ==c==
12282 ===ca===
12283 !! result
12284 xxx
12285
12286 ==a==
12287 ===aa===
12288 ====aaa====
12289 ==b==
12290 ===ba===
12291 ===bb===
12292 ====bba====
12293 ===bc===
12294 ==c==
12295 ===ca===
12296 !! end
12297
12298 !! test
12299 Section replacement test (section 1)
12300 !! options
12301 replace=1,"xxx"
12302 !! input
12303 start
12304 ==a==
12305 ===aa===
12306 ====aaa====
12307 ==b==
12308 ===ba===
12309 ===bb===
12310 ====bba====
12311 ===bc===
12312 ==c==
12313 ===ca===
12314 !! result
12315 start
12316 xxx
12317
12318 ==b==
12319 ===ba===
12320 ===bb===
12321 ====bba====
12322 ===bc===
12323 ==c==
12324 ===ca===
12325 !! end
12326
12327 !! test
12328 Section replacement test (section 2)
12329 !! options
12330 replace=2,"xxx"
12331 !! input
12332 start
12333 ==a==
12334 ===aa===
12335 ====aaa====
12336 ==b==
12337 ===ba===
12338 ===bb===
12339 ====bba====
12340 ===bc===
12341 ==c==
12342 ===ca===
12343 !! result
12344 start
12345 ==a==
12346 xxx
12347
12348 ==b==
12349 ===ba===
12350 ===bb===
12351 ====bba====
12352 ===bc===
12353 ==c==
12354 ===ca===
12355 !! end
12356
12357 !! test
12358 Section replacement test (section 3)
12359 !! options
12360 replace=3,"xxx"
12361 !! input
12362 start
12363 ==a==
12364 ===aa===
12365 ====aaa====
12366 ==b==
12367 ===ba===
12368 ===bb===
12369 ====bba====
12370 ===bc===
12371 ==c==
12372 ===ca===
12373 !! result
12374 start
12375 ==a==
12376 ===aa===
12377 xxx
12378
12379 ==b==
12380 ===ba===
12381 ===bb===
12382 ====bba====
12383 ===bc===
12384 ==c==
12385 ===ca===
12386 !! end
12387
12388 !! test
12389 Section replacement test (section 4)
12390 !! options
12391 replace=4,"xxx"
12392 !! input
12393 start
12394 ==a==
12395 ===aa===
12396 ====aaa====
12397 ==b==
12398 ===ba===
12399 ===bb===
12400 ====bba====
12401 ===bc===
12402 ==c==
12403 ===ca===
12404 !! result
12405 start
12406 ==a==
12407 ===aa===
12408 ====aaa====
12409 xxx
12410
12411 ==c==
12412 ===ca===
12413 !! end
12414
12415 !! test
12416 Section replacement test (section 5)
12417 !! options
12418 replace=5,"xxx"
12419 !! input
12420 start
12421 ==a==
12422 ===aa===
12423 ====aaa====
12424 ==b==
12425 ===ba===
12426 ===bb===
12427 ====bba====
12428 ===bc===
12429 ==c==
12430 ===ca===
12431 !! result
12432 start
12433 ==a==
12434 ===aa===
12435 ====aaa====
12436 ==b==
12437 xxx
12438
12439 ===bb===
12440 ====bba====
12441 ===bc===
12442 ==c==
12443 ===ca===
12444 !! end
12445
12446 !! test
12447 Section replacement test (section 6)
12448 !! options
12449 replace=6,"xxx"
12450 !! input
12451 start
12452 ==a==
12453 ===aa===
12454 ====aaa====
12455 ==b==
12456 ===ba===
12457 ===bb===
12458 ====bba====
12459 ===bc===
12460 ==c==
12461 ===ca===
12462 !! result
12463 start
12464 ==a==
12465 ===aa===
12466 ====aaa====
12467 ==b==
12468 ===ba===
12469 xxx
12470
12471 ===bc===
12472 ==c==
12473 ===ca===
12474 !! end
12475
12476 !! test
12477 Section replacement test (section 7)
12478 !! options
12479 replace=7,"xxx"
12480 !! input
12481 start
12482 ==a==
12483 ===aa===
12484 ====aaa====
12485 ==b==
12486 ===ba===
12487 ===bb===
12488 ====bba====
12489 ===bc===
12490 ==c==
12491 ===ca===
12492 !! result
12493 start
12494 ==a==
12495 ===aa===
12496 ====aaa====
12497 ==b==
12498 ===ba===
12499 ===bb===
12500 xxx
12501
12502 ===bc===
12503 ==c==
12504 ===ca===
12505 !! end
12506
12507 !! test
12508 Section replacement test (section 8)
12509 !! options
12510 replace=8,"xxx"
12511 !! input
12512 start
12513 ==a==
12514 ===aa===
12515 ====aaa====
12516 ==b==
12517 ===ba===
12518 ===bb===
12519 ====bba====
12520 ===bc===
12521 ==c==
12522 ===ca===
12523 !! result
12524 start
12525 ==a==
12526 ===aa===
12527 ====aaa====
12528 ==b==
12529 ===ba===
12530 ===bb===
12531 ====bba====
12532 xxx
12533
12534 ==c==
12535 ===ca===
12536 !!end
12537
12538 !! test
12539 Section replacement test (section 9)
12540 !! options
12541 replace=9,"xxx"
12542 !! input
12543 start
12544 ==a==
12545 ===aa===
12546 ====aaa====
12547 ==b==
12548 ===ba===
12549 ===bb===
12550 ====bba====
12551 ===bc===
12552 ==c==
12553 ===ca===
12554 !! result
12555 start
12556 ==a==
12557 ===aa===
12558 ====aaa====
12559 ==b==
12560 ===ba===
12561 ===bb===
12562 ====bba====
12563 ===bc===
12564 xxx
12565 !! end
12566
12567 !! test
12568 Section replacement test (section 10)
12569 !! options
12570 replace=10,"xxx"
12571 !! input
12572 start
12573 ==a==
12574 ===aa===
12575 ====aaa====
12576 ==b==
12577 ===ba===
12578 ===bb===
12579 ====bba====
12580 ===bc===
12581 ==c==
12582 ===ca===
12583 !! result
12584 start
12585 ==a==
12586 ===aa===
12587 ====aaa====
12588 ==b==
12589 ===ba===
12590 ===bb===
12591 ====bba====
12592 ===bc===
12593 ==c==
12594 xxx
12595 !! end
12596
12597 !! test
12598 Section replacement test with initial whitespace (bug 13728)
12599 !! options
12600 replace=2,"xxx"
12601 !! input
12602 Preformatted initial line
12603 ==a==
12604 ===a===
12605 !! result
12606 Preformatted initial line
12607 ==a==
12608 xxx
12609 !! end
12610
12611
12612 !! test
12613 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12614 !! options
12615 section=1
12616 !! input
12617 ==a==
12618 a
12619 !! result
12620 ==a==
12621 a
12622 !! end
12623
12624 !! test
12625 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12626 !! options
12627 section=1
12628 !! input
12629 ==a==
12630 a
12631 !! result
12632 ==a==
12633 a
12634 !! end
12635
12636
12637 !! test
12638 Section extraction, <pre> around bogus header (bug 10309)
12639 !! options
12640 noxml section=2
12641 !! input
12642 == Section One ==
12643 <pre>
12644 =======
12645 </pre>
12646
12647 == Section Two ==
12648 stuff
12649 !! result
12650 == Section Two ==
12651 stuff
12652 !! end
12653
12654 !! test
12655 Section replacement, <pre> around bogus header (bug 10309)
12656 !! options
12657 noxml replace=2,"xxx"
12658 !! input
12659 == Section One ==
12660 <pre>
12661 =======
12662 </pre>
12663
12664 == Section Two ==
12665 stuff
12666 !! result
12667 == Section One ==
12668 <pre>
12669 =======
12670 </pre>
12671
12672 xxx
12673 !! end
12674
12675
12676
12677 !! test
12678 Handling of &#x0A; in URLs
12679 !! input
12680 **irc://&#x0A;a
12681 !! result
12682 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12683 </li></ul>
12684 </li></ul>
12685
12686 !!end
12687
12688 !! test
12689 5 quotes, code coverage +1 line (php)
12690 !! options
12691 php
12692 !! input
12693 '''''
12694 !! result
12695 !! end
12696 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12697 !! test
12698 5 quotes, code coverage +1 line (parsoid)
12699 !! options
12700 parsoid
12701 !! input
12702 '''''
12703 !! result
12704 <p><i><b></b></i></p>
12705 !! end
12706
12707 !! test
12708 Special:Search page linking.
12709 !! input
12710 {{Special:search}}
12711 !! result
12712 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12713 </p>
12714 !! end
12715
12716 !! test
12717 Say the magic word
12718 !! options
12719 title=[[Parser test]]
12720 !! input
12721 * {{PAGENAME}}
12722 * {{PAGENAMEE}}
12723 * {{FULLPAGENAME}}
12724 * {{FULLPAGENAMEE}}
12725 * {{BASEPAGENAME}}
12726 * {{BASEPAGENAMEE}}
12727 * {{SUBPAGENAME}}
12728 * {{SUBPAGENAMEE}}
12729 * {{ROOTPAGENAME}}
12730 * {{ROOTPAGENAMEE}}
12731 * {{TALKPAGENAME}}
12732 * {{TALKPAGENAMEE}}
12733 * {{SUBJECTPAGENAME}}
12734 * {{SUBJECTPAGENAMEE}}
12735 * {{NAMESPACEE}}
12736 * {{NAMESPACE}}
12737 * {{NAMESPACENUMBER}}
12738 * {{TALKSPACE}}
12739 * {{TALKSPACEE}}
12740 * {{SUBJECTSPACE}}
12741 * {{SUBJECTSPACEE}}
12742 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12743 !! result
12744 <ul><li> Parser test
12745 </li><li> Parser_test
12746 </li><li> Parser test
12747 </li><li> Parser_test
12748 </li><li> Parser test
12749 </li><li> Parser_test
12750 </li><li> Parser test
12751 </li><li> Parser_test
12752 </li><li> Parser test
12753 </li><li> Parser_test
12754 </li><li> Talk:Parser test
12755 </li><li> Talk:Parser_test
12756 </li><li> Parser test
12757 </li><li> Parser_test
12758 </li><li>
12759 </li><li>
12760 </li><li> 0
12761 </li><li> Talk
12762 </li><li> Talk
12763 </li><li>
12764 </li><li>
12765 </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>
12766 </li></ul>
12767
12768 !! end
12769 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12770
12771 !! test
12772 Gallery
12773 !! input
12774 <gallery>
12775 image1.png |
12776 image2.gif|||||
12777
12778 image3|
12779 image4 |300px| centre
12780 image5.svg| http://///////
12781 [[x|xx]]]]
12782 * image6
12783 </gallery>
12784 !! result
12785 <ul class="gallery mw-gallery-traditional">
12786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12787 <div class="thumb" style="height: 150px;">Image1.png</div>
12788 <div class="gallerytext">
12789 </div>
12790 </div></li>
12791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12792 <div class="thumb" style="height: 150px;">Image2.gif</div>
12793 <div class="gallerytext">
12794 <p>||||
12795 </p>
12796 </div>
12797 </div></li>
12798 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12799 <div class="thumb" style="height: 150px;">Image3</div>
12800 <div class="gallerytext">
12801 </div>
12802 </div></li>
12803 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12804 <div class="thumb" style="height: 150px;">Image4</div>
12805 <div class="gallerytext">
12806 <p>300px| centre
12807 </p>
12808 </div>
12809 </div></li>
12810 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12811 <div class="thumb" style="height: 150px;">Image5.svg</div>
12812 <div class="gallerytext">
12813 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12814 </p>
12815 </div>
12816 </div></li>
12817 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12818 <div class="thumb" style="height: 150px;">* image6</div>
12819 <div class="gallerytext">
12820 </div>
12821 </div></li>
12822 </ul>
12823
12824 !! end
12825
12826 !! test
12827 Gallery (with options)
12828 !! input
12829 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12830 File:Nonexistant.jpg|caption
12831 File:Nonexistant.jpg
12832 image:foobar.jpg|some '''caption''' [[Main Page]]
12833 image:foobar.jpg
12834 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12835 </gallery>
12836 !! result
12837 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
12838 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12839 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12840 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12841 <div class="gallerytext">
12842 <p>caption
12843 </p>
12844 </div>
12845 </div></li>
12846 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12847 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12848 <div class="gallerytext">
12849 </div>
12850 </div></li>
12851 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12852 <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>
12853 <div class="gallerytext">
12854 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12855 </p>
12856 </div>
12857 </div></li>
12858 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12859 <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>
12860 <div class="gallerytext">
12861 </div>
12862 </div></li>
12863 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12864 <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>
12865 <div class="gallerytext">
12866 <p>Blabla|blabla.
12867 </p>
12868 </div>
12869 </div></li>
12870 </ul>
12871
12872 !! end
12873
12874 !! test
12875 Gallery with wikitext inside caption
12876 !! input
12877 <gallery>
12878 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12879 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12880 </gallery>
12881 !! result
12882 <ul class="gallery mw-gallery-traditional">
12883 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12884 <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>
12885 <div class="gallerytext">
12886 <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>
12887 </p>
12888 </div>
12889 </div></li>
12890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12891 <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>
12892 <div class="gallerytext">
12893 <p>This is a test template
12894 </p>
12895 </div>
12896 </div></li>
12897 </ul>
12898
12899 !! end
12900
12901 !! test
12902 gallery (with showfilename option)
12903 !! input
12904 <gallery showfilename>
12905 File:Nonexistant.jpg|caption
12906 File:Nonexistant.jpg
12907 image:foobar.jpg|some '''caption''' [[Main Page]]
12908 File:Foobar.jpg
12909 </gallery>
12910 !! result
12911 <ul class="gallery mw-gallery-traditional">
12912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12913 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12914 <div class="gallerytext">
12915 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12916 caption
12917 </p>
12918 </div>
12919 </div></li>
12920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12921 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12922 <div class="gallerytext">
12923 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12924 </p>
12925 </div>
12926 </div></li>
12927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12928 <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>
12929 <div class="gallerytext">
12930 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12931 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12932 </p>
12933 </div>
12934 </div></li>
12935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12936 <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>
12937 <div class="gallerytext">
12938 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12939 </p>
12940 </div>
12941 </div></li>
12942 </ul>
12943
12944 !! end
12945
12946 !! test
12947 Gallery (with namespace-less filenames)
12948 !! input
12949 <gallery>
12950 File:Nonexistant.jpg
12951 Nonexistant.jpg
12952 image:foobar.jpg
12953 foobar.jpg
12954 </gallery>
12955 !! result
12956 <ul class="gallery mw-gallery-traditional">
12957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12958 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12959 <div class="gallerytext">
12960 </div>
12961 </div></li>
12962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12963 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12964 <div class="gallerytext">
12965 </div>
12966 </div></li>
12967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12968 <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>
12969 <div class="gallerytext">
12970 </div>
12971 </div></li>
12972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12973 <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>
12974 <div class="gallerytext">
12975 </div>
12976 </div></li>
12977 </ul>
12978
12979 !! end
12980
12981 !! test
12982 HTML Hex character encoding (spells the word "JavaScript")
12983 !! input
12984 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12985 !! result
12986 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12987 </p>
12988 !! end
12989
12990 !! test
12991 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12992 !! input
12993 &#xsee;&#XSEE;
12994 !! result
12995 <p>&amp;#xsee;&amp;#XSEE;
12996 </p>
12997 !! end
12998
12999 !! test
13000 HTML Hex character encoding mixed case
13001 !! input
13002 &#xEE;&#Xee;
13003 !! result
13004 <p>&#xee;&#xee;
13005 </p>
13006 !! end
13007
13008 !! test
13009 __FORCETOC__ override
13010 !! input
13011 __NEWSECTIONLINK__
13012 __FORCETOC__
13013 !! result
13014 <p><br />
13015 </p>
13016 !! end
13017
13018 !! test
13019 ISBN code coverage
13020 !! input
13021 ISBN 978-0-1234-56&#x20;789
13022 !! result
13023 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13024 </p>
13025 !! end
13026
13027 !! test
13028 ISBN followed by 5 spaces
13029 !! input
13030 ISBN
13031 !! result
13032 <p>ISBN
13033 </p>
13034 !! end
13035
13036 !! test
13037 Double ISBN
13038 !! input
13039 ISBN ISBN 1234567890
13040 !! result
13041 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13042 </p>
13043 !! end
13044
13045 !! test
13046 Bug 22905: <abbr> followed by ISBN followed by </a>
13047 !! input
13048 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13049 !! result
13050 <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>
13051 </p>
13052 !! end
13053
13054 !! test
13055 Double RFC
13056 !! input
13057 RFC RFC 1234
13058 !! result
13059 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13060 </p>
13061 !! end
13062
13063 !! test
13064 Double RFC with a wiki link
13065 !! input
13066 RFC [[RFC 1234]]
13067 !! result
13068 <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>
13069 </p>
13070 !! end
13071
13072 !! test
13073 RFC code coverage
13074 !! input
13075 RFC 983&#x20;987
13076 !! result
13077 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13078 </p>
13079 !! end
13080
13081 !! test
13082 Centre-aligned image
13083 !! input
13084 [[Image:foobar.jpg|centre]]
13085 !! result
13086 <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>
13087
13088 !!end
13089
13090 !! test
13091 None-aligned image
13092 !! input
13093 [[Image:foobar.jpg|none]]
13094 !! result
13095 <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>
13096
13097 !!end
13098
13099 !! test
13100 Width + Height sized image (using px) (height is ignored)
13101 !! input
13102 [[Image:foobar.jpg|640x480px]]
13103 !! result
13104 <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>
13105 </p>
13106 !!end
13107
13108 !! test
13109 Width-sized image (using px, no following whitespace)
13110 !! input
13111 [[Image:foobar.jpg|640px]]
13112 !! result
13113 <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>
13114 </p>
13115 !!end
13116
13117 !! test
13118 Width-sized image (using px, with following whitespace - test regression from r39467)
13119 !! input
13120 [[Image:foobar.jpg|640px ]]
13121 !! result
13122 <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>
13123 </p>
13124 !!end
13125
13126 !! test
13127 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13128 !! input
13129 [[Image:foobar.jpg| 640px]]
13130 !! result
13131 <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>
13132 </p>
13133 !!end
13134
13135 !! test
13136 Another italics / bold test
13137 !! input
13138 ''' ''x'
13139 !! result
13140 <pre>'<i> </i>x'
13141 </pre>
13142 !!end
13143
13144 # Note the results may be incorrect, as parserTest output included this:
13145 # XML error: Mismatched tag at byte 6120:
13146 # ...<dd> </dt></dl> </dd...
13147 !! test
13148 dt/dd/dl test
13149 !! options
13150 disabled
13151 !! input
13152 :;;;::
13153 !! result
13154 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13155 </dd></dl>
13156 </dd></dl>
13157 </dt></dl>
13158 </dt></dl>
13159 </dt></dl>
13160 </dd></dl>
13161
13162 !!end
13163
13164
13165 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13166 !! test
13167 Images with the "|" character in the comment
13168 !! input
13169 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13170 !! result
13171 <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>
13172
13173 !!end
13174
13175 !! test
13176 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13177 !! input
13178 <html><script>alert(1);</script></html>
13179 !! result
13180 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13181 </p>
13182 !! end
13183
13184 !! test
13185 HTML with raw HTML ($wgRawHtml==true)
13186 !! options
13187 wgRawHtml=1
13188 !! input
13189 <html><script>alert(1);</script></html>
13190 !! result
13191 <p><script>alert(1);</script>
13192 </p>
13193 !! end
13194
13195 !! test
13196 Parents of subpages, one level up
13197 !! options
13198 subpage title=[[Subpage test/L1/L2/L3]]
13199 !! input
13200 [[../|L2]]
13201 !! result
13202 <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>
13203 </p>
13204 !! end
13205
13206
13207 !! test
13208 Parents of subpages, one level up, not named
13209 !! options
13210 subpage title=[[Subpage test/L1/L2/L3]]
13211 !! input
13212 [[../]]
13213 !! result
13214 <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>
13215 </p>
13216 !! end
13217
13218
13219
13220 !! test
13221 Parents of subpages, two levels up
13222 !! options
13223 subpage title=[[Subpage test/L1/L2/L3]]
13224 !! input
13225 [[../../|L1]]2
13226
13227 [[../../|L1]]l
13228 !! result
13229 <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
13230 </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>
13231 </p>
13232 !! end
13233
13234 !! test
13235 Parents of subpages, two levels up, without trailing slash or name.
13236 !! options
13237 subpage title=[[Subpage test/L1/L2/L3]]
13238 !! input
13239 [[../..]]
13240 !! result
13241 <p>[[../..]]
13242 </p>
13243 !! end
13244
13245 !! test
13246 Parents of subpages, two levels up, with lots of extra trailing slashes.
13247 !! options
13248 subpage title=[[Subpage test/L1/L2/L3]]
13249 !! input
13250 [[../../////]]
13251 !! result
13252 <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>
13253 </p>
13254 !! end
13255
13256 !! article
13257 Subpage test/L1/L2/L3Sibling
13258 !! text
13259 Sibling article
13260 !! endarticle
13261
13262 !! test
13263 Transclusion of a sibling page (one level up)
13264 !! options
13265 subpage title=[[Subpage test/L1/L2/L3]]
13266 !! input
13267 {{../L3Sibling}}
13268 !! result
13269 <p>Sibling article
13270 </p>
13271 !! end
13272
13273 !! test
13274 Transclusion of a child page
13275 !! options
13276 subpage title=[[Subpage test/L1/L2]]
13277 !! input
13278 {{/L3Sibling}}
13279 !! result
13280 <p>Sibling article
13281 </p>
13282 !! end
13283
13284 !! test
13285 Non-transclusion because of too many up levels
13286 !! options
13287 subpage title=[[Subpage test/L1/L2/L3]]
13288 !! input
13289 {{../../../../More than parent}}
13290 !! result
13291 <p>{{../../../../More than parent}}
13292 </p>
13293 !! end
13294
13295 !! test
13296 Definition list code coverage
13297 !! input
13298 ; title : def
13299 ; title : def
13300 ;title: def
13301 !! result
13302 <dl><dt> title &#160;</dt><dd> def
13303 </dd><dt> title&#160;</dt><dd> def
13304 </dd><dt>title</dt><dd> def
13305 </dd></dl>
13306
13307 !! end
13308
13309 !! test
13310 Don't fall for the self-closing div
13311 !! input
13312 <div>hello world</div/>
13313 !! result
13314 <div>hello world</div>
13315
13316 !! end
13317
13318 !! test
13319 MSGNW magic word
13320 !! input
13321 {{MSGNW:msg}}
13322 !! result
13323 <p>&#91;&#91;:Template:Msg&#93;&#93;
13324 </p>
13325 !! end
13326
13327 !! test
13328 RAW magic word
13329 !! input
13330 {{RAW:QUERTY}}
13331 !! result
13332 <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>
13333 </p>
13334 !! end
13335
13336 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13337 !! test
13338 Always escape literal '>' in output, not just after '<'
13339 !! input
13340 ><>
13341 !! result
13342 <p>&gt;&lt;&gt;
13343 </p>
13344 !! end
13345
13346 !! test
13347 Template caching
13348 !! input
13349 {{Test}}
13350 {{Test}}
13351 !! result
13352 <p>This is a test template
13353 This is a test template
13354 </p>
13355 !! end
13356
13357
13358 !! article
13359 MediaWiki:Fake
13360 !! text
13361 ==header==
13362 !! endarticle
13363
13364 !! test
13365 Inclusion of !userCanEdit() content
13366 !! input
13367 {{MediaWiki:Fake}}
13368 !! result
13369 <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>
13370
13371 !! end
13372
13373
13374 !! test
13375 Out-of-order TOC heading levels
13376 !! input
13377 ==2==
13378 ======6======
13379 ===3===
13380 =1=
13381 =====5=====
13382 ==2==
13383 !! result
13384 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13385 <ul>
13386 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13387 <ul>
13388 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13389 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13390 </ul>
13391 </li>
13392 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13393 <ul>
13394 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13395 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13396 </ul>
13397 </li>
13398 </ul>
13399 </div>
13400 <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>
13401 <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>
13402 <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>
13403 <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>
13404 <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>
13405 <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>
13406
13407 !! end
13408
13409
13410 !! test
13411 ISBN with a dummy number
13412 !! input
13413 ISBN ---
13414 !! result
13415 <p>ISBN ---
13416 </p>
13417 !! end
13418
13419
13420 !! test
13421 ISBN with space-delimited number
13422 !! input
13423 ISBN 92 9017 032 8
13424 !! result
13425 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13426 </p>
13427 !! end
13428
13429
13430 !! test
13431 ISBN with multiple spaces, no number
13432 !! input
13433 ISBN foo
13434 !! result
13435 <p>ISBN foo
13436 </p>
13437 !! end
13438
13439
13440 !! test
13441 ISBN length
13442 !! input
13443 ISBN 123456789
13444
13445 ISBN 1234567890
13446
13447 ISBN 12345678901
13448 !! result
13449 <p>ISBN 123456789
13450 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13451 </p><p>ISBN 12345678901
13452 </p>
13453 !! end
13454
13455
13456 !! test
13457 ISBN with trailing year (bug 8110)
13458 !! input
13459 ISBN 1-234-56789-0 - 2006
13460
13461 ISBN 1 234 56789 0 - 2006
13462 !! result
13463 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13464 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13465 </p>
13466 !! end
13467
13468
13469 !! test
13470 anchorencode
13471 !! input
13472 {{anchorencode:foo bar©#%n}}
13473 !! result
13474 <p>foo_bar.C2.A9.23.25n
13475 </p>
13476 !! end
13477
13478 !! test
13479 anchorencode trims spaces
13480 !! input
13481 {{anchorencode: __pretty__please__}}
13482 !! result
13483 <p>pretty_please
13484 </p>
13485 !! end
13486
13487 !! test
13488 anchorencode deals with links
13489 !! input
13490 {{anchorencode: [[hello|world]] [[hi]]}}
13491 !! result
13492 <p>world_hi
13493 </p>
13494 !! end
13495
13496 !! test
13497 anchorencode deals with templates
13498 !! input
13499 {{anchorencode: {{Foo}} }}
13500 !! result
13501 <p>FOO
13502 </p>
13503 !! end
13504
13505 !! test
13506 anchorencode encodes like the TOC generator: (bug 18431)
13507 !! input
13508 === _ +:.3A%3A&&amp;]] ===
13509 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13510 __NOEDITSECTION__
13511 !! result
13512 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13513 <p>.2B:.3A.253A.26.26.5D.5D
13514 </p>
13515 !! end
13516
13517 # Expected output in the following test is not necessarily expected (there
13518 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13519 # only testing for well-formedness.
13520 !! test
13521 Bug 6200: blockquotes and paragraph formatting
13522 !! input
13523 <blockquote>
13524 foo
13525 </blockquote>
13526
13527 bar
13528
13529 baz
13530 !! result
13531 <blockquote>
13532 foo
13533 </blockquote>
13534 <p>bar
13535 </p>
13536 <pre>baz
13537 </pre>
13538 !! end
13539
13540 !! test
13541 Bug 8293: Use of center tag ruins paragraph formatting
13542 !! input
13543 <center>
13544 foo
13545 </center>
13546
13547 bar
13548
13549 baz
13550 !! result
13551 <center>
13552 <p>foo
13553 </p>
13554 </center>
13555 <p>bar
13556 </p>
13557 <pre>baz
13558 </pre>
13559 !! end
13560
13561 !!test
13562 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13563 !!options
13564 php
13565 !!input
13566 <span><s>x</span></s>
13567 !!result
13568 <p><span><s>x&lt;/span&gt;</s></span>
13569 </p>
13570 !!end
13571
13572 !!test
13573 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13574 !!options
13575 parsoid
13576 !!input
13577 <span><s>x</span></s>
13578 !!result
13579 <p><span><s>x</s></span><s></s>
13580 </p>
13581 !!end
13582
13583 ###
13584 ### Language variants related tests
13585 ###
13586 !! test
13587 Self-link in language variants
13588 !! options
13589 title=[[Dunav]] language=sr
13590 !! input
13591 Both [[Dunav]] and [[Дунав]] are names for this river.
13592 !! result
13593 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13594 </p>
13595 !!end
13596
13597 !! article
13598 Дуна
13599 !! text
13600 content
13601 !! endarticle
13602
13603 !! test
13604 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13605 !! options
13606 title=[[Duna]] language=sr
13607 !! input
13608 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13609 !! result
13610 <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.
13611 </p>
13612 !! end
13613
13614 !! test
13615 Link to pages in language variants
13616 !! options
13617 language=sr
13618 !! input
13619 Main Page can be written as [[Маин Паге]]
13620 !! result
13621 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13622 </p>
13623 !!end
13624
13625
13626 !! test
13627 Multiple links to pages in language variants
13628 !! options
13629 language=sr
13630 !! input
13631 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13632 !! result
13633 <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>.
13634 </p>
13635 !!end
13636
13637
13638 !! test
13639 Simple template in language variants
13640 !! options
13641 language=sr
13642 !! input
13643 {{тест}}
13644 !! result
13645 <p>This is a test template
13646 </p>
13647 !! end
13648
13649
13650 !! test
13651 Template with explicit namespace in language variants
13652 !! options
13653 language=sr
13654 !! input
13655 {{Template:тест}}
13656 !! result
13657 <p>This is a test template
13658 </p>
13659 !! end
13660
13661
13662 !! test
13663 Basic test for template parameter in language variants
13664 !! options
13665 language=sr
13666 !! input
13667 {{парамтест|param=foo}}
13668 !! result
13669 <p>This is a test template with parameter foo
13670 </p>
13671 !! end
13672
13673
13674 !! test
13675 Simple category in language variants
13676 !! options
13677 language=sr cat
13678 !! input
13679 [[Category:МедиаWики Усер'с Гуиде]]
13680 !! result
13681 <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>
13682 !! end
13683
13684
13685 !! article
13686 Category:分类
13687 !! text
13688 blah
13689 !! endarticle
13690
13691 !! article
13692 Category:分類
13693 !! text
13694 blah
13695 !! endarticle
13696
13697 !! test
13698 Don't convert blue categorylinks to another variant (bug 33210)
13699 !! options
13700 language=zh cat
13701 !! input
13702 [[A]][[Category:分类]]
13703 !! result
13704 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13705 !! end
13706
13707
13708 !! test
13709 Stripping -{}- tags (language variants)
13710 !! options
13711 language=sr
13712 !! input
13713 Latin proverb: -{Ne nuntium necare}-
13714 !! result
13715 <p>Latin proverb: Ne nuntium necare
13716 </p>
13717 !! end
13718
13719
13720 !! test
13721 Prevent conversion with -{}- tags (language variants)
13722 !! options
13723 language=sr variant=sr-ec
13724 !! input
13725 Latinski: -{Ne nuntium necare}-
13726 !! result
13727 <p>Латински: Ne nuntium necare
13728 </p>
13729 !! end
13730
13731
13732 !! test
13733 Prevent conversion of text with -{}- tags (language variants)
13734 !! options
13735 language=sr variant=sr-ec
13736 !! input
13737 Latinski: -{Ne nuntium necare}-
13738 !! result
13739 <p>Латински: Ne nuntium necare
13740 </p>
13741 !! end
13742
13743
13744 !! test
13745 Prevent conversion of links with -{}- tags (language variants)
13746 !! options
13747 language=sr variant=sr-ec
13748 !! input
13749 -{[[Main Page]]}-
13750 !! result
13751 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13752 </p>
13753 !! end
13754
13755
13756 !! test
13757 -{}- tags within headlines (within html for parserConvert())
13758 !! options
13759 language=sr variant=sr-ec
13760 !! input
13761 == -{Naslov}- ==
13762 !! result
13763 <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>
13764
13765 !! end
13766
13767
13768 !! test
13769 Explicit definition of language variant alternatives
13770 !! options
13771 language=zh variant=zh-tw
13772 !! input
13773 -{zh:China;zh-tw:Taiwan}-, not China
13774 !! result
13775 <p>Taiwan, not China
13776 </p>
13777 !! end
13778
13779
13780 !! test
13781 Conversion around HTML tags
13782 !! options
13783 language=sr variant=sr-ec
13784 !! input
13785 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13786 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13787 !! result
13788 <p>
13789 <span title="ЛаCтин">ски</span>
13790 </p>
13791 !! end
13792
13793
13794 !! test
13795 Explicit session-wise language variant mapping (A flag and - flag)
13796 !! options
13797 language=zh variant=zh-tw
13798 !! input
13799 Taiwan is not China.
13800 But -{A|zh:China;zh-tw:Taiwan}- is China,
13801 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13802 and -{China}- is China.
13803 !! result
13804 <p>Taiwan is not China.
13805 But Taiwan is Taiwan,
13806 (This should be stripped!)
13807 and China is China.
13808 </p>
13809 !! end
13810
13811 !! test
13812 Explicit session-wise language variant mapping (H flag for hide)
13813 !! options
13814 language=zh variant=zh-tw
13815 !! input
13816 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13817 Taiwan is China.
13818 !! result
13819 <p>(This should be stripped!)
13820 Taiwan is Taiwan.
13821 </p>
13822 !! end
13823
13824 !! test
13825 Adding explicit conversion rule for title (T flag)
13826 !! options
13827 language=zh variant=zh-tw showtitle
13828 !! input
13829 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13830 !! result
13831 Taiwan
13832 <p>Should be stripped!
13833 </p>
13834 !! end
13835
13836 !! test
13837 Testing that changing the language variant here in the tests actually works
13838 !! options
13839 language=zh variant=zh showtitle
13840 !! input
13841 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13842 !! result
13843 China
13844 <p>Should be stripped!
13845 </p>
13846 !! end
13847
13848 !! test
13849 Recursive conversion of alt and title attrs shouldn't clear converter state
13850 !! options
13851 language=zh variant=zh-cn showtitle
13852 !! input
13853 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13854 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13855 !! result
13856 China
13857 <p>
13858 Should be stripped<span title="Exclamation">!</span>
13859 </p>
13860 !! end
13861
13862 !! test
13863 Bug 24072: more test on conversion rule for title
13864 !! options
13865 language=zh variant=zh-tw showtitle
13866 !! input
13867 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13868 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13869 !! result
13870 Taiwan
13871 <p>This should be stripped!
13872 This won't take interferes with the title rule.
13873 </p>
13874 !! end
13875
13876 !! test
13877 Partly disable title conversion if variant == main language code
13878 !! options
13879 language=zh variant=zh title=[[ZH]] showtitle
13880 !! input
13881 -{T|zh-cn:CN;zh-tw:TW}-
13882 !! result
13883 ZH
13884 <p>
13885 </p>
13886 !! end
13887
13888 !! test
13889 Partly disable title conversion if variant == main language code, more
13890 !! options
13891 language=zh variant=zh title=[[ZH]] showtitle
13892 !! input
13893 -{T|TW}-
13894 !! result
13895 ZH
13896 <p>
13897 </p>
13898 !! end
13899
13900 !! test
13901 Raw output of variant escape tags (R flag)
13902 !! options
13903 language=zh variant=zh-tw
13904 !! input
13905 Raw: -{R|zh:China;zh-tw:Taiwan}-
13906 !! result
13907 <p>Raw: zh:China;zh-tw:Taiwan
13908 </p>
13909 !! end
13910
13911 !! test
13912 Nested using of manual convert syntax
13913 !! options
13914 language=zh variant=zh-hk
13915 !! input
13916 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13917 !! result
13918 <p>Nested: Hello Hong Kong!
13919 </p>
13920 !! end
13921
13922 !! test
13923 Proper conversion of text in external links
13924 !! options
13925 language=sr variant=sr-ec
13926 !! input
13927 http://www.google.com
13928 gopher://www.google.com
13929 [http://www.google.com http://www.google.com]
13930 [gopher://www.google.com gopher://www.google.com]
13931 [https://www.google.com irc://www.google.com]
13932 [ftp://www.google.com www.google.com/ftp://dir]
13933 [//www.google.com www.google.com]
13934 !! result
13935 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13936 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13937 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13938 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13939 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13940 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13941 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13942 </p>
13943 !! end
13944
13945 !! test
13946 Do not convert roman numbers to language variants
13947 !! options
13948 language=sr variant=sr-ec
13949 !! input
13950 Fridrih IV je car.
13951 !! result
13952 <p>Фридрих IV је цар.
13953 </p>
13954 !! end
13955
13956 !! test
13957 Unclosed language converter markup "-{"
13958 !! options
13959 language=sr
13960 !! input
13961 -{T|hello
13962 !! result
13963 <p>-{T|hello
13964 </p>
13965 !! end
13966
13967 !! test
13968 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13969 !! options
13970 language=sr
13971 !! input
13972 -{R|=&gt;}-
13973 !! result
13974 <p>=&gt;
13975 </p>
13976 !!end
13977
13978 !! test
13979 Bug 529: Uncovered bullet
13980 !! input
13981 * Foo {{bullet}}
13982 !! result
13983 <ul><li> Foo
13984 </li><li> Bar
13985 </li></ul>
13986
13987 !! end
13988
13989 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13990 # Templates in Wikipedia rely on this behavior, as tidy has always been
13991 # enabled there. These tests are normally run *without* tidy, so specify the
13992 # full output here.
13993 # To test realistic parsing behavior, apply a tidy-like transformation to both
13994 # the expected output and your parser's output.
13995 !! test
13996 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13997 !! input
13998 ******* Foo {{bullet}}
13999 !! result
14000 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14001 </li></ul>
14002 </li></ul>
14003 </li></ul>
14004 </li></ul>
14005 </li></ul>
14006 </li></ul>
14007 </li><li> Bar
14008 </li></ul>
14009
14010 !! end
14011
14012 !! test
14013 Bug 529: Uncovered table already at line-start
14014 !! input
14015 x
14016
14017 {{table}}
14018 y
14019 !! result
14020 <p>x
14021 </p>
14022 <table>
14023 <tr>
14024 <td> 1 </td>
14025 <td> 2
14026 </td></tr>
14027 <tr>
14028 <td> 3 </td>
14029 <td> 4
14030 </td></tr></table>
14031 <p>y
14032 </p>
14033 !! end
14034
14035 !! test
14036 Bug 529: Uncovered bullet in parser function result
14037 !! input
14038 * Foo {{lc:{{bullet}} }}
14039 !! result
14040 <ul><li> Foo
14041 </li><li> bar
14042 </li></ul>
14043
14044 !! end
14045
14046 !! test
14047 Bug 5678: Double-parsed template argument
14048 !! input
14049 {{lc:{{{1}}}|hello}}
14050 !! result
14051 <p>{{{1}}}
14052 </p>
14053 !! end
14054
14055 !! test
14056 Bug 5678: Double-parsed template invocation
14057 !! input
14058 {{lc:{{paramtest {{!}} param = hello }} }}
14059 !! result
14060 <p>{{paramtest | param = hello }}
14061 </p>
14062 !! end
14063
14064 !! test
14065 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14066 !! options
14067 language=cs
14068 title=[[Main Page]]
14069 !! input
14070 {{PRVNÍVELKÉ:ěščř}}
14071 {{prvnívelké:ěščř}}
14072 {{PRVNÍMALÉ:ěščř}}
14073 {{prvnímalé:ěščř}}
14074 {{MALÁ:ěščř}}
14075 {{malá:ěščř}}
14076 {{VELKÁ:ěščř}}
14077 {{velká:ěščř}}
14078 !! result
14079 <p>Ěščř
14080 Ěščř
14081 ěščř
14082 ěščř
14083 ěščř
14084 ěščř
14085 ĚŠČŘ
14086 ĚŠČŘ
14087 </p>
14088 !! end
14089
14090 !! test
14091 Morwen/13: Unclosed link followed by heading
14092 !! input
14093 [[link
14094 ==heading==
14095 !! result
14096 <p>[[link
14097 </p>
14098 <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>
14099
14100 !! end
14101
14102 !! test
14103 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14104 !! input
14105 {{foo|
14106 =heading=
14107 !! result
14108 <p>{{foo|
14109 </p>
14110 <h1><span class="mw-headline" id="heading">heading</span></h1>
14111
14112 !! end
14113
14114 !! test
14115 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14116 !! input
14117 {{foo|
14118 ==heading==
14119 !! result
14120 <p>{{foo|
14121 </p>
14122 <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>
14123
14124 !! end
14125
14126 !! test
14127 Tildes in comments
14128 !! options
14129 pst
14130 !! input
14131 <!-- ~~~~ -->
14132 !! result
14133 <!-- ~~~~ -->
14134 !! end
14135
14136 !! test
14137 Paragraphs inside divs (no extra line breaks)
14138 !! input
14139 <div>Line one
14140
14141 Line two</div>
14142 !! result
14143 <div>Line one
14144 Line two</div>
14145
14146 !! end
14147
14148 !! test
14149 Paragraphs inside divs (extra line break on open)
14150 !! input
14151 <div>
14152 Line one
14153
14154 Line two</div>
14155 !! result
14156 <div>
14157 <p>Line one
14158 </p>
14159 Line two</div>
14160
14161 !! end
14162
14163 !! test
14164 Paragraphs inside divs (extra line break on close)
14165 !! input
14166 <div>Line one
14167
14168 Line two
14169 </div>
14170 !! result
14171 <div>Line one
14172 <p>Line two
14173 </p>
14174 </div>
14175
14176 !! end
14177
14178 !! test
14179 Paragraphs inside divs (extra line break on open and close)
14180 !! input
14181 <div>
14182 Line one
14183
14184 Line two
14185 </div>
14186 !! result
14187 <div>
14188 <p>Line one
14189 </p><p>Line two
14190 </p>
14191 </div>
14192
14193 !! end
14194
14195 !! test
14196 Nesting tags, paragraphs on lines which begin with <div>
14197 !! options
14198 disabled
14199 !! input
14200 <div></div><strong>A
14201 B</strong>
14202 !! result
14203 <div></div>
14204 <p><strong>A
14205 B</strong>
14206 </p>
14207 !! end
14208
14209 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14210 !! test
14211 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14212 !! options
14213 disabled
14214 !! input
14215 <blockquote>Line one
14216
14217 Line two</blockquote>
14218 !! result
14219 <blockquote>Line one
14220 Line two</blockquote>
14221
14222 !! end
14223
14224 !! test
14225 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14226 !! options
14227 disabled
14228 !! input
14229 <blockquote>
14230 Line one
14231
14232 Line two</blockquote>
14233 !! result
14234 <blockquote>
14235 <p>Line one
14236 </p>
14237 Line two</blockquote>
14238
14239 !! end
14240
14241 !! test
14242 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14243 !! options
14244 disabled
14245 !! input
14246 <blockquote>Line one
14247
14248 Line two
14249 </blockquote>
14250 !! result
14251 <blockquote>Line one
14252 <p>Line two
14253 </p>
14254 </blockquote>
14255
14256 !! end
14257
14258 !! test
14259 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14260 !! options
14261 disabled
14262 !! input
14263 <blockquote>
14264 Line one
14265
14266 Line two
14267 </blockquote>
14268 !! result
14269 <blockquote>
14270 <p>Line one
14271 </p><p>Line two
14272 </p>
14273 </blockquote>
14274
14275 !! end
14276
14277 !! test
14278 Paragraphs inside blockquotes/divs (no extra line breaks)
14279 !! input
14280 <blockquote><div>Line one
14281
14282 Line two</div></blockquote>
14283 !! result
14284 <blockquote><div>Line one
14285 Line two</div></blockquote>
14286
14287 !! end
14288
14289 !! test
14290 Paragraphs inside blockquotes/divs (extra line break on open)
14291 !! input
14292 <blockquote><div>
14293 Line one
14294
14295 Line two</div></blockquote>
14296 !! result
14297 <blockquote><div>
14298 <p>Line one
14299 </p>
14300 Line two</div></blockquote>
14301
14302 !! end
14303
14304 !! test
14305 Paragraphs inside blockquotes/divs (extra line break on close)
14306 !! input
14307 <blockquote><div>Line one
14308
14309 Line two
14310 </div></blockquote>
14311 !! result
14312 <blockquote><div>Line one
14313 <p>Line two
14314 </p>
14315 </div></blockquote>
14316
14317 !! end
14318
14319 !! test
14320 Paragraphs inside blockquotes/divs (extra line break on open and close)
14321 !! input
14322 <blockquote><div>
14323 Line one
14324
14325 Line two
14326 </div></blockquote>
14327 !! result
14328 <blockquote><div>
14329 <p>Line one
14330 </p><p>Line two
14331 </p>
14332 </div></blockquote>
14333
14334 !! end
14335
14336 !! test
14337 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14338 !! options
14339 wgLinkHolderBatchSize=0
14340 !! input
14341 [[meatball:1]]
14342 [[meatball:2]]
14343 [[meatball:3]]
14344 !! result
14345 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14346 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14347 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14348 </p>
14349 !! end
14350
14351 !! test
14352 Free external link invading image caption
14353 !! input
14354 [[Image:Foobar.jpg|thumb|http://x|hello]]
14355 !! result
14356 <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>
14357
14358 !! end
14359
14360 !! test
14361 Bug 15196: localised external link numbers
14362 !! options
14363 language=fa
14364 !! input
14365 [http://en.wikipedia.org/]
14366 !! result
14367 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14368 </p>
14369 !! end
14370
14371 !! test
14372 Multibyte character in padleft
14373 !! input
14374 {{padleft:-Hello|7|Æ}}
14375 !! result
14376 <p>Æ-Hello
14377 </p>
14378 !! end
14379
14380 !! test
14381 Multibyte character in padright
14382 !! input
14383 {{padright:Hello-|7|Æ}}
14384 !! result
14385 <p>Hello-Æ
14386 </p>
14387 !! end
14388
14389 !!test
14390 formatdate parser function
14391 !!input
14392 {{#formatdate:2009-03-24}}
14393 !! result
14394 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14395 </p>
14396 !! end
14397
14398 !!test
14399 formatdate parser function, with default format
14400 !!input
14401 {{#formatdate:2009-03-24|mdy}}
14402 !! result
14403 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14404 </p>
14405 !! end
14406
14407 !! test
14408 Spacing of numbers in formatted dates
14409 !! input
14410 {{#formatdate:January 15}}
14411 !! result
14412 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14413 </p>
14414 !! end
14415
14416 !! test
14417 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
14418 !! options
14419 language=nl title=[[MediaWiki:Common.css]]
14420 !! input
14421 {{#formatdate:2009-03-24|dmy}}
14422 !! result
14423 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14424 </p>
14425 !! end
14426
14427 #
14428 #
14429 #
14430
14431 #
14432 # Edit comments
14433 #
14434
14435 !! test
14436 Edit comment with link
14437 !! options
14438 comment
14439 !! input
14440 I like the [[Main Page]] a lot
14441 !! result
14442 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14443 !!end
14444
14445 !! test
14446 Edit comment with link and link text
14447 !! options
14448 comment
14449 !! input
14450 I like the [[Main Page|best pages]] a lot
14451 !! result
14452 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14453 !!end
14454
14455 !! test
14456 Edit comment with link and link text with suffix
14457 !! options
14458 comment
14459 !! input
14460 I like the [[Main Page|best page]]s a lot
14461 !! result
14462 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14463 !!end
14464
14465 !! test
14466 Edit comment with section link (non-local, eg in history list)
14467 !! options
14468 comment title=[[Main Page]]
14469 !! input
14470 /* External links */ removed bogus entries
14471 !! result
14472 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14473 !!end
14474
14475 !! test
14476 Edit comment with section link and text before it (non-local, eg in history list)
14477 !! options
14478 comment title=[[Main Page]]
14479 !! input
14480 pre-comment text /* External links */ removed bogus entries
14481 !! result
14482 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>
14483 !!end
14484
14485 !! test
14486 Edit comment with section link (local, eg in diff view)
14487 !! options
14488 comment local title=[[Main Page]]
14489 !! input
14490 /* External links */ removed bogus entries
14491 !! result
14492 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14493 !!end
14494
14495 !! test
14496 Edit comment with subpage link (bug 14080)
14497 !! options
14498 comment
14499 subpage
14500 title=[[Subpage test]]
14501 !! input
14502 Poked at a [[/subpage]] here...
14503 !! result
14504 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14505 !!end
14506
14507 !! test
14508 Edit comment with subpage link and link text (bug 14080)
14509 !! options
14510 comment
14511 subpage
14512 title=[[Subpage test]]
14513 !! input
14514 Poked at a [[/subpage|neat little page]] here...
14515 !! result
14516 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14517 !!end
14518
14519 !! test
14520 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14521 !! options
14522 comment
14523 title=[[Subpage test]]
14524 !! input
14525 Poked at a [[/subpage]] here...
14526 !! result
14527 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...
14528 !!end
14529
14530 !! test
14531 Edit comment with bare anchor link (local, as on diff)
14532 !! options
14533 comment
14534 local
14535 title=[[Main Page]]
14536 !!input
14537 [[#section]]
14538 !! result
14539 <a href="#section">#section</a>
14540 !! end
14541
14542 !! test
14543 Edit comment with bare anchor link (non-local, as on history)
14544 !! options
14545 comment
14546 title=[[Main Page]]
14547 !!input
14548 [[#section]]
14549 !! result
14550 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14551 !! end
14552
14553 !! test
14554 Anchor starting with underscore
14555 !!input
14556 [[#_ref|One]]
14557 !! result
14558 <p><a href="#_ref">One</a>
14559 </p>
14560 !! end
14561
14562 !! test
14563 Id starting with underscore
14564 !!input
14565 <div id="_ref"></div>
14566 !! result
14567 <div id="_ref"></div>
14568
14569 !! end
14570
14571 !! test
14572 Space normalisation on autocomment (bug 22784)
14573 !! options
14574 comment
14575 title=[[Main Page]]
14576 !!input
14577 /* __hello__world__ */
14578 !! result
14579 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14580 !! end
14581
14582 !! test
14583 percent-encoding and + signs in comments (Bug 26410)
14584 !! options
14585 comment
14586 !!input
14587 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14588 !! result
14589 <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>
14590 !! end
14591
14592 !! test
14593 Bad images - basic functionality
14594 !! options
14595 disabled
14596 !! input
14597 [[File:Bad.jpg]]
14598 !! result
14599 !! end
14600
14601 !! test
14602 Bad images - bug 16039: text after bad image disappears
14603 !! options
14604 disabled
14605 !! input
14606 Foo bar
14607 [[File:Bad.jpg]]
14608 Bar foo
14609 !! result
14610 <p>Foo bar
14611 </p><p>Bar foo
14612 </p>
14613 !! end
14614
14615 !! test
14616 Verify that displaytitle works (bug #22501) no displaytitle
14617 !! options
14618 showtitle
14619 !! config
14620 wgAllowDisplayTitle=true
14621 wgRestrictDisplayTitle=false
14622 !! input
14623 this is not the the title
14624 !! result
14625 Parser test
14626 <p>this is not the the title
14627 </p>
14628 !! end
14629
14630 !! test
14631 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14632 !! options
14633 showtitle
14634 title=[[Screen]]
14635 !! config
14636 wgAllowDisplayTitle=true
14637 wgRestrictDisplayTitle=false
14638 !! input
14639 this is not the the title
14640 {{DISPLAYTITLE:whatever}}
14641 !! result
14642 whatever
14643 <p>this is not the the title
14644 </p>
14645 !! end
14646
14647 !! test
14648 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14649 !! options
14650 showtitle
14651 title=[[Screen]]
14652 !! config
14653 wgAllowDisplayTitle=true
14654 wgRestrictDisplayTitle=true
14655 !! input
14656 this is not the the title
14657 {{DISPLAYTITLE:whatever}}
14658 !! result
14659 Screen
14660 <p>this is not the the title
14661 </p>
14662 !! end
14663
14664 !! test
14665 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14666 !! options
14667 showtitle
14668 title=[[Screen]]
14669 !! config
14670 wgAllowDisplayTitle=true
14671 wgRestrictDisplayTitle=true
14672 !! input
14673 this is not the the title
14674 {{DISPLAYTITLE:screen}}
14675 !! result
14676 screen
14677 <p>this is not the the title
14678 </p>
14679 !! end
14680
14681 !! test
14682 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14683 !! options
14684 showtitle
14685 title=[[Screen]]
14686 !! config
14687 wgAllowDisplayTitle=false
14688 !! input
14689 this is not the the title
14690 {{DISPLAYTITLE:screen}}
14691 !! result
14692 Screen
14693 <p>this is not the the title
14694 <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>
14695 </p>
14696 !! end
14697
14698 !! test
14699 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14700 !! options
14701 showtitle
14702 title=[[Screen]]
14703 !! config
14704 wgAllowDisplayTitle=false
14705 !! input
14706 this is not the the title
14707 !! result
14708 Screen
14709 <p>this is not the the title
14710 </p>
14711 !! end
14712
14713 !! test
14714 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14715 !! options
14716 showtitle
14717 title=[[Screen]]
14718 !! config
14719 wgAllowDisplayTitle=true
14720 wgRestrictDisplayTitle=true
14721 !! input
14722 this is not the the title
14723 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14724 !! result
14725 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14726 <p>this is not the the title
14727 </p>
14728 !! end
14729
14730 !! test
14731 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14732 !! options
14733 showtitle
14734 title=[[Screen]]
14735 !! config
14736 wgAllowDisplayTitle=true
14737 wgRestrictDisplayTitle=true
14738 !! input
14739 this is not the the title
14740 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14741 !! result
14742 <span style="color: red;">s</span>creen
14743 <p>this is not the the title
14744 </p>
14745 !! end
14746
14747 !! test
14748 preload: check <noinclude> and <includeonly>
14749 !! options
14750 preload
14751 !! input
14752 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14753 !! result
14754 Hello kind world.
14755 !! end
14756
14757 !! test
14758 preload: check <onlyinclude>
14759 !! options
14760 preload
14761 !! input
14762 Goodbye <onlyinclude>Hello world</onlyinclude>
14763 !! result
14764 Hello world
14765 !! end
14766
14767 !! test
14768 preload: can pass tags through if we want to
14769 !! options
14770 preload
14771 !! input
14772 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14773 !! result
14774 <includeonly>Hello world</includeonly>
14775 !! end
14776
14777 !! test
14778 preload: check that it doesn't try to do tricks
14779 !! options
14780 preload
14781 !! input
14782 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14783 !! result
14784 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14785 !! end
14786
14787 !! test
14788 Play a bit with r67090 and bug 3158
14789 !! options
14790 disabled
14791 !! input
14792 <div style="width:50% !important">&nbsp;</div>
14793 <div style="width:50%&nbsp;!important">&nbsp;</div>
14794 <div style="width:50%&#160;!important">&nbsp;</div>
14795 <div style="border : solid;">&nbsp;</div>
14796 !! result
14797 <div style="width:50% !important">&nbsp;</div>
14798 <div style="width:50% !important">&nbsp;</div>
14799 <div style="width:50% !important">&nbsp;</div>
14800 <div style="border&#160;: solid;">&nbsp;</div>
14801
14802 !! end
14803
14804 !! test
14805 HTML5 data attributes
14806 !! input
14807 <span data-foo="bar">Baz</span>
14808 <p data-abc-def_hij="">Quuz</p>
14809 !! result
14810 <p><span data-foo="bar">Baz</span>
14811 </p>
14812 <p data-abc-def_hij="">Quuz</p>
14813
14814 !! end
14815
14816 !! test
14817 percent-encoding and + signs in internal links (Bug 26410)
14818 !! input
14819 [[User:+%]] [[Page+title%]]
14820 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14821 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14822 [[%33%45]] [[%33%45+]]
14823 !! result
14824 <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>
14825 <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>
14826 <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>
14827 <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>
14828 </p>
14829 !! end
14830
14831 !! test
14832 Special characters in embedded file links (bug 27679)
14833 !! input
14834 [[File:Contains & ampersand.jpg]]
14835 [[File:Does not exist.jpg|Title with & ampersand]]
14836 !! result
14837 <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>
14838 <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>
14839 </p>
14840 !! end
14841
14842
14843 !! test
14844 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14845 !! input
14846 Text&apos;s been normalized?
14847 !! result
14848 <p>Text&#39;s been normalized?
14849 </p>
14850 !! end
14851
14852 !! test
14853 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14854 !! input
14855 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14856 !! result
14857 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14858 </p>
14859 !! end
14860
14861 !! test
14862 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14863 !! input
14864 [http://www.example.org/ ideograms]
14865 !! result
14866 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14867 </p>
14868 !! end
14869
14870 !! test
14871 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14872 !! input
14873 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14874 !! result
14875 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14876 </p>
14877 !! end
14878
14879 !! article
14880 Mediawiki:loop1
14881 !! text
14882 {{Identical|A}}
14883 !! endarticle
14884
14885 !! article
14886 Mediawiki:loop2
14887 !! text
14888 {{Identical|B}}
14889 !! endarticle
14890
14891 !! article
14892 Template:Identical
14893 !! text
14894 {{int:loop1}}
14895 {{int:loop2}}
14896 !! endarticle
14897
14898 !! test
14899 Bug 31098 Template which includes system messages which includes the template
14900 !! input
14901 {{Identical}}
14902 !! result
14903 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14904 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14905 </p>
14906 !! end
14907
14908 !! test
14909 Bug31490 Turkish: ucfirst 'blah'
14910 !! options
14911 language=tr
14912 !! input
14913 {{ucfirst:blah}}
14914 !! result
14915 <p>Blah
14916 </p>
14917 !! end
14918
14919 !! test
14920 Bug31490 Turkish: ucfirst 'ix'
14921 !! options
14922 language=tr
14923 !! input
14924 {{ucfirst:ix}}
14925 !! result
14926 <p>İx
14927 </p>
14928 !! end
14929
14930 !! test
14931 Bug31490 Turkish: lcfirst 'BLAH'
14932 !! options
14933 language=tr
14934 !! input
14935 {{lcfirst:BLAH}}
14936 !! result
14937 <p>bLAH
14938 </p>
14939 !! end
14940
14941 !! test
14942 Bug31490 Turkish: ucfırst (with a dotless i)
14943 !! options
14944 language=tr
14945 !! input
14946 {{ucfırst:blah}}
14947 !! result
14948 <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>
14949 </p>
14950 !! end
14951
14952 !! test
14953 Bug31490 ucfırst (with a dotless i) with English language
14954 !! options
14955 language=en
14956 !! input
14957 {{ucfırst:blah}}
14958 !! result
14959 <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>
14960 </p>
14961 !! end
14962
14963 !! test
14964 Bug 26375: TOC with italics
14965 !! options
14966 title=[[Main Page]]
14967 !! input
14968 __TOC__
14969 == ''Lost'' episodes ==
14970 !! result
14971 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14972 <ul>
14973 <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>
14974 </ul>
14975 </div>
14976 <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>
14977
14978 !! end
14979
14980 !! test
14981 Bug 26375: TOC with bold
14982 !! options
14983 title=[[Main Page]]
14984 !! input
14985 __TOC__
14986 == '''should be bold''' then normal text ==
14987 !! result
14988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14989 <ul>
14990 <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>
14991 </ul>
14992 </div>
14993 <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>
14994
14995 !! end
14996
14997 !! test
14998 Bug 33845: Headings become cursive in TOC when they contain an image
14999 !! options
15000 title=[[Main Page]]
15001 !! input
15002 __TOC__
15003 == Image [[Image:foobar.jpg]] ==
15004 !! result
15005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15006 <ul>
15007 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15008 </ul>
15009 </div>
15010 <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>
15011
15012 !! end
15013
15014 !! test
15015 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15016 !! options
15017 title=[[Main Page]]
15018 !! input
15019 __TOC__
15020 == <blockquote>Quote</blockquote> ==
15021 !! result
15022 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15023 <ul>
15024 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15025 </ul>
15026 </div>
15027 <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>
15028
15029 !! end
15030
15031 !! test
15032 Unclosed tags in TOC
15033 !! options
15034 title=[[Main Page]]
15035 !! input
15036 __TOC__
15037 == Proof: 2 < 3 ==
15038 <small>Hanc marginis exiguitas non caperet.</small>
15039 QED
15040 !! result
15041 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15042 <ul>
15043 <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>
15044 </ul>
15045 </div>
15046 <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>
15047 <p><small>Hanc marginis exiguitas non caperet.</small>
15048 QED
15049 </p>
15050 !! end
15051
15052 !! test
15053 Multiple tags in TOC
15054 !! input
15055 __TOC__
15056 == <i>Foo</i> <b>Bar</b> ==
15057
15058 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15059 !! result
15060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15061 <ul>
15062 <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>
15063 <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>
15064 </ul>
15065 </div>
15066 <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>
15067 <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>
15068
15069 !! end
15070
15071 !! test
15072 Tags with parameters in TOC
15073 !! input
15074 __TOC__
15075 == <sup class="in-h2">Hello</sup> ==
15076
15077 == <sup class="a > b">Evilbye</sup> ==
15078 !! result
15079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15080 <ul>
15081 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15082 <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>
15083 </ul>
15084 </div>
15085 <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>
15086 <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>
15087
15088 !! end
15089
15090 !! test
15091 span tags with directionality in TOC
15092 !! input
15093 __TOC__
15094 == <span dir="ltr">C++</span> ==
15095
15096 == <span dir="rtl">זבנג!</span> ==
15097
15098 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15099
15100 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15101
15102 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15103 !! result
15104 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15105 <ul>
15106 <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>
15107 <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>
15108 <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>
15109 <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>
15110 <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>
15111 </ul>
15112 </div>
15113 <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>
15114 <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>
15115 <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>
15116 <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>
15117 <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>
15118
15119 !! end
15120
15121 !! article
15122 MediaWiki:Bug32057
15123 !! text
15124 == {{int:headline_sample}} ==
15125 !! endarticle
15126
15127 !! test
15128 Bug 32057: Title needed when expanding <h> nodes.
15129 !! options
15130 title=[[Main Page]]
15131 !! input
15132 {{int:Bug32057}}
15133 !! result
15134 <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>
15135
15136 !! end
15137
15138 !! test
15139 Strip marker in urlencode
15140 !! input
15141 {{urlencode:x<nowiki/>y}}
15142 {{urlencode:x<nowiki/>y|wiki}}
15143 {{urlencode:x<nowiki/>y|path}}
15144 !! result
15145 <p>xy
15146 xy
15147 xy
15148 </p>
15149 !! end
15150
15151 !! test
15152 Strip marker in lc
15153 !! input
15154 {{lc:x<nowiki/>y}}
15155 !! result
15156 <p>xy
15157 </p>
15158 !! end
15159
15160 !! test
15161 Strip marker in uc
15162 !! input
15163 {{uc:x<nowiki/>y}}
15164 !! result
15165 <p>XY
15166 </p>
15167 !! end
15168
15169 !! test
15170 Strip marker in formatNum
15171 !! input
15172 {{formatnum:1<nowiki/>2}}
15173 {{formatnum:1<nowiki/>2|R}}
15174 !! result
15175 <p>12
15176 12
15177 </p>
15178 !! end
15179
15180 !! test
15181 Check noCommafy in formatNum
15182 !! options
15183 language=be-tarask
15184 !! input
15185 {{formatnum:123456.78}}
15186 {{formatnum:123456.78|NOSEP}}
15187 !! result
15188 <p>123 456,78
15189 123456.78
15190 </p>
15191 !! end
15192
15193 !! test
15194 Strip marker in grammar
15195 !! options
15196 language=fi
15197 !! input
15198 {{grammar:elative|foo<nowiki/>bar}}
15199 !! result
15200 <p>foobarista
15201 </p>
15202 !! end
15203
15204 !! test
15205 Strip marker in padleft
15206 !! input
15207 {{padleft:|2|x<nowiki/>y}}
15208 !! result
15209 <p>xy
15210 </p>
15211 !! end
15212
15213 !! test
15214 Strip marker in padright
15215 !! input
15216 {{padright:|2|x<nowiki/>y}}
15217 !! result
15218 <p>xy
15219 </p>
15220 !! end
15221
15222 !! test
15223 Strip marker in anchorencode
15224 !! input
15225 {{anchorencode:x<nowiki/>y}}
15226 !! result
15227 <p>xy
15228 </p>
15229 !! end
15230
15231 !! test
15232 nowiki inside link inside heading (bug 18295)
15233 !! input
15234 ==[[foo|x<nowiki>y</nowiki>z]]==
15235 !! result
15236 <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>
15237
15238 !! end
15239
15240 !! test
15241 new support for bdi element (bug 31817)
15242 !! input
15243 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15244 !! result
15245 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15246
15247 !!end
15248
15249 !! test
15250 Ignore pipe between table row attributes
15251 !! input
15252 {|
15253 | quux
15254 |- id=foo | style='color: red'
15255 | bar
15256 |}
15257 !! result
15258 <table>
15259 <tr>
15260 <td> quux
15261 </td></tr>
15262 <tr id="foo" style="color: red">
15263 <td> bar
15264 </td></tr></table>
15265
15266 !! end
15267
15268 !!test
15269 Gallery override link with WikiLink (bug 34852)
15270 !! input
15271 <gallery>
15272 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15273 </gallery>
15274 !! result
15275 <ul class="gallery mw-gallery-traditional">
15276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15277 <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>
15278 <div class="gallerytext">
15279 <p>caption
15280 </p>
15281 </div>
15282 </div></li>
15283 </ul>
15284
15285 !! end
15286
15287 !!test
15288 Gallery override link with absolute external link (bug 34852)
15289 !! input
15290 <gallery>
15291 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15292 </gallery>
15293 !! result
15294 <ul class="gallery mw-gallery-traditional">
15295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15296 <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>
15297 <div class="gallerytext">
15298 <p>caption
15299 </p>
15300 </div>
15301 </div></li>
15302 </ul>
15303
15304 !! end
15305
15306 !!test
15307 Gallery override link with malicious javascript (bug 34852)
15308 !! input
15309 <gallery>
15310 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15311 </gallery>
15312 !! result
15313 <ul class="gallery mw-gallery-traditional">
15314 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15315 <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>
15316 <div class="gallerytext">
15317 <p>caption
15318 </p>
15319 </div>
15320 </div></li>
15321 </ul>
15322
15323 !! end
15324
15325 !!test
15326 Gallery with invalid title as link (bug 43964)
15327 !! input
15328 <gallery>
15329 File:foobar.jpg|link=<
15330 </gallery>
15331 !! result
15332 <ul class="gallery mw-gallery-traditional">
15333 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15334 <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>
15335 <div class="gallerytext">
15336 </div>
15337 </div></li>
15338 </ul>
15339
15340 !! end
15341
15342 !!test
15343 Language parser function
15344 !! input
15345 {{#language:ar}}
15346 !! result
15347 <p>العربية
15348 </p>
15349 !! end
15350
15351 !!test
15352 Padleft and padright as substr
15353 !! input
15354 {{padleft:|3|abcde}}
15355 {{padright:|3|abcde}}
15356 !! result
15357 <p>abc
15358 abc
15359 </p>
15360 !! end
15361
15362 !!test
15363 Special parser function
15364 !! input
15365 {{#special:RandomPage}}
15366 {{#special:BaDtItLe}}
15367 {{#special:Foobar}}
15368 !! result
15369 <p>Special:Random
15370 Special:Badtitle
15371 Special:Foobar
15372 </p>
15373 !! end
15374
15375 !!test
15376 Bug 34939 - Case insensitive link parsing ([HttP://])
15377 !! input
15378 [HttP://MediaWiki.Org/]
15379 !! result
15380 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15381 </p>
15382 !! end
15383
15384 !!test
15385 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15386 !! input
15387 [HttP://MediaWiki.Org/ MediaWiki]
15388 !! result
15389 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15390 </p>
15391 !! end
15392
15393 !!test
15394 Bug 34939 - Case insensitive link parsing (HttP://)
15395 !! input
15396 HttP://MediaWiki.Org/
15397 !! result
15398 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15399 </p>
15400 !! end
15401
15402
15403 ###
15404 ### Parsoids-specific tests
15405 ### Parsoid-PHP parser incompatibilities
15406 ###
15407 !!test
15408 1. SOL-sensitive wikitext tokens as template-args
15409 !!options
15410 parsoid=wt2html,wt2wt
15411 !!input
15412 {{echo|*a}}
15413 {{echo|#a}}
15414 {{echo|:a}}
15415 !!result
15416 <span about="#mwt1" typeof="mw:Transclusion">
15417 </span><ul about="#mwt1"><li>a</li></ul>
15418 <span about="#mwt2" typeof="mw:Transclusion">
15419 </span><ol about="#mwt2"><li>a</li></ol>
15420 <span about="#mwt3" typeof="mw:Transclusion">
15421 </span><dl about="#mwt3"><dd>a</dd></dl>
15422 !!end
15423
15424 #### ----------------------------------------------------------------
15425 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15426 #### tags. Parsoid's output for these tags differs from that of the
15427 #### PHP parser.
15428 #### ----------------------------------------------------------------
15429
15430 !!test
15431 Ref: 1. ref-location should be replaced with an index span
15432 !!options
15433 parsoid
15434 !!input
15435 A <ref>foo</ref>
15436 B <ref name="x">foo</ref>
15437 C <ref name="y" />
15438 !!result
15439 <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>
15440 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>
15441 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>
15442 !!end
15443
15444 !!test
15445 Ref: 2. ref-tags with identical names should all get the same index
15446 !!options
15447 parsoid
15448 !!input
15449 A <ref name="x">foo</ref>
15450 B <ref name="x" />
15451 !!result
15452 <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>
15453 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>
15454 !!end
15455
15456 !!test
15457 Ref: 3. spaces in ref-names should be ignored
15458 !!options
15459 parsoid
15460 !!input
15461 A <ref name="x">foo</ref>
15462 B <ref name=" x " />
15463 C <ref name= x />
15464 !!result
15465 <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>
15466 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>
15467 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>
15468 !!end
15469
15470 !!test
15471 Ref: 4. 'constructor' should be accepted as a valid ref-name
15472 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15473 !!options
15474 parsoid
15475 !!input
15476 A <ref name="constructor">foo</ref>
15477 !!result
15478 <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>
15479 !!end
15480
15481 !!test
15482 Ref: 5. body should accept generic wikitext
15483 !!options
15484 parsoid
15485 !!input
15486 A <ref>
15487 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15488 </ref>
15489
15490 <references />
15491 !!result
15492 <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>
15493
15494 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15495 <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>
15496 </li></ol>
15497 !!end
15498
15499 !!test
15500 Ref: 6. indent-pres should not be output in ref-body
15501 !!options
15502 parsoid
15503 !!input
15504 A <ref>
15505 foo
15506 bar
15507 baz
15508 </ref>
15509
15510 <references />
15511 !!result
15512 <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>
15513
15514 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15515 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15516 bar
15517 baz
15518 </li></ol>
15519 !!end
15520
15521 !!test
15522 Ref: 6. No p-wrapping in ref-body
15523 !!options
15524 parsoid
15525 !!input
15526 A <ref>
15527 foo
15528
15529 bar
15530
15531
15532 baz
15533
15534
15535
15536 booz
15537 </ref>
15538
15539 <references />
15540 !!result
15541 <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>
15542
15543 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15544 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15545
15546 bar
15547
15548
15549 baz
15550
15551
15552
15553 booz
15554 </li></ol>
15555 !!end
15556
15557 !!test
15558 Ref: 8. transclusion wikitext has lower precedence
15559 !!options
15560 parsoid
15561 !!input
15562 A <ref> foo {{echo|</ref> B C}}
15563
15564 <references />
15565 !!result
15566 <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>
15567
15568 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15569 <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>
15570 !!end
15571
15572 !!test
15573 Ref: 9. unclosed comments should not leak out of ref-body
15574 !!options
15575 parsoid
15576 !!input
15577 A <ref> foo <!--</ref> B C
15578
15579 <references />
15580 !!result
15581 <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>
15582
15583 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15584 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15585 !!end
15586
15587 !!test
15588 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15589 !!options
15590 parsoid
15591 !!input
15592 A <ref> <b> foo </ref> B C
15593
15594 <references />
15595 !!result
15596 <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>
15597
15598 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15599 <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>
15600 !!end
15601
15602 !!test
15603 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15604 !!options
15605 parsoid
15606 !!input
15607 A <ref>foo</ref> B
15608 C <ref>bar</ref> D
15609 !!result
15610 <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
15611 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>
15612 !!end
15613
15614 !!test
15615 Ref: 12. ref-tags act as trailing newline migration barrier
15616 !!options
15617 parsoid
15618 !!input
15619 <!--the newline at the end of this line moves out of the p-tag-->a
15620
15621 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15622 <ref />
15623
15624 c
15625 !!result
15626 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15627
15628
15629 <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>
15630 <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>
15631
15632
15633 <p>c</p>
15634 !!end
15635
15636 !!test
15637 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15638 !!options
15639 parsoid
15640 !!input
15641 <ref>foo</ref> A
15642 <ref>bar
15643 </ref> B
15644 !!result
15645 <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
15646 <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>
15647 !!end
15648
15649 !!test
15650 Ref: 14. A nested ref-tag should be emitted as plain text
15651 !!options
15652 parsoid
15653 !!input
15654 <ref>foo <ref>bar</ref> baz</ref>
15655
15656 <references />
15657 !!result
15658 <p><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></p>
15659
15660 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15661 <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>
15662 !!end
15663
15664 !!test
15665 Ref: 15. ref-tags with identical names should get identical indexes
15666 !!options
15667 parsoid
15668 !!input
15669 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15670 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15671
15672 <references />
15673 !!result
15674 <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>
15675 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>
15676
15677 <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>
15678 !!end
15679
15680 !!test
15681 References: 1. references tag without any refs should be handled properly
15682 !!options
15683 parsoid
15684 !!input
15685 <references />
15686 !!result
15687 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15688 !!end
15689
15690 !!test
15691 References: 2. references tag with group only outputs references from that group
15692 !!options
15693 parsoid
15694 !!input
15695 A <ref group="a">foo</ref>
15696 B <ref group="b">bar</ref>
15697
15698 <references group='a' />
15699 !!result
15700 <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>
15701 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>
15702
15703 <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>
15704 !!end
15705
15706 !!test
15707 References: 3. ref list should be cleared after processing references
15708 !!options
15709 parsoid
15710 !!input
15711 A <ref>foo</ref>
15712
15713 <references />
15714
15715 B <ref>bar</ref>
15716
15717 <references />
15718 !!result
15719 <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>
15720
15721 <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>
15722
15723 <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>
15724
15725 <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>
15726 !!end
15727
15728 !!test
15729 References: 4. only referenced group should be cleared after processing references
15730 !!options
15731 parsoid
15732 !!input
15733 A <ref group="a">afoo</ref>
15734 B <ref>bfoo</ref>
15735
15736 <references group="a"/>
15737
15738 C <ref>cfoo</ref>
15739
15740 <references />
15741 !!result
15742 <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>
15743 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>
15744
15745 <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>
15746
15747 <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>
15748
15749 <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>
15750 !!end
15751
15752 !!test
15753 References: 5. ref tags in references should be processed while ignoring all other content
15754 !!options
15755 parsoid
15756 !!input
15757 A <ref name="a" />
15758 B <ref name="b">bar</ref>
15759
15760 <references>
15761 <ref name="a">foo</ref>
15762 This should just get lost.
15763 </references>
15764 !!result
15765 <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>
15766 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>
15767
15768 <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>
15769 !!end
15770
15771 !!test
15772 References: 6. <references /> from a transclusion
15773 !!options
15774 parsoid
15775 !!input
15776 {{echo|<references />}}
15777 !!result
15778 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15779 !!end
15780
15781 !! test
15782 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15783 !! options
15784 parsoid
15785 !! input
15786 A <ref>foo bar for a</ref>
15787 B <ref name="b" />
15788
15789 <references />
15790
15791 <references>
15792 <ref name="b">foo</ref>
15793 </references>
15794 !! result
15795 <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>
15796 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>
15797
15798 <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>
15799
15800 <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>
15801
15802 !! end
15803
15804 #### ----------------------------------------------------------------
15805 #### The following section of tests are primarily to test
15806 #### wikitext escaping capabilities of Parsoid. Given that
15807 #### escaping can be done any number of ways, the wikitext (input)
15808 #### is always adjusted to reflect how Parsoid adds nowiki
15809 #### escape tags.
15810 ####
15811 #### We are marking several tests as parsoid-only since the
15812 #### HTML in the result section is different from what the
15813 #### PHP parser generates for it.
15814 #### ----------------------------------------------------------------
15815
15816
15817 #### --------------- Headings ---------------
15818 #### 0. Unnested
15819 #### 1. Nested inside html <h1>=foo=</h1>
15820 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15821 #### 3. Nested inside html with wikitext split by html tags
15822 #### 4. No escape needed
15823 #### 5. Empty headings <h1></h1>
15824 #### 6. Heading chars in SOL context
15825 #### ----------------------------------------
15826 !! test
15827 Headings: 0. Unnested
15828 !! options
15829 parsoid
15830 !! input
15831 <nowiki>=foo=</nowiki>
15832
15833 <nowiki> =foo= </nowiki>
15834 <!--cmt-->
15835 <nowiki>=foo=</nowiki>
15836
15837 =foo''a''<nowiki>=</nowiki>
15838 !! result
15839 <p><span typeof="mw:Nowiki">=foo=</span></p>
15840
15841 <p><span typeof="mw:Nowiki"> =foo= </span>
15842 <!--cmt-->
15843 <span typeof="mw:Nowiki">=foo=</span></p>
15844
15845 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15846 !!end
15847
15848 !! test
15849 Headings: 1. Nested inside html
15850 !! options
15851 parsoid
15852 !! input
15853 =<nowiki>=foo=</nowiki>=
15854
15855 ==<nowiki>=foo=</nowiki>==
15856
15857 ===<nowiki>=foo=</nowiki>===
15858
15859 ====<nowiki>=foo=</nowiki>====
15860
15861 =====<nowiki>=foo=</nowiki>=====
15862
15863 ======<nowiki>=foo=</nowiki>======
15864 !! result
15865 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15866 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15867 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15868 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15869 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15870 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15871 !!end
15872
15873 !! test
15874 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15875 !! options
15876 parsoid
15877 !! input
15878 =foo=
15879 <nowiki>*</nowiki>bar
15880
15881 =foo=
15882 =bar
15883
15884 =foo=
15885 <nowiki>=bar=</nowiki>
15886 !! result
15887 <h1>foo</h1>*bar
15888 <h1>foo</h1>=bar
15889 <h1>foo</h1>=bar=
15890 !!end
15891
15892 !! test
15893 Headings: 3. Nested inside html with wikitext split by html tags
15894 !! options
15895 parsoid
15896 !! input
15897 =='''bold'''<nowiki>foo=</nowiki>=
15898 !! result
15899 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15900 !!end
15901
15902 !! test
15903 Headings: 4a. No escaping needed (testing just h1 and h2)
15904 !! options
15905 parsoid
15906 !! input
15907 ==foo=
15908
15909 =foo==
15910
15911 = =foo= =
15912
15913 ==foo= bar=
15914
15915 ===foo==
15916
15917 ==foo===
15918
15919 =''=''foo==
15920
15921 =<nowiki>=</nowiki>=
15922 !! result
15923 <h1>=foo</h1>
15924 <h1>foo=</h1>
15925 <h1> =foo= </h1>
15926 <h1>=foo= bar</h1>
15927 <h2>=foo</h2>
15928 <h2>foo=</h2>
15929 <h1><i>=</i>foo=</h1>
15930 <h1><span typeof="mw:Nowiki">=</span></h1>
15931 !!end
15932
15933 !! test
15934 Headings: 4b. No escaping needed (inside p-tags)
15935 !! options
15936 parsoid
15937 !! input
15938 ===
15939 =foo= x
15940 =foo= <s></s>
15941 !! result
15942 <p>===
15943 =foo= x
15944 =foo= <s></s>
15945 </p>
15946 !!end
15947
15948 !! test
15949 Headings: 5. Empty headings
15950 !! options
15951 parsoid
15952 !! input
15953 =<nowiki/>=
15954
15955 ==<nowiki/>==
15956
15957 ===<nowiki/>===
15958
15959 ====<nowiki/>====
15960
15961 =====<nowiki/>=====
15962
15963 ======<nowiki/>======
15964 !! result
15965 <h1></h1>
15966 <h2></h2>
15967 <h3></h3>
15968 <h4></h4>
15969 <h5></h5>
15970 <h6></h6>
15971 !!end
15972
15973 !! test
15974 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15975 !! options
15976 parsoid
15977 !! input
15978 <nowiki>=a=</nowiki>
15979
15980 <nowiki>=a=</nowiki>
15981
15982 <nowiki>=a=</nowiki>
15983
15984 <nowiki>=a=</nowiki>
15985 !! result
15986 <p>=a=</p>
15987 <p>=a= </p>
15988 <p>=a= </p>
15989 <p>=a= </p>
15990 !!end
15991
15992 !! test
15993 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15994 !! options
15995 parsoid
15996 !! input
15997 <nowiki>=a=
15998 b</nowiki>
15999
16000 <nowiki>=a=
16001 b</nowiki>
16002
16003 <nowiki>=a=
16004 b</nowiki>
16005
16006 <nowiki>=a=
16007 b</nowiki>
16008 !! result
16009 <p>=a=
16010 b</p>
16011 <p>=a=
16012 b</p>
16013 <p>=a=
16014 b</p>
16015 <p>=a=
16016 b</p>
16017 </p>
16018 !!end
16019
16020 !! test
16021 Headings: 6c. Heading chars in SOL context (leading newline break)
16022 !! options
16023 parsoid
16024 !! input
16025 a
16026 <nowiki>=b=</nowiki>
16027 !! result
16028 <p>a
16029 =b=</p>
16030 !!end
16031
16032 !! test
16033 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16034 !! options
16035 parsoid
16036 !! input
16037 <!--c0--><nowiki>=a=</nowiki>
16038 <!--c1-->
16039 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16040 !! result
16041 <p><!--c0-->=a=</p>
16042 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16043 !!end
16044
16045 !! test
16046 Headings: 6d. Heading chars in SOL context (No escaping needed)
16047 !! options
16048 parsoid=html2wt
16049 !! input
16050 =a=<div>b</div>
16051 !! result
16052 =a=<div>b</div>
16053 !!end
16054
16055 #### --------------- Lists ---------------
16056 #### 0. Outside nests (*foo, etc.)
16057 #### 1. Nested inside html <ul><li>*foo</li></ul>
16058 #### 2. Inside definition lists
16059 #### 3. Only bullets at start should be escaped
16060 #### 4. No escapes needed
16061 #### 5. No unnecessary escapes
16062 #### 6. Escape bullets in SOL position
16063 #### 7. Escape bullets in a multi-line context
16064 #### ----------------------------------------
16065
16066 !! test
16067 Lists: 0. Outside nests
16068 !! input
16069 <nowiki>*</nowiki>foo
16070
16071 <nowiki>#</nowiki>foo
16072 !! result
16073 <p>*foo
16074 </p><p>#foo
16075 </p>
16076 !!end
16077
16078 !! test
16079 Lists: 1. Nested inside html
16080 !! input
16081 *<nowiki>*foo</nowiki>
16082
16083 *<nowiki>#foo</nowiki>
16084
16085 *<nowiki>:foo</nowiki>
16086
16087 *<nowiki>;foo</nowiki>
16088
16089 #<nowiki>*foo</nowiki>
16090
16091 #<nowiki>#foo</nowiki>
16092
16093 #<nowiki>:foo</nowiki>
16094
16095 #<nowiki>;foo</nowiki>
16096 !! result
16097 <ul><li>*foo
16098 </li></ul>
16099 <ul><li>#foo
16100 </li></ul>
16101 <ul><li>:foo
16102 </li></ul>
16103 <ul><li>;foo
16104 </li></ul>
16105 <ol><li>*foo
16106 </li></ol>
16107 <ol><li>#foo
16108 </li></ol>
16109 <ol><li>:foo
16110 </li></ol>
16111 <ol><li>;foo
16112 </li></ol>
16113
16114 !!end
16115
16116 !! test
16117 Lists: 2. Inside definition lists
16118 !! input
16119 ;<nowiki>;foo</nowiki>
16120
16121 ;<nowiki>:foo</nowiki>
16122
16123 ;<nowiki>:foo</nowiki>
16124 :bar
16125
16126 :<nowiki>:foo</nowiki>
16127 !! result
16128 <dl><dt>;foo
16129 </dt></dl>
16130 <dl><dt>:foo
16131 </dt></dl>
16132 <dl><dt>:foo
16133 </dt><dd>bar
16134 </dd></dl>
16135 <dl><dd>:foo
16136 </dd></dl>
16137
16138 !!end
16139
16140 !! test
16141 Lists: 3. Only bullets at start of text should be escaped
16142 !! input
16143 *<nowiki>*foo*bar</nowiki>
16144
16145 *<nowiki>*foo</nowiki>''it''*bar
16146 !! result
16147 <ul><li>*foo*bar
16148 </li></ul>
16149 <ul><li>*foo<i>it</i>*bar
16150 </li></ul>
16151
16152 !!end
16153
16154 !! test
16155 Lists: 4. No escapes needed
16156 !! options
16157 parsoid
16158 !! input
16159 *foo*bar
16160
16161 *''foo''*bar
16162
16163 *[[Foo]]: bar
16164 !! result
16165 <ul><li>foo*bar
16166 </li></ul>
16167 <ul><li><i>foo</i>*bar
16168 </li></ul>
16169 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16170 </li></ul>
16171 !!end
16172
16173 !! test
16174 Lists: 5. No unnecessary escapes
16175 !! input
16176 * bar <span><nowiki>[[foo]]</nowiki></span>
16177
16178 *=bar <span><nowiki>[[foo]]</nowiki></span>
16179
16180 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16181
16182 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16183
16184 *=bar <span>foo]]</span>=
16185
16186 * <s></s>: a
16187 !! result
16188 <ul><li> bar <span>[[foo]]</span>
16189 </li></ul>
16190 <ul><li>=bar <span>[[foo]]</span>
16191 </li></ul>
16192 <ul><li>[[bar <span>[[foo]]</span>
16193 </li></ul>
16194 <ul><li>]]bar <span>[[foo]]</span>
16195 </li></ul>
16196 <ul><li>=bar <span>foo]]</span>=
16197 </li></ul>
16198 <ul><li> <s></s>: a
16199 </li></ul>
16200
16201 !!end
16202
16203 !! test
16204 Lists: 6. Escape bullets in SOL position
16205 !! options
16206 parsoid
16207 !! input
16208 <!--cmt--><nowiki>*foo</nowiki>
16209 !! result
16210 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16211 !!end
16212
16213 !! test
16214 Lists: 7. Escape bullets in a multi-line context
16215 !! input
16216 a
16217 <nowiki>*</nowiki>b
16218 !! result
16219 <p>a
16220 *b
16221 </p>
16222 !!end
16223
16224 #### --------------- HRs ---------------
16225 #### 1. Single line
16226 #### -----------------------------------
16227
16228 !! test
16229 HRs: 1. Single line
16230 !! options
16231 parsoid
16232 !! input
16233 ----<nowiki>----</nowiki>
16234 ----=foo=
16235 ----*foo
16236 !! result
16237 <hr><span typeof="mw:Nowiki">----</span>
16238 <hr>=foo=
16239 <hr>*foo
16240 !! end
16241
16242 #### --------------- Tables ---------------
16243 #### 1a. Simple example
16244 #### 1b. No escaping needed (!foo)
16245 #### 1c. No escaping needed (|foo)
16246 #### 1d. No escaping needed (|}foo)
16247 ####
16248 #### 2a. Nested in td (<td>foo|bar</td>)
16249 #### 2b. Nested in td (<td>foo||bar</td>)
16250 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16251 ####
16252 #### 3a. Nested in th (<th>foo!bar</th>)
16253 #### 3b. Nested in th (<th>foo!!bar</th>)
16254 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16255 ####
16256 #### 4a. Escape -
16257 #### 4b. Escape +
16258 #### 4c. No escaping needed
16259 #### --------------------------------------
16260
16261 !! test
16262 Tables: 1a. Simple example
16263 !! input
16264 <nowiki>{|
16265 |}</nowiki>
16266 !! result
16267 <p>{|
16268 |}
16269 </p>
16270 !! end
16271
16272 !! test
16273 Tables: 1b. No escaping needed
16274 !! input
16275 !foo
16276 !! result
16277 <p>!foo
16278 </p>
16279 !! end
16280
16281 !! test
16282 Tables: 1c. No escaping needed
16283 !! input
16284 |foo
16285 !! result
16286 <p>|foo
16287 </p>
16288 !! end
16289
16290 !! test
16291 Tables: 1d. No escaping needed
16292 !! input
16293 |}foo
16294 !! result
16295 <p>|}foo
16296 </p>
16297 !! end
16298
16299 !! test
16300 Tables: 2a. Nested in td
16301 !! options
16302 parsoid
16303 !! input
16304 {|
16305 |<nowiki>foo|bar</nowiki>
16306 |}
16307 !! result
16308 <table><tbody><tr>
16309 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16310 !! end
16311
16312 !! test
16313 Tables: 2b. Nested in td
16314 !! options
16315 parsoid
16316 !! input
16317 {|
16318 |<nowiki>foo||bar</nowiki>
16319 |''it''<nowiki>foo||bar</nowiki>
16320 |}
16321 !! result
16322 <table><tbody><tr>
16323 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16324 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16325 !! end
16326
16327 !! test
16328 Tables: 2c. Nested in td -- no escaping needed
16329 !! options
16330 parsoid
16331 !! input
16332 {|
16333 |foo!!bar
16334 |}
16335 !! result
16336 <table><tbody><tr><td>foo!!bar
16337 </td></tr></tbody></table>
16338
16339 !! end
16340
16341 !! test
16342 Tables: 3a. Nested in th
16343 !! options
16344 parsoid
16345 !! input
16346 {|
16347 !foo!bar
16348 |}
16349 !! result
16350 <table><tbody><tr><th>foo!bar
16351 </th></tr></tbody></table>
16352
16353 !! end
16354
16355 !! test
16356 Tables: 3b. Nested in th
16357 !! options
16358 parsoid
16359 !! input
16360 {|
16361 !<nowiki>foo!!bar</nowiki>
16362 |}
16363 !! result
16364 <table>
16365 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16366 </tbody></table>
16367 !! end
16368
16369 !! test
16370 Tables: 3c. Nested in th -- no escaping needed
16371 !! options
16372 parsoid
16373 !! input
16374 {|
16375 !<nowiki>foo||bar</nowiki>
16376 |}
16377 !! result
16378 <table><tbody><tr>
16379 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16380 !! end
16381
16382 !! test
16383 Tables: 4a. Escape -
16384 !! options
16385 parsoid
16386 !! input
16387 {|
16388 |-
16389 !-bar
16390 |-
16391 |<nowiki>-bar</nowiki>
16392 |}
16393 !! result
16394 <table><tbody>
16395 <tr><th>-bar</th></tr>
16396 <tr>
16397 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16398 !! end
16399
16400 !! test
16401 Tables: 4b. Escape +
16402 !! options
16403 parsoid
16404 !! input
16405 {|
16406 |-
16407 !+bar
16408 |-
16409 |<nowiki>+bar</nowiki>
16410 |}
16411 !! result
16412 <table><tbody>
16413 <tr><th>+bar</th></tr>
16414 <tr>
16415 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16416 !! end
16417
16418 !! test
16419 Tables: 4c. No escaping needed
16420 !! options
16421 parsoid
16422 !! input
16423 {|
16424 |-
16425 |foo-bar
16426 |foo+bar
16427 |-
16428 |''foo''-bar
16429 |''foo''+bar
16430 |-
16431 |foo
16432 bar|baz
16433 +bar
16434 -bar
16435 |}
16436 !! result
16437 <table><tbody>
16438 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16439 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16440 <tr><td>foo
16441 <p>bar|baz
16442 +bar
16443 -bar</p></td></tr>
16444 </tbody></table>
16445 !! end
16446
16447 ### SSS FIXME: Disabled right now because accurate html2wt
16448 ### on this snippet requires data-parsoid flags that we've
16449 ### stripped out of these tests. We should scheme how we
16450 ### we want to handle these kind of tests that require
16451 ### data-parsoid flags for accurate html2wt serialization
16452
16453 !! test
16454 Tables: 4d. No escaping needed
16455 !! options
16456 disabled
16457 !! input
16458 {|
16459 ||+1
16460 ||-2
16461 |}
16462 !! result
16463 <table>
16464 <tr>
16465 <td>+1
16466 </td>
16467 <td>-2
16468 </td></tr></table>
16469
16470 !! end
16471
16472 #### --------------- Links ----------------
16473 #### 1. Quote marks in link text
16474 #### 2. Wikilinks: Escapes needed
16475 #### 3. Wikilinks: No escapes needed
16476 #### 4. Extlinks: Escapes needed
16477 #### 5. Extlinks: No escapes needed
16478 #### --------------------------------------
16479 !! test
16480 Links 1. Quote marks in link text
16481 !! options
16482 parsoid
16483 !! input
16484 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16485 !! result
16486 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16487 !! end
16488
16489 !! test
16490 Links 2. WikiLinks: Escapes needed
16491 !! options
16492 parsoid
16493 !! input
16494 [[Foo|<nowiki>[Foobar]</nowiki>]]
16495 [[Foo|<nowiki>Foobar]</nowiki>]]
16496 [[Foo|x [Foobar] x]]
16497 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16498 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16499 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16500 [[Foo|<nowiki>|Bar</nowiki>]]
16501 [[Foo|<nowiki>]]bar</nowiki>]]
16502 [[Foo|<nowiki>[[bar</nowiki>]]
16503 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16504 !! result
16505 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16506 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16507 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16508 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16509 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16510 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16511 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16512 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16513 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16514 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16515 !! end
16516
16517 !! test
16518 Links 3. WikiLinks: No escapes needed
16519 !! options
16520 parsoid
16521 !! input
16522 [[Foo|[Foobar]]
16523 [[Foo|foo|bar]]
16524 !! result
16525 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16526 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16527 !! end
16528
16529 !! test
16530 Links 4. ExtLinks: Escapes needed
16531 !! options
16532 parsoid
16533 !! input
16534 [http://google.com <nowiki>[google]</nowiki>]
16535 [http://google.com <nowiki>google]</nowiki>]
16536 !! result
16537 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16538 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16539 !! end
16540
16541 !! test
16542 Links 5. ExtLinks: No escapes needed
16543 !! options
16544 parsoid
16545 !! input
16546 [http://google.com [google]
16547 !! result
16548 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16549 !! end
16550
16551 #### --------------- Quotes ---------------
16552 #### 1. Quotes inside <b> and <i>
16553 #### 2. Link fragments separated by <i> and <b> tags
16554 #### 3. Link fragments inside <i> and <b>
16555 #### 4. No escaping needed
16556 #### --------------------------------------
16557 !! test
16558 1. Quotes inside <b> and <i>
16559 !! options
16560 parsoid=html2wt,wt2wt
16561 !! input
16562 ''<nowiki>'foo'</nowiki>''
16563 ''<nowiki>''foo''</nowiki>''
16564 ''<nowiki>'''foo'''</nowiki>''
16565 ''foo''<nowiki/>'s
16566 '''<nowiki>'foo'</nowiki>'''
16567 '''<nowiki>''foo''</nowiki>'''
16568 '''<nowiki>'''foo'''</nowiki>'''
16569 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16570 '''foo'''<nowiki/>'s
16571 '''foo''
16572 ''foo''<nowiki/>'
16573 '<nowiki/>''foo''<nowiki/>'
16574 ''''foo'''
16575 '''foo'''<nowiki/>'
16576 '<nowiki/>'''foo'''<nowiki/>'
16577 !! result
16578 <p><i>'foo'</i>
16579 <i>''foo''</i>
16580 <i>'''foo'''</i>
16581 <i>foo</i>'s
16582 <b>'foo'</b>
16583 <b>''foo''</b>
16584 <b>'''foo'''</b>
16585 <b>foo'<i>bar'</i>baz</b>
16586 <b>foo</b>'s
16587 '<i>foo</i>
16588 <i>foo</i>'
16589 '<i>foo</i>'
16590 '<b>foo</b>
16591 <b>foo</b>'
16592 '<b>foo</b>'</p>
16593 !! end
16594
16595 !! test
16596 2. Link fragments separated by <i> and <b> tags
16597 !! input
16598 [[''foo''<nowiki>hello]]</nowiki>
16599
16600 [['''foo'''<nowiki>hello]]</nowiki>
16601 !! result
16602 <p>[[<i>foo</i>hello]]
16603 </p><p>[[<b>foo</b>hello]]
16604 </p>
16605 !! end
16606
16607 !! test
16608 3. Link fragments inside <i> and <b>
16609 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16610 this is one of the shortcomings of this format)
16611 !! input
16612 ''[[foo''<nowiki>]]</nowiki>
16613
16614 '''[[foo'''<nowiki>]]</nowiki>
16615 !! result
16616 <p><i>[[foo</i>]]
16617 </p><p><b>[[foo</b>]]
16618 </p>
16619 !! end
16620
16621 !! test
16622 4. No escaping needed
16623 !! input
16624 '<span>''bar''</span>'
16625 '<span>'''bar'''</span>'
16626 !! result
16627 <p>'<span><i>bar</i></span>'
16628 '<span><b>bar</b></span>'
16629 </p>
16630 !! end
16631
16632 #### ----------- Paragraphs ---------------
16633 #### 1. No unnecessary escapes
16634 #### --------------------------------------
16635
16636 !! test
16637 1. No unnecessary escapes
16638 !! input
16639 bar <span><nowiki>[[foo]]</nowiki></span>
16640
16641 =bar <span><nowiki>[[foo]]</nowiki></span>
16642
16643 [[bar <span><nowiki>[[foo]]</nowiki></span>
16644
16645 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16646
16647 =bar <span>foo]]</span><nowiki>=</nowiki>
16648 !! result
16649 <p>bar <span>[[foo]]</span>
16650 </p><p>=bar <span>[[foo]]</span>
16651 </p><p>[[bar <span>[[foo]]</span>
16652 </p><p>]]bar <span>[[foo]]</span>
16653 </p><p>=bar <span>foo]]</span>=
16654 </p>
16655 !!end
16656
16657 #### ----------------------- PRE --------------------------
16658 #### 1. Leading whitespace in SOL context should be escaped
16659 #### ------------------------------------------------------
16660 !! test
16661 1. Leading whitespace in SOL context should be escaped
16662 !! options
16663 parsoid
16664 !! input
16665 <nowiki> </nowiki>a
16666
16667 <nowiki> </nowiki> a
16668
16669 <nowiki> </nowiki>a(tab)
16670
16671 <nowiki> </nowiki> a
16672 <!--cmt-->
16673 <nowiki> </nowiki> a
16674
16675 a
16676 <nowiki> </nowiki>b
16677
16678 a
16679 <nowiki> </nowiki>b
16680
16681 a
16682 <nowiki> </nowiki> b
16683 !! result
16684 <p> a</p>
16685 <p> a</p>
16686 <p> a(tab)</p>
16687 <p> a</p>
16688 <p><!--cmt--> a</p>
16689 <p>a
16690 b</p>
16691 <p>a
16692 b</p>
16693 <p>a
16694 b</p>
16695 !! end
16696
16697 #### --------------- HTML tags ---------------
16698 #### 1. a tags
16699 #### 2. other tags
16700 #### 3. multi-line html tag
16701 #### -----------------------------------------
16702 !! test
16703 1. a tags
16704 !! options
16705 parsoid
16706 !! input
16707 <a href="http://google.com">google</a>
16708 !! result
16709 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16710 !! end
16711
16712 !! test
16713 2. other tags
16714 !! input
16715 <nowiki><div>foo</div>
16716 <div style="color:red">foo</div></nowiki>
16717 !! result
16718 <p>&lt;div&gt;foo&lt;/div&gt;
16719 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16720 </p>
16721 !! end
16722
16723 !! test
16724 3. multi-line html tag
16725 !! input
16726 <nowiki><div
16727 >foo</div
16728 ></nowiki>
16729 !! result
16730 <p>&lt;div
16731 &gt;foo&lt;/div
16732 &gt;
16733 </p>
16734 !! end
16735
16736 !! test
16737 4. extension tags
16738 !! input
16739 <nowiki><ref>foo</ref></nowiki>
16740 !! result
16741 <p>&lt;ref&gt;foo&lt;/ref&gt;
16742 </p>
16743 !! end
16744
16745 #### --------------- Others ---------------
16746 !! test
16747 Escaping nowikis
16748 !! input
16749 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16750 !! result
16751 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16752 </p>
16753 !! end
16754
16755 ## The quote-char in the input is necessary for triggering the bug
16756 !! test
16757 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16758 !! options
16759 parsoid=wt2wt,html2wt
16760 !! input
16761 foo's bar :
16762 !! result
16763 <p>foo's bar :</p>
16764 !! end
16765
16766 !! test
16767
16768 Tag-like HTML structures are passed through as text
16769 !! input
16770 <x y>
16771
16772 <x.y>
16773
16774 <x-y>
16775
16776 1>2
16777
16778 x<y
16779
16780 a>b
16781
16782 1<d e>f
16783 !! result
16784 <p>&lt;x y&gt;
16785 </p><p>&lt;x.y&gt;
16786 </p><p>&lt;x-y&gt;
16787 </p><p>1&gt;2
16788 </p><p>x&lt;y
16789 </p><p>a&gt;b
16790 </p><p>1&lt;d e&gt;f
16791 </p>
16792 !! end
16793
16794
16795 # This was a bug in the PHP parser (see bug 17663 and its dups,
16796 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16797 !! test
16798 Tag names followed by punctuation should not be recognized as tags
16799 !! input
16800 <s.ome> text
16801 !! result
16802 <p>&lt;s.ome&gt; text
16803 </p>
16804 !! end
16805
16806 !! test
16807 HTML tag with necessary entities in attributes
16808 !! input
16809 <span title="&amp;amp;">foo</span>
16810 !! result
16811 <p><span title="&amp;amp;">foo</span>
16812 </p>
16813 !! end
16814
16815 !! test
16816 HTML tag with 'unnecessary' entity encoding in attributes
16817 !! input
16818 <span title="&amp;">foo</span>
16819 !! result
16820 <p><span title="&amp;">foo</span>
16821 </p>
16822 !! end
16823
16824 !! test
16825 HTML tag with broken attribute value quoting
16826 !! input
16827 <span title="Hello world>Foo</span>
16828 !! result
16829 <p><span>Foo</span>
16830 </p>
16831 !! end
16832
16833 !! test
16834 Parsoid-only: HTML tag with broken attribute value quoting
16835 !! options
16836 parsoid
16837 !! input
16838 <span title="Hello world>Foo</span>
16839 !! result
16840 <p><span title="Hello world">Foo</span>
16841 </p>
16842 !! end
16843
16844 !! test
16845 Table with broken attribute value quoting
16846 !! input
16847 {|
16848 | title="Hello world|Foo
16849 |}
16850 !! result
16851 <table>
16852 <tr>
16853 <td>Foo
16854 </td></tr></table>
16855
16856 !! end
16857
16858 !! test
16859 Table with broken attribute value quoting on consecutive lines
16860 !! input
16861 {|
16862 | title="Hello world|Foo
16863 | style="color:red|Bar
16864 |}
16865 !! result
16866 <table>
16867 <tr>
16868 <td>Foo
16869 </td>
16870 <td>Bar
16871 </td></tr></table>
16872
16873 !! end
16874
16875 !! test
16876 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16877 !! options
16878 parsoid
16879 !! input
16880 {|
16881 | title="Hello world|Foo
16882 | style="color:red|Bar
16883 |}
16884 !! result
16885 <table><tbody>
16886 <tr>
16887 <td title="Hello world">Foo
16888 </td><td style="color: red">Bar
16889 </td></tr></tbody></table>
16890
16891 !! end
16892
16893 !! test
16894 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16895 !! options
16896 parsoid
16897 !! input
16898 {{}}
16899 !! result
16900 {{}}
16901 !! end
16902
16903 !! test
16904 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16905 !! options
16906 parsoid
16907 !! input
16908 }}{{
16909 !! result
16910 }}{{
16911 !! end
16912
16913 !!test
16914 Accept empty td cell attribute
16915 !!input
16916 {|
16917 | align="center" | foo || |
16918 |}
16919 !!result
16920 <table>
16921 <tr>
16922 <td align="center"> foo </td>
16923 <td>
16924 </td></tr></table>
16925
16926 !!end
16927
16928 !!test
16929 Non-empty attributes in th-cells
16930 !!input
16931 {|
16932 ! Foo !! style="color: red" | Bar
16933 |}
16934 !!result
16935 <table>
16936 <tr>
16937 <th> Foo </th>
16938 <th style="color: red"> Bar
16939 </th></tr></table>
16940
16941 !!end
16942
16943 !!test
16944 Accept empty attributes in th-cells
16945 !!input
16946 {|
16947 !| foo !!| bar
16948 |}
16949 !!result
16950 <table>
16951 <tr>
16952 <th> foo </th>
16953 <th> bar
16954 </th></tr></table>
16955
16956 !!end
16957
16958 !!test
16959 Empty table rows go away
16960 !!input
16961 {|
16962 | Hello
16963 | there
16964 |- class="foo"
16965 |-
16966 |}
16967 !! result
16968 <table>
16969 <tr>
16970 <td> Hello
16971 </td>
16972 <td> there
16973 </td></tr>
16974
16975 </table>
16976
16977 !! end
16978
16979 ###
16980 ### Parsoid-centric tests for testing RTing of inter-element separators
16981 ### Edge cases not tested by existing parser tests and specific to
16982 ### Parsoid-specific serialization strategies.
16983 ###
16984
16985 !!test
16986 RT-ed inter-element separators should be valid separators
16987 !!input
16988 {|
16989 |- [[foo]]
16990 |}
16991 !!result
16992 <table>
16993
16994 </table>
16995
16996 !!end
16997
16998 !!test
16999 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17000 (Parsoid-only since PHP parser relies on Tidy for correct output)
17001 !!options
17002 parsoid
17003 !!input
17004 {|
17005 |<small>foo
17006 bar
17007 |}
17008
17009 {|
17010 |<small>foo<small>
17011 |}
17012 !!result
17013 !!end
17014
17015 !!test
17016 Empty TD followed by TD with tpl-generated attribute
17017 !!input
17018 {|
17019 |-
17020 |
17021 |{{echo|style='color:red'}}|foo
17022 |}
17023 !!result
17024 <table>
17025
17026 <tr>
17027 <td>
17028 </td>
17029 <td>foo
17030 </td></tr></table>
17031
17032 !!end
17033
17034 !!test
17035 Indented table with an empty td
17036 !!input
17037 {|
17038 |-
17039 |
17040 |foo
17041 |}
17042 !!result
17043 <table>
17044
17045 <tr>
17046 <td>
17047 </td>
17048 <td>foo
17049 </td></tr></table>
17050
17051 !!end
17052
17053 !!test
17054 Empty TR followed by a template-generated TR
17055 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17056 !!options
17057 parsoid=wt2html,wt2wt
17058 !!input
17059 {|
17060 |-
17061 {{echo|<tr><td>foo</td></tr>}}
17062 |}
17063 !!result
17064 <table>
17065 <tbody>
17066 <tr></tr>
17067 <tr typeof="mw:Transclusion">
17068 <td>foo</td></tr></tbody></table>
17069 !!end
17070
17071 ## PHP and parsoid output differ for this, and since this is primarily
17072 ## for testing Parsoid's serializer, marking this Parsoid only
17073 !!test
17074 Empty TR followed by mixed-ws-comment line should RT correctly
17075 !!options
17076 parsoid
17077 !!input
17078 {|
17079 |-
17080 <!--c-->
17081 |-
17082 <!--c--> <!--d-->
17083 |}
17084 !!result
17085 <table>
17086 <tbody>
17087 <tr>
17088 <td> <!--c--></td></tr>
17089 <tr>
17090 <td><!--c--> <!--d--></td></tr>
17091 </tbody></table>
17092
17093 !!end
17094
17095 !!test
17096 Multi-line image caption generated by templates with/without trailing newlines
17097 !!options
17098 parsoid
17099 !!input
17100 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17101 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17102 !!result
17103 <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>
17104 <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>
17105
17106 !!end
17107
17108 ## PHP emits broken html for this, and since this is primarily
17109 ## a Parsoid serializer test, marking this Parsoid only
17110 !!test
17111 Improperly nested inline or quotes tags with whitespace in between
17112 !!options
17113 parsoid
17114 !!input
17115 <span> <s>x</span> </s>
17116 ''' ''x''' ''
17117 !!result
17118 <p><span> <s>x</s></span><s> </s>
17119 <b> <i>x</i></b><i> </i>
17120 </p>
17121 !!end
17122
17123 !!test
17124 Encapsulate protected attributes from wt
17125 !!options
17126 parsoid
17127 !!input
17128 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17129 !!result
17130 <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>
17131 </body>
17132 !!end
17133
17134 # -----------------------------------------------------------------
17135 # The following section of tests are primarily to spec requirements
17136 # around serialization of new/edited content.
17137 #
17138 # All these tests are marked Parsoid html2wt and html2html only
17139 # ----------------------------------------------------------------
17140
17141 !! test
17142 Image: Modifying size of an image
17143 !! options
17144 parsoid=html2wt
17145 !! input
17146 [[Image:Wiki.png|230x230px]]
17147 !! result
17148 <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>
17149 !!end
17150
17151 !! test
17152 Image: New block level image should have \n before and after
17153 !! options
17154 parsoid=html2wt
17155 !! input
17156 123
17157 [[File:Wiki.png|right|thumb|150x150px]]
17158 456
17159 !! result
17160 <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>
17161 !!end
17162
17163 # Wacky -- the leading newline in input is required because
17164 # that is what the serializer emits. To be fixed. Not fixing
17165 # the test because this test is required to test serialization of
17166 # new content and preferred whitespace style.
17167 !! test
17168 Lists: Add space after bullets
17169 !! options
17170 parsoid=html2wt
17171 !! input
17172
17173 * foo
17174 * bar
17175 * <span> baz</span>
17176 !! result
17177 <ul>
17178 <li>foo</li>
17179 <li> bar</li>
17180 <li><span> baz</span></li>
17181 </ul>
17182 !! end
17183
17184 !! test
17185 Parsoid: Serialize positional parameters with = in them as named parameter
17186 !! options
17187 parsoid=html2wt
17188 !! input
17189 {{echo|1 = f=oo}}
17190 !! result
17191 <p about="#mwt1" typeof="mw:Transclusion"
17192 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17193 >foo</p>
17194 !! end
17195
17196 # -----------------------------------------------------------------
17197 # End of section for Parsoid-only html2wt tests for serialization
17198 # of new content
17199 # -----------------------------------------------------------------
17200
17201 TODO:
17202 more images
17203 more tables
17204 character entities
17205 and much more
17206 Try for 100% code coverage