Sync up with Parsoid parserTests.
[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 Ident preformatting with inline content
1315 !! input
1316 a
1317 ''b''
1318 !! result
1319 <pre>a
1320 <i>b</i>
1321 </pre>
1322 !! end
1323
1324 !! test
1325 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1326 !! input
1327 <pre><nowiki>
1328 <b>
1329 <cite>
1330 <em>
1331 </nowiki></pre>
1332 !! result
1333 <pre>
1334 &lt;b&gt;
1335 &lt;cite&gt;
1336 &lt;em&gt;
1337 </pre>
1338
1339 !! end
1340
1341 !! test
1342 Regression with preformatted in <center>
1343 !! input
1344 <center>
1345 Blah
1346 </center>
1347 !! result
1348 <center>
1349 <pre>Blah
1350 </pre>
1351 </center>
1352
1353 !! end
1354
1355 !! test
1356 Bug 6200: Preformatted in <blockquote>
1357 !! input
1358 <blockquote>
1359 Blah
1360 </blockquote>
1361 !! result
1362 <blockquote>
1363 <pre>Blah
1364 </pre>
1365 </blockquote>
1366
1367 !! end
1368
1369 !! test
1370 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1371 !! input
1372 <blockquote>
1373 Foo
1374
1375 Bar
1376 </blockquote>
1377 !! result
1378 <blockquote>
1379 <p>Foo
1380 </p><p>Bar
1381 </p>
1382 </blockquote>
1383
1384 !! end
1385
1386 !! test
1387 Bug 15491: <ins>/<del> in blockquote
1388 !! input
1389 <blockquote>
1390 Foo <del>bar</del> <ins>baz</ins> quux
1391 </blockquote>
1392 !! result
1393 <blockquote>
1394 <p>Foo <del>bar</del> <ins>baz</ins> quux
1395 </p>
1396 </blockquote>
1397
1398 !! end
1399
1400 # Note that the p-wrapping is newline sensitive, which could be
1401 # considered a bug: tidy will wrap only the 'Foo' in the example
1402 # below in a <p> tag. (see comment 23-25 of bug #6200)
1403 !! test
1404 Bug 15491: <ins>/<del> in blockquote (2)
1405 !! input
1406 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1407 </blockquote>
1408 !! result
1409 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1410 </blockquote>
1411
1412 !! end
1413
1414 !! test
1415 <pre> with attributes (bug 3202)
1416 !! input
1417 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1418 !! result
1419 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1420
1421 !! end
1422
1423 !! test
1424 <pre> with width attribute (bug 3202)
1425 !! input
1426 <pre width="8">Narrow screen goodies</pre>
1427 !! result
1428 <pre width="8">Narrow screen goodies</pre>
1429
1430 !! end
1431
1432 !! test
1433 <pre> with forbidden attribute (bug 3202)
1434 !! input
1435 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1436 !! result
1437 <pre width="8">Narrow screen goodies</pre>
1438
1439 !! end
1440
1441 !! test
1442 Entities inside <pre>
1443 !! input
1444 <pre>&lt;</pre>
1445 !! result
1446 <pre>&lt;</pre>
1447
1448 !! end
1449
1450 !! test
1451 <pre> with forbidden attribute values (bug 3202)
1452 !! input
1453 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1454 !! result
1455 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1456
1457 !! end
1458
1459 !! test
1460 <nowiki> inside <pre> (bug 13238)
1461 !! input
1462 <pre>
1463 <nowiki>
1464 </pre>
1465 <pre>
1466 <nowiki></nowiki>
1467 </pre>
1468 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1469 !! result
1470 <pre>
1471 &lt;nowiki&gt;
1472 </pre>
1473 <pre>
1474
1475 </pre>
1476 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1477
1478 !! end
1479
1480 !! test
1481 <nowiki> and <pre> preference (first one wins)
1482 !! input
1483 <pre>
1484 <nowiki>
1485 </pre>
1486 </nowiki>
1487 </pre>
1488
1489 <nowiki>
1490 <pre>
1491 <nowiki>
1492 </pre>
1493 </nowiki>
1494 </pre>
1495
1496 !! result
1497 <pre>
1498 &lt;nowiki&gt;
1499 </pre>
1500 <p>&lt;/nowiki&gt;
1501 &lt;/pre&gt;
1502 </p><p>
1503 &lt;pre&gt;
1504 &lt;nowiki&gt;
1505 &lt;/pre&gt;
1506
1507 &lt;/pre&gt;
1508 </p>
1509 !! end
1510
1511 !! test
1512 </pre> inside nowiki
1513 !! input
1514 <nowiki></pre></nowiki>
1515 !! result
1516 <p>&lt;/pre&gt;
1517 </p>
1518 !! end
1519
1520 !!test
1521 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1522 !!input
1523 {{echo|}}
1524 !!result
1525
1526 !!end
1527
1528 !!test
1529 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1530 !!input
1531 {{echo|
1532 foo}}
1533 !!result
1534 <p>foo
1535 </p>
1536 !!end
1537
1538 !! test
1539 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1540 !! input
1541 {{echo|a
1542 b}}
1543 !!result
1544 <pre>a
1545 </pre>
1546 <p>b
1547 </p>
1548 !!end
1549
1550 !! test
1551 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1552 !! input
1553 {{echo|a
1554 b
1555 c
1556 d
1557 e
1558 }}
1559 !!result
1560 <pre>a
1561 </pre>
1562 <p>b
1563 c
1564 </p>
1565 <pre>d
1566 </pre>
1567 <p>e
1568 </p>
1569 !!end
1570
1571 !!test
1572 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1573 !!input
1574 {{echo| foo}}
1575
1576 {{echo| foo}}{{echo| bar}}
1577
1578 {{echo| foo}}
1579 {{echo| bar}}
1580
1581 {{echo|<!--cmt--> foo}}
1582
1583 <!--cmt-->{{echo| foo}}
1584
1585 {{echo|{{echo| }}bar}}
1586 !!result
1587 <pre>foo
1588 </pre>
1589 <pre>foo bar
1590 </pre>
1591 <pre>foo
1592 bar
1593 </pre>
1594 <pre>foo
1595 </pre>
1596 <pre>foo
1597 </pre>
1598 <pre>bar
1599 </pre>
1600 !!end
1601
1602 !! test
1603 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1604 !! input
1605 {{echo| }}a
1606
1607 {{echo|
1608 }}a
1609
1610 {{echo|
1611 b}}
1612
1613 {{echo|a
1614 }}b
1615
1616 {{echo|a
1617 }} b
1618 !!result
1619 <pre>a
1620 </pre>
1621 <p><br />
1622 </p>
1623 <pre>a
1624 </pre>
1625 <p><br />
1626 </p>
1627 <pre>b
1628 </pre>
1629 <p>a
1630 </p>
1631 <pre>b
1632 </pre>
1633 <p>a
1634 </p>
1635 <pre>b
1636 </pre>
1637 !!end
1638
1639 !! test
1640 Templates: Single-line variant of parameter whitespace stripping test
1641 !! input
1642 {{echo| a}}
1643
1644 {{echo|1= a}}
1645
1646 {{echo|{{echo| a}}}}
1647
1648 {{echo|1={{echo| a}}}}
1649 !! result
1650 <pre>a
1651 </pre>
1652 <p>a
1653 </p>
1654 <pre>a
1655 </pre>
1656 <p>a
1657 </p>
1658 !! end
1659
1660 !! test
1661 Templates: Strip whitespace from named parameters, but not positional ones
1662 !! input
1663 {{echo|
1664 foo}}
1665
1666 {{echo|
1667 * foo}}
1668
1669 {{echo| 1 =
1670 foo}}
1671
1672 {{echo| 1 =
1673 * foo}}
1674 !! result
1675 <pre>foo
1676 </pre>
1677 <p><br />
1678 </p>
1679 <ul><li> foo
1680 </li></ul>
1681 <p>foo
1682 </p>
1683 <ul><li> foo
1684 </li></ul>
1685
1686 !! end
1687
1688 !! test
1689 Templates: Dont strip whitespace from whitespace/comment-only arguments
1690 !! input
1691 {{echo| }}
1692 {{echo|<!--cmt-->}}
1693 {{echo| <!--cmt--> }}
1694 !! result
1695 <p><br />
1696 </p>
1697 !! end
1698
1699 !! test
1700 Templates: Parsoid parameter escaping test 1
1701 !! options
1702 parsoid
1703 !! input
1704 {{echo|[foo]|{{echo|[bar]}}}}
1705 !! result
1706 <p about="#mwt1" typeof="mw:Transclusion"
1707 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>
1708 !! end
1709
1710 !! test
1711 Parsoid: Pipes in external links in template parameter
1712 !! options
1713 parsoid
1714 !! input
1715 {{echo|[{{echo|http://example.com}} link]}}
1716 !! result
1717 <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>
1718 !! end
1719
1720 !! test
1721 Parsoid: pipe in transclusion parameter
1722 !! options
1723 parsoid
1724 !! input
1725 {{echo|http://foo.com/a&#124;b}}
1726 !! result
1727 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1728 typeof="mw:Transclusion"
1729 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>
1730 !! end
1731
1732 !! test
1733 Parsoid: Pipe in external link target and content in template parameter
1734 !! options
1735 parsoid=html2wt,wt2wt
1736 !! input
1737 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1738 !! result
1739 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1740 typeof="mw:Transclusion"
1741 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1742 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1743 !! end
1744
1745 !! test
1746 Templates: Dont escape already nowiki-escaped text in template parameters
1747 !! options
1748 parsoid=html2wt,wt2wt
1749 !! input
1750 {{echo|foo<nowiki>|</nowiki>bar}}
1751 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1752 {{echo|<nowiki></nowiki>}}
1753 !! result
1754 <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>
1755 <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>
1756 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1757 </p>
1758 !! end
1759
1760 ###
1761 ### Parsoid-centric tests for testing RT edge cases for pre
1762 ###
1763
1764 !!test
1765 1a. Indent-Pre and Comments
1766 !!input
1767 a
1768 <!--a-->
1769 c
1770 !!result
1771 <pre>a
1772 </pre>
1773 <p>c
1774 </p>
1775 !!end
1776
1777 !!test
1778 1b. Indent-Pre and Comments
1779 !!input
1780 a
1781 <!--a-->
1782 c
1783 !!result
1784 <pre>a
1785 </pre>
1786 <p>c
1787 </p>
1788 !!end
1789
1790 !!test
1791 1c. Indent-Pre and Comments
1792 !!input
1793 <!--a--> a
1794
1795 <!--a--> a
1796 !!result
1797 <pre> a
1798 </pre>
1799 <pre> a
1800 </pre>
1801 !!end
1802
1803 !!test
1804 1d. Indent-Pre and Comments
1805 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1806 !!input
1807 <!--a--> a
1808
1809 <!--b-->b
1810 !!result
1811 <pre>a
1812 </pre>
1813 <pre>b
1814 </pre>
1815 !!end
1816
1817 !!test
1818 2a. Indent-Pre and tables
1819 !!input
1820 {|
1821 |-
1822 !h1!!h2
1823 |foo||bar
1824 |}
1825 !!result
1826 <table>
1827
1828 <tr>
1829 <th>h1</th>
1830 <th>h2
1831 </th>
1832 <td>foo</td>
1833 <td>bar
1834 </td></tr></table>
1835
1836 !!end
1837
1838 !!test
1839 2b. Indent-Pre and tables
1840 !!input
1841 {|
1842 |-
1843 |foo
1844 |}
1845 !!result
1846 <table>
1847
1848 <tr>
1849 <td>foo
1850 </td></tr></table>
1851
1852 !!end
1853
1854 !!test
1855 2c. Indent-Pre and tables (bug 42252)
1856 !!input
1857 {|
1858 |+ foo
1859 ! | bar
1860 |}
1861 !!result
1862 <table>
1863 <caption> foo
1864 </caption>
1865 <tr>
1866 <th> bar
1867 </th></tr></table>
1868
1869 !!end
1870
1871 !!test
1872 3a. Indent-Pre and block tags (single-line html)
1873 !!input
1874 <p> foo </p>
1875 <div> foo </div>
1876 <span> foo </span>
1877 !!result
1878 <p> foo </p>
1879 <div> foo </div>
1880 <pre><span> foo </span>
1881 </pre>
1882 !!end
1883
1884 !!test
1885 3b. Indent-Pre and block tags (pre-content on separate line)
1886 !!input
1887 <p>
1888 foo
1889 </p>
1890
1891 <div>
1892 foo
1893 </div>
1894
1895 <center>
1896 foo
1897 </center>
1898
1899 <blockquote>
1900 foo
1901 </blockquote>
1902
1903 <table><tr><td>
1904 foo
1905 </td></tr></table>
1906
1907 <ul><li>
1908 foo
1909 </li></ul>
1910
1911 !!result
1912 <p>
1913 foo
1914 </p>
1915 <div>
1916 <pre>foo
1917 </pre>
1918 </div>
1919 <center>
1920 <pre>foo
1921 </pre>
1922 </center>
1923 <blockquote>
1924 <pre>foo
1925 </pre>
1926 </blockquote>
1927 <table><tr><td>
1928 <pre>foo
1929 </pre>
1930 </td></tr></table>
1931 <ul><li>
1932 foo
1933 </li></ul>
1934
1935 !!end
1936
1937 !!test
1938 4. Multiple spaces at start-of-line
1939 !!input
1940 <p> foo </p>
1941 foo
1942 {|
1943 |foo
1944 |}
1945 !!result
1946 <p> foo </p>
1947 <pre> foo
1948 </pre>
1949 <table>
1950 <tr>
1951 <td>foo
1952 </td></tr></table>
1953
1954 !!end
1955
1956 !! test
1957 5. White-space in indent-pre
1958 NOTE: the white-space char on 2nd line is significant
1959 !! input
1960 a<br/>
1961
1962 b
1963 !! result
1964 <pre>a<br />
1965
1966 b
1967 </pre>
1968 !! end
1969
1970 !! test
1971 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1972 !! input
1973 a
1974
1975 <!-- continue -->
1976 b
1977
1978 c
1979
1980 d
1981 !! result
1982 <pre>a
1983
1984 b
1985 </pre>
1986 <pre>c
1987
1988 </pre>
1989 <p>d
1990 </p>
1991 !! end
1992
1993 !! test
1994 7a. Indent-pre and category links
1995 !! options
1996 parsoid=wt2html,wt2wt
1997 !! input
1998 [[Category:foo]] <!-- No pre-wrapping -->
1999 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2000 !! result
2001 <span typeof="mw:Transclusion"> </span>
2002 !! end
2003
2004 !! test
2005 7b. Indent-pre and category links
2006 !! options
2007 parsoid=wt2html,wt2wt
2008 !! input
2009 [[Category:foo]] a
2010 [[Category:foo]] {{echo|b}}
2011 !! result
2012 <pre> a <span typeof="mw:Transclusion">b</span>
2013 </pre>
2014 !! end
2015
2016 ###
2017 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2018 ###
2019
2020 !!test
2021 HTML-pre: 1. embedded newlines
2022 !!input
2023 <pre>foo</pre>
2024
2025 <pre>
2026 foo
2027 </pre>
2028
2029 <pre>
2030
2031 foo
2032 </pre>
2033
2034 <pre>
2035
2036
2037 foo
2038 </pre>
2039 !!result
2040 <pre>foo</pre>
2041 <pre>
2042 foo
2043 </pre>
2044 <pre>
2045
2046 foo
2047 </pre>
2048 <pre>
2049
2050
2051 foo
2052 </pre>
2053
2054 !!end
2055
2056 !!test
2057 HTML-pre: 2: indented text
2058 !!input
2059 <pre>
2060 foo
2061 </pre>
2062 !!result
2063 <pre>
2064 foo
2065 </pre>
2066
2067 !!end
2068
2069 !!test
2070 HTML-pre: 3: other wikitext
2071 !!input
2072 <pre>
2073 * foo
2074 # bar
2075 = no-h =
2076 '' no-italic ''
2077 [[ NoLink ]]
2078 </pre>
2079 !!result
2080 <pre>
2081 * foo
2082 # bar
2083 = no-h =
2084 '' no-italic ''
2085 [[ NoLink ]]
2086 </pre>
2087
2088 !!end
2089
2090 ###
2091 ### Definition lists
2092 ###
2093 !! test
2094 Simple definition
2095 !! input
2096 ; name : Definition
2097 !! result
2098 <dl><dt> name&#160;</dt><dd> Definition
2099 </dd></dl>
2100
2101 !! end
2102
2103 !! test
2104 Definition list for indentation only
2105 !! input
2106 : Indented text
2107 !! result
2108 <dl><dd> Indented text
2109 </dd></dl>
2110
2111 !! end
2112
2113 !! test
2114 Definition list with no space
2115 !! input
2116 ;name:Definition
2117 !! result
2118 <dl><dt>name</dt><dd>Definition
2119 </dd></dl>
2120
2121 !!end
2122
2123 !! test
2124 Definition list with URL link
2125 !! input
2126 ; http://example.com/ : definition
2127 !! result
2128 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2129 </dd></dl>
2130
2131 !! end
2132
2133 !! test
2134 Definition list with bracketed URL link
2135 !! input
2136 ;[http://www.example.com/ Example]:Something about it
2137 !! result
2138 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2139 </dd></dl>
2140
2141 !! end
2142
2143 !! test
2144 Definition list with wikilink containing colon
2145 !! input
2146 ; [[Help:FAQ]]: The least-read page on Wikipedia
2147 !! result
2148 <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
2149 </dd></dl>
2150
2151 !! end
2152
2153 # At Brion's and JeLuF's insistence... :)
2154 !! test
2155 Definition list with news link containing colon
2156 !! input
2157 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2158 !! result
2159 <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!
2160 </dd></dl>
2161
2162 !! end
2163
2164 !! test
2165 Malformed definition list with colon
2166 !! input
2167 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2168 !! result
2169 <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
2170 </dt></dl>
2171
2172 !! end
2173
2174 !! test
2175 Definition lists: colon in external link text
2176 !! input
2177 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2178 !! result
2179 <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
2180 </dd></dl>
2181
2182 !! end
2183
2184 !! test
2185 Definition lists: colon in HTML attribute
2186 !! input
2187 ;<b style="display: inline">bold</b>
2188 !! result
2189 <dl><dt><b style="display: inline">bold</b>
2190 </dt></dl>
2191
2192 !! end
2193
2194 !! test
2195 Definition lists: self-closed tag
2196 !! input
2197 ;one<br/>two : two-line fun
2198 !! result
2199 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2200 </dd></dl>
2201
2202 !! end
2203
2204 !! test
2205 Bug 11748: Literal closing tags
2206 !! input
2207 <dl>
2208 <dt>test 1</dt>
2209 <dd>test test test test test</dd>
2210 <dt>test 2</dt>
2211 <dd>test test test test test</dd>
2212 </dl>
2213 !! result
2214 <dl>
2215 <dt>test 1</dt>
2216 <dd>test test test test test</dd>
2217 <dt>test 2</dt>
2218 <dd>test test test test test</dd>
2219 </dl>
2220
2221 !! end
2222
2223 !! test
2224 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2225 !! input
2226 <ul><li>
2227 ; term : description
2228 * unordered
2229 </li>
2230 </ul>
2231 !! result
2232 <ul><li>
2233 <dl><dt> term&#160;</dt><dd> description
2234 </dd></dl>
2235 <ul><li> unordered
2236 </li></ul>
2237 </li>
2238 </ul>
2239
2240 !! end
2241
2242 !! test
2243
2244 Definition list with empty definition and following paragraph
2245 !! input
2246 ; term:
2247 Paragraph text
2248 !! result
2249 <dl><dt> term</dt><dd>
2250 </dd></dl>
2251 <p>Paragraph text
2252 </p>
2253 !! end
2254
2255 !! test
2256 Nested definition lists using html syntax
2257 !! input
2258 <dl><dd>
2259 <dl>
2260 <dd>Foo</dd>
2261 </dl>
2262 </dd></dl>
2263 !! result
2264 <dl><dd>
2265 <dl>
2266 <dd>Foo</dd>
2267 </dl>
2268 </dd></dl>
2269
2270 !! end
2271
2272 !! test
2273 Definition Lists: No nesting: Multiple dd's
2274 !! input
2275 ;x
2276 :a
2277 :b
2278 !! result
2279 <dl><dt>x
2280 </dt><dd>a
2281 </dd><dd>b
2282 </dd></dl>
2283
2284 !! end
2285
2286 !! test
2287 Definition Lists: Indentation: Regular
2288 !! input
2289 :i1
2290 ::i2
2291 :::i3
2292 !! result
2293 <dl><dd>i1
2294 <dl><dd>i2
2295 <dl><dd>i3
2296 </dd></dl>
2297 </dd></dl>
2298 </dd></dl>
2299
2300 !! end
2301
2302 !! test
2303 Definition Lists: Indentation: Missing 1st level
2304 !! input
2305 ::i2
2306 :::i3
2307 !! result
2308 <dl><dd><dl><dd>i2
2309 <dl><dd>i3
2310 </dd></dl>
2311 </dd></dl>
2312 </dd></dl>
2313
2314 !! end
2315
2316 !! test
2317 Definition Lists: Indentation: Multi-level indent
2318 !! input
2319 :::i3
2320 !! result
2321 <dl><dd><dl><dd><dl><dd>i3
2322 </dd></dl>
2323 </dd></dl>
2324 </dd></dl>
2325
2326 !! end
2327
2328 !! test
2329 Definition Lists: Hacky use to indent tables
2330 !! input
2331 ::{|
2332 |foo
2333 |bar
2334 |}
2335 this text
2336 should be left alone
2337 !! result
2338 <dl><dd><dl><dd><table>
2339 <tr>
2340 <td>foo
2341 </td>
2342 <td>bar
2343 </td></tr></table></dd></dl></dd></dl>
2344 <p>this text
2345 should be left alone
2346 </p>
2347 !! end
2348 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2349 ## as an empty dt item. It also ignores all but the last ";" when followed
2350 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2351 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2352 ## ";"s.
2353 ##
2354 ## Ex: ";;t2 ::d2" is transformed into:
2355 ##
2356 ## <dl>
2357 ## <dt>t2 </dt>
2358 ## <dd>
2359 ## <dl>
2360 ## <dt></dt>
2361 ## <dd>d2</dd>
2362 ## </dl>
2363 ## </dd>
2364 ## </dl>
2365 ##
2366 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2367 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2368 ##
2369 ## <dl>
2370 ## <dt>
2371 ## <dl>
2372 ## <dt>t2 </dt>
2373 ## <dd>:d2</dd>
2374 ## </dl>
2375 ## </dt>
2376 ## </dl>
2377 ##
2378 ## All Parsoid only definition list tests have this difference.
2379 ##
2380 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2381 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2382
2383 !! test
2384 Table / list interaction: indented table with lists in table contents
2385 !! input
2386 :{|
2387 |-
2388 | a
2389 * b
2390 |-
2391 | c
2392 * d
2393 |}
2394 !! result
2395 <dl><dd><table>
2396
2397 <tr>
2398 <td> a
2399 <ul><li> b
2400 </li></ul>
2401 </td></tr>
2402 <tr>
2403 <td> c
2404 <ul><li> d
2405 </li></ul>
2406 </td></tr></table></dd></dl>
2407
2408 !! end
2409
2410 !!test
2411 Table / list interaction: lists nested in tables nested in indented lists
2412 !!input
2413 :{|
2414 |
2415 :a
2416 :b
2417 |
2418 *c
2419 *d
2420 |}
2421
2422 *e
2423 *f
2424 !!result
2425 <dl><dd><table>
2426 <tr>
2427 <td>
2428 <dl><dd>a
2429 </dd><dd>b
2430 </dd></dl>
2431 </td>
2432 <td>
2433 <ul><li>c
2434 </li><li>d
2435 </li></ul>
2436 </td></tr></table></dd></dl>
2437 <ul><li>e
2438 </li><li>f
2439 </li></ul>
2440
2441 !!end
2442
2443 !! test
2444 Definition Lists: Nesting: Multi-level (Parsoid only)
2445 !! options
2446 parsoid
2447 !! input
2448 ;t1 :d1
2449 ;;t2 ::d2
2450 ;;;t3 :::d3
2451 !! result
2452 <dl>
2453 <dt>t1 </dt>
2454 <dd>d1</dd>
2455 <dt>
2456 <dl>
2457 <dt>t2 </dt>
2458 <dd>:d2</dd>
2459 <dt>
2460 <dl>
2461 <dt>t3 </dt>
2462 <dd>::d3</dd>
2463 </dl>
2464 </dt>
2465 </dl>
2466 </dt>
2467 </dl>
2468
2469
2470 !! end
2471
2472
2473 !! test
2474 Definition Lists: Nesting: Test 2 (Parsoid only)
2475 !! options
2476 parsoid
2477 !! input
2478 ;t1
2479 ::d2
2480 !! result
2481 <dl>
2482 <dt>t1</dt>
2483 <dd>
2484 <dl>
2485 <dd>d2</dd>
2486 </dl>
2487 </dd>
2488 </dl>
2489
2490 !! end
2491
2492
2493 !! test
2494 Definition Lists: Nesting: Test 3 (Parsoid only)
2495 !! options
2496 parsoid
2497 !! input
2498 :;t1
2499 ::::d2
2500 !! result
2501 <dl>
2502 <dd>
2503 <dl>
2504 <dt>t1</dt>
2505 <dd>
2506 <dl>
2507 <dd>
2508 <dl>
2509 <dd>d2</dd>
2510 </dl>
2511 </dd>
2512 </dl>
2513 </dd>
2514 </dl>
2515 </dd>
2516 </dl>
2517
2518 !! end
2519
2520
2521 !! test
2522 Definition Lists: Nesting: Test 4
2523 !! input
2524 ::;t3
2525 :::d3
2526 !! result
2527 <dl><dd><dl><dd><dl><dt>t3
2528 </dt><dd>d3
2529 </dd></dl>
2530 </dd></dl>
2531 </dd></dl>
2532
2533 !! end
2534
2535
2536 ## The Parsoid team believes the following three test exposes a
2537 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2538 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2539 !! test
2540 Definition Lists: Mixed Lists: Test 1 (php)
2541 !! options
2542 php
2543 !! input
2544 :;* foo
2545 ::* bar
2546 :; baz
2547 !! result
2548 <dl><dd><dl><dt><ul><li> foo
2549 </li><li> bar
2550 </li></ul>
2551 </dt></dl>
2552 <dl><dt> baz
2553 </dt></dl>
2554 </dd></dl>
2555
2556 !! end
2557 !! test
2558 Definition Lists: Mixed Lists: Test 1 (parsoid)
2559 !! options
2560 parsoid
2561 !! input
2562 :;* foo
2563 ::* bar
2564 :; baz
2565 !! result
2566 <dl><dd><dl><dt><ul><li> foo
2567 </li></ul></dt><dd><ul><li> bar
2568 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2569 !! end
2570
2571 !! test
2572 Definition Lists: Mixed Lists: Test 2
2573 !! input
2574 *: d1
2575 *: d2
2576 !! result
2577 <ul><li><dl><dd> d1
2578 </dd><dd> d2
2579 </dd></dl>
2580 </li></ul>
2581
2582 !! end
2583
2584
2585 !! test
2586 Definition Lists: Mixed Lists: Test 3
2587 !! input
2588 *::: d1
2589 *::: d2
2590 !! result
2591 <ul><li><dl><dd><dl><dd><dl><dd> d1
2592 </dd><dd> d2
2593 </dd></dl>
2594 </dd></dl>
2595 </dd></dl>
2596 </li></ul>
2597
2598 !! end
2599
2600
2601 !! test
2602 Definition Lists: Mixed Lists: Test 4
2603 !! input
2604 *;d1 :d2
2605 *;d3 :d4
2606 !! result
2607 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2608 </dd><dt>d3&#160;</dt><dd>d4
2609 </dd></dl>
2610 </li></ul>
2611
2612 !! end
2613
2614
2615 !! test
2616 Definition Lists: Mixed Lists: Test 5
2617 !! input
2618 *:d1
2619 *:: d2
2620 !! result
2621 <ul><li><dl><dd>d1
2622 <dl><dd> d2
2623 </dd></dl>
2624 </dd></dl>
2625 </li></ul>
2626
2627 !! end
2628
2629
2630 !! test
2631 Definition Lists: Mixed Lists: Test 6
2632 !! input
2633 #*:d1
2634 #*::: d3
2635 !! result
2636 <ol><li><ul><li><dl><dd>d1
2637 <dl><dd><dl><dd> d3
2638 </dd></dl>
2639 </dd></dl>
2640 </dd></dl>
2641 </li></ul>
2642 </li></ol>
2643
2644 !! end
2645
2646
2647 !! test
2648 Definition Lists: Mixed Lists: Test 7
2649 !! input
2650 :* d1
2651 :* d2
2652 !! result
2653 <dl><dd><ul><li> d1
2654 </li><li> d2
2655 </li></ul>
2656 </dd></dl>
2657
2658 !! end
2659
2660
2661 !! test
2662 Definition Lists: Mixed Lists: Test 8
2663 !! input
2664 :* d1
2665 ::* d2
2666 !! result
2667 <dl><dd><ul><li> d1
2668 </li></ul>
2669 <dl><dd><ul><li> d2
2670 </li></ul>
2671 </dd></dl>
2672 </dd></dl>
2673
2674 !! end
2675
2676
2677 !! test
2678 Definition Lists: Mixed Lists: Test 9
2679 !! input
2680 *;foo :bar
2681 !! result
2682 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2683 </dd></dl>
2684 </li></ul>
2685
2686 !! end
2687
2688
2689 !! test
2690 Definition Lists: Mixed Lists: Test 10
2691 !! input
2692 *#;foo :bar
2693 !! result
2694 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2695 </dd></dl>
2696 </li></ol>
2697 </li></ul>
2698
2699 !! end
2700
2701 # The Parsoid team disagrees with the PHP parser's seemingly-random
2702 # rules regarding dd/dt on the next two tests. Parsoid is more
2703 # consistent, and recognizes the shared nesting and keeps the
2704 # still-open tags around until the nesting is complete.
2705
2706 !! test
2707 Definition Lists: Mixed Lists: Test 11 (php)
2708 !! options
2709 php
2710 !! input
2711 *#*#;*;;foo :bar
2712 *#*#;boo :baz
2713 !! result
2714 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2715 </dt></dl>
2716 </dd></dl>
2717 </li></ul>
2718 </dd></dl>
2719 <dl><dt>boo&#160;</dt><dd>baz
2720 </dd></dl>
2721 </li></ol>
2722 </li></ul>
2723 </li></ol>
2724 </li></ul>
2725
2726 !! end
2727 !! test
2728 Definition Lists: Mixed Lists: Test 11 (parsoid)
2729 !! options
2730 parsoid
2731 !! input
2732 *#*#;*;;foo :bar
2733 *#*#;boo :baz
2734 !! result
2735 <ul>
2736 <li>
2737 <ol>
2738 <li>
2739 <ul>
2740 <li>
2741 <ol>
2742 <li>
2743 <dl>
2744 <dt>
2745 <ul>
2746 <li>
2747 <dl>
2748 <dt>
2749 <dl>
2750 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2751 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2752 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2753 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2754 !! end
2755
2756
2757 !! test
2758 Definition Lists: Weird Ones: Test 1 (php)
2759 !! options
2760 php
2761 !! input
2762 *#;*::;; foo : bar (who uses this?)
2763 !! result
2764 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2765 </dt></dl>
2766 </dd></dl>
2767 </dd></dl>
2768 </dd></dl>
2769 </li></ul>
2770 </dd></dl>
2771 </li></ol>
2772 </li></ul>
2773
2774 !! end
2775 !! test
2776 Definition Lists: Weird Ones: Test 1 (parsoid)
2777 !! options
2778 parsoid
2779 !! input
2780 *#;*::;; foo : bar (who uses this?)
2781 !! result
2782 <ul>
2783 <li>
2784 <ol>
2785 <li>
2786 <dl>
2787 <dt>
2788 <ul>
2789 <li>
2790 <dl>
2791 <dd>
2792 <dl>
2793 <dd>
2794 <dl>
2795 <dt>
2796 <dl>
2797 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2798 <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>
2799 !! end
2800
2801 ###
2802 ### External links
2803 ###
2804 !! test
2805 External links: non-bracketed
2806 !! input
2807 Non-bracketed: http://example.com
2808 !! result
2809 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2810 </p>
2811 !! end
2812
2813 !! test
2814 External links: numbered
2815 !! input
2816 Numbered: [http://example.com]
2817 Numbered: [http://example.net]
2818 Numbered: [http://example.com]
2819 !! result
2820 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2821 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2822 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2823 </p>
2824 !!end
2825
2826 !! test
2827 External links: specified text
2828 !! input
2829 Specified text: [http://example.com link]
2830 !! result
2831 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2832 </p>
2833 !!end
2834
2835 !! test
2836 External links: trail
2837 !! input
2838 Linktrails should not work for external links: [http://example.com link]s
2839 !! result
2840 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: dollar sign in URL
2846 !! input
2847 http://example.com/1$2345
2848 !! result
2849 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2850 </p>
2851 !! end
2852
2853 !! test
2854 External links: dollar sign in URL (named)
2855 !! input
2856 [http://example.com/1$2345]
2857 !! result
2858 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2859 </p>
2860 !!end
2861
2862 !! test
2863 External links: open square bracket forbidden in URL (bug 4377)
2864 !! input
2865 http://example.com/1[2345
2866 !! result
2867 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2868 </p>
2869 !! end
2870
2871 !! test
2872 External links: open square bracket forbidden in URL (named) (bug 4377)
2873 !! input
2874 [http://example.com/1[2345]
2875 !! result
2876 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2877 </p>
2878 !!end
2879
2880 !! test
2881 External links: nowiki in URL link text (bug 6230)
2882 !!input
2883 [http://example.com/ <nowiki>''example site''</nowiki>]
2884 !! result
2885 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2886 </p>
2887 !! end
2888
2889 !! test
2890 External links: newline forbidden in text (bug 6230 regression check)
2891 !! input
2892 [http://example.com/ first
2893 second]
2894 !! result
2895 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2896 second]
2897 </p>
2898 !!end
2899
2900 !! test
2901 External links: Pipe char between url and text
2902 !! input
2903 [http://example.com | link]
2904 !! result
2905 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2906 </p>
2907 !!end
2908
2909 !! test
2910 External links: protocol-relative URL in brackets
2911 !! input
2912 [//example.com/ Test]
2913 !! result
2914 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2915 </p>
2916 !! end
2917
2918 !! test
2919 External links: protocol-relative URL in brackets without text
2920 !! input
2921 [//example.com]
2922 !! result
2923 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2924 </p>
2925 !! end
2926
2927 !! test
2928 External links: protocol-relative URL in free text is left alone
2929 !! input
2930 //example.com/Foo
2931 !! result
2932 <p>//example.com/Foo
2933 </p>
2934 !!end
2935
2936 !! test
2937 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2938 !! input
2939 foo//example.com/Foo
2940 !! result
2941 <p>foo//example.com/Foo
2942 </p>
2943 !! end
2944
2945 !! test
2946 External image
2947 !! input
2948 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2949 !! result
2950 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2951 </p>
2952 !! end
2953
2954 !! test
2955 External image from https
2956 !! input
2957 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2958 !! result
2959 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2960 </p>
2961 !! end
2962
2963 !! test
2964 External image (when not allowed)
2965 !! options
2966 wgAllowExternalImages=0
2967 !! input
2968 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2969 !! result
2970 <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>
2971 </p>
2972 !! end
2973
2974 !! test
2975 Link to non-http image, no img tag
2976 !! input
2977 Link to non-http image, no img tag: ftp://example.com/test.jpg
2978 !! result
2979 <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>
2980 </p>
2981 !! end
2982
2983 !! test
2984 External links: terminating separator
2985 !! input
2986 Terminating separator: http://example.com/thing,
2987 !! result
2988 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2989 </p>
2990 !! end
2991
2992 !! test
2993 External links: intervening separator
2994 !! input
2995 Intervening separator: http://example.com/1,2,3
2996 !! result
2997 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2998 </p>
2999 !! end
3000
3001 !! test
3002 External links: old bug with URL in query
3003 !! input
3004 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3005 !! result
3006 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3007 </p>
3008 !! end
3009
3010 !! test
3011 External links: old URL-in-URL bug, mixed protocols
3012 !! input
3013 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3014 !! result
3015 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3016 </p>
3017 !!end
3018
3019 !! test
3020 External links: URL in text
3021 !! input
3022 URL in text: [http://example.com http://example.com]
3023 !! result
3024 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3025 </p>
3026 !! end
3027
3028 !! test
3029 External links: Clickable images
3030 !! input
3031 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3032 !! result
3033 <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>
3034 </p>
3035 !!end
3036
3037 !! test
3038 External links: raw ampersand
3039 !! input
3040 Old &amp; use: http://x&y
3041 !! result
3042 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3043 </p>
3044 !! end
3045
3046 !! test
3047 External links: encoded ampersand
3048 !! input
3049 Old &amp; use: http://x&amp;y
3050 !! result
3051 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3052 </p>
3053 !! end
3054
3055 !! test
3056 External links: encoded equals (bug 6102)
3057 !! input
3058 http://example.com/?foo&#61;bar
3059 !! result
3060 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3061 </p>
3062 !! end
3063
3064 !! test
3065 External links: [raw ampersand]
3066 !! input
3067 Old &amp; use: [http://x&y]
3068 !! result
3069 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3070 </p>
3071 !! end
3072
3073 !! test
3074 External links: [encoded ampersand]
3075 !! input
3076 Old &amp; use: [http://x&amp;y]
3077 !! result
3078 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3079 </p>
3080 !! end
3081
3082 !! test
3083 External links: [encoded equals] (bug 6102)
3084 !! input
3085 [http://example.com/?foo&#61;bar]
3086 !! result
3087 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3088 </p>
3089 !! end
3090
3091 !! test
3092 External links: [IDN ignored character reference in hostname; strip it right off]
3093 !! input
3094 [http://e&zwnj;xample.com/]
3095 !! result
3096 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3097 </p>
3098 !! end
3099
3100 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3101 # Where an external link could easily circumvent the sanitization of the text of
3102 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3103 # test demands a higher standard. That's a bit strange.
3104 #
3105 # Example:
3106 #
3107 # http://e‌xample.com -> [http://example.com|http://example.com]
3108 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3109 #
3110 # The first example is sanitized, but the second is not. Any security benefits
3111 # from this production are trivial to circumvent. Either remove this test and
3112 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3113 # the test accordingly.
3114 #
3115 # All our love,
3116 # The Parsoid team.
3117 !! test
3118 External links: IDN ignored character reference in hostname; strip it right off
3119 !! input
3120 http://e&zwnj;xample.com/
3121 !! result
3122 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3123 </p>
3124 !! end
3125
3126 !! test
3127 External links: www.jpeg.org (bug 554)
3128 !! input
3129 http://www.jpeg.org
3130 !!result
3131 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3132 </p>
3133 !! end
3134
3135 !! test
3136 External links: URL within URL (original bug 2)
3137 !! input
3138 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3139 !! result
3140 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3141 </p>
3142 !! end
3143
3144 !! test
3145 BUG 361: URL inside bracketed URL
3146 !! input
3147 [http://www.example.com/foo http://www.example.com/bar]
3148 !! result
3149 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3150 </p>
3151 !! end
3152
3153 !! test
3154 BUG 361: URL within URL, not bracketed
3155 !! input
3156 http://www.example.com/foo?=http://www.example.com/bar
3157 !! result
3158 <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>
3159 </p>
3160 !! end
3161
3162 !! test
3163 BUG 289: ">"-token in URL-tail
3164 !! input
3165 http://www.example.com/<hello>
3166 !! result
3167 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3168 </p>
3169 !!end
3170
3171 !! test
3172 BUG 289: literal ">"-token in URL-tail
3173 !! input
3174 http://www.example.com/<b>html</b>
3175 !! result
3176 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3177 </p>
3178 !!end
3179
3180 !! test
3181 BUG 289: ">"-token in bracketed URL
3182 !! input
3183 [http://www.example.com/<hello> stuff]
3184 !! result
3185 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3186 </p>
3187 !!end
3188
3189 !! test
3190 BUG 289: literal ">"-token in bracketed URL
3191 !! input
3192 [http://www.example.com/<b>html</b> stuff]
3193 !! result
3194 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3195 </p>
3196 !!end
3197
3198 !! test
3199 BUG 289: literal double quote at end of URL
3200 !! input
3201 http://www.example.com/"hello"
3202 !! result
3203 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3204 </p>
3205 !!end
3206
3207 !! test
3208 BUG 289: literal double quote in bracketed URL
3209 !! input
3210 [http://www.example.com/"hello" stuff]
3211 !! result
3212 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3213 </p>
3214 !!end
3215
3216 !! test
3217 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3218 !! input
3219 [http://www.example.com test]
3220 !! result
3221 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3222 </p>
3223 !! end
3224
3225 !! test
3226 External links: link text with spaces
3227 !! input
3228 [http://www.example.com a b c]
3229 [http://www.example.com ''a'' ''b'']
3230 !! result
3231 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3232 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3233 </p>
3234 !! end
3235
3236 !! test
3237 External links: wiki links within external link (Bug 3695)
3238 !! input
3239 [http://example.com [[wikilink]] embedded in ext link]
3240 !! result
3241 <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>
3242 </p>
3243 !! end
3244
3245 !! test
3246 BUG 787: Links with one slash after the url protocol are invalid
3247 !! input
3248 http:/example.com
3249
3250 [http:/example.com title]
3251 !! result
3252 <p>http:/example.com
3253 </p><p>[http:/example.com title]
3254 </p>
3255 !! end
3256
3257 !! test
3258 Bracketed external links with template-generated invalid target
3259 !! input
3260 [{{echo|http:/example.com}} title]
3261 !! result
3262 <p>[http:/example.com title]
3263 </p>
3264 !! end
3265
3266 !! test
3267 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3268 !! input
3269 ''[http://example.com text'']
3270 [http://example.com '''text]'''
3271 ''Something [http://example.com in italic'']
3272 ''Something [http://example.com mixed''''', even bold]'''
3273 '''''Now [http://example.com both''''']
3274 !! result
3275 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3276 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3277 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3278 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3279 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3280 </p>
3281 !! end
3282
3283
3284 !! test
3285 Bug 4781: %26 in URL
3286 !! input
3287 http://www.example.com/?title=AT%26T
3288 !! result
3289 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3290 </p>
3291 !! end
3292
3293 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3294 # % is actually legal in HTML5. Any change in output would need testing though.
3295 !! test
3296 Bug 4781, 5267: %25 in URL
3297 !! input
3298 http://www.example.com/?title=100%25_Bran
3299 !! result
3300 <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>
3301 </p>
3302 !! end
3303
3304 !! test
3305 Bug 4781, 5267: %28, %29 in URL
3306 !! input
3307 http://www.example.com/?title=Ben-Hur_%281959_film%29
3308 !! result
3309 <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>
3310 </p>
3311 !! end
3312
3313
3314 !! test
3315 Bug 4781: %26 in autonumber URL
3316 !! input
3317 [http://www.example.com/?title=AT%26T]
3318 !! result
3319 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3320 </p>
3321 !! end
3322
3323 !! test
3324 Bug 4781, 5267: %26 in autonumber URL
3325 !! input
3326 [http://www.example.com/?title=100%25_Bran]
3327 !! result
3328 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3329 </p>
3330 !! end
3331
3332 !! test
3333 Bug 4781, 5267: %28, %29 in autonumber URL
3334 !! input
3335 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3336 !! result
3337 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3338 </p>
3339 !! end
3340
3341
3342 !! test
3343 Bug 4781: %26 in bracketed URL
3344 !! input
3345 [http://www.example.com/?title=AT%26T link]
3346 !! result
3347 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3348 </p>
3349 !! end
3350
3351 !! test
3352 Bug 4781, 5267: %26 in bracketed URL
3353 !! input
3354 [http://www.example.com/?title=100%25_Bran link]
3355 !! result
3356 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3357 </p>
3358 !! end
3359
3360 !! test
3361 Bug 4781, 5267: %28, %29 in bracketed URL
3362 !! input
3363 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3364 !! result
3365 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3366 </p>
3367 !! end
3368
3369 !! test
3370 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3371 !! input
3372 Some [http://example.com/ pretty ''italics'' and stuff]!
3373 !! result
3374 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3375 </p>
3376 !! end
3377
3378 !! test
3379 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3380 !! input
3381 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3382 !! result
3383 <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>
3384 </p>
3385 !! end
3386
3387 !! test
3388 External link containing double-single-quotes with no space separating the url from text in italics
3389 !! input
3390 [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]].]
3391 !! result
3392 <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>
3393 </p>
3394 !! end
3395
3396 !! test
3397 External link with comments in link text
3398 !! input
3399 [http://www.google.com Google <!-- comment -->]
3400 !! result
3401 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3402 </p>
3403 !! end
3404
3405 !! test
3406 URL-encoding in URL functions (single parameter)
3407 !! input
3408 {{localurl:Some page|amp=&}}
3409 !! result
3410 <p>/index.php?title=Some_page&amp;amp=&amp;
3411 </p>
3412 !! end
3413
3414 !! test
3415 URL-encoding in URL functions (multiple parameters)
3416 !! input
3417 {{localurl:Some page|q=?&amp=&}}
3418 !! result
3419 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3420 </p>
3421 !! end
3422
3423 !! test
3424 Brackets in urls
3425 !! input
3426 http://example.com/index.php?foozoid%5B%5D=bar
3427
3428 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3429 !! result
3430 <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>
3431 </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>
3432 </p>
3433 !! end
3434
3435 !! test
3436 IPv6 urls (bug 21261)
3437 !! options
3438 disabled
3439 !! input
3440 http://[2404:130:0:1000::187:2]/index.php
3441 !! result
3442 <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>
3443 </p>
3444 !! end
3445
3446 !! test
3447 Non-extlinks in brackets
3448 !! input
3449 [foo]
3450 [foo bar]
3451 [foo ''bar'']
3452 [fool's] errand
3453 [fool's errand]
3454 [{{echo|foo}}]
3455 [{{echo|foo}} bar]
3456 [{{echo|foo}} ''bar'']
3457 [{{echo|foo}}l's] errand
3458 [{{echo|foo}}l's errand]
3459 [url={{echo|foo}}]
3460 [url=http://example.com]
3461 !! result
3462 <p>[foo]
3463 [foo bar]
3464 [foo <i>bar</i>]
3465 [fool's] errand
3466 [fool's errand]
3467 [foo]
3468 [foo bar]
3469 [foo <i>bar</i>]
3470 [fool's] errand
3471 [fool's errand]
3472 [url=foo]
3473 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3474 </p>
3475 !! end
3476
3477 !! test
3478 Parsoid: Percent encoding in external links
3479 !! options
3480 parsoid
3481 !! input
3482 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3483 !! result
3484 <p><a rel="mw:ExtLink"
3485 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3486 !! end
3487
3488 !! test
3489 Parsoid: use url link syntax for links where the content is equal the link
3490 target
3491 !! options
3492 parsoid
3493 !! input
3494 http://example.com
3495 !! result
3496 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3497 !! end
3498
3499 ###
3500 ### Quotes
3501 ###
3502
3503 !! test
3504 Quotes
3505 !! input
3506 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3507
3508 Normal text. '''''Bold italic text.''''' Normal text.
3509 !!result
3510 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3511 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3512 </p>
3513 !! end
3514
3515
3516 !! test
3517 Unclosed and unmatched quotes (php)
3518 !! options
3519 php
3520 !! input
3521 '''''Bold italic text '''with bold deactivated''' in between.'''''
3522
3523 '''''Bold italic text ''with italic deactivated'' in between.'''''
3524
3525 '''Bold text..
3526
3527 ..spanning two paragraphs (should not work).'''
3528
3529 '''Bold tag left open
3530
3531 ''Italic tag left open
3532
3533 Normal text.
3534
3535 <!-- Unmatching number of opening, closing tags: -->
3536 '''This year''''s election ''should'' beat '''last year''''s.
3537
3538 ''Tom'''s car is bigger than ''Susan'''s.
3539
3540 Plain ''italic'''s plain
3541 !! result
3542 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3543 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3544 </p><p><b>Bold text..</b>
3545 </p><p>..spanning two paragraphs (should not work).
3546 </p><p><b>Bold tag left open</b>
3547 </p><p><i>Italic tag left open</i>
3548 </p><p>Normal text.
3549 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3550 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3551 </p><p>Plain <i>italic'</i>s plain
3552 </p>
3553 !! end
3554 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3555 # parser strips. The wikitext contains just the first half of the bold
3556 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3557 # differently than the PHP parser.)
3558 !! test
3559 Unclosed and unmatched quotes (parsoid)
3560 !! options
3561 parsoid
3562 !! input
3563 '''''Bold italic text '''with bold deactivated''' in between.'''''
3564
3565 '''''Bold italic text ''with italic deactivated'' in between.'''''
3566
3567 '''Bold text..
3568
3569 ..spanning two paragraphs (should not work).'''
3570
3571 '''Bold tag left open
3572
3573 ''Italic tag left open
3574
3575 Normal text.
3576
3577 <!-- Unmatching number of opening, closing tags: -->
3578 '''This year''''s election ''should'' beat '''last year''''s.
3579
3580 ''Tom'''s car is bigger than ''Susan'''s.
3581
3582 Plain ''italic'''s plain
3583 !! result
3584 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3585 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3586 </p><p><b>Bold text..</b>
3587 </p><p>..spanning two paragraphs (should not work).<b></b>
3588 </p><p><b>Bold tag left open</b>
3589 </p><p><i>Italic tag left open</i>
3590 </p><p>Normal text.
3591 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3592 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3593 </p><p>Plain <i>italic'</i>s plain
3594 </p>
3595 !! end
3596
3597 ###
3598 ### Tables
3599 ###
3600 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3601 ###
3602
3603 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3604 # is the bare minimum required by the spec, see:
3605 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3606 !! test
3607 A table with no data. (php)
3608 !! options
3609 php
3610 !! input
3611 {||}
3612 !! result
3613 !! end
3614 # Parsoid team replies: empty table tags are legal in HTML5
3615 !! test
3616 A table with no data. (parsoid)
3617 !! options
3618 parsoid
3619 !! input
3620 {||}
3621 !! result
3622 <table></table>
3623 !! end
3624
3625 # A table with nothing but a caption is invalid XHTML, we might want to render
3626 # this as <p>caption</p>
3627 !! test
3628 A table with nothing but a caption (php)
3629 !! options
3630 php
3631 !! input
3632 {|
3633 |+ caption
3634 |}
3635 !! result
3636 <table>
3637 <caption> caption
3638 </caption><tr><td></td></tr></table>
3639
3640 !! end
3641 # Parsoid team replies: table with only a caption is legal in HTML5
3642 !! test
3643 A table with nothing but a caption (parsoid)
3644 !! options
3645 parsoid
3646 !! input
3647 {|
3648 |+ caption
3649 |}
3650 !! result
3651 <table><caption> caption</caption></table>
3652 !! end
3653
3654 !! test
3655 A table with caption with default-spaced attributes and a table row
3656 !! input
3657 {|
3658 |+ style="color: red;" | caption1
3659 |-
3660 | foo
3661 |}
3662 !! result
3663 <table>
3664 <caption style="color: red;"> caption1
3665 </caption>
3666 <tr>
3667 <td> foo
3668 </td></tr></table>
3669
3670 !! end
3671
3672 !! test
3673 A table with captions with non-default spaced attributes and a table row
3674 !! input
3675 {|
3676 |+style="color: red;"|caption2
3677 |+ style="color: red;"| caption3
3678 |-
3679 | foo
3680 |}
3681 !! result
3682 <table>
3683 <caption style="color: red;">caption2
3684 </caption>
3685 <caption style="color: red;"> caption3
3686 </caption>
3687 <tr>
3688 <td> foo
3689 </td></tr></table>
3690
3691 !! end
3692
3693 !! test
3694 Table td-cell syntax variations
3695 !! input
3696 {|
3697 | foo bar foo | baz
3698 | foo bar foo || baz
3699 | style='color:red;' | baz
3700 | style='color:red;' || baz
3701 |}
3702 !! result
3703 <table>
3704 <tr>
3705 <td> baz
3706 </td>
3707 <td> foo bar foo </td>
3708 <td> baz
3709 </td>
3710 <td style="color:red;"> baz
3711 </td>
3712 <td> style='color:red;' </td>
3713 <td> baz
3714 </td></tr></table>
3715
3716 !! end
3717
3718 !! test
3719 Simple table
3720 !! input
3721 {|
3722 | 1 || 2
3723 |-
3724 | 3 || 4
3725 |}
3726 !! result
3727 <table>
3728 <tr>
3729 <td> 1 </td>
3730 <td> 2
3731 </td></tr>
3732 <tr>
3733 <td> 3 </td>
3734 <td> 4
3735 </td></tr></table>
3736
3737 !! end
3738
3739 !! test
3740 Simple table but with multiple dashes for row wikitext
3741 !! input
3742 {|
3743 | foo
3744 |-----
3745 | bar
3746 |}
3747 !! result
3748 <table>
3749 <tr>
3750 <td> foo
3751 </td></tr>
3752 <tr>
3753 <td> bar
3754 </td></tr></table>
3755
3756 !! end
3757 !! test
3758 Multiplication table
3759 !! input
3760 {| border="1" cellpadding="2"
3761 |+Multiplication table
3762 |-
3763 ! &times; !! 1 !! 2 !! 3
3764 |-
3765 ! 1
3766 | 1 || 2 || 3
3767 |-
3768 ! 2
3769 | 2 || 4 || 6
3770 |-
3771 ! 3
3772 | 3 || 6 || 9
3773 |-
3774 ! 4
3775 | 4 || 8 || 12
3776 |-
3777 ! 5
3778 | 5 || 10 || 15
3779 |}
3780 !! result
3781 <table border="1" cellpadding="2">
3782 <caption>Multiplication table
3783 </caption>
3784 <tr>
3785 <th> &#215; </th>
3786 <th> 1 </th>
3787 <th> 2 </th>
3788 <th> 3
3789 </th></tr>
3790 <tr>
3791 <th> 1
3792 </th>
3793 <td> 1 </td>
3794 <td> 2 </td>
3795 <td> 3
3796 </td></tr>
3797 <tr>
3798 <th> 2
3799 </th>
3800 <td> 2 </td>
3801 <td> 4 </td>
3802 <td> 6
3803 </td></tr>
3804 <tr>
3805 <th> 3
3806 </th>
3807 <td> 3 </td>
3808 <td> 6 </td>
3809 <td> 9
3810 </td></tr>
3811 <tr>
3812 <th> 4
3813 </th>
3814 <td> 4 </td>
3815 <td> 8 </td>
3816 <td> 12
3817 </td></tr>
3818 <tr>
3819 <th> 5
3820 </th>
3821 <td> 5 </td>
3822 <td> 10 </td>
3823 <td> 15
3824 </td></tr></table>
3825
3826 !! end
3827
3828 !! test
3829 Accept "||" in table headings
3830 !! input
3831 {|
3832 !h1 || h2
3833 |}
3834 !! result
3835 <table>
3836 <tr>
3837 <th>h1 </th>
3838 <th> h2
3839 </th></tr></table>
3840
3841 !! end
3842
3843 !! test
3844 Accept "||" in indented table headings
3845 !! input
3846 :{|
3847 !h1 || h2
3848 |}
3849 !! result
3850 <dl><dd><table>
3851 <tr>
3852 <th>h1 </th>
3853 <th> h2
3854 </th></tr></table></dd></dl>
3855
3856 !! end
3857
3858 !! test
3859 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3860 !! input
3861 {|
3862 !| h1
3863 || a
3864 |}
3865 !! result
3866 <table>
3867 <tr>
3868 <th> h1
3869 </th>
3870 <td> a
3871 </td></tr></table>
3872
3873 !! end
3874
3875 !!test
3876 Accept "| !" at start of line in tables (ignore !-attribute)
3877 !!input
3878 {|
3879 |-
3880 | !style="color:red" | bar
3881 |}
3882 !!result
3883 <table>
3884
3885 <tr>
3886 <td> bar
3887 </td></tr></table>
3888
3889 !!end
3890
3891 !!test
3892 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 +/-
3893 !!input
3894 {|
3895 |-
3896 |style='color:red;'|+1
3897 |style='color:blue;'|-1
3898 |-
3899 | 1 || 2 || 3
3900 | 1 ||+2 ||-3
3901 |-
3902 | +1
3903 | -1
3904 |}
3905 !!result
3906 <table>
3907
3908 <tr>
3909 <td style="color:red;">+1
3910 </td>
3911 <td style="color:blue;">-1
3912 </td></tr>
3913 <tr>
3914 <td> 1 </td>
3915 <td> 2 </td>
3916 <td> 3
3917 </td>
3918 <td> 1 </td>
3919 <td>+2 </td>
3920 <td>-3
3921 </td></tr>
3922 <tr>
3923 <td> +1
3924 </td>
3925 <td> -1
3926 </td></tr></table>
3927
3928 !!end
3929
3930 !! test
3931 Table rowspan
3932 !! input
3933 {| border=1
3934 | Cell 1, row 1
3935 |rowspan=2| Cell 2, row 1 (and 2)
3936 | Cell 3, row 1
3937 |-
3938 | Cell 1, row 2
3939 | Cell 3, row 2
3940 |}
3941 !! result
3942 <table border="1">
3943 <tr>
3944 <td> Cell 1, row 1
3945 </td>
3946 <td rowspan="2"> Cell 2, row 1 (and 2)
3947 </td>
3948 <td> Cell 3, row 1
3949 </td></tr>
3950 <tr>
3951 <td> Cell 1, row 2
3952 </td>
3953 <td> Cell 3, row 2
3954 </td></tr></table>
3955
3956 !! end
3957
3958 !! test
3959 Nested table
3960 !! input
3961 {| border=1
3962 | &alpha;
3963 |
3964 {| bgcolor=#ABCDEF border=2
3965 |nested
3966 |-
3967 |table
3968 |}
3969 |the original table again
3970 |}
3971 !! result
3972 <table border="1">
3973 <tr>
3974 <td> &#945;
3975 </td>
3976 <td>
3977 <table bgcolor="#ABCDEF" border="2">
3978 <tr>
3979 <td>nested
3980 </td></tr>
3981 <tr>
3982 <td>table
3983 </td></tr></table>
3984 </td>
3985 <td>the original table again
3986 </td></tr></table>
3987
3988 !! end
3989
3990 !! test
3991 Invalid attributes in table cell (bug 1830)
3992 !! input
3993 {|
3994 |Cell:|broken
3995 |}
3996 !! result
3997 <table>
3998 <tr>
3999 <td>broken
4000 </td></tr></table>
4001
4002 !! end
4003
4004
4005 !! test
4006 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4007 !! input
4008 {|
4009 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4010 !! result
4011 <table>
4012 <tr>
4013 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4014 <td>]" onmouseover="alert(document.cookie)"&gt;test
4015 </td>
4016 </tr>
4017 </table>
4018
4019 !! end
4020
4021
4022 !! test
4023 Indented table markup mixed with indented pre content (proposed in bug 6200)
4024 !! input
4025 <table>
4026 <tr>
4027 <td>
4028 Text that should be rendered preformatted
4029 </td>
4030 </tr>
4031 </table>
4032 !! result
4033 <table>
4034 <tr>
4035 <td>
4036 <pre>Text that should be rendered preformatted
4037 </pre>
4038 </td>
4039 </tr>
4040 </table>
4041
4042 !! end
4043
4044 !! test
4045 Template-generated table cell attributes and cell content
4046 !! input
4047 {|
4048 |{{table_attribs}}
4049 |}
4050 !! result
4051 <table>
4052 <tr>
4053 <td style="color: red"> Foo
4054 </td></tr></table>
4055
4056 !! end
4057
4058 !! test
4059 Template-generated table cell attributes and cell content (2)
4060 !! input
4061 {|
4062 |align=center {{table_attribs}}
4063 |}
4064 !! result
4065 <table>
4066 <tr>
4067 <td align="center" style="color: red"> Foo
4068 </td></tr></table>
4069
4070 !! end
4071
4072 !! test
4073 Template-generated table cell attributes and cell content (3)
4074 !! input
4075 {|
4076 |align=center {{table_cells}}
4077 |}
4078 !! result
4079 <table>
4080 <tr>
4081 <td align="center" style="color: red"> Foo </td>
4082 <td> Bar </td>
4083 <td> Baz
4084 </td></tr></table>
4085
4086 !! end
4087
4088 !! test
4089 Table with row followed by newlines and table heading
4090 !! input
4091 {|
4092 |-
4093
4094 ! foo
4095 |}
4096 !! result
4097 <table>
4098
4099
4100 <tr>
4101 <th> foo
4102 </th></tr></table>
4103
4104 !! end
4105
4106 !! test
4107 Table with empty line following the start tag
4108 !! input
4109 {|
4110
4111 |-
4112 | foo
4113 |}
4114 !! result
4115 <table>
4116
4117
4118 <tr>
4119 <td> foo
4120 </td></tr></table>
4121
4122 !! end
4123
4124 # FIXME: Preserve the attribute properly (with an empty string as value) in
4125 # the PHP parser. Parsoid implements the behavior below.
4126 !! test
4127 Table attributes with empty value
4128 !! options
4129 parsoid
4130 !! input
4131 {|
4132 | style=| hello
4133 |}
4134 !! result
4135 <table>
4136 <tbody>
4137 <tr>
4138 <td style=""> hello
4139 </td></tr></tbody></table>
4140
4141 !! end
4142
4143 !! test
4144 Wikitext table with a lot of comments
4145 !! input
4146 {|
4147 <!-- c0 -->
4148 | foo
4149 <!-- c1 -->
4150 |- <!-- c2 -->
4151 <!-- c3 -->
4152 |<!-- c4 -->
4153 <!-- c5 -->
4154 |}
4155 !! result
4156 <table>
4157 <tr>
4158 <td> foo
4159 </td></tr>
4160 <tr>
4161 <td>
4162 </td></tr></table>
4163
4164 !! end
4165
4166 !! test
4167 Wikitext table with double-line table cell
4168 !! input
4169 {|
4170 |a
4171 b
4172 |}
4173 !! result
4174 <table>
4175 <tr>
4176 <td>a
4177 <p>b
4178 </p>
4179 </td></tr></table>
4180
4181 !! end
4182
4183 !! test
4184 Table cell with a single comment
4185 !! input
4186 {|
4187 | <!-- c1 -->
4188 | a
4189 |}
4190 !! result
4191 <table>
4192 <tr>
4193 <td>
4194 </td>
4195 <td> a
4196 </td></tr></table>
4197
4198 !! end
4199
4200 # The expected HTML structure in this test is debatable. The PHP parser does
4201 # not parse this kind of table at all. The main focus for Parsoid is on
4202 # round-tripping, so this output is ok for now. TODO: revisit!
4203 !! test
4204 Wikitext table with html-syntax row (Parsoid)
4205 !! options
4206 parsoid
4207 !! input
4208 {|
4209 |-
4210 <td>foo</td>
4211 |}
4212 !! result
4213 <table>
4214 <tbody>
4215 <tr>
4216 <td>foo</td></tr></tbody></table>
4217 !! end
4218
4219 !! test
4220 Implicit <td> after a |-
4221 (PHP parser relies on Tidy to add the missing <td> tags)
4222 !! options
4223 parsoid=wt2html,wt2wt
4224 !! input
4225 {|
4226 |-
4227 a
4228 |}
4229 !! result
4230 <table>
4231 <tr><td>a</td></tr>
4232 </table>
4233 !! end
4234
4235 !! test
4236 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4237 (PHP parser relies on Tidy to add the missing <td> tags)
4238 !! options
4239 parsoid=wt2html,wt2wt
4240 !! input
4241 {|
4242 |-
4243 |
4244 a
4245 |-
4246 b
4247 |}
4248 !! result
4249 <table>
4250 <tbody>
4251 <tr><td><pre>a</pre></td></tr>
4252 <tr><td> b</td></tr>
4253 </tbody>
4254 </table>
4255 !! end
4256
4257 !! test
4258 Lists should be recognized in an implicit <td> context
4259 (PHP parser relies on Tidy to add the missing <td> tags)
4260 !! options
4261 parsoid=wt2html,wt2wt
4262 !! input
4263 {|
4264 |-
4265 *a
4266 |}
4267 !! result
4268 <table>
4269 <tr>
4270 <td><ul><li>a</li></ul></td>
4271 </tr>
4272 </table>
4273 !! end
4274
4275 ###
4276 ### Internal links
4277 ###
4278 !! test
4279 Plain link, capitalized
4280 !! input
4281 [[Main Page]]
4282 !! result
4283 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4284 </p>
4285 !! end
4286
4287 !! test
4288 Plain link, uncapitalized
4289 !! input
4290 [[main Page]]
4291 !! result
4292 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4293 </p>
4294 !! end
4295
4296 !! test
4297 Piped link
4298 !! input
4299 [[Main Page|The Main Page]]
4300 !! result
4301 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4302 </p>
4303 !! end
4304
4305 !! test
4306 Piped link with comment in link text
4307 !! input
4308 [[Main Page|The Main<!--front--> Page]]
4309 !! result
4310 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4311 </p>
4312 !! end
4313
4314 !! test
4315 Broken link
4316 !! input
4317 [[Zigzagzogzagzig]]
4318 !! result
4319 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4320 </p>
4321 !! end
4322
4323 !! test
4324 Broken link with fragment
4325 !! input
4326 [[Zigzagzogzagzig#zug]]
4327 !! result
4328 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4329 </p>
4330 !! end
4331
4332 !! test
4333 Special page link with fragment
4334 !! input
4335 [[Special:Version#anchor]]
4336 !! result
4337 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4338 </p>
4339 !! end
4340
4341 !! test
4342 Nonexistent special page link with fragment
4343 !! input
4344 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4345 !! result
4346 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4347 </p>
4348 !! end
4349
4350 !! test
4351 Link with prefix
4352 !! input
4353 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4354 !! result
4355 <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>
4356 </p>
4357 !! end
4358
4359 !! test
4360 Link with suffix
4361 !! input
4362 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4363 !! result
4364 <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>!!!
4365 </p>
4366 !! end
4367
4368 !! article
4369 prefixed article
4370 !! text
4371 Some text
4372 !! endarticle
4373
4374 !! test
4375 Bug 43661: Piped links with identical prefixes
4376 !! input
4377 [[prefixed article|prefixed articles with spaces]]
4378
4379 [[prefixed article|prefixed articlesaoeu]]
4380
4381 [[Main Page|Main Page test]]
4382 !! result
4383 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4384 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4385 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4386 </p>
4387 !! end
4388
4389
4390 !! test
4391 Link with HTML entity in suffix / tail
4392 !! input
4393 [[Main Page]]&quot;, [[Main Page]]&#97;
4394 !! result
4395 <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;
4396 </p>
4397 !! end
4398
4399 !! test
4400 Link with 3 brackets
4401 !! input
4402 [[[main page]]]
4403 !! result
4404 <p>[[[main page]]]
4405 </p>
4406 !! end
4407
4408 !! test
4409 Piped link with 3 brackets
4410 !! input
4411 [[[main page|the main page]]]
4412 !! result
4413 <p>[[[main page|the main page]]]
4414 </p>
4415 !! end
4416
4417 !! test
4418 Link with multiple pipes
4419 !! input
4420 [[Main Page|The|Main|Page]]
4421 !! result
4422 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4423 </p>
4424 !! end
4425
4426 !! test
4427 Link to namespaces
4428 !! input
4429 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4430 !! result
4431 <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>
4432 </p>
4433 !! end
4434
4435 !! test
4436 Piped link to namespace
4437 !! input
4438 [[Meta:Disclaimers|The disclaimers]]
4439 !! result
4440 <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>
4441 </p>
4442 !! end
4443
4444 !! test
4445 Link containing }
4446 !! input
4447 [[Usually caused by a typo (oops}]]
4448 !! result
4449 <p>[[Usually caused by a typo (oops}]]
4450 </p>
4451 !! end
4452
4453 !! test
4454 Link containing % (not as a hex sequence)
4455 !! input
4456 [[7% Solution]]
4457 !! result
4458 <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>
4459 </p>
4460 !! end
4461
4462 !! test
4463 Link containing % as a single hex sequence interpreted to char
4464 !! input
4465 [[7%25 Solution]]
4466 !! result
4467 <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>
4468 </p>
4469 !!end
4470
4471 !! test
4472 Link containing % as a double hex sequence interpreted to hex sequence
4473 !! input
4474 [[7%2525 Solution]]
4475 !! result
4476 <p>[[7%2525 Solution]]
4477 </p>
4478 !!end
4479
4480 !! test
4481 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4482 Example for such a section: == < ==
4483 !! input
4484 [[%23%3c]][[%23%3e]]
4485 !! result
4486 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4487 </p>
4488 !! end
4489
4490 !! test
4491 Link containing "<#" and ">#" as a hex sequences
4492 !! input
4493 [[%3c%23]][[%3e%23]]
4494 !! result
4495 <p>[[%3c%23]][[%3e%23]]
4496 </p>
4497 !! end
4498
4499 !! test
4500 Link containing an equals sign
4501 !! input
4502 [[Special:BookSources/isbn=4-00-026157-6]]
4503 !! result
4504 <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>
4505 </p>
4506 !! end
4507
4508 !! article
4509 Foo~bar
4510 !! text
4511 Just a test of an article title containing a tilde.
4512 !! endarticle
4513
4514 # note that links containing signatures, like [[Foo~~~~]], are
4515 # massaged by the pre-save transform (PST) and so the tildes are never
4516 # seen by the parser.
4517 !! test
4518 Link containing a tilde
4519 !! input
4520 [[Foo~bar]]
4521 !! result
4522 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4523 </p>
4524 !! end
4525
4526 !! test
4527 Link containing double-single-quotes '' (bug 4598)
4528 !! input
4529 [[Lista d''e paise d''o munno]]
4530 !! result
4531 <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>
4532 </p>
4533 !! end
4534
4535 !! test
4536 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4537 !! input
4538 Some [[Link|pretty ''italics'' and stuff]]!
4539 !! result
4540 <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>!
4541 </p>
4542 !! end
4543
4544 !! test
4545 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4546 !! input
4547 ''Some [[Link|pretty ''italics'' and stuff]]!
4548 !! result
4549 <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>
4550 </p>
4551 !! end
4552
4553 !! test
4554 Link with double quotes in title part (literal) and alternate part (interpreted)
4555 !! input
4556 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4557
4558 [[''Pentecoste'']]
4559
4560 [[''Pentecoste''|Pentecoste]]
4561
4562 [[''Pentecoste''|''Pentecoste'']]
4563 !! result
4564 <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>
4565 </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>
4566 </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>
4567 </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>
4568 </p>
4569 !! end
4570
4571 !! test
4572 Broken image links with HTML captions (bug 39700)
4573 !! input
4574 [[File:Nonexistent|<script></script>]]
4575 [[File:Nonexistent|100px|<script></script>]]
4576 [[File:Nonexistent|&lt;]]
4577 [[File:Nonexistent|a<i>b</i>c]]
4578 !! result
4579 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4580 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4581 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4582 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4583 </p>
4584 !! end
4585
4586 !! test
4587 Plain link to URL
4588 !! input
4589 [[http://www.example.com]]
4590 !! result
4591 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4592 </p>
4593 !! end
4594
4595 !! test
4596 Plain link to URL with link text
4597 !! input
4598 [[http://www.example.com Link text]]
4599 !! result
4600 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4601 </p>
4602 !! end
4603
4604 !! test
4605 Plain link to protocol-relative URL
4606 !! input
4607 [[//www.example.com]]
4608 !! result
4609 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4610 </p>
4611 !! end
4612
4613 !! test
4614 Plain link to protocol-relative URL with link text
4615 !! input
4616 [[//www.example.com Link text]]
4617 !! result
4618 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4619 </p>
4620 !! end
4621
4622 !! test
4623 Plain link to page with question mark in title
4624 !! input
4625 [[A?b]]
4626
4627 [[A?b|Baz]]
4628 !! result
4629 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4630 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4631 </p>
4632 !! end
4633
4634
4635 # I'm fairly sure the expected result here is wrong.
4636 # We want these to be URL links, not pseudo-pages with URLs for titles....
4637 # However the current output is also pretty screwy.
4638 #
4639 # ----
4640 # I'm changing it to match the current output--it arguably makes more
4641 # sense in the light of the test above. Old expected result was:
4642 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4643 #</p>
4644 # But I think this test is bordering on "garbage in, garbage out" anyway.
4645 # -- wtm
4646 !! test
4647 Piped link to URL
4648 !! input
4649 Piped link to URL: [[http://www.example.com|an example URL]]
4650 !! result
4651 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4652 </p>
4653 !! end
4654
4655 !! test
4656 BUG 2: [[page|http://url/]] should link to page, not http://url/
4657 !! input
4658 [[Main Page|http://url/]]
4659 !! result
4660 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4661 </p>
4662 !! end
4663
4664 !! test
4665 BUG 337: Escaped self-links should be bold
4666 !! options
4667 title=[[Bug462]]
4668 !! input
4669 [[Bu&#103;462]] [[Bug462]]
4670 !! result
4671 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4672 </p>
4673 !! end
4674
4675 !! test
4676 Self-link to section should not be bold
4677 !! options
4678 title=[[Main Page]]
4679 !! input
4680 [[Main Page#section]]
4681 !! result
4682 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4683 </p>
4684 !! end
4685
4686 !! article
4687 00
4688 !! text
4689 This is 00.
4690 !! endarticle
4691
4692 !!test
4693 Self-link to numeric title
4694 !!options
4695 title=[[0]]
4696 !!input
4697 [[0]]
4698 !!result
4699 <p><strong class="selflink">0</strong>
4700 </p>
4701 !!end
4702
4703 !!test
4704 Link to numeric-equivalent title
4705 !!options
4706 title=[[0]]
4707 !!input
4708 [[00]]
4709 !!result
4710 <p><a href="/wiki/00" title="00">00</a>
4711 </p>
4712 !!end
4713
4714 !! test
4715 <nowiki> inside a link
4716 !! input
4717 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4718 !! result
4719 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4720 </p>
4721 !! end
4722
4723 !! test
4724 Non-breaking spaces in title
4725 !! input
4726 [[&nbsp; Main &nbsp; Page &nbsp;]]
4727 !! result
4728 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4729 </p>
4730 !!end
4731
4732 !! test
4733 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4734 !! options
4735 language=ca
4736 !! input
4737 '''[[Main Page]]'''
4738 !! result
4739 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4740 </p>
4741 !! end
4742
4743 !! test
4744 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4745 !! options
4746 language=ca
4747 !! input
4748 ''[[Main Page]]''
4749 !! result
4750 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4751 </p>
4752 !! end
4753
4754 !! test
4755 Internal link with en linktrail: no apostrophes (bug 27473)
4756 !! options
4757 language=en
4758 !! input
4759 [[Something]]'nice
4760 !! result
4761 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4762 </p>
4763 !! end
4764
4765 !! test
4766 Internal link with ca linktrail with apostrophes (bug 27473)
4767 !! options
4768 language=ca
4769 !! input
4770 [[Something]]'nice
4771 !! result
4772 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 Internal link with kaa linktrail with apostrophes (bug 27473)
4778 !! options
4779 language=kaa
4780 !! input
4781 [[Something]]'nice
4782 !! result
4783 <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>
4784 </p>
4785 !! end
4786
4787 !! article
4788 Söfnuður
4789 !! text
4790 Test.
4791 !! endarticle
4792
4793 !! test
4794 Internal link with is link prefix
4795 !! options
4796 language=is
4797 !! input
4798 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4799 !! result
4800 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4801 </p>
4802 !! end
4803
4804 !! article
4805 Mótmælendatrú
4806 !! text
4807 Test.
4808 !! endarticle
4809
4810 !! test
4811 Internal link with is link trail and link prefix
4812 !! options
4813 language=is
4814 !! input
4815 [[mótmælendatrú|xxx]]ar
4816 [[mótmælendatrú]]ar
4817 mótmælenda[[söfnuður]]
4818 mótmælenda[[söfnuður|söfnuðir]]
4819 mótmælenda[[söfnuður|söfnuðir]]xxx
4820 !! result
4821 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4822 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4823 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4824 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4825 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4826 </p>
4827 !! end
4828
4829 !! test
4830 Parsoid link trail escaping
4831 !! options
4832 parsoid=html2wt,html2html
4833 !! input
4834 [[apple]]<nowiki/>s
4835 !! result
4836 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4837 !! end
4838
4839 !! test
4840 Parsoid link prefix escaping
4841 !! options
4842 language=is
4843 parsoid=html2wt,html2html
4844 !! input
4845 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4846 !! result
4847 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4848 !! end
4849
4850 !! test
4851 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4852 !! input
4853 [[Foo| bar]]
4854
4855 [[Foo| ''bar'']]
4856
4857 [http://wp.org foo]
4858
4859 [http://wp.org ''foo'']
4860 !! result
4861 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4862 </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>
4863 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4864 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4865 </p>
4866 !! end
4867
4868 ###
4869 ### Interwiki links (see maintenance/interwiki.sql)
4870 ###
4871
4872 !! test
4873 Inline interwiki link
4874 !! input
4875 [[MeatBall:SoftSecurity]]
4876 !! result
4877 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4878 </p>
4879 !! end
4880
4881 !! test
4882 Inline interwiki link with empty title (bug 2372)
4883 !! input
4884 [[MeatBall:]]
4885 !! result
4886 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4887 </p>
4888 !! end
4889
4890 !! test
4891 Interwiki link encoding conversion (bug 1636)
4892 !! input
4893 *[[Wikipedia:ro:Olteni&#0355;a]]
4894 *[[Wikipedia:ro:Olteni&#355;a]]
4895 !! result
4896 <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>
4897 </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>
4898 </li></ul>
4899
4900 !! end
4901
4902 !! test
4903 Interwiki link with fragment (bug 2130)
4904 !! input
4905 [[MeatBall:SoftSecurity#foo]]
4906 !! result
4907 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4908 </p>
4909 !! end
4910
4911 !! test
4912 Interlanguage link
4913 !! input
4914 Blah blah blah
4915 [[zh:Chinese]]
4916 !!result
4917 <p>Blah blah blah
4918 </p>
4919 !! end
4920
4921 !! test
4922 Double interlanguage link
4923 !! input
4924 Blah blah blah
4925 [[es:Spanish]]
4926 [[zh:Chinese]]
4927 !!result
4928 <p>Blah blah blah
4929 </p>
4930 !! end
4931
4932 !! test
4933 Interlanguage link, with prefix links
4934 !! options
4935 language=ln
4936 !! input
4937 Blah blah blah
4938 [[zh:Chinese]]
4939 !!result
4940 <p>Blah blah blah
4941 </p>
4942 !! end
4943
4944 !! test
4945 Double interlanguage link, with prefix links (bug 8897)
4946 !! options
4947 language=ln
4948 !! input
4949 Blah blah blah
4950 [[es:Spanish]]
4951 [[zh:Chinese]]
4952 !!result
4953 <p>Blah blah blah
4954 </p>
4955 !! end
4956
4957 !! test
4958 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4959 !! options
4960 language=ln
4961 !! input
4962 [[WW&nbsp;II]]
4963 !!result
4964 <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>
4965 </p>
4966 !! end
4967
4968 !! test
4969 Parsoid: handle constructor well
4970 !! options
4971 parsoid
4972 !! input
4973 [[constructor]]
4974
4975 [[constructor:foo]]
4976 !! result
4977 <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>
4978
4979
4980 <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>
4981 !! end
4982
4983 ##
4984 ## Redirects, Parsoid-only
4985 ##
4986 !! test
4987 Simple redirect to page
4988 !! options
4989 parsoid
4990 !! input
4991 #REDIRECT [[Main Page]]
4992 !! result
4993 <link rel="mw:PageProp/redirect" href="./Main_Page">
4994 !! end
4995
4996 !! test
4997 Optional colon in #REDIRECT
4998 !! options
4999 # the colon is archaic syntax. we support it for wt2html, but we
5000 # don't care that it roundtrips back to the modern syntax.
5001 parsoid=wt2html,html2html
5002 !! input
5003 #REDIRECT:[[Main Page]]
5004 !! result
5005 <link rel="mw:PageProp/redirect" href="./Main_Page">
5006 !! end
5007
5008 !! test
5009 Whitespace in #REDIRECT with optional colon
5010 !! options
5011 # the colon and gratuitous whitespace is archaic syntax. we support
5012 # it for wt2html, but we don't care that it roundtrips back to the
5013 # modern syntax (without extra whitespace)
5014 parsoid=wt2html,html2html
5015 !! input
5016
5017 #REDIRECT
5018 :
5019 [[Main Page]]
5020 !! result
5021 <link rel="mw:PageProp/redirect" href="./Main_Page">
5022 !! end
5023
5024 !! test
5025 Piped link in #REDIRECT
5026 !! options
5027 # content after piped link is ignored. we support this syntax,
5028 # but don't care that the piped link is lost when we roundtrip this.
5029 parsoid=wt2html
5030 !! input
5031 #REDIRECT [[Main Page|bar]]
5032 !! result
5033 <link rel="mw:PageProp/redirect" href="./Main_Page">
5034 !! end
5035
5036 !! test
5037 Redirect to category
5038 !! options
5039 parsoid=wt2html
5040 !! input
5041 #REDIRECT [[Category:Foo]]
5042 !! result
5043 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5044 !! end
5045
5046 !! test
5047 Redirect to category with URL encoding
5048 !! options
5049 parsoid=wt2html
5050 !! input
5051 #REDIRECT [[Category%3AFoo]]
5052 !! result
5053 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5054 !! end
5055
5056 !! test
5057 Redirect to category page
5058 !! options
5059 parsoid=wt2html,html2html
5060 !! input
5061 #REDIRECT [[:Category:Foo]]
5062 !! result
5063 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5064 !! end
5065
5066 !! test
5067 Redirect to image page (1)
5068 !! options
5069 parsoid
5070 !! input
5071 #REDIRECT [[File:Wiki.png]]
5072 !! result
5073 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5074 !! end
5075
5076 !! test
5077 Redirect to image page (2)
5078 !! options
5079 parsoid
5080 !! input
5081 #REDIRECT [[Image:Wiki.png]]
5082 !! result
5083 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5084 !! end
5085
5086 !! test
5087 Redirect to language
5088 !! options
5089 parsoid
5090 !! input
5091 #REDIRECT [[en:File:Wiki.png]]
5092 !! result
5093 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5094 !! end
5095
5096 !! test
5097 Redirect to interwiki
5098 !! options
5099 parsoid
5100 !! input
5101 #REDIRECT [[meatball:File:Wiki.png]]
5102 !! result
5103 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5104 !! end
5105
5106 !! test
5107 Non-English #REDIRECT
5108 !! options
5109 parsoid
5110 language=is
5111 !! input
5112 #TILVÍSUN [[Main Page]]
5113 !! result
5114 <link rel="mw:PageProp/redirect" href="./Main_Page">
5115 !! end
5116
5117 ##
5118 ## XHTML tidiness
5119 ###
5120
5121 !! test
5122 <br> to <br />
5123 !! input
5124 1<br>2<br />3
5125 !! result
5126 <p>1<br />2<br />3
5127 </p>
5128 !! end
5129
5130 !! test
5131 Broken br tag sanitization
5132 !! options
5133 php
5134 !! input
5135 </br>
5136 !! result
5137 <p>&lt;/br&gt;
5138 </p>
5139 !! end
5140
5141 # TODO: Fix html2html mode (bug 51055)!
5142 !! test
5143 Parsoid: Broken br tag recognition
5144 !! options
5145 parsoid=wt2html
5146 !! input
5147 </br>
5148 !! result
5149 <p><br></p>
5150 !! end
5151
5152 !! test
5153 Incorrecly removing closing slashes from correctly formed XHTML
5154 !! input
5155 <br style="clear:both;" />
5156 !! result
5157 <p><br style="clear:both;" />
5158 </p>
5159 !! end
5160
5161 !! test
5162 Failing to transform badly formed HTML into correct XHTML
5163 !! input
5164 <br style="clear: left;">
5165 <br style="clear: right;">
5166 <br style="clear: both;">
5167 !! result
5168 <p><br style="clear: left;" />
5169 <br style="clear: right;" />
5170 <br style="clear: both;" />
5171 </p>
5172 !!end
5173
5174 !! test
5175 Handling html with a div self-closing tag
5176 !! input
5177 <div title />
5178 <div title/>
5179 <div title/ >
5180 <div title=bar />
5181 <div title=bar/>
5182 <div title=bar/ >
5183 !! result
5184 <p>&lt;div title /&gt;
5185 &lt;div title/&gt;
5186 </p>
5187 <div>
5188 <p>&lt;div title=bar /&gt;
5189 &lt;div title=bar/&gt;
5190 </p>
5191 <div title="bar/"></div>
5192 </div>
5193
5194 !! end
5195
5196 !! test
5197 Handling html with a br self-closing tag
5198 !! input
5199 <br title />
5200 <br title/>
5201 <br title/ >
5202 <br title=bar />
5203 <br title=bar/>
5204 <br title=bar/ >
5205 !! result
5206 <p><br title="title" />
5207 <br title="title" />
5208 <br />
5209 <br title="bar" />
5210 <br title="bar" />
5211 <br title="bar/" />
5212 </p>
5213 !! end
5214
5215 !! test
5216 Horizontal ruler (should it add that extra space?)
5217 !! input
5218 <hr>
5219 <hr >
5220 foo <hr
5221 > bar
5222 !! result
5223 <hr />
5224 <hr />
5225 foo <hr /> bar
5226
5227 !! end
5228
5229 !! test
5230 Horizontal ruler -- 4+ dashes render hr
5231 !! input
5232 ----
5233 !! result
5234 <hr />
5235
5236 !! end
5237
5238 !! test
5239 Horizontal ruler -- eats additional dashes on the same line
5240 !! input
5241 ---------
5242 !! result
5243 <hr />
5244
5245 !! end
5246
5247 !! test
5248 Horizontal ruler -- does not collapse dashes on consecutive lines
5249 !! input
5250 ----
5251 ----
5252 !! result
5253 <hr />
5254 <hr />
5255
5256 !! end
5257
5258 !! test
5259 Horizontal ruler -- <4 dashes render as plain text
5260 !! input
5261 ---
5262 !! result
5263 <p>---
5264 </p>
5265 !! end
5266
5267 !! test
5268 Horizontal ruler -- Supports content following dashes on same line
5269 !! input
5270 ---- Foo
5271 !! result
5272 <hr /> Foo
5273
5274 !! end
5275
5276 ###
5277 ### Block-level elements
5278 ###
5279 !! test
5280 Common list
5281 !! input
5282 *Common list
5283 * item 2
5284 *item 3
5285 !! result
5286 <ul><li>Common list
5287 </li><li> item 2
5288 </li><li>item 3
5289 </li></ul>
5290
5291 !! end
5292
5293 !! test
5294 Numbered list
5295 !! input
5296 #Numbered list
5297 #item 2
5298 # item 3
5299 !! result
5300 <ol><li>Numbered list
5301 </li><li>item 2
5302 </li><li> item 3
5303 </li></ol>
5304
5305 !! end
5306
5307 !! test
5308 Mixed list
5309 !! input
5310 *Mixed list
5311 *# with numbers
5312 ** and bullets
5313 *# and numbers
5314 *bullets again
5315 **bullet level 2
5316 ***bullet level 3
5317 ***#Number on level 4
5318 **bullet level 2
5319 **#Number on level 3
5320 **#Number on level 3
5321 *#number level 2
5322 *Level 1
5323 *** Level 3
5324 #** Level 3, but ordered
5325 !! result
5326 <ul><li>Mixed list
5327 <ol><li> with numbers
5328 </li></ol>
5329 <ul><li> and bullets
5330 </li></ul>
5331 <ol><li> and numbers
5332 </li></ol>
5333 </li><li>bullets again
5334 <ul><li>bullet level 2
5335 <ul><li>bullet level 3
5336 <ol><li>Number on level 4
5337 </li></ol>
5338 </li></ul>
5339 </li><li>bullet level 2
5340 <ol><li>Number on level 3
5341 </li><li>Number on level 3
5342 </li></ol>
5343 </li></ul>
5344 <ol><li>number level 2
5345 </li></ol>
5346 </li><li>Level 1
5347 <ul><li><ul><li> Level 3
5348 </li></ul>
5349 </li></ul>
5350 </li></ul>
5351 <ol><li><ul><li><ul><li> Level 3, but ordered
5352 </li></ul>
5353 </li></ul>
5354 </li></ol>
5355
5356 !! end
5357
5358 !! test
5359 Nested lists 1
5360 !! input
5361 *foo
5362 **bar
5363 !! result
5364 <ul><li>foo
5365 <ul><li>bar
5366 </li></ul>
5367 </li></ul>
5368
5369 !! end
5370
5371 !! test
5372 Nested lists 2
5373 !! input
5374 **foo
5375 *bar
5376 !! result
5377 <ul><li><ul><li>foo
5378 </li></ul>
5379 </li><li>bar
5380 </li></ul>
5381
5382 !! end
5383
5384 !! test
5385 Nested lists 3 (first element empty)
5386 !! input
5387 *
5388 **bar
5389 !! result
5390 <ul><li>
5391 <ul><li>bar
5392 </li></ul>
5393 </li></ul>
5394
5395 !! end
5396
5397 !! test
5398 Nested lists 4 (first element empty)
5399 !! input
5400 **
5401 *bar
5402 !! result
5403 <ul><li><ul><li>
5404 </li></ul>
5405 </li><li>bar
5406 </li></ul>
5407
5408 !! end
5409
5410 !! test
5411 Nested lists 5 (both elements empty)
5412 !! input
5413 **
5414 *
5415 !! result
5416 <ul><li><ul><li>
5417 </li></ul>
5418 </li><li>
5419 </li></ul>
5420
5421 !! end
5422
5423 !! test
5424 Nested lists 6 (both elements empty)
5425 !! input
5426 *
5427 **
5428 !! result
5429 <ul><li>
5430 <ul><li>
5431 </li></ul>
5432 </li></ul>
5433
5434 !! end
5435
5436 !! test
5437 Nested lists 7 (skip initial nesting levels)
5438 !! input
5439 *** foo
5440 !! result
5441 <ul><li><ul><li><ul><li> foo
5442 </li></ul>
5443 </li></ul>
5444 </li></ul>
5445
5446 !! end
5447
5448 !! test
5449 Nested lists 8 (multiple nesting transitions)
5450 !! input
5451 * foo
5452 *** bar
5453 ** baz
5454 * boo
5455 !! result
5456 <ul><li> foo
5457 <ul><li><ul><li> bar
5458 </li></ul>
5459 </li><li> baz
5460 </li></ul>
5461 </li><li> boo
5462 </li></ul>
5463
5464 !! end
5465
5466 !! test
5467 1. Lists with start-of-line-transparent tokens before bullets: Comments
5468 !! input
5469 *foo
5470 *<!--cmt-->bar
5471 <!--cmt-->*baz
5472 !! result
5473 <ul><li>foo
5474 </li><li>bar
5475 </li><li>baz
5476 </li></ul>
5477
5478 !! end
5479
5480 !! test
5481 2. Lists with start-of-line-transparent tokens before bullets: Template close
5482 !! input
5483 *foo {{echo|bar
5484 }}*baz
5485 !! result
5486 <ul><li>foo bar
5487 </li><li>baz
5488 </li></ul>
5489
5490 !! end
5491
5492 !! test
5493 List items are not parsed correctly following a <pre> block (bug 785)
5494 !! input
5495 * <pre>foo</pre>
5496 * <pre>bar</pre>
5497 * zar
5498 !! result
5499 <ul><li> <pre>foo</pre>
5500 </li><li> <pre>bar</pre>
5501 </li><li> zar
5502 </li></ul>
5503
5504 !! end
5505
5506 !! test
5507 List items from template
5508 !! input
5509
5510 {{inner list}}
5511 * item 2
5512
5513 * item 0
5514 {{inner list}}
5515 * item 2
5516
5517 * item 0
5518 * notSOL{{inner list}}
5519 * item 2
5520 !! result
5521 <ul><li> item 1
5522 </li><li> item 2
5523 </li></ul>
5524 <ul><li> item 0
5525 </li><li> item 1
5526 </li><li> item 2
5527 </li></ul>
5528 <ul><li> item 0
5529 </li><li> notSOL
5530 </li><li> item 1
5531 </li><li> item 2
5532 </li></ul>
5533
5534 !! end
5535
5536 !! test
5537 List interrupted by empty line or heading
5538 !! input
5539 * foo
5540
5541 ** bar
5542 == A heading ==
5543 * Another list item
5544 !! result
5545 <ul><li> foo
5546 </li></ul>
5547 <ul><li><ul><li> bar
5548 </li></ul>
5549 </li></ul>
5550 <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>
5551 <ul><li> Another list item
5552 </li></ul>
5553
5554 !!end
5555
5556 !!test
5557 Multiple list tags generated by templates
5558 !!input
5559 {{echo|<li>}}a
5560 {{echo|<li>}}b
5561 {{echo|<li>}}c
5562 !!result
5563 <li>a
5564 <li>b
5565 <li>c</li>
5566 </li>
5567 </li>
5568
5569 !!end
5570
5571 !!test
5572 Single-comment whitespace lines dont break lists, and so do multi-comment whitespace lines
5573 !!input
5574 *a
5575 <!--This line will NOT split the list-->
5576 *b
5577 <!--This line will NOT split the list either-->
5578 *c
5579 <!--foo--> <!----> <!--This line NOT split the list either-->
5580 *d
5581 !!result
5582 <ul><li>a
5583 </li><li>b
5584 </li><li>c
5585 </li><li>d
5586 </li></ul>
5587
5588 !!end
5589
5590 !!test
5591 Test the li-hack
5592 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5593 !!options
5594 parsoid=wt2html,wt2wt
5595 !!input
5596 * foo
5597 * <li>li-hack
5598 * {{echo|<li>templated li-hack}}
5599 * <!--foo--> <li> unsupported li-hack with preceding comments
5600
5601 <ul>
5602 <li><li>not a li-hack
5603 </li>
5604 </ul>
5605 !!result
5606 <ul><li> foo</li>
5607 <li>li-hack</li>
5608 <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>
5609 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5610
5611 <ul>
5612 <li></li><li>not a li-hack
5613 </li>
5614 </ul>
5615 !!end
5616
5617 !! test
5618 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5619 !! options
5620 parsoid
5621 !! input
5622 # foo
5623 ## bar
5624 * foo
5625 ** bar
5626 : foo
5627 :: bar
5628 !! result
5629 <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>
5630 !! end
5631
5632 !! test
5633 Parsoid: Test of whitespace serialization with Templated bullets
5634 !! options
5635 parsoid
5636 !! input
5637 * {{bullet}}
5638 !! result
5639 <ul>
5640 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5641 </ul>
5642 !! end
5643
5644 # ------------------------------------------------------------------------
5645 # The next set of tests are about Parsoid's ability to handle badly nested
5646 # tags (parse, minimize scope of fixup, and roundtrip back)
5647 # ------------------------------------------------------------------------
5648
5649 !! test
5650 Unbalanced closing block tags break a list
5651 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5652 !! options
5653 parsoid
5654 !! input
5655 <div>
5656 *a</div><div>
5657 *b</div>
5658 !! result
5659 <div>
5660 <ul><li>a
5661 </li></ul></div><div>
5662 <ul><li>b
5663 </li></ul></div>
5664 !! end
5665
5666 !! test
5667 Unbalanced closing non-block tags don't break a list
5668 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5669 !! options
5670 parsoid
5671 !! input
5672 <span>
5673 *a</span><span>
5674 *b</span>
5675 !! result
5676 <p><span></span>
5677 </p>
5678 <ul><li>a<span></span>
5679 </li><li>b
5680 </li></ul>
5681 !! end
5682
5683 !! test
5684 Unclosed formatting tags that straddle lists are closed and reopened
5685 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5686 !! options
5687 parsoid
5688 !! input
5689 # <s> a
5690 # b </s>
5691 !! result
5692 <ol><li> <s> a </s>
5693 </li><li> <s> b </s>
5694 </li></ol>
5695 !! end
5696
5697 !!test
5698 List embedded in a non-block tag
5699 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5700 !! options
5701 parsoid
5702 !!input
5703 <small>
5704 * foo
5705 </small>
5706 !!result
5707 <p><small></small></p>
5708 <small>
5709 <ul>
5710 <li> foo</li>
5711 </ul>
5712 </small>
5713 <p><small></small></p>
5714 !!end
5715
5716 ###
5717 ### Magic Words
5718 ###
5719
5720 # Note that the current date is hard-coded as
5721 # 1970-01-01T00:02:03Z (a Thursday)
5722 # when running parser tests. The timezone is also fixed to GMT, so
5723 # local date will be identical to current date.
5724
5725 !! test
5726 Magic Word: {{CURRENTDAY}}
5727 !! input
5728 {{CURRENTDAY}}
5729 !! result
5730 <p>1
5731 </p>
5732 !! end
5733
5734 !! test
5735 Magic Word: {{CURRENTDAY2}}
5736 !! input
5737 {{CURRENTDAY2}}
5738 !! result
5739 <p>01
5740 </p>
5741 !! end
5742
5743 !! test
5744 Magic Word: {{CURRENTDAYNAME}}
5745 !! input
5746 {{CURRENTDAYNAME}}
5747 !! result
5748 <p>Thursday
5749 </p>
5750 !! end
5751
5752 !! test
5753 Magic Word: {{CURRENTDOW}}
5754 !! input
5755 {{CURRENTDOW}}
5756 !! result
5757 <p>4
5758 </p>
5759 !! end
5760
5761 !! test
5762 Magic Word: {{CURRENTMONTH}}
5763 !! input
5764 {{CURRENTMONTH}}
5765 !! result
5766 <p>01
5767 </p>
5768 !! end
5769
5770 !! test
5771 Magic Word: {{CURRENTMONTH1}}
5772 !! input
5773 {{CURRENTMONTH1}}
5774 !! result
5775 <p>1
5776 </p>
5777 !! end
5778
5779 !! test
5780 Magic Word: {{CURRENTMONTHABBREV}}
5781 !! input
5782 {{CURRENTMONTHABBREV}}
5783 !! result
5784 <p>Jan
5785 </p>
5786 !! end
5787
5788 !! test
5789 Magic Word: {{CURRENTMONTHNAME}}
5790 !! input
5791 {{CURRENTMONTHNAME}}
5792 !! result
5793 <p>January
5794 </p>
5795 !! end
5796
5797 !! test
5798 Magic Word: {{CURRENTMONTHNAMEGEN}}
5799 !! input
5800 {{CURRENTMONTHNAMEGEN}}
5801 !! result
5802 <p>January
5803 </p>
5804 !! end
5805
5806 !! test
5807 Magic Word: {{CURRENTTIME}}
5808 !! input
5809 {{CURRENTTIME}}
5810 !! result
5811 <p>00:02
5812 </p>
5813 !! end
5814
5815 !! test
5816 Magic Word: {{CURRENTHOUR}}
5817 !! input
5818 {{CURRENTHOUR}}
5819 !! result
5820 <p>00
5821 </p>
5822 !! end
5823
5824 !! test
5825 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5826 !! input
5827 {{CURRENTWEEK}}
5828 !! result
5829 <p>1
5830 </p>
5831 !! end
5832
5833 !! test
5834 Magic Word: {{CURRENTYEAR}}
5835 !! input
5836 {{CURRENTYEAR}}
5837 !! result
5838 <p>1970
5839 </p>
5840 !! end
5841
5842 !! test
5843 Magic Word: {{CURRENTTIMESTAMP}}
5844 !! input
5845 {{CURRENTTIMESTAMP}}
5846 !! result
5847 <p>19700101000203
5848 </p>
5849 !! end
5850
5851 !! test
5852 Magic Words LOCAL (UTC)
5853 !! input
5854 * {{LOCALMONTH}}
5855 * {{LOCALMONTH1}}
5856 * {{LOCALMONTHNAME}}
5857 * {{LOCALMONTHNAMEGEN}}
5858 * {{LOCALMONTHABBREV}}
5859 * {{LOCALDAY}}
5860 * {{LOCALDAY2}}
5861 * {{LOCALDAYNAME}}
5862 * {{LOCALYEAR}}
5863 * {{LOCALTIME}}
5864 * {{LOCALHOUR}}
5865 * {{LOCALWEEK}}
5866 * {{LOCALDOW}}
5867 * {{LOCALTIMESTAMP}}
5868 !! result
5869 <ul><li> 01
5870 </li><li> 1
5871 </li><li> January
5872 </li><li> January
5873 </li><li> Jan
5874 </li><li> 1
5875 </li><li> 01
5876 </li><li> Thursday
5877 </li><li> 1970
5878 </li><li> 00:02
5879 </li><li> 00
5880 </li><li> 1
5881 </li><li> 4
5882 </li><li> 19700101000203
5883 </li></ul>
5884
5885 !! end
5886
5887 !! test
5888 Magic Word: {{FULLPAGENAME}}
5889 !! options
5890 title=[[User:Ævar Arnfjörð Bjarmason]]
5891 !! input
5892 {{FULLPAGENAME}}
5893 !! result
5894 <p>User:Ævar Arnfjörð Bjarmason
5895 </p>
5896 !! end
5897
5898 !! test
5899 Magic Word: {{FULLPAGENAMEE}}
5900 !! options
5901 title=[[User:Ævar Arnfjörð Bjarmason]]
5902 !! input
5903 {{FULLPAGENAMEE}}
5904 !! result
5905 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5906 </p>
5907 !! end
5908
5909 !! test
5910 Magic Word: {{TALKSPACE}}
5911 !! options
5912 title=[[User:Ævar Arnfjörð Bjarmason]]
5913 !! input
5914 {{TALKSPACE}}
5915 !! result
5916 <p>User talk
5917 </p>
5918 !! end
5919
5920 !! test
5921 Magic Word: {{TALKSPACE}}, same namespace
5922 !! options
5923 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5924 !! input
5925 {{TALKSPACE}}
5926 !! result
5927 <p>User talk
5928 </p>
5929 !! end
5930
5931 !! test
5932 Magic Word: {{TALKSPACE}}, main namespace
5933 !! options
5934 title=[[Parser Test]]
5935 !! input
5936 {{TALKSPACE}}
5937 !! result
5938 <p>Talk
5939 </p>
5940 !! end
5941
5942 !! test
5943 Magic Word: {{TALKSPACEE}}
5944 !! options
5945 title=[[User:Ævar Arnfjörð Bjarmason]]
5946 !! input
5947 {{TALKSPACEE}}
5948 !! result
5949 <p>User_talk
5950 </p>
5951 !! end
5952
5953 !! test
5954 Magic Word: {{SUBJECTSPACE}}
5955 !! options
5956 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5957 !! input
5958 {{SUBJECTSPACE}}
5959 !! result
5960 <p>User
5961 </p>
5962 !! end
5963
5964 !! test
5965 Magic Word: {{SUBJECTSPACE}}, same namespace
5966 !! options
5967 title=[[User:Ævar Arnfjörð Bjarmason]]
5968 !! input
5969 {{SUBJECTSPACE}}
5970 !! result
5971 <p>User
5972 </p>
5973 !! end
5974
5975 !! test
5976 Magic Word: {{SUBJECTSPACE}}, main namespace
5977 !! options
5978 title=[[Parser Test]]
5979 !! input
5980 {{SUBJECTSPACE}}
5981 !! result
5982
5983 !! end
5984
5985 !! test
5986 Magic Word: {{SUBJECTSPACEE}}
5987 !! options
5988 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5989 !! input
5990 {{SUBJECTSPACEE}}
5991 !! result
5992 <p>User
5993 </p>
5994 !! end
5995
5996 !! test
5997 Magic Word: {{NAMESPACE}}
5998 !! options
5999 title=[[User:Ævar Arnfjörð Bjarmason]]
6000 !! input
6001 {{NAMESPACE}}
6002 !! result
6003 <p>User
6004 </p>
6005 !! end
6006
6007 !! test
6008 Magic Word: {{NAMESPACEE}}
6009 !! options
6010 title=[[User:Ævar Arnfjörð Bjarmason]]
6011 !! input
6012 {{NAMESPACEE}}
6013 !! result
6014 <p>User
6015 </p>
6016 !! end
6017
6018 !! test
6019 Magic Word: {{NAMESPACENUMBER}}
6020 !! options
6021 title=[[User:Ævar Arnfjörð Bjarmason]]
6022 !! input
6023 {{NAMESPACENUMBER}}
6024 !! result
6025 <p>2
6026 </p>
6027 !! end
6028
6029 !! test
6030 Magic Word: {{SUBPAGENAME}}
6031 !! options
6032 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6033 !! input
6034 {{SUBPAGENAME}}
6035 !! result
6036 <p>sub ö
6037 </p>
6038 !! end
6039
6040 !! test
6041 Magic Word: {{SUBPAGENAMEE}}
6042 !! options
6043 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6044 !! input
6045 {{SUBPAGENAMEE}}
6046 !! result
6047 <p>sub_%C3%B6
6048 </p>
6049 !! end
6050
6051 !! test
6052 Magic Word: {{ROOTPAGENAME}}
6053 !! options
6054 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6055 !! input
6056 {{ROOTPAGENAME}}
6057 !! result
6058 <p>Ævar Arnfjörð Bjarmason
6059 </p>
6060 !! end
6061
6062 !! test
6063 Magic Word: {{ROOTPAGENAMEE}}
6064 !! options
6065 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6066 !! input
6067 {{ROOTPAGENAMEE}}
6068 !! result
6069 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6070 </p>
6071 !! end
6072
6073 !! test
6074 Magic Word: {{BASEPAGENAME}}
6075 !! options
6076 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6077 !! input
6078 {{BASEPAGENAME}}
6079 !! result
6080 <p>Ævar Arnfjörð Bjarmason
6081 </p>
6082 !! end
6083
6084 !! test
6085 Magic Word: {{BASEPAGENAMEE}}
6086 !! options
6087 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6088 !! input
6089 {{BASEPAGENAMEE}}
6090 !! result
6091 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6092 </p>
6093 !! end
6094
6095 !! test
6096 Magic Word: {{TALKPAGENAME}}
6097 !! options
6098 title=[[User:Ævar Arnfjörð Bjarmason]]
6099 !! input
6100 {{TALKPAGENAME}}
6101 !! result
6102 <p>User talk:Ævar Arnfjörð Bjarmason
6103 </p>
6104 !! end
6105
6106 !! test
6107 Magic Word: {{TALKPAGENAMEE}}
6108 !! options
6109 title=[[User:Ævar Arnfjörð Bjarmason]]
6110 !! input
6111 {{TALKPAGENAMEE}}
6112 !! result
6113 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6114 </p>
6115 !! end
6116
6117 !! test
6118 Magic Word: {{SUBJECTPAGENAME}}
6119 !! options
6120 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6121 !! input
6122 {{SUBJECTPAGENAME}}
6123 !! result
6124 <p>User:Ævar Arnfjörð Bjarmason
6125 </p>
6126 !! end
6127
6128 !! test
6129 Magic Word: {{SUBJECTPAGENAMEE}}
6130 !! options
6131 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6132 !! input
6133 {{SUBJECTPAGENAMEE}}
6134 !! result
6135 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6136 </p>
6137 !! end
6138
6139 !! test
6140 Magic Word: {{NUMBEROFFILES}}
6141 !! input
6142 {{NUMBEROFFILES}}
6143 !! result
6144 <p>4
6145 </p>
6146 !! end
6147
6148 !! test
6149 Magic Word: {{PAGENAME}}
6150 !! options
6151 title=[[User:Ævar Arnfjörð Bjarmason]]
6152 !! input
6153 {{PAGENAME}}
6154 !! result
6155 <p>Ævar Arnfjörð Bjarmason
6156 </p>
6157 !! end
6158
6159 !! test
6160 Magic Word: {{PAGENAME}} with metacharacters
6161 !! options
6162 title=[['foo & bar = baz']]
6163 !! input
6164 ''{{PAGENAME}}''
6165 !! result
6166 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6167 </p>
6168 !! end
6169
6170 !! test
6171 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6172 !! options
6173 title=[[*RFC 1234 http://example.com/]]
6174 !! input
6175 {{PAGENAME}}
6176 !! result
6177 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6178 </p>
6179 !! end
6180
6181 !! test
6182 Magic Word: {{PAGENAMEE}}
6183 !! options
6184 title=[[User:Ævar Arnfjörð Bjarmason]]
6185 !! input
6186 {{PAGENAMEE}}
6187 !! result
6188 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6189 </p>
6190 !! end
6191
6192 !! test
6193 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6194 !! options
6195 title=[[*RFC 1234 http://example.com/]]
6196 !! input
6197 {{PAGENAMEE}}
6198 !! result
6199 <p>&#42;RFC_1234_http&#58;//example.com/
6200 </p>
6201 !! end
6202
6203 !! test
6204 Magic Word: {{REVISIONID}}
6205 !! input
6206 {{REVISIONID}}
6207 !! result
6208 <p>1337
6209 </p>
6210 !! end
6211
6212 !! test
6213 Magic Word: {{SCRIPTPATH}}
6214 !! input
6215 {{SCRIPTPATH}}
6216 !! result
6217 <p>/
6218 </p>
6219 !! end
6220
6221 !! test
6222 Magic Word: {{STYLEPATH}}
6223 !! input
6224 {{STYLEPATH}}
6225 !! result
6226 <p>/skins
6227 </p>
6228 !! end
6229
6230 !! test
6231 Magic Word: {{SERVER}}
6232 !! input
6233 {{SERVER}}
6234 !! result
6235 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6236 </p>
6237 !! end
6238
6239 !! test
6240 Magic Word: {{SERVERNAME}}
6241 !! input
6242 {{SERVERNAME}}
6243 !! result
6244 <p>example.org
6245 </p>
6246 !! end
6247
6248 !! test
6249 Magic Word: {{SITENAME}}
6250 !! input
6251 {{SITENAME}}
6252 !! result
6253 <p>MediaWiki
6254 </p>
6255 !! end
6256
6257 !! test
6258 Case-sensitive magic words, when cased differently, should just be template transclusions
6259 !! input
6260 {{CurrentMonth}}
6261 {{currentday}}
6262 {{cURreNTweEK}}
6263 {{currentHour}}
6264 !! result
6265 <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>
6266 <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>
6267 <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>
6268 <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>
6269 </p>
6270 !! end
6271
6272 !! test
6273 Case-insensitive magic words should still work with weird casing.
6274 !! input
6275 {{sErVeRNaMe}}
6276 {{LCFirst:AOEU}}
6277 {{ucFIRST:aoeu}}
6278 {{SERver}}
6279 !! result
6280 <p>example.org
6281 aOEU
6282 Aoeu
6283 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6284 </p>
6285 !! end
6286
6287 !! test
6288 Namespace 1 {{ns:1}}
6289 !! input
6290 {{ns:1}}
6291 !! result
6292 <p>Talk
6293 </p>
6294 !! end
6295
6296 !! test
6297 Namespace 1 {{ns:01}}
6298 !! input
6299 {{ns:01}}
6300 !! result
6301 <p>Talk
6302 </p>
6303 !! end
6304
6305 !! test
6306 Namespace 0 {{ns:0}} (bug 4783)
6307 !! input
6308 {{ns:0}}
6309 !! result
6310
6311 !! end
6312
6313 !! test
6314 Namespace 0 {{ns:00}} (bug 4783)
6315 !! input
6316 {{ns:00}}
6317 !! result
6318
6319 !! end
6320
6321 !! test
6322 Namespace -1 {{ns:-1}}
6323 !! input
6324 {{ns:-1}}
6325 !! result
6326 <p>Special
6327 </p>
6328 !! end
6329
6330 !! test
6331 Namespace User {{ns:User}}
6332 !! input
6333 {{ns:User}}
6334 !! result
6335 <p>User
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 User talk {{ns:uSeR tAlK}}
6350 !! input
6351 {{ns:uSeR tAlK}}
6352 !! result
6353 <p>User talk
6354 </p>
6355 !! end
6356
6357 !! test
6358 Namespace File {{ns:File}}
6359 !! input
6360 {{ns:File}}
6361 !! result
6362 <p>File
6363 </p>
6364 !! end
6365
6366 !! test
6367 Namespace File {{ns:Image}}
6368 !! input
6369 {{ns:Image}}
6370 !! result
6371 <p>File
6372 </p>
6373 !! end
6374
6375 !! test
6376 Namespace (lang=de) Benutzer {{ns:User}}
6377 !! options
6378 language=de
6379 !! input
6380 {{ns:User}}
6381 !! result
6382 <p>Benutzer
6383 </p>
6384 !! end
6385
6386 !! test
6387 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6388 !! options
6389 language=de
6390 !! input
6391 {{ns:3}}
6392 !! result
6393 <p>Benutzer Diskussion
6394 </p>
6395 !! end
6396
6397
6398 !! test
6399 Urlencode
6400 !! input
6401 {{urlencode:hi world?!}}
6402 {{urlencode:hi world?!|WIKI}}
6403 {{urlencode:hi world?!|PATH}}
6404 {{urlencode:hi world?!|QUERY}}
6405 !! result
6406 <p>hi+world%3F%21
6407 hi_world%3F!
6408 hi%20world%3F%21
6409 hi+world%3F%21
6410 </p>
6411 !! end
6412
6413 ###
6414 ### Magic links
6415 ###
6416 !! test
6417 Magic links: internal link to RFC (bug 479)
6418 !! input
6419 [[RFC 123]]
6420 !! result
6421 <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>
6422 </p>
6423 !! end
6424
6425 !! test
6426 Magic links: RFC (bug 479)
6427 !! input
6428 RFC 822
6429 !! result
6430 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6431 </p>
6432 !! end
6433
6434 !! test
6435 Magic links: ISBN (bug 1937)
6436 !! input
6437 ISBN 0-306-40615-2
6438 !! result
6439 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6440 </p>
6441 !! end
6442
6443 !! test
6444 Magic links: PMID incorrectly converts space to underscore
6445 !! input
6446 PMID 1234
6447 !! result
6448 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6449 </p>
6450 !! end
6451
6452 ###
6453 ### Templates
6454 ####
6455
6456 !! test
6457 Nonexistent template
6458 !! input
6459 {{thistemplatedoesnotexist}}
6460 !! result
6461 <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>
6462 </p>
6463 !! end
6464
6465 !! test
6466 Template with invalid target containing tags
6467 !! input
6468 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6469 !! result
6470 <p>{{a<b>b</b>|foo|a=b|a = b}}
6471 </p>
6472 !! end
6473
6474 !! test
6475 Template with invalid target containing unclosed tag
6476 !! input
6477 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6478 !! result
6479 <p>{{a<b>|foo|a=b|a = b}}</b>
6480 </p>
6481 !! end
6482
6483 !! article
6484 Template:test
6485 !! text
6486 This is a test template
6487 !! endarticle
6488
6489 !! test
6490 Simple template
6491 !! input
6492 {{test}}
6493 !! result
6494 <p>This is a test template
6495 </p>
6496 !! end
6497
6498 !! test
6499 Template with explicit namespace
6500 !! input
6501 {{Template:test}}
6502 !! result
6503 <p>This is a test template
6504 </p>
6505 !! end
6506
6507
6508 !! article
6509 Template:paramtest
6510 !! text
6511 This is a test template with parameter {{{param}}}
6512 !! endarticle
6513
6514 !! test
6515 Template parameter
6516 !! input
6517 {{paramtest|param=foo}}
6518 !! result
6519 <p>This is a test template with parameter foo
6520 </p>
6521 !! end
6522
6523 !! article
6524 Template:paramtestnum
6525 !! text
6526 [[{{{1}}}|{{{2}}}]]
6527 !! endarticle
6528
6529 !! test
6530 Template unnamed parameter
6531 !! input
6532 {{paramtestnum|Main Page|the main page}}
6533 !! result
6534 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6535 </p>
6536 !! end
6537
6538 !! article
6539 Template:templatesimple
6540 !! text
6541 (test)
6542 !! endarticle
6543
6544 !! article
6545 Template:templateredirect
6546 !! text
6547 #redirect [[Template:templatesimple]]
6548 !! endarticle
6549
6550 !! article
6551 Template:templateasargtestnum
6552 !! text
6553 {{{{{1}}}}}
6554 !! endarticle
6555
6556 !! article
6557 Template:templateasargtest
6558 !! text
6559 {{template{{{templ}}}}}
6560 !! endarticle
6561
6562 !! article
6563 Template:templateasargtest2
6564 !! text
6565 {{{{{templ}}}}}
6566 !! endarticle
6567
6568 !! test
6569 Template with template name as unnamed argument
6570 !! input
6571 {{templateasargtestnum|templatesimple}}
6572 !! result
6573 <p>(test)
6574 </p>
6575 !! end
6576
6577 !! test
6578 Template with template name as argument
6579 !! input
6580 {{templateasargtest|templ=simple}}
6581 !! result
6582 <p>(test)
6583 </p>
6584 !! end
6585
6586 !! test
6587 Template with template name as argument (2)
6588 !! input
6589 {{templateasargtest2|templ=templatesimple}}
6590 !! result
6591 <p>(test)
6592 </p>
6593 !! end
6594
6595 !! article
6596 Template:templateasargtestdefault
6597 !! text
6598 {{{{{templ|templatesimple}}}}}
6599 !! endarticle
6600
6601 !! article
6602 Template:templa
6603 !! text
6604 '''templ'''
6605 !! endarticle
6606
6607 !! test
6608 Template with default value
6609 !! input
6610 {{templateasargtestdefault}}
6611 !! result
6612 <p>(test)
6613 </p>
6614 !! end
6615
6616 !! test
6617 Template with default value (value set)
6618 !! input
6619 {{templateasargtestdefault|templ=templa}}
6620 !! result
6621 <p><b>templ</b>
6622 </p>
6623 !! end
6624
6625 !! test
6626 Template redirect
6627 !! input
6628 {{templateredirect}}
6629 !! result
6630 <p>(test)
6631 </p>
6632 !! end
6633
6634 !! test
6635 Template with argument in separate line
6636 !! input
6637 {{ templateasargtest |
6638 templ = simple }}
6639 !! result
6640 <p>(test)
6641 </p>
6642 !! end
6643
6644 !! test
6645 Template with complex template as argument
6646 !! input
6647 {{paramtest|
6648 param ={{ templateasargtest |
6649 templ = simple }}}}
6650 !! result
6651 <p>This is a test template with parameter (test)
6652 </p>
6653 !! end
6654
6655 !! test
6656 Template with thumb image (with link in description)
6657 !! input
6658 {{paramtest|
6659 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6660 !! result
6661 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>
6662
6663 !! end
6664
6665 !! article
6666 Template:complextemplate
6667 !! text
6668 {{{1}}} {{paramtest|
6669 param ={{{param}}}}}
6670 !! endarticle
6671
6672 !! test
6673 Template with complex arguments
6674 !! input
6675 {{complextemplate|
6676 param ={{ templateasargtest |
6677 templ = simple }}|[[Template:complextemplate|link]]}}
6678 !! result
6679 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6680 </p>
6681 !! end
6682
6683 !! test
6684 BUG 553: link with two variables in a piped link
6685 !! input
6686 {|
6687 |[[{{{1}}}|{{{2}}}]]
6688 |}
6689 !! result
6690 <table>
6691 <tr>
6692 <td>[[{{{1}}}|{{{2}}}]]
6693 </td></tr></table>
6694
6695 !! end
6696
6697 !! test
6698 Magic variable as template parameter
6699 !! input
6700 {{paramtest|param={{SITENAME}}}}
6701 !! result
6702 <p>This is a test template with parameter MediaWiki
6703 </p>
6704 !! end
6705
6706 !! article
6707 Template:linktest
6708 !! text
6709 [[{{{param}}}|link]]
6710 !! endarticle
6711
6712 !! test
6713 Template parameter as link source
6714 !! input
6715 {{linktest|param=Main Page}}
6716 !! result
6717 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6718 </p>
6719 !! end
6720
6721 !!test
6722 Template-generated attribute string (k='v')
6723 !!input
6724 <span {{attr_str|id|v1}}>bar</span>
6725 !!result
6726 <p><span id="v1">bar</span>
6727 </p>
6728 !!end
6729
6730 !!article
6731 Template:paramtest2
6732 !! text
6733 including another template, {{paramtest|param={{{arg}}}}}
6734 !! endarticle
6735
6736 !! test
6737 Template passing argument to another template
6738 !! input
6739 {{paramtest2|arg='hmm'}}
6740 !! result
6741 <p>including another template, This is a test template with parameter 'hmm'
6742 </p>
6743 !! end
6744
6745 !! article
6746 Template:Linktest2
6747 !! text
6748 Main Page
6749 !! endarticle
6750
6751 !! test
6752 Template as link source
6753 !! input
6754 [[{{linktest2}}]]
6755
6756 [[{{linktest2}}|Main Page]]
6757
6758 [[{{linktest2}}]]Page
6759 !! result
6760 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6761 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6762 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6763 </p>
6764 !! end
6765
6766
6767 !! article
6768 Template:loop1
6769 !! text
6770 {{loop2}}
6771 !! endarticle
6772
6773 !! article
6774 Template:loop2
6775 !! text
6776 {{loop1}}
6777 !! endarticle
6778
6779 !! test
6780 Template infinite loop
6781 !! input
6782 {{loop1}}
6783 !! result
6784 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6785 </p>
6786 !! end
6787
6788 !! test
6789 Template from main namespace
6790 !! input
6791 {{:Main Page}}
6792 !! result
6793 <p>blah blah
6794 </p>
6795 !! end
6796
6797 !! article
6798 Template:table
6799 !! text
6800 {|
6801 | 1 || 2
6802 |-
6803 | 3 || 4
6804 |}
6805 !! endarticle
6806
6807 !! test
6808 BUG 529: Template with table, not included at beginning of line
6809 !! input
6810 foo {{table}}
6811 !! result
6812 <p>foo
6813 </p>
6814 <table>
6815 <tr>
6816 <td> 1 </td>
6817 <td> 2
6818 </td></tr>
6819 <tr>
6820 <td> 3 </td>
6821 <td> 4
6822 </td></tr></table>
6823
6824 !! end
6825
6826 !! test
6827 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6828 !! input
6829 foo
6830 {{table}}
6831 !! result
6832 <p>foo
6833 </p>
6834 <table>
6835 <tr>
6836 <td> 1 </td>
6837 <td> 2
6838 </td></tr>
6839 <tr>
6840 <td> 3 </td>
6841 <td> 4
6842 </td></tr></table>
6843
6844 !! end
6845
6846 !! test
6847 BUG 41: Template parameters shown as broken links
6848 !! input
6849 {{{parameter}}}
6850 !! result
6851 <p>{{{parameter}}}
6852 </p>
6853 !! end
6854
6855 !! test
6856 Template with targets containing wikilinks
6857 !! input
6858 {{[[foo]]}}
6859
6860 {{[[{{echo|foo}}]]}}
6861
6862 {{{{echo|[[foo}}]]}}
6863 !! result
6864 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6865 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6866 </p><p>{{[[foo}}]]
6867 </p>
6868 !! end
6869
6870 !! article
6871 Template:MSGNW test
6872 !! text
6873 ''None'' of '''this''' should be
6874 * interpreted
6875 but rather passed unmodified
6876 {{test}}
6877 !! endarticle
6878
6879 # hmm, fix this or just deprecate msgnw and document its behavior?
6880 !! test
6881 msgnw keyword
6882 !! options
6883 disabled
6884 !! input
6885 {{msgnw:MSGNW test}}
6886 !! result
6887 <p>''None'' of '''this''' should be
6888 * interpreted
6889 but rather passed unmodified
6890 {{test}}
6891 </p>
6892 !! end
6893
6894 !! test
6895 int keyword
6896 !! input
6897 {{int:youhavenewmessages|lots of money|not!}}
6898 !! result
6899 <p>You have lots of money (not!).
6900 </p>
6901 !! end
6902
6903 !! article
6904 Template:Includes
6905 !! text
6906 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6907 !! endarticle
6908
6909 !! test
6910 <includeonly> and <noinclude> being included
6911 !! input
6912 {{Includes}}
6913 !! result
6914 <p>Foobar
6915 </p>
6916 !! end
6917
6918 !! article
6919 Template:Includes2
6920 !! text
6921 <onlyinclude>Foo</onlyinclude>bar
6922 !! endarticle
6923
6924 !! test
6925 <onlyinclude> being included
6926 !! input
6927 {{Includes2}}
6928 !! result
6929 <p>Foo
6930 </p>
6931 !! end
6932
6933
6934 !! article
6935 Template:Includes3
6936 !! text
6937 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6938 !! endarticle
6939
6940 !! test
6941 <onlyinclude> and <includeonly> being included
6942 !! input
6943 {{Includes3}}
6944 !! result
6945 <p>Foo
6946 </p>
6947 !! end
6948
6949 !! test
6950 <includeonly> and <noinclude> on a page
6951 !! input
6952 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6953 !! result
6954 <p>Foozar
6955 </p>
6956 !! end
6957
6958 !! test
6959 Un-closed <noinclude>
6960 !! input
6961 <noinclude>
6962 !! result
6963 !! end
6964
6965 !! test
6966 <onlyinclude> on a page
6967 !! input
6968 <onlyinclude>Foo</onlyinclude>bar
6969 !! result
6970 <p>Foobar
6971 </p>
6972 !! end
6973
6974 !! test
6975 Un-closed <onlyinclude>
6976 !! input
6977 <onlyinclude>
6978 !! result
6979 !! end
6980
6981 !!test
6982 Self-closed noinclude, includeonly, onlyinclude tags
6983 !!input
6984 <noinclude />
6985 <includeonly />
6986 <onlyinclude />
6987 !!result
6988 <p><br />
6989 </p>
6990 !!end
6991
6992 !!test
6993 Unbalanced includeonly and noinclude tags
6994 !!input
6995 {|
6996 |a</noinclude>
6997 |b</noinclude></noinclude>
6998 |c</noinclude></includeonly>
6999 |d</includeonly></includeonly>
7000 |}
7001 !!result
7002 <table>
7003 <tr>
7004 <td>a
7005 </td>
7006 <td>b
7007 </td>
7008 <td>c&lt;/includeonly&gt;
7009 </td>
7010 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7011 </td></tr></table>
7012
7013 !!end
7014
7015 !! article
7016 Template:Includeonly section
7017 !! text
7018 <includeonly>
7019 ==Includeonly section==
7020 </includeonly>
7021 ==Section T-1==
7022 !!endarticle
7023
7024 !! test
7025 Bug 6563: Edit link generation for section shown by <includeonly>
7026 !! input
7027 {{includeonly section}}
7028 !! result
7029 <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>
7030 <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>
7031
7032 !! end
7033
7034 # Uses same input as the contents of [[Template:Includeonly section]]
7035 !! test
7036 Bug 6563: Section extraction for section shown by <includeonly>
7037 !! options
7038 section=T-2
7039 !! input
7040 <includeonly>
7041 ==Includeonly section==
7042 </includeonly>
7043 ==Section T-2==
7044 !! result
7045 ==Section T-2==
7046 !! end
7047
7048 !! test
7049 Bug 6563: Edit link generation for section suppressed by <includeonly>
7050 !! input
7051 <includeonly>
7052 ==Includeonly section==
7053 </includeonly>
7054 ==Section 1==
7055 !! result
7056 <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>
7057
7058 !! end
7059
7060 !! test
7061 Bug 6563: Section extraction for section suppressed by <includeonly>
7062 !! options
7063 section=1
7064 !! input
7065 <includeonly>
7066 ==Includeonly section==
7067 </includeonly>
7068 ==Section 1==
7069 !! result
7070 ==Section 1==
7071 !! end
7072
7073 !! test
7074 Un-closed <includeonly>
7075 !! input
7076 <includeonly>
7077 !! result
7078 !! end
7079
7080 # TODO: test with DOM fragment reuse!
7081 !! test
7082 Parsoid: DOM fragment reuse
7083 !! options
7084 parsoid=wt2wt,wt2html
7085 !! input
7086 a{{echo|b<table></table>c}}d
7087
7088 a{{echo|b
7089 <table></table>
7090 c}}d
7091
7092 {{echo|a
7093
7094 <table></table>
7095
7096 b}}
7097 !! result
7098 a<span typeof="mw:Transclusion">b</span>
7099 <table></table><span>c</span>d
7100 <p typeof="mw:Transclusion">ab</p>
7101 <table></table>
7102 <p>cd</p>
7103 <p typeof="mw:Transclusion">a</p>
7104 <table></table>
7105 <p>b</p>
7106 !! end
7107
7108 ###
7109 ### <includeonly> and <noinclude> in attributes
7110 ###
7111 !!test
7112 0. includeonly around the entire attribute
7113 !!input
7114 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7115 !!result
7116 <p><span id="v2">bar</span>
7117 </p>
7118 !!end
7119
7120 !!test
7121 1. includeonly in html attr key
7122 !!input
7123 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7124 !!result
7125 <p><span id="foo">bar</span>
7126 </p>
7127 !!end
7128
7129 !!test
7130 2. includeonly in html attr value
7131 !!input
7132 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7133 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7134 !!result
7135 <p><span id="v1">bar</span>
7136 <span id="v1">bar</span>
7137 </p>
7138 !!end
7139
7140 !!test
7141 3. includeonly in part of an attr value
7142 !!input
7143 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7144 !!result
7145 <p><span style="color:red;">bar</span>
7146 </p>
7147 !!end
7148
7149 ###
7150 ### Testing parsing of templates where a template arg
7151 ### has the same name as the template itself.
7152 ###
7153
7154 !! article
7155 Template:quote
7156 !! text
7157 {{{quote|{{{1}}}}}}
7158 !! endarticle
7159
7160 !!test
7161 Templates: Template Name/Arg clash: 1. Use of positional param
7162 !!input
7163 {{quote|foo}}
7164 !!result
7165 <p>foo
7166 </p>
7167 !!end
7168
7169 !!test
7170 Templates: Template Name/Arg clash: 2. Use of named param
7171 !!input
7172 {{quote|quote=foo}}
7173 !!result
7174 <p>foo
7175 </p>
7176 !!end
7177
7178 !!test
7179 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7180 !!input
7181 {{quote|quote}}
7182 !!result
7183 <p>quote
7184 </p>
7185 !!end
7186
7187 ###
7188 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7189 ###
7190
7191 !!test
7192 Templates: 1. Simple use
7193 !!input
7194 {{echo|Foo}}
7195 !!result
7196 <p>Foo
7197 </p>
7198 !!end
7199
7200 !!test
7201 Templates: 2. Inside a block tag
7202 !!input
7203 <div>{{echo|Foo}}</div>
7204 !!result
7205 <div>Foo</div>
7206
7207 !!end
7208
7209 !!test
7210 Templates: P-wrapping: 1a. Templates on consecutive lines
7211 !!input
7212 {{echo|Foo}}
7213 {{echo|bar}}
7214 !!result
7215 <p>Foo
7216 bar
7217 </p>
7218 !!end
7219
7220 !!test
7221 Templates: P-wrapping: 1b. Templates on consecutive lines
7222 !!input
7223 Foo
7224
7225 {{echo|bar}}
7226 {{echo|baz}}
7227 !!result
7228 <p>Foo
7229 </p><p>bar
7230 baz
7231 </p>
7232 !!end
7233
7234 !!test
7235 Templates: P-wrapping: 1c. Templates on consecutive lines
7236 !!input
7237 {{echo|Foo}}
7238 {{echo|bar}} <div>baz</div>
7239 !!result
7240 <p>Foo
7241 </p>
7242 bar <div>baz</div>
7243
7244 !!end
7245
7246 !!test
7247 Templates: P-wrapping: 1d. Template preceded by comment-only line
7248 !!options
7249 parsoid=wt2html,wt2wt
7250 !!input
7251 <!-- foo -->
7252 {{echo|Bar}}
7253 !!result
7254 <!-- foo -->
7255 <p typeof="mw:Transclusion">Bar
7256 </p>
7257 !!end
7258
7259 !!test
7260 Templates: Inline Text: 1. Multiple tmeplate uses
7261 !!input
7262 {{echo|Foo}}bar{{echo|baz}}
7263 !!result
7264 <p>Foobarbaz
7265 </p>
7266 !!end
7267
7268 !!test
7269 Templates: Inline Text: 2. Back-to-back template uses
7270 !!input
7271 {{echo|Foo}}{{echo|bar}}
7272 !!result
7273 <p>Foobar
7274 </p>
7275 !!end
7276
7277 !!test
7278 Templates: Block Tags: 1. Multiple template uses
7279 !!input
7280 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7281 !!result
7282 <div>Foo</div><div>bar</div><div>baz</div>
7283
7284 !!end
7285
7286 !!test
7287 Templates: Block Tags: 2. Back-to-back template uses
7288 !!input
7289 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7290 !!result
7291 <div>Foo</div><div>bar</div>
7292
7293 !!end
7294
7295 !!test
7296 Templates: Links: 1. Simple example
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: 2. Generation of link href
7306 !!input
7307 [[{{echo|Foo}}|bar]]
7308 !!result
7309 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7310 </p>
7311 !!end
7312
7313 !!test
7314 Templates: Links: 3. Generation of part of a link href
7315 !!input
7316 [[Fo{{echo|o}}|bar]]
7317
7318 [[Foo{{echo|bar}}]]
7319
7320 [[Foo{{echo|bar}}baz]]
7321
7322 [[Foo{{echo|bar}}|bar]]
7323
7324 [[:Foo{{echo|bar}}]]
7325
7326 [[:Foo{{echo|bar}}|bar]]
7327 !!result
7328 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7329 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7330 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7331 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7332 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7333 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7334 </p>
7335 !!end
7336
7337 !!test
7338 Templates: Links: 4. Multiple templates generating link href
7339 !!input
7340 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7341 !!result
7342 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7343 </p>
7344 !!end
7345
7346 !!test
7347 Templates: Links: 5. Generation of link text
7348 !!input
7349 [[Foo|{{echo|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: Links: 5. Nested templates (only outermost template should be marked)
7357 !!input
7358 {{echo|[[{{echo|Foo}}|bar]]}}
7359 !!result
7360 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7361 </p>
7362 !!end
7363
7364 !!test
7365 Templates: HTML Tag: 1. Generation of HTML attr. key
7366 !!input
7367 <div {{echo|style}}="color:red;">foo</div>
7368 !!result
7369 <div style="color:red;">foo</div>
7370
7371 !!end
7372
7373 !!test
7374 Templates: HTML Tag: 2. Generation of HTML attr. value
7375 !!input
7376 <div 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: 3. Generation of HTML attr key and value
7384 !!input
7385 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7386 !!result
7387 <div style="color:red;">foo</div>
7388
7389 !!end
7390
7391 !!test
7392 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7393 !!input
7394 <div title="{{echo|This is a long title}} with just 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: 5. Generation of middle piece of HTML attr value
7402 !!input
7403 <div title="This is a long title with just {{echo|one piece}} 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: 6. Generation of end piece of HTML attr value
7411 !!input
7412 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7413 !!result
7414 <div title="This is a long title with just one piece templated">foo</div>
7415
7416 !!end
7417
7418 !!test
7419 Templates: HTML Tag: 7. Generation of partial attribute key string
7420 !!input
7421 <div st{{echo|yle}}="color:red;">foo</div>
7422 !!result
7423 <div style="color:red;">foo</div>
7424
7425 !!end
7426
7427 !!test
7428 Templates: HTML Tables: 1. Generating start of a HTML table
7429 !!input
7430 {{echo|<table><tr><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: 2a. Generating middle of a HTML table
7438 !!input
7439 <table><tr>{{echo|<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: 2b. Generating middle of a HTML table
7447 !!input
7448 <table>{{echo|<tr><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: 3. Generating end of a HTML table
7456 !!input
7457 <table><tr>{{echo|<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: 4a. Generating a single tag of a HTML table
7465 !!input
7466 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
7474 !!input
7475 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
7483 !!input
7484 <table><tr>{{echo|<td>}}foo</td></tr></table>
7485 !!result
7486 <table><tr><td>foo</td></tr></table>
7487
7488 !!end
7489
7490 !!test
7491 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7492 !!input
7493 <table><tr><td>foo{{echo|</td>}}</tr></table>
7494 !!result
7495 <table><tr><td>foo</td></tr></table>
7496
7497 !!end
7498
7499 !!test
7500 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7501 !!input
7502 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7503 !!result
7504 <table><tr><td>foo</td></tr></table>
7505
7506 !!end
7507
7508 !!test
7509 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7510 !!input
7511 <table><tr><td>foo</td></tr>{{echo|</table>}}
7512 !!result
7513 <table><tr><td>foo</td></tr></table>
7514
7515 !!end
7516
7517 !!test
7518 Templates: HTML Tables: 5. Proper fostering of categories from inside
7519 !!options
7520 parsoid=wt2html,wt2wt
7521 !!input
7522 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7523 <!--Two categories (Bug 50330)-->
7524 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7525 !!result
7526 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7527 <!--Two categories (Bug 50330)-->
7528 <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>
7529 !!end
7530
7531 !!test
7532 Templates: Wiki Tables: 1a. Fostering of entire template content
7533 !!input
7534 {|
7535 {{echo|a}}
7536 |}
7537 !!result
7538 <table>
7539 a
7540 <tr><td></td></tr></table>
7541
7542 !!end
7543
7544 !!test
7545 Templates: Wiki Tables: 1b. Fostering of entire template content
7546 !!input
7547 {|
7548 {{echo|<div>}}
7549 foo
7550 {{echo|</div>}}
7551 |}
7552 !!result
7553 <table>
7554 <div>
7555 <p>foo
7556 </p>
7557 </div>
7558 <tr><td></td></tr></table>
7559
7560 !!end
7561
7562 !!test
7563 Templates: Wiki Tables: 2. Fostering of partial template content
7564 !!input
7565 {|
7566 {{echo|a
7567 <div>b</div>}}
7568 |}
7569 !!result
7570 <table>
7571 a
7572 <div>b</div>
7573 <tr><td></td></tr></table>
7574
7575 !!end
7576
7577 !!test
7578 Templates: Wiki Tables: 3. td-content via multiple templates
7579 !!input
7580 {|
7581 {{echo|{{pipe}}a}}{{echo|b}}
7582 |}
7583 !!result
7584 <table>
7585 <tr>
7586 <td>ab
7587 </td></tr></table>
7588
7589 !!end
7590
7591 !!test
7592 Templates: Wiki Tables: 4. Templated tags, no content
7593 !!input
7594 {{tbl-start}}
7595 {{tbl-end}}
7596 !!result
7597 <table>
7598 <tr><td></td></tr></table>
7599
7600 !!end
7601
7602 !!test
7603 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7604 !!input
7605 {{tbl-start}}
7606 |foo
7607 {{tbl-end}}
7608 !!result
7609 <table>
7610 <tr>
7611 <td>foo
7612 </td></tr></table>
7613
7614 !!end
7615
7616 !!test
7617 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7618 !!input
7619 {{tbl-start}}
7620 {{!}}foo
7621 {{tbl-end}}
7622 !!result
7623 <table>
7624 <tr>
7625 <td>foo
7626 </td></tr></table>
7627
7628 !!end
7629
7630 !!test
7631 Templates: Lists: Multi-line list-items via templates
7632 !!input
7633 *{{echo|a {{nonexistent|
7634 unused}}}}
7635 *{{echo|b {{nonexistent|
7636 unused}}}}
7637 !!result
7638 <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>
7639 </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>
7640 </li></ul>
7641
7642 !!end
7643
7644 !!test
7645 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7646 !!input
7647 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7648 !!result
7649 <p><i>ab</i>c<i>d</i>e
7650 </p>
7651 !!end
7652
7653 !!test
7654 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7655 (PHP parser generates misnested html)
7656 !! options
7657 parsoid=wt2html,wt2wt
7658 !!input
7659 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7660 !!result
7661 <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>
7662 !!end
7663
7664 !!test
7665 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7666 (PHP parser generates misnested html)
7667 !! options
7668 parsoid=wt2html,wt2wt
7669 !!input
7670 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7671 !!result
7672 <div typeof="mw:Transclusion"><i>a</i></div>
7673 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7674 <div typeof="mw:Transclusion">e</div>
7675 !!end
7676
7677 !!test
7678 Templates: Ugly nesting: 4. Divs opened/closed across templates
7679 !!input
7680 a<div>b{{echo|c</div>d}}e
7681 !!result
7682 a<div>bc</div>de
7683
7684 !!end
7685
7686 !!test
7687 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7688 (Parsoid-centric)
7689 !! options
7690 parsoid
7691 !!input
7692 {|
7693 |{{echo|foo</table>}}
7694 |bar
7695 |}
7696 !!result
7697 <table typeof="mw:Transclusion">
7698 <tbody>
7699 <tr>
7700 <td>foo</td></tr></tbody></table><span>bar</span>
7701 !!end
7702
7703 !!test
7704 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7705 (Parsoid-centric)
7706 !! options
7707 parsoid
7708 !!input
7709 <table>
7710 <tr>
7711 <td>
7712 <table>
7713 <tr>
7714 <td>1. {{echo|foo </table>}}</td>
7715 <td> bar </td>
7716 <td>2. {{echo|baz </table>}}</td>
7717 </tr>
7718 <tr>
7719 <td>abc</td>
7720 </tr>
7721 </table>
7722 </td>
7723 </tr>
7724 <tr>
7725 <td>xyz</td>
7726 </tr>
7727 </table>
7728 !!result
7729 <table about="#mwt1" typeof="mw:Transclusion">
7730 <tbody><tr >
7731 <td >
7732 <table >
7733 <tbody><tr >
7734 <td >1. foo </td></tr></tbody></table></td>
7735 <td > bar </td>
7736 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7737 </span><span about="#mwt1">
7738
7739 abc</span><span about="#mwt1">
7740 </span><span about="#mwt1">
7741 </span><span about="#mwt1">
7742 </span><span about="#mwt1">
7743 </span><span about="#mwt1">
7744
7745 xyz</span><span about="#mwt1">
7746 </span><span about="#mwt1">
7747 </span>
7748 !!end
7749
7750 !! test
7751 Templates: Ugly templates: 3. newline-only template parameter
7752 !! input
7753 foo {{echo|
7754 }}
7755 !! result
7756 <p>foo
7757 </p>
7758 !! end
7759
7760 # This looks like a bug: a single newline triggers p/br for some reason.
7761 !! test
7762 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7763 !! input
7764 {{echo|
7765 }}
7766 !! result
7767 <p><br />
7768 </p>
7769 !! end
7770
7771
7772 !!test
7773 Parser Functions: 1. Simple example
7774 !!input
7775 {{uc:foo}}
7776 !!result
7777 <p>FOO
7778 </p>
7779 !!end
7780
7781 !!test
7782 Parser Functions: 2. Nested use (only outermost should be marked up)
7783 !!input
7784 {{uc:{{lc:FOO}}}}
7785 !!result
7786 <p>FOO
7787 </p>
7788 !!end
7789
7790 ###
7791 ### Pre-save transform tests
7792 ###
7793 !! test
7794 pre-save transform: subst:
7795 !! options
7796 PST
7797 !! input
7798 {{subst:test}}
7799 !! result
7800 This is a test template
7801 !! end
7802
7803 !! test
7804 pre-save transform: normal template
7805 !! options
7806 PST
7807 !! input
7808 {{test}}
7809 !! result
7810 {{test}}
7811 !! end
7812
7813 !! test
7814 pre-save transform: nonexistent template
7815 !! options
7816 PST
7817 !! input
7818 {{thistemplatedoesnotexist}}
7819 !! result
7820 {{thistemplatedoesnotexist}}
7821 !! end
7822
7823
7824 !! test
7825 pre-save transform: subst magic variables
7826 !! options
7827 PST
7828 !! input
7829 {{subst:SITENAME}}
7830 !! result
7831 MediaWiki
7832 !! end
7833
7834 # This is bug 89, which I fixed. -- wtm
7835 !! test
7836 pre-save transform: subst: templates with parameters
7837 !! options
7838 pst
7839 !! input
7840 {{subst:paramtest|param="something else"}}
7841 !! result
7842 This is a test template with parameter "something else"
7843 !! end
7844
7845 !! article
7846 Template:nowikitest
7847 !! text
7848 <nowiki>'''not wiki'''</nowiki>
7849 !! endarticle
7850
7851 !! test
7852 pre-save transform: nowiki in subst (bug 1188)
7853 !! options
7854 pst
7855 !! input
7856 {{subst:nowikitest}}
7857 !! result
7858 <nowiki>'''not wiki'''</nowiki>
7859 !! end
7860
7861
7862 !! article
7863 Template:commenttest
7864 !! text
7865 This template has <!-- a comment --> in it.
7866 !! endarticle
7867
7868 !! test
7869 pre-save transform: comment in subst (bug 1936)
7870 !! options
7871 pst
7872 !! input
7873 {{subst:commenttest}}
7874 !! result
7875 This template has <!-- a comment --> in it.
7876 !! end
7877
7878 !! test
7879 pre-save transform: unclosed tag
7880 !! options
7881 pst noxml
7882 !! input
7883 <nowiki>'''not wiki'''
7884 !! result
7885 <nowiki>'''not wiki'''
7886 !! end
7887
7888 !! test
7889 pre-save transform: mixed tag case
7890 !! options
7891 pst noxml
7892 !! input
7893 <NOwiki>'''not wiki'''</noWIKI>
7894 !! result
7895 <NOwiki>'''not wiki'''</noWIKI>
7896 !! end
7897
7898 !! test
7899 pre-save transform: unclosed comment in <nowiki>
7900 !! options
7901 pst noxml
7902 !! input
7903 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7904 !! result
7905 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7906 !!end
7907
7908 # Leading @ in this template definition works around a limitation
7909 # in parsoid's parserTests which otherwise strips the <span> from the
7910 # result (confusing it for a template wrapper)
7911 !! article
7912 Template:dangerous
7913 !!text
7914 @<span onmouseover="alert('crap')">Oh no</span>
7915 !!endarticle
7916
7917 !!test
7918 (confirming safety of fix for subst bug 1936)
7919 !! input
7920 {{Template:dangerous}}
7921 !! result
7922 <p>@<span>Oh no</span>
7923 </p>
7924 !! end
7925
7926 !! test
7927 pre-save transform: comment containing gallery (bug 5024)
7928 !! options
7929 pst
7930 !! input
7931 <!-- <gallery>data</gallery> -->
7932 !!result
7933 <!-- <gallery>data</gallery> -->
7934 !!end
7935
7936 !! test
7937 pre-save transform: comment containing extension
7938 !! options
7939 pst
7940 !! input
7941 <!-- <tag>data</tag> -->
7942 !!result
7943 <!-- <tag>data</tag> -->
7944 !!end
7945
7946 !! test
7947 pre-save transform: comment containing nowiki
7948 !! options
7949 pst
7950 !! input
7951 <!-- <nowiki>data</nowiki> -->
7952 !!result
7953 <!-- <nowiki>data</nowiki> -->
7954 !!end
7955
7956 !! test
7957 pre-save transform: <noinclude> in subst (bug 3298)
7958 !! options
7959 pst
7960 !! input
7961 {{subst:Includes}}
7962 !! result
7963 Foobar
7964 !! end
7965
7966 !! test
7967 pre-save transform: <onlyinclude> in subst (bug 3298)
7968 !! options
7969 pst
7970 !! input
7971 {{subst:Includes2}}
7972 !! result
7973 Foo
7974 !! end
7975
7976 !! article
7977 Template:SubstTest
7978 !!text
7979 {{<includeonly>subst:</includeonly>Includes}}
7980 !! endarticle
7981
7982 !! article
7983 Template:SafeSubstTest
7984 !! text
7985 {{<includeonly>safesubst:</includeonly>Includes}}
7986 !! endarticle
7987
7988 !! test
7989 bug 22297: safesubst: works during PST
7990 !! options
7991 pst
7992 !! input
7993 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7994 !! result
7995 FoobarFoobar
7996 !! end
7997
7998 !! test
7999 bug 22297: safesubst: works during normal parse
8000 !! input
8001 {{SafeSubstTest}}
8002 !! result
8003 <p>Foobar
8004 </p>
8005 !! end
8006
8007 !! test:
8008 subst: does not work during normal parse
8009 !! input
8010 {{SubstTest}}
8011 !! result
8012 <p>{{subst:Includes}}
8013 </p>
8014 !! end
8015
8016 !! test
8017 pre-save transform: context links ("pipe trick")
8018 !! options
8019 pst
8020 !! input
8021 [[Article (context)|]]
8022 [[Bar:Article|]]
8023 [[:Bar:Article|]]
8024 [[Bar:Article (context)|]]
8025 [[:Bar:Article (context)|]]
8026 [[|Article]]
8027 [[|Article (context)]]
8028 [[Bar:X (Y) Z|]]
8029 [[:Bar:X (Y) Z|]]
8030 !! result
8031 [[Article (context)|Article]]
8032 [[Bar:Article|Article]]
8033 [[:Bar:Article|Article]]
8034 [[Bar:Article (context)|Article]]
8035 [[:Bar:Article (context)|Article]]
8036 [[Article]]
8037 [[Article (context)]]
8038 [[Bar:X (Y) Z|X (Y) Z]]
8039 [[:Bar:X (Y) Z|X (Y) Z]]
8040 !! end
8041
8042 !! test
8043 pre-save transform: context links ("pipe trick") with interwiki prefix
8044 !! options
8045 pst
8046 !! input
8047 [[interwiki:Article|]]
8048 [[:interwiki:Article|]]
8049 [[interwiki:Bar:Article|]]
8050 [[:interwiki:Bar:Article|]]
8051 !! result
8052 [[interwiki:Article|Article]]
8053 [[:interwiki:Article|Article]]
8054 [[interwiki:Bar:Article|Bar:Article]]
8055 [[:interwiki:Bar:Article|Bar:Article]]
8056 !! end
8057
8058 !! test
8059 pre-save transform: context links ("pipe trick") with parens in title
8060 !! options
8061 pst title=[[Somearticle (context)]]
8062 !! input
8063 [[|Article]]
8064 !! result
8065 [[Article (context)|Article]]
8066 !! end
8067
8068 !! test
8069 pre-save transform: context links ("pipe trick") with comma in title
8070 !! options
8071 pst title=[[Someplace, Somewhere]]
8072 !! input
8073 [[|Otherplace]]
8074 [[Otherplace, Elsewhere|]]
8075 [[Otherplace, Elsewhere, Anywhere|]]
8076 !! result
8077 [[Otherplace, Somewhere|Otherplace]]
8078 [[Otherplace, Elsewhere|Otherplace]]
8079 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8080 !! end
8081
8082 !! test
8083 pre-save transform: context links ("pipe trick") with parens and comma
8084 !! options
8085 pst title=[[Someplace (IGNORED), Somewhere]]
8086 !! input
8087 [[|Otherplace]]
8088 [[Otherplace (place), Elsewhere|]]
8089 !! result
8090 [[Otherplace, Somewhere|Otherplace]]
8091 [[Otherplace (place), Elsewhere|Otherplace]]
8092 !! end
8093
8094 !! test
8095 pre-save transform: context links ("pipe trick") with comma and parens
8096 !! options
8097 pst title=[[Who, me? (context)]]
8098 !! input
8099 [[|Yes, you.]]
8100 [[Me, Myself, and I (1937 song)|]]
8101 !! result
8102 [[Yes, you. (context)|Yes, you.]]
8103 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8104 !! end
8105
8106 !! test
8107 pre-save transform: context links ("pipe trick") with namespace
8108 !! options
8109 pst title=[[Ns:Somearticle]]
8110 !! input
8111 [[|Article]]
8112 !! result
8113 [[Ns:Article|Article]]
8114 !! end
8115
8116 !! test
8117 pre-save transform: context links ("pipe trick") with namespace and parens
8118 !! options
8119 pst title=[[Ns:Somearticle (context)]]
8120 !! input
8121 [[|Article]]
8122 !! result
8123 [[Ns:Article (context)|Article]]
8124 !! end
8125
8126 !! test
8127 pre-save transform: context links ("pipe trick") with namespace and comma
8128 !! options
8129 pst title=[[Ns:Somearticle, Context, Whatever]]
8130 !! input
8131 [[|Article]]
8132 !! result
8133 [[Ns:Article, Context, Whatever|Article]]
8134 !! end
8135
8136 !! test
8137 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8138 !! options
8139 pst title=[[Ns:Somearticle, Context (context)]]
8140 !! input
8141 [[|Article]]
8142 !! result
8143 [[Ns:Article (context)|Article]]
8144 !! end
8145
8146 !! test
8147 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8148 !! options
8149 pst title=[[Ns:Somearticle (IGNORED), Context]]
8150 !! input
8151 [[|Article]]
8152 !! result
8153 [[Ns:Article, Context|Article]]
8154 !! end
8155
8156 !! test
8157 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8158 !! options
8159 pst
8160 !! input
8161 [[Article(context)|]]
8162 [[Bar:Article(context)|]]
8163 [[:Bar:Article(context)|]]
8164 [[|Article(context)]]
8165 [[Bar:X(Y)Z|]]
8166 [[:Bar:X(Y)Z|]]
8167 !! result
8168 [[Article(context)|Article]]
8169 [[Bar:Article(context)|Article]]
8170 [[:Bar:Article(context)|Article]]
8171 [[Article(context)]]
8172 [[Bar:X(Y)Z|X(Y)Z]]
8173 [[:Bar:X(Y)Z|X(Y)Z]]
8174 !! end
8175
8176 !! test
8177 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8178 !! options
8179 pst
8180 !! input
8181 [[Article (context)|]]
8182 [[Bar:Article (context)|]]
8183 [[:Bar:Article (context)|]]
8184 [[|Article (context)]]
8185 [[Bar:X (Y) Z|]]
8186 [[:Bar:X (Y) Z|]]
8187 !! result
8188 [[Article (context)|Article]]
8189 [[Bar:Article (context)|Article]]
8190 [[:Bar:Article (context)|Article]]
8191 [[Article (context)]]
8192 [[Bar:X (Y) Z|X (Y) Z]]
8193 [[:Bar:X (Y) Z|X (Y) Z]]
8194 !! end
8195
8196 !! test
8197 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8198 !! options
8199 pst
8200 !! input
8201 [[Article(context)|]]
8202 [[Bar:Article(context)|]]
8203 [[:Bar:Article(context)|]]
8204 [[|Article(context)]]
8205 [[Bar:X(Y)Z|]]
8206 [[:Bar:X(Y)Z|]]
8207 !! result
8208 [[Article(context)|Article]]
8209 [[Bar:Article(context)|Article]]
8210 [[:Bar:Article(context)|Article]]
8211 [[Article(context)]]
8212 [[Bar:X(Y)Z|X(Y)Z]]
8213 [[:Bar:X(Y)Z|X(Y)Z]]
8214 !! end
8215
8216 !! test
8217 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8218 !! options
8219 pst
8220 !! input
8221 [[Article (context), context|]]
8222 [[Article (context),context|]]
8223 [[Bar:Article (context), context|]]
8224 [[Bar:Article (context),context|]]
8225 [[:Bar:Article (context), context|]]
8226 [[:Bar:Article (context),context|]]
8227 !! result
8228 [[Article (context), context|Article]]
8229 [[Article (context),context|Article]]
8230 [[Bar:Article (context), context|Article]]
8231 [[Bar:Article (context),context|Article]]
8232 [[:Bar:Article (context), context|Article]]
8233 [[:Bar:Article (context),context|Article]]
8234 !! end
8235
8236 !! test
8237 pre-save transform: trim trailing empty lines
8238 !! options
8239 pst
8240 !! input
8241 Empty lines are trimmed
8242
8243
8244
8245
8246 !! result
8247 Empty lines are trimmed
8248 !! end
8249
8250 !! test
8251 pre-save transform: Signature expansion
8252 !! options
8253 pst
8254 !! input
8255 * ~~~
8256 * <noinclude>~~~</noinclude>
8257 * <includeonly>~~~</includeonly>
8258 * <onlyinclude>~~~</onlyinclude>
8259 !! result
8260 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8261 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8262 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8263 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8264 !! end
8265
8266
8267 !! test
8268 pre-save transform: Signature expansion in nowiki tags (bug 93)
8269 !! options
8270 pst disabled
8271 !! input
8272 Shall not expand:
8273
8274 <nowiki>~~~~</nowiki>
8275
8276 <includeonly><nowiki>~~~~</nowiki></includeonly>
8277
8278 <noinclude><nowiki>~~~~</nowiki></noinclude>
8279
8280 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8281
8282 {{subst:Foo}} shall be converted to FOO
8283
8284 As well as inside noinclude/onlyinclude
8285 <noinclude>{{subst:Foo}}</noinclude>
8286 <onlyinclude>{{subst:Foo}}</onlyinclude>
8287
8288 But not inside includeonly
8289 <includeonly>{{subst:Foo}}</includeonly>
8290 !! result
8291 Shall not expand:
8292
8293 <nowiki>~~~~</nowiki>
8294
8295 <includeonly><nowiki>~~~~</nowiki></includeonly>
8296
8297 <noinclude><nowiki>~~~~</nowiki></noinclude>
8298
8299 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8300
8301 FOO shall be converted to FOO
8302
8303 As well as inside noinclude/onlyinclude
8304 <noinclude>FOO</noinclude>
8305 <onlyinclude>FOO</onlyinclude>
8306
8307 But not inside includeonly
8308 <includeonly>{{subst:Foo}}</includeonly>
8309 !! end
8310
8311 !! test
8312 Parsoid: Recognize nowiki with trailing space in tags
8313 !! options
8314 parsoid=wt2html
8315 !! input
8316 <nowiki ><div>[[foo]]</nowiki >
8317
8318 a<nowiki / >b
8319
8320 c<nowiki />d
8321
8322 e<nowiki/ >f
8323 !! result
8324 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8325 <p>ab</p>
8326 <p>cd</p>
8327 <p>ef</p>
8328 !! end
8329
8330 !! test
8331 Parsoid: Recognize nowiki with odd capitalization
8332 !! options
8333 parsoid=wt2html
8334 !! input
8335 <noWikI ><div>[[foo]]</Nowiki >
8336 !! result
8337 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8338 !! end
8339
8340
8341 !! test
8342 Parsoid: Escape nowiki with trailing space in tags
8343 !! options
8344 parsoid=html2wt
8345 !! input
8346 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8347
8348 a&lt;nowiki /&gt;b
8349
8350 c&lt;nowiki/ &gt;d
8351 !! result
8352 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8353 <p>a&lt;nowiki /&gt;b</p>
8354 <p>c&lt;nowiki/ &gt;d</p>
8355 !! end
8356
8357 !! test
8358 Parsoid: Escape weird noWikI capitalizations
8359 !! options
8360 parsoid=html2wt
8361 !! input
8362 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8363 !! result
8364 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8365 !! end
8366
8367 ###
8368 ### Message transform tests
8369 ###
8370 !! test
8371 message transform: magic variables
8372 !! options
8373 msg
8374 !! input
8375 {{SITENAME}}
8376 !! result
8377 MediaWiki
8378 !! end
8379
8380 !! test
8381 message transform: should not transform wiki markup
8382 !! options
8383 msg
8384 !! input
8385 ''test''
8386 !! result
8387 ''test''
8388 !! end
8389
8390 !! test
8391 message transform: <noinclude> in transcluded template (bug 4926)
8392 !! options
8393 msg
8394 !! input
8395 {{Includes}}
8396 !! result
8397 Foobar
8398 !! end
8399
8400 !! test
8401 message transform: <onlyinclude> in transcluded template (bug 4926)
8402 !! options
8403 msg
8404 !! input
8405 {{Includes2}}
8406 !! result
8407 Foo
8408 !! end
8409
8410 !! test
8411 {{#special:}} page name, known
8412 !! options
8413 msg
8414 !! input
8415 {{#special:Recentchanges}}
8416 !! result
8417 Special:RecentChanges
8418 !! end
8419
8420 !! test
8421 {{#special:}} page name with subpage, known
8422 !! options
8423 msg
8424 !! input
8425 {{#special:Recentchanges/param}}
8426 !! result
8427 Special:RecentChanges/param
8428 !! end
8429
8430 !! test
8431 {{#special:}} page name, unknown
8432 !! options
8433 msg
8434 !! input
8435 {{#special:foobar nonexistent}}
8436 !! result
8437 Special:Foobar nonexistent
8438 !! end
8439
8440 !! test
8441 {{#speciale:}} page name, known
8442 !! options
8443 msg
8444 !! input
8445 {{#speciale:Recentchanges}}
8446 !! result
8447 Special:RecentChanges
8448 !! end
8449
8450 !! test
8451 {{#speciale:}} page name with subpage, known
8452 !! options
8453 msg
8454 !! input
8455 {{#speciale:Recentchanges/param}}
8456 !! result
8457 Special:RecentChanges/param
8458 !! end
8459
8460 !! test
8461 {{#speciale:}} page name, unknown
8462 !! options
8463 msg
8464 !! input
8465 {{#speciale:foobar nonexistent}}
8466 !! result
8467 Special:Foobar_nonexistent
8468 !! end
8469
8470 ###
8471 ### Images
8472 ###
8473 ### For Parsoid-specific tests, see
8474 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8475
8476 !! test
8477 Simple image (php)
8478 !! options
8479 php
8480 !! input
8481 [[Image:foobar.jpg]]
8482 !! result
8483 <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>
8484 </p>
8485 !! end
8486
8487 !! test
8488 Simple image (parsoid)
8489 !! options
8490 parsoid=wt2html
8491 !! input
8492 [[Image:foobar.jpg]]
8493 !! result
8494 <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>
8495 </p>
8496 !! end
8497
8498 !! test
8499 Simple image (using File: namespace, now canonical) (php)
8500 !! options
8501 php
8502 !! input
8503 [[File:foobar.jpg]]
8504 !! result
8505 <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>
8506 </p>
8507 !! end
8508
8509 !! test
8510 Simple image (using File: namespace, now canonical) (parsoid)
8511 !! options
8512 parsoid
8513 !! input
8514 [[File:Foobar.jpg]]
8515 !! result
8516 <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>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Right-aligned image (php)
8522 !! options
8523 php
8524 !! input
8525 [[Image:foobar.jpg|right]]
8526 !! result
8527 <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>
8528
8529 !! end
8530
8531 !! test
8532 Right-aligned image (parsoid)
8533 !! options
8534 parsoid
8535 !! input
8536 [[File:Foobar.jpg|right]]
8537 !! result
8538 <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>
8539 !! end
8540
8541 !! test
8542 Image with caption (php)
8543 !! options
8544 php
8545 !! input
8546 [[File:Foobar.jpg|right|Caption text]]
8547 !! result
8548 <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>
8549
8550 !! end
8551
8552 !! test
8553 Image with caption (parsoid)
8554 !! options
8555 parsoid
8556 !! input
8557 [[File:Foobar.jpg|right|Caption text]]
8558 !! result
8559 <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>
8560 !! end
8561
8562 !! test
8563 Image with empty attribute (php)
8564 !! options
8565 php
8566 !! input
8567 [[File:Foobar.jpg|right||Caption text]]
8568 !! result
8569 <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>
8570
8571 !! end
8572
8573 !! test
8574 Image with empty attribute (parsoid)
8575 !! options
8576 parsoid=wt2html
8577 !! input
8578 [[File:Foobar.jpg|right||Caption text]]
8579 !! result
8580 <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>
8581 !! end
8582
8583 !! test
8584 Image with attributes from template (php)
8585 !! options
8586 php
8587 !! input
8588 [[File:Foobar.jpg|{{image_attribs}}]]
8589 !! result
8590 <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>
8591
8592 !! end
8593
8594 !! test
8595 Image with attributes from template (parsoid)
8596 !! options
8597 parsoid
8598 !! input
8599 [[File:Foobar.jpg|{{image_attribs}}]]
8600 !! result
8601 <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>
8602 !! end
8603
8604 !! test
8605 Image with link tails (php)
8606 !! options
8607 php
8608 !! input
8609 123[[File:Foobar.jpg]]456
8610 123[[File:Foobar.jpg|right]]456
8611 123[[File:Foobar.jpg|thumb]]456
8612 !! result
8613 <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
8614 </p>
8615 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
8616 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
8617
8618 !! end
8619
8620 !! test
8621 Image with link tails (parsoid)
8622 !! options
8623 parsoid
8624 !! input
8625 123[[File:Foobar.jpg]]456
8626 123[[File:Foobar.jpg|right]]456
8627 123[[File:Foobar.jpg|thumb]]456
8628 !! result
8629 <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>
8630 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
8631 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
8632 !! end
8633
8634 !! test
8635 Image with multiple captions -- only last one is accepted (php)
8636 !! options
8637 php
8638 !! input
8639 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8640 !! result
8641 <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>
8642
8643 !! end
8644
8645 !! test
8646 Image with multiple captions -- only last one is accepted (parsoid)
8647 !! options
8648 parsoid
8649 !! input
8650 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8651 !! result
8652 <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>
8653 !! end
8654
8655 !! test
8656 Image with width attribute at different positions (php)
8657 !! options
8658 php
8659 !! input
8660 [[File:Foobar.jpg|200px|right|Caption]]
8661 [[File:Foobar.jpg|right|200px|Caption]]
8662 [[File:Foobar.jpg|right|Caption|200px]]
8663 !! result
8664 <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>
8665 <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>
8666 <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>
8667
8668 !! end
8669
8670 !! test
8671 Image with width attribute at different positions (parsoid)
8672 !! options
8673 parsoid
8674 !! input
8675 [[File:Foobar.jpg|200px|right|Caption]]
8676 [[File:Foobar.jpg|right|200px|Caption]]
8677 [[File:Foobar.jpg|right|Caption|200px]]
8678 !! result
8679 <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>
8680 <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>
8681 <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>
8682 !! end
8683
8684 !! test
8685 Image with link parameter, wiki target (php)
8686 !! options
8687 php
8688 !! input
8689 [[File:Foobar.jpg|link=Main Page]]
8690 !! result
8691 <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>
8692 </p>
8693 !! end
8694
8695 !! test
8696 Image with link parameter, wiki target (parsoid)
8697 !! options
8698 parsoid
8699 !! input
8700 [[File:Foobar.jpg|link=Main Page]]
8701 !! result
8702 <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>
8703 !! end
8704
8705 !! test
8706 Image with link parameter, URL target (php)
8707 !! options
8708 php
8709 !! input
8710 [[File:Foobar.jpg|link=http://example.com/]]
8711 !! result
8712 <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>
8713 </p>
8714 !! end
8715
8716 # parsoid bug 49293 (part 1)
8717 !! test
8718 Image with link parameter, URL target (parsoid)
8719 !! options
8720 parsoid
8721 !! input
8722 [[File:Foobar.jpg|link=http://example.com/]]
8723 !! result
8724 <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>
8725 !! end
8726
8727 !! test
8728 Image with link parameter, protocol-less URL target (php)
8729 !! options
8730 php
8731 !! input
8732 [[File:Foobar.jpg|link=//example.com/]]
8733 !! result
8734 <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>
8735 </p>
8736 !! end
8737
8738 # parsoid bug 49293 (part 2)
8739 !! test
8740 Image with link parameter, protocol-less URL target (parsoid)
8741 !! options
8742 parsoid
8743 !! input
8744 [[File:Foobar.jpg|link=//example.com/]]
8745 !! result
8746 <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>
8747 !! end
8748
8749 !! test
8750 Image with link parameter, wgExternalLinkTarget
8751 !! input
8752 [[Image:foobar.jpg|link=http://example.com/]]
8753 !! config
8754 wgExternalLinkTarget='foobar'
8755 !! result
8756 <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>
8757 </p>
8758 !! end
8759
8760 !! test
8761 Image with link parameter, wgNoFollowLinks set to false
8762 !! input
8763 [[Image:foobar.jpg|link=http://example.com/]]
8764 !! config
8765 wgNoFollowLinks=false
8766 !! result
8767 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8768 </p>
8769 !! end
8770
8771 !! test
8772 Image with link parameter, wgNoFollowDomainExceptions
8773 !! input
8774 [[Image:foobar.jpg|link=http://example.com/]]
8775 !! config
8776 wgNoFollowDomainExceptions='example.com'
8777 !! result
8778 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8779 </p>
8780 !! end
8781
8782 !! test
8783 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8784 !! input
8785 [[Image:foobar.jpg|link=http://example.com/|Title]]
8786 !! config
8787 wgExternalLinkTarget='foobar'
8788 !! result
8789 <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>
8790 </p>
8791 !! end
8792
8793 !! test
8794 Image with empty link parameter (php)
8795 !! options
8796 php
8797 !! input
8798 [[File:Foobar.jpg|link=]]
8799 !! result
8800 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8801 </p>
8802 !! end
8803
8804 !! test
8805 Image with empty link parameter (parsoid)
8806 !! options
8807 parsoid
8808 !! input
8809 [[File:Foobar.jpg|link=]]
8810 !! result
8811 <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>
8812 !! end
8813
8814 !! test
8815 Image with link parameter (wiki target) and unnamed parameter (php)
8816 !! options
8817 php
8818 !! input
8819 [[File:Foobar.jpg|link=Main Page|Title]]
8820 !! result
8821 <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>
8822 </p>
8823 !! end
8824
8825 !! test
8826 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8827 !! options
8828 parsoid
8829 !! input
8830 [[File:Foobar.jpg|link=Main Page|Title]]
8831 !! result
8832 <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>
8833 !! end
8834
8835 !! test
8836 Image with link parameter (URL target) and unnamed parameter (php)
8837 !! options
8838 php
8839 !! input
8840 [[File:Foobar.jpg|link=http://example.com/|Title]]
8841 !! result
8842 <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>
8843 </p>
8844 !! end
8845
8846 !! test
8847 Image with link parameter (URL target) and unnamed parameter (parsoid)
8848 !! options
8849 parsoid
8850 !! input
8851 [[File:Foobar.jpg|link=http://example.com/|Title]]
8852 !! result
8853 <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>
8854 !! end
8855
8856 !! test
8857 Thumbnail image with link parameter
8858 !! options
8859 php
8860 !! input
8861 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8862 !! result
8863 <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>
8864
8865 !! end
8866
8867 !! test
8868 Manually-specified thumbnail image
8869 !! options
8870 php
8871 !! input
8872 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8873 !! result
8874 <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>
8875
8876 !! end
8877
8878 !! test
8879 Manually-specified thumbnail image with explicit link to wiki page
8880 !! options
8881 php
8882 !! input
8883 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8884 !! result
8885 <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>
8886
8887 !! end
8888
8889 !! test
8890 Manually-specified thumbnail image with explicit link to url
8891 !! options
8892 php
8893 !! input
8894 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8895 !! result
8896 <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>
8897
8898 !! end
8899
8900 !! test
8901 Manually-specified thumbnail image with explicit no link
8902 !! options
8903 php
8904 !! input
8905 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8906 !! result
8907 <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>
8908
8909 !! end
8910
8911 !! test
8912 Manually-specified thumbnail image with explicit link and alt text
8913 !! options
8914 php
8915 !! input
8916 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8917 !! result
8918 <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>
8919
8920 !! end
8921
8922 !! test
8923 Image with frame and link
8924 !! input
8925 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8926 !! result
8927 <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>
8928
8929 !! end
8930
8931 !! test
8932 Image with frame and link and explicit alt
8933 !! input
8934 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8935 !! result
8936 <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>
8937
8938 !! end
8939
8940 !! test
8941 Image with wiki markup in implicit alt
8942 !! input
8943 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8944 !! result
8945 <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>
8946 </p>
8947 !! end
8948
8949 !! test
8950 Image with wiki markup in explicit alt
8951 !! input
8952 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8953 !! result
8954 <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>
8955 </p>
8956 !! end
8957
8958 !! test
8959 Link to image page- image page normally doesn't exists, hence edit link
8960 Add test with existing image page
8961 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8962 !! input
8963 [[:Image:test]]
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)">Image:test</a>
8966 </p>
8967 !! end
8968
8969 !! test
8970 bug 18784 Link to non-existent image page with caption should use caption as link text
8971 !! input
8972 [[:Image:test|caption]]
8973 !! result
8974 <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>
8975 </p>
8976 !! end
8977
8978 !! test
8979 Frameless image caption with a free URL
8980 !! input
8981 [[Image:foobar.jpg|http://example.com]]
8982 !! result
8983 <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>
8984 </p>
8985 !! end
8986
8987 !! test
8988 Thumbnail image caption with a free URL
8989 !! input
8990 [[Image:foobar.jpg|thumb|http://example.com]]
8991 !! result
8992 <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>
8993
8994 !! end
8995
8996 !! test
8997 Thumbnail image caption with a free URL and explicit alt
8998 !! input
8999 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9000 !! result
9001 <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>
9002
9003 !! end
9004
9005 !! test
9006 SVG thumbnails with no language set
9007 !! options
9008 !! input
9009 [[File:Foobar.svg|thumb|width=200]]
9010 !! result
9011 <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>
9012
9013 !! end
9014
9015 !! test
9016 SVG thumbnails with language de
9017 !! options
9018 !! input
9019 [[File:Foobar.svg|thumb|width=200|lang=de]]
9020 !! result
9021 <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>
9022
9023 !! end
9024
9025 !! test
9026 SVG thumbnails with invalid language code
9027 !! options
9028 !! input
9029 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9030 !! result
9031 <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>
9032
9033 !! end
9034
9035 !! test
9036 BUG 1887: A ISBN with a thumbnail
9037 !! input
9038 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
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><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
9041
9042 !! end
9043
9044 !! test
9045 BUG 1887: A RFC with a thumbnail
9046 !! input
9047 [[Image:foobar.jpg|thumb|This is RFC 12354]]
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>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
9050
9051 !! end
9052
9053 !! test
9054 BUG 1887: A mailto link with a thumbnail
9055 !! input
9056 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9057 !! result
9058 <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>
9059
9060 !! end
9061
9062 # Pending resolution to bug 368
9063 !! test
9064 BUG 648: Frameless image caption with a link
9065 !! input
9066 [[Image:foobar.jpg|text with a [[link]] in it]]
9067 !! result
9068 <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>
9069 </p>
9070 !! end
9071
9072 !! test
9073 BUG 648: Frameless image caption with a link (suffix)
9074 !! input
9075 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9076 !! result
9077 <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>
9078 </p>
9079 !! end
9080
9081 !! test
9082 BUG 648: Frameless image caption with an interwiki link
9083 !! input
9084 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9085 !! result
9086 <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>
9087 </p>
9088 !! end
9089
9090 !! test
9091 BUG 648: Frameless image caption with a piped interwiki link
9092 !! input
9093 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9094 !! result
9095 <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>
9096 </p>
9097 !! end
9098
9099 !! test
9100 Escape HTML special chars in image alt text
9101 !! input
9102 [[Image:foobar.jpg|& < > "]]
9103 !! result
9104 <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>
9105 </p>
9106 !! end
9107
9108 !! test
9109 BUG 499: Alt text should have &#1234;, not &amp;1234;
9110 !! input
9111 [[Image:foobar.jpg|&#9792;]]
9112 !! result
9113 <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>
9114 </p>
9115 !! end
9116
9117 !! test
9118 Broken image caption with link
9119 !! input
9120 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9121 !! result
9122 <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.
9123 </p>
9124 !! end
9125
9126 !! test
9127 Image caption containing another image
9128 !! input
9129 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9130 !! result
9131 <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>
9132
9133 !! end
9134
9135 !! test
9136 Image caption containing a newline
9137 !! input
9138 [[Image:Foobar.jpg|This
9139 *is some text]]
9140 !! result
9141 <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>
9142 </p>
9143 !!end
9144
9145 !!test
9146 Parsoid: Image caption containing leading space
9147 (The leading space should not trigger nowiki escaping in wt2wt mode)
9148 !! input
9149 [[Image:Foobar.jpg|thumb| bar]]
9150 !! result
9151 <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>
9152
9153 !!end
9154
9155 !! test
9156 Bug 3090: External links other than http: in image captions
9157 !! input
9158 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9159 !! result
9160 <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>
9161
9162 !! end
9163
9164 !! test
9165 Custom class
9166 !! input
9167 [[Image:foobar.jpg|a|class=b]]
9168 !! result
9169 <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>
9170 </p>
9171 !! end
9172
9173 !! test
9174 Localized image handling (1).
9175 !! options
9176 language=es
9177 !! input
9178 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9179 !! result
9180 <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>
9181
9182 !! end
9183
9184 !! test
9185 Localized image handling (2).
9186 !! options
9187 language=es
9188 !! input
9189 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9190 !! result
9191 <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>
9192
9193 !! end
9194
9195 !! test
9196 "border", "frameless" and "class" attributes on an image.
9197 !! input
9198 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9199 !! result
9200 <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>
9201 </p>
9202 !! end
9203
9204 !! article
9205 File:Barfoo.jpg
9206 !! text
9207 #REDIRECT [[File:Barfoo.jpg]]
9208 !! endarticle
9209
9210 !! test
9211 Redirected image
9212 !! input
9213 [[Image:Barfoo.jpg]]
9214 !! result
9215 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9216 </p>
9217 !! end
9218
9219 !! test
9220 Missing image with uploads disabled
9221 !! options
9222 wgEnableUploads=0
9223 !! input
9224 [[Image:Foobaz.jpg]]
9225 !! result
9226 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9227 </p>
9228 !! end
9229
9230 # Parsoid-specific testing for images
9231 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9232 # Currently imperfect due to a flaw in the Parsoid testrunner
9233 # Work in progress
9234 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9235 # image tests.
9236
9237 !! test
9238 Parsoid-specific image handling - simple image with size and middle alignment
9239 !! options
9240 parsoid
9241 !! input
9242 [[Image:Foobar.jpg|50px|middle]]
9243 !! result
9244 <p>
9245 <span class="mw-valign-middle" typeof="mw:Image">
9246 <a href="File:Foobar.jpg">
9247 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9248 </a>
9249 </span>
9250 </p>
9251 !! end
9252
9253 !! test
9254 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9255 !! options
9256 parsoid
9257 !! input
9258 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9259 !! result
9260 <p>
9261 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9262 <a href="File:Foobar.jpg">
9263 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9264 </a>
9265 </span>
9266 </p>
9267 !! end
9268
9269 !! test
9270 Parsoid-specific image handling - simple image with border and size spec
9271 !! options
9272 parsoid
9273 !! input
9274 [[Image:Foobar.jpg|50px|border|caption]]
9275 !! result
9276 <p>
9277 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9278 <a href="File:Foobar.jpg">
9279 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9280 </a>
9281 </span>
9282 </p>
9283 !! end
9284
9285 !! test
9286 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9287 !! options
9288 parsoid
9289 !! input
9290 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9291 !! result
9292 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9293 <a href="File:Foobar.jpg">
9294 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9295 </a>
9296 <figcaption>caption content</figcaption>
9297 </figure>
9298 !! end
9299
9300 !! test
9301 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9302 !! options
9303 parsoid
9304 !! input
9305 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9306 !! result
9307 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9308 <a href="File:Foobar.jpg">
9309 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9310 </a>
9311 <figcaption>caption</figcaption>
9312 </figure>
9313 !! end
9314
9315 !! test
9316 Parsoid-specific image handling - framed image with specific size and caption
9317 !! options
9318 parsoid
9319 !! input
9320 [[Image:Foobar.jpg|500x50px|frame|caption]]
9321 !! result
9322 <figure typeof="mw:Image/Frame">
9323 <a href="File:Foobar.jpg">
9324 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9325 </a>
9326 <figcaption>caption</figcaption>
9327 </figure>
9328 !! end
9329
9330 !! test
9331 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9332 !! options
9333 parsoid
9334 !! input
9335 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9336 !! result
9337 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9338 <a href="File:Foobar.jpg">
9339 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9340 </a>
9341 <figcaption>caption</figcaption>
9342 </figure>
9343 !! end
9344
9345 !! test
9346 Parsoid-specific image handling - frameless image with specific size, border, and caption
9347 !! options
9348 parsoid
9349 !! input
9350 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9351 !! result
9352 <p>
9353 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9354 <a href="File:Foobar.jpg">
9355 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9356 </a>
9357 </p>
9358 !! end
9359
9360 #!! test
9361 #Parsoid-specific image handling - simple image with a formatted caption
9362 #!! options
9363 #parsoid
9364 #!! input
9365 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9366 #!! result
9367 #<p>
9368 #<span typeof="mw:Image">
9369 #<a class="mw-default-size" href="Image:Foobar.jpg">
9370 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9371 #</a>
9372 #<span>abc</span>
9373 #</span>
9374 #</p>
9375
9376
9377 ###
9378 ### Subpages
9379 ###
9380 !! article
9381 Subpage test/subpage
9382 !! text
9383 foo
9384 !! endarticle
9385
9386 !! test
9387 Subpage link
9388 !! options
9389 subpage title=[[Subpage test]]
9390 !! input
9391 [[/subpage]]
9392 !! result
9393 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9394 </p>
9395 !! end
9396
9397 !! test
9398 Subpage noslash link
9399 !! options
9400 subpage title=[[Subpage test]]
9401 !!input
9402 [[/subpage/]]
9403 !! result
9404 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9405 </p>
9406 !! end
9407
9408 # TODO: make this PHP-parser compatible!
9409 !! test
9410 Relative subpage noslash link
9411 !! options
9412 parsoid=wt2wt,wt2html,html2html
9413 subpage title=[[Subpage test/1/2/3/4]]
9414 !!input
9415 [[../../subpage/]]
9416
9417 [[../../subpage]]
9418 !! result
9419 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9420 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9421 !! end
9422
9423 # TODO: make this PHP-parser compatible!
9424 !! test
9425 Parsoid: dot-slash prefixed wikilinks
9426 !! options
9427 parsoid=wt2wt,wt2html,html2html
9428 !!input
9429 [[./foo]]
9430
9431 [[././bar]]
9432
9433 [[././baz/]]
9434 !! result
9435 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9436 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9437 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9438 !! end
9439
9440 !! test
9441 Disabled subpages
9442 !! input
9443 [[/subpage]]
9444 !! result
9445 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9446 </p>
9447 !! end
9448
9449 !! test
9450 BUG 561: {{/Subpage}}
9451 !! options
9452 subpage title=[[Page]]
9453 !! input
9454 {{/Subpage}}
9455 !! result
9456 <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>
9457 </p>
9458 !! end
9459
9460 ###
9461 ### Categories
9462 ###
9463 !! article
9464 Category:MediaWiki User's Guide
9465 !! text
9466 blah
9467 !! endarticle
9468
9469 !! test
9470 Link to category
9471 !! input
9472 [[:Category:MediaWiki User's Guide]]
9473 !! result
9474 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9475 </p>
9476 !! end
9477
9478 !! test
9479 Simple category
9480 !! options
9481 cat
9482 !! input
9483 [[Category:MediaWiki User's Guide]]
9484 !! result
9485 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9486 !! end
9487
9488 !! test
9489 PAGESINCATEGORY invalid title fatal (r33546 fix)
9490 !! input
9491 {{PAGESINCATEGORY:<bogus>}}
9492 !! result
9493 <p>0
9494 </p>
9495 !! end
9496
9497 !! test
9498 Category with different sort key
9499 !! options
9500 cat
9501 !! input
9502 [[Category:MediaWiki User's Guide|Foo]]
9503 !! result
9504 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9505 !! end
9506
9507 !! test
9508 Category with identical sort key
9509 !! options
9510 cat
9511 !! input
9512 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9513 !! result
9514 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9515 !! end
9516
9517 !! test
9518 Category with empty sort key
9519 !! options
9520 cat
9521 pst
9522 !! input
9523 [[Category:MediaWiki User's Guide|]]
9524 !! result
9525 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9526 !! end
9527
9528 !! test
9529 Category with empty sort key and parentheses
9530 !! options
9531 cat
9532 pst
9533 !! input
9534 [[Category:Foo (bar)|]]
9535 !! result
9536 [[Category:Foo (bar)|Foo]]
9537 !! end
9538
9539 !! test
9540 Category with link tail
9541 !! options
9542 cat
9543 pst
9544 !! input
9545 123[[Category:Foo]]456
9546 !! result
9547 123[[Category:Foo]]456
9548 !! end
9549
9550 !! test
9551 Category with template
9552 !! options
9553 cat
9554 pst
9555 !! input
9556 [[Category:{{echo|Foo}}]]
9557 !! result
9558 [[Category:{{echo|Foo}}]]
9559 !! end
9560
9561 !! test
9562 Category with template in sort key
9563 !! options
9564 cat
9565 pst
9566 !! input
9567 [[Category:Foo|{{echo|Bar}}]]
9568 !! result
9569 [[Category:Foo|{{echo|Bar}}]]
9570 !! end
9571
9572 !! test
9573 Category with template in sort key and title
9574 !! options
9575 cat
9576 pst
9577 !! input
9578 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9579 !! result
9580 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9581 !! end
9582
9583 !! test
9584 Category / paragraph interactions
9585 !! input
9586 Foo [[Category:Baz]] Bar
9587
9588 Foo [[Category:Baz]]
9589 Bar
9590
9591 Foo
9592 [[Category:Baz]]
9593 Bar
9594
9595 Foo
9596 [[Category:Baz]] Bar
9597
9598 Foo
9599 [[Category:Baz]]
9600 [[Category:Baz]]
9601 [[Category:Baz]]
9602 Bar
9603
9604 [[Category:Baz]]
9605 [[Category:Baz]]
9606 [[Category:Baz]]
9607
9608 [[Category:Baz]]
9609 {{echo|[[Category:Baz]]}}
9610 [[Category:Baz]]
9611 !! result
9612 <p>Foo Bar
9613 </p><p>Foo
9614 Bar
9615 </p><p>Foo
9616 Bar
9617 </p><p>Foo Bar
9618 </p><p>Foo
9619 Bar
9620 </p>
9621 !! end
9622
9623 !! test
9624 Parsoid: Serialize link to category page with colon escape
9625 !! options
9626 parsoid
9627 !! input
9628
9629 [[:Category:Foo]]
9630 [[:Category:Foo|Bar]]
9631 !! result
9632 <p>
9633 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9634 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9635 </p>
9636 !! end
9637
9638 !! test
9639 Parsoid: Link prefix/suffixes aren't applied to category links
9640 !! options
9641 parsoid=wt2html,wt2wt,html2html
9642 language=is
9643 !! input
9644 x[[Category:Foo]]y
9645 !! result
9646 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9647 !! end
9648
9649 !! test
9650 Parsoid: Serialize link to file page with colon escape
9651 !! options
9652 parsoid
9653 !! input
9654
9655 [[:File:Foo.png]]
9656 [[:File:Foo.png|Bar]]
9657 !! result
9658 <p>
9659 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9660 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9661 </p>
9662 !! end
9663
9664 !! test
9665 Parsoid: Serialize a genuine category link without colon escape
9666 !! options
9667 parsoid
9668 !! input
9669 [[Category:Foo]]
9670 [[Category:Foo|Bar]]
9671 !! result
9672 <link rel="mw:WikiLink/Category" href="Category:Foo">
9673 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9674 !! end
9675
9676 ###
9677 ### Inter-language links
9678 ###
9679 !! test
9680 Inter-language links
9681 !! options
9682 ill
9683 !! input
9684 [[es:Alimento]]
9685 [[fr:Nourriture]]
9686 [[zh:&#39135;&#21697;]]
9687 !! result
9688 es:Alimento fr:Nourriture zh:食品
9689 !! end
9690
9691 !! test
9692 Duplicate interlanguage links (bug 24502)
9693 !! options
9694 ill
9695 !! input
9696 [[es:1]]
9697 [[es:2]]
9698 [[fr:1]]
9699 [[fr:2]]
9700 !! result
9701 es:1 fr:1
9702 !! end
9703
9704 ###
9705 ### Sections
9706 ###
9707 !! test
9708 Basic section headings
9709 !! input
9710 == Headline 1 ==
9711 Some text
9712
9713 ==Headline 2==
9714 More
9715 ===Smaller headline===
9716 Blah blah
9717 !! result
9718 <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>
9719 <p>Some text
9720 </p>
9721 <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>
9722 <p>More
9723 </p>
9724 <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>
9725 <p>Blah blah
9726 </p>
9727 !! end
9728
9729 !! test
9730 Section headings with TOC
9731 !! input
9732 == Headline 1 ==
9733 === Subheadline 1 ===
9734 ===== Skipping a level =====
9735 ====== Skipping a level ======
9736
9737 == Headline 2 ==
9738 Some text
9739 ===Another headline===
9740 !! result
9741 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9742 <ul>
9743 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9744 <ul>
9745 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9746 <ul>
9747 <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>
9748 <ul>
9749 <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>
9750 </ul>
9751 </li>
9752 </ul>
9753 </li>
9754 </ul>
9755 </li>
9756 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9757 <ul>
9758 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9759 </ul>
9760 </li>
9761 </ul>
9762 </div>
9763 <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>
9764 <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>
9765 <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>
9766 <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>
9767 <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>
9768 <p>Some text
9769 </p>
9770 <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>
9771
9772 !! end
9773
9774 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9775 !! test
9776 Handling of sections up to level 6 and beyond
9777 !! input
9778 = Level 1 Heading=
9779 == Level 2 Heading==
9780 === Level 3 Heading===
9781 ==== Level 4 Heading====
9782 ===== Level 5 Heading=====
9783 ====== Level 6 Heading======
9784 ======= Level 7 Heading=======
9785 ======== Level 8 Heading========
9786 ========= Level 9 Heading=========
9787 ========== Level 10 Heading==========
9788 !! result
9789 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9790 <ul>
9791 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9792 <ul>
9793 <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>
9794 <ul>
9795 <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>
9796 <ul>
9797 <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>
9798 <ul>
9799 <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>
9800 <ul>
9801 <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>
9802 <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>
9803 <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>
9804 <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>
9805 <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>
9806 </ul>
9807 </li>
9808 </ul>
9809 </li>
9810 </ul>
9811 </li>
9812 </ul>
9813 </li>
9814 </ul>
9815 </li>
9816 </ul>
9817 </div>
9818 <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>
9819 <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>
9820 <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>
9821 <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>
9822 <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>
9823 <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>
9824 <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>
9825 <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>
9826 <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>
9827 <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>
9828
9829 !! end
9830
9831 !! test
9832 TOC regression (bug 9764)
9833 !! input
9834 == title 1 ==
9835 === title 1.1 ===
9836 ==== title 1.1.1 ====
9837 === title 1.2 ===
9838 == title 2 ==
9839 === title 2.1 ===
9840 !! result
9841 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9842 <ul>
9843 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9844 <ul>
9845 <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>
9846 <ul>
9847 <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>
9848 </ul>
9849 </li>
9850 <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>
9851 </ul>
9852 </li>
9853 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9854 <ul>
9855 <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>
9856 </ul>
9857 </li>
9858 </ul>
9859 </div>
9860 <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>
9861 <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>
9862 <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>
9863 <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>
9864 <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>
9865 <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>
9866
9867 !! end
9868
9869 !! test
9870 TOC with wgMaxTocLevel=3 (bug 6204)
9871 !! options
9872 wgMaxTocLevel=3
9873 !! input
9874 == title 1 ==
9875 === title 1.1 ===
9876 ==== title 1.1.1 ====
9877 === title 1.2 ===
9878 == title 2 ==
9879 === title 2.1 ===
9880 !! result
9881 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9882 <ul>
9883 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9884 <ul>
9885 <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>
9886 <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>
9887 </ul>
9888 </li>
9889 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9890 <ul>
9891 <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>
9892 </ul>
9893 </li>
9894 </ul>
9895 </div>
9896 <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>
9897 <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>
9898 <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>
9899 <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>
9900 <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>
9901 <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>
9902
9903 !! end
9904
9905 !! test
9906 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9907 !! options
9908 wgMaxTocLevel=3
9909 !! input
9910 ==Section 1==
9911 ===Section 1.1===
9912 ====Section 1.1.1====
9913 ====Section 1.1.1.1====
9914 ==Section 2==
9915 !! result
9916 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9917 <ul>
9918 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9919 <ul>
9920 <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>
9921 </ul>
9922 </li>
9923 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9924 </ul>
9925 </div>
9926 <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>
9927 <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>
9928 <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>
9929 <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>
9930 <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>
9931
9932 !! end
9933
9934
9935 !! test
9936 Resolving duplicate section names
9937 !! input
9938 == Foo bar ==
9939 == Foo bar ==
9940 !! result
9941 <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>
9942 <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>
9943
9944 !! end
9945
9946 !! test
9947 Resolving duplicate section names with differing case (bug 10721)
9948 !! input
9949 == Foo bar ==
9950 == Foo Bar ==
9951 !! result
9952 <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>
9953 <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>
9954
9955 !! end
9956
9957 !! article
9958 Template:sections
9959 !! text
9960 ===Section 1===
9961 ==Section 2==
9962 !! endarticle
9963
9964 !! test
9965 Template with sections, __NOTOC__
9966 !! input
9967 __NOTOC__
9968 ==Section 0==
9969 {{sections}}
9970 ==Section 4==
9971 !! result
9972 <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>
9973 <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>
9974 <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>
9975 <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>
9976
9977 !! end
9978
9979 !! test
9980 __NOEDITSECTION__ keyword
9981 !! input
9982 __NOEDITSECTION__
9983 ==Section 1==
9984 ==Section 2==
9985 !! result
9986 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9987 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9988
9989 !! end
9990
9991 !! test
9992 Link inside a section heading
9993 !! input
9994 ==Section with a [[Main Page|link]] in it==
9995 !! result
9996 <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>
9997
9998 !! end
9999
10000 !! test
10001 TOC regression (bug 12077)
10002 !! input
10003 __TOC__
10004 == title 1 ==
10005 === title 1.1 ===
10006 == title 2 ==
10007 !! result
10008 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10009 <ul>
10010 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10011 <ul>
10012 <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>
10013 </ul>
10014 </li>
10015 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10016 </ul>
10017 </div>
10018 <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>
10019 <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>
10020 <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>
10021
10022 !! end
10023
10024 !! test
10025 BUG 1219 URL next to image (good)
10026 !! input
10027 http://example.com [[Image:foobar.jpg]]
10028 !! result
10029 <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>
10030 </p>
10031 !!end
10032
10033 !! test
10034 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10035 !! input
10036 ===
10037 The line above must have a trailing space!
10038 === <!--
10039 --> <!-- -->
10040 But just in case it doesn't...
10041 !! result
10042 <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>
10043 <p>The line above must have a trailing space!
10044 </p>
10045 <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>
10046 <p>But just in case it doesn't...
10047 </p>
10048 !! end
10049
10050 !! test
10051 Header with special characters (bug 25462)
10052 !! input
10053 The tooltips shall not show entities to the user (ie. be double escaped)
10054
10055 == text > text ==
10056 section 1
10057
10058 == text < text ==
10059 section 2
10060
10061 == text & text ==
10062 section 3
10063
10064 == text ' text ==
10065 section 4
10066
10067 == text " text ==
10068 section 5
10069 !! result
10070 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10071 </p>
10072 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10073 <ul>
10074 <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>
10075 <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>
10076 <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>
10077 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10078 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10079 </ul>
10080 </div>
10081 <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>
10082 <p>section 1
10083 </p>
10084 <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>
10085 <p>section 2
10086 </p>
10087 <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>
10088 <p>section 3
10089 </p>
10090 <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>
10091 <p>section 4
10092 </p>
10093 <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>
10094 <p>section 5
10095 </p>
10096 !! end
10097
10098 !! test
10099 Headers with excess '=' characters
10100 (Are similar tests necessary beyond the 1st level?)
10101 !! input
10102 =foo==
10103 ==foo=
10104 =''italic'' heading==
10105 ==''italic'' heading=
10106 !! result
10107 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10108 <ul>
10109 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10110 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10111 <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>
10112 <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>
10113 </ul>
10114 </div>
10115 <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>
10116 <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>
10117 <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>
10118 <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>
10119
10120 !! end
10121
10122 !! test
10123 HTML headers vs TOC (bug 23393)
10124 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10125 !! input
10126 <h1>Header 1</h1>
10127 == Header 1.1 ==
10128 == Header 1.2 ==
10129
10130 <h1>Header 2
10131 </h1>
10132 == Header 2.1 ==
10133 == Header 2.2 ==
10134 __NOEDITSECTION__
10135 !! result
10136 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10137 <ul>
10138 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10139 <ul>
10140 <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>
10141 <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>
10142 </ul>
10143 </li>
10144 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10145 <ul>
10146 <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>
10147 <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>
10148 </ul>
10149 </li>
10150 </ul>
10151 </div>
10152 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10153 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10154 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10155 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10156 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10157 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10158
10159 !! end
10160
10161 !! test
10162 BUG 1219 URL next to image (broken)
10163 !! input
10164 http://example.com[[Image:foobar.jpg]]
10165 !! result
10166 <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>
10167 </p>
10168 !!end
10169
10170 !! test
10171 Bug 1186 news: in the middle of text
10172 !! input
10173 http://en.wikinews.org/wiki/Wikinews:Workplace
10174 !! result
10175 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10176 </p>
10177 !!end
10178
10179
10180 !! test
10181 Namespaced link must have a title
10182 !! input
10183 [[Project:]]
10184 !! result
10185 <p>[[Project:]]
10186 </p>
10187 !!end
10188
10189 !! test
10190 Namespaced link must have a title (bad fragment version)
10191 !! input
10192 [[Project:#fragment]]
10193 !! result
10194 <p>[[Project:#fragment]]
10195 </p>
10196 !!end
10197
10198
10199 ###
10200 ### HTML tags and HTML attributes
10201 ###
10202
10203 !! test
10204 div with no attributes
10205 !! input
10206 <div>HTML rocks</div>
10207 !! result
10208 <div>HTML rocks</div>
10209
10210 !! end
10211
10212 !! test
10213 div with double-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 single-quoted 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 unquoted attribute
10232 !! input
10233 <div id=rock>HTML rocks</div>
10234 !! result
10235 <div id="rock">HTML rocks</div>
10236
10237 !! end
10238
10239 !! test
10240 div with illegal double attributes
10241 !! input
10242 <div id="a" id="b">HTML rocks</div>
10243 !! result
10244 <div id="b">HTML rocks</div>
10245
10246 !!end
10247
10248 # FIXME: produce empty string instead of "class" in the PHP parser, following
10249 # the HTML5 spec.
10250 !! test
10251 div with empty attribute value, space before equals
10252 !! options
10253 parsoid
10254 !! input
10255 <div class =>HTML rocks</div>
10256 !! result
10257 <div class="">HTML rocks</div>
10258
10259 !! end
10260
10261 # The PHP parser escapes the opening brace to &#123; for some reason, so
10262 # disabled this test for it.
10263 !! test
10264 div with braces in attribute value
10265 !! options
10266 parsoid
10267 !! input
10268 <div title="{}">Foo</div>
10269 !! result
10270 <div title="{}">Foo</div>
10271 !! end
10272
10273 # This it very inconsistent in the PHP parser: it returns
10274 # class="class" if there is a space between the name and the equal sign (see
10275 # 'div with empty attribute value, space before equals'), but strips the
10276 # attribute completely if the space is missing. We hope that not much content
10277 # depends on this, so are implementing the behavior below in Parsoid for
10278 # consistencies' sake. Disabled for the PHP parser.
10279 # FIXME: fix this behavior in the PHP parser?
10280 !! test
10281 div with empty attribute value, no space before equals
10282 !! options
10283 parsoid
10284 !! input
10285 <div class=>HTML rocks</div>
10286 !! result
10287 <div class="">HTML rocks</div>
10288
10289 !! end
10290
10291 !! test
10292 HTML multiple attributes correction
10293 !! input
10294 <p class="error" class="awesome">Awesome!</p>
10295 !! result
10296 <p class="awesome">Awesome!</p>
10297
10298 !!end
10299
10300 !! test
10301 Table multiple attributes correction
10302 !! input
10303 {|
10304 !+ class="error" class="awesome"| status
10305 |}
10306 !! result
10307 <table>
10308 <tr>
10309 <th class="awesome"> status
10310 </th></tr></table>
10311
10312 !!end
10313
10314 !! test
10315 DIV IN UPPERCASE
10316 !! input
10317 <DIV ID="x">HTML ROCKS</DIV>
10318 !! result
10319 <div id="x">HTML ROCKS</div>
10320
10321 !!end
10322
10323 !! test
10324 Non-ASCII pseudo-tags are rendered as text
10325 !! input
10326 <khyô>
10327 !! result
10328 <p>&lt;khyô&gt;
10329 </p>
10330 !! end
10331
10332 !! test
10333 Pseudo-tag with URL 'name' renders as url link
10334 !! input
10335 <http://example.com/>
10336 !! result
10337 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10338 </p>
10339 !! end
10340
10341 !! test
10342 text with amp in the middle of nowhere
10343 !! input
10344 Remember AT&T?
10345 !!result
10346 <p>Remember AT&amp;T?
10347 </p>
10348 !! end
10349
10350 !! test
10351 text with character entity: eacute
10352 !! input
10353 I always thought &eacute; was a cute letter.
10354 !! result
10355 <p>I always thought &#233; was a cute letter.
10356 </p>
10357 !! end
10358
10359 !! test
10360 text with entity-escaped character entity-like string: eacute
10361 !! input
10362 I always thought &amp;eacute; was a cute letter.
10363 !! result
10364 <p>I always thought &amp;eacute; was a cute letter.
10365 </p>
10366 !! end
10367
10368 !! test
10369 text with undefined character entity: xacute
10370 !! input
10371 I always thought &xacute; was a cute letter.
10372 !! result
10373 <p>I always thought &amp;xacute; was a cute letter.
10374 </p>
10375 !! end
10376
10377
10378 ###
10379 ### Nesting tests (see bug 41545, 50604, 51081)
10380 ###
10381
10382 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10383 # Note that html2wt is considerably more difficult if we use <b> in
10384 # the test case, instead of <big>
10385 !! test
10386 Ensure that HTML adoption agency algorithm is properly implemented.
10387 !! input
10388 <big>X<big>Y</big>Z</big>
10389 !! result
10390 <p><big>X<big>Y</big>Z</big>
10391 </p>
10392 !! end
10393
10394 # This was bug 41545 in the PHP parser.
10395 !! test
10396 Nesting of <kbd>
10397 !! input
10398 <kbd>X<kbd>Y</kbd>Z</kbd>
10399 !! result
10400 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10401 </p>
10402 !! end
10403
10404 # The following cases were bug 51081 in the PHP parser.
10405 # Note that there are some other nestable tags (b, i, etc) which are
10406 # not covered; see bug 51081 for discussion.
10407 !! test
10408 Nesting of <em>
10409 !! input
10410 <em>X<em>Y</em>Z</em>
10411 !! result
10412 <p><em>X<em>Y</em>Z</em>
10413 </p>
10414 !! end
10415
10416 !! test
10417 Nesting of <strong>
10418 !! input
10419 <strong>X<strong>Y</strong>Z</strong>
10420 !! result
10421 <p><strong>X<strong>Y</strong>Z</strong>
10422 </p>
10423 !! end
10424
10425 !! test
10426 Nesting of <q>
10427 !! input
10428 <q>X<q>Y</q>Z</q>
10429 !! result
10430 <p><q>X<q>Y</q>Z</q>
10431 </p>
10432 !! end
10433
10434 !! test
10435 Nesting of <ruby>
10436 !! input
10437 <ruby>X<ruby>Y</ruby>Z</ruby>
10438 !! result
10439 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10440 </p>
10441 !! end
10442
10443 !! test
10444 Nesting of <bdo>
10445 !! input
10446 <bdo>X<bdo>Y</bdo>Z</bdo>
10447 !! result
10448 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10449 </p>
10450 !! end
10451
10452
10453 ###
10454 ### Media links
10455 ###
10456
10457 !! test
10458 Media link
10459 !! input
10460 [[Media:Foobar.jpg]]
10461 !! result
10462 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10463 </p>
10464 !! end
10465
10466 !! test
10467 Media link with text
10468 !! input
10469 [[Media:Foobar.jpg|A neat file to look at]]
10470 !! result
10471 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10472 </p>
10473 !! end
10474
10475 # FIXME: this is still bad HTML tag nesting
10476 !! test
10477 Media link with nasty text
10478 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10479 !! input
10480 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10481 !! result
10482 <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>
10483
10484 !! end
10485
10486 !! test
10487 Media link to nonexistent file (bug 1702)
10488 !! input
10489 [[Media:No such.jpg]]
10490 !! result
10491 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10492 </p>
10493 !! end
10494
10495 !! test
10496 Image link to nonexistent file (bug 1850 - good)
10497 !! input
10498 [[Image:No such.jpg]]
10499 !! result
10500 <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>
10501 </p>
10502 !! end
10503
10504 !! test
10505 :Image link to nonexistent file (bug 1850 - bad)
10506 !! input
10507 [[:Image:No such.jpg]]
10508 !! result
10509 <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>
10510 </p>
10511 !! end
10512
10513
10514
10515 !! test
10516 Character reference normalization in link text (bug 1938)
10517 !! input
10518 [[Main Page|this&that]]
10519 !! result
10520 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10521 </p>
10522 !!end
10523
10524 !! article
10525 אַ
10526 !! text
10527 Test for unicode normalization
10528
10529 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10530 !! endarticle
10531
10532 !! test
10533 (bug 19451) Links should refer to the normalized form.
10534 !! input
10535 [[&#xFB2E;]]
10536 [[&#x5d0;&#x5b7;]]
10537 [[&#x5d0;ַ]]
10538 [[א&#x5b7;]]
10539 [[אַ]]
10540 !! result
10541 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10542 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10543 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10544 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10545 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10546 </p>
10547 !! end
10548
10549 !! test
10550 Empty attribute crash test (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 Empty attribute crash test single-quotes (bug 2067)
10560 !! input
10561 <font color=''>foo</font>
10562 !! result
10563 <p><font color="">foo</font>
10564 </p>
10565 !! end
10566
10567 !! test
10568 Attribute test: equals, then nothing
10569 !! input
10570 <font color=>foo</font>
10571 !! result
10572 <p><font>foo</font>
10573 </p>
10574 !! end
10575
10576 !! test
10577 Attribute test: unquoted value
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: unquoted but illegal value (hash)
10587 !! input
10588 <font color=#x>foo</font>
10589 !! result
10590 <p><font color="#x">foo</font>
10591 </p>
10592 !! end
10593
10594 !! test
10595 Attribute test: no value
10596 !! input
10597 <font color>foo</font>
10598 !! result
10599 <p><font color="color">foo</font>
10600 </p>
10601 !! end
10602
10603 !! test
10604 Bug 2095: link with three closing brackets
10605 !! input
10606 [[Main Page]]]
10607 !! result
10608 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10609 </p>
10610 !! end
10611
10612 !! test
10613 Bug 2095: link with pipe and three closing brackets
10614 !! input
10615 [[Main Page|link]]]
10616 !! result
10617 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10618 </p>
10619 !! end
10620
10621 !! test
10622 Bug 2095: link with pipe and three closing brackets, version 2
10623 !! input
10624 [[Main Page|[http://example.com/]]]
10625 !! result
10626 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10627 </p>
10628 !! end
10629
10630
10631 ###
10632 ### Safety
10633 ###
10634
10635 !! article
10636 Template:Dangerous attribute
10637 !! text
10638 " onmouseover="alert(document.cookie)
10639 !! endarticle
10640
10641 !! article
10642 Template:Dangerous style attribute
10643 !! text
10644 border-size: expression(alert(document.cookie))
10645 !! endarticle
10646
10647 !! article
10648 Template:Div style
10649 !! text
10650 <div style="float: right; {{{1}}}">Magic div</div>
10651 !! endarticle
10652
10653 !! test
10654 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10655 !! input
10656 <div title="{{test}}"></div>
10657 !! result
10658 <div title="This is a test template"></div>
10659
10660 !! end
10661
10662 !! test
10663 Bug 2304: HTML attribute safety (dangerous template; 2309)
10664 !! input
10665 <div title="{{dangerous attribute}}"></div>
10666 !! result
10667 <div title=""></div>
10668
10669 !! end
10670
10671 !! test
10672 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10673 !! input
10674 <div style="{{dangerous style attribute}}"></div>
10675 !! result
10676 <div style="/* insecure input */"></div>
10677
10678 !! end
10679
10680 !! test
10681 Bug 2304: HTML attribute safety (safe parameter; 2309)
10682 !! input
10683 {{div style|width: 200px}}
10684 !! result
10685 <div style="float: right; width: 200px">Magic div</div>
10686
10687 !! end
10688
10689 !! test
10690 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10691 !! input
10692 {{div style|width: expression(alert(document.cookie))}}
10693 !! result
10694 <div style="/* insecure input */">Magic div</div>
10695
10696 !! end
10697
10698 !! test
10699 Bug 2304: HTML attribute safety (unsafe breakout parameter; 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 (unsafe breakout parameter 2; 2309)
10709 !! input
10710 {{div style|" ><script>alert(document.cookie)</script>}}
10711 !! result
10712 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10713
10714 !! end
10715
10716 !! test
10717 Bug 2304: HTML attribute safety (link)
10718 !! input
10719 <div title="[[Main Page]]"></div>
10720 !! result
10721 <div title="&#91;&#91;Main Page]]"></div>
10722
10723 !! end
10724
10725 !! test
10726 Bug 2304: HTML attribute safety (italics)
10727 !! input
10728 <div title="''foobar''"></div>
10729 !! result
10730 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10731
10732 !! end
10733
10734 !! test
10735 Bug 2304: HTML attribute safety (bold)
10736 !! input
10737 <div title="'''foobar'''"></div>
10738 !! result
10739 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10740
10741 !! end
10742
10743
10744 !! test
10745 Bug 2304: HTML attribute safety (ISBN)
10746 !! input
10747 <div title="ISBN 1234567890"></div>
10748 !! result
10749 <div title="&#73;SBN 1234567890"></div>
10750
10751 !! end
10752
10753 !! test
10754 Bug 2304: HTML attribute safety (RFC)
10755 !! input
10756 <div title="RFC 1234"></div>
10757 !! result
10758 <div title="&#82;FC 1234"></div>
10759
10760 !! end
10761
10762 !! test
10763 Bug 2304: HTML attribute safety (PMID)
10764 !! input
10765 <div title="PMID 1234567890"></div>
10766 !! result
10767 <div title="&#80;MID 1234567890"></div>
10768
10769 !! end
10770
10771 !! test
10772 Bug 2304: HTML attribute safety (web link)
10773 !! input
10774 <div title="http://example.com/"></div>
10775 !! result
10776 <div title="http&#58;//example.com/"></div>
10777
10778 !! end
10779
10780 !! test
10781 Bug 2304: HTML attribute safety (named web link)
10782 !! input
10783 <div title="[http://example.com/ link]"></div>
10784 !! result
10785 <div title="&#91;http&#58;//example.com/ link]"></div>
10786
10787 !! end
10788
10789 !! test
10790 Bug 3244: HTML attribute safety (extension; safe)
10791 !! input
10792 <div style="<nowiki>background:blue</nowiki>"></div>
10793 !! result
10794 <div style="background:blue"></div>
10795
10796 !! end
10797
10798 !! test
10799 Bug 3244: HTML attribute safety (extension; unsafe)
10800 !! input
10801 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10802 !! result
10803 <div style="/* insecure input */"></div>
10804
10805 !! end
10806
10807 # More MSIE fun discovered by Tom Gilder
10808
10809 !! test
10810 MSIE CSS safety test: spurious slash
10811 !! input
10812 <div style="background-image:u\rl(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: hex code
10820 !! input
10821 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10822 !! result
10823 <div style="/* insecure input */">evil</div>
10824
10825 !! end
10826
10827 !! test
10828 MSIE CSS safety test: comment in url
10829 !! input
10830 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10831 !! result
10832 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10833
10834 !! end
10835
10836 !! test
10837 MSIE CSS safety test: comment in expression
10838 !! input
10839 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10840 !! result
10841 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10842
10843 !! end
10844
10845
10846 !! test
10847 Table attribute legitimate extension
10848 !! input
10849 {|
10850 !+ style="<nowiki>color:blue</nowiki>"| status
10851 |}
10852 !! result
10853 <table>
10854 <tr>
10855 <th style="color:blue"> status
10856 </th></tr></table>
10857
10858 !!end
10859
10860 !! test
10861 Table attribute safety
10862 !! input
10863 {|
10864 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10865 |}
10866 !! result
10867 <table>
10868 <tr>
10869 <th style="/* insecure input */"> status
10870 </th></tr></table>
10871
10872 !! end
10873
10874 !! test
10875 CSS line continuation 1
10876 !! input
10877 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10878 !! result
10879 <div style="/* insecure input */"></div>
10880
10881 !! end
10882
10883 !! test
10884 CSS line continuation 2
10885 !! input
10886 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10887 !! result
10888 <div style="/* insecure input */"></div>
10889
10890 !! end
10891
10892 !! article
10893 Template:Identity
10894 !! text
10895 {{{1}}}
10896 !! endarticle
10897
10898 !! test
10899 Expansion of multi-line templates in attribute values (bug 6255)
10900 !! input
10901 <div style="background: {{identity|#00FF00}}">-</div>
10902 !! result
10903 <div style="background: #00FF00">-</div>
10904
10905 !! end
10906
10907
10908 !! test
10909 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10910 !! input
10911 <div style="background:
10912 #00FF00">-</div>
10913 !! result
10914 <div style="background: #00FF00">-</div>
10915
10916 !! end
10917
10918 !! test
10919 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10920 !! input
10921 <div style="background: &#10;#00FF00">-</div>
10922 !! result
10923 <div style="background: &#10;#00FF00">-</div>
10924
10925 !! end
10926
10927 ###
10928 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10929 ###
10930 !! test
10931 Parser hook: empty input
10932 !! input
10933 <tag></tag>
10934 !! result
10935 <pre>
10936 ''
10937 array (
10938 )
10939 </pre>
10940
10941 !! end
10942
10943 !! test
10944 Parser hook: empty input using terminated empty elements
10945 !! input
10946 <tag/>
10947 !! result
10948 <pre>
10949 NULL
10950 array (
10951 )
10952 </pre>
10953
10954 !! end
10955
10956 !! test
10957 Parser hook: empty input using terminated empty elements (space before)
10958 !! input
10959 <tag />
10960 !! result
10961 <pre>
10962 NULL
10963 array (
10964 )
10965 </pre>
10966
10967 !! end
10968
10969 !! test
10970 Parser hook: basic input
10971 !! input
10972 <tag>input</tag>
10973 !! result
10974 <pre>
10975 'input'
10976 array (
10977 )
10978 </pre>
10979
10980 !! end
10981
10982
10983 !! test
10984 Parser hook: case insensitive
10985 !! input
10986 <TAG>input</TAG>
10987 !! result
10988 <pre>
10989 'input'
10990 array (
10991 )
10992 </pre>
10993
10994 !! end
10995
10996
10997 !! test
10998 Parser hook: case insensitive, redux
10999 !! input
11000 <TaG>input</TAg>
11001 !! result
11002 <pre>
11003 'input'
11004 array (
11005 )
11006 </pre>
11007
11008 !! end
11009
11010 !! test
11011 Parser hook: nested tags
11012 !! options
11013 noxml
11014 !! input
11015 <tag><tag></tag></tag>
11016 !! result
11017 <pre>
11018 '<tag>'
11019 array (
11020 )
11021 </pre>&lt;/tag&gt;
11022
11023 !! end
11024
11025 !! test
11026 Parser hook: basic arguments
11027 !! input
11028 <tag width=200 height = "100" depth = '50' square></tag>
11029 !! result
11030 <pre>
11031 ''
11032 array (
11033 'width' => '200',
11034 'height' => '100',
11035 'depth' => '50',
11036 'square' => 'square',
11037 )
11038 </pre>
11039
11040 !! end
11041
11042 !! test
11043 Parser hook: argument containing a forward slash (bug 5344)
11044 !! input
11045 <tag filename='/tmp/bla'></tag>
11046 !! result
11047 <pre>
11048 ''
11049 array (
11050 'filename' => '/tmp/bla',
11051 )
11052 </pre>
11053
11054 !! end
11055
11056 !! test
11057 Parser hook: empty input using terminated empty elements (bug 2374)
11058 !! input
11059 <tag foo=bar/>text
11060 !! result
11061 <pre>
11062 NULL
11063 array (
11064 'foo' => 'bar',
11065 )
11066 </pre>text
11067
11068 !! end
11069
11070 # </tag> should be output literally since there is no matching tag that begins it
11071 !! test
11072 Parser hook: basic arguments using terminated empty elements (bug 2374)
11073 !! input
11074 <tag width=200 height = "100" depth = '50' square/>
11075 other stuff
11076 </tag>
11077 !! result
11078 <pre>
11079 NULL
11080 array (
11081 'width' => '200',
11082 'height' => '100',
11083 'depth' => '50',
11084 'square' => 'square',
11085 )
11086 </pre>
11087 <p>other stuff
11088 &lt;/tag&gt;
11089 </p>
11090 !! end
11091
11092 ###
11093 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11094 ###
11095
11096 !! test
11097 Parser hook: static parser hook not inside a comment
11098 !! input
11099 <statictag>hello, world</statictag>
11100 <statictag action=flush/>
11101 !! result
11102 <p>hello, world
11103 </p>
11104 !! end
11105
11106
11107 !! test
11108 Parser hook: static parser hook inside a comment
11109 !! input
11110 <!-- <statictag>hello, world</statictag> -->
11111 <statictag action=flush/>
11112 !! result
11113 <p><br />
11114 </p>
11115 !! end
11116
11117 # Nested template calls; this case was broken by Parser.php rev 1.506,
11118 # since reverted.
11119
11120 !! article
11121 Template:One-parameter
11122 !! text
11123 (My parameter is: {{{1}}})
11124 !! endarticle
11125
11126 !! article
11127 Template:Map-one-parameter
11128 !! text
11129 {{{{{1}}}|{{{2}}}}}
11130 !! endarticle
11131
11132 !! test
11133 Nested template calls
11134 !! input
11135 {{Map-one-parameter|One-parameter|param}}
11136 !! result
11137 <p>(My parameter is: param)
11138 </p>
11139 !! end
11140
11141
11142 ###
11143 ### Sanitizer
11144 ###
11145 !! test
11146 Sanitizer: Closing of open tags
11147 !! input
11148 <s></s><table></table>
11149 !! result
11150 <s></s><table></table>
11151
11152 !! end
11153
11154 !! test
11155 Sanitizer: Closing of open but not closed tags
11156 !! input
11157 <s>foo
11158 !! result
11159 <p><s>foo</s>
11160 </p>
11161 !! end
11162
11163 !! test
11164 Sanitizer: Closing of closed but not open tags
11165 !! input
11166 </s>
11167 !! result
11168 <p>&lt;/s&gt;
11169 </p>
11170 !! end
11171
11172 !! test
11173 Sanitizer: Closing of closed but not open table tags
11174 !! input
11175 Table not started</td></tr></table>
11176 !! result
11177 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11178 </p>
11179 !! end
11180
11181 !! test
11182 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11183 !! input
11184 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11185 !! result
11186 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11187 </p>
11188 !! end
11189
11190 !! test
11191 Sanitizer: Validating the contents of the id attribute (bug 4515)
11192 !! options
11193 disabled
11194 !! input
11195 <br id=9 />
11196 !! result
11197 Something, but definitely not <br id="9" />...
11198 !! end
11199
11200 !! test
11201 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11202 !! options
11203 disabled
11204 !! input
11205 <br id="foo" /><br id="foo" />
11206 !! result
11207 Something need to be done. foo-2 ?
11208 !! end
11209
11210 !! test
11211 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11212 !! input
11213 <div itemscope>
11214 <meta itemprop="hello" content="world">
11215 <meta http-equiv="refresh" content="5">
11216 <meta itemprop="hello" http-equiv="refresh" content="5">
11217 <link itemprop="hello" href="{{SERVER}}">
11218 <link rel="stylesheet" href="{{SERVER}}">
11219 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11220 </div>
11221 !! result
11222 <div itemscope="itemscope">
11223 <p> <meta itemprop="hello" content="world" />
11224 &lt;meta http-equiv="refresh" content="5"&gt;
11225 <meta itemprop="hello" content="5" />
11226 </p>
11227 <link itemprop="hello" href="http&#58;//example.org" />
11228 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11229 <link itemprop="hello" href="http&#58;//example.org" />
11230 </div>
11231
11232 !! end
11233
11234 !! test
11235 Language converter: output gets cut off unexpectedly (bug 5757)
11236 !! options
11237 language=zh
11238 !! input
11239 this bit is safe: }-
11240
11241 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11242
11243 then we get cut off here: }-
11244
11245 all additional text is vanished
11246 !! result
11247 <p>this bit is safe: }-
11248 </p><p>but if we add a conversion instance: xxx
11249 </p><p>then we get cut off here: }-
11250 </p><p>all additional text is vanished
11251 </p>
11252 !! end
11253
11254 !! test
11255 Self closed html pairs (bug 5487)
11256 !! options
11257 !! input
11258 <center><font id="bug" />Centered text</center>
11259 <div><font id="bug2" />In div text</div>
11260 !! result
11261 <center>&lt;font id="bug" /&gt;Centered text</center>
11262 <div>&lt;font id="bug2" /&gt;In div text</div>
11263
11264 !! end
11265
11266 #
11267 #
11268 #
11269
11270 !! test
11271 Punctuation: nbsp before exclamation
11272 !! input
11273 C'est grave !
11274 !! result
11275 <p>C'est grave&#160;!
11276 </p>
11277 !! end
11278
11279 !! test
11280 Punctuation: CSS !important (bug 11874)
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 !! test
11289 Punctuation: CSS ! important (bug 11874; with space after)
11290 !! input
11291 <div style="width:50% ! important">important</div>
11292 !! result
11293 <div style="width:50% ! important">important</div>
11294
11295 !!end
11296
11297
11298 !! test
11299 HTML bullet list, closed tags (bug 5497)
11300 !! input
11301 <ul>
11302 <li>One</li>
11303 <li>Two</li>
11304 </ul>
11305 !! result
11306 <ul>
11307 <li>One</li>
11308 <li>Two</li>
11309 </ul>
11310
11311 !! end
11312
11313 !! test
11314 HTML bullet list, unclosed tags (bug 5497)
11315 !! options
11316 disabled
11317 !! input
11318 <ul>
11319 <li>One
11320 <li>Two
11321 </ul>
11322 !! result
11323 <ul>
11324 <li>One
11325 </li><li>Two
11326 </li></ul>
11327
11328 !! end
11329
11330 !! test
11331 HTML ordered list, closed tags (bug 5497)
11332 !! input
11333 <ol>
11334 <li>One</li>
11335 <li>Two</li>
11336 </ol>
11337 !! result
11338 <ol>
11339 <li>One</li>
11340 <li>Two</li>
11341 </ol>
11342
11343 !! end
11344
11345 !! test
11346 HTML ordered list, unclosed tags (bug 5497)
11347 !! options
11348 disabled
11349 !! input
11350 <ol>
11351 <li>One
11352 <li>Two
11353 </ol>
11354 !! result
11355 <ol>
11356 <li>One
11357 </li><li>Two
11358 </li></ol>
11359
11360 !! end
11361
11362 !! test
11363 HTML nested bullet list, closed tags (bug 5497)
11364 !! input
11365 <ul>
11366 <li>One</li>
11367 <li>Two:
11368 <ul>
11369 <li>Sub-one</li>
11370 <li>Sub-two</li>
11371 </ul>
11372 </li>
11373 </ul>
11374 !! result
11375 <ul>
11376 <li>One</li>
11377 <li>Two:
11378 <ul>
11379 <li>Sub-one</li>
11380 <li>Sub-two</li>
11381 </ul>
11382 </li>
11383 </ul>
11384
11385 !! end
11386
11387 !! test
11388 HTML nested bullet list, open tags (bug 5497)
11389 !! options
11390 disabled
11391 !! input
11392 <ul>
11393 <li>One
11394 <li>Two:
11395 <ul>
11396 <li>Sub-one
11397 <li>Sub-two
11398 </ul>
11399 </ul>
11400 !! result
11401 <ul>
11402 <li>One
11403 </li><li>Two:
11404 <ul>
11405 <li>Sub-one
11406 </li><li>Sub-two
11407 </li></ul>
11408 </li></ul>
11409
11410 !! end
11411
11412 !! test
11413 HTML nested ordered list, closed tags (bug 5497)
11414 !! input
11415 <ol>
11416 <li>One</li>
11417 <li>Two:
11418 <ol>
11419 <li>Sub-one</li>
11420 <li>Sub-two</li>
11421 </ol>
11422 </li>
11423 </ol>
11424 !! result
11425 <ol>
11426 <li>One</li>
11427 <li>Two:
11428 <ol>
11429 <li>Sub-one</li>
11430 <li>Sub-two</li>
11431 </ol>
11432 </li>
11433 </ol>
11434
11435 !! end
11436
11437 !! test
11438 HTML nested ordered list, open tags (bug 5497)
11439 !! options
11440 disabled
11441 !! input
11442 <ol>
11443 <li>One
11444 <li>Two:
11445 <ol>
11446 <li>Sub-one
11447 <li>Sub-two
11448 </ol>
11449 </ol>
11450 !! result
11451 <ol>
11452 <li>One
11453 </li><li>Two:
11454 <ol>
11455 <li>Sub-one
11456 </li><li>Sub-two
11457 </li></ol>
11458 </li></ol>
11459
11460 !! end
11461
11462 !! test
11463 HTML ordered list item with parameters oddity
11464 !! input
11465 <ol><li id="fragment">One</li></ol>
11466 !! result
11467 <ol><li id="fragment">One</li></ol>
11468
11469 !! end
11470
11471 !!test
11472 bug 5918: autonumbering
11473 !! input
11474 [http://first/] [http://second] [ftp://ftp]
11475
11476 ftp://inlineftp
11477
11478 [mailto:enclosed@mail.tld With target]
11479
11480 [mailto:enclosed@mail.tld]
11481
11482 mailto:inline@mail.tld
11483 !! result
11484 <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>
11485 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11486 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11487 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11488 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11489 </p>
11490 !! end
11491
11492
11493 #
11494 # Security and HTML correctness
11495 # From Nick Jenkins' fuzz testing
11496 #
11497
11498 !! test
11499 Fuzz testing: Parser13
11500 !! input
11501 {|
11502 | http://a|
11503 !! result
11504 <table>
11505 <tr>
11506 <td>
11507 </td>
11508 </tr>
11509 </table>
11510
11511 !! end
11512
11513 !! test
11514 Fuzz testing: Parser14
11515 !! input
11516 == onmouseover= ==
11517 http://__TOC__
11518 !! result
11519 <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>
11520 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11521 <ul>
11522 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11523 </ul>
11524 </div>
11525
11526 !! end
11527
11528 !! test
11529 Fuzz testing: Parser14-table
11530 !! input
11531 ==a==
11532 {| STYLE=__TOC__
11533 !! result
11534 <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>
11535 <table style="&#95;_TOC&#95;_">
11536 <tr><td></td></tr>
11537 </table>
11538
11539 !! end
11540
11541 # Known to produce bogus xml (extra </td>)
11542 !! test
11543 Fuzz testing: Parser16
11544 !! options
11545 noxml
11546 !! input
11547 {|
11548 !https://||||||
11549 !! result
11550 <table>
11551 <tr>
11552 <th>https://</th>
11553 <th></th>
11554 <th></th>
11555 <th>
11556 </td>
11557 </tr>
11558 </table>
11559
11560 !! end
11561
11562 !! test
11563 Fuzz testing: Parser21
11564 !! input
11565 {|
11566 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11567 |
11568 !! result
11569 <table>
11570 <tr>
11571 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11572 </th>
11573 <td>
11574 </td>
11575 </tr>
11576 </table>
11577
11578 !! end
11579
11580 !! test
11581 Fuzz testing: Parser22
11582 !! input
11583 http://===r:::https://b
11584
11585 {|
11586 !!result
11587 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11588 </p>
11589 <table>
11590 <tr><td></td></tr>
11591 </table>
11592
11593 !! end
11594
11595 # Known to produce bad XML for now
11596 !! test
11597 Fuzz testing: Parser24
11598 !! options
11599 noxml
11600 !! input
11601 {|
11602 {{{|
11603 <u CLASS=
11604 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11605 <br style="onmouseover='alert(document.cookie);' " />
11606
11607 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11608 |
11609 !! result
11610 <table>
11611 {{{|
11612 <u class="&#124;">}}}} &gt;
11613 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11614
11615 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11616 <tr>
11617 <td></u>
11618 </td>
11619 </tr>
11620 </table>
11621
11622 !! end
11623
11624 # Note: the current result listed for this is not what the original one was,
11625 # but the original bug was JavaScript injection, which is fixed in any case.
11626 # It's not clear that the original result listed was any more correct than the
11627 # current one. Original result:
11628 # <p>{{{|
11629 # </p>
11630 # <li class="&#124;&#124;">
11631 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11632 !!test
11633 Fuzz testing: Parser25 (bug 6055)
11634 !! input
11635 {{{
11636 |
11637 <LI CLASS=||
11638 >
11639 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11640 !! result
11641 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11642 </p>
11643 !! end
11644
11645 !!test
11646 Fuzz testing: URL adjacent extension (with space, clean)
11647 !! options
11648 !! input
11649 http://example.com <nowiki>junk</nowiki>
11650 !! result
11651 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11652 </p>
11653 !!end
11654
11655 !!test
11656 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11657 !! options
11658 !! input
11659 http://example.com<nowiki>junk</nowiki>
11660 !! result
11661 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11662 </p>
11663 !!end
11664
11665 !!test
11666 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11667 !! options
11668 !! input
11669 http://example.com<pre>junk</pre>
11670 !! result
11671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11672
11673 !!end
11674
11675 !!test
11676 Fuzz testing: image with bogus manual thumbnail
11677 !!input
11678 [[Image:foobar.jpg|thumbnail= ]]
11679 !!result
11680 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11681
11682 !!end
11683
11684 !! test
11685 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11686 !! input
11687 <pre dir="&#10;"></pre>
11688 !! result
11689 <pre dir="&#10;"></pre>
11690
11691 !! end
11692
11693 !! test
11694 Parsing optional HTML elements (Bug 6171)
11695 !! options
11696 !! input
11697 <table>
11698 <tr>
11699 <td> Some tabular data</td>
11700 <td> More tabular data ...
11701 <td> And yet som tabular data</td>
11702 </tr>
11703 </table>
11704 !! result
11705 <table>
11706 <tr>
11707 <td> Some tabular data</td>
11708 <td> More tabular data ...
11709 </td><td> And yet som tabular data</td>
11710 </tr>
11711 </table>
11712
11713 !! end
11714
11715 !! test
11716 Correct handling of <td>, <tr> (Bug 6171)
11717 !! options
11718 !! input
11719 <table>
11720 <tr>
11721 <td> Some tabular data</td>
11722 <td> More tabular data ...</td>
11723 <td> And yet som tabular data</td>
11724 </tr>
11725 </table>
11726 !! result
11727 <table>
11728 <tr>
11729 <td> Some tabular data</td>
11730 <td> More tabular data ...</td>
11731 <td> And yet som tabular data</td>
11732 </tr>
11733 </table>
11734
11735 !! end
11736
11737
11738 !! test
11739 Parsing crashing regression (fr:JavaScript)
11740 !! input
11741 </body></x>
11742 !! result
11743 <p>&lt;/body&gt;&lt;/x&gt;
11744 </p>
11745 !! end
11746
11747 !! test
11748 Inline wiki vs wiki block nesting
11749 !! input
11750 '''Bold paragraph
11751
11752 New wiki paragraph
11753 !! result
11754 <p><b>Bold paragraph</b>
11755 </p><p>New wiki paragraph
11756 </p>
11757 !! end
11758
11759 !! test
11760 Inline HTML vs wiki block nesting
11761 !! options
11762 disabled
11763 !! input
11764 <b>Bold paragraph
11765
11766 New wiki paragraph
11767 !! result
11768 <p><b>Bold paragraph</b>
11769 </p><p>New wiki paragraph
11770 </p>
11771 !! end
11772
11773 # Original result was this:
11774 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11775 # </p>
11776 # While that might be marginally more intuitive, maybe, the six-apostrophe
11777 # construct is clearly pathological and the result stated here (which is what
11778 # the parser actually does) is about as reasonable as anything.
11779 !!test
11780 Mixing markup for italics and bold
11781 !! options
11782 !! input
11783 '''bold''''''bold''bolditalics'''''
11784 !! result
11785 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11786 </p>
11787 !! end
11788
11789
11790 !! article
11791 Xyzzyx
11792 !! text
11793 Article for special page transclusion test
11794 !! endarticle
11795
11796 !! test
11797 Special page transclusion
11798 !! options
11799 !! input
11800 {{Special:Prefixindex/Xyzzyx}}
11801 !! result
11802 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11803
11804 !! end
11805
11806 !! test
11807 Special page transclusion twice (bug 5021)
11808 !! options
11809 !! input
11810 {{Special:Prefixindex/Xyzzyx}}
11811 {{Special:Prefixindex/Xyzzyx}}
11812 !! result
11813 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11814 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11815
11816 !! end
11817
11818 !! test
11819 Transclusion of default MediaWiki message
11820 !! input
11821 {{MediaWiki:Mainpage}}
11822 !!result
11823 <p>Main Page
11824 </p>
11825 !! end
11826
11827 !! test
11828 Transclusion of nonexistent MediaWiki message
11829 !! input
11830 {{MediaWiki:Mainpagexxx}}
11831 !!result
11832 <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>
11833 </p>
11834 !! end
11835
11836 !! test
11837 Transclusion of MediaWiki message with underscore
11838 !! input
11839 {{MediaWiki:history_short}}
11840 !! result
11841 <p>History
11842 </p>
11843 !! end
11844
11845 !! test
11846 Transclusion of MediaWiki message with space
11847 !! input
11848 {{MediaWiki:history short}}
11849 !! result
11850 <p>History
11851 </p>
11852 !! end
11853
11854 !! test
11855 Invalid header with following text
11856 !! input
11857 = x = y
11858 !! result
11859 <p>= x = y
11860 </p>
11861 !! end
11862
11863
11864 !! test
11865 Section extraction test (section 0)
11866 !! options
11867 section=0
11868 !! input
11869 start
11870 ==a==
11871 ===aa===
11872 ====aaa====
11873 ==b==
11874 ===ba===
11875 ===bb===
11876 ====bba====
11877 ===bc===
11878 ==c==
11879 ===ca===
11880 !! result
11881 start
11882 !! end
11883
11884 !! test
11885 Section extraction test (section 1)
11886 !! options
11887 section=1
11888 !! input
11889 start
11890 ==a==
11891 ===aa===
11892 ====aaa====
11893 ==b==
11894 ===ba===
11895 ===bb===
11896 ====bba====
11897 ===bc===
11898 ==c==
11899 ===ca===
11900 !! result
11901 ==a==
11902 ===aa===
11903 ====aaa====
11904 !! end
11905
11906 !! test
11907 Section extraction test (section 2)
11908 !! options
11909 section=2
11910 !! input
11911 start
11912 ==a==
11913 ===aa===
11914 ====aaa====
11915 ==b==
11916 ===ba===
11917 ===bb===
11918 ====bba====
11919 ===bc===
11920 ==c==
11921 ===ca===
11922 !! result
11923 ===aa===
11924 ====aaa====
11925 !! end
11926
11927 !! test
11928 Section extraction test (section 3)
11929 !! options
11930 section=3
11931 !! input
11932 start
11933 ==a==
11934 ===aa===
11935 ====aaa====
11936 ==b==
11937 ===ba===
11938 ===bb===
11939 ====bba====
11940 ===bc===
11941 ==c==
11942 ===ca===
11943 !! result
11944 ====aaa====
11945 !! end
11946
11947 !! test
11948 Section extraction test (section 4)
11949 !! options
11950 section=4
11951 !! input
11952 start
11953 ==a==
11954 ===aa===
11955 ====aaa====
11956 ==b==
11957 ===ba===
11958 ===bb===
11959 ====bba====
11960 ===bc===
11961 ==c==
11962 ===ca===
11963 !! result
11964 ==b==
11965 ===ba===
11966 ===bb===
11967 ====bba====
11968 ===bc===
11969 !! end
11970
11971 !! test
11972 Section extraction test (section 5)
11973 !! options
11974 section=5
11975 !! input
11976 start
11977 ==a==
11978 ===aa===
11979 ====aaa====
11980 ==b==
11981 ===ba===
11982 ===bb===
11983 ====bba====
11984 ===bc===
11985 ==c==
11986 ===ca===
11987 !! result
11988 ===ba===
11989 !! end
11990
11991 !! test
11992 Section extraction test (section 6)
11993 !! options
11994 section=6
11995 !! input
11996 start
11997 ==a==
11998 ===aa===
11999 ====aaa====
12000 ==b==
12001 ===ba===
12002 ===bb===
12003 ====bba====
12004 ===bc===
12005 ==c==
12006 ===ca===
12007 !! result
12008 ===bb===
12009 ====bba====
12010 !! end
12011
12012 !! test
12013 Section extraction test (section 7)
12014 !! options
12015 section=7
12016 !! input
12017 start
12018 ==a==
12019 ===aa===
12020 ====aaa====
12021 ==b==
12022 ===ba===
12023 ===bb===
12024 ====bba====
12025 ===bc===
12026 ==c==
12027 ===ca===
12028 !! result
12029 ====bba====
12030 !! end
12031
12032 !! test
12033 Section extraction test (section 8)
12034 !! options
12035 section=8
12036 !! input
12037 start
12038 ==a==
12039 ===aa===
12040 ====aaa====
12041 ==b==
12042 ===ba===
12043 ===bb===
12044 ====bba====
12045 ===bc===
12046 ==c==
12047 ===ca===
12048 !! result
12049 ===bc===
12050 !! end
12051
12052 !! test
12053 Section extraction test (section 9)
12054 !! options
12055 section=9
12056 !! input
12057 start
12058 ==a==
12059 ===aa===
12060 ====aaa====
12061 ==b==
12062 ===ba===
12063 ===bb===
12064 ====bba====
12065 ===bc===
12066 ==c==
12067 ===ca===
12068 !! result
12069 ==c==
12070 ===ca===
12071 !! end
12072
12073 !! test
12074 Section extraction test (section 10)
12075 !! options
12076 section=10
12077 !! input
12078 start
12079 ==a==
12080 ===aa===
12081 ====aaa====
12082 ==b==
12083 ===ba===
12084 ===bb===
12085 ====bba====
12086 ===bc===
12087 ==c==
12088 ===ca===
12089 !! result
12090 ===ca===
12091 !! end
12092
12093 !! test
12094 Section extraction test (nonexistent section 11)
12095 !! options
12096 section=11
12097 !! input
12098 start
12099 ==a==
12100 ===aa===
12101 ====aaa====
12102 ==b==
12103 ===ba===
12104 ===bb===
12105 ====bba====
12106 ===bc===
12107 ==c==
12108 ===ca===
12109 !! result
12110 !! end
12111
12112 !! test
12113 Section extraction test with bogus heading (section 1)
12114 !! options
12115 section=1
12116 !! input
12117 ==a==
12118 ==bogus== not a legal section
12119 ==b==
12120 !! result
12121 ==a==
12122 ==bogus== not a legal section
12123 !! end
12124
12125 !! test
12126 Section extraction test with bogus heading (section 2)
12127 !! options
12128 section=2
12129 !! input
12130 ==a==
12131 ==bogus== not a legal section
12132 ==b==
12133 !! result
12134 ==b==
12135 !! end
12136
12137 !! test
12138 Section extraction test with comment after heading (section 1)
12139 !! options
12140 section=1
12141 !! input
12142 ==a==
12143 ==b== <!-- -->
12144 ==c==
12145 !! result
12146 ==a==
12147 !! end
12148
12149 !! test
12150 Section extraction test with comment after heading (section 2)
12151 !! options
12152 section=2
12153 !! input
12154 ==a==
12155 ==b== <!-- -->
12156 ==c==
12157 !! result
12158 ==b== <!-- -->
12159 !! end
12160
12161 !! test
12162 Section extraction test with bogus <nowiki> heading (section 1)
12163 !! options
12164 section=1
12165 !! input
12166 ==a==
12167 ==bogus== <nowiki>not a legal section</nowiki>
12168 ==b==
12169 !! result
12170 ==a==
12171 ==bogus== <nowiki>not a legal section</nowiki>
12172 !! end
12173
12174 !! test
12175 Section extraction test with bogus <nowiki> heading (section 2)
12176 !! options
12177 section=2
12178 !! input
12179 ==a==
12180 ==bogus== <nowiki>not a legal section</nowiki>
12181 ==b==
12182 !! result
12183 ==b==
12184 !! end
12185
12186
12187 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12188 # instead of respecting commented sections
12189 !! test
12190 Section extraction prefixed by comment (section 1)
12191 !! options
12192 section=1
12193 !! input
12194 <!-- -->==sec1==
12195 ==sec2==
12196 !!result
12197 ==sec2==
12198 !!end
12199
12200 !! test
12201 Section extraction prefixed by comment (section 2)
12202 !! options
12203 section=2
12204 !! input
12205 <!-- -->==sec1==
12206 ==sec2==
12207 !!result
12208
12209 !!end
12210
12211
12212 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12213 # instead of respecting HTML-style headings
12214 !! test
12215 Section extraction, mixed wiki and html (section 1)
12216 !! options
12217 section=1
12218 !! input
12219 <h2>unmarked</h2>
12220 unmarked
12221 ==1==
12222 one
12223 ==2==
12224 two
12225 !! result
12226 ==1==
12227 one
12228 !! end
12229
12230 !! test
12231 Section extraction, mixed wiki and html (section 2)
12232 !! options
12233 section=2
12234 !! input
12235 <h2>unmarked</h2>
12236 unmarked
12237 ==1==
12238 one
12239 ==2==
12240 two
12241 !! result
12242 ==2==
12243 two
12244 !! end
12245
12246
12247 # Formerly testing for bug 3342
12248 !! test
12249 Section extraction, heading surrounded by <noinclude>
12250 !! options
12251 section=1
12252 !! input
12253 <noinclude>==unmarked==</noinclude>
12254 ==marked==
12255 !! result
12256 ==marked==
12257 !!end
12258
12259 # Test behavior of bug 19910
12260 !! test
12261 Sectiion with all-equals
12262 !! options
12263 section=2
12264 !! input
12265 ===
12266 The line above must have a trailing space
12267 === <!--
12268 --> <!-- -->
12269 But just in case it doesn't...
12270 !! result
12271 === <!--
12272 --> <!-- -->
12273 But just in case it doesn't...
12274 !! end
12275
12276 !! test
12277 Section replacement test (section 0)
12278 !! options
12279 replace=0,"xxx"
12280 !! input
12281 start
12282 ==a==
12283 ===aa===
12284 ====aaa====
12285 ==b==
12286 ===ba===
12287 ===bb===
12288 ====bba====
12289 ===bc===
12290 ==c==
12291 ===ca===
12292 !! result
12293 xxx
12294
12295 ==a==
12296 ===aa===
12297 ====aaa====
12298 ==b==
12299 ===ba===
12300 ===bb===
12301 ====bba====
12302 ===bc===
12303 ==c==
12304 ===ca===
12305 !! end
12306
12307 !! test
12308 Section replacement test (section 1)
12309 !! options
12310 replace=1,"xxx"
12311 !! input
12312 start
12313 ==a==
12314 ===aa===
12315 ====aaa====
12316 ==b==
12317 ===ba===
12318 ===bb===
12319 ====bba====
12320 ===bc===
12321 ==c==
12322 ===ca===
12323 !! result
12324 start
12325 xxx
12326
12327 ==b==
12328 ===ba===
12329 ===bb===
12330 ====bba====
12331 ===bc===
12332 ==c==
12333 ===ca===
12334 !! end
12335
12336 !! test
12337 Section replacement test (section 2)
12338 !! options
12339 replace=2,"xxx"
12340 !! input
12341 start
12342 ==a==
12343 ===aa===
12344 ====aaa====
12345 ==b==
12346 ===ba===
12347 ===bb===
12348 ====bba====
12349 ===bc===
12350 ==c==
12351 ===ca===
12352 !! result
12353 start
12354 ==a==
12355 xxx
12356
12357 ==b==
12358 ===ba===
12359 ===bb===
12360 ====bba====
12361 ===bc===
12362 ==c==
12363 ===ca===
12364 !! end
12365
12366 !! test
12367 Section replacement test (section 3)
12368 !! options
12369 replace=3,"xxx"
12370 !! input
12371 start
12372 ==a==
12373 ===aa===
12374 ====aaa====
12375 ==b==
12376 ===ba===
12377 ===bb===
12378 ====bba====
12379 ===bc===
12380 ==c==
12381 ===ca===
12382 !! result
12383 start
12384 ==a==
12385 ===aa===
12386 xxx
12387
12388 ==b==
12389 ===ba===
12390 ===bb===
12391 ====bba====
12392 ===bc===
12393 ==c==
12394 ===ca===
12395 !! end
12396
12397 !! test
12398 Section replacement test (section 4)
12399 !! options
12400 replace=4,"xxx"
12401 !! input
12402 start
12403 ==a==
12404 ===aa===
12405 ====aaa====
12406 ==b==
12407 ===ba===
12408 ===bb===
12409 ====bba====
12410 ===bc===
12411 ==c==
12412 ===ca===
12413 !! result
12414 start
12415 ==a==
12416 ===aa===
12417 ====aaa====
12418 xxx
12419
12420 ==c==
12421 ===ca===
12422 !! end
12423
12424 !! test
12425 Section replacement test (section 5)
12426 !! options
12427 replace=5,"xxx"
12428 !! input
12429 start
12430 ==a==
12431 ===aa===
12432 ====aaa====
12433 ==b==
12434 ===ba===
12435 ===bb===
12436 ====bba====
12437 ===bc===
12438 ==c==
12439 ===ca===
12440 !! result
12441 start
12442 ==a==
12443 ===aa===
12444 ====aaa====
12445 ==b==
12446 xxx
12447
12448 ===bb===
12449 ====bba====
12450 ===bc===
12451 ==c==
12452 ===ca===
12453 !! end
12454
12455 !! test
12456 Section replacement test (section 6)
12457 !! options
12458 replace=6,"xxx"
12459 !! input
12460 start
12461 ==a==
12462 ===aa===
12463 ====aaa====
12464 ==b==
12465 ===ba===
12466 ===bb===
12467 ====bba====
12468 ===bc===
12469 ==c==
12470 ===ca===
12471 !! result
12472 start
12473 ==a==
12474 ===aa===
12475 ====aaa====
12476 ==b==
12477 ===ba===
12478 xxx
12479
12480 ===bc===
12481 ==c==
12482 ===ca===
12483 !! end
12484
12485 !! test
12486 Section replacement test (section 7)
12487 !! options
12488 replace=7,"xxx"
12489 !! input
12490 start
12491 ==a==
12492 ===aa===
12493 ====aaa====
12494 ==b==
12495 ===ba===
12496 ===bb===
12497 ====bba====
12498 ===bc===
12499 ==c==
12500 ===ca===
12501 !! result
12502 start
12503 ==a==
12504 ===aa===
12505 ====aaa====
12506 ==b==
12507 ===ba===
12508 ===bb===
12509 xxx
12510
12511 ===bc===
12512 ==c==
12513 ===ca===
12514 !! end
12515
12516 !! test
12517 Section replacement test (section 8)
12518 !! options
12519 replace=8,"xxx"
12520 !! input
12521 start
12522 ==a==
12523 ===aa===
12524 ====aaa====
12525 ==b==
12526 ===ba===
12527 ===bb===
12528 ====bba====
12529 ===bc===
12530 ==c==
12531 ===ca===
12532 !! result
12533 start
12534 ==a==
12535 ===aa===
12536 ====aaa====
12537 ==b==
12538 ===ba===
12539 ===bb===
12540 ====bba====
12541 xxx
12542
12543 ==c==
12544 ===ca===
12545 !!end
12546
12547 !! test
12548 Section replacement test (section 9)
12549 !! options
12550 replace=9,"xxx"
12551 !! input
12552 start
12553 ==a==
12554 ===aa===
12555 ====aaa====
12556 ==b==
12557 ===ba===
12558 ===bb===
12559 ====bba====
12560 ===bc===
12561 ==c==
12562 ===ca===
12563 !! result
12564 start
12565 ==a==
12566 ===aa===
12567 ====aaa====
12568 ==b==
12569 ===ba===
12570 ===bb===
12571 ====bba====
12572 ===bc===
12573 xxx
12574 !! end
12575
12576 !! test
12577 Section replacement test (section 10)
12578 !! options
12579 replace=10,"xxx"
12580 !! input
12581 start
12582 ==a==
12583 ===aa===
12584 ====aaa====
12585 ==b==
12586 ===ba===
12587 ===bb===
12588 ====bba====
12589 ===bc===
12590 ==c==
12591 ===ca===
12592 !! result
12593 start
12594 ==a==
12595 ===aa===
12596 ====aaa====
12597 ==b==
12598 ===ba===
12599 ===bb===
12600 ====bba====
12601 ===bc===
12602 ==c==
12603 xxx
12604 !! end
12605
12606 !! test
12607 Section replacement test with initial whitespace (bug 13728)
12608 !! options
12609 replace=2,"xxx"
12610 !! input
12611 Preformatted initial line
12612 ==a==
12613 ===a===
12614 !! result
12615 Preformatted initial line
12616 ==a==
12617 xxx
12618 !! end
12619
12620
12621 !! test
12622 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12623 !! options
12624 section=1
12625 !! input
12626 ==a==
12627 a
12628 !! result
12629 ==a==
12630 a
12631 !! end
12632
12633 !! test
12634 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12635 !! options
12636 section=1
12637 !! input
12638 ==a==
12639 a
12640 !! result
12641 ==a==
12642 a
12643 !! end
12644
12645
12646 !! test
12647 Section extraction, <pre> around bogus header (bug 10309)
12648 !! options
12649 noxml section=2
12650 !! input
12651 == Section One ==
12652 <pre>
12653 =======
12654 </pre>
12655
12656 == Section Two ==
12657 stuff
12658 !! result
12659 == Section Two ==
12660 stuff
12661 !! end
12662
12663 !! test
12664 Section replacement, <pre> around bogus header (bug 10309)
12665 !! options
12666 noxml replace=2,"xxx"
12667 !! input
12668 == Section One ==
12669 <pre>
12670 =======
12671 </pre>
12672
12673 == Section Two ==
12674 stuff
12675 !! result
12676 == Section One ==
12677 <pre>
12678 =======
12679 </pre>
12680
12681 xxx
12682 !! end
12683
12684
12685
12686 !! test
12687 Handling of &#x0A; in URLs
12688 !! input
12689 **irc://&#x0A;a
12690 !! result
12691 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12692 </li></ul>
12693 </li></ul>
12694
12695 !!end
12696
12697 !! test
12698 5 quotes, code coverage +1 line (php)
12699 !! options
12700 php
12701 !! input
12702 '''''
12703 !! result
12704 !! end
12705 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12706 !! test
12707 5 quotes, code coverage +1 line (parsoid)
12708 !! options
12709 parsoid
12710 !! input
12711 '''''
12712 !! result
12713 <p><i><b></b></i></p>
12714 !! end
12715
12716 !! test
12717 Special:Search page linking.
12718 !! input
12719 {{Special:search}}
12720 !! result
12721 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12722 </p>
12723 !! end
12724
12725 !! test
12726 Say the magic word
12727 !! options
12728 title=[[Parser test]]
12729 !! input
12730 * {{PAGENAME}}
12731 * {{PAGENAMEE}}
12732 * {{FULLPAGENAME}}
12733 * {{FULLPAGENAMEE}}
12734 * {{BASEPAGENAME}}
12735 * {{BASEPAGENAMEE}}
12736 * {{SUBPAGENAME}}
12737 * {{SUBPAGENAMEE}}
12738 * {{ROOTPAGENAME}}
12739 * {{ROOTPAGENAMEE}}
12740 * {{TALKPAGENAME}}
12741 * {{TALKPAGENAMEE}}
12742 * {{SUBJECTPAGENAME}}
12743 * {{SUBJECTPAGENAMEE}}
12744 * {{NAMESPACEE}}
12745 * {{NAMESPACE}}
12746 * {{NAMESPACENUMBER}}
12747 * {{TALKSPACE}}
12748 * {{TALKSPACEE}}
12749 * {{SUBJECTSPACE}}
12750 * {{SUBJECTSPACEE}}
12751 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12752 !! result
12753 <ul><li> Parser test
12754 </li><li> Parser_test
12755 </li><li> Parser test
12756 </li><li> Parser_test
12757 </li><li> Parser test
12758 </li><li> Parser_test
12759 </li><li> Parser test
12760 </li><li> Parser_test
12761 </li><li> Parser test
12762 </li><li> Parser_test
12763 </li><li> Talk:Parser test
12764 </li><li> Talk:Parser_test
12765 </li><li> Parser test
12766 </li><li> Parser_test
12767 </li><li>
12768 </li><li>
12769 </li><li> 0
12770 </li><li> Talk
12771 </li><li> Talk
12772 </li><li>
12773 </li><li>
12774 </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>
12775 </li></ul>
12776
12777 !! end
12778 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12779
12780 !! test
12781 Gallery
12782 !! input
12783 <gallery>
12784 image1.png |
12785 image2.gif|||||
12786
12787 image3|
12788 image4 |300px| centre
12789 image5.svg| http://///////
12790 [[x|xx]]]]
12791 * image6
12792 </gallery>
12793 !! result
12794 <ul class="gallery">
12795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12796 <div style="height: 150px;">Image1.png</div>
12797 <div class="gallerytext">
12798 </div>
12799 </div></li>
12800 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12801 <div style="height: 150px;">Image2.gif</div>
12802 <div class="gallerytext">
12803 <p>||||
12804 </p>
12805 </div>
12806 </div></li>
12807 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12808 <div style="height: 150px;">Image3</div>
12809 <div class="gallerytext">
12810 </div>
12811 </div></li>
12812 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12813 <div style="height: 150px;">Image4</div>
12814 <div class="gallerytext">
12815 <p>300px| centre
12816 </p>
12817 </div>
12818 </div></li>
12819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12820 <div style="height: 150px;">Image5.svg</div>
12821 <div class="gallerytext">
12822 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12823 </p>
12824 </div>
12825 </div></li>
12826 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12827 <div style="height: 150px;">* image6</div>
12828 <div class="gallerytext">
12829 </div>
12830 </div></li>
12831 </ul>
12832
12833 !! end
12834
12835 !! test
12836 Gallery (with options)
12837 !! input
12838 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12839 File:Nonexistant.jpg|caption
12840 File:Nonexistant.jpg
12841 image:foobar.jpg|some '''caption''' [[Main Page]]
12842 image:foobar.jpg
12843 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12844 </gallery>
12845 !! result
12846 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12847 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12848 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12849 <div style="height: 70px;">Nonexistant.jpg</div>
12850 <div class="gallerytext">
12851 <p>caption
12852 </p>
12853 </div>
12854 </div></li>
12855 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12856 <div style="height: 70px;">Nonexistant.jpg</div>
12857 <div class="gallerytext">
12858 </div>
12859 </div></li>
12860 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12861 <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>
12862 <div class="gallerytext">
12863 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12864 </p>
12865 </div>
12866 </div></li>
12867 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12868 <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>
12869 <div class="gallerytext">
12870 </div>
12871 </div></li>
12872 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12873 <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>
12874 <div class="gallerytext">
12875 <p>Blabla|blabla.
12876 </p>
12877 </div>
12878 </div></li>
12879 </ul>
12880
12881 !! end
12882
12883 !! test
12884 Gallery with wikitext inside caption
12885 !! input
12886 <gallery>
12887 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12888 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12889 </gallery>
12890 !! result
12891 <ul class="gallery">
12892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12893 <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>
12894 <div class="gallerytext">
12895 <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>
12896 </p>
12897 </div>
12898 </div></li>
12899 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12900 <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>
12901 <div class="gallerytext">
12902 <p>This is a test template
12903 </p>
12904 </div>
12905 </div></li>
12906 </ul>
12907
12908 !! end
12909
12910 !! test
12911 gallery (with showfilename option)
12912 !! input
12913 <gallery showfilename>
12914 File:Nonexistant.jpg|caption
12915 File:Nonexistant.jpg
12916 image:foobar.jpg|some '''caption''' [[Main Page]]
12917 File:Foobar.jpg
12918 </gallery>
12919 !! result
12920 <ul class="gallery">
12921 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12922 <div style="height: 150px;">Nonexistant.jpg</div>
12923 <div class="gallerytext">
12924 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12925 caption
12926 </p>
12927 </div>
12928 </div></li>
12929 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12930 <div style="height: 150px;">Nonexistant.jpg</div>
12931 <div class="gallerytext">
12932 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12933 </p>
12934 </div>
12935 </div></li>
12936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12937 <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>
12938 <div class="gallerytext">
12939 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12940 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12941 </p>
12942 </div>
12943 </div></li>
12944 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12945 <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>
12946 <div class="gallerytext">
12947 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12948 </p>
12949 </div>
12950 </div></li>
12951 </ul>
12952
12953 !! end
12954
12955 !! test
12956 Gallery (with namespace-less filenames)
12957 !! input
12958 <gallery>
12959 File:Nonexistant.jpg
12960 Nonexistant.jpg
12961 image:foobar.jpg
12962 foobar.jpg
12963 </gallery>
12964 !! result
12965 <ul class="gallery">
12966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12967 <div style="height: 150px;">Nonexistant.jpg</div>
12968 <div class="gallerytext">
12969 </div>
12970 </div></li>
12971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12972 <div style="height: 150px;">Nonexistant.jpg</div>
12973 <div class="gallerytext">
12974 </div>
12975 </div></li>
12976 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12977 <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>
12978 <div class="gallerytext">
12979 </div>
12980 </div></li>
12981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12982 <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>
12983 <div class="gallerytext">
12984 </div>
12985 </div></li>
12986 </ul>
12987
12988 !! end
12989
12990 !! test
12991 HTML Hex character encoding (spells the word "JavaScript")
12992 !! input
12993 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12994 !! result
12995 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12996 </p>
12997 !! end
12998
12999 !! test
13000 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13001 !! input
13002 &#xsee;&#XSEE;
13003 !! result
13004 <p>&amp;#xsee;&amp;#XSEE;
13005 </p>
13006 !! end
13007
13008 !! test
13009 HTML Hex character encoding mixed case
13010 !! input
13011 &#xEE;&#Xee;
13012 !! result
13013 <p>&#xee;&#xee;
13014 </p>
13015 !! end
13016
13017 !! test
13018 __FORCETOC__ override
13019 !! input
13020 __NEWSECTIONLINK__
13021 __FORCETOC__
13022 !! result
13023 <p><br />
13024 </p>
13025 !! end
13026
13027 !! test
13028 ISBN code coverage
13029 !! input
13030 ISBN 978-0-1234-56&#x20;789
13031 !! result
13032 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13033 </p>
13034 !! end
13035
13036 !! test
13037 ISBN followed by 5 spaces
13038 !! input
13039 ISBN
13040 !! result
13041 <p>ISBN
13042 </p>
13043 !! end
13044
13045 !! test
13046 Double ISBN
13047 !! input
13048 ISBN ISBN 1234567890
13049 !! result
13050 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13051 </p>
13052 !! end
13053
13054 !! test
13055 Bug 22905: <abbr> followed by ISBN followed by </a>
13056 !! input
13057 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13058 !! result
13059 <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>
13060 </p>
13061 !! end
13062
13063 !! test
13064 Double RFC
13065 !! input
13066 RFC RFC 1234
13067 !! result
13068 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13069 </p>
13070 !! end
13071
13072 !! test
13073 Double RFC with a wiki link
13074 !! input
13075 RFC [[RFC 1234]]
13076 !! result
13077 <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>
13078 </p>
13079 !! end
13080
13081 !! test
13082 RFC code coverage
13083 !! input
13084 RFC 983&#x20;987
13085 !! result
13086 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13087 </p>
13088 !! end
13089
13090 !! test
13091 Centre-aligned image
13092 !! input
13093 [[Image:foobar.jpg|centre]]
13094 !! result
13095 <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>
13096
13097 !!end
13098
13099 !! test
13100 None-aligned image
13101 !! input
13102 [[Image:foobar.jpg|none]]
13103 !! result
13104 <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>
13105
13106 !!end
13107
13108 !! test
13109 Width + Height sized image (using px) (height is ignored)
13110 !! input
13111 [[Image:foobar.jpg|640x480px]]
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, no following whitespace)
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 following 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 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13137 !! input
13138 [[Image:foobar.jpg| 640px]]
13139 !! result
13140 <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>
13141 </p>
13142 !!end
13143
13144 !! test
13145 Another italics / bold test
13146 !! input
13147 ''' ''x'
13148 !! result
13149 <pre>'<i> </i>x'
13150 </pre>
13151 !!end
13152
13153 # Note the results may be incorrect, as parserTest output included this:
13154 # XML error: Mismatched tag at byte 6120:
13155 # ...<dd> </dt></dl> </dd...
13156 !! test
13157 dt/dd/dl test
13158 !! options
13159 disabled
13160 !! input
13161 :;;;::
13162 !! result
13163 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13164 </dd></dl>
13165 </dd></dl>
13166 </dt></dl>
13167 </dt></dl>
13168 </dt></dl>
13169 </dd></dl>
13170
13171 !!end
13172
13173
13174 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13175 !! test
13176 Images with the "|" character in the comment
13177 !! input
13178 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13179 !! result
13180 <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>
13181
13182 !!end
13183
13184 !! test
13185 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13186 !! input
13187 <html><script>alert(1);</script></html>
13188 !! result
13189 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13190 </p>
13191 !! end
13192
13193 !! test
13194 HTML with raw HTML ($wgRawHtml==true)
13195 !! options
13196 wgRawHtml=1
13197 !! input
13198 <html><script>alert(1);</script></html>
13199 !! result
13200 <p><script>alert(1);</script>
13201 </p>
13202 !! end
13203
13204 !! test
13205 Parents of subpages, one level up
13206 !! options
13207 subpage title=[[Subpage test/L1/L2/L3]]
13208 !! input
13209 [[../|L2]]
13210 !! result
13211 <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>
13212 </p>
13213 !! end
13214
13215
13216 !! test
13217 Parents of subpages, one level up, not named
13218 !! options
13219 subpage title=[[Subpage test/L1/L2/L3]]
13220 !! input
13221 [[../]]
13222 !! result
13223 <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>
13224 </p>
13225 !! end
13226
13227
13228
13229 !! test
13230 Parents of subpages, two levels up
13231 !! options
13232 subpage title=[[Subpage test/L1/L2/L3]]
13233 !! input
13234 [[../../|L1]]2
13235
13236 [[../../|L1]]l
13237 !! result
13238 <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
13239 </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>
13240 </p>
13241 !! end
13242
13243 !! test
13244 Parents of subpages, two levels up, without trailing slash or name.
13245 !! options
13246 subpage title=[[Subpage test/L1/L2/L3]]
13247 !! input
13248 [[../..]]
13249 !! result
13250 <p>[[../..]]
13251 </p>
13252 !! end
13253
13254 !! test
13255 Parents of subpages, two levels up, with lots of extra trailing slashes.
13256 !! options
13257 subpage title=[[Subpage test/L1/L2/L3]]
13258 !! input
13259 [[../../////]]
13260 !! result
13261 <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>
13262 </p>
13263 !! end
13264
13265 !! article
13266 Subpage test/L1/L2/L3Sibling
13267 !! text
13268 Sibling article
13269 !! endarticle
13270
13271 !! test
13272 Transclusion of a sibling page (one level up)
13273 !! options
13274 subpage title=[[Subpage test/L1/L2/L3]]
13275 !! input
13276 {{../L3Sibling}}
13277 !! result
13278 <p>Sibling article
13279 </p>
13280 !! end
13281
13282 !! test
13283 Transclusion of a child page
13284 !! options
13285 subpage title=[[Subpage test/L1/L2]]
13286 !! input
13287 {{/L3Sibling}}
13288 !! result
13289 <p>Sibling article
13290 </p>
13291 !! end
13292
13293 !! test
13294 Non-transclusion because of too many up levels
13295 !! options
13296 subpage title=[[Subpage test/L1/L2/L3]]
13297 !! input
13298 {{../../../../More than parent}}
13299 !! result
13300 <p>{{../../../../More than parent}}
13301 </p>
13302 !! end
13303
13304 !! test
13305 Definition list code coverage
13306 !! input
13307 ; title : def
13308 ; title : def
13309 ;title: def
13310 !! result
13311 <dl><dt> title &#160;</dt><dd> def
13312 </dd><dt> title&#160;</dt><dd> def
13313 </dd><dt>title</dt><dd> def
13314 </dd></dl>
13315
13316 !! end
13317
13318 !! test
13319 Don't fall for the self-closing div
13320 !! input
13321 <div>hello world</div/>
13322 !! result
13323 <div>hello world</div>
13324
13325 !! end
13326
13327 !! test
13328 MSGNW magic word
13329 !! input
13330 {{MSGNW:msg}}
13331 !! result
13332 <p>&#91;&#91;:Template:Msg&#93;&#93;
13333 </p>
13334 !! end
13335
13336 !! test
13337 RAW magic word
13338 !! input
13339 {{RAW:QUERTY}}
13340 !! result
13341 <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>
13342 </p>
13343 !! end
13344
13345 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13346 !! test
13347 Always escape literal '>' in output, not just after '<'
13348 !! input
13349 ><>
13350 !! result
13351 <p>&gt;&lt;&gt;
13352 </p>
13353 !! end
13354
13355 !! test
13356 Template caching
13357 !! input
13358 {{Test}}
13359 {{Test}}
13360 !! result
13361 <p>This is a test template
13362 This is a test template
13363 </p>
13364 !! end
13365
13366
13367 !! article
13368 MediaWiki:Fake
13369 !! text
13370 ==header==
13371 !! endarticle
13372
13373 !! test
13374 Inclusion of !userCanEdit() content
13375 !! input
13376 {{MediaWiki:Fake}}
13377 !! result
13378 <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>
13379
13380 !! end
13381
13382
13383 !! test
13384 Out-of-order TOC heading levels
13385 !! input
13386 ==2==
13387 ======6======
13388 ===3===
13389 =1=
13390 =====5=====
13391 ==2==
13392 !! result
13393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13394 <ul>
13395 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13396 <ul>
13397 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13398 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13399 </ul>
13400 </li>
13401 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13402 <ul>
13403 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13404 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13405 </ul>
13406 </li>
13407 </ul>
13408 </div>
13409 <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>
13410 <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>
13411 <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>
13412 <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>
13413 <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>
13414 <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>
13415
13416 !! end
13417
13418
13419 !! test
13420 ISBN with a dummy number
13421 !! input
13422 ISBN ---
13423 !! result
13424 <p>ISBN ---
13425 </p>
13426 !! end
13427
13428
13429 !! test
13430 ISBN with space-delimited number
13431 !! input
13432 ISBN 92 9017 032 8
13433 !! result
13434 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13435 </p>
13436 !! end
13437
13438
13439 !! test
13440 ISBN with multiple spaces, no number
13441 !! input
13442 ISBN foo
13443 !! result
13444 <p>ISBN foo
13445 </p>
13446 !! end
13447
13448
13449 !! test
13450 ISBN length
13451 !! input
13452 ISBN 123456789
13453
13454 ISBN 1234567890
13455
13456 ISBN 12345678901
13457 !! result
13458 <p>ISBN 123456789
13459 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13460 </p><p>ISBN 12345678901
13461 </p>
13462 !! end
13463
13464
13465 !! test
13466 ISBN with trailing year (bug 8110)
13467 !! input
13468 ISBN 1-234-56789-0 - 2006
13469
13470 ISBN 1 234 56789 0 - 2006
13471 !! result
13472 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13473 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13474 </p>
13475 !! end
13476
13477
13478 !! test
13479 anchorencode
13480 !! input
13481 {{anchorencode:foo bar©#%n}}
13482 !! result
13483 <p>foo_bar.C2.A9.23.25n
13484 </p>
13485 !! end
13486
13487 !! test
13488 anchorencode trims spaces
13489 !! input
13490 {{anchorencode: __pretty__please__}}
13491 !! result
13492 <p>pretty_please
13493 </p>
13494 !! end
13495
13496 !! test
13497 anchorencode deals with links
13498 !! input
13499 {{anchorencode: [[hello|world]] [[hi]]}}
13500 !! result
13501 <p>world_hi
13502 </p>
13503 !! end
13504
13505 !! test
13506 anchorencode deals with templates
13507 !! input
13508 {{anchorencode: {{Foo}} }}
13509 !! result
13510 <p>FOO
13511 </p>
13512 !! end
13513
13514 !! test
13515 anchorencode encodes like the TOC generator: (bug 18431)
13516 !! input
13517 === _ +:.3A%3A&&amp;]] ===
13518 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13519 __NOEDITSECTION__
13520 !! result
13521 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13522 <p>.2B:.3A.253A.26.26.5D.5D
13523 </p>
13524 !! end
13525
13526 !! test
13527 Bug 6200: blockquotes and paragraph formatting
13528 !! input
13529 <blockquote>
13530 foo
13531 </blockquote>
13532
13533 bar
13534
13535 baz
13536 !! result
13537 <blockquote>
13538 <p>foo
13539 </p>
13540 </blockquote>
13541 <p>bar
13542 </p>
13543 <pre>baz
13544 </pre>
13545 !! end
13546
13547 !! test
13548 Bug 8293: Use of center tag ruins paragraph formatting
13549 !! input
13550 <center>
13551 foo
13552 </center>
13553
13554 bar
13555
13556 baz
13557 !! result
13558 <center>
13559 <p>foo
13560 </p>
13561 </center>
13562 <p>bar
13563 </p>
13564 <pre>baz
13565 </pre>
13566 !! end
13567
13568 !!test
13569 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13570 !!options
13571 php
13572 !!input
13573 <span><s>x</span></s>
13574 !!result
13575 <p><span><s>x&lt;/span&gt;</s></span>
13576 </p>
13577 !!end
13578
13579 !!test
13580 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13581 !!options
13582 parsoid
13583 !!input
13584 <span><s>x</span></s>
13585 !!result
13586 <p><span><s>x</s></span><s></s>
13587 </p>
13588 !!end
13589
13590 ###
13591 ### Language variants related tests
13592 ###
13593 !! test
13594 Self-link in language variants
13595 !! options
13596 title=[[Dunav]] language=sr
13597 !! input
13598 Both [[Dunav]] and [[Дунав]] are names for this river.
13599 !! result
13600 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13601 </p>
13602 !!end
13603
13604 !! article
13605 Дуна
13606 !! text
13607 content
13608 !! endarticle
13609
13610 !! test
13611 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13612 !! options
13613 title=[[Duna]] language=sr
13614 !! input
13615 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13616 !! result
13617 <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.
13618 </p>
13619 !! end
13620
13621 !! test
13622 Link to pages in language variants
13623 !! options
13624 language=sr
13625 !! input
13626 Main Page can be written as [[Маин Паге]]
13627 !! result
13628 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13629 </p>
13630 !!end
13631
13632
13633 !! test
13634 Multiple links to pages in language variants
13635 !! options
13636 language=sr
13637 !! input
13638 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13639 !! result
13640 <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>.
13641 </p>
13642 !!end
13643
13644
13645 !! test
13646 Simple template in language variants
13647 !! options
13648 language=sr
13649 !! input
13650 {{тест}}
13651 !! result
13652 <p>This is a test template
13653 </p>
13654 !! end
13655
13656
13657 !! test
13658 Template with explicit namespace in language variants
13659 !! options
13660 language=sr
13661 !! input
13662 {{Template:тест}}
13663 !! result
13664 <p>This is a test template
13665 </p>
13666 !! end
13667
13668
13669 !! test
13670 Basic test for template parameter in language variants
13671 !! options
13672 language=sr
13673 !! input
13674 {{парамтест|param=foo}}
13675 !! result
13676 <p>This is a test template with parameter foo
13677 </p>
13678 !! end
13679
13680
13681 !! test
13682 Simple category in language variants
13683 !! options
13684 language=sr cat
13685 !! input
13686 [[Category:МедиаWики Усер'с Гуиде]]
13687 !! result
13688 <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>
13689 !! end
13690
13691
13692 !! article
13693 Category:分类
13694 !! text
13695 blah
13696 !! endarticle
13697
13698 !! article
13699 Category:分類
13700 !! text
13701 blah
13702 !! endarticle
13703
13704 !! test
13705 Don't convert blue categorylinks to another variant (bug 33210)
13706 !! options
13707 language=zh cat
13708 !! input
13709 [[A]][[Category:分类]]
13710 !! result
13711 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13712 !! end
13713
13714
13715 !! test
13716 Stripping -{}- tags (language variants)
13717 !! options
13718 language=sr
13719 !! input
13720 Latin proverb: -{Ne nuntium necare}-
13721 !! result
13722 <p>Latin proverb: Ne nuntium necare
13723 </p>
13724 !! end
13725
13726
13727 !! test
13728 Prevent conversion with -{}- tags (language variants)
13729 !! options
13730 language=sr variant=sr-ec
13731 !! input
13732 Latinski: -{Ne nuntium necare}-
13733 !! result
13734 <p>Латински: Ne nuntium necare
13735 </p>
13736 !! end
13737
13738
13739 !! test
13740 Prevent conversion of text with -{}- tags (language variants)
13741 !! options
13742 language=sr variant=sr-ec
13743 !! input
13744 Latinski: -{Ne nuntium necare}-
13745 !! result
13746 <p>Латински: Ne nuntium necare
13747 </p>
13748 !! end
13749
13750
13751 !! test
13752 Prevent conversion of links with -{}- tags (language variants)
13753 !! options
13754 language=sr variant=sr-ec
13755 !! input
13756 -{[[Main Page]]}-
13757 !! result
13758 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13759 </p>
13760 !! end
13761
13762
13763 !! test
13764 -{}- tags within headlines (within html for parserConvert())
13765 !! options
13766 language=sr variant=sr-ec
13767 !! input
13768 == -{Naslov}- ==
13769 !! result
13770 <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>
13771
13772 !! end
13773
13774
13775 !! test
13776 Explicit definition of language variant alternatives
13777 !! options
13778 language=zh variant=zh-tw
13779 !! input
13780 -{zh:China;zh-tw:Taiwan}-, not China
13781 !! result
13782 <p>Taiwan, not China
13783 </p>
13784 !! end
13785
13786
13787 !! test
13788 Conversion around HTML tags
13789 !! options
13790 language=sr variant=sr-ec
13791 !! input
13792 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13793 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13794 !! result
13795 <p>
13796 <span title="ЛаCтин">ски</span>
13797 </p>
13798 !! end
13799
13800
13801 !! test
13802 Explicit session-wise language variant mapping (A flag and - flag)
13803 !! options
13804 language=zh variant=zh-tw
13805 !! input
13806 Taiwan is not China.
13807 But -{A|zh:China;zh-tw:Taiwan}- is China,
13808 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13809 and -{China}- is China.
13810 !! result
13811 <p>Taiwan is not China.
13812 But Taiwan is Taiwan,
13813 (This should be stripped!)
13814 and China is China.
13815 </p>
13816 !! end
13817
13818 !! test
13819 Explicit session-wise language variant mapping (H flag for hide)
13820 !! options
13821 language=zh variant=zh-tw
13822 !! input
13823 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13824 Taiwan is China.
13825 !! result
13826 <p>(This should be stripped!)
13827 Taiwan is Taiwan.
13828 </p>
13829 !! end
13830
13831 !! test
13832 Adding explicit conversion rule for title (T flag)
13833 !! options
13834 language=zh variant=zh-tw showtitle
13835 !! input
13836 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13837 !! result
13838 Taiwan
13839 <p>Should be stripped!
13840 </p>
13841 !! end
13842
13843 !! test
13844 Testing that changing the language variant here in the tests actually works
13845 !! options
13846 language=zh variant=zh showtitle
13847 !! input
13848 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13849 !! result
13850 China
13851 <p>Should be stripped!
13852 </p>
13853 !! end
13854
13855 !! test
13856 Recursive conversion of alt and title attrs shouldn't clear converter state
13857 !! options
13858 language=zh variant=zh-cn showtitle
13859 !! input
13860 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13861 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13862 !! result
13863 China
13864 <p>
13865 Should be stripped<span title="Exclamation">!</span>
13866 </p>
13867 !! end
13868
13869 !! test
13870 Bug 24072: more test on conversion rule for title
13871 !! options
13872 language=zh variant=zh-tw showtitle
13873 !! input
13874 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13875 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13876 !! result
13877 Taiwan
13878 <p>This should be stripped!
13879 This won't take interferes with the title rule.
13880 </p>
13881 !! end
13882
13883 !! test
13884 Partly disable title conversion if variant == main language code
13885 !! options
13886 language=zh variant=zh title=[[ZH]] showtitle
13887 !! input
13888 -{T|zh-cn:CN;zh-tw:TW}-
13889 !! result
13890 ZH
13891 <p>
13892 </p>
13893 !! end
13894
13895 !! test
13896 Partly disable title conversion if variant == main language code, more
13897 !! options
13898 language=zh variant=zh title=[[ZH]] showtitle
13899 !! input
13900 -{T|TW}-
13901 !! result
13902 ZH
13903 <p>
13904 </p>
13905 !! end
13906
13907 !! test
13908 Raw output of variant escape tags (R flag)
13909 !! options
13910 language=zh variant=zh-tw
13911 !! input
13912 Raw: -{R|zh:China;zh-tw:Taiwan}-
13913 !! result
13914 <p>Raw: zh:China;zh-tw:Taiwan
13915 </p>
13916 !! end
13917
13918 !! test
13919 Nested using of manual convert syntax
13920 !! options
13921 language=zh variant=zh-hk
13922 !! input
13923 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13924 !! result
13925 <p>Nested: Hello Hong Kong!
13926 </p>
13927 !! end
13928
13929 !! test
13930 Proper conversion of text in external links
13931 !! options
13932 language=sr variant=sr-ec
13933 !! input
13934 http://www.google.com
13935 gopher://www.google.com
13936 [http://www.google.com http://www.google.com]
13937 [gopher://www.google.com gopher://www.google.com]
13938 [https://www.google.com irc://www.google.com]
13939 [ftp://www.google.com www.google.com/ftp://dir]
13940 [//www.google.com www.google.com]
13941 !! result
13942 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13943 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13944 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13945 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13946 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13947 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13948 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13949 </p>
13950 !! end
13951
13952 !! test
13953 Do not convert roman numbers to language variants
13954 !! options
13955 language=sr variant=sr-ec
13956 !! input
13957 Fridrih IV je car.
13958 !! result
13959 <p>Фридрих IV је цар.
13960 </p>
13961 !! end
13962
13963 !! test
13964 Unclosed language converter markup "-{"
13965 !! options
13966 language=sr
13967 !! input
13968 -{T|hello
13969 !! result
13970 <p>-{T|hello
13971 </p>
13972 !! end
13973
13974 !! test
13975 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13976 !! options
13977 language=sr
13978 !! input
13979 -{R|=&gt;}-
13980 !! result
13981 <p>=&gt;
13982 </p>
13983 !!end
13984
13985 !! test
13986 Bug 529: Uncovered bullet
13987 !! input
13988 * Foo {{bullet}}
13989 !! result
13990 <ul><li> Foo
13991 </li><li> Bar
13992 </li></ul>
13993
13994 !! end
13995
13996 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13997 # Templates in Wikipedia rely on this behavior, as tidy has always been
13998 # enabled there. These tests are normally run *without* tidy, so specify the
13999 # full output here.
14000 # To test realistic parsing behavior, apply a tidy-like transformation to both
14001 # the expected output and your parser's output.
14002 !! test
14003 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14004 !! input
14005 ******* Foo {{bullet}}
14006 !! result
14007 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14008 </li></ul>
14009 </li></ul>
14010 </li></ul>
14011 </li></ul>
14012 </li></ul>
14013 </li></ul>
14014 </li><li> Bar
14015 </li></ul>
14016
14017 !! end
14018
14019 !! test
14020 Bug 529: Uncovered table already at line-start
14021 !! input
14022 x
14023
14024 {{table}}
14025 y
14026 !! result
14027 <p>x
14028 </p>
14029 <table>
14030 <tr>
14031 <td> 1 </td>
14032 <td> 2
14033 </td></tr>
14034 <tr>
14035 <td> 3 </td>
14036 <td> 4
14037 </td></tr></table>
14038 <p>y
14039 </p>
14040 !! end
14041
14042 !! test
14043 Bug 529: Uncovered bullet in parser function result
14044 !! input
14045 * Foo {{lc:{{bullet}} }}
14046 !! result
14047 <ul><li> Foo
14048 </li><li> bar
14049 </li></ul>
14050
14051 !! end
14052
14053 !! test
14054 Bug 5678: Double-parsed template argument
14055 !! input
14056 {{lc:{{{1}}}|hello}}
14057 !! result
14058 <p>{{{1}}}
14059 </p>
14060 !! end
14061
14062 !! test
14063 Bug 5678: Double-parsed template invocation
14064 !! input
14065 {{lc:{{paramtest {{!}} param = hello }} }}
14066 !! result
14067 <p>{{paramtest | param = hello }}
14068 </p>
14069 !! end
14070
14071 !! test
14072 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14073 !! options
14074 language=cs
14075 title=[[Main Page]]
14076 !! input
14077 {{PRVNÍVELKÉ:ěščř}}
14078 {{prvnívelké:ěščř}}
14079 {{PRVNÍMALÉ:ěščř}}
14080 {{prvnímalé:ěščř}}
14081 {{MALÁ:ěščř}}
14082 {{malá:ěščř}}
14083 {{VELKÁ:ěščř}}
14084 {{velká:ěščř}}
14085 !! result
14086 <p>Ěščř
14087 Ěščř
14088 ěščř
14089 ěščř
14090 ěščř
14091 ěščř
14092 ĚŠČŘ
14093 ĚŠČŘ
14094 </p>
14095 !! end
14096
14097 !! test
14098 Morwen/13: Unclosed link followed by heading
14099 !! input
14100 [[link
14101 ==heading==
14102 !! result
14103 <p>[[link
14104 </p>
14105 <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>
14106
14107 !! end
14108
14109 !! test
14110 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14111 !! input
14112 {{foo|
14113 =heading=
14114 !! result
14115 <p>{{foo|
14116 </p>
14117 <h1><span class="mw-headline" id="heading">heading</span></h1>
14118
14119 !! end
14120
14121 !! test
14122 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14123 !! input
14124 {{foo|
14125 ==heading==
14126 !! result
14127 <p>{{foo|
14128 </p>
14129 <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>
14130
14131 !! end
14132
14133 !! test
14134 Tildes in comments
14135 !! options
14136 pst
14137 !! input
14138 <!-- ~~~~ -->
14139 !! result
14140 <!-- ~~~~ -->
14141 !! end
14142
14143 !! test
14144 Paragraphs inside divs (no extra line breaks)
14145 !! input
14146 <div>Line one
14147
14148 Line two</div>
14149 !! result
14150 <div>Line one
14151 Line two</div>
14152
14153 !! end
14154
14155 !! test
14156 Paragraphs inside divs (extra line break on open)
14157 !! input
14158 <div>
14159 Line one
14160
14161 Line two</div>
14162 !! result
14163 <div>
14164 <p>Line one
14165 </p>
14166 Line two</div>
14167
14168 !! end
14169
14170 !! test
14171 Paragraphs inside divs (extra line break on close)
14172 !! input
14173 <div>Line one
14174
14175 Line two
14176 </div>
14177 !! result
14178 <div>Line one
14179 <p>Line two
14180 </p>
14181 </div>
14182
14183 !! end
14184
14185 !! test
14186 Paragraphs inside divs (extra line break on open and close)
14187 !! input
14188 <div>
14189 Line one
14190
14191 Line two
14192 </div>
14193 !! result
14194 <div>
14195 <p>Line one
14196 </p><p>Line two
14197 </p>
14198 </div>
14199
14200 !! end
14201
14202 !! test
14203 Nesting tags, paragraphs on lines which begin with <div>
14204 !! options
14205 disabled
14206 !! input
14207 <div></div><strong>A
14208 B</strong>
14209 !! result
14210 <div></div>
14211 <p><strong>A
14212 B</strong>
14213 </p>
14214 !! end
14215
14216 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14217 !! test
14218 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14219 !! input
14220 <blockquote>Line one
14221
14222 Line two</blockquote>
14223 !! result
14224 <blockquote>Line one
14225 Line two</blockquote>
14226
14227 !! end
14228
14229 !! test
14230 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14231 !! input
14232 <blockquote>
14233 Line one
14234
14235 Line two</blockquote>
14236 !! result
14237 <blockquote>
14238 <p>Line one
14239 </p>
14240 Line two</blockquote>
14241
14242 !! end
14243
14244 !! test
14245 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14246 !! input
14247 <blockquote>Line one
14248
14249 Line two
14250 </blockquote>
14251 !! result
14252 <blockquote>Line one
14253 <p>Line two
14254 </p>
14255 </blockquote>
14256
14257 !! end
14258
14259 !! test
14260 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14261 !! input
14262 <blockquote>
14263 Line one
14264
14265 Line two
14266 </blockquote>
14267 !! result
14268 <blockquote>
14269 <p>Line one
14270 </p><p>Line two
14271 </p>
14272 </blockquote>
14273
14274 !! end
14275
14276 !! test
14277 Paragraphs inside blockquotes/divs (no extra line breaks)
14278 !! input
14279 <blockquote><div>Line one
14280
14281 Line two</div></blockquote>
14282 !! result
14283 <blockquote><div>Line one
14284 Line two</div></blockquote>
14285
14286 !! end
14287
14288 !! test
14289 Paragraphs inside blockquotes/divs (extra line break on open)
14290 !! input
14291 <blockquote><div>
14292 Line one
14293
14294 Line two</div></blockquote>
14295 !! result
14296 <blockquote><div>
14297 <p>Line one
14298 </p>
14299 Line two</div></blockquote>
14300
14301 !! end
14302
14303 !! test
14304 Paragraphs inside blockquotes/divs (extra line break on close)
14305 !! input
14306 <blockquote><div>Line one
14307
14308 Line two
14309 </div></blockquote>
14310 !! result
14311 <blockquote><div>Line one
14312 <p>Line two
14313 </p>
14314 </div></blockquote>
14315
14316 !! end
14317
14318 !! test
14319 Paragraphs inside blockquotes/divs (extra line break on open and close)
14320 !! input
14321 <blockquote><div>
14322 Line one
14323
14324 Line two
14325 </div></blockquote>
14326 !! result
14327 <blockquote><div>
14328 <p>Line one
14329 </p><p>Line two
14330 </p>
14331 </div></blockquote>
14332
14333 !! end
14334
14335 !! test
14336 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14337 !! options
14338 wgLinkHolderBatchSize=0
14339 !! input
14340 [[meatball:1]]
14341 [[meatball:2]]
14342 [[meatball:3]]
14343 !! result
14344 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14345 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14346 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14347 </p>
14348 !! end
14349
14350 !! test
14351 Free external link invading image caption
14352 !! input
14353 [[Image:Foobar.jpg|thumb|http://x|hello]]
14354 !! result
14355 <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>
14356
14357 !! end
14358
14359 !! test
14360 Bug 15196: localised external link numbers
14361 !! options
14362 language=fa
14363 !! input
14364 [http://en.wikipedia.org/]
14365 !! result
14366 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14367 </p>
14368 !! end
14369
14370 !! test
14371 Multibyte character in padleft
14372 !! input
14373 {{padleft:-Hello|7|Æ}}
14374 !! result
14375 <p>Æ-Hello
14376 </p>
14377 !! end
14378
14379 !! test
14380 Multibyte character in padright
14381 !! input
14382 {{padright:Hello-|7|Æ}}
14383 !! result
14384 <p>Hello-Æ
14385 </p>
14386 !! end
14387
14388 !!test
14389 formatdate parser function
14390 !!input
14391 {{#formatdate:2009-03-24}}
14392 !! result
14393 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14394 </p>
14395 !! end
14396
14397 !!test
14398 formatdate parser function, with default format
14399 !!input
14400 {{#formatdate:2009-03-24|mdy}}
14401 !! result
14402 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14403 </p>
14404 !! end
14405
14406 !! test
14407 Spacing of numbers in formatted dates
14408 !! input
14409 {{#formatdate:January 15}}
14410 !! result
14411 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14412 </p>
14413 !! end
14414
14415 !! test
14416 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
14417 !! options
14418 language=nl title=[[MediaWiki:Common.css]]
14419 !! input
14420 {{#formatdate:2009-03-24|dmy}}
14421 !! result
14422 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14423 </p>
14424 !! end
14425
14426 #
14427 #
14428 #
14429
14430 #
14431 # Edit comments
14432 #
14433
14434 !! test
14435 Edit comment with link
14436 !! options
14437 comment
14438 !! input
14439 I like the [[Main Page]] a lot
14440 !! result
14441 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14442 !!end
14443
14444 !! test
14445 Edit comment with link and link text
14446 !! options
14447 comment
14448 !! input
14449 I like the [[Main Page|best pages]] a lot
14450 !! result
14451 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14452 !!end
14453
14454 !! test
14455 Edit comment with link and link text with suffix
14456 !! options
14457 comment
14458 !! input
14459 I like the [[Main Page|best page]]s a lot
14460 !! result
14461 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14462 !!end
14463
14464 !! test
14465 Edit comment with section link (non-local, eg in history list)
14466 !! options
14467 comment title=[[Main Page]]
14468 !! input
14469 /* External links */ removed bogus entries
14470 !! result
14471 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14472 !!end
14473
14474 !! test
14475 Edit comment with section link and text before it (non-local, eg in history list)
14476 !! options
14477 comment title=[[Main Page]]
14478 !! input
14479 pre-comment text /* External links */ removed bogus entries
14480 !! result
14481 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>
14482 !!end
14483
14484 !! test
14485 Edit comment with section link (local, eg in diff view)
14486 !! options
14487 comment local title=[[Main Page]]
14488 !! input
14489 /* External links */ removed bogus entries
14490 !! result
14491 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14492 !!end
14493
14494 !! test
14495 Edit comment with subpage link (bug 14080)
14496 !! options
14497 comment
14498 subpage
14499 title=[[Subpage test]]
14500 !! input
14501 Poked at a [[/subpage]] here...
14502 !! result
14503 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14504 !!end
14505
14506 !! test
14507 Edit comment with subpage link and link text (bug 14080)
14508 !! options
14509 comment
14510 subpage
14511 title=[[Subpage test]]
14512 !! input
14513 Poked at a [[/subpage|neat little page]] here...
14514 !! result
14515 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14516 !!end
14517
14518 !! test
14519 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14520 !! options
14521 comment
14522 title=[[Subpage test]]
14523 !! input
14524 Poked at a [[/subpage]] here...
14525 !! result
14526 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...
14527 !!end
14528
14529 !! test
14530 Edit comment with bare anchor link (local, as on diff)
14531 !! options
14532 comment
14533 local
14534 title=[[Main Page]]
14535 !!input
14536 [[#section]]
14537 !! result
14538 <a href="#section">#section</a>
14539 !! end
14540
14541 !! test
14542 Edit comment with bare anchor link (non-local, as on history)
14543 !! options
14544 comment
14545 title=[[Main Page]]
14546 !!input
14547 [[#section]]
14548 !! result
14549 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14550 !! end
14551
14552 !! test
14553 Anchor starting with underscore
14554 !!input
14555 [[#_ref|One]]
14556 !! result
14557 <p><a href="#_ref">One</a>
14558 </p>
14559 !! end
14560
14561 !! test
14562 Id starting with underscore
14563 !!input
14564 <div id="_ref"></div>
14565 !! result
14566 <div id="_ref"></div>
14567
14568 !! end
14569
14570 !! test
14571 Space normalisation on autocomment (bug 22784)
14572 !! options
14573 comment
14574 title=[[Main Page]]
14575 !!input
14576 /* __hello__world__ */
14577 !! result
14578 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14579 !! end
14580
14581 !! test
14582 percent-encoding and + signs in comments (Bug 26410)
14583 !! options
14584 comment
14585 !!input
14586 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14587 !! result
14588 <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>
14589 !! end
14590
14591 !! test
14592 Bad images - basic functionality
14593 !! options
14594 disabled
14595 !! input
14596 [[File:Bad.jpg]]
14597 !! result
14598 !! end
14599
14600 !! test
14601 Bad images - bug 16039: text after bad image disappears
14602 !! options
14603 disabled
14604 !! input
14605 Foo bar
14606 [[File:Bad.jpg]]
14607 Bar foo
14608 !! result
14609 <p>Foo bar
14610 </p><p>Bar foo
14611 </p>
14612 !! end
14613
14614 !! test
14615 Verify that displaytitle works (bug #22501) no displaytitle
14616 !! options
14617 showtitle
14618 !! config
14619 wgAllowDisplayTitle=true
14620 wgRestrictDisplayTitle=false
14621 !! input
14622 this is not the the title
14623 !! result
14624 Parser test
14625 <p>this is not the the title
14626 </p>
14627 !! end
14628
14629 !! test
14630 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14631 !! options
14632 showtitle
14633 title=[[Screen]]
14634 !! config
14635 wgAllowDisplayTitle=true
14636 wgRestrictDisplayTitle=false
14637 !! input
14638 this is not the the title
14639 {{DISPLAYTITLE:whatever}}
14640 !! result
14641 whatever
14642 <p>this is not the the title
14643 </p>
14644 !! end
14645
14646 !! test
14647 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14648 !! options
14649 showtitle
14650 title=[[Screen]]
14651 !! config
14652 wgAllowDisplayTitle=true
14653 wgRestrictDisplayTitle=true
14654 !! input
14655 this is not the the title
14656 {{DISPLAYTITLE:whatever}}
14657 !! result
14658 Screen
14659 <p>this is not the the title
14660 </p>
14661 !! end
14662
14663 !! test
14664 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14665 !! options
14666 showtitle
14667 title=[[Screen]]
14668 !! config
14669 wgAllowDisplayTitle=true
14670 wgRestrictDisplayTitle=true
14671 !! input
14672 this is not the the title
14673 {{DISPLAYTITLE:screen}}
14674 !! result
14675 screen
14676 <p>this is not the the title
14677 </p>
14678 !! end
14679
14680 !! test
14681 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14682 !! options
14683 showtitle
14684 title=[[Screen]]
14685 !! config
14686 wgAllowDisplayTitle=false
14687 !! input
14688 this is not the the title
14689 {{DISPLAYTITLE:screen}}
14690 !! result
14691 Screen
14692 <p>this is not the the title
14693 <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>
14694 </p>
14695 !! end
14696
14697 !! test
14698 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14699 !! options
14700 showtitle
14701 title=[[Screen]]
14702 !! config
14703 wgAllowDisplayTitle=false
14704 !! input
14705 this is not the the title
14706 !! result
14707 Screen
14708 <p>this is not the the title
14709 </p>
14710 !! end
14711
14712 !! test
14713 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14714 !! options
14715 showtitle
14716 title=[[Screen]]
14717 !! config
14718 wgAllowDisplayTitle=true
14719 wgRestrictDisplayTitle=true
14720 !! input
14721 this is not the the title
14722 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14723 !! result
14724 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14725 <p>this is not the the title
14726 </p>
14727 !! end
14728
14729 !! test
14730 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14731 !! options
14732 showtitle
14733 title=[[Screen]]
14734 !! config
14735 wgAllowDisplayTitle=true
14736 wgRestrictDisplayTitle=true
14737 !! input
14738 this is not the the title
14739 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14740 !! result
14741 <span style="color: red;">s</span>creen
14742 <p>this is not the the title
14743 </p>
14744 !! end
14745
14746 !! test
14747 preload: check <noinclude> and <includeonly>
14748 !! options
14749 preload
14750 !! input
14751 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14752 !! result
14753 Hello kind world.
14754 !! end
14755
14756 !! test
14757 preload: check <onlyinclude>
14758 !! options
14759 preload
14760 !! input
14761 Goodbye <onlyinclude>Hello world</onlyinclude>
14762 !! result
14763 Hello world
14764 !! end
14765
14766 !! test
14767 preload: can pass tags through if we want to
14768 !! options
14769 preload
14770 !! input
14771 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14772 !! result
14773 <includeonly>Hello world</includeonly>
14774 !! end
14775
14776 !! test
14777 preload: check that it doesn't try to do tricks
14778 !! options
14779 preload
14780 !! input
14781 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14782 !! result
14783 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14784 !! end
14785
14786 !! test
14787 Play a bit with r67090 and bug 3158
14788 !! options
14789 disabled
14790 !! input
14791 <div style="width:50% !important">&nbsp;</div>
14792 <div style="width:50%&nbsp;!important">&nbsp;</div>
14793 <div style="width:50%&#160;!important">&nbsp;</div>
14794 <div style="border : solid;">&nbsp;</div>
14795 !! result
14796 <div style="width:50% !important">&nbsp;</div>
14797 <div style="width:50% !important">&nbsp;</div>
14798 <div style="width:50% !important">&nbsp;</div>
14799 <div style="border&#160;: solid;">&nbsp;</div>
14800
14801 !! end
14802
14803 !! test
14804 HTML5 data attributes
14805 !! input
14806 <span data-foo="bar">Baz</span>
14807 <p data-abc-def_hij="">Quuz</p>
14808 !! result
14809 <p><span data-foo="bar">Baz</span>
14810 </p>
14811 <p data-abc-def_hij="">Quuz</p>
14812
14813 !! end
14814
14815 !! test
14816 percent-encoding and + signs in internal links (Bug 26410)
14817 !! input
14818 [[User:+%]] [[Page+title%]]
14819 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14820 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14821 [[%33%45]] [[%33%45+]]
14822 !! result
14823 <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>
14824 <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>
14825 <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>
14826 <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>
14827 </p>
14828 !! end
14829
14830 !! test
14831 Special characters in embedded file links (bug 27679)
14832 !! input
14833 [[File:Contains & ampersand.jpg]]
14834 [[File:Does not exist.jpg|Title with & ampersand]]
14835 !! result
14836 <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>
14837 <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>
14838 </p>
14839 !! end
14840
14841
14842 !! test
14843 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14844 !! input
14845 Text&apos;s been normalized?
14846 !! result
14847 <p>Text&#39;s been normalized?
14848 </p>
14849 !! end
14850
14851 !! test
14852 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14853 !! input
14854 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14855 !! result
14856 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14857 </p>
14858 !! end
14859
14860 !! test
14861 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14862 !! input
14863 [http://www.example.org/ ideograms]
14864 !! result
14865 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14866 </p>
14867 !! end
14868
14869 !! test
14870 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14871 !! input
14872 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14873 !! result
14874 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14875 </p>
14876 !! end
14877
14878 !! article
14879 Mediawiki:loop1
14880 !! text
14881 {{Identical|A}}
14882 !! endarticle
14883
14884 !! article
14885 Mediawiki:loop2
14886 !! text
14887 {{Identical|B}}
14888 !! endarticle
14889
14890 !! article
14891 Template:Identical
14892 !! text
14893 {{int:loop1}}
14894 {{int:loop2}}
14895 !! endarticle
14896
14897 !! test
14898 Bug 31098 Template which includes system messages which includes the template
14899 !! input
14900 {{Identical}}
14901 !! result
14902 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14903 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14904 </p>
14905 !! end
14906
14907 !! test
14908 Bug31490 Turkish: ucfirst 'blah'
14909 !! options
14910 language=tr
14911 !! input
14912 {{ucfirst:blah}}
14913 !! result
14914 <p>Blah
14915 </p>
14916 !! end
14917
14918 !! test
14919 Bug31490 Turkish: ucfirst 'ix'
14920 !! options
14921 language=tr
14922 !! input
14923 {{ucfirst:ix}}
14924 !! result
14925 <p>İx
14926 </p>
14927 !! end
14928
14929 !! test
14930 Bug31490 Turkish: lcfirst 'BLAH'
14931 !! options
14932 language=tr
14933 !! input
14934 {{lcfirst:BLAH}}
14935 !! result
14936 <p>bLAH
14937 </p>
14938 !! end
14939
14940 !! test
14941 Bug31490 Turkish: ucfırst (with a dotless i)
14942 !! options
14943 language=tr
14944 !! input
14945 {{ucfırst:blah}}
14946 !! result
14947 <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>
14948 </p>
14949 !! end
14950
14951 !! test
14952 Bug31490 ucfırst (with a dotless i) with English language
14953 !! options
14954 language=en
14955 !! input
14956 {{ucfırst:blah}}
14957 !! result
14958 <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>
14959 </p>
14960 !! end
14961
14962 !! test
14963 Bug 26375: TOC with italics
14964 !! options
14965 title=[[Main Page]]
14966 !! input
14967 __TOC__
14968 == ''Lost'' episodes ==
14969 !! result
14970 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14971 <ul>
14972 <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>
14973 </ul>
14974 </div>
14975 <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>
14976
14977 !! end
14978
14979 !! test
14980 Bug 26375: TOC with bold
14981 !! options
14982 title=[[Main Page]]
14983 !! input
14984 __TOC__
14985 == '''should be bold''' then normal text ==
14986 !! result
14987 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14988 <ul>
14989 <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>
14990 </ul>
14991 </div>
14992 <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>
14993
14994 !! end
14995
14996 !! test
14997 Bug 33845: Headings become cursive in TOC when they contain an image
14998 !! options
14999 title=[[Main Page]]
15000 !! input
15001 __TOC__
15002 == Image [[Image:foobar.jpg]] ==
15003 !! result
15004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15005 <ul>
15006 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15007 </ul>
15008 </div>
15009 <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>
15010
15011 !! end
15012
15013 !! test
15014 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15015 !! options
15016 title=[[Main Page]]
15017 !! input
15018 __TOC__
15019 == <blockquote>Quote</blockquote> ==
15020 !! result
15021 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15022 <ul>
15023 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15024 </ul>
15025 </div>
15026 <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>
15027
15028 !! end
15029
15030 !! test
15031 Unclosed tags in TOC
15032 !! options
15033 title=[[Main Page]]
15034 !! input
15035 __TOC__
15036 == Proof: 2 < 3 ==
15037 <small>Hanc marginis exiguitas non caperet.</small>
15038 QED
15039 !! result
15040 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15041 <ul>
15042 <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>
15043 </ul>
15044 </div>
15045 <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>
15046 <p><small>Hanc marginis exiguitas non caperet.</small>
15047 QED
15048 </p>
15049 !! end
15050
15051 !! test
15052 Multiple tags in TOC
15053 !! input
15054 __TOC__
15055 == <i>Foo</i> <b>Bar</b> ==
15056
15057 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15058 !! result
15059 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15060 <ul>
15061 <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>
15062 <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>
15063 </ul>
15064 </div>
15065 <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>
15066 <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>
15067
15068 !! end
15069
15070 !! test
15071 Tags with parameters in TOC
15072 !! input
15073 __TOC__
15074 == <sup class="in-h2">Hello</sup> ==
15075
15076 == <sup class="a > b">Evilbye</sup> ==
15077 !! result
15078 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15079 <ul>
15080 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15081 <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>
15082 </ul>
15083 </div>
15084 <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>
15085 <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>
15086
15087 !! end
15088
15089 !! test
15090 span tags with directionality in TOC
15091 !! input
15092 __TOC__
15093 == <span dir="ltr">C++</span> ==
15094
15095 == <span dir="rtl">זבנג!</span> ==
15096
15097 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15098
15099 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15100
15101 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15102 !! result
15103 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15104 <ul>
15105 <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>
15106 <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>
15107 <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>
15108 <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>
15109 <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>
15110 </ul>
15111 </div>
15112 <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>
15113 <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>
15114 <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>
15115 <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>
15116 <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>
15117
15118 !! end
15119
15120 !! article
15121 MediaWiki:Bug32057
15122 !! text
15123 == {{int:headline_sample}} ==
15124 !! endarticle
15125
15126 !! test
15127 Bug 32057: Title needed when expanding <h> nodes.
15128 !! options
15129 title=[[Main Page]]
15130 !! input
15131 {{int:Bug32057}}
15132 !! result
15133 <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>
15134
15135 !! end
15136
15137 !! test
15138 Strip marker in urlencode
15139 !! input
15140 {{urlencode:x<nowiki/>y}}
15141 {{urlencode:x<nowiki/>y|wiki}}
15142 {{urlencode:x<nowiki/>y|path}}
15143 !! result
15144 <p>xy
15145 xy
15146 xy
15147 </p>
15148 !! end
15149
15150 !! test
15151 Strip marker in lc
15152 !! input
15153 {{lc:x<nowiki/>y}}
15154 !! result
15155 <p>xy
15156 </p>
15157 !! end
15158
15159 !! test
15160 Strip marker in uc
15161 !! input
15162 {{uc:x<nowiki/>y}}
15163 !! result
15164 <p>XY
15165 </p>
15166 !! end
15167
15168 !! test
15169 Strip marker in formatNum
15170 !! input
15171 {{formatnum:1<nowiki/>2}}
15172 {{formatnum:1<nowiki/>2|R}}
15173 !! result
15174 <p>12
15175 12
15176 </p>
15177 !! end
15178
15179 !! test
15180 Check noCommafy in formatNum
15181 !! options
15182 language=be-tarask
15183 !! input
15184 {{formatnum:123456.78}}
15185 {{formatnum:123456.78|NOSEP}}
15186 !! result
15187 <p>123 456,78
15188 123456.78
15189 </p>
15190 !! end
15191
15192 !! test
15193 Strip marker in grammar
15194 !! options
15195 language=fi
15196 !! input
15197 {{grammar:elative|foo<nowiki/>bar}}
15198 !! result
15199 <p>foobarista
15200 </p>
15201 !! end
15202
15203 !! test
15204 Strip marker in padleft
15205 !! input
15206 {{padleft:|2|x<nowiki/>y}}
15207 !! result
15208 <p>xy
15209 </p>
15210 !! end
15211
15212 !! test
15213 Strip marker in padright
15214 !! input
15215 {{padright:|2|x<nowiki/>y}}
15216 !! result
15217 <p>xy
15218 </p>
15219 !! end
15220
15221 !! test
15222 Strip marker in anchorencode
15223 !! input
15224 {{anchorencode:x<nowiki/>y}}
15225 !! result
15226 <p>xy
15227 </p>
15228 !! end
15229
15230 !! test
15231 nowiki inside link inside heading (bug 18295)
15232 !! input
15233 ==[[foo|x<nowiki>y</nowiki>z]]==
15234 !! result
15235 <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>
15236
15237 !! end
15238
15239 !! test
15240 new support for bdi element (bug 31817)
15241 !! input
15242 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15243 !! result
15244 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15245
15246 !!end
15247
15248 !! test
15249 Ignore pipe between table row attributes
15250 !! input
15251 {|
15252 | quux
15253 |- id=foo | style='color: red'
15254 | bar
15255 |}
15256 !! result
15257 <table>
15258 <tr>
15259 <td> quux
15260 </td></tr>
15261 <tr id="foo" style="color: red">
15262 <td> bar
15263 </td></tr></table>
15264
15265 !! end
15266
15267 !!test
15268 Gallery override link with WikiLink (bug 34852)
15269 !! input
15270 <gallery>
15271 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15272 </gallery>
15273 !! result
15274 <ul class="gallery">
15275 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15276 <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>
15277 <div class="gallerytext">
15278 <p>caption
15279 </p>
15280 </div>
15281 </div></li>
15282 </ul>
15283
15284 !! end
15285
15286 !!test
15287 Gallery override link with absolute external link (bug 34852)
15288 !! input
15289 <gallery>
15290 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15291 </gallery>
15292 !! result
15293 <ul class="gallery">
15294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15295 <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>
15296 <div class="gallerytext">
15297 <p>caption
15298 </p>
15299 </div>
15300 </div></li>
15301 </ul>
15302
15303 !! end
15304
15305 !!test
15306 Gallery override link with malicious javascript (bug 34852)
15307 !! input
15308 <gallery>
15309 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15310 </gallery>
15311 !! result
15312 <ul class="gallery">
15313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15314 <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>
15315 <div class="gallerytext">
15316 <p>caption
15317 </p>
15318 </div>
15319 </div></li>
15320 </ul>
15321
15322 !! end
15323
15324 !!test
15325 Gallery with invalid title as link (bug 43964)
15326 !! input
15327 <gallery>
15328 File:foobar.jpg|link=<
15329 </gallery>
15330 !! result
15331 <ul class="gallery">
15332 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15333 <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>
15334 <div class="gallerytext">
15335 </div>
15336 </div></li>
15337 </ul>
15338
15339 !! end
15340
15341 !!test
15342 Language parser function
15343 !! input
15344 {{#language:ar}}
15345 !! result
15346 <p>العربية
15347 </p>
15348 !! end
15349
15350 !!test
15351 Padleft and padright as substr
15352 !! input
15353 {{padleft:|3|abcde}}
15354 {{padright:|3|abcde}}
15355 !! result
15356 <p>abc
15357 abc
15358 </p>
15359 !! end
15360
15361 !!test
15362 Special parser function
15363 !! input
15364 {{#special:RandomPage}}
15365 {{#special:BaDtItLe}}
15366 {{#special:Foobar}}
15367 !! result
15368 <p>Special:Random
15369 Special:Badtitle
15370 Special:Foobar
15371 </p>
15372 !! end
15373
15374 !!test
15375 Bug 34939 - Case insensitive link parsing ([HttP://])
15376 !! input
15377 [HttP://MediaWiki.Org/]
15378 !! result
15379 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15380 </p>
15381 !! end
15382
15383 !!test
15384 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15385 !! input
15386 [HttP://MediaWiki.Org/ MediaWiki]
15387 !! result
15388 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15389 </p>
15390 !! end
15391
15392 !!test
15393 Bug 34939 - Case insensitive link parsing (HttP://)
15394 !! input
15395 HttP://MediaWiki.Org/
15396 !! result
15397 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15398 </p>
15399 !! end
15400
15401
15402 ###
15403 ### Parsoids-specific tests
15404 ### Parsoid-PHP parser incompatibilities
15405 ###
15406 !!test
15407 1. SOL-sensitive wikitext tokens as template-args
15408 !!options
15409 parsoid=wt2html,wt2wt
15410 !!input
15411 {{echo|*a}}
15412 {{echo|#a}}
15413 {{echo|:a}}
15414 !!result
15415 <span about="#mwt1" typeof="mw:Transclusion">
15416 </span><ul about="#mwt1"><li>a</li></ul>
15417 <span about="#mwt2" typeof="mw:Transclusion">
15418 </span><ol about="#mwt2"><li>a</li></ol>
15419 <span about="#mwt3" typeof="mw:Transclusion">
15420 </span><dl about="#mwt3"><dd>a</dd></dl>
15421 !!end
15422
15423 #### ----------------------------------------------------------------
15424 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15425 #### tags. Parsoid's output for these tags differs from that of the
15426 #### PHP parser.
15427 #### ----------------------------------------------------------------
15428
15429 !!test
15430 Ref: 1. ref-location should be replaced with an index span
15431 !!options
15432 parsoid
15433 !!input
15434 A <ref>foo</ref>
15435 B <ref name="x">foo</ref>
15436 C <ref name="y" />
15437 !!result
15438 <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>
15439 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>
15440 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>
15441 !!end
15442
15443 !!test
15444 Ref: 2. ref-tags with identical names should all get the same index
15445 !!options
15446 parsoid
15447 !!input
15448 A <ref name="x">foo</ref>
15449 B <ref name="x" />
15450 !!result
15451 <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>
15452 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>
15453 !!end
15454
15455 !!test
15456 Ref: 3. spaces in ref-names should be ignored
15457 !!options
15458 parsoid
15459 !!input
15460 A <ref name="x">foo</ref>
15461 B <ref name=" x " />
15462 C <ref name= x />
15463 !!result
15464 <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>
15465 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>
15466 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>
15467 !!end
15468
15469 !!test
15470 Ref: 4. 'constructor' should be accepted as a valid ref-name
15471 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15472 !!options
15473 parsoid
15474 !!input
15475 A <ref name="constructor">foo</ref>
15476 !!result
15477 <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>
15478 !!end
15479
15480 !!test
15481 Ref: 5. body should accept generic wikitext
15482 !!options
15483 parsoid
15484 !!input
15485 A <ref>
15486 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15487 </ref>
15488
15489 <references />
15490 !!result
15491 <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>
15492
15493 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15494 <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>
15495 </li></ol>
15496 !!end
15497
15498 !!test
15499 Ref: 6. indent-pres should not be output in ref-body
15500 !!options
15501 parsoid
15502 !!input
15503 A <ref>
15504 foo
15505 bar
15506 baz
15507 </ref>
15508
15509 <references />
15510 !!result
15511 <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>
15512
15513 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15514 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15515 bar
15516 baz
15517 </li></ol>
15518 !!end
15519
15520 !!test
15521 Ref: 6. No p-wrapping in ref-body
15522 !!options
15523 parsoid
15524 !!input
15525 A <ref>
15526 foo
15527
15528 bar
15529
15530
15531 baz
15532
15533
15534
15535 booz
15536 </ref>
15537
15538 <references />
15539 !!result
15540 <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>
15541
15542 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15543 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15544
15545 bar
15546
15547
15548 baz
15549
15550
15551
15552 booz
15553 </li></ol>
15554 !!end
15555
15556 !!test
15557 Ref: 8. transclusion wikitext has lower precedence
15558 !!options
15559 parsoid
15560 !!input
15561 A <ref> foo {{echo|</ref> B C}}
15562
15563 <references />
15564 !!result
15565 <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>
15566
15567 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15568 <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>
15569 !!end
15570
15571 !!test
15572 Ref: 9. unclosed comments should not leak out of ref-body
15573 !!options
15574 parsoid
15575 !!input
15576 A <ref> foo <!--</ref> B C
15577
15578 <references />
15579 !!result
15580 <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>
15581
15582 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15583 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15584 !!end
15585
15586 !!test
15587 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15588 !!options
15589 parsoid
15590 !!input
15591 A <ref> <b> foo </ref> B C
15592
15593 <references />
15594 !!result
15595 <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>
15596
15597 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15598 <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>
15599 !!end
15600
15601 !!test
15602 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15603 !!options
15604 parsoid
15605 !!input
15606 A <ref>foo</ref> B
15607 C <ref>bar</ref> D
15608 !!result
15609 <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
15610 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>
15611 !!end
15612
15613 !!test
15614 Ref: 12. ref-tags act as trailing newline migration barrier
15615 !!options
15616 parsoid
15617 !!input
15618 <!--the newline at the end of this line moves out of the p-tag-->a
15619
15620 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15621 <ref />
15622
15623 c
15624 !!result
15625 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15626
15627
15628 <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>
15629 <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>
15630
15631
15632 <p>c</p>
15633 !!end
15634
15635 !!test
15636 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15637 !!options
15638 parsoid
15639 !!input
15640 <ref>foo</ref> A
15641 <ref>bar
15642 </ref> B
15643 !!result
15644 <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
15645 <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>
15646 !!end
15647
15648 !!test
15649 Ref: 14. A nested ref-tag should be emitted as plain text
15650 !!options
15651 parsoid
15652 !!input
15653 <ref>foo <ref>bar</ref> baz</ref>
15654
15655 <references />
15656 !!result
15657 <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>
15658
15659 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15660 <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>
15661 !!end
15662
15663 !!test
15664 Ref: 15. ref-tags with identical names should get identical indexes
15665 !!options
15666 parsoid
15667 !!input
15668 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15669 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15670
15671 <references />
15672 !!result
15673 <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>
15674 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>
15675
15676 <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>
15677 !!end
15678
15679 !!test
15680 References: 1. references tag without any refs should be handled properly
15681 !!options
15682 parsoid
15683 !!input
15684 <references />
15685 !!result
15686 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15687 !!end
15688
15689 !!test
15690 References: 2. references tag with group only outputs references from that group
15691 !!options
15692 parsoid
15693 !!input
15694 A <ref group="a">foo</ref>
15695 B <ref group="b">bar</ref>
15696
15697 <references group='a' />
15698 !!result
15699 <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>
15700 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>
15701
15702 <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>
15703 !!end
15704
15705 !!test
15706 References: 3. ref list should be cleared after processing references
15707 !!options
15708 parsoid
15709 !!input
15710 A <ref>foo</ref>
15711
15712 <references />
15713
15714 B <ref>bar</ref>
15715
15716 <references />
15717 !!result
15718 <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>
15719
15720 <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>
15721
15722 <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>
15723
15724 <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>
15725 !!end
15726
15727 !!test
15728 References: 4. only referenced group should be cleared after processing references
15729 !!options
15730 parsoid
15731 !!input
15732 A <ref group="a">afoo</ref>
15733 B <ref>bfoo</ref>
15734
15735 <references group="a"/>
15736
15737 C <ref>cfoo</ref>
15738
15739 <references />
15740 !!result
15741 <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>
15742 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>
15743
15744 <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>
15745
15746 <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>
15747
15748 <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>
15749 !!end
15750
15751 !!test
15752 References: 5. ref tags in references should be processed while ignoring all other content
15753 !!options
15754 parsoid
15755 !!input
15756 A <ref name="a" />
15757 B <ref name="b">bar</ref>
15758
15759 <references>
15760 <ref name="a">foo</ref>
15761 This should just get lost.
15762 </references>
15763 !!result
15764 <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>
15765 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>
15766
15767 <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>
15768 !!end
15769
15770 !!test
15771 References: 6. <references /> from a transclusion
15772 !!options
15773 parsoid
15774 !!input
15775 {{echo|<references />}}
15776 !!result
15777 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15778 !!end
15779
15780 !! test
15781 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15782 !! options
15783 parsoid
15784 !! input
15785 A <ref>foo bar for a</ref>
15786 B <ref name="b" />
15787
15788 <references />
15789
15790 <references>
15791 <ref name="b">foo</ref>
15792 </references>
15793 !! result
15794 <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>
15795 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>
15796
15797 <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>
15798
15799 <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>
15800
15801 !! end
15802
15803 #### ----------------------------------------------------------------
15804 #### The following section of tests are primarily to test
15805 #### wikitext escaping capabilities of Parsoid. Given that
15806 #### escaping can be done any number of ways, the wikitext (input)
15807 #### is always adjusted to reflect how Parsoid adds nowiki
15808 #### escape tags.
15809 ####
15810 #### We are marking several tests as parsoid-only since the
15811 #### HTML in the result section is different from what the
15812 #### PHP parser generates for it.
15813 #### ----------------------------------------------------------------
15814
15815
15816 #### --------------- Headings ---------------
15817 #### 0. Unnested
15818 #### 1. Nested inside html <h1>=foo=</h1>
15819 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15820 #### 3. Nested inside html with wikitext split by html tags
15821 #### 4. No escape needed
15822 #### 5. Empty headings <h1></h1>
15823 #### 6. Heading chars in SOL context
15824 #### ----------------------------------------
15825 !! test
15826 Headings: 0. Unnested
15827 !! options
15828 parsoid
15829 !! input
15830 <nowiki>=foo=</nowiki>
15831
15832 <nowiki> =foo= </nowiki>
15833 <!--cmt-->
15834 <nowiki>=foo=</nowiki>
15835
15836 =foo''a''<nowiki>=</nowiki>
15837 !! result
15838 <p><span typeof="mw:Nowiki">=foo=</span></p>
15839
15840 <p><span typeof="mw:Nowiki"> =foo= </span>
15841 <!--cmt-->
15842 <span typeof="mw:Nowiki">=foo=</span></p>
15843
15844 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15845 !!end
15846
15847 !! test
15848 Headings: 1. Nested inside html
15849 !! options
15850 parsoid
15851 !! input
15852 =<nowiki>=foo=</nowiki>=
15853
15854 ==<nowiki>=foo=</nowiki>==
15855
15856 ===<nowiki>=foo=</nowiki>===
15857
15858 ====<nowiki>=foo=</nowiki>====
15859
15860 =====<nowiki>=foo=</nowiki>=====
15861
15862 ======<nowiki>=foo=</nowiki>======
15863 !! result
15864 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15865 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15866 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15867 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15868 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15869 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15870 !!end
15871
15872 !! test
15873 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15874 !! options
15875 parsoid
15876 !! input
15877 =foo=
15878 <nowiki>*</nowiki>bar
15879
15880 =foo=
15881 =bar
15882
15883 =foo=
15884 <nowiki>=bar=</nowiki>
15885 !! result
15886 <h1>foo</h1>*bar
15887 <h1>foo</h1>=bar
15888 <h1>foo</h1>=bar=
15889 !!end
15890
15891 !! test
15892 Headings: 3. Nested inside html with wikitext split by html tags
15893 !! options
15894 parsoid
15895 !! input
15896 =='''bold'''<nowiki>foo=</nowiki>=
15897 !! result
15898 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15899 !!end
15900
15901 !! test
15902 Headings: 4a. No escaping needed (testing just h1 and h2)
15903 !! options
15904 parsoid
15905 !! input
15906 ==foo=
15907
15908 =foo==
15909
15910 = =foo= =
15911
15912 ==foo= bar=
15913
15914 ===foo==
15915
15916 ==foo===
15917
15918 =''=''foo==
15919
15920 =<nowiki>=</nowiki>=
15921 !! result
15922 <h1>=foo</h1>
15923 <h1>foo=</h1>
15924 <h1> =foo= </h1>
15925 <h1>=foo= bar</h1>
15926 <h2>=foo</h2>
15927 <h2>foo=</h2>
15928 <h1><i>=</i>foo=</h1>
15929 <h1><span typeof="mw:Nowiki">=</span></h1>
15930 !!end
15931
15932 !! test
15933 Headings: 4b. No escaping needed (inside p-tags)
15934 !! options
15935 parsoid
15936 !! input
15937 ===
15938 =foo= x
15939 =foo= <s></s>
15940 !! result
15941 <p>===
15942 =foo= x
15943 =foo= <s></s>
15944 </p>
15945 !!end
15946
15947 !! test
15948 Headings: 5. Empty headings
15949 !! options
15950 parsoid
15951 !! input
15952 =<nowiki/>=
15953
15954 ==<nowiki/>==
15955
15956 ===<nowiki/>===
15957
15958 ====<nowiki/>====
15959
15960 =====<nowiki/>=====
15961
15962 ======<nowiki/>======
15963 !! result
15964 <h1></h1>
15965 <h2></h2>
15966 <h3></h3>
15967 <h4></h4>
15968 <h5></h5>
15969 <h6></h6>
15970 !!end
15971
15972 !! test
15973 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15974 !! options
15975 parsoid
15976 !! input
15977 <nowiki>=a=</nowiki>
15978
15979 <nowiki>=a=</nowiki>
15980
15981 <nowiki>=a=</nowiki>
15982
15983 <nowiki>=a=</nowiki>
15984 !! result
15985 <p>=a=</p>
15986 <p>=a= </p>
15987 <p>=a= </p>
15988 <p>=a= </p>
15989 !!end
15990
15991 !! test
15992 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15993 !! options
15994 parsoid
15995 !! input
15996 <nowiki>=a=
15997 b</nowiki>
15998
15999 <nowiki>=a=
16000 b</nowiki>
16001
16002 <nowiki>=a=
16003 b</nowiki>
16004
16005 <nowiki>=a=
16006 b</nowiki>
16007 !! result
16008 <p>=a=
16009 b</p>
16010 <p>=a=
16011 b</p>
16012 <p>=a=
16013 b</p>
16014 <p>=a=
16015 b</p>
16016 </p>
16017 !!end
16018
16019 !! test
16020 Headings: 6c. Heading chars in SOL context (leading newline break)
16021 !! options
16022 parsoid
16023 !! input
16024 a
16025 <nowiki>=b=</nowiki>
16026 !! result
16027 <p>a
16028 =b=</p>
16029 !!end
16030
16031 !! test
16032 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16033 !! options
16034 parsoid
16035 !! input
16036 <!--c0--><nowiki>=a=</nowiki>
16037 <!--c1-->
16038 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16039 !! result
16040 <p><!--c0-->=a=</p>
16041 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16042 !!end
16043
16044 !! test
16045 Headings: 6d. Heading chars in SOL context (No escaping needed)
16046 !! options
16047 parsoid=html2wt
16048 !! input
16049 =a=<div>b</div>
16050 !! result
16051 =a=<div>b</div>
16052 !!end
16053
16054 #### --------------- Lists ---------------
16055 #### 0. Outside nests (*foo, etc.)
16056 #### 1. Nested inside html <ul><li>*foo</li></ul>
16057 #### 2. Inside definition lists
16058 #### 3. Only bullets at start should be escaped
16059 #### 4. No escapes needed
16060 #### 5. No unnecessary escapes
16061 #### 6. Escape bullets in SOL position
16062 #### 7. Escape bullets in a multi-line context
16063 #### ----------------------------------------
16064
16065 !! test
16066 Lists: 0. Outside nests
16067 !! input
16068 <nowiki>*</nowiki>foo
16069
16070 <nowiki>#</nowiki>foo
16071 !! result
16072 <p>*foo
16073 </p><p>#foo
16074 </p>
16075 !!end
16076
16077 !! test
16078 Lists: 1. Nested inside html
16079 !! input
16080 *<nowiki>*foo</nowiki>
16081
16082 *<nowiki>#foo</nowiki>
16083
16084 *<nowiki>:foo</nowiki>
16085
16086 *<nowiki>;foo</nowiki>
16087
16088 #<nowiki>*foo</nowiki>
16089
16090 #<nowiki>#foo</nowiki>
16091
16092 #<nowiki>:foo</nowiki>
16093
16094 #<nowiki>;foo</nowiki>
16095 !! result
16096 <ul><li>*foo
16097 </li></ul>
16098 <ul><li>#foo
16099 </li></ul>
16100 <ul><li>:foo
16101 </li></ul>
16102 <ul><li>;foo
16103 </li></ul>
16104 <ol><li>*foo
16105 </li></ol>
16106 <ol><li>#foo
16107 </li></ol>
16108 <ol><li>:foo
16109 </li></ol>
16110 <ol><li>;foo
16111 </li></ol>
16112
16113 !!end
16114
16115 !! test
16116 Lists: 2. Inside definition lists
16117 !! input
16118 ;<nowiki>;foo</nowiki>
16119
16120 ;<nowiki>:foo</nowiki>
16121
16122 ;<nowiki>:foo</nowiki>
16123 :bar
16124
16125 :<nowiki>:foo</nowiki>
16126 !! result
16127 <dl><dt>;foo
16128 </dt></dl>
16129 <dl><dt>:foo
16130 </dt></dl>
16131 <dl><dt>:foo
16132 </dt><dd>bar
16133 </dd></dl>
16134 <dl><dd>:foo
16135 </dd></dl>
16136
16137 !!end
16138
16139 !! test
16140 Lists: 3. Only bullets at start of text should be escaped
16141 !! input
16142 *<nowiki>*foo*bar</nowiki>
16143
16144 *<nowiki>*foo</nowiki>''it''*bar
16145 !! result
16146 <ul><li>*foo*bar
16147 </li></ul>
16148 <ul><li>*foo<i>it</i>*bar
16149 </li></ul>
16150
16151 !!end
16152
16153 !! test
16154 Lists: 4. No escapes needed
16155 !! options
16156 parsoid
16157 !! input
16158 *foo*bar
16159
16160 *''foo''*bar
16161
16162 *[[Foo]]: bar
16163 !! result
16164 <ul><li>foo*bar
16165 </li></ul>
16166 <ul><li><i>foo</i>*bar
16167 </li></ul>
16168 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16169 </li></ul>
16170 !!end
16171
16172 !! test
16173 Lists: 5. No unnecessary escapes
16174 !! input
16175 * bar <span><nowiki>[[foo]]</nowiki></span>
16176
16177 *=bar <span><nowiki>[[foo]]</nowiki></span>
16178
16179 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16180
16181 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16182
16183 *=bar <span>foo]]</span>=
16184
16185 * <s></s>: a
16186 !! result
16187 <ul><li> bar <span>[[foo]]</span>
16188 </li></ul>
16189 <ul><li>=bar <span>[[foo]]</span>
16190 </li></ul>
16191 <ul><li>[[bar <span>[[foo]]</span>
16192 </li></ul>
16193 <ul><li>]]bar <span>[[foo]]</span>
16194 </li></ul>
16195 <ul><li>=bar <span>foo]]</span>=
16196 </li></ul>
16197 <ul><li> <s></s>: a
16198 </li></ul>
16199
16200 !!end
16201
16202 !! test
16203 Lists: 6. Escape bullets in SOL position
16204 !! options
16205 parsoid
16206 !! input
16207 <!--cmt--><nowiki>*foo</nowiki>
16208 !! result
16209 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16210 !!end
16211
16212 !! test
16213 Lists: 7. Escape bullets in a multi-line context
16214 !! input
16215 a
16216 <nowiki>*</nowiki>b
16217 !! result
16218 <p>a
16219 *b
16220 </p>
16221 !!end
16222
16223 #### --------------- HRs ---------------
16224 #### 1. Single line
16225 #### -----------------------------------
16226
16227 !! test
16228 HRs: 1. Single line
16229 !! options
16230 parsoid
16231 !! input
16232 ----<nowiki>----</nowiki>
16233 ----=foo=
16234 ----*foo
16235 !! result
16236 <hr><span typeof="mw:Nowiki">----</span>
16237 <hr>=foo=
16238 <hr>*foo
16239 !! end
16240
16241 #### --------------- Tables ---------------
16242 #### 1a. Simple example
16243 #### 1b. No escaping needed (!foo)
16244 #### 1c. No escaping needed (|foo)
16245 #### 1d. No escaping needed (|}foo)
16246 ####
16247 #### 2a. Nested in td (<td>foo|bar</td>)
16248 #### 2b. Nested in td (<td>foo||bar</td>)
16249 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16250 ####
16251 #### 3a. Nested in th (<th>foo!bar</th>)
16252 #### 3b. Nested in th (<th>foo!!bar</th>)
16253 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16254 ####
16255 #### 4a. Escape -
16256 #### 4b. Escape +
16257 #### 4c. No escaping needed
16258 #### --------------------------------------
16259
16260 !! test
16261 Tables: 1a. Simple example
16262 !! input
16263 <nowiki>{|
16264 |}</nowiki>
16265 !! result
16266 <p>{|
16267 |}
16268 </p>
16269 !! end
16270
16271 !! test
16272 Tables: 1b. No escaping needed
16273 !! input
16274 !foo
16275 !! result
16276 <p>!foo
16277 </p>
16278 !! end
16279
16280 !! test
16281 Tables: 1c. No escaping needed
16282 !! input
16283 |foo
16284 !! result
16285 <p>|foo
16286 </p>
16287 !! end
16288
16289 !! test
16290 Tables: 1d. No escaping needed
16291 !! input
16292 |}foo
16293 !! result
16294 <p>|}foo
16295 </p>
16296 !! end
16297
16298 !! test
16299 Tables: 2a. Nested in td
16300 !! options
16301 parsoid
16302 !! input
16303 {|
16304 |<nowiki>foo|bar</nowiki>
16305 |}
16306 !! result
16307 <table><tbody><tr>
16308 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16309 !! end
16310
16311 !! test
16312 Tables: 2b. Nested in td
16313 !! options
16314 parsoid
16315 !! input
16316 {|
16317 |<nowiki>foo||bar</nowiki>
16318 |''it''<nowiki>foo||bar</nowiki>
16319 |}
16320 !! result
16321 <table><tbody><tr>
16322 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16323 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16324 !! end
16325
16326 !! test
16327 Tables: 2c. Nested in td -- no escaping needed
16328 !! options
16329 parsoid
16330 !! input
16331 {|
16332 |foo!!bar
16333 |}
16334 !! result
16335 <table><tbody><tr><td>foo!!bar
16336 </td></tr></tbody></table>
16337
16338 !! end
16339
16340 !! test
16341 Tables: 3a. Nested in th
16342 !! options
16343 parsoid
16344 !! input
16345 {|
16346 !foo!bar
16347 |}
16348 !! result
16349 <table><tbody><tr><th>foo!bar
16350 </th></tr></tbody></table>
16351
16352 !! end
16353
16354 !! test
16355 Tables: 3b. Nested in th
16356 !! options
16357 parsoid
16358 !! input
16359 {|
16360 !<nowiki>foo!!bar</nowiki>
16361 |}
16362 !! result
16363 <table>
16364 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16365 </tbody></table>
16366 !! end
16367
16368 !! test
16369 Tables: 3c. Nested in th -- no escaping needed
16370 !! options
16371 parsoid
16372 !! input
16373 {|
16374 !<nowiki>foo||bar</nowiki>
16375 |}
16376 !! result
16377 <table><tbody><tr>
16378 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16379 !! end
16380
16381 !! test
16382 Tables: 4a. Escape -
16383 !! options
16384 parsoid
16385 !! input
16386 {|
16387 |-
16388 !-bar
16389 |-
16390 |<nowiki>-bar</nowiki>
16391 |}
16392 !! result
16393 <table><tbody>
16394 <tr><th>-bar</th></tr>
16395 <tr>
16396 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16397 !! end
16398
16399 !! test
16400 Tables: 4b. Escape +
16401 !! options
16402 parsoid
16403 !! input
16404 {|
16405 |-
16406 !+bar
16407 |-
16408 |<nowiki>+bar</nowiki>
16409 |}
16410 !! result
16411 <table><tbody>
16412 <tr><th>+bar</th></tr>
16413 <tr>
16414 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16415 !! end
16416
16417 !! test
16418 Tables: 4c. No escaping needed
16419 !! options
16420 parsoid
16421 !! input
16422 {|
16423 |-
16424 |foo-bar
16425 |foo+bar
16426 |-
16427 |''foo''-bar
16428 |''foo''+bar
16429 |-
16430 |foo
16431 bar|baz
16432 +bar
16433 -bar
16434 |}
16435 !! result
16436 <table><tbody>
16437 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16438 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16439 <tr><td>foo
16440 <p>bar|baz
16441 +bar
16442 -bar</p></td></tr>
16443 </tbody></table>
16444 !! end
16445
16446 ### SSS FIXME: Disabled right now because accurate html2wt
16447 ### on this snippet requires data-parsoid flags that we've
16448 ### stripped out of these tests. We should scheme how we
16449 ### we want to handle these kind of tests that require
16450 ### data-parsoid flags for accurate html2wt serialization
16451
16452 !! test
16453 Tables: 4d. No escaping needed
16454 !! options
16455 disabled
16456 !! input
16457 {|
16458 ||+1
16459 ||-2
16460 |}
16461 !! result
16462 <table>
16463 <tr>
16464 <td>+1
16465 </td>
16466 <td>-2
16467 </td></tr></table>
16468
16469 !! end
16470
16471 #### --------------- Links ----------------
16472 #### 1. Quote marks in link text
16473 #### 2. Wikilinks: Escapes needed
16474 #### 3. Wikilinks: No escapes needed
16475 #### 4. Extlinks: Escapes needed
16476 #### 5. Extlinks: No escapes needed
16477 #### --------------------------------------
16478 !! test
16479 Links 1. Quote marks in link text
16480 !! options
16481 parsoid
16482 !! input
16483 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16484 !! result
16485 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16486 !! end
16487
16488 !! test
16489 Links 2. WikiLinks: Escapes needed
16490 !! options
16491 parsoid
16492 !! input
16493 [[Foo|<nowiki>[Foobar]</nowiki>]]
16494 [[Foo|<nowiki>Foobar]</nowiki>]]
16495 [[Foo|x [Foobar] x]]
16496 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16497 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16498 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16499 [[Foo|<nowiki>|Bar</nowiki>]]
16500 [[Foo|<nowiki>]]bar</nowiki>]]
16501 [[Foo|<nowiki>[[bar</nowiki>]]
16502 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16503 !! result
16504 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16505 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16506 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16507 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16508 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16509 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16510 <a href="Foo" rel="mw:WikiLink">|Bar</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">x ]] y [[ z</a>
16514 !! end
16515
16516 !! test
16517 Links 3. WikiLinks: No escapes needed
16518 !! options
16519 parsoid
16520 !! input
16521 [[Foo|[Foobar]]
16522 [[Foo|foo|bar]]
16523 !! result
16524 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16525 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16526 !! end
16527
16528 !! test
16529 Links 4. ExtLinks: Escapes needed
16530 !! options
16531 parsoid
16532 !! input
16533 [http://google.com <nowiki>[google]</nowiki>]
16534 [http://google.com <nowiki>google]</nowiki>]
16535 !! result
16536 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16537 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16538 !! end
16539
16540 !! test
16541 Links 5. ExtLinks: No escapes needed
16542 !! options
16543 parsoid
16544 !! input
16545 [http://google.com [google]
16546 !! result
16547 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16548 !! end
16549
16550 #### --------------- Quotes ---------------
16551 #### 1. Quotes inside <b> and <i>
16552 #### 2. Link fragments separated by <i> and <b> tags
16553 #### 3. Link fragments inside <i> and <b>
16554 #### 4. No escaping needed
16555 #### --------------------------------------
16556 !! test
16557 1. Quotes inside <b> and <i>
16558 !! options
16559 parsoid=html2wt,wt2wt
16560 !! input
16561 ''<nowiki>'foo'</nowiki>''
16562 ''<nowiki>''foo''</nowiki>''
16563 ''<nowiki>'''foo'''</nowiki>''
16564 ''foo''<nowiki/>'s
16565 '''<nowiki>'foo'</nowiki>'''
16566 '''<nowiki>''foo''</nowiki>'''
16567 '''<nowiki>'''foo'''</nowiki>'''
16568 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16569 '''foo'''<nowiki/>'s
16570 '''foo''
16571 ''foo''<nowiki/>'
16572 '<nowiki/>''foo''<nowiki/>'
16573 ''''foo'''
16574 '''foo'''<nowiki/>'
16575 '<nowiki/>'''foo'''<nowiki/>'
16576 !! result
16577 <p><i>'foo'</i>
16578 <i>''foo''</i>
16579 <i>'''foo'''</i>
16580 <i>foo</i>'s
16581 <b>'foo'</b>
16582 <b>''foo''</b>
16583 <b>'''foo'''</b>
16584 <b>foo'<i>bar'</i>baz</b>
16585 <b>foo</b>'s
16586 '<i>foo</i>
16587 <i>foo</i>'
16588 '<i>foo</i>'
16589 '<b>foo</b>
16590 <b>foo</b>'
16591 '<b>foo</b>'</p>
16592 !! end
16593
16594 !! test
16595 2. Link fragments separated by <i> and <b> tags
16596 !! input
16597 [[''foo''<nowiki>hello]]</nowiki>
16598
16599 [['''foo'''<nowiki>hello]]</nowiki>
16600 !! result
16601 <p>[[<i>foo</i>hello]]
16602 </p><p>[[<b>foo</b>hello]]
16603 </p>
16604 !! end
16605
16606 !! test
16607 3. Link fragments inside <i> and <b>
16608 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16609 this is one of the shortcomings of this format)
16610 !! input
16611 ''[[foo''<nowiki>]]</nowiki>
16612
16613 '''[[foo'''<nowiki>]]</nowiki>
16614 !! result
16615 <p><i>[[foo</i>]]
16616 </p><p><b>[[foo</b>]]
16617 </p>
16618 !! end
16619
16620 !! test
16621 4. No escaping needed
16622 !! input
16623 '<span>''bar''</span>'
16624 '<span>'''bar'''</span>'
16625 !! result
16626 <p>'<span><i>bar</i></span>'
16627 '<span><b>bar</b></span>'
16628 </p>
16629 !! end
16630
16631 #### ----------- Paragraphs ---------------
16632 #### 1. No unnecessary escapes
16633 #### --------------------------------------
16634
16635 !! test
16636 1. No unnecessary escapes
16637 !! input
16638 bar <span><nowiki>[[foo]]</nowiki></span>
16639
16640 =bar <span><nowiki>[[foo]]</nowiki></span>
16641
16642 [[bar <span><nowiki>[[foo]]</nowiki></span>
16643
16644 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16645
16646 =bar <span>foo]]</span><nowiki>=</nowiki>
16647 !! result
16648 <p>bar <span>[[foo]]</span>
16649 </p><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>
16654 !!end
16655
16656 #### ----------------------- PRE --------------------------
16657 #### 1. Leading whitespace in SOL context should be escaped
16658 #### ------------------------------------------------------
16659 !! test
16660 1. Leading whitespace in SOL context should be escaped
16661 !! options
16662 parsoid
16663 !! input
16664 <nowiki> </nowiki>a
16665
16666 <nowiki> </nowiki> a
16667
16668 <nowiki> </nowiki>a(tab)
16669
16670 <nowiki> </nowiki> a
16671 <!--cmt-->
16672 <nowiki> </nowiki> a
16673
16674 a
16675 <nowiki> </nowiki>b
16676
16677 a
16678 <nowiki> </nowiki>b
16679
16680 a
16681 <nowiki> </nowiki> b
16682 !! result
16683 <p> a</p>
16684 <p> a</p>
16685 <p> a(tab)</p>
16686 <p> a</p>
16687 <p><!--cmt--> a</p>
16688 <p>a
16689 b</p>
16690 <p>a
16691 b</p>
16692 <p>a
16693 b</p>
16694 !! end
16695
16696 #### --------------- HTML tags ---------------
16697 #### 1. a tags
16698 #### 2. other tags
16699 #### 3. multi-line html tag
16700 #### -----------------------------------------
16701 !! test
16702 1. a tags
16703 !! options
16704 parsoid
16705 !! input
16706 <a href="http://google.com">google</a>
16707 !! result
16708 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16709 !! end
16710
16711 !! test
16712 2. other tags
16713 !! input
16714 <nowiki><div>foo</div>
16715 <div style="color:red">foo</div></nowiki>
16716 !! result
16717 <p>&lt;div&gt;foo&lt;/div&gt;
16718 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16719 </p>
16720 !! end
16721
16722 !! test
16723 3. multi-line html tag
16724 !! input
16725 <nowiki><div
16726 >foo</div
16727 ></nowiki>
16728 !! result
16729 <p>&lt;div
16730 &gt;foo&lt;/div
16731 &gt;
16732 </p>
16733 !! end
16734
16735 !! test
16736 4. extension tags
16737 !! input
16738 <nowiki><ref>foo</ref></nowiki>
16739 !! result
16740 <p>&lt;ref&gt;foo&lt;/ref&gt;
16741 </p>
16742 !! end
16743
16744 #### --------------- Others ---------------
16745 !! test
16746 Escaping nowikis
16747 !! input
16748 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16749 !! result
16750 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16751 </p>
16752 !! end
16753
16754 ## The quote-char in the input is necessary for triggering the bug
16755 !! test
16756 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16757 !! options
16758 parsoid=wt2wt,html2wt
16759 !! input
16760 foo's bar :
16761 !! result
16762 <p>foo's bar :</p>
16763 !! end
16764
16765 !! test
16766
16767 Tag-like HTML structures are passed through as text
16768 !! input
16769 <x y>
16770
16771 <x.y>
16772
16773 <x-y>
16774
16775 1>2
16776
16777 x<y
16778
16779 a>b
16780
16781 1<d e>f
16782 !! result
16783 <p>&lt;x y&gt;
16784 </p><p>&lt;x.y&gt;
16785 </p><p>&lt;x-y&gt;
16786 </p><p>1&gt;2
16787 </p><p>x&lt;y
16788 </p><p>a&gt;b
16789 </p><p>1&lt;d e&gt;f
16790 </p>
16791 !! end
16792
16793
16794 # This was a bug in the PHP parser (see bug 17663 and its dups,
16795 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16796 !! test
16797 Tag names followed by punctuation should not be recognized as tags
16798 !! input
16799 <s.ome> text
16800 !! result
16801 <p>&lt;s.ome&gt; text
16802 </p>
16803 !! end
16804
16805 !! test
16806 HTML tag with necessary entities in attributes
16807 !! input
16808 <span title="&amp;amp;">foo</span>
16809 !! result
16810 <p><span title="&amp;amp;">foo</span>
16811 </p>
16812 !! end
16813
16814 !! test
16815 HTML tag with 'unnecessary' entity encoding in attributes
16816 !! input
16817 <span title="&amp;">foo</span>
16818 !! result
16819 <p><span title="&amp;">foo</span>
16820 </p>
16821 !! end
16822
16823 !! test
16824 HTML tag with broken attribute value quoting
16825 !! input
16826 <span title="Hello world>Foo</span>
16827 !! result
16828 <p><span>Foo</span>
16829 </p>
16830 !! end
16831
16832 !! test
16833 Parsoid-only: HTML tag with broken attribute value quoting
16834 !! options
16835 parsoid
16836 !! input
16837 <span title="Hello world>Foo</span>
16838 !! result
16839 <p><span title="Hello world">Foo</span>
16840 </p>
16841 !! end
16842
16843 !! test
16844 Table with broken attribute value quoting
16845 !! input
16846 {|
16847 | title="Hello world|Foo
16848 |}
16849 !! result
16850 <table>
16851 <tr>
16852 <td>Foo
16853 </td></tr></table>
16854
16855 !! end
16856
16857 !! test
16858 Table with broken attribute value quoting on consecutive lines
16859 !! input
16860 {|
16861 | title="Hello world|Foo
16862 | style="color:red|Bar
16863 |}
16864 !! result
16865 <table>
16866 <tr>
16867 <td>Foo
16868 </td>
16869 <td>Bar
16870 </td></tr></table>
16871
16872 !! end
16873
16874 !! test
16875 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16876 !! options
16877 parsoid
16878 !! input
16879 {|
16880 | title="Hello world|Foo
16881 | style="color:red|Bar
16882 |}
16883 !! result
16884 <table><tbody>
16885 <tr>
16886 <td title="Hello world">Foo
16887 </td><td style="color: red">Bar
16888 </td></tr></tbody></table>
16889
16890 !! end
16891
16892 !! test
16893 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16894 !! options
16895 parsoid
16896 !! input
16897 {{}}
16898 !! result
16899 {{}}
16900 !! end
16901
16902 !! test
16903 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16904 !! options
16905 parsoid
16906 !! input
16907 }}{{
16908 !! result
16909 }}{{
16910 !! end
16911
16912 !!test
16913 Accept empty td cell attribute
16914 !!input
16915 {|
16916 | align="center" | foo || |
16917 |}
16918 !!result
16919 <table>
16920 <tr>
16921 <td align="center"> foo </td>
16922 <td>
16923 </td></tr></table>
16924
16925 !!end
16926
16927 !!test
16928 Non-empty attributes in th-cells
16929 !!input
16930 {|
16931 ! Foo !! style="color: red" | Bar
16932 |}
16933 !!result
16934 <table>
16935 <tr>
16936 <th> Foo </th>
16937 <th style="color: red"> Bar
16938 </th></tr></table>
16939
16940 !!end
16941
16942 !!test
16943 Accept empty attributes in th-cells
16944 !!input
16945 {|
16946 !| foo !!| bar
16947 |}
16948 !!result
16949 <table>
16950 <tr>
16951 <th> foo </th>
16952 <th> bar
16953 </th></tr></table>
16954
16955 !!end
16956
16957 !!test
16958 Empty table rows go away
16959 !!input
16960 {|
16961 | Hello
16962 | there
16963 |- class="foo"
16964 |-
16965 |}
16966 !! result
16967 <table>
16968 <tr>
16969 <td> Hello
16970 </td>
16971 <td> there
16972 </td></tr>
16973
16974 </table>
16975
16976 !! end
16977
16978 ###
16979 ### Parsoid-centric tests for testing RTing of inter-element separators
16980 ### Edge cases not tested by existing parser tests and specific to
16981 ### Parsoid-specific serialization strategies.
16982 ###
16983
16984 !!test
16985 RT-ed inter-element separators should be valid separators
16986 !!input
16987 {|
16988 |- [[foo]]
16989 |}
16990 !!result
16991 <table>
16992
16993 </table>
16994
16995 !!end
16996
16997 !!test
16998 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16999 (Parsoid-only since PHP parser relies on Tidy for correct output)
17000 !!options
17001 parsoid
17002 !!input
17003 {|
17004 |<small>foo
17005 bar
17006 |}
17007
17008 {|
17009 |<small>foo<small>
17010 |}
17011 !!result
17012 !!end
17013
17014 !!test
17015 Empty TD followed by TD with tpl-generated attribute
17016 !!input
17017 {|
17018 |-
17019 |
17020 |{{echo|style='color:red'}}|foo
17021 |}
17022 !!result
17023 <table>
17024
17025 <tr>
17026 <td>
17027 </td>
17028 <td>foo
17029 </td></tr></table>
17030
17031 !!end
17032
17033 !!test
17034 Indented table with an empty td
17035 !!input
17036 {|
17037 |-
17038 |
17039 |foo
17040 |}
17041 !!result
17042 <table>
17043
17044 <tr>
17045 <td>
17046 </td>
17047 <td>foo
17048 </td></tr></table>
17049
17050 !!end
17051
17052 !!test
17053 Empty TR followed by a template-generated TR
17054 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17055 !!options
17056 parsoid=wt2html,wt2wt
17057 !!input
17058 {|
17059 |-
17060 {{echo|<tr><td>foo</td></tr>}}
17061 |}
17062 !!result
17063 <table>
17064 <tbody>
17065 <tr></tr>
17066 <tr typeof="mw:Transclusion">
17067 <td>foo</td></tr></tbody></table>
17068 !!end
17069
17070 ## PHP and parsoid output differ for this, and since this is primarily
17071 ## for testing Parsoid's serializer, marking this Parsoid only
17072 !!test
17073 Empty TR followed by mixed-ws-comment line should RT correctly
17074 !!options
17075 parsoid
17076 !!input
17077 {|
17078 |-
17079 <!--c-->
17080 |-
17081 <!--c--> <!--d-->
17082 |}
17083 !!result
17084 <table>
17085 <tbody>
17086 <tr>
17087 <td> <!--c--></td></tr>
17088 <tr>
17089 <td><!--c--> <!--d--></td></tr>
17090 </tbody></table>
17091
17092 !!end
17093
17094 !!test
17095 Multi-line image caption generated by templates with/without trailing newlines
17096 !!options
17097 parsoid
17098 !!input
17099 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17100 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17101 !!result
17102 <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>
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\n\n</div></div></div>
17104
17105 !!end
17106
17107 ## PHP emits broken html for this, and since this is primarily
17108 ## a Parsoid serializer test, marking this Parsoid only
17109 !!test
17110 Improperly nested inline or quotes tags with whitespace in between
17111 !!options
17112 parsoid
17113 !!input
17114 <span> <s>x</span> </s>
17115 ''' ''x''' ''
17116 !!result
17117 <p><span> <s>x</s></span><s> </s>
17118 <b> <i>x</i></b><i> </i>
17119 </p>
17120 !!end
17121
17122 !!test
17123 Encapsulate protected attributes from wt
17124 !!options
17125 parsoid
17126 !!input
17127 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17128 !!result
17129 <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>
17130 </body>
17131 !!end
17132
17133 # -----------------------------------------------------------------
17134 # The following section of tests are primarily to spec requirements
17135 # around serialization of new/edited content.
17136 #
17137 # All these tests are marked Parsoid html2wt and html2html only
17138 # ----------------------------------------------------------------
17139
17140 !! test
17141 Image: Modifying size of an image
17142 !! options
17143 parsoid=html2wt
17144 !! input
17145 [[Image:Wiki.png|230x230px]]
17146 !! result
17147 <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>
17148 !!end
17149
17150 !! test
17151 Image: New block level image should have \n before and after
17152 !! options
17153 parsoid=html2wt
17154 !! input
17155 123
17156 [[File:Wiki.png|right|thumb|150x150px]]
17157 456
17158 !! result
17159 <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>
17160 !!end
17161
17162 # Wacky -- the leading newline in input is required because
17163 # that is what the serializer emits. To be fixed. Not fixing
17164 # the test because this test is required to test serialization of
17165 # new content and preferred whitespace style.
17166 !! test
17167 Lists: Add space after bullets
17168 !! options
17169 parsoid=html2wt
17170 !! input
17171
17172 * foo
17173 * bar
17174 * <span> baz</span>
17175 !! result
17176 <ul>
17177 <li>foo</li>
17178 <li> bar</li>
17179 <li><span> baz</span></li>
17180 </ul>
17181 !! end
17182
17183 !! test
17184 Parsoid: Serialize positional parameters with = in them as named parameter
17185 !! options
17186 parsoid=html2wt
17187 !! input
17188 {{echo|1 = f=oo}}
17189 !! result
17190 <p about="#mwt1" typeof="mw:Transclusion"
17191 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17192 >foo</p>
17193 !! end
17194
17195 # -----------------------------------------------------------------
17196 # End of section for Parsoid-only html2wt tests for serialization
17197 # of new content
17198 # -----------------------------------------------------------------
17199
17200 TODO:
17201 more images
17202 more tables
17203 character entities
17204 and much more
17205 Try for 100% code coverage