Merge "Select search backend by query parameter"
[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 # Expected output in the following test is not really expected (there should be
1356 # <pre> in the output) -- it's only testing for well-formedness.
1357 !! test
1358 Bug 6200: Preformatted in <blockquote>
1359 !! input
1360 <blockquote>
1361 Blah
1362 </blockquote>
1363 !! result
1364 <blockquote>
1365 Blah
1366 </blockquote>
1367
1368 !! end
1369
1370 !! test
1371 <pre> with attributes (bug 3202)
1372 !! input
1373 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1374 !! result
1375 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1376
1377 !! end
1378
1379 !! test
1380 <pre> with width attribute (bug 3202)
1381 !! input
1382 <pre width="8">Narrow screen goodies</pre>
1383 !! result
1384 <pre width="8">Narrow screen goodies</pre>
1385
1386 !! end
1387
1388 !! test
1389 <pre> with forbidden attribute (bug 3202)
1390 !! input
1391 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1392 !! result
1393 <pre width="8">Narrow screen goodies</pre>
1394
1395 !! end
1396
1397 !! test
1398 Entities inside <pre>
1399 !! input
1400 <pre>&lt;</pre>
1401 !! result
1402 <pre>&lt;</pre>
1403
1404 !! end
1405
1406 !! test
1407 <pre> with forbidden attribute values (bug 3202)
1408 !! input
1409 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1410 !! result
1411 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1412
1413 !! end
1414
1415 !! test
1416 <nowiki> inside <pre> (bug 13238)
1417 !! input
1418 <pre>
1419 <nowiki>
1420 </pre>
1421 <pre>
1422 <nowiki></nowiki>
1423 </pre>
1424 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1425 !! result
1426 <pre>
1427 &lt;nowiki&gt;
1428 </pre>
1429 <pre>
1430
1431 </pre>
1432 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1433
1434 !! end
1435
1436 !! test
1437 <nowiki> and <pre> preference (first one wins)
1438 !! input
1439 <pre>
1440 <nowiki>
1441 </pre>
1442 </nowiki>
1443 </pre>
1444
1445 <nowiki>
1446 <pre>
1447 <nowiki>
1448 </pre>
1449 </nowiki>
1450 </pre>
1451
1452 !! result
1453 <pre>
1454 &lt;nowiki&gt;
1455 </pre>
1456 <p>&lt;/nowiki&gt;
1457 &lt;/pre&gt;
1458 </p><p>
1459 &lt;pre&gt;
1460 &lt;nowiki&gt;
1461 &lt;/pre&gt;
1462
1463 &lt;/pre&gt;
1464 </p>
1465 !! end
1466
1467 !! test
1468 </pre> inside nowiki
1469 !! input
1470 <nowiki></pre></nowiki>
1471 !! result
1472 <p>&lt;/pre&gt;
1473 </p>
1474 !! end
1475
1476 !!test
1477 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1478 !!input
1479 {{echo|}}
1480 !!result
1481
1482 !!end
1483
1484 !!test
1485 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1486 !!input
1487 {{echo|
1488 foo}}
1489 !!result
1490 <p>foo
1491 </p>
1492 !!end
1493
1494 !! test
1495 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1496 !! input
1497 {{echo|a
1498 b}}
1499 !!result
1500 <pre>a
1501 </pre>
1502 <p>b
1503 </p>
1504 !!end
1505
1506 !! test
1507 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1508 !! input
1509 {{echo|a
1510 b
1511 c
1512 d
1513 e
1514 }}
1515 !!result
1516 <pre>a
1517 </pre>
1518 <p>b
1519 c
1520 </p>
1521 <pre>d
1522 </pre>
1523 <p>e
1524 </p>
1525 !!end
1526
1527 !!test
1528 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1529 !!input
1530 {{echo| foo}}
1531
1532 {{echo| foo}}{{echo| bar}}
1533
1534 {{echo| foo}}
1535 {{echo| bar}}
1536
1537 {{echo|<!--cmt--> foo}}
1538
1539 <!--cmt-->{{echo| foo}}
1540
1541 {{echo|{{echo| }}bar}}
1542 !!result
1543 <pre>foo
1544 </pre>
1545 <pre>foo bar
1546 </pre>
1547 <pre>foo
1548 bar
1549 </pre>
1550 <pre>foo
1551 </pre>
1552 <pre>foo
1553 </pre>
1554 <pre>bar
1555 </pre>
1556 !!end
1557
1558 !! test
1559 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1560 !! input
1561 {{echo| }}a
1562
1563 {{echo|
1564 }}a
1565
1566 {{echo|
1567 b}}
1568
1569 {{echo|a
1570 }}b
1571
1572 {{echo|a
1573 }} b
1574 !!result
1575 <pre>a
1576 </pre>
1577 <p><br />
1578 </p>
1579 <pre>a
1580 </pre>
1581 <p><br />
1582 </p>
1583 <pre>b
1584 </pre>
1585 <p>a
1586 </p>
1587 <pre>b
1588 </pre>
1589 <p>a
1590 </p>
1591 <pre>b
1592 </pre>
1593 !!end
1594
1595 !! test
1596 Templates: Single-line variant of parameter whitespace stripping test
1597 !! input
1598 {{echo| a}}
1599
1600 {{echo|1= a}}
1601
1602 {{echo|{{echo| a}}}}
1603
1604 {{echo|1={{echo| a}}}}
1605 !! result
1606 <pre>a
1607 </pre>
1608 <p>a
1609 </p>
1610 <pre>a
1611 </pre>
1612 <p>a
1613 </p>
1614 !! end
1615
1616 !! test
1617 Templates: Strip whitespace from named parameters, but not positional ones
1618 !! input
1619 {{echo|
1620 foo}}
1621
1622 {{echo|
1623 * foo}}
1624
1625 {{echo| 1 =
1626 foo}}
1627
1628 {{echo| 1 =
1629 * foo}}
1630 !! result
1631 <pre>foo
1632 </pre>
1633 <p><br />
1634 </p>
1635 <ul><li> foo
1636 </li></ul>
1637 <p>foo
1638 </p>
1639 <ul><li> foo
1640 </li></ul>
1641
1642 !! end
1643
1644 !! test
1645 Templates: Dont strip whitespace from whitespace/comment-only arguments
1646 !! input
1647 {{echo| }}
1648 {{echo|<!--cmt-->}}
1649 {{echo| <!--cmt--> }}
1650 !! result
1651 <p><br />
1652 </p>
1653 !! end
1654
1655 !! test
1656 Templates: Parsoid parameter escaping test 1
1657 !! options
1658 parsoid
1659 !! input
1660 {{echo|[foo]|{{echo|[bar]}}}}
1661 !! result
1662 <p about="#mwt1" typeof="mw:Transclusion"
1663 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>
1664 !! end
1665
1666 !! test
1667 Parsoid: Pipes in external links in template parameter
1668 !! options
1669 parsoid
1670 !! input
1671 {{echo|[{{echo|http://example.com}} link]}}
1672 !! result
1673 <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>
1674 !! end
1675
1676 !! test
1677 Parsoid: pipe in transclusion parameter
1678 !! options
1679 parsoid
1680 !! input
1681 {{echo|http://foo.com/a&#124;b}}
1682 !! result
1683 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1684 typeof="mw:Transclusion"
1685 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>
1686 !! end
1687
1688 !! test
1689 Parsoid: Pipe in external link target and content in template parameter
1690 !! options
1691 parsoid=html2wt,wt2wt
1692 !! input
1693 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1694 !! result
1695 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1696 typeof="mw:Transclusion"
1697 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1698 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1699 !! end
1700
1701 !! test
1702 Templates: Dont escape already nowiki-escaped text in template parameters
1703 !! options
1704 parsoid=html2wt,wt2wt
1705 !! input
1706 {{echo|foo<nowiki>|</nowiki>bar}}
1707 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1708 {{echo|<nowiki></nowiki>}}
1709 !! result
1710 <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>
1711 <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>
1712 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1713 </p>
1714 !! end
1715
1716 ###
1717 ### Parsoid-centric tests for testing RT edge cases for pre
1718 ###
1719
1720 !!test
1721 1a. Indent-Pre and Comments
1722 !!input
1723 a
1724 <!--a-->
1725 c
1726 !!result
1727 <pre>a
1728 </pre>
1729 <p>c
1730 </p>
1731 !!end
1732
1733 !!test
1734 1b. Indent-Pre and Comments
1735 !!input
1736 a
1737 <!--a-->
1738 c
1739 !!result
1740 <pre>a
1741 </pre>
1742 <p>c
1743 </p>
1744 !!end
1745
1746 !!test
1747 1c. Indent-Pre and Comments
1748 !!input
1749 <!--a--> a
1750
1751 <!--a--> a
1752 !!result
1753 <pre> a
1754 </pre>
1755 <pre> a
1756 </pre>
1757 !!end
1758
1759 !!test
1760 1d. Indent-Pre and Comments
1761 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1762 !!input
1763 <!--a--> a
1764
1765 <!--b-->b
1766 !!result
1767 <pre>a
1768 </pre>
1769 <pre>b
1770 </pre>
1771 !!end
1772
1773 !!test
1774 2a. Indent-Pre and tables
1775 !!input
1776 {|
1777 |-
1778 !h1!!h2
1779 |foo||bar
1780 |}
1781 !!result
1782 <table>
1783
1784 <tr>
1785 <th>h1</th>
1786 <th>h2
1787 </th>
1788 <td>foo</td>
1789 <td>bar
1790 </td></tr></table>
1791
1792 !!end
1793
1794 !!test
1795 2b. Indent-Pre and tables
1796 !!input
1797 {|
1798 |-
1799 |foo
1800 |}
1801 !!result
1802 <table>
1803
1804 <tr>
1805 <td>foo
1806 </td></tr></table>
1807
1808 !!end
1809
1810 !!test
1811 2c. Indent-Pre and tables (bug 42252)
1812 !!input
1813 {|
1814 |+ foo
1815 ! | bar
1816 |}
1817 !!result
1818 <table>
1819 <caption> foo
1820 </caption>
1821 <tr>
1822 <th> bar
1823 </th></tr></table>
1824
1825 !!end
1826
1827 !!test
1828 3a. Indent-Pre and block tags (single-line html)
1829 !!input
1830 <p> foo </p>
1831 <div> foo </div>
1832 <span> foo </span>
1833 !!result
1834 <p> foo </p>
1835 <div> foo </div>
1836 <pre><span> foo </span>
1837 </pre>
1838 !!end
1839
1840 !!test
1841 3b. Indent-Pre and block tags (pre-content on separate line)
1842 !!input
1843 <p>
1844 foo
1845 </p>
1846
1847 <div>
1848 foo
1849 </div>
1850
1851 <center>
1852 foo
1853 </center>
1854
1855 <blockquote>
1856 foo
1857 </blockquote>
1858
1859 <table><tr><td>
1860 foo
1861 </td></tr></table>
1862
1863 <ul><li>
1864 foo
1865 </li></ul>
1866
1867 !!result
1868 <p>
1869 foo
1870 </p>
1871 <div>
1872 <pre>foo
1873 </pre>
1874 </div>
1875 <center>
1876 <pre>foo
1877 </pre>
1878 </center>
1879 <blockquote>
1880 foo
1881 </blockquote>
1882 <table><tr><td>
1883 <pre>foo
1884 </pre>
1885 </td></tr></table>
1886 <ul><li>
1887 foo
1888 </li></ul>
1889
1890 !!end
1891
1892 !!test
1893 4. Multiple spaces at start-of-line
1894 !!input
1895 <p> foo </p>
1896 foo
1897 {|
1898 |foo
1899 |}
1900 !!result
1901 <p> foo </p>
1902 <pre> foo
1903 </pre>
1904 <table>
1905 <tr>
1906 <td>foo
1907 </td></tr></table>
1908
1909 !!end
1910
1911 !! test
1912 5. White-space in indent-pre
1913 NOTE: the white-space char on 2nd line is significant
1914 !! input
1915 a<br/>
1916
1917 b
1918 !! result
1919 <pre>a<br />
1920
1921 b
1922 </pre>
1923 !! end
1924
1925 !! test
1926 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
1927 !! input
1928 a
1929
1930 <!-- continue -->
1931 b
1932
1933 c
1934
1935 d
1936 !! result
1937 <pre>a
1938
1939 b
1940 </pre>
1941 <pre>c
1942
1943 </pre>
1944 <p>d
1945 </p>
1946 !! end
1947
1948 !! test
1949 7a. Indent-pre and category links
1950 !! options
1951 parsoid=wt2html,wt2wt
1952 !! input
1953 [[Category:foo]] <!-- No pre-wrapping -->
1954 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
1955 !! result
1956 <span typeof="mw:Transclusion"> </span>
1957 !! end
1958
1959 !! test
1960 7b. Indent-pre and category links
1961 !! options
1962 parsoid=wt2html,wt2wt
1963 !! input
1964 [[Category:foo]] a
1965 [[Category:foo]] {{echo|b}}
1966 !! result
1967 <pre> a <span typeof="mw:Transclusion">b</span>
1968 </pre>
1969 !! end
1970
1971 ###
1972 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1973 ###
1974
1975 !!test
1976 HTML-pre: 1. embedded newlines
1977 !!input
1978 <pre>foo</pre>
1979
1980 <pre>
1981 foo
1982 </pre>
1983
1984 <pre>
1985
1986 foo
1987 </pre>
1988
1989 <pre>
1990
1991
1992 foo
1993 </pre>
1994 !!result
1995 <pre>foo</pre>
1996 <pre>
1997 foo
1998 </pre>
1999 <pre>
2000
2001 foo
2002 </pre>
2003 <pre>
2004
2005
2006 foo
2007 </pre>
2008
2009 !!end
2010
2011 !!test
2012 HTML-pre: 2: indented text
2013 !!input
2014 <pre>
2015 foo
2016 </pre>
2017 !!result
2018 <pre>
2019 foo
2020 </pre>
2021
2022 !!end
2023
2024 !!test
2025 HTML-pre: 3: other wikitext
2026 !!input
2027 <pre>
2028 * foo
2029 # bar
2030 = no-h =
2031 '' no-italic ''
2032 [[ NoLink ]]
2033 </pre>
2034 !!result
2035 <pre>
2036 * foo
2037 # bar
2038 = no-h =
2039 '' no-italic ''
2040 [[ NoLink ]]
2041 </pre>
2042
2043 !!end
2044
2045 ###
2046 ### Definition lists
2047 ###
2048 !! test
2049 Simple definition
2050 !! input
2051 ; name : Definition
2052 !! result
2053 <dl><dt> name&#160;</dt><dd> Definition
2054 </dd></dl>
2055
2056 !! end
2057
2058 !! test
2059 Definition list for indentation only
2060 !! input
2061 : Indented text
2062 !! result
2063 <dl><dd> Indented text
2064 </dd></dl>
2065
2066 !! end
2067
2068 !! test
2069 Definition list with no space
2070 !! input
2071 ;name:Definition
2072 !! result
2073 <dl><dt>name</dt><dd>Definition
2074 </dd></dl>
2075
2076 !!end
2077
2078 !! test
2079 Definition list with URL link
2080 !! input
2081 ; http://example.com/ : definition
2082 !! result
2083 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2084 </dd></dl>
2085
2086 !! end
2087
2088 !! test
2089 Definition list with bracketed URL link
2090 !! input
2091 ;[http://www.example.com/ Example]:Something about it
2092 !! result
2093 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2094 </dd></dl>
2095
2096 !! end
2097
2098 !! test
2099 Definition list with wikilink containing colon
2100 !! input
2101 ; [[Help:FAQ]]: The least-read page on Wikipedia
2102 !! result
2103 <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
2104 </dd></dl>
2105
2106 !! end
2107
2108 # At Brion's and JeLuF's insistence... :)
2109 !! test
2110 Definition list with news link containing colon
2111 !! input
2112 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2113 !! result
2114 <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!
2115 </dd></dl>
2116
2117 !! end
2118
2119 !! test
2120 Malformed definition list with colon
2121 !! input
2122 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2123 !! result
2124 <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
2125 </dt></dl>
2126
2127 !! end
2128
2129 !! test
2130 Definition lists: colon in external link text
2131 !! input
2132 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2133 !! result
2134 <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
2135 </dd></dl>
2136
2137 !! end
2138
2139 !! test
2140 Definition lists: colon in HTML attribute
2141 !! input
2142 ;<b style="display: inline">bold</b>
2143 !! result
2144 <dl><dt><b style="display: inline">bold</b>
2145 </dt></dl>
2146
2147 !! end
2148
2149 !! test
2150 Definition lists: self-closed tag
2151 !! input
2152 ;one<br/>two : two-line fun
2153 !! result
2154 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2155 </dd></dl>
2156
2157 !! end
2158
2159 !! test
2160 Bug 11748: Literal closing tags
2161 !! input
2162 <dl>
2163 <dt>test 1</dt>
2164 <dd>test test test test test</dd>
2165 <dt>test 2</dt>
2166 <dd>test test test test test</dd>
2167 </dl>
2168 !! result
2169 <dl>
2170 <dt>test 1</dt>
2171 <dd>test test test test test</dd>
2172 <dt>test 2</dt>
2173 <dd>test test test test test</dd>
2174 </dl>
2175
2176 !! end
2177
2178 !! test
2179 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2180 !! input
2181 <ul><li>
2182 ; term : description
2183 * unordered
2184 </li>
2185 </ul>
2186 !! result
2187 <ul><li>
2188 <dl><dt> term&#160;</dt><dd> description
2189 </dd></dl>
2190 <ul><li> unordered
2191 </li></ul>
2192 </li>
2193 </ul>
2194
2195 !! end
2196
2197 !! test
2198
2199 Definition list with empty definition and following paragraph
2200 !! input
2201 ; term:
2202 Paragraph text
2203 !! result
2204 <dl><dt> term</dt><dd>
2205 </dd></dl>
2206 <p>Paragraph text
2207 </p>
2208 !! end
2209
2210 !! test
2211 Nested definition lists using html syntax
2212 !! input
2213 <dl><dd>
2214 <dl>
2215 <dd>Foo</dd>
2216 </dl>
2217 </dd></dl>
2218 !! result
2219 <dl><dd>
2220 <dl>
2221 <dd>Foo</dd>
2222 </dl>
2223 </dd></dl>
2224
2225 !! end
2226
2227 !! test
2228 Definition Lists: No nesting: Multiple dd's
2229 !! input
2230 ;x
2231 :a
2232 :b
2233 !! result
2234 <dl><dt>x
2235 </dt><dd>a
2236 </dd><dd>b
2237 </dd></dl>
2238
2239 !! end
2240
2241 !! test
2242 Definition Lists: Indentation: Regular
2243 !! input
2244 :i1
2245 ::i2
2246 :::i3
2247 !! result
2248 <dl><dd>i1
2249 <dl><dd>i2
2250 <dl><dd>i3
2251 </dd></dl>
2252 </dd></dl>
2253 </dd></dl>
2254
2255 !! end
2256
2257 !! test
2258 Definition Lists: Indentation: Missing 1st level
2259 !! input
2260 ::i2
2261 :::i3
2262 !! result
2263 <dl><dd><dl><dd>i2
2264 <dl><dd>i3
2265 </dd></dl>
2266 </dd></dl>
2267 </dd></dl>
2268
2269 !! end
2270
2271 !! test
2272 Definition Lists: Indentation: Multi-level indent
2273 !! input
2274 :::i3
2275 !! result
2276 <dl><dd><dl><dd><dl><dd>i3
2277 </dd></dl>
2278 </dd></dl>
2279 </dd></dl>
2280
2281 !! end
2282
2283 !! test
2284 Definition Lists: Hacky use to indent tables
2285 !! input
2286 ::{|
2287 |foo
2288 |bar
2289 |}
2290 this text
2291 should be left alone
2292 !! result
2293 <dl><dd><dl><dd><table>
2294 <tr>
2295 <td>foo
2296 </td>
2297 <td>bar
2298 </td></tr></table></dd></dl></dd></dl>
2299 <p>this text
2300 should be left alone
2301 </p>
2302 !! end
2303 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2304 ## as an empty dt item. It also ignores all but the last ";" when followed
2305 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2306 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2307 ## ";"s.
2308 ##
2309 ## Ex: ";;t2 ::d2" is transformed into:
2310 ##
2311 ## <dl>
2312 ## <dt>t2 </dt>
2313 ## <dd>
2314 ## <dl>
2315 ## <dt></dt>
2316 ## <dd>d2</dd>
2317 ## </dl>
2318 ## </dd>
2319 ## </dl>
2320 ##
2321 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2322 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2323 ##
2324 ## <dl>
2325 ## <dt>
2326 ## <dl>
2327 ## <dt>t2 </dt>
2328 ## <dd>:d2</dd>
2329 ## </dl>
2330 ## </dt>
2331 ## </dl>
2332 ##
2333 ## All Parsoid only definition list tests have this difference.
2334 ##
2335 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2336 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2337
2338 !! test
2339 Table / list interaction: indented table with lists in table contents
2340 !! input
2341 :{|
2342 |-
2343 | a
2344 * b
2345 |-
2346 | c
2347 * d
2348 |}
2349 !! result
2350 <dl><dd><table>
2351
2352 <tr>
2353 <td> a
2354 <ul><li> b
2355 </li></ul>
2356 </td></tr>
2357 <tr>
2358 <td> c
2359 <ul><li> d
2360 </li></ul>
2361 </td></tr></table></dd></dl>
2362
2363 !! end
2364
2365 !!test
2366 Table / list interaction: lists nested in tables nested in indented lists
2367 !!input
2368 :{|
2369 |
2370 :a
2371 :b
2372 |
2373 *c
2374 *d
2375 |}
2376
2377 *e
2378 *f
2379 !!result
2380 <dl><dd><table>
2381 <tr>
2382 <td>
2383 <dl><dd>a
2384 </dd><dd>b
2385 </dd></dl>
2386 </td>
2387 <td>
2388 <ul><li>c
2389 </li><li>d
2390 </li></ul>
2391 </td></tr></table></dd></dl>
2392 <ul><li>e
2393 </li><li>f
2394 </li></ul>
2395
2396 !!end
2397
2398 !! test
2399 Definition Lists: Nesting: Multi-level (Parsoid only)
2400 !! options
2401 parsoid
2402 !! input
2403 ;t1 :d1
2404 ;;t2 ::d2
2405 ;;;t3 :::d3
2406 !! result
2407 <dl>
2408 <dt>t1 </dt>
2409 <dd>d1</dd>
2410 <dt>
2411 <dl>
2412 <dt>t2 </dt>
2413 <dd>:d2</dd>
2414 <dt>
2415 <dl>
2416 <dt>t3 </dt>
2417 <dd>::d3</dd>
2418 </dl>
2419 </dt>
2420 </dl>
2421 </dt>
2422 </dl>
2423
2424
2425 !! end
2426
2427
2428 !! test
2429 Definition Lists: Nesting: Test 2 (Parsoid only)
2430 !! options
2431 parsoid
2432 !! input
2433 ;t1
2434 ::d2
2435 !! result
2436 <dl>
2437 <dt>t1</dt>
2438 <dd>
2439 <dl>
2440 <dd>d2</dd>
2441 </dl>
2442 </dd>
2443 </dl>
2444
2445 !! end
2446
2447
2448 !! test
2449 Definition Lists: Nesting: Test 3 (Parsoid only)
2450 !! options
2451 parsoid
2452 !! input
2453 :;t1
2454 ::::d2
2455 !! result
2456 <dl>
2457 <dd>
2458 <dl>
2459 <dt>t1</dt>
2460 <dd>
2461 <dl>
2462 <dd>
2463 <dl>
2464 <dd>d2</dd>
2465 </dl>
2466 </dd>
2467 </dl>
2468 </dd>
2469 </dl>
2470 </dd>
2471 </dl>
2472
2473 !! end
2474
2475
2476 !! test
2477 Definition Lists: Nesting: Test 4
2478 !! input
2479 ::;t3
2480 :::d3
2481 !! result
2482 <dl><dd><dl><dd><dl><dt>t3
2483 </dt><dd>d3
2484 </dd></dl>
2485 </dd></dl>
2486 </dd></dl>
2487
2488 !! end
2489
2490
2491 ## The Parsoid team believes the following three test exposes a
2492 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2493 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2494 !! test
2495 Definition Lists: Mixed Lists: Test 1 (php)
2496 !! options
2497 php
2498 !! input
2499 :;* foo
2500 ::* bar
2501 :; baz
2502 !! result
2503 <dl><dd><dl><dt><ul><li> foo
2504 </li><li> bar
2505 </li></ul>
2506 </dt></dl>
2507 <dl><dt> baz
2508 </dt></dl>
2509 </dd></dl>
2510
2511 !! end
2512 !! test
2513 Definition Lists: Mixed Lists: Test 1 (parsoid)
2514 !! options
2515 parsoid
2516 !! input
2517 :;* foo
2518 ::* bar
2519 :; baz
2520 !! result
2521 <dl><dd><dl><dt><ul><li> foo
2522 </li></ul></dt><dd><ul><li> bar
2523 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2524 !! end
2525
2526 !! test
2527 Definition Lists: Mixed Lists: Test 2
2528 !! input
2529 *: d1
2530 *: d2
2531 !! result
2532 <ul><li><dl><dd> d1
2533 </dd><dd> d2
2534 </dd></dl>
2535 </li></ul>
2536
2537 !! end
2538
2539
2540 !! test
2541 Definition Lists: Mixed Lists: Test 3
2542 !! input
2543 *::: d1
2544 *::: d2
2545 !! result
2546 <ul><li><dl><dd><dl><dd><dl><dd> d1
2547 </dd><dd> d2
2548 </dd></dl>
2549 </dd></dl>
2550 </dd></dl>
2551 </li></ul>
2552
2553 !! end
2554
2555
2556 !! test
2557 Definition Lists: Mixed Lists: Test 4
2558 !! input
2559 *;d1 :d2
2560 *;d3 :d4
2561 !! result
2562 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2563 </dd><dt>d3&#160;</dt><dd>d4
2564 </dd></dl>
2565 </li></ul>
2566
2567 !! end
2568
2569
2570 !! test
2571 Definition Lists: Mixed Lists: Test 5
2572 !! input
2573 *:d1
2574 *:: d2
2575 !! result
2576 <ul><li><dl><dd>d1
2577 <dl><dd> d2
2578 </dd></dl>
2579 </dd></dl>
2580 </li></ul>
2581
2582 !! end
2583
2584
2585 !! test
2586 Definition Lists: Mixed Lists: Test 6
2587 !! input
2588 #*:d1
2589 #*::: d3
2590 !! result
2591 <ol><li><ul><li><dl><dd>d1
2592 <dl><dd><dl><dd> d3
2593 </dd></dl>
2594 </dd></dl>
2595 </dd></dl>
2596 </li></ul>
2597 </li></ol>
2598
2599 !! end
2600
2601
2602 !! test
2603 Definition Lists: Mixed Lists: Test 7
2604 !! input
2605 :* d1
2606 :* d2
2607 !! result
2608 <dl><dd><ul><li> d1
2609 </li><li> d2
2610 </li></ul>
2611 </dd></dl>
2612
2613 !! end
2614
2615
2616 !! test
2617 Definition Lists: Mixed Lists: Test 8
2618 !! input
2619 :* d1
2620 ::* d2
2621 !! result
2622 <dl><dd><ul><li> d1
2623 </li></ul>
2624 <dl><dd><ul><li> d2
2625 </li></ul>
2626 </dd></dl>
2627 </dd></dl>
2628
2629 !! end
2630
2631
2632 !! test
2633 Definition Lists: Mixed Lists: Test 9
2634 !! input
2635 *;foo :bar
2636 !! result
2637 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2638 </dd></dl>
2639 </li></ul>
2640
2641 !! end
2642
2643
2644 !! test
2645 Definition Lists: Mixed Lists: Test 10
2646 !! input
2647 *#;foo :bar
2648 !! result
2649 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2650 </dd></dl>
2651 </li></ol>
2652 </li></ul>
2653
2654 !! end
2655
2656 # The Parsoid team disagrees with the PHP parser's seemingly-random
2657 # rules regarding dd/dt on the next two tests. Parsoid is more
2658 # consistent, and recognizes the shared nesting and keeps the
2659 # still-open tags around until the nesting is complete.
2660
2661 !! test
2662 Definition Lists: Mixed Lists: Test 11 (php)
2663 !! options
2664 php
2665 !! input
2666 *#*#;*;;foo :bar
2667 *#*#;boo :baz
2668 !! result
2669 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2670 </dt></dl>
2671 </dd></dl>
2672 </li></ul>
2673 </dd></dl>
2674 <dl><dt>boo&#160;</dt><dd>baz
2675 </dd></dl>
2676 </li></ol>
2677 </li></ul>
2678 </li></ol>
2679 </li></ul>
2680
2681 !! end
2682 !! test
2683 Definition Lists: Mixed Lists: Test 11 (parsoid)
2684 !! options
2685 parsoid
2686 !! input
2687 *#*#;*;;foo :bar
2688 *#*#;boo :baz
2689 !! result
2690 <ul>
2691 <li>
2692 <ol>
2693 <li>
2694 <ul>
2695 <li>
2696 <ol>
2697 <li>
2698 <dl>
2699 <dt>
2700 <ul>
2701 <li>
2702 <dl>
2703 <dt>
2704 <dl>
2705 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2706 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2707 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2708 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2709 !! end
2710
2711
2712 !! test
2713 Definition Lists: Weird Ones: Test 1 (php)
2714 !! options
2715 php
2716 !! input
2717 *#;*::;; foo : bar (who uses this?)
2718 !! result
2719 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2720 </dt></dl>
2721 </dd></dl>
2722 </dd></dl>
2723 </dd></dl>
2724 </li></ul>
2725 </dd></dl>
2726 </li></ol>
2727 </li></ul>
2728
2729 !! end
2730 !! test
2731 Definition Lists: Weird Ones: Test 1 (parsoid)
2732 !! options
2733 parsoid
2734 !! input
2735 *#;*::;; foo : bar (who uses this?)
2736 !! result
2737 <ul>
2738 <li>
2739 <ol>
2740 <li>
2741 <dl>
2742 <dt>
2743 <ul>
2744 <li>
2745 <dl>
2746 <dd>
2747 <dl>
2748 <dd>
2749 <dl>
2750 <dt>
2751 <dl>
2752 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2753 <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>
2754 !! end
2755
2756 ###
2757 ### External links
2758 ###
2759 !! test
2760 External links: non-bracketed
2761 !! input
2762 Non-bracketed: http://example.com
2763 !! result
2764 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: numbered
2770 !! input
2771 Numbered: [http://example.com]
2772 Numbered: [http://example.net]
2773 Numbered: [http://example.com]
2774 !! result
2775 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2776 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2777 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2778 </p>
2779 !!end
2780
2781 !! test
2782 External links: specified text
2783 !! input
2784 Specified text: [http://example.com link]
2785 !! result
2786 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2787 </p>
2788 !!end
2789
2790 !! test
2791 External links: trail
2792 !! input
2793 Linktrails should not work for external links: [http://example.com link]s
2794 !! result
2795 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2796 </p>
2797 !! end
2798
2799 !! test
2800 External links: dollar sign in URL
2801 !! input
2802 http://example.com/1$2345
2803 !! result
2804 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2805 </p>
2806 !! end
2807
2808 !! test
2809 External links: dollar sign in URL (named)
2810 !! input
2811 [http://example.com/1$2345]
2812 !! result
2813 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2814 </p>
2815 !!end
2816
2817 !! test
2818 External links: open square bracket forbidden in URL (bug 4377)
2819 !! input
2820 http://example.com/1[2345
2821 !! result
2822 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2823 </p>
2824 !! end
2825
2826 !! test
2827 External links: open square bracket forbidden in URL (named) (bug 4377)
2828 !! input
2829 [http://example.com/1[2345]
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2832 </p>
2833 !!end
2834
2835 !! test
2836 External links: nowiki in URL link text (bug 6230)
2837 !!input
2838 [http://example.com/ <nowiki>''example site''</nowiki>]
2839 !! result
2840 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: newline forbidden in text (bug 6230 regression check)
2846 !! input
2847 [http://example.com/ first
2848 second]
2849 !! result
2850 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2851 second]
2852 </p>
2853 !!end
2854
2855 !! test
2856 External links: Pipe char between url and text
2857 !! input
2858 [http://example.com | link]
2859 !! result
2860 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2861 </p>
2862 !!end
2863
2864 !! test
2865 External links: protocol-relative URL in brackets
2866 !! input
2867 [//example.com/ Test]
2868 !! result
2869 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2870 </p>
2871 !! end
2872
2873 !! test
2874 External links: protocol-relative URL in brackets without text
2875 !! input
2876 [//example.com]
2877 !! result
2878 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2879 </p>
2880 !! end
2881
2882 !! test
2883 External links: protocol-relative URL in free text is left alone
2884 !! input
2885 //example.com/Foo
2886 !! result
2887 <p>//example.com/Foo
2888 </p>
2889 !!end
2890
2891 !! test
2892 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2893 !! input
2894 foo//example.com/Foo
2895 !! result
2896 <p>foo//example.com/Foo
2897 </p>
2898 !! end
2899
2900 !! test
2901 External image
2902 !! input
2903 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2904 !! result
2905 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2906 </p>
2907 !! end
2908
2909 !! test
2910 External image from https
2911 !! input
2912 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2913 !! result
2914 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2915 </p>
2916 !! end
2917
2918 !! test
2919 External image (when not allowed)
2920 !! options
2921 wgAllowExternalImages=0
2922 !! input
2923 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2924 !! result
2925 <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>
2926 </p>
2927 !! end
2928
2929 !! test
2930 Link to non-http image, no img tag
2931 !! input
2932 Link to non-http image, no img tag: ftp://example.com/test.jpg
2933 !! result
2934 <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>
2935 </p>
2936 !! end
2937
2938 !! test
2939 External links: terminating separator
2940 !! input
2941 Terminating separator: http://example.com/thing,
2942 !! result
2943 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2944 </p>
2945 !! end
2946
2947 !! test
2948 External links: intervening separator
2949 !! input
2950 Intervening separator: http://example.com/1,2,3
2951 !! result
2952 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2953 </p>
2954 !! end
2955
2956 !! test
2957 External links: old bug with URL in query
2958 !! input
2959 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2960 !! result
2961 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2962 </p>
2963 !! end
2964
2965 !! test
2966 External links: old URL-in-URL bug, mixed protocols
2967 !! input
2968 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2969 !! result
2970 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2971 </p>
2972 !!end
2973
2974 !! test
2975 External links: URL in text
2976 !! input
2977 URL in text: [http://example.com http://example.com]
2978 !! result
2979 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2980 </p>
2981 !! end
2982
2983 !! test
2984 External links: Clickable images
2985 !! input
2986 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2987 !! result
2988 <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>
2989 </p>
2990 !!end
2991
2992 !! test
2993 External links: raw ampersand
2994 !! input
2995 Old &amp; use: http://x&y
2996 !! result
2997 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2998 </p>
2999 !! end
3000
3001 !! test
3002 External links: encoded ampersand
3003 !! input
3004 Old &amp; use: http://x&amp;y
3005 !! result
3006 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3007 </p>
3008 !! end
3009
3010 !! test
3011 External links: encoded equals (bug 6102)
3012 !! input
3013 http://example.com/?foo&#61;bar
3014 !! result
3015 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3016 </p>
3017 !! end
3018
3019 !! test
3020 External links: [raw ampersand]
3021 !! input
3022 Old &amp; use: [http://x&y]
3023 !! result
3024 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3025 </p>
3026 !! end
3027
3028 !! test
3029 External links: [encoded ampersand]
3030 !! input
3031 Old &amp; use: [http://x&amp;y]
3032 !! result
3033 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 External links: [encoded equals] (bug 6102)
3039 !! input
3040 [http://example.com/?foo&#61;bar]
3041 !! result
3042 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3043 </p>
3044 !! end
3045
3046 !! test
3047 External links: [IDN ignored character reference in hostname; strip it right off]
3048 !! input
3049 [http://e&zwnj;xample.com/]
3050 !! result
3051 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3052 </p>
3053 !! end
3054
3055 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3056 # Where an external link could easily circumvent the sanitization of the text of
3057 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3058 # test demands a higher standard. That's a bit strange.
3059 #
3060 # Example:
3061 #
3062 # http://e‌xample.com -> [http://example.com|http://example.com]
3063 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3064 #
3065 # The first example is sanitized, but the second is not. Any security benefits
3066 # from this production are trivial to circumvent. Either remove this test and
3067 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3068 # the test accordingly.
3069 #
3070 # All our love,
3071 # The Parsoid team.
3072 !! test
3073 External links: IDN ignored character reference in hostname; strip it right off
3074 !! input
3075 http://e&zwnj;xample.com/
3076 !! result
3077 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3078 </p>
3079 !! end
3080
3081 !! test
3082 External links: www.jpeg.org (bug 554)
3083 !! input
3084 http://www.jpeg.org
3085 !!result
3086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3087 </p>
3088 !! end
3089
3090 !! test
3091 External links: URL within URL (original bug 2)
3092 !! input
3093 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3094 !! result
3095 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3096 </p>
3097 !! end
3098
3099 !! test
3100 BUG 361: URL inside bracketed URL
3101 !! input
3102 [http://www.example.com/foo http://www.example.com/bar]
3103 !! result
3104 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3105 </p>
3106 !! end
3107
3108 !! test
3109 BUG 361: URL within URL, not bracketed
3110 !! input
3111 http://www.example.com/foo?=http://www.example.com/bar
3112 !! result
3113 <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>
3114 </p>
3115 !! end
3116
3117 !! test
3118 BUG 289: ">"-token in URL-tail
3119 !! input
3120 http://www.example.com/<hello>
3121 !! result
3122 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3123 </p>
3124 !!end
3125
3126 !! test
3127 BUG 289: literal ">"-token in URL-tail
3128 !! input
3129 http://www.example.com/<b>html</b>
3130 !! result
3131 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3132 </p>
3133 !!end
3134
3135 !! test
3136 BUG 289: ">"-token in bracketed URL
3137 !! input
3138 [http://www.example.com/<hello> stuff]
3139 !! result
3140 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3141 </p>
3142 !!end
3143
3144 !! test
3145 BUG 289: literal ">"-token in bracketed URL
3146 !! input
3147 [http://www.example.com/<b>html</b> stuff]
3148 !! result
3149 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3150 </p>
3151 !!end
3152
3153 !! test
3154 BUG 289: literal double quote at end of URL
3155 !! input
3156 http://www.example.com/"hello"
3157 !! result
3158 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3159 </p>
3160 !!end
3161
3162 !! test
3163 BUG 289: literal double quote in bracketed URL
3164 !! input
3165 [http://www.example.com/"hello" stuff]
3166 !! result
3167 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3168 </p>
3169 !!end
3170
3171 !! test
3172 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3173 !! input
3174 [http://www.example.com test]
3175 !! result
3176 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3177 </p>
3178 !! end
3179
3180 !! test
3181 External links: link text with spaces
3182 !! input
3183 [http://www.example.com a b c]
3184 [http://www.example.com ''a'' ''b'']
3185 !! result
3186 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3187 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3188 </p>
3189 !! end
3190
3191 !! test
3192 External links: wiki links within external link (Bug 3695)
3193 !! input
3194 [http://example.com [[wikilink]] embedded in ext link]
3195 !! result
3196 <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>
3197 </p>
3198 !! end
3199
3200 !! test
3201 BUG 787: Links with one slash after the url protocol are invalid
3202 !! input
3203 http:/example.com
3204
3205 [http:/example.com title]
3206 !! result
3207 <p>http:/example.com
3208 </p><p>[http:/example.com title]
3209 </p>
3210 !! end
3211
3212 !! test
3213 Bracketed external links with template-generated invalid target
3214 !! input
3215 [{{echo|http:/example.com}} title]
3216 !! result
3217 <p>[http:/example.com title]
3218 </p>
3219 !! end
3220
3221 !! test
3222 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3223 !! input
3224 ''[http://example.com text'']
3225 [http://example.com '''text]'''
3226 ''Something [http://example.com in italic'']
3227 ''Something [http://example.com mixed''''', even bold]'''
3228 '''''Now [http://example.com both''''']
3229 !! result
3230 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3231 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3232 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3233 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3234 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3235 </p>
3236 !! end
3237
3238
3239 !! test
3240 Bug 4781: %26 in URL
3241 !! input
3242 http://www.example.com/?title=AT%26T
3243 !! result
3244 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3245 </p>
3246 !! end
3247
3248 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3249 # % is actually legal in HTML5. Any change in output would need testing though.
3250 !! test
3251 Bug 4781, 5267: %25 in URL
3252 !! input
3253 http://www.example.com/?title=100%25_Bran
3254 !! result
3255 <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>
3256 </p>
3257 !! end
3258
3259 !! test
3260 Bug 4781, 5267: %28, %29 in URL
3261 !! input
3262 http://www.example.com/?title=Ben-Hur_%281959_film%29
3263 !! result
3264 <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>
3265 </p>
3266 !! end
3267
3268
3269 !! test
3270 Bug 4781: %26 in autonumber URL
3271 !! input
3272 [http://www.example.com/?title=AT%26T]
3273 !! result
3274 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3275 </p>
3276 !! end
3277
3278 !! test
3279 Bug 4781, 5267: %26 in autonumber URL
3280 !! input
3281 [http://www.example.com/?title=100%25_Bran]
3282 !! result
3283 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3284 </p>
3285 !! end
3286
3287 !! test
3288 Bug 4781, 5267: %28, %29 in autonumber URL
3289 !! input
3290 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3291 !! result
3292 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3293 </p>
3294 !! end
3295
3296
3297 !! test
3298 Bug 4781: %26 in bracketed URL
3299 !! input
3300 [http://www.example.com/?title=AT%26T link]
3301 !! result
3302 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3303 </p>
3304 !! end
3305
3306 !! test
3307 Bug 4781, 5267: %26 in bracketed URL
3308 !! input
3309 [http://www.example.com/?title=100%25_Bran link]
3310 !! result
3311 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3312 </p>
3313 !! end
3314
3315 !! test
3316 Bug 4781, 5267: %28, %29 in bracketed URL
3317 !! input
3318 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3319 !! result
3320 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3321 </p>
3322 !! end
3323
3324 !! test
3325 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3326 !! input
3327 Some [http://example.com/ pretty ''italics'' and stuff]!
3328 !! result
3329 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3330 </p>
3331 !! end
3332
3333 !! test
3334 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3335 !! input
3336 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3337 !! result
3338 <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>
3339 </p>
3340 !! end
3341
3342 !! test
3343 External link containing double-single-quotes with no space separating the url from text in italics
3344 !! input
3345 [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]].]
3346 !! result
3347 <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>
3348 </p>
3349 !! end
3350
3351 !! test
3352 External link with comments in link text
3353 !! input
3354 [http://www.google.com Google <!-- comment -->]
3355 !! result
3356 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3357 </p>
3358 !! end
3359
3360 !! test
3361 URL-encoding in URL functions (single parameter)
3362 !! input
3363 {{localurl:Some page|amp=&}}
3364 !! result
3365 <p>/index.php?title=Some_page&amp;amp=&amp;
3366 </p>
3367 !! end
3368
3369 !! test
3370 URL-encoding in URL functions (multiple parameters)
3371 !! input
3372 {{localurl:Some page|q=?&amp=&}}
3373 !! result
3374 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3375 </p>
3376 !! end
3377
3378 !! test
3379 Brackets in urls
3380 !! input
3381 http://example.com/index.php?foozoid%5B%5D=bar
3382
3383 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3384 !! result
3385 <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>
3386 </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>
3387 </p>
3388 !! end
3389
3390 !! test
3391 IPv6 urls (bug 21261)
3392 !! options
3393 disabled
3394 !! input
3395 http://[2404:130:0:1000::187:2]/index.php
3396 !! result
3397 <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>
3398 </p>
3399 !! end
3400
3401 !! test
3402 Non-extlinks in brackets
3403 !! input
3404 [foo]
3405 [foo bar]
3406 [foo ''bar'']
3407 [fool's] errand
3408 [fool's errand]
3409 [{{echo|foo}}]
3410 [{{echo|foo}} bar]
3411 [{{echo|foo}} ''bar'']
3412 [{{echo|foo}}l's] errand
3413 [{{echo|foo}}l's errand]
3414 [url={{echo|foo}}]
3415 [url=http://example.com]
3416 !! result
3417 <p>[foo]
3418 [foo bar]
3419 [foo <i>bar</i>]
3420 [fool's] errand
3421 [fool's errand]
3422 [foo]
3423 [foo bar]
3424 [foo <i>bar</i>]
3425 [fool's] errand
3426 [fool's errand]
3427 [url=foo]
3428 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3429 </p>
3430 !! end
3431
3432 !! test
3433 Parsoid: Percent encoding in external links
3434 !! options
3435 parsoid
3436 !! input
3437 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3438 !! result
3439 <p><a rel="mw:ExtLink"
3440 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3441 !! end
3442
3443 !! test
3444 Parsoid: use url link syntax for links where the content is equal the link
3445 target
3446 !! options
3447 parsoid
3448 !! input
3449 http://example.com
3450 !! result
3451 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3452 !! end
3453
3454 ###
3455 ### Quotes
3456 ###
3457
3458 !! test
3459 Quotes
3460 !! input
3461 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3462
3463 Normal text. '''''Bold italic text.''''' Normal text.
3464 !!result
3465 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3466 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3467 </p>
3468 !! end
3469
3470
3471 !! test
3472 Unclosed and unmatched quotes (php)
3473 !! options
3474 php
3475 !! input
3476 '''''Bold italic text '''with bold deactivated''' in between.'''''
3477
3478 '''''Bold italic text ''with italic deactivated'' in between.'''''
3479
3480 '''Bold text..
3481
3482 ..spanning two paragraphs (should not work).'''
3483
3484 '''Bold tag left open
3485
3486 ''Italic tag left open
3487
3488 Normal text.
3489
3490 <!-- Unmatching number of opening, closing tags: -->
3491 '''This year''''s election ''should'' beat '''last year''''s.
3492
3493 ''Tom'''s car is bigger than ''Susan'''s.
3494
3495 Plain ''italic'''s plain
3496 !! result
3497 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3498 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3499 </p><p><b>Bold text..</b>
3500 </p><p>..spanning two paragraphs (should not work).
3501 </p><p><b>Bold tag left open</b>
3502 </p><p><i>Italic tag left open</i>
3503 </p><p>Normal text.
3504 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3505 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3506 </p><p>Plain <i>italic'</i>s plain
3507 </p>
3508 !! end
3509 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3510 # parser strips. The wikitext contains just the first half of the bold
3511 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3512 # differently than the PHP parser.)
3513 !! test
3514 Unclosed and unmatched quotes (parsoid)
3515 !! options
3516 parsoid
3517 !! input
3518 '''''Bold italic text '''with bold deactivated''' in between.'''''
3519
3520 '''''Bold italic text ''with italic deactivated'' in between.'''''
3521
3522 '''Bold text..
3523
3524 ..spanning two paragraphs (should not work).'''
3525
3526 '''Bold tag left open
3527
3528 ''Italic tag left open
3529
3530 Normal text.
3531
3532 <!-- Unmatching number of opening, closing tags: -->
3533 '''This year''''s election ''should'' beat '''last year''''s.
3534
3535 ''Tom'''s car is bigger than ''Susan'''s.
3536
3537 Plain ''italic'''s plain
3538 !! result
3539 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3540 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3541 </p><p><b>Bold text..</b>
3542 </p><p>..spanning two paragraphs (should not work).<b></b>
3543 </p><p><b>Bold tag left open</b>
3544 </p><p><i>Italic tag left open</i>
3545 </p><p>Normal text.
3546 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3547 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3548 </p><p>Plain <i>italic'</i>s plain
3549 </p>
3550 !! end
3551
3552 ###
3553 ### Tables
3554 ###
3555 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3556 ###
3557
3558 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3559 # is the bare minimum required by the spec, see:
3560 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3561 !! test
3562 A table with no data. (php)
3563 !! options
3564 php
3565 !! input
3566 {||}
3567 !! result
3568 !! end
3569 # Parsoid team replies: empty table tags are legal in HTML5
3570 !! test
3571 A table with no data. (parsoid)
3572 !! options
3573 parsoid
3574 !! input
3575 {||}
3576 !! result
3577 <table></table>
3578 !! end
3579
3580 # A table with nothing but a caption is invalid XHTML, we might want to render
3581 # this as <p>caption</p>
3582 !! test
3583 A table with nothing but a caption (php)
3584 !! options
3585 php
3586 !! input
3587 {|
3588 |+ caption
3589 |}
3590 !! result
3591 <table>
3592 <caption> caption
3593 </caption><tr><td></td></tr></table>
3594
3595 !! end
3596 # Parsoid team replies: table with only a caption is legal in HTML5
3597 !! test
3598 A table with nothing but a caption (parsoid)
3599 !! options
3600 parsoid
3601 !! input
3602 {|
3603 |+ caption
3604 |}
3605 !! result
3606 <table><caption> caption</caption></table>
3607 !! end
3608
3609 !! test
3610 A table with caption with default-spaced attributes and a table row
3611 !! input
3612 {|
3613 |+ style="color: red;" | caption1
3614 |-
3615 | foo
3616 |}
3617 !! result
3618 <table>
3619 <caption style="color: red;"> caption1
3620 </caption>
3621 <tr>
3622 <td> foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 A table with captions with non-default spaced attributes and a table row
3629 !! input
3630 {|
3631 |+style="color: red;"|caption2
3632 |+ style="color: red;"| caption3
3633 |-
3634 | foo
3635 |}
3636 !! result
3637 <table>
3638 <caption style="color: red;">caption2
3639 </caption>
3640 <caption style="color: red;"> caption3
3641 </caption>
3642 <tr>
3643 <td> foo
3644 </td></tr></table>
3645
3646 !! end
3647
3648 !! test
3649 Table td-cell syntax variations
3650 !! input
3651 {|
3652 | foo bar foo | baz
3653 | foo bar foo || baz
3654 | style='color:red;' | baz
3655 | style='color:red;' || baz
3656 |}
3657 !! result
3658 <table>
3659 <tr>
3660 <td> baz
3661 </td>
3662 <td> foo bar foo </td>
3663 <td> baz
3664 </td>
3665 <td style="color:red;"> baz
3666 </td>
3667 <td> style='color:red;' </td>
3668 <td> baz
3669 </td></tr></table>
3670
3671 !! end
3672
3673 !! test
3674 Simple table
3675 !! input
3676 {|
3677 | 1 || 2
3678 |-
3679 | 3 || 4
3680 |}
3681 !! result
3682 <table>
3683 <tr>
3684 <td> 1 </td>
3685 <td> 2
3686 </td></tr>
3687 <tr>
3688 <td> 3 </td>
3689 <td> 4
3690 </td></tr></table>
3691
3692 !! end
3693
3694 !! test
3695 Simple table but with multiple dashes for row wikitext
3696 !! input
3697 {|
3698 | foo
3699 |-----
3700 | bar
3701 |}
3702 !! result
3703 <table>
3704 <tr>
3705 <td> foo
3706 </td></tr>
3707 <tr>
3708 <td> bar
3709 </td></tr></table>
3710
3711 !! end
3712 !! test
3713 Multiplication table
3714 !! input
3715 {| border="1" cellpadding="2"
3716 |+Multiplication table
3717 |-
3718 ! &times; !! 1 !! 2 !! 3
3719 |-
3720 ! 1
3721 | 1 || 2 || 3
3722 |-
3723 ! 2
3724 | 2 || 4 || 6
3725 |-
3726 ! 3
3727 | 3 || 6 || 9
3728 |-
3729 ! 4
3730 | 4 || 8 || 12
3731 |-
3732 ! 5
3733 | 5 || 10 || 15
3734 |}
3735 !! result
3736 <table border="1" cellpadding="2">
3737 <caption>Multiplication table
3738 </caption>
3739 <tr>
3740 <th> &#215; </th>
3741 <th> 1 </th>
3742 <th> 2 </th>
3743 <th> 3
3744 </th></tr>
3745 <tr>
3746 <th> 1
3747 </th>
3748 <td> 1 </td>
3749 <td> 2 </td>
3750 <td> 3
3751 </td></tr>
3752 <tr>
3753 <th> 2
3754 </th>
3755 <td> 2 </td>
3756 <td> 4 </td>
3757 <td> 6
3758 </td></tr>
3759 <tr>
3760 <th> 3
3761 </th>
3762 <td> 3 </td>
3763 <td> 6 </td>
3764 <td> 9
3765 </td></tr>
3766 <tr>
3767 <th> 4
3768 </th>
3769 <td> 4 </td>
3770 <td> 8 </td>
3771 <td> 12
3772 </td></tr>
3773 <tr>
3774 <th> 5
3775 </th>
3776 <td> 5 </td>
3777 <td> 10 </td>
3778 <td> 15
3779 </td></tr></table>
3780
3781 !! end
3782
3783 !! test
3784 Accept "||" in table headings
3785 !! input
3786 {|
3787 !h1 || h2
3788 |}
3789 !! result
3790 <table>
3791 <tr>
3792 <th>h1 </th>
3793 <th> h2
3794 </th></tr></table>
3795
3796 !! end
3797
3798 !! test
3799 Accept "||" in indented table headings
3800 !! input
3801 :{|
3802 !h1 || h2
3803 |}
3804 !! result
3805 <dl><dd><table>
3806 <tr>
3807 <th>h1 </th>
3808 <th> h2
3809 </th></tr></table></dd></dl>
3810
3811 !! end
3812
3813 !! test
3814 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3815 !! input
3816 {|
3817 !| h1
3818 || a
3819 |}
3820 !! result
3821 <table>
3822 <tr>
3823 <th> h1
3824 </th>
3825 <td> a
3826 </td></tr></table>
3827
3828 !! end
3829
3830 !!test
3831 Accept "| !" at start of line in tables (ignore !-attribute)
3832 !!input
3833 {|
3834 |-
3835 | !style="color:red" | bar
3836 |}
3837 !!result
3838 <table>
3839
3840 <tr>
3841 <td> bar
3842 </td></tr></table>
3843
3844 !!end
3845
3846 !!test
3847 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 +/-
3848 !!input
3849 {|
3850 |-
3851 |style='color:red;'|+1
3852 |style='color:blue;'|-1
3853 |-
3854 | 1 || 2 || 3
3855 | 1 ||+2 ||-3
3856 |-
3857 | +1
3858 | -1
3859 |}
3860 !!result
3861 <table>
3862
3863 <tr>
3864 <td style="color:red;">+1
3865 </td>
3866 <td style="color:blue;">-1
3867 </td></tr>
3868 <tr>
3869 <td> 1 </td>
3870 <td> 2 </td>
3871 <td> 3
3872 </td>
3873 <td> 1 </td>
3874 <td>+2 </td>
3875 <td>-3
3876 </td></tr>
3877 <tr>
3878 <td> +1
3879 </td>
3880 <td> -1
3881 </td></tr></table>
3882
3883 !!end
3884
3885 !! test
3886 Table rowspan
3887 !! input
3888 {| border=1
3889 | Cell 1, row 1
3890 |rowspan=2| Cell 2, row 1 (and 2)
3891 | Cell 3, row 1
3892 |-
3893 | Cell 1, row 2
3894 | Cell 3, row 2
3895 |}
3896 !! result
3897 <table border="1">
3898 <tr>
3899 <td> Cell 1, row 1
3900 </td>
3901 <td rowspan="2"> Cell 2, row 1 (and 2)
3902 </td>
3903 <td> Cell 3, row 1
3904 </td></tr>
3905 <tr>
3906 <td> Cell 1, row 2
3907 </td>
3908 <td> Cell 3, row 2
3909 </td></tr></table>
3910
3911 !! end
3912
3913 !! test
3914 Nested table
3915 !! input
3916 {| border=1
3917 | &alpha;
3918 |
3919 {| bgcolor=#ABCDEF border=2
3920 |nested
3921 |-
3922 |table
3923 |}
3924 |the original table again
3925 |}
3926 !! result
3927 <table border="1">
3928 <tr>
3929 <td> &#945;
3930 </td>
3931 <td>
3932 <table bgcolor="#ABCDEF" border="2">
3933 <tr>
3934 <td>nested
3935 </td></tr>
3936 <tr>
3937 <td>table
3938 </td></tr></table>
3939 </td>
3940 <td>the original table again
3941 </td></tr></table>
3942
3943 !! end
3944
3945 !! test
3946 Invalid attributes in table cell (bug 1830)
3947 !! input
3948 {|
3949 |Cell:|broken
3950 |}
3951 !! result
3952 <table>
3953 <tr>
3954 <td>broken
3955 </td></tr></table>
3956
3957 !! end
3958
3959
3960 !! test
3961 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3962 !! input
3963 {|
3964 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3965 !! result
3966 <table>
3967 <tr>
3968 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3969 <td>]" onmouseover="alert(document.cookie)"&gt;test
3970 </td>
3971 </tr>
3972 </table>
3973
3974 !! end
3975
3976
3977 !! test
3978 Indented table markup mixed with indented pre content (proposed in bug 6200)
3979 !! input
3980 <table>
3981 <tr>
3982 <td>
3983 Text that should be rendered preformatted
3984 </td>
3985 </tr>
3986 </table>
3987 !! result
3988 <table>
3989 <tr>
3990 <td>
3991 <pre>Text that should be rendered preformatted
3992 </pre>
3993 </td>
3994 </tr>
3995 </table>
3996
3997 !! end
3998
3999 !! test
4000 Template-generated table cell attributes and cell content
4001 !! input
4002 {|
4003 |{{table_attribs}}
4004 |}
4005 !! result
4006 <table>
4007 <tr>
4008 <td style="color: red"> Foo
4009 </td></tr></table>
4010
4011 !! end
4012
4013 !! test
4014 Template-generated table cell attributes and cell content (2)
4015 !! input
4016 {|
4017 |align=center {{table_attribs}}
4018 |}
4019 !! result
4020 <table>
4021 <tr>
4022 <td align="center" style="color: red"> Foo
4023 </td></tr></table>
4024
4025 !! end
4026
4027 !! test
4028 Template-generated table cell attributes and cell content (3)
4029 !! input
4030 {|
4031 |align=center {{table_cells}}
4032 |}
4033 !! result
4034 <table>
4035 <tr>
4036 <td align="center" style="color: red"> Foo </td>
4037 <td> Bar </td>
4038 <td> Baz
4039 </td></tr></table>
4040
4041 !! end
4042
4043 !! test
4044 Table with row followed by newlines and table heading
4045 !! input
4046 {|
4047 |-
4048
4049 ! foo
4050 |}
4051 !! result
4052 <table>
4053
4054
4055 <tr>
4056 <th> foo
4057 </th></tr></table>
4058
4059 !! end
4060
4061 !! test
4062 Table with empty line following the start tag
4063 !! input
4064 {|
4065
4066 |-
4067 | foo
4068 |}
4069 !! result
4070 <table>
4071
4072
4073 <tr>
4074 <td> foo
4075 </td></tr></table>
4076
4077 !! end
4078
4079 # FIXME: Preserve the attribute properly (with an empty string as value) in
4080 # the PHP parser. Parsoid implements the behavior below.
4081 !! test
4082 Table attributes with empty value
4083 !! options
4084 parsoid
4085 !! input
4086 {|
4087 | style=| hello
4088 |}
4089 !! result
4090 <table>
4091 <tbody>
4092 <tr>
4093 <td style=""> hello
4094 </td></tr></tbody></table>
4095
4096 !! end
4097
4098 !! test
4099 Wikitext table with a lot of comments
4100 !! input
4101 {|
4102 <!-- c0 -->
4103 | foo
4104 <!-- c1 -->
4105 |- <!-- c2 -->
4106 <!-- c3 -->
4107 |<!-- c4 -->
4108 <!-- c5 -->
4109 |}
4110 !! result
4111 <table>
4112 <tr>
4113 <td> foo
4114 </td></tr>
4115 <tr>
4116 <td>
4117 </td></tr></table>
4118
4119 !! end
4120
4121 !! test
4122 Wikitext table with double-line table cell
4123 !! input
4124 {|
4125 |a
4126 b
4127 |}
4128 !! result
4129 <table>
4130 <tr>
4131 <td>a
4132 <p>b
4133 </p>
4134 </td></tr></table>
4135
4136 !! end
4137
4138 !! test
4139 Table cell with a single comment
4140 !! input
4141 {|
4142 | <!-- c1 -->
4143 | a
4144 |}
4145 !! result
4146 <table>
4147 <tr>
4148 <td>
4149 </td>
4150 <td> a
4151 </td></tr></table>
4152
4153 !! end
4154
4155 # The expected HTML structure in this test is debatable. The PHP parser does
4156 # not parse this kind of table at all. The main focus for Parsoid is on
4157 # round-tripping, so this output is ok for now. TODO: revisit!
4158 !! test
4159 Wikitext table with html-syntax row (Parsoid)
4160 !! options
4161 parsoid
4162 !! input
4163 {|
4164 |-
4165 <td>foo</td>
4166 |}
4167 !! result
4168 <table>
4169 <tbody>
4170 <tr>
4171 <td>foo</td></tr></tbody></table>
4172 !! end
4173
4174 !! test
4175 Implicit <td> after a |-
4176 (PHP parser relies on Tidy to add the missing <td> tags)
4177 !! options
4178 parsoid=wt2html,wt2wt
4179 !! input
4180 {|
4181 |-
4182 a
4183 |}
4184 !! result
4185 <table>
4186 <tr><td>a</td></tr>
4187 </table>
4188 !! end
4189
4190 !! test
4191 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4192 (PHP parser relies on Tidy to add the missing <td> tags)
4193 !! options
4194 parsoid=wt2html,wt2wt
4195 !! input
4196 {|
4197 |-
4198 |
4199 a
4200 |-
4201 b
4202 |}
4203 !! result
4204 <table>
4205 <tbody>
4206 <tr><td><pre>a</pre></td></tr>
4207 <tr><td> b</td></tr>
4208 </tbody>
4209 </table>
4210 !! end
4211
4212 !! test
4213 Lists should be recognized in an implicit <td> context
4214 (PHP parser relies on Tidy to add the missing <td> tags)
4215 !! options
4216 parsoid=wt2html,wt2wt
4217 !! input
4218 {|
4219 |-
4220 *a
4221 |}
4222 !! result
4223 <table>
4224 <tr>
4225 <td><ul><li>a</li></ul></td>
4226 </tr>
4227 </table>
4228 !! end
4229
4230 ###
4231 ### Internal links
4232 ###
4233 !! test
4234 Plain link, capitalized
4235 !! input
4236 [[Main Page]]
4237 !! result
4238 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4239 </p>
4240 !! end
4241
4242 !! test
4243 Plain link, uncapitalized
4244 !! input
4245 [[main Page]]
4246 !! result
4247 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4248 </p>
4249 !! end
4250
4251 !! test
4252 Piped link
4253 !! input
4254 [[Main Page|The Main Page]]
4255 !! result
4256 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4257 </p>
4258 !! end
4259
4260 !! test
4261 Piped link with comment in link text
4262 !! input
4263 [[Main Page|The Main<!--front--> Page]]
4264 !! result
4265 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4266 </p>
4267 !! end
4268
4269 !! test
4270 Broken link
4271 !! input
4272 [[Zigzagzogzagzig]]
4273 !! result
4274 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4275 </p>
4276 !! end
4277
4278 !! test
4279 Broken link with fragment
4280 !! input
4281 [[Zigzagzogzagzig#zug]]
4282 !! result
4283 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4284 </p>
4285 !! end
4286
4287 !! test
4288 Special page link with fragment
4289 !! input
4290 [[Special:Version#anchor]]
4291 !! result
4292 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4293 </p>
4294 !! end
4295
4296 !! test
4297 Nonexistent special page link with fragment
4298 !! input
4299 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4300 !! result
4301 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4302 </p>
4303 !! end
4304
4305 !! test
4306 Link with prefix
4307 !! input
4308 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4309 !! result
4310 <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>
4311 </p>
4312 !! end
4313
4314 !! test
4315 Link with suffix
4316 !! input
4317 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4318 !! result
4319 <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>!!!
4320 </p>
4321 !! end
4322
4323 !! article
4324 prefixed article
4325 !! text
4326 Some text
4327 !! endarticle
4328
4329 !! test
4330 Bug 43661: Piped links with identical prefixes
4331 !! input
4332 [[prefixed article|prefixed articles with spaces]]
4333
4334 [[prefixed article|prefixed articlesaoeu]]
4335
4336 [[Main Page|Main Page test]]
4337 !! result
4338 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4339 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4340 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4341 </p>
4342 !! end
4343
4344
4345 !! test
4346 Link with HTML entity in suffix / tail
4347 !! input
4348 [[Main Page]]&quot;, [[Main Page]]&#97;
4349 !! result
4350 <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;
4351 </p>
4352 !! end
4353
4354 !! test
4355 Link with 3 brackets
4356 !! input
4357 [[[main page]]]
4358 !! result
4359 <p>[[[main page]]]
4360 </p>
4361 !! end
4362
4363 !! test
4364 Piped link with 3 brackets
4365 !! input
4366 [[[main page|the main page]]]
4367 !! result
4368 <p>[[[main page|the main page]]]
4369 </p>
4370 !! end
4371
4372 !! test
4373 Link with multiple pipes
4374 !! input
4375 [[Main Page|The|Main|Page]]
4376 !! result
4377 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4378 </p>
4379 !! end
4380
4381 !! test
4382 Link to namespaces
4383 !! input
4384 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4385 !! result
4386 <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>
4387 </p>
4388 !! end
4389
4390 !! test
4391 Piped link to namespace
4392 !! input
4393 [[Meta:Disclaimers|The disclaimers]]
4394 !! result
4395 <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>
4396 </p>
4397 !! end
4398
4399 !! test
4400 Link containing }
4401 !! input
4402 [[Usually caused by a typo (oops}]]
4403 !! result
4404 <p>[[Usually caused by a typo (oops}]]
4405 </p>
4406 !! end
4407
4408 !! test
4409 Link containing % (not as a hex sequence)
4410 !! input
4411 [[7% Solution]]
4412 !! result
4413 <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>
4414 </p>
4415 !! end
4416
4417 !! test
4418 Link containing % as a single hex sequence interpreted to char
4419 !! input
4420 [[7%25 Solution]]
4421 !! result
4422 <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>
4423 </p>
4424 !!end
4425
4426 !! test
4427 Link containing % as a double hex sequence interpreted to hex sequence
4428 !! input
4429 [[7%2525 Solution]]
4430 !! result
4431 <p>[[7%2525 Solution]]
4432 </p>
4433 !!end
4434
4435 !! test
4436 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4437 Example for such a section: == < ==
4438 !! input
4439 [[%23%3c]][[%23%3e]]
4440 !! result
4441 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4442 </p>
4443 !! end
4444
4445 !! test
4446 Link containing "<#" and ">#" as a hex sequences
4447 !! input
4448 [[%3c%23]][[%3e%23]]
4449 !! result
4450 <p>[[%3c%23]][[%3e%23]]
4451 </p>
4452 !! end
4453
4454 !! test
4455 Link containing an equals sign
4456 !! input
4457 [[Special:BookSources/isbn=4-00-026157-6]]
4458 !! result
4459 <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>
4460 </p>
4461 !! end
4462
4463 !! article
4464 Foo~bar
4465 !! text
4466 Just a test of an article title containing a tilde.
4467 !! endarticle
4468
4469 # note that links containing signatures, like [[Foo~~~~]], are
4470 # massaged by the pre-save transform (PST) and so the tildes are never
4471 # seen by the parser.
4472 !! test
4473 Link containing a tilde
4474 !! input
4475 [[Foo~bar]]
4476 !! result
4477 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4478 </p>
4479 !! end
4480
4481 !! test
4482 Link containing double-single-quotes '' (bug 4598)
4483 !! input
4484 [[Lista d''e paise d''o munno]]
4485 !! result
4486 <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>
4487 </p>
4488 !! end
4489
4490 !! test
4491 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4492 !! input
4493 Some [[Link|pretty ''italics'' and stuff]]!
4494 !! result
4495 <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>!
4496 </p>
4497 !! end
4498
4499 !! test
4500 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4501 !! input
4502 ''Some [[Link|pretty ''italics'' and stuff]]!
4503 !! result
4504 <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>
4505 </p>
4506 !! end
4507
4508 !! test
4509 Link with double quotes in title part (literal) and alternate part (interpreted)
4510 !! input
4511 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4512
4513 [[''Pentecoste'']]
4514
4515 [[''Pentecoste''|Pentecoste]]
4516
4517 [[''Pentecoste''|''Pentecoste'']]
4518 !! result
4519 <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>
4520 </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>
4521 </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>
4522 </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>
4523 </p>
4524 !! end
4525
4526 !! test
4527 Broken image links with HTML captions (bug 39700)
4528 !! input
4529 [[File:Nonexistent|<script></script>]]
4530 [[File:Nonexistent|100px|<script></script>]]
4531 [[File:Nonexistent|&lt;]]
4532 [[File:Nonexistent|a<i>b</i>c]]
4533 !! result
4534 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4535 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4536 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4537 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 Plain link to URL
4543 !! input
4544 [[http://www.example.com]]
4545 !! result
4546 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4547 </p>
4548 !! end
4549
4550 !! test
4551 Plain link to URL with link text
4552 !! input
4553 [[http://www.example.com Link text]]
4554 !! result
4555 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4556 </p>
4557 !! end
4558
4559 !! test
4560 Plain link to protocol-relative URL
4561 !! input
4562 [[//www.example.com]]
4563 !! result
4564 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4565 </p>
4566 !! end
4567
4568 !! test
4569 Plain link to protocol-relative URL with link text
4570 !! input
4571 [[//www.example.com Link text]]
4572 !! result
4573 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4574 </p>
4575 !! end
4576
4577 !! test
4578 Plain link to page with question mark in title
4579 !! input
4580 [[A?b]]
4581
4582 [[A?b|Baz]]
4583 !! result
4584 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4585 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4586 </p>
4587 !! end
4588
4589
4590 # I'm fairly sure the expected result here is wrong.
4591 # We want these to be URL links, not pseudo-pages with URLs for titles....
4592 # However the current output is also pretty screwy.
4593 #
4594 # ----
4595 # I'm changing it to match the current output--it arguably makes more
4596 # sense in the light of the test above. Old expected result was:
4597 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4598 #</p>
4599 # But I think this test is bordering on "garbage in, garbage out" anyway.
4600 # -- wtm
4601 !! test
4602 Piped link to URL
4603 !! input
4604 Piped link to URL: [[http://www.example.com|an example URL]]
4605 !! result
4606 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4607 </p>
4608 !! end
4609
4610 !! test
4611 BUG 2: [[page|http://url/]] should link to page, not http://url/
4612 !! input
4613 [[Main Page|http://url/]]
4614 !! result
4615 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4616 </p>
4617 !! end
4618
4619 !! test
4620 BUG 337: Escaped self-links should be bold
4621 !! options
4622 title=[[Bug462]]
4623 !! input
4624 [[Bu&#103;462]] [[Bug462]]
4625 !! result
4626 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4627 </p>
4628 !! end
4629
4630 !! test
4631 Self-link to section should not be bold
4632 !! options
4633 title=[[Main Page]]
4634 !! input
4635 [[Main Page#section]]
4636 !! result
4637 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4638 </p>
4639 !! end
4640
4641 !! article
4642 00
4643 !! text
4644 This is 00.
4645 !! endarticle
4646
4647 !!test
4648 Self-link to numeric title
4649 !!options
4650 title=[[0]]
4651 !!input
4652 [[0]]
4653 !!result
4654 <p><strong class="selflink">0</strong>
4655 </p>
4656 !!end
4657
4658 !!test
4659 Link to numeric-equivalent title
4660 !!options
4661 title=[[0]]
4662 !!input
4663 [[00]]
4664 !!result
4665 <p><a href="/wiki/00" title="00">00</a>
4666 </p>
4667 !!end
4668
4669 !! test
4670 <nowiki> inside a link
4671 !! input
4672 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4673 !! result
4674 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4675 </p>
4676 !! end
4677
4678 !! test
4679 Non-breaking spaces in title
4680 !! input
4681 [[&nbsp; Main &nbsp; Page &nbsp;]]
4682 !! result
4683 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4684 </p>
4685 !!end
4686
4687 !! test
4688 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4689 !! options
4690 language=ca
4691 !! input
4692 '''[[Main Page]]'''
4693 !! result
4694 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4695 </p>
4696 !! end
4697
4698 !! test
4699 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4700 !! options
4701 language=ca
4702 !! input
4703 ''[[Main Page]]''
4704 !! result
4705 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4706 </p>
4707 !! end
4708
4709 !! test
4710 Internal link with en linktrail: no apostrophes (bug 27473)
4711 !! options
4712 language=en
4713 !! input
4714 [[Something]]'nice
4715 !! result
4716 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4717 </p>
4718 !! end
4719
4720 !! test
4721 Internal link with ca linktrail with apostrophes (bug 27473)
4722 !! options
4723 language=ca
4724 !! input
4725 [[Something]]'nice
4726 !! result
4727 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4728 </p>
4729 !! end
4730
4731 !! test
4732 Internal link with kaa linktrail with apostrophes (bug 27473)
4733 !! options
4734 language=kaa
4735 !! input
4736 [[Something]]'nice
4737 !! result
4738 <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>
4739 </p>
4740 !! end
4741
4742 !! article
4743 Söfnuður
4744 !! text
4745 Test.
4746 !! endarticle
4747
4748 !! test
4749 Internal link with is link prefix
4750 !! options
4751 language=is
4752 !! input
4753 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4754 !! result
4755 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4756 </p>
4757 !! end
4758
4759 !! article
4760 Mótmælendatrú
4761 !! text
4762 Test.
4763 !! endarticle
4764
4765 !! test
4766 Internal link with is link trail and link prefix
4767 !! options
4768 language=is
4769 !! input
4770 [[mótmælendatrú|xxx]]ar
4771 [[mótmælendatrú]]ar
4772 mótmælenda[[söfnuður]]
4773 mótmælenda[[söfnuður|söfnuðir]]
4774 mótmælenda[[söfnuður|söfnuðir]]xxx
4775 !! result
4776 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4777 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4778 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4779 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4780 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4781 </p>
4782 !! end
4783
4784 !! test
4785 Parsoid link trail escaping
4786 !! options
4787 parsoid=html2wt,html2html
4788 !! input
4789 [[apple]]<nowiki/>s
4790 !! result
4791 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4792 !! end
4793
4794 !! test
4795 Parsoid link prefix escaping
4796 !! options
4797 language=is
4798 parsoid=html2wt,html2html
4799 !! input
4800 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4801 !! result
4802 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4803 !! end
4804
4805 !! test
4806 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4807 !! input
4808 [[Foo| bar]]
4809
4810 [[Foo| ''bar'']]
4811
4812 [http://wp.org foo]
4813
4814 [http://wp.org ''foo'']
4815 !! result
4816 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4817 </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>
4818 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4819 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4820 </p>
4821 !! end
4822
4823 ###
4824 ### Interwiki links (see maintenance/interwiki.sql)
4825 ###
4826
4827 !! test
4828 Inline interwiki link
4829 !! input
4830 [[MeatBall:SoftSecurity]]
4831 !! result
4832 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4833 </p>
4834 !! end
4835
4836 !! test
4837 Inline interwiki link with empty title (bug 2372)
4838 !! input
4839 [[MeatBall:]]
4840 !! result
4841 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4842 </p>
4843 !! end
4844
4845 !! test
4846 Interwiki link encoding conversion (bug 1636)
4847 !! input
4848 *[[Wikipedia:ro:Olteni&#0355;a]]
4849 *[[Wikipedia:ro:Olteni&#355;a]]
4850 !! result
4851 <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>
4852 </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>
4853 </li></ul>
4854
4855 !! end
4856
4857 !! test
4858 Interwiki link with fragment (bug 2130)
4859 !! input
4860 [[MeatBall:SoftSecurity#foo]]
4861 !! result
4862 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4863 </p>
4864 !! end
4865
4866 !! test
4867 Interlanguage link
4868 !! input
4869 Blah blah blah
4870 [[zh:Chinese]]
4871 !!result
4872 <p>Blah blah blah
4873 </p>
4874 !! end
4875
4876 !! test
4877 Double interlanguage link
4878 !! input
4879 Blah blah blah
4880 [[es:Spanish]]
4881 [[zh:Chinese]]
4882 !!result
4883 <p>Blah blah blah
4884 </p>
4885 !! end
4886
4887 !! test
4888 Interlanguage link, with prefix links
4889 !! options
4890 language=ln
4891 !! input
4892 Blah blah blah
4893 [[zh:Chinese]]
4894 !!result
4895 <p>Blah blah blah
4896 </p>
4897 !! end
4898
4899 !! test
4900 Double interlanguage link, with prefix links (bug 8897)
4901 !! options
4902 language=ln
4903 !! input
4904 Blah blah blah
4905 [[es:Spanish]]
4906 [[zh:Chinese]]
4907 !!result
4908 <p>Blah blah blah
4909 </p>
4910 !! end
4911
4912 !! test
4913 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4914 !! options
4915 language=ln
4916 !! input
4917 [[WW&nbsp;II]]
4918 !!result
4919 <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>
4920 </p>
4921 !! end
4922
4923 !! test
4924 Parsoid: handle constructor well
4925 !! options
4926 parsoid
4927 !! input
4928 [[constructor]]
4929
4930 [[constructor:foo]]
4931 !! result
4932 <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>
4933
4934
4935 <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>
4936 !! end
4937
4938 ##
4939 ## Redirects, Parsoid-only
4940 ##
4941 !! test
4942 Simple redirect to page
4943 !! options
4944 parsoid
4945 !! input
4946 #REDIRECT [[Main Page]]
4947 !! result
4948 <link rel="mw:PageProp/redirect" href="./Main_Page">
4949 !! end
4950
4951 !! test
4952 Optional colon in #REDIRECT
4953 !! options
4954 # the colon is archaic syntax. we support it for wt2html, but we
4955 # don't care that it roundtrips back to the modern syntax.
4956 parsoid=wt2html,html2html
4957 !! input
4958 #REDIRECT:[[Main Page]]
4959 !! result
4960 <link rel="mw:PageProp/redirect" href="./Main_Page">
4961 !! end
4962
4963 !! test
4964 Whitespace in #REDIRECT with optional colon
4965 !! options
4966 # the colon and gratuitous whitespace is archaic syntax. we support
4967 # it for wt2html, but we don't care that it roundtrips back to the
4968 # modern syntax (without extra whitespace)
4969 parsoid=wt2html,html2html
4970 !! input
4971
4972 #REDIRECT
4973 :
4974 [[Main Page]]
4975 !! result
4976 <link rel="mw:PageProp/redirect" href="./Main_Page">
4977 !! end
4978
4979 !! test
4980 Piped link in #REDIRECT
4981 !! options
4982 # content after piped link is ignored. we support this syntax,
4983 # but don't care that the piped link is lost when we roundtrip this.
4984 parsoid=wt2html
4985 !! input
4986 #REDIRECT [[Main Page|bar]]
4987 !! result
4988 <link rel="mw:PageProp/redirect" href="./Main_Page">
4989 !! end
4990
4991 !! test
4992 Redirect to category
4993 !! options
4994 parsoid=wt2html
4995 !! input
4996 #REDIRECT [[Category:Foo]]
4997 !! result
4998 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4999 !! end
5000
5001 !! test
5002 Redirect to category with URL encoding
5003 !! options
5004 parsoid=wt2html
5005 !! input
5006 #REDIRECT [[Category%3AFoo]]
5007 !! result
5008 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5009 !! end
5010
5011 !! test
5012 Redirect to category page
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! input
5016 #REDIRECT [[:Category:Foo]]
5017 !! result
5018 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5019 !! end
5020
5021 !! test
5022 Redirect to image page (1)
5023 !! options
5024 parsoid
5025 !! input
5026 #REDIRECT [[File:Wiki.png]]
5027 !! result
5028 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5029 !! end
5030
5031 !! test
5032 Redirect to image page (2)
5033 !! options
5034 parsoid
5035 !! input
5036 #REDIRECT [[Image:Wiki.png]]
5037 !! result
5038 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5039 !! end
5040
5041 !! test
5042 Redirect to language
5043 !! options
5044 parsoid
5045 !! input
5046 #REDIRECT [[en:File:Wiki.png]]
5047 !! result
5048 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5049 !! end
5050
5051 !! test
5052 Redirect to interwiki
5053 !! options
5054 parsoid
5055 !! input
5056 #REDIRECT [[meatball:File:Wiki.png]]
5057 !! result
5058 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5059 !! end
5060
5061 !! test
5062 Non-English #REDIRECT
5063 !! options
5064 parsoid
5065 language=is
5066 !! input
5067 #TILVÍSUN [[Main Page]]
5068 !! result
5069 <link rel="mw:PageProp/redirect" href="./Main_Page">
5070 !! end
5071
5072 ##
5073 ## XHTML tidiness
5074 ###
5075
5076 !! test
5077 <br> to <br />
5078 !! input
5079 1<br>2<br />3
5080 !! result
5081 <p>1<br />2<br />3
5082 </p>
5083 !! end
5084
5085 !! test
5086 Broken br tag sanitization
5087 !! options
5088 php
5089 !! input
5090 </br>
5091 !! result
5092 <p>&lt;/br&gt;
5093 </p>
5094 !! end
5095
5096 # TODO: Fix html2html mode (bug 51055)!
5097 !! test
5098 Parsoid: Broken br tag recognition
5099 !! options
5100 parsoid=wt2html
5101 !! input
5102 </br>
5103 !! result
5104 <p><br></p>
5105 !! end
5106
5107 !! test
5108 Incorrecly removing closing slashes from correctly formed XHTML
5109 !! input
5110 <br style="clear:both;" />
5111 !! result
5112 <p><br style="clear:both;" />
5113 </p>
5114 !! end
5115
5116 !! test
5117 Failing to transform badly formed HTML into correct XHTML
5118 !! input
5119 <br style="clear: left;">
5120 <br style="clear: right;">
5121 <br style="clear: both;">
5122 !! result
5123 <p><br style="clear: left;" />
5124 <br style="clear: right;" />
5125 <br style="clear: both;" />
5126 </p>
5127 !!end
5128
5129 !! test
5130 Handling html with a div self-closing tag
5131 !! input
5132 <div title />
5133 <div title/>
5134 <div title/ >
5135 <div title=bar />
5136 <div title=bar/>
5137 <div title=bar/ >
5138 !! result
5139 <p>&lt;div title /&gt;
5140 &lt;div title/&gt;
5141 </p>
5142 <div>
5143 <p>&lt;div title=bar /&gt;
5144 &lt;div title=bar/&gt;
5145 </p>
5146 <div title="bar/"></div>
5147 </div>
5148
5149 !! end
5150
5151 !! test
5152 Handling html with a br self-closing tag
5153 !! input
5154 <br title />
5155 <br title/>
5156 <br title/ >
5157 <br title=bar />
5158 <br title=bar/>
5159 <br title=bar/ >
5160 !! result
5161 <p><br title="title" />
5162 <br title="title" />
5163 <br />
5164 <br title="bar" />
5165 <br title="bar" />
5166 <br title="bar/" />
5167 </p>
5168 !! end
5169
5170 !! test
5171 Horizontal ruler (should it add that extra space?)
5172 !! input
5173 <hr>
5174 <hr >
5175 foo <hr
5176 > bar
5177 !! result
5178 <hr />
5179 <hr />
5180 foo <hr /> bar
5181
5182 !! end
5183
5184 !! test
5185 Horizontal ruler -- 4+ dashes render hr
5186 !! input
5187 ----
5188 !! result
5189 <hr />
5190
5191 !! end
5192
5193 !! test
5194 Horizontal ruler -- eats additional dashes on the same line
5195 !! input
5196 ---------
5197 !! result
5198 <hr />
5199
5200 !! end
5201
5202 !! test
5203 Horizontal ruler -- does not collapse dashes on consecutive lines
5204 !! input
5205 ----
5206 ----
5207 !! result
5208 <hr />
5209 <hr />
5210
5211 !! end
5212
5213 !! test
5214 Horizontal ruler -- <4 dashes render as plain text
5215 !! input
5216 ---
5217 !! result
5218 <p>---
5219 </p>
5220 !! end
5221
5222 !! test
5223 Horizontal ruler -- Supports content following dashes on same line
5224 !! input
5225 ---- Foo
5226 !! result
5227 <hr /> Foo
5228
5229 !! end
5230
5231 ###
5232 ### Block-level elements
5233 ###
5234 !! test
5235 Common list
5236 !! input
5237 *Common list
5238 * item 2
5239 *item 3
5240 !! result
5241 <ul><li>Common list
5242 </li><li> item 2
5243 </li><li>item 3
5244 </li></ul>
5245
5246 !! end
5247
5248 !! test
5249 Numbered list
5250 !! input
5251 #Numbered list
5252 #item 2
5253 # item 3
5254 !! result
5255 <ol><li>Numbered list
5256 </li><li>item 2
5257 </li><li> item 3
5258 </li></ol>
5259
5260 !! end
5261
5262 !! test
5263 Mixed list
5264 !! input
5265 *Mixed list
5266 *# with numbers
5267 ** and bullets
5268 *# and numbers
5269 *bullets again
5270 **bullet level 2
5271 ***bullet level 3
5272 ***#Number on level 4
5273 **bullet level 2
5274 **#Number on level 3
5275 **#Number on level 3
5276 *#number level 2
5277 *Level 1
5278 *** Level 3
5279 #** Level 3, but ordered
5280 !! result
5281 <ul><li>Mixed list
5282 <ol><li> with numbers
5283 </li></ol>
5284 <ul><li> and bullets
5285 </li></ul>
5286 <ol><li> and numbers
5287 </li></ol>
5288 </li><li>bullets again
5289 <ul><li>bullet level 2
5290 <ul><li>bullet level 3
5291 <ol><li>Number on level 4
5292 </li></ol>
5293 </li></ul>
5294 </li><li>bullet level 2
5295 <ol><li>Number on level 3
5296 </li><li>Number on level 3
5297 </li></ol>
5298 </li></ul>
5299 <ol><li>number level 2
5300 </li></ol>
5301 </li><li>Level 1
5302 <ul><li><ul><li> Level 3
5303 </li></ul>
5304 </li></ul>
5305 </li></ul>
5306 <ol><li><ul><li><ul><li> Level 3, but ordered
5307 </li></ul>
5308 </li></ul>
5309 </li></ol>
5310
5311 !! end
5312
5313 !! test
5314 Nested lists 1
5315 !! input
5316 *foo
5317 **bar
5318 !! result
5319 <ul><li>foo
5320 <ul><li>bar
5321 </li></ul>
5322 </li></ul>
5323
5324 !! end
5325
5326 !! test
5327 Nested lists 2
5328 !! input
5329 **foo
5330 *bar
5331 !! result
5332 <ul><li><ul><li>foo
5333 </li></ul>
5334 </li><li>bar
5335 </li></ul>
5336
5337 !! end
5338
5339 !! test
5340 Nested lists 3 (first element empty)
5341 !! input
5342 *
5343 **bar
5344 !! result
5345 <ul><li>
5346 <ul><li>bar
5347 </li></ul>
5348 </li></ul>
5349
5350 !! end
5351
5352 !! test
5353 Nested lists 4 (first element empty)
5354 !! input
5355 **
5356 *bar
5357 !! result
5358 <ul><li><ul><li>
5359 </li></ul>
5360 </li><li>bar
5361 </li></ul>
5362
5363 !! end
5364
5365 !! test
5366 Nested lists 5 (both elements empty)
5367 !! input
5368 **
5369 *
5370 !! result
5371 <ul><li><ul><li>
5372 </li></ul>
5373 </li><li>
5374 </li></ul>
5375
5376 !! end
5377
5378 !! test
5379 Nested lists 6 (both elements empty)
5380 !! input
5381 *
5382 **
5383 !! result
5384 <ul><li>
5385 <ul><li>
5386 </li></ul>
5387 </li></ul>
5388
5389 !! end
5390
5391 !! test
5392 Nested lists 7 (skip initial nesting levels)
5393 !! input
5394 *** foo
5395 !! result
5396 <ul><li><ul><li><ul><li> foo
5397 </li></ul>
5398 </li></ul>
5399 </li></ul>
5400
5401 !! end
5402
5403 !! test
5404 Nested lists 8 (multiple nesting transitions)
5405 !! input
5406 * foo
5407 *** bar
5408 ** baz
5409 * boo
5410 !! result
5411 <ul><li> foo
5412 <ul><li><ul><li> bar
5413 </li></ul>
5414 </li><li> baz
5415 </li></ul>
5416 </li><li> boo
5417 </li></ul>
5418
5419 !! end
5420
5421 !! test
5422 1. Lists with start-of-line-transparent tokens before bullets: Comments
5423 !! input
5424 *foo
5425 *<!--cmt-->bar
5426 <!--cmt-->*baz
5427 !! result
5428 <ul><li>foo
5429 </li><li>bar
5430 </li><li>baz
5431 </li></ul>
5432
5433 !! end
5434
5435 !! test
5436 2. Lists with start-of-line-transparent tokens before bullets: Template close
5437 !! input
5438 *foo {{echo|bar
5439 }}*baz
5440 !! result
5441 <ul><li>foo bar
5442 </li><li>baz
5443 </li></ul>
5444
5445 !! end
5446
5447 !! test
5448 List items are not parsed correctly following a <pre> block (bug 785)
5449 !! input
5450 * <pre>foo</pre>
5451 * <pre>bar</pre>
5452 * zar
5453 !! result
5454 <ul><li> <pre>foo</pre>
5455 </li><li> <pre>bar</pre>
5456 </li><li> zar
5457 </li></ul>
5458
5459 !! end
5460
5461 !! test
5462 List items from template
5463 !! input
5464
5465 {{inner list}}
5466 * item 2
5467
5468 * item 0
5469 {{inner list}}
5470 * item 2
5471
5472 * item 0
5473 * notSOL{{inner list}}
5474 * item 2
5475 !! result
5476 <ul><li> item 1
5477 </li><li> item 2
5478 </li></ul>
5479 <ul><li> item 0
5480 </li><li> item 1
5481 </li><li> item 2
5482 </li></ul>
5483 <ul><li> item 0
5484 </li><li> notSOL
5485 </li><li> item 1
5486 </li><li> item 2
5487 </li></ul>
5488
5489 !! end
5490
5491 !! test
5492 List interrupted by empty line or heading
5493 !! input
5494 * foo
5495
5496 ** bar
5497 == A heading ==
5498 * Another list item
5499 !! result
5500 <ul><li> foo
5501 </li></ul>
5502 <ul><li><ul><li> bar
5503 </li></ul>
5504 </li></ul>
5505 <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>
5506 <ul><li> Another list item
5507 </li></ul>
5508
5509 !!end
5510
5511 !!test
5512 Multiple list tags generated by templates
5513 !!input
5514 {{echo|<li>}}a
5515 {{echo|<li>}}b
5516 {{echo|<li>}}c
5517 !!result
5518 <li>a
5519 <li>b
5520 <li>c</li>
5521 </li>
5522 </li>
5523
5524 !!end
5525
5526 !!test
5527 Single-comment whitespace lines dont break lists, and so do multi-comment whitespace lines
5528 !!input
5529 *a
5530 <!--This line will NOT split the list-->
5531 *b
5532 <!--This line will NOT split the list either-->
5533 *c
5534 <!--foo--> <!----> <!--This line NOT split the list either-->
5535 *d
5536 !!result
5537 <ul><li>a
5538 </li><li>b
5539 </li><li>c
5540 </li><li>d
5541 </li></ul>
5542
5543 !!end
5544
5545 !!test
5546 Test the li-hack
5547 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5548 !!options
5549 parsoid=wt2html,wt2wt
5550 !!input
5551 * foo
5552 * <li>li-hack
5553 * {{echo|<li>templated li-hack}}
5554 * <!--foo--> <li> unsupported li-hack with preceding comments
5555
5556 <ul>
5557 <li><li>not a li-hack
5558 </li>
5559 </ul>
5560 !!result
5561 <ul><li> foo</li>
5562 <li>li-hack</li>
5563 <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>
5564 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5565
5566 <ul>
5567 <li></li><li>not a li-hack
5568 </li>
5569 </ul>
5570 !!end
5571
5572 !! test
5573 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5574 !! options
5575 parsoid
5576 !! input
5577 # foo
5578 ## bar
5579 * foo
5580 ** bar
5581 : foo
5582 :: bar
5583 !! result
5584 <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>
5585 !! end
5586
5587 !! test
5588 Parsoid: Test of whitespace serialization with Templated bullets
5589 !! options
5590 parsoid
5591 !! input
5592 * {{bullet}}
5593 !! result
5594 <ul>
5595 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5596 </ul>
5597 !! end
5598
5599 # ------------------------------------------------------------------------
5600 # The next set of tests are about Parsoid's ability to handle badly nested
5601 # tags (parse, minimize scope of fixup, and roundtrip back)
5602 # ------------------------------------------------------------------------
5603
5604 !! test
5605 Unbalanced closing block tags break a list
5606 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5607 !! options
5608 parsoid
5609 !! input
5610 <div>
5611 *a</div><div>
5612 *b</div>
5613 !! result
5614 <div>
5615 <ul><li>a
5616 </li></ul></div><div>
5617 <ul><li>b
5618 </li></ul></div>
5619 !! end
5620
5621 !! test
5622 Unbalanced closing non-block tags don't break a list
5623 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5624 !! options
5625 parsoid
5626 !! input
5627 <span>
5628 *a</span><span>
5629 *b</span>
5630 !! result
5631 <p><span></span>
5632 </p>
5633 <ul><li>a<span></span>
5634 </li><li>b
5635 </li></ul>
5636 !! end
5637
5638 !! test
5639 Unclosed formatting tags that straddle lists are closed and reopened
5640 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5641 !! options
5642 parsoid
5643 !! input
5644 # <s> a
5645 # b </s>
5646 !! result
5647 <ol><li> <s> a </s>
5648 </li><li> <s> b </s>
5649 </li></ol>
5650 !! end
5651
5652 !!test
5653 List embedded in a non-block tag
5654 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5655 !! options
5656 parsoid
5657 !!input
5658 <small>
5659 * foo
5660 </small>
5661 !!result
5662 <p><small></small></p>
5663 <small>
5664 <ul>
5665 <li> foo</li>
5666 </ul>
5667 </small>
5668 <p><small></small></p>
5669 !!end
5670
5671 ###
5672 ### Magic Words
5673 ###
5674
5675 # Note that the current date is hard-coded as
5676 # 1970-01-01T00:02:03Z (a Thursday)
5677 # when running parser tests. The timezone is also fixed to GMT, so
5678 # local date will be identical to current date.
5679
5680 !! test
5681 Magic Word: {{CURRENTDAY}}
5682 !! input
5683 {{CURRENTDAY}}
5684 !! result
5685 <p>1
5686 </p>
5687 !! end
5688
5689 !! test
5690 Magic Word: {{CURRENTDAY2}}
5691 !! input
5692 {{CURRENTDAY2}}
5693 !! result
5694 <p>01
5695 </p>
5696 !! end
5697
5698 !! test
5699 Magic Word: {{CURRENTDAYNAME}}
5700 !! input
5701 {{CURRENTDAYNAME}}
5702 !! result
5703 <p>Thursday
5704 </p>
5705 !! end
5706
5707 !! test
5708 Magic Word: {{CURRENTDOW}}
5709 !! input
5710 {{CURRENTDOW}}
5711 !! result
5712 <p>4
5713 </p>
5714 !! end
5715
5716 !! test
5717 Magic Word: {{CURRENTMONTH}}
5718 !! input
5719 {{CURRENTMONTH}}
5720 !! result
5721 <p>01
5722 </p>
5723 !! end
5724
5725 !! test
5726 Magic Word: {{CURRENTMONTH1}}
5727 !! input
5728 {{CURRENTMONTH1}}
5729 !! result
5730 <p>1
5731 </p>
5732 !! end
5733
5734 !! test
5735 Magic Word: {{CURRENTMONTHABBREV}}
5736 !! input
5737 {{CURRENTMONTHABBREV}}
5738 !! result
5739 <p>Jan
5740 </p>
5741 !! end
5742
5743 !! test
5744 Magic Word: {{CURRENTMONTHNAME}}
5745 !! input
5746 {{CURRENTMONTHNAME}}
5747 !! result
5748 <p>January
5749 </p>
5750 !! end
5751
5752 !! test
5753 Magic Word: {{CURRENTMONTHNAMEGEN}}
5754 !! input
5755 {{CURRENTMONTHNAMEGEN}}
5756 !! result
5757 <p>January
5758 </p>
5759 !! end
5760
5761 !! test
5762 Magic Word: {{CURRENTTIME}}
5763 !! input
5764 {{CURRENTTIME}}
5765 !! result
5766 <p>00:02
5767 </p>
5768 !! end
5769
5770 !! test
5771 Magic Word: {{CURRENTHOUR}}
5772 !! input
5773 {{CURRENTHOUR}}
5774 !! result
5775 <p>00
5776 </p>
5777 !! end
5778
5779 !! test
5780 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5781 !! input
5782 {{CURRENTWEEK}}
5783 !! result
5784 <p>1
5785 </p>
5786 !! end
5787
5788 !! test
5789 Magic Word: {{CURRENTYEAR}}
5790 !! input
5791 {{CURRENTYEAR}}
5792 !! result
5793 <p>1970
5794 </p>
5795 !! end
5796
5797 !! test
5798 Magic Word: {{CURRENTTIMESTAMP}}
5799 !! input
5800 {{CURRENTTIMESTAMP}}
5801 !! result
5802 <p>19700101000203
5803 </p>
5804 !! end
5805
5806 !! test
5807 Magic Words LOCAL (UTC)
5808 !! input
5809 * {{LOCALMONTH}}
5810 * {{LOCALMONTH1}}
5811 * {{LOCALMONTHNAME}}
5812 * {{LOCALMONTHNAMEGEN}}
5813 * {{LOCALMONTHABBREV}}
5814 * {{LOCALDAY}}
5815 * {{LOCALDAY2}}
5816 * {{LOCALDAYNAME}}
5817 * {{LOCALYEAR}}
5818 * {{LOCALTIME}}
5819 * {{LOCALHOUR}}
5820 * {{LOCALWEEK}}
5821 * {{LOCALDOW}}
5822 * {{LOCALTIMESTAMP}}
5823 !! result
5824 <ul><li> 01
5825 </li><li> 1
5826 </li><li> January
5827 </li><li> January
5828 </li><li> Jan
5829 </li><li> 1
5830 </li><li> 01
5831 </li><li> Thursday
5832 </li><li> 1970
5833 </li><li> 00:02
5834 </li><li> 00
5835 </li><li> 1
5836 </li><li> 4
5837 </li><li> 19700101000203
5838 </li></ul>
5839
5840 !! end
5841
5842 !! test
5843 Magic Word: {{FULLPAGENAME}}
5844 !! options
5845 title=[[User:Ævar Arnfjörð Bjarmason]]
5846 !! input
5847 {{FULLPAGENAME}}
5848 !! result
5849 <p>User:Ævar Arnfjörð Bjarmason
5850 </p>
5851 !! end
5852
5853 !! test
5854 Magic Word: {{FULLPAGENAMEE}}
5855 !! options
5856 title=[[User:Ævar Arnfjörð Bjarmason]]
5857 !! input
5858 {{FULLPAGENAMEE}}
5859 !! result
5860 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5861 </p>
5862 !! end
5863
5864 !! test
5865 Magic Word: {{TALKSPACE}}
5866 !! options
5867 title=[[User:Ævar Arnfjörð Bjarmason]]
5868 !! input
5869 {{TALKSPACE}}
5870 !! result
5871 <p>User talk
5872 </p>
5873 !! end
5874
5875 !! test
5876 Magic Word: {{TALKSPACE}}, same namespace
5877 !! options
5878 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5879 !! input
5880 {{TALKSPACE}}
5881 !! result
5882 <p>User talk
5883 </p>
5884 !! end
5885
5886 !! test
5887 Magic Word: {{TALKSPACE}}, main namespace
5888 !! options
5889 title=[[Parser Test]]
5890 !! input
5891 {{TALKSPACE}}
5892 !! result
5893 <p>Talk
5894 </p>
5895 !! end
5896
5897 !! test
5898 Magic Word: {{TALKSPACEE}}
5899 !! options
5900 title=[[User:Ævar Arnfjörð Bjarmason]]
5901 !! input
5902 {{TALKSPACEE}}
5903 !! result
5904 <p>User_talk
5905 </p>
5906 !! end
5907
5908 !! test
5909 Magic Word: {{SUBJECTSPACE}}
5910 !! options
5911 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5912 !! input
5913 {{SUBJECTSPACE}}
5914 !! result
5915 <p>User
5916 </p>
5917 !! end
5918
5919 !! test
5920 Magic Word: {{SUBJECTSPACE}}, same namespace
5921 !! options
5922 title=[[User:Ævar Arnfjörð Bjarmason]]
5923 !! input
5924 {{SUBJECTSPACE}}
5925 !! result
5926 <p>User
5927 </p>
5928 !! end
5929
5930 !! test
5931 Magic Word: {{SUBJECTSPACE}}, main namespace
5932 !! options
5933 title=[[Parser Test]]
5934 !! input
5935 {{SUBJECTSPACE}}
5936 !! result
5937
5938 !! end
5939
5940 !! test
5941 Magic Word: {{SUBJECTSPACEE}}
5942 !! options
5943 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5944 !! input
5945 {{SUBJECTSPACEE}}
5946 !! result
5947 <p>User
5948 </p>
5949 !! end
5950
5951 !! test
5952 Magic Word: {{NAMESPACE}}
5953 !! options
5954 title=[[User:Ævar Arnfjörð Bjarmason]]
5955 !! input
5956 {{NAMESPACE}}
5957 !! result
5958 <p>User
5959 </p>
5960 !! end
5961
5962 !! test
5963 Magic Word: {{NAMESPACEE}}
5964 !! options
5965 title=[[User:Ævar Arnfjörð Bjarmason]]
5966 !! input
5967 {{NAMESPACEE}}
5968 !! result
5969 <p>User
5970 </p>
5971 !! end
5972
5973 !! test
5974 Magic Word: {{NAMESPACENUMBER}}
5975 !! options
5976 title=[[User:Ævar Arnfjörð Bjarmason]]
5977 !! input
5978 {{NAMESPACENUMBER}}
5979 !! result
5980 <p>2
5981 </p>
5982 !! end
5983
5984 !! test
5985 Magic Word: {{SUBPAGENAME}}
5986 !! options
5987 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5988 !! input
5989 {{SUBPAGENAME}}
5990 !! result
5991 <p>sub ö
5992 </p>
5993 !! end
5994
5995 !! test
5996 Magic Word: {{SUBPAGENAMEE}}
5997 !! options
5998 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5999 !! input
6000 {{SUBPAGENAMEE}}
6001 !! result
6002 <p>sub_%C3%B6
6003 </p>
6004 !! end
6005
6006 !! test
6007 Magic Word: {{ROOTPAGENAME}}
6008 !! options
6009 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6010 !! input
6011 {{ROOTPAGENAME}}
6012 !! result
6013 <p>Ævar Arnfjörð Bjarmason
6014 </p>
6015 !! end
6016
6017 !! test
6018 Magic Word: {{ROOTPAGENAMEE}}
6019 !! options
6020 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6021 !! input
6022 {{ROOTPAGENAMEE}}
6023 !! result
6024 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6025 </p>
6026 !! end
6027
6028 !! test
6029 Magic Word: {{BASEPAGENAME}}
6030 !! options
6031 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6032 !! input
6033 {{BASEPAGENAME}}
6034 !! result
6035 <p>Ævar Arnfjörð Bjarmason
6036 </p>
6037 !! end
6038
6039 !! test
6040 Magic Word: {{BASEPAGENAMEE}}
6041 !! options
6042 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6043 !! input
6044 {{BASEPAGENAMEE}}
6045 !! result
6046 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6047 </p>
6048 !! end
6049
6050 !! test
6051 Magic Word: {{TALKPAGENAME}}
6052 !! options
6053 title=[[User:Ævar Arnfjörð Bjarmason]]
6054 !! input
6055 {{TALKPAGENAME}}
6056 !! result
6057 <p>User talk:Ævar Arnfjörð Bjarmason
6058 </p>
6059 !! end
6060
6061 !! test
6062 Magic Word: {{TALKPAGENAMEE}}
6063 !! options
6064 title=[[User:Ævar Arnfjörð Bjarmason]]
6065 !! input
6066 {{TALKPAGENAMEE}}
6067 !! result
6068 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6069 </p>
6070 !! end
6071
6072 !! test
6073 Magic Word: {{SUBJECTPAGENAME}}
6074 !! options
6075 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6076 !! input
6077 {{SUBJECTPAGENAME}}
6078 !! result
6079 <p>User:Ævar Arnfjörð Bjarmason
6080 </p>
6081 !! end
6082
6083 !! test
6084 Magic Word: {{SUBJECTPAGENAMEE}}
6085 !! options
6086 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6087 !! input
6088 {{SUBJECTPAGENAMEE}}
6089 !! result
6090 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6091 </p>
6092 !! end
6093
6094 !! test
6095 Magic Word: {{NUMBEROFFILES}}
6096 !! input
6097 {{NUMBEROFFILES}}
6098 !! result
6099 <p>4
6100 </p>
6101 !! end
6102
6103 !! test
6104 Magic Word: {{PAGENAME}}
6105 !! options
6106 title=[[User:Ævar Arnfjörð Bjarmason]]
6107 !! input
6108 {{PAGENAME}}
6109 !! result
6110 <p>Ævar Arnfjörð Bjarmason
6111 </p>
6112 !! end
6113
6114 !! test
6115 Magic Word: {{PAGENAME}} with metacharacters
6116 !! options
6117 title=[['foo & bar = baz']]
6118 !! input
6119 ''{{PAGENAME}}''
6120 !! result
6121 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6122 </p>
6123 !! end
6124
6125 !! test
6126 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6127 !! options
6128 title=[[*RFC 1234 http://example.com/]]
6129 !! input
6130 {{PAGENAME}}
6131 !! result
6132 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6133 </p>
6134 !! end
6135
6136 !! test
6137 Magic Word: {{PAGENAMEE}}
6138 !! options
6139 title=[[User:Ævar Arnfjörð Bjarmason]]
6140 !! input
6141 {{PAGENAMEE}}
6142 !! result
6143 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6144 </p>
6145 !! end
6146
6147 !! test
6148 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6149 !! options
6150 title=[[*RFC 1234 http://example.com/]]
6151 !! input
6152 {{PAGENAMEE}}
6153 !! result
6154 <p>&#42;RFC_1234_http&#58;//example.com/
6155 </p>
6156 !! end
6157
6158 !! test
6159 Magic Word: {{REVISIONID}}
6160 !! input
6161 {{REVISIONID}}
6162 !! result
6163 <p>1337
6164 </p>
6165 !! end
6166
6167 !! test
6168 Magic Word: {{SCRIPTPATH}}
6169 !! input
6170 {{SCRIPTPATH}}
6171 !! result
6172 <p>/
6173 </p>
6174 !! end
6175
6176 !! test
6177 Magic Word: {{STYLEPATH}}
6178 !! input
6179 {{STYLEPATH}}
6180 !! result
6181 <p>/skins
6182 </p>
6183 !! end
6184
6185 !! test
6186 Magic Word: {{SERVER}}
6187 !! input
6188 {{SERVER}}
6189 !! result
6190 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6191 </p>
6192 !! end
6193
6194 !! test
6195 Magic Word: {{SERVERNAME}}
6196 !! input
6197 {{SERVERNAME}}
6198 !! result
6199 <p>example.org
6200 </p>
6201 !! end
6202
6203 !! test
6204 Magic Word: {{SITENAME}}
6205 !! input
6206 {{SITENAME}}
6207 !! result
6208 <p>MediaWiki
6209 </p>
6210 !! end
6211
6212 !! test
6213 Case-sensitive magic words, when cased differently, should just be template transclusions
6214 !! input
6215 {{CurrentMonth}}
6216 {{currentday}}
6217 {{cURreNTweEK}}
6218 {{currentHour}}
6219 !! result
6220 <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>
6221 <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>
6222 <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>
6223 <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>
6224 </p>
6225 !! end
6226
6227 !! test
6228 Case-insensitive magic words should still work with weird casing.
6229 !! input
6230 {{sErVeRNaMe}}
6231 {{LCFirst:AOEU}}
6232 {{ucFIRST:aoeu}}
6233 {{SERver}}
6234 !! result
6235 <p>example.org
6236 aOEU
6237 Aoeu
6238 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6239 </p>
6240 !! end
6241
6242 !! test
6243 Namespace 1 {{ns:1}}
6244 !! input
6245 {{ns:1}}
6246 !! result
6247 <p>Talk
6248 </p>
6249 !! end
6250
6251 !! test
6252 Namespace 1 {{ns:01}}
6253 !! input
6254 {{ns:01}}
6255 !! result
6256 <p>Talk
6257 </p>
6258 !! end
6259
6260 !! test
6261 Namespace 0 {{ns:0}} (bug 4783)
6262 !! input
6263 {{ns:0}}
6264 !! result
6265
6266 !! end
6267
6268 !! test
6269 Namespace 0 {{ns:00}} (bug 4783)
6270 !! input
6271 {{ns:00}}
6272 !! result
6273
6274 !! end
6275
6276 !! test
6277 Namespace -1 {{ns:-1}}
6278 !! input
6279 {{ns:-1}}
6280 !! result
6281 <p>Special
6282 </p>
6283 !! end
6284
6285 !! test
6286 Namespace User {{ns:User}}
6287 !! input
6288 {{ns:User}}
6289 !! result
6290 <p>User
6291 </p>
6292 !! end
6293
6294 !! test
6295 Namespace User talk {{ns:User_talk}}
6296 !! input
6297 {{ns:User_talk}}
6298 !! result
6299 <p>User talk
6300 </p>
6301 !! end
6302
6303 !! test
6304 Namespace User talk {{ns:uSeR tAlK}}
6305 !! input
6306 {{ns:uSeR tAlK}}
6307 !! result
6308 <p>User talk
6309 </p>
6310 !! end
6311
6312 !! test
6313 Namespace File {{ns:File}}
6314 !! input
6315 {{ns:File}}
6316 !! result
6317 <p>File
6318 </p>
6319 !! end
6320
6321 !! test
6322 Namespace File {{ns:Image}}
6323 !! input
6324 {{ns:Image}}
6325 !! result
6326 <p>File
6327 </p>
6328 !! end
6329
6330 !! test
6331 Namespace (lang=de) Benutzer {{ns:User}}
6332 !! options
6333 language=de
6334 !! input
6335 {{ns:User}}
6336 !! result
6337 <p>Benutzer
6338 </p>
6339 !! end
6340
6341 !! test
6342 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6343 !! options
6344 language=de
6345 !! input
6346 {{ns:3}}
6347 !! result
6348 <p>Benutzer Diskussion
6349 </p>
6350 !! end
6351
6352
6353 !! test
6354 Urlencode
6355 !! input
6356 {{urlencode:hi world?!}}
6357 {{urlencode:hi world?!|WIKI}}
6358 {{urlencode:hi world?!|PATH}}
6359 {{urlencode:hi world?!|QUERY}}
6360 !! result
6361 <p>hi+world%3F%21
6362 hi_world%3F!
6363 hi%20world%3F%21
6364 hi+world%3F%21
6365 </p>
6366 !! end
6367
6368 ###
6369 ### Magic links
6370 ###
6371 !! test
6372 Magic links: internal link to RFC (bug 479)
6373 !! input
6374 [[RFC 123]]
6375 !! result
6376 <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>
6377 </p>
6378 !! end
6379
6380 !! test
6381 Magic links: RFC (bug 479)
6382 !! input
6383 RFC 822
6384 !! result
6385 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6386 </p>
6387 !! end
6388
6389 !! test
6390 Magic links: ISBN (bug 1937)
6391 !! input
6392 ISBN 0-306-40615-2
6393 !! result
6394 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6395 </p>
6396 !! end
6397
6398 !! test
6399 Magic links: PMID incorrectly converts space to underscore
6400 !! input
6401 PMID 1234
6402 !! result
6403 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6404 </p>
6405 !! end
6406
6407 ###
6408 ### Templates
6409 ####
6410
6411 !! test
6412 Nonexistent template
6413 !! input
6414 {{thistemplatedoesnotexist}}
6415 !! result
6416 <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>
6417 </p>
6418 !! end
6419
6420 !! test
6421 Template with invalid target containing tags
6422 !! input
6423 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6424 !! result
6425 <p>{{a<b>b</b>|foo|a=b|a = b}}
6426 </p>
6427 !! end
6428
6429 !! test
6430 Template with invalid target containing unclosed tag
6431 !! input
6432 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6433 !! result
6434 <p>{{a<b>|foo|a=b|a = b}}</b>
6435 </p>
6436 !! end
6437
6438 !! article
6439 Template:test
6440 !! text
6441 This is a test template
6442 !! endarticle
6443
6444 !! test
6445 Simple template
6446 !! input
6447 {{test}}
6448 !! result
6449 <p>This is a test template
6450 </p>
6451 !! end
6452
6453 !! test
6454 Template with explicit namespace
6455 !! input
6456 {{Template:test}}
6457 !! result
6458 <p>This is a test template
6459 </p>
6460 !! end
6461
6462
6463 !! article
6464 Template:paramtest
6465 !! text
6466 This is a test template with parameter {{{param}}}
6467 !! endarticle
6468
6469 !! test
6470 Template parameter
6471 !! input
6472 {{paramtest|param=foo}}
6473 !! result
6474 <p>This is a test template with parameter foo
6475 </p>
6476 !! end
6477
6478 !! article
6479 Template:paramtestnum
6480 !! text
6481 [[{{{1}}}|{{{2}}}]]
6482 !! endarticle
6483
6484 !! test
6485 Template unnamed parameter
6486 !! input
6487 {{paramtestnum|Main Page|the main page}}
6488 !! result
6489 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6490 </p>
6491 !! end
6492
6493 !! article
6494 Template:templatesimple
6495 !! text
6496 (test)
6497 !! endarticle
6498
6499 !! article
6500 Template:templateredirect
6501 !! text
6502 #redirect [[Template:templatesimple]]
6503 !! endarticle
6504
6505 !! article
6506 Template:templateasargtestnum
6507 !! text
6508 {{{{{1}}}}}
6509 !! endarticle
6510
6511 !! article
6512 Template:templateasargtest
6513 !! text
6514 {{template{{{templ}}}}}
6515 !! endarticle
6516
6517 !! article
6518 Template:templateasargtest2
6519 !! text
6520 {{{{{templ}}}}}
6521 !! endarticle
6522
6523 !! test
6524 Template with template name as unnamed argument
6525 !! input
6526 {{templateasargtestnum|templatesimple}}
6527 !! result
6528 <p>(test)
6529 </p>
6530 !! end
6531
6532 !! test
6533 Template with template name as argument
6534 !! input
6535 {{templateasargtest|templ=simple}}
6536 !! result
6537 <p>(test)
6538 </p>
6539 !! end
6540
6541 !! test
6542 Template with template name as argument (2)
6543 !! input
6544 {{templateasargtest2|templ=templatesimple}}
6545 !! result
6546 <p>(test)
6547 </p>
6548 !! end
6549
6550 !! article
6551 Template:templateasargtestdefault
6552 !! text
6553 {{{{{templ|templatesimple}}}}}
6554 !! endarticle
6555
6556 !! article
6557 Template:templa
6558 !! text
6559 '''templ'''
6560 !! endarticle
6561
6562 !! test
6563 Template with default value
6564 !! input
6565 {{templateasargtestdefault}}
6566 !! result
6567 <p>(test)
6568 </p>
6569 !! end
6570
6571 !! test
6572 Template with default value (value set)
6573 !! input
6574 {{templateasargtestdefault|templ=templa}}
6575 !! result
6576 <p><b>templ</b>
6577 </p>
6578 !! end
6579
6580 !! test
6581 Template redirect
6582 !! input
6583 {{templateredirect}}
6584 !! result
6585 <p>(test)
6586 </p>
6587 !! end
6588
6589 !! test
6590 Template with argument in separate line
6591 !! input
6592 {{ templateasargtest |
6593 templ = simple }}
6594 !! result
6595 <p>(test)
6596 </p>
6597 !! end
6598
6599 !! test
6600 Template with complex template as argument
6601 !! input
6602 {{paramtest|
6603 param ={{ templateasargtest |
6604 templ = simple }}}}
6605 !! result
6606 <p>This is a test template with parameter (test)
6607 </p>
6608 !! end
6609
6610 !! test
6611 Template with thumb image (with link in description)
6612 !! input
6613 {{paramtest|
6614 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6615 !! result
6616 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>
6617
6618 !! end
6619
6620 !! article
6621 Template:complextemplate
6622 !! text
6623 {{{1}}} {{paramtest|
6624 param ={{{param}}}}}
6625 !! endarticle
6626
6627 !! test
6628 Template with complex arguments
6629 !! input
6630 {{complextemplate|
6631 param ={{ templateasargtest |
6632 templ = simple }}|[[Template:complextemplate|link]]}}
6633 !! result
6634 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6635 </p>
6636 !! end
6637
6638 !! test
6639 BUG 553: link with two variables in a piped link
6640 !! input
6641 {|
6642 |[[{{{1}}}|{{{2}}}]]
6643 |}
6644 !! result
6645 <table>
6646 <tr>
6647 <td>[[{{{1}}}|{{{2}}}]]
6648 </td></tr></table>
6649
6650 !! end
6651
6652 !! test
6653 Magic variable as template parameter
6654 !! input
6655 {{paramtest|param={{SITENAME}}}}
6656 !! result
6657 <p>This is a test template with parameter MediaWiki
6658 </p>
6659 !! end
6660
6661 !! article
6662 Template:linktest
6663 !! text
6664 [[{{{param}}}|link]]
6665 !! endarticle
6666
6667 !! test
6668 Template parameter as link source
6669 !! input
6670 {{linktest|param=Main Page}}
6671 !! result
6672 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6673 </p>
6674 !! end
6675
6676 !!test
6677 Template-generated attribute string (k='v')
6678 !!input
6679 <span {{attr_str|id|v1}}>bar</span>
6680 !!result
6681 <p><span id="v1">bar</span>
6682 </p>
6683 !!end
6684
6685 !!article
6686 Template:paramtest2
6687 !! text
6688 including another template, {{paramtest|param={{{arg}}}}}
6689 !! endarticle
6690
6691 !! test
6692 Template passing argument to another template
6693 !! input
6694 {{paramtest2|arg='hmm'}}
6695 !! result
6696 <p>including another template, This is a test template with parameter 'hmm'
6697 </p>
6698 !! end
6699
6700 !! article
6701 Template:Linktest2
6702 !! text
6703 Main Page
6704 !! endarticle
6705
6706 !! test
6707 Template as link source
6708 !! input
6709 [[{{linktest2}}]]
6710
6711 [[{{linktest2}}|Main Page]]
6712
6713 [[{{linktest2}}]]Page
6714 !! result
6715 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6716 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6717 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6718 </p>
6719 !! end
6720
6721
6722 !! article
6723 Template:loop1
6724 !! text
6725 {{loop2}}
6726 !! endarticle
6727
6728 !! article
6729 Template:loop2
6730 !! text
6731 {{loop1}}
6732 !! endarticle
6733
6734 !! test
6735 Template infinite loop
6736 !! input
6737 {{loop1}}
6738 !! result
6739 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6740 </p>
6741 !! end
6742
6743 !! test
6744 Template from main namespace
6745 !! input
6746 {{:Main Page}}
6747 !! result
6748 <p>blah blah
6749 </p>
6750 !! end
6751
6752 !! article
6753 Template:table
6754 !! text
6755 {|
6756 | 1 || 2
6757 |-
6758 | 3 || 4
6759 |}
6760 !! endarticle
6761
6762 !! test
6763 BUG 529: Template with table, not included at beginning of line
6764 !! input
6765 foo {{table}}
6766 !! result
6767 <p>foo
6768 </p>
6769 <table>
6770 <tr>
6771 <td> 1 </td>
6772 <td> 2
6773 </td></tr>
6774 <tr>
6775 <td> 3 </td>
6776 <td> 4
6777 </td></tr></table>
6778
6779 !! end
6780
6781 !! test
6782 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6783 !! input
6784 foo
6785 {{table}}
6786 !! result
6787 <p>foo
6788 </p>
6789 <table>
6790 <tr>
6791 <td> 1 </td>
6792 <td> 2
6793 </td></tr>
6794 <tr>
6795 <td> 3 </td>
6796 <td> 4
6797 </td></tr></table>
6798
6799 !! end
6800
6801 !! test
6802 BUG 41: Template parameters shown as broken links
6803 !! input
6804 {{{parameter}}}
6805 !! result
6806 <p>{{{parameter}}}
6807 </p>
6808 !! end
6809
6810 !! test
6811 Template with targets containing wikilinks
6812 !! input
6813 {{[[foo]]}}
6814
6815 {{[[{{echo|foo}}]]}}
6816
6817 {{{{echo|[[foo}}]]}}
6818 !! result
6819 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6820 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6821 </p><p>{{[[foo}}]]
6822 </p>
6823 !! end
6824
6825 !! article
6826 Template:MSGNW test
6827 !! text
6828 ''None'' of '''this''' should be
6829 * interpreted
6830 but rather passed unmodified
6831 {{test}}
6832 !! endarticle
6833
6834 # hmm, fix this or just deprecate msgnw and document its behavior?
6835 !! test
6836 msgnw keyword
6837 !! options
6838 disabled
6839 !! input
6840 {{msgnw:MSGNW test}}
6841 !! result
6842 <p>''None'' of '''this''' should be
6843 * interpreted
6844 but rather passed unmodified
6845 {{test}}
6846 </p>
6847 !! end
6848
6849 !! test
6850 int keyword
6851 !! input
6852 {{int:youhavenewmessages|lots of money|not!}}
6853 !! result
6854 <p>You have lots of money (not!).
6855 </p>
6856 !! end
6857
6858 !! article
6859 Template:Includes
6860 !! text
6861 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6862 !! endarticle
6863
6864 !! test
6865 <includeonly> and <noinclude> being included
6866 !! input
6867 {{Includes}}
6868 !! result
6869 <p>Foobar
6870 </p>
6871 !! end
6872
6873 !! article
6874 Template:Includes2
6875 !! text
6876 <onlyinclude>Foo</onlyinclude>bar
6877 !! endarticle
6878
6879 !! test
6880 <onlyinclude> being included
6881 !! input
6882 {{Includes2}}
6883 !! result
6884 <p>Foo
6885 </p>
6886 !! end
6887
6888
6889 !! article
6890 Template:Includes3
6891 !! text
6892 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6893 !! endarticle
6894
6895 !! test
6896 <onlyinclude> and <includeonly> being included
6897 !! input
6898 {{Includes3}}
6899 !! result
6900 <p>Foo
6901 </p>
6902 !! end
6903
6904 !! test
6905 <includeonly> and <noinclude> on a page
6906 !! input
6907 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6908 !! result
6909 <p>Foozar
6910 </p>
6911 !! end
6912
6913 !! test
6914 Un-closed <noinclude>
6915 !! input
6916 <noinclude>
6917 !! result
6918 !! end
6919
6920 !! test
6921 <onlyinclude> on a page
6922 !! input
6923 <onlyinclude>Foo</onlyinclude>bar
6924 !! result
6925 <p>Foobar
6926 </p>
6927 !! end
6928
6929 !! test
6930 Un-closed <onlyinclude>
6931 !! input
6932 <onlyinclude>
6933 !! result
6934 !! end
6935
6936 !!test
6937 Self-closed noinclude, includeonly, onlyinclude tags
6938 !!input
6939 <noinclude />
6940 <includeonly />
6941 <onlyinclude />
6942 !!result
6943 <p><br />
6944 </p>
6945 !!end
6946
6947 !!test
6948 Unbalanced includeonly and noinclude tags
6949 !!input
6950 {|
6951 |a</noinclude>
6952 |b</noinclude></noinclude>
6953 |c</noinclude></includeonly>
6954 |d</includeonly></includeonly>
6955 |}
6956 !!result
6957 <table>
6958 <tr>
6959 <td>a
6960 </td>
6961 <td>b
6962 </td>
6963 <td>c&lt;/includeonly&gt;
6964 </td>
6965 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6966 </td></tr></table>
6967
6968 !!end
6969
6970 !! article
6971 Template:Includeonly section
6972 !! text
6973 <includeonly>
6974 ==Includeonly section==
6975 </includeonly>
6976 ==Section T-1==
6977 !!endarticle
6978
6979 !! test
6980 Bug 6563: Edit link generation for section shown by <includeonly>
6981 !! input
6982 {{includeonly section}}
6983 !! result
6984 <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>
6985 <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>
6986
6987 !! end
6988
6989 # Uses same input as the contents of [[Template:Includeonly section]]
6990 !! test
6991 Bug 6563: Section extraction for section shown by <includeonly>
6992 !! options
6993 section=T-2
6994 !! input
6995 <includeonly>
6996 ==Includeonly section==
6997 </includeonly>
6998 ==Section T-2==
6999 !! result
7000 ==Section T-2==
7001 !! end
7002
7003 !! test
7004 Bug 6563: Edit link generation for section suppressed by <includeonly>
7005 !! input
7006 <includeonly>
7007 ==Includeonly section==
7008 </includeonly>
7009 ==Section 1==
7010 !! result
7011 <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>
7012
7013 !! end
7014
7015 !! test
7016 Bug 6563: Section extraction for section suppressed by <includeonly>
7017 !! options
7018 section=1
7019 !! input
7020 <includeonly>
7021 ==Includeonly section==
7022 </includeonly>
7023 ==Section 1==
7024 !! result
7025 ==Section 1==
7026 !! end
7027
7028 !! test
7029 Un-closed <includeonly>
7030 !! input
7031 <includeonly>
7032 !! result
7033 !! end
7034
7035 # TODO: test with DOM fragment reuse!
7036 !! test
7037 Parsoid: DOM fragment reuse
7038 !! options
7039 parsoid=wt2wt,wt2html
7040 !! input
7041 a{{echo|b<table></table>c}}d
7042
7043 a{{echo|b
7044 <table></table>
7045 c}}d
7046
7047 {{echo|a
7048
7049 <table></table>
7050
7051 b}}
7052 !! result
7053 a<span typeof="mw:Transclusion">b</span>
7054 <table></table><span>c</span>d
7055 <p typeof="mw:Transclusion">ab</p>
7056 <table></table>
7057 <p>cd</p>
7058 <p typeof="mw:Transclusion">a</p>
7059 <table></table>
7060 <p>b</p>
7061 !! end
7062
7063 ###
7064 ### <includeonly> and <noinclude> in attributes
7065 ###
7066 !!test
7067 0. includeonly around the entire attribute
7068 !!input
7069 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7070 !!result
7071 <p><span id="v2">bar</span>
7072 </p>
7073 !!end
7074
7075 !!test
7076 1. includeonly in html attr key
7077 !!input
7078 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7079 !!result
7080 <p><span id="foo">bar</span>
7081 </p>
7082 !!end
7083
7084 !!test
7085 2. includeonly in html attr value
7086 !!input
7087 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7088 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7089 !!result
7090 <p><span id="v1">bar</span>
7091 <span id="v1">bar</span>
7092 </p>
7093 !!end
7094
7095 !!test
7096 3. includeonly in part of an attr value
7097 !!input
7098 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7099 !!result
7100 <p><span style="color:red;">bar</span>
7101 </p>
7102 !!end
7103
7104 ###
7105 ### Testing parsing of templates where a template arg
7106 ### has the same name as the template itself.
7107 ###
7108
7109 !! article
7110 Template:quote
7111 !! text
7112 {{{quote|{{{1}}}}}}
7113 !! endarticle
7114
7115 !!test
7116 Templates: Template Name/Arg clash: 1. Use of positional param
7117 !!input
7118 {{quote|foo}}
7119 !!result
7120 <p>foo
7121 </p>
7122 !!end
7123
7124 !!test
7125 Templates: Template Name/Arg clash: 2. Use of named param
7126 !!input
7127 {{quote|quote=foo}}
7128 !!result
7129 <p>foo
7130 </p>
7131 !!end
7132
7133 !!test
7134 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7135 !!input
7136 {{quote|quote}}
7137 !!result
7138 <p>quote
7139 </p>
7140 !!end
7141
7142 ###
7143 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7144 ###
7145
7146 !!test
7147 Templates: 1. Simple use
7148 !!input
7149 {{echo|Foo}}
7150 !!result
7151 <p>Foo
7152 </p>
7153 !!end
7154
7155 !!test
7156 Templates: 2. Inside a block tag
7157 !!input
7158 <div>{{echo|Foo}}</div>
7159 !!result
7160 <div>Foo</div>
7161
7162 !!end
7163
7164 !!test
7165 Templates: P-wrapping: 1a. Templates on consecutive lines
7166 !!input
7167 {{echo|Foo}}
7168 {{echo|bar}}
7169 !!result
7170 <p>Foo
7171 bar
7172 </p>
7173 !!end
7174
7175 !!test
7176 Templates: P-wrapping: 1b. Templates on consecutive lines
7177 !!input
7178 Foo
7179
7180 {{echo|bar}}
7181 {{echo|baz}}
7182 !!result
7183 <p>Foo
7184 </p><p>bar
7185 baz
7186 </p>
7187 !!end
7188
7189 !!test
7190 Templates: P-wrapping: 1c. Templates on consecutive lines
7191 !!input
7192 {{echo|Foo}}
7193 {{echo|bar}} <div>baz</div>
7194 !!result
7195 <p>Foo
7196 </p>
7197 bar <div>baz</div>
7198
7199 !!end
7200
7201 !!test
7202 Templates: P-wrapping: 1d. Template preceded by comment-only line
7203 !!options
7204 parsoid=wt2html,wt2wt
7205 !!input
7206 <!-- foo -->
7207 {{echo|Bar}}
7208 !!result
7209 <!-- foo -->
7210 <p typeof="mw:Transclusion">Bar
7211 </p>
7212 !!end
7213
7214 !!test
7215 Templates: Inline Text: 1. Multiple tmeplate uses
7216 !!input
7217 {{echo|Foo}}bar{{echo|baz}}
7218 !!result
7219 <p>Foobarbaz
7220 </p>
7221 !!end
7222
7223 !!test
7224 Templates: Inline Text: 2. Back-to-back template uses
7225 !!input
7226 {{echo|Foo}}{{echo|bar}}
7227 !!result
7228 <p>Foobar
7229 </p>
7230 !!end
7231
7232 !!test
7233 Templates: Block Tags: 1. Multiple template uses
7234 !!input
7235 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7236 !!result
7237 <div>Foo</div><div>bar</div><div>baz</div>
7238
7239 !!end
7240
7241 !!test
7242 Templates: Block Tags: 2. Back-to-back template uses
7243 !!input
7244 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7245 !!result
7246 <div>Foo</div><div>bar</div>
7247
7248 !!end
7249
7250 !!test
7251 Templates: Links: 1. Simple example
7252 !!input
7253 {{echo|[[Foo|bar]]}}
7254 !!result
7255 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7256 </p>
7257 !!end
7258
7259 !!test
7260 Templates: Links: 2. Generation of link href
7261 !!input
7262 [[{{echo|Foo}}|bar]]
7263 !!result
7264 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7265 </p>
7266 !!end
7267
7268 !!test
7269 Templates: Links: 3. Generation of part of a link href
7270 !!input
7271 [[Fo{{echo|o}}|bar]]
7272
7273 [[Foo{{echo|bar}}]]
7274
7275 [[Foo{{echo|bar}}baz]]
7276
7277 [[Foo{{echo|bar}}|bar]]
7278
7279 [[:Foo{{echo|bar}}]]
7280
7281 [[:Foo{{echo|bar}}|bar]]
7282 !!result
7283 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7284 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7285 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7286 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7287 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7288 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7289 </p>
7290 !!end
7291
7292 !!test
7293 Templates: Links: 4. Multiple templates generating link href
7294 !!input
7295 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7296 !!result
7297 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7298 </p>
7299 !!end
7300
7301 !!test
7302 Templates: Links: 5. Generation of link text
7303 !!input
7304 [[Foo|{{echo|bar}}]]
7305 !!result
7306 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7307 </p>
7308 !!end
7309
7310 !!test
7311 Templates: Links: 5. Nested templates (only outermost template should be marked)
7312 !!input
7313 {{echo|[[{{echo|Foo}}|bar]]}}
7314 !!result
7315 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7316 </p>
7317 !!end
7318
7319 !!test
7320 Templates: HTML Tag: 1. Generation of HTML attr. key
7321 !!input
7322 <div {{echo|style}}="color:red;">foo</div>
7323 !!result
7324 <div style="color:red;">foo</div>
7325
7326 !!end
7327
7328 !!test
7329 Templates: HTML Tag: 2. Generation of HTML attr. value
7330 !!input
7331 <div style={{echo|'color:red;'}}>foo</div>
7332 !!result
7333 <div style="color:red;">foo</div>
7334
7335 !!end
7336
7337 !!test
7338 Templates: HTML Tag: 3. Generation of HTML attr key and value
7339 !!input
7340 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7341 !!result
7342 <div style="color:red;">foo</div>
7343
7344 !!end
7345
7346 !!test
7347 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7348 !!input
7349 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7350 !!result
7351 <div title="This is a long title with just one piece templated">foo</div>
7352
7353 !!end
7354
7355 !!test
7356 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7357 !!input
7358 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7359 !!result
7360 <div title="This is a long title with just one piece templated">foo</div>
7361
7362 !!end
7363
7364 !!test
7365 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7366 !!input
7367 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7368 !!result
7369 <div title="This is a long title with just one piece templated">foo</div>
7370
7371 !!end
7372
7373 !!test
7374 Templates: HTML Tag: 7. Generation of partial attribute key string
7375 !!input
7376 <div st{{echo|yle}}="color:red;">foo</div>
7377 !!result
7378 <div style="color:red;">foo</div>
7379
7380 !!end
7381
7382 !!test
7383 Templates: HTML Tables: 1. Generating start of a HTML table
7384 !!input
7385 {{echo|<table><tr><td>foo</td>}}</tr></table>
7386 !!result
7387 <table><tr><td>foo</td></tr></table>
7388
7389 !!end
7390
7391 !!test
7392 Templates: HTML Tables: 2a. Generating middle of a HTML table
7393 !!input
7394 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7395 !!result
7396 <table><tr><td>foo</td></tr></table>
7397
7398 !!end
7399
7400 !!test
7401 Templates: HTML Tables: 2b. Generating middle of a HTML table
7402 !!input
7403 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7404 !!result
7405 <table><tr><td>foo</td></tr></table>
7406
7407 !!end
7408
7409 !!test
7410 Templates: HTML Tables: 3. Generating end of a HTML table
7411 !!input
7412 <table><tr>{{echo|<td>foo</td></tr></table>}}
7413 !!result
7414 <table><tr><td>foo</td></tr></table>
7415
7416 !!end
7417
7418 !!test
7419 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7420 !!input
7421 {{echo|<table>}}<tr><td>foo</td></tr></table>
7422 !!result
7423 <table><tr><td>foo</td></tr></table>
7424
7425 !!end
7426
7427 !!test
7428 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7429 !!input
7430 <table>{{echo|<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: 4c. Generating a single tag 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: 4d. Generating a single tag of a HTML table
7447 !!input
7448 <table><tr><td>foo{{echo|</td>}}</tr></table>
7449 !!result
7450 <table><tr><td>foo</td></tr></table>
7451
7452 !!end
7453
7454 !!test
7455 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7456 !!input
7457 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7458 !!result
7459 <table><tr><td>foo</td></tr></table>
7460
7461 !!end
7462
7463 !!test
7464 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7465 !!input
7466 <table><tr><td>foo</td></tr>{{echo|</table>}}
7467 !!result
7468 <table><tr><td>foo</td></tr></table>
7469
7470 !!end
7471
7472 !!test
7473 Templates: HTML Tables: 5. Proper fostering of categories from inside
7474 !!options
7475 parsoid=wt2html,wt2wt
7476 !!input
7477 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7478 <!--Two categories (Bug 50330)-->
7479 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7480 !!result
7481 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7482 <!--Two categories (Bug 50330)-->
7483 <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>
7484 !!end
7485
7486 !!test
7487 Templates: Wiki Tables: 1a. Fostering of entire template content
7488 !!input
7489 {|
7490 {{echo|a}}
7491 |}
7492 !!result
7493 <table>
7494 a
7495 <tr><td></td></tr></table>
7496
7497 !!end
7498
7499 !!test
7500 Templates: Wiki Tables: 1b. Fostering of entire template content
7501 !!input
7502 {|
7503 {{echo|<div>}}
7504 foo
7505 {{echo|</div>}}
7506 |}
7507 !!result
7508 <table>
7509 <div>
7510 <p>foo
7511 </p>
7512 </div>
7513 <tr><td></td></tr></table>
7514
7515 !!end
7516
7517 !!test
7518 Templates: Wiki Tables: 2. Fostering of partial template content
7519 !!input
7520 {|
7521 {{echo|a
7522 <div>b</div>}}
7523 |}
7524 !!result
7525 <table>
7526 a
7527 <div>b</div>
7528 <tr><td></td></tr></table>
7529
7530 !!end
7531
7532 !!test
7533 Templates: Wiki Tables: 3. td-content via multiple templates
7534 !!input
7535 {|
7536 {{echo|{{pipe}}a}}{{echo|b}}
7537 |}
7538 !!result
7539 <table>
7540 <tr>
7541 <td>ab
7542 </td></tr></table>
7543
7544 !!end
7545
7546 !!test
7547 Templates: Wiki Tables: 4. Templated tags, no content
7548 !!input
7549 {{tbl-start}}
7550 {{tbl-end}}
7551 !!result
7552 <table>
7553 <tr><td></td></tr></table>
7554
7555 !!end
7556
7557 !!test
7558 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7559 !!input
7560 {{tbl-start}}
7561 |foo
7562 {{tbl-end}}
7563 !!result
7564 <table>
7565 <tr>
7566 <td>foo
7567 </td></tr></table>
7568
7569 !!end
7570
7571 !!test
7572 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7573 !!input
7574 {{tbl-start}}
7575 {{!}}foo
7576 {{tbl-end}}
7577 !!result
7578 <table>
7579 <tr>
7580 <td>foo
7581 </td></tr></table>
7582
7583 !!end
7584
7585 !!test
7586 Templates: Lists: Multi-line list-items via templates
7587 !!input
7588 *{{echo|a {{nonexistent|
7589 unused}}}}
7590 *{{echo|b {{nonexistent|
7591 unused}}}}
7592 !!result
7593 <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>
7594 </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>
7595 </li></ul>
7596
7597 !!end
7598
7599 !!test
7600 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7601 !!input
7602 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7603 !!result
7604 <p><i>ab</i>c<i>d</i>e
7605 </p>
7606 !!end
7607
7608 !!test
7609 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7610 (PHP parser generates misnested html)
7611 !! options
7612 parsoid=wt2html,wt2wt
7613 !!input
7614 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7615 !!result
7616 <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>
7617 !!end
7618
7619 !!test
7620 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7621 (PHP parser generates misnested html)
7622 !! options
7623 parsoid=wt2html,wt2wt
7624 !!input
7625 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7626 !!result
7627 <div typeof="mw:Transclusion"><i>a</i></div>
7628 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7629 <div typeof="mw:Transclusion">e</div>
7630 !!end
7631
7632 !!test
7633 Templates: Ugly nesting: 4. Divs opened/closed across templates
7634 !!input
7635 a<div>b{{echo|c</div>d}}e
7636 !!result
7637 a<div>bc</div>de
7638
7639 !!end
7640
7641 !!test
7642 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7643 (Parsoid-centric)
7644 !! options
7645 parsoid
7646 !!input
7647 {|
7648 |{{echo|foo</table>}}
7649 |bar
7650 |}
7651 !!result
7652 <table typeof="mw:Transclusion">
7653 <tbody>
7654 <tr>
7655 <td>foo</td></tr></tbody></table><span>bar</span>
7656 !!end
7657
7658 !!test
7659 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7660 (Parsoid-centric)
7661 !! options
7662 parsoid
7663 !!input
7664 <table>
7665 <tr>
7666 <td>
7667 <table>
7668 <tr>
7669 <td>1. {{echo|foo </table>}}</td>
7670 <td> bar </td>
7671 <td>2. {{echo|baz </table>}}</td>
7672 </tr>
7673 <tr>
7674 <td>abc</td>
7675 </tr>
7676 </table>
7677 </td>
7678 </tr>
7679 <tr>
7680 <td>xyz</td>
7681 </tr>
7682 </table>
7683 !!result
7684 <table about="#mwt1" typeof="mw:Transclusion">
7685 <tbody><tr >
7686 <td >
7687 <table >
7688 <tbody><tr >
7689 <td >1. foo </td></tr></tbody></table></td>
7690 <td > bar </td>
7691 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7692 </span><span about="#mwt1">
7693
7694 abc</span><span about="#mwt1">
7695 </span><span about="#mwt1">
7696 </span><span about="#mwt1">
7697 </span><span about="#mwt1">
7698 </span><span about="#mwt1">
7699
7700 xyz</span><span about="#mwt1">
7701 </span><span about="#mwt1">
7702 </span>
7703 !!end
7704
7705 !! test
7706 Templates: Ugly templates: 3. newline-only template parameter
7707 !! input
7708 foo {{echo|
7709 }}
7710 !! result
7711 <p>foo
7712 </p>
7713 !! end
7714
7715 # This looks like a bug: a single newline triggers p/br for some reason.
7716 !! test
7717 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7718 !! input
7719 {{echo|
7720 }}
7721 !! result
7722 <p><br />
7723 </p>
7724 !! end
7725
7726
7727 !!test
7728 Parser Functions: 1. Simple example
7729 !!input
7730 {{uc:foo}}
7731 !!result
7732 <p>FOO
7733 </p>
7734 !!end
7735
7736 !!test
7737 Parser Functions: 2. Nested use (only outermost should be marked up)
7738 !!input
7739 {{uc:{{lc:FOO}}}}
7740 !!result
7741 <p>FOO
7742 </p>
7743 !!end
7744
7745 ###
7746 ### Pre-save transform tests
7747 ###
7748 !! test
7749 pre-save transform: subst:
7750 !! options
7751 PST
7752 !! input
7753 {{subst:test}}
7754 !! result
7755 This is a test template
7756 !! end
7757
7758 !! test
7759 pre-save transform: normal template
7760 !! options
7761 PST
7762 !! input
7763 {{test}}
7764 !! result
7765 {{test}}
7766 !! end
7767
7768 !! test
7769 pre-save transform: nonexistent template
7770 !! options
7771 PST
7772 !! input
7773 {{thistemplatedoesnotexist}}
7774 !! result
7775 {{thistemplatedoesnotexist}}
7776 !! end
7777
7778
7779 !! test
7780 pre-save transform: subst magic variables
7781 !! options
7782 PST
7783 !! input
7784 {{subst:SITENAME}}
7785 !! result
7786 MediaWiki
7787 !! end
7788
7789 # This is bug 89, which I fixed. -- wtm
7790 !! test
7791 pre-save transform: subst: templates with parameters
7792 !! options
7793 pst
7794 !! input
7795 {{subst:paramtest|param="something else"}}
7796 !! result
7797 This is a test template with parameter "something else"
7798 !! end
7799
7800 !! article
7801 Template:nowikitest
7802 !! text
7803 <nowiki>'''not wiki'''</nowiki>
7804 !! endarticle
7805
7806 !! test
7807 pre-save transform: nowiki in subst (bug 1188)
7808 !! options
7809 pst
7810 !! input
7811 {{subst:nowikitest}}
7812 !! result
7813 <nowiki>'''not wiki'''</nowiki>
7814 !! end
7815
7816
7817 !! article
7818 Template:commenttest
7819 !! text
7820 This template has <!-- a comment --> in it.
7821 !! endarticle
7822
7823 !! test
7824 pre-save transform: comment in subst (bug 1936)
7825 !! options
7826 pst
7827 !! input
7828 {{subst:commenttest}}
7829 !! result
7830 This template has <!-- a comment --> in it.
7831 !! end
7832
7833 !! test
7834 pre-save transform: unclosed tag
7835 !! options
7836 pst noxml
7837 !! input
7838 <nowiki>'''not wiki'''
7839 !! result
7840 <nowiki>'''not wiki'''
7841 !! end
7842
7843 !! test
7844 pre-save transform: mixed tag case
7845 !! options
7846 pst noxml
7847 !! input
7848 <NOwiki>'''not wiki'''</noWIKI>
7849 !! result
7850 <NOwiki>'''not wiki'''</noWIKI>
7851 !! end
7852
7853 !! test
7854 pre-save transform: unclosed comment in <nowiki>
7855 !! options
7856 pst noxml
7857 !! input
7858 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7859 !! result
7860 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7861 !!end
7862
7863 # Leading @ in this template definition works around a limitation
7864 # in parsoid's parserTests which otherwise strips the <span> from the
7865 # result (confusing it for a template wrapper)
7866 !! article
7867 Template:dangerous
7868 !!text
7869 @<span onmouseover="alert('crap')">Oh no</span>
7870 !!endarticle
7871
7872 !!test
7873 (confirming safety of fix for subst bug 1936)
7874 !! input
7875 {{Template:dangerous}}
7876 !! result
7877 <p>@<span>Oh no</span>
7878 </p>
7879 !! end
7880
7881 !! test
7882 pre-save transform: comment containing gallery (bug 5024)
7883 !! options
7884 pst
7885 !! input
7886 <!-- <gallery>data</gallery> -->
7887 !!result
7888 <!-- <gallery>data</gallery> -->
7889 !!end
7890
7891 !! test
7892 pre-save transform: comment containing extension
7893 !! options
7894 pst
7895 !! input
7896 <!-- <tag>data</tag> -->
7897 !!result
7898 <!-- <tag>data</tag> -->
7899 !!end
7900
7901 !! test
7902 pre-save transform: comment containing nowiki
7903 !! options
7904 pst
7905 !! input
7906 <!-- <nowiki>data</nowiki> -->
7907 !!result
7908 <!-- <nowiki>data</nowiki> -->
7909 !!end
7910
7911 !! test
7912 pre-save transform: <noinclude> in subst (bug 3298)
7913 !! options
7914 pst
7915 !! input
7916 {{subst:Includes}}
7917 !! result
7918 Foobar
7919 !! end
7920
7921 !! test
7922 pre-save transform: <onlyinclude> in subst (bug 3298)
7923 !! options
7924 pst
7925 !! input
7926 {{subst:Includes2}}
7927 !! result
7928 Foo
7929 !! end
7930
7931 !! article
7932 Template:SubstTest
7933 !!text
7934 {{<includeonly>subst:</includeonly>Includes}}
7935 !! endarticle
7936
7937 !! article
7938 Template:SafeSubstTest
7939 !! text
7940 {{<includeonly>safesubst:</includeonly>Includes}}
7941 !! endarticle
7942
7943 !! test
7944 bug 22297: safesubst: works during PST
7945 !! options
7946 pst
7947 !! input
7948 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7949 !! result
7950 FoobarFoobar
7951 !! end
7952
7953 !! test
7954 bug 22297: safesubst: works during normal parse
7955 !! input
7956 {{SafeSubstTest}}
7957 !! result
7958 <p>Foobar
7959 </p>
7960 !! end
7961
7962 !! test:
7963 subst: does not work during normal parse
7964 !! input
7965 {{SubstTest}}
7966 !! result
7967 <p>{{subst:Includes}}
7968 </p>
7969 !! end
7970
7971 !! test
7972 pre-save transform: context links ("pipe trick")
7973 !! options
7974 pst
7975 !! input
7976 [[Article (context)|]]
7977 [[Bar:Article|]]
7978 [[:Bar:Article|]]
7979 [[Bar:Article (context)|]]
7980 [[:Bar:Article (context)|]]
7981 [[|Article]]
7982 [[|Article (context)]]
7983 [[Bar:X (Y) Z|]]
7984 [[:Bar:X (Y) Z|]]
7985 !! result
7986 [[Article (context)|Article]]
7987 [[Bar:Article|Article]]
7988 [[:Bar:Article|Article]]
7989 [[Bar:Article (context)|Article]]
7990 [[:Bar:Article (context)|Article]]
7991 [[Article]]
7992 [[Article (context)]]
7993 [[Bar:X (Y) Z|X (Y) Z]]
7994 [[:Bar:X (Y) Z|X (Y) Z]]
7995 !! end
7996
7997 !! test
7998 pre-save transform: context links ("pipe trick") with interwiki prefix
7999 !! options
8000 pst
8001 !! input
8002 [[interwiki:Article|]]
8003 [[:interwiki:Article|]]
8004 [[interwiki:Bar:Article|]]
8005 [[:interwiki:Bar:Article|]]
8006 !! result
8007 [[interwiki:Article|Article]]
8008 [[:interwiki:Article|Article]]
8009 [[interwiki:Bar:Article|Bar:Article]]
8010 [[:interwiki:Bar:Article|Bar:Article]]
8011 !! end
8012
8013 !! test
8014 pre-save transform: context links ("pipe trick") with parens in title
8015 !! options
8016 pst title=[[Somearticle (context)]]
8017 !! input
8018 [[|Article]]
8019 !! result
8020 [[Article (context)|Article]]
8021 !! end
8022
8023 !! test
8024 pre-save transform: context links ("pipe trick") with comma in title
8025 !! options
8026 pst title=[[Someplace, Somewhere]]
8027 !! input
8028 [[|Otherplace]]
8029 [[Otherplace, Elsewhere|]]
8030 [[Otherplace, Elsewhere, Anywhere|]]
8031 !! result
8032 [[Otherplace, Somewhere|Otherplace]]
8033 [[Otherplace, Elsewhere|Otherplace]]
8034 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8035 !! end
8036
8037 !! test
8038 pre-save transform: context links ("pipe trick") with parens and comma
8039 !! options
8040 pst title=[[Someplace (IGNORED), Somewhere]]
8041 !! input
8042 [[|Otherplace]]
8043 [[Otherplace (place), Elsewhere|]]
8044 !! result
8045 [[Otherplace, Somewhere|Otherplace]]
8046 [[Otherplace (place), Elsewhere|Otherplace]]
8047 !! end
8048
8049 !! test
8050 pre-save transform: context links ("pipe trick") with comma and parens
8051 !! options
8052 pst title=[[Who, me? (context)]]
8053 !! input
8054 [[|Yes, you.]]
8055 [[Me, Myself, and I (1937 song)|]]
8056 !! result
8057 [[Yes, you. (context)|Yes, you.]]
8058 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8059 !! end
8060
8061 !! test
8062 pre-save transform: context links ("pipe trick") with namespace
8063 !! options
8064 pst title=[[Ns:Somearticle]]
8065 !! input
8066 [[|Article]]
8067 !! result
8068 [[Ns:Article|Article]]
8069 !! end
8070
8071 !! test
8072 pre-save transform: context links ("pipe trick") with namespace and parens
8073 !! options
8074 pst title=[[Ns:Somearticle (context)]]
8075 !! input
8076 [[|Article]]
8077 !! result
8078 [[Ns:Article (context)|Article]]
8079 !! end
8080
8081 !! test
8082 pre-save transform: context links ("pipe trick") with namespace and comma
8083 !! options
8084 pst title=[[Ns:Somearticle, Context, Whatever]]
8085 !! input
8086 [[|Article]]
8087 !! result
8088 [[Ns:Article, Context, Whatever|Article]]
8089 !! end
8090
8091 !! test
8092 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8093 !! options
8094 pst title=[[Ns:Somearticle, Context (context)]]
8095 !! input
8096 [[|Article]]
8097 !! result
8098 [[Ns:Article (context)|Article]]
8099 !! end
8100
8101 !! test
8102 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8103 !! options
8104 pst title=[[Ns:Somearticle (IGNORED), Context]]
8105 !! input
8106 [[|Article]]
8107 !! result
8108 [[Ns:Article, Context|Article]]
8109 !! end
8110
8111 !! test
8112 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8113 !! options
8114 pst
8115 !! input
8116 [[Article(context)|]]
8117 [[Bar:Article(context)|]]
8118 [[:Bar:Article(context)|]]
8119 [[|Article(context)]]
8120 [[Bar:X(Y)Z|]]
8121 [[:Bar:X(Y)Z|]]
8122 !! result
8123 [[Article(context)|Article]]
8124 [[Bar:Article(context)|Article]]
8125 [[:Bar:Article(context)|Article]]
8126 [[Article(context)]]
8127 [[Bar:X(Y)Z|X(Y)Z]]
8128 [[:Bar:X(Y)Z|X(Y)Z]]
8129 !! end
8130
8131 !! test
8132 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8133 !! options
8134 pst
8135 !! input
8136 [[Article (context)|]]
8137 [[Bar:Article (context)|]]
8138 [[:Bar:Article (context)|]]
8139 [[|Article (context)]]
8140 [[Bar:X (Y) Z|]]
8141 [[:Bar:X (Y) Z|]]
8142 !! result
8143 [[Article (context)|Article]]
8144 [[Bar:Article (context)|Article]]
8145 [[:Bar:Article (context)|Article]]
8146 [[Article (context)]]
8147 [[Bar:X (Y) Z|X (Y) Z]]
8148 [[:Bar:X (Y) Z|X (Y) Z]]
8149 !! end
8150
8151 !! test
8152 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8153 !! options
8154 pst
8155 !! input
8156 [[Article(context)|]]
8157 [[Bar:Article(context)|]]
8158 [[:Bar:Article(context)|]]
8159 [[|Article(context)]]
8160 [[Bar:X(Y)Z|]]
8161 [[:Bar:X(Y)Z|]]
8162 !! result
8163 [[Article(context)|Article]]
8164 [[Bar:Article(context)|Article]]
8165 [[:Bar:Article(context)|Article]]
8166 [[Article(context)]]
8167 [[Bar:X(Y)Z|X(Y)Z]]
8168 [[:Bar:X(Y)Z|X(Y)Z]]
8169 !! end
8170
8171 !! test
8172 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8173 !! options
8174 pst
8175 !! input
8176 [[Article (context), context|]]
8177 [[Article (context),context|]]
8178 [[Bar:Article (context), context|]]
8179 [[Bar:Article (context),context|]]
8180 [[:Bar:Article (context), context|]]
8181 [[:Bar:Article (context),context|]]
8182 !! result
8183 [[Article (context), context|Article]]
8184 [[Article (context),context|Article]]
8185 [[Bar:Article (context), context|Article]]
8186 [[Bar:Article (context),context|Article]]
8187 [[:Bar:Article (context), context|Article]]
8188 [[:Bar:Article (context),context|Article]]
8189 !! end
8190
8191 !! test
8192 pre-save transform: trim trailing empty lines
8193 !! options
8194 pst
8195 !! input
8196 Empty lines are trimmed
8197
8198
8199
8200
8201 !! result
8202 Empty lines are trimmed
8203 !! end
8204
8205 !! test
8206 pre-save transform: Signature expansion
8207 !! options
8208 pst
8209 !! input
8210 * ~~~
8211 * <noinclude>~~~</noinclude>
8212 * <includeonly>~~~</includeonly>
8213 * <onlyinclude>~~~</onlyinclude>
8214 !! result
8215 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8216 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8217 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8218 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8219 !! end
8220
8221
8222 !! test
8223 pre-save transform: Signature expansion in nowiki tags (bug 93)
8224 !! options
8225 pst disabled
8226 !! input
8227 Shall not expand:
8228
8229 <nowiki>~~~~</nowiki>
8230
8231 <includeonly><nowiki>~~~~</nowiki></includeonly>
8232
8233 <noinclude><nowiki>~~~~</nowiki></noinclude>
8234
8235 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8236
8237 {{subst:Foo}} shall be converted to FOO
8238
8239 As well as inside noinclude/onlyinclude
8240 <noinclude>{{subst:Foo}}</noinclude>
8241 <onlyinclude>{{subst:Foo}}</onlyinclude>
8242
8243 But not inside includeonly
8244 <includeonly>{{subst:Foo}}</includeonly>
8245 !! result
8246 Shall not expand:
8247
8248 <nowiki>~~~~</nowiki>
8249
8250 <includeonly><nowiki>~~~~</nowiki></includeonly>
8251
8252 <noinclude><nowiki>~~~~</nowiki></noinclude>
8253
8254 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8255
8256 FOO shall be converted to FOO
8257
8258 As well as inside noinclude/onlyinclude
8259 <noinclude>FOO</noinclude>
8260 <onlyinclude>FOO</onlyinclude>
8261
8262 But not inside includeonly
8263 <includeonly>{{subst:Foo}}</includeonly>
8264 !! end
8265
8266 !! test
8267 Parsoid: Recognize nowiki with trailing space in tags
8268 !! options
8269 parsoid=wt2html
8270 !! input
8271 <nowiki ><div>[[foo]]</nowiki >
8272
8273 a<nowiki / >b
8274
8275 c<nowiki />d
8276
8277 e<nowiki/ >f
8278 !! result
8279 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8280 <p>ab</p>
8281 <p>cd</p>
8282 <p>ef</p>
8283 !! end
8284
8285 !! test
8286 Parsoid: Recognize nowiki with odd capitalization
8287 !! options
8288 parsoid=wt2html
8289 !! input
8290 <noWikI ><div>[[foo]]</Nowiki >
8291 !! result
8292 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8293 !! end
8294
8295
8296 !! test
8297 Parsoid: Escape nowiki with trailing space in tags
8298 !! options
8299 parsoid=html2wt
8300 !! input
8301 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8302
8303 a&lt;nowiki /&gt;b
8304
8305 c&lt;nowiki/ &gt;d
8306 !! result
8307 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8308 <p>a&lt;nowiki /&gt;b</p>
8309 <p>c&lt;nowiki/ &gt;d</p>
8310 !! end
8311
8312 !! test
8313 Parsoid: Escape weird noWikI capitalizations
8314 !! options
8315 parsoid=html2wt
8316 !! input
8317 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8318 !! result
8319 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8320 !! end
8321
8322 ###
8323 ### Message transform tests
8324 ###
8325 !! test
8326 message transform: magic variables
8327 !! options
8328 msg
8329 !! input
8330 {{SITENAME}}
8331 !! result
8332 MediaWiki
8333 !! end
8334
8335 !! test
8336 message transform: should not transform wiki markup
8337 !! options
8338 msg
8339 !! input
8340 ''test''
8341 !! result
8342 ''test''
8343 !! end
8344
8345 !! test
8346 message transform: <noinclude> in transcluded template (bug 4926)
8347 !! options
8348 msg
8349 !! input
8350 {{Includes}}
8351 !! result
8352 Foobar
8353 !! end
8354
8355 !! test
8356 message transform: <onlyinclude> in transcluded template (bug 4926)
8357 !! options
8358 msg
8359 !! input
8360 {{Includes2}}
8361 !! result
8362 Foo
8363 !! end
8364
8365 !! test
8366 {{#special:}} page name, known
8367 !! options
8368 msg
8369 !! input
8370 {{#special:Recentchanges}}
8371 !! result
8372 Special:RecentChanges
8373 !! end
8374
8375 !! test
8376 {{#special:}} page name with subpage, known
8377 !! options
8378 msg
8379 !! input
8380 {{#special:Recentchanges/param}}
8381 !! result
8382 Special:RecentChanges/param
8383 !! end
8384
8385 !! test
8386 {{#special:}} page name, unknown
8387 !! options
8388 msg
8389 !! input
8390 {{#special:foobar nonexistent}}
8391 !! result
8392 Special:Foobar nonexistent
8393 !! end
8394
8395 !! test
8396 {{#speciale:}} page name, known
8397 !! options
8398 msg
8399 !! input
8400 {{#speciale:Recentchanges}}
8401 !! result
8402 Special:RecentChanges
8403 !! end
8404
8405 !! test
8406 {{#speciale:}} page name with subpage, known
8407 !! options
8408 msg
8409 !! input
8410 {{#speciale:Recentchanges/param}}
8411 !! result
8412 Special:RecentChanges/param
8413 !! end
8414
8415 !! test
8416 {{#speciale:}} page name, unknown
8417 !! options
8418 msg
8419 !! input
8420 {{#speciale:foobar nonexistent}}
8421 !! result
8422 Special:Foobar_nonexistent
8423 !! end
8424
8425 ###
8426 ### Images
8427 ###
8428 ### For Parsoid-specific tests, see
8429 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8430
8431 !! test
8432 Simple image (php)
8433 !! options
8434 php
8435 !! input
8436 [[Image:foobar.jpg]]
8437 !! result
8438 <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>
8439 </p>
8440 !! end
8441
8442 !! test
8443 Simple image (parsoid)
8444 !! options
8445 parsoid=wt2html
8446 !! input
8447 [[Image:foobar.jpg]]
8448 !! result
8449 <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>
8450 </p>
8451 !! end
8452
8453 !! test
8454 Simple image (using File: namespace, now canonical) (php)
8455 !! options
8456 php
8457 !! input
8458 [[File:foobar.jpg]]
8459 !! result
8460 <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>
8461 </p>
8462 !! end
8463
8464 !! test
8465 Simple image (using File: namespace, now canonical) (parsoid)
8466 !! options
8467 parsoid
8468 !! input
8469 [[File:Foobar.jpg]]
8470 !! result
8471 <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>
8472 </p>
8473 !! end
8474
8475 !! test
8476 Right-aligned image (php)
8477 !! options
8478 php
8479 !! input
8480 [[Image:foobar.jpg|right]]
8481 !! result
8482 <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>
8483
8484 !! end
8485
8486 !! test
8487 Right-aligned image (parsoid)
8488 !! options
8489 parsoid
8490 !! input
8491 [[File:Foobar.jpg|right]]
8492 !! result
8493 <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>
8494 !! end
8495
8496 !! test
8497 Image with caption (php)
8498 !! options
8499 php
8500 !! input
8501 [[File:Foobar.jpg|right|Caption text]]
8502 !! result
8503 <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>
8504
8505 !! end
8506
8507 !! test
8508 Image with caption (parsoid)
8509 !! options
8510 parsoid
8511 !! input
8512 [[File:Foobar.jpg|right|Caption text]]
8513 !! result
8514 <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>
8515 !! end
8516
8517 !! test
8518 Image with empty attribute (php)
8519 !! options
8520 php
8521 !! input
8522 [[File:Foobar.jpg|right||Caption text]]
8523 !! result
8524 <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>
8525
8526 !! end
8527
8528 !! test
8529 Image with empty attribute (parsoid)
8530 !! options
8531 parsoid=wt2html
8532 !! input
8533 [[File:Foobar.jpg|right||Caption text]]
8534 !! result
8535 <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>
8536 !! end
8537
8538 !! test
8539 Image with attributes from template (php)
8540 !! options
8541 php
8542 !! input
8543 [[File:Foobar.jpg|{{image_attribs}}]]
8544 !! result
8545 <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>
8546
8547 !! end
8548
8549 !! test
8550 Image with attributes from template (parsoid)
8551 !! options
8552 parsoid
8553 !! input
8554 [[File:Foobar.jpg|{{image_attribs}}]]
8555 !! result
8556 <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>
8557 !! end
8558
8559 !! test
8560 Image with link tails (php)
8561 !! options
8562 php
8563 !! input
8564 123[[File:Foobar.jpg]]456
8565 123[[File:Foobar.jpg|right]]456
8566 123[[File:Foobar.jpg|thumb]]456
8567 !! result
8568 <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
8569 </p>
8570 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
8571 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
8572
8573 !! end
8574
8575 !! test
8576 Image with link tails (parsoid)
8577 !! options
8578 parsoid
8579 !! input
8580 123[[File:Foobar.jpg]]456
8581 123[[File:Foobar.jpg|right]]456
8582 123[[File:Foobar.jpg|thumb]]456
8583 !! result
8584 <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>
8585 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
8586 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
8587 !! end
8588
8589 !! test
8590 Image with multiple captions -- only last one is accepted (php)
8591 !! options
8592 php
8593 !! input
8594 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8595 !! result
8596 <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>
8597
8598 !! end
8599
8600 !! test
8601 Image with multiple captions -- only last one is accepted (parsoid)
8602 !! options
8603 parsoid
8604 !! input
8605 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8606 !! result
8607 <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>
8608 !! end
8609
8610 !! test
8611 Image with width attribute at different positions (php)
8612 !! options
8613 php
8614 !! input
8615 [[File:Foobar.jpg|200px|right|Caption]]
8616 [[File:Foobar.jpg|right|200px|Caption]]
8617 [[File:Foobar.jpg|right|Caption|200px]]
8618 !! result
8619 <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>
8620 <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>
8621 <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>
8622
8623 !! end
8624
8625 !! test
8626 Image with width attribute at different positions (parsoid)
8627 !! options
8628 parsoid
8629 !! input
8630 [[File:Foobar.jpg|200px|right|Caption]]
8631 [[File:Foobar.jpg|right|200px|Caption]]
8632 [[File:Foobar.jpg|right|Caption|200px]]
8633 !! result
8634 <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>
8635 <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>
8636 <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>
8637 !! end
8638
8639 !! test
8640 Image with link parameter, wiki target (php)
8641 !! options
8642 php
8643 !! input
8644 [[File:Foobar.jpg|link=Main Page]]
8645 !! result
8646 <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>
8647 </p>
8648 !! end
8649
8650 !! test
8651 Image with link parameter, wiki target (parsoid)
8652 !! options
8653 parsoid
8654 !! input
8655 [[File:Foobar.jpg|link=Main Page]]
8656 !! result
8657 <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>
8658 !! end
8659
8660 !! test
8661 Image with link parameter, URL target (php)
8662 !! options
8663 php
8664 !! input
8665 [[File:Foobar.jpg|link=http://example.com/]]
8666 !! result
8667 <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>
8668 </p>
8669 !! end
8670
8671 # parsoid bug 49293 (part 1)
8672 !! test
8673 Image with link parameter, URL target (parsoid)
8674 !! options
8675 parsoid
8676 !! input
8677 [[File:Foobar.jpg|link=http://example.com/]]
8678 !! result
8679 <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>
8680 !! end
8681
8682 !! test
8683 Image with link parameter, protocol-less URL target (php)
8684 !! options
8685 php
8686 !! input
8687 [[File:Foobar.jpg|link=//example.com/]]
8688 !! result
8689 <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>
8690 </p>
8691 !! end
8692
8693 # parsoid bug 49293 (part 2)
8694 !! test
8695 Image with link parameter, protocol-less URL target (parsoid)
8696 !! options
8697 parsoid
8698 !! input
8699 [[File:Foobar.jpg|link=//example.com/]]
8700 !! result
8701 <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>
8702 !! end
8703
8704 !! test
8705 Image with link parameter, wgExternalLinkTarget
8706 !! input
8707 [[Image:foobar.jpg|link=http://example.com/]]
8708 !! config
8709 wgExternalLinkTarget='foobar'
8710 !! result
8711 <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>
8712 </p>
8713 !! end
8714
8715 !! test
8716 Image with link parameter, wgNoFollowLinks set to false
8717 !! input
8718 [[Image:foobar.jpg|link=http://example.com/]]
8719 !! config
8720 wgNoFollowLinks=false
8721 !! result
8722 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8723 </p>
8724 !! end
8725
8726 !! test
8727 Image with link parameter, wgNoFollowDomainExceptions
8728 !! input
8729 [[Image:foobar.jpg|link=http://example.com/]]
8730 !! config
8731 wgNoFollowDomainExceptions='example.com'
8732 !! result
8733 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8734 </p>
8735 !! end
8736
8737 !! test
8738 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8739 !! input
8740 [[Image:foobar.jpg|link=http://example.com/|Title]]
8741 !! config
8742 wgExternalLinkTarget='foobar'
8743 !! result
8744 <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>
8745 </p>
8746 !! end
8747
8748 !! test
8749 Image with empty link parameter (php)
8750 !! options
8751 php
8752 !! input
8753 [[File:Foobar.jpg|link=]]
8754 !! result
8755 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8756 </p>
8757 !! end
8758
8759 !! test
8760 Image with empty link parameter (parsoid)
8761 !! options
8762 parsoid
8763 !! input
8764 [[File:Foobar.jpg|link=]]
8765 !! result
8766 <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>
8767 !! end
8768
8769 !! test
8770 Image with link parameter (wiki target) and unnamed parameter (php)
8771 !! options
8772 php
8773 !! input
8774 [[File:Foobar.jpg|link=Main Page|Title]]
8775 !! result
8776 <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>
8777 </p>
8778 !! end
8779
8780 !! test
8781 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8782 !! options
8783 parsoid
8784 !! input
8785 [[File:Foobar.jpg|link=Main Page|Title]]
8786 !! result
8787 <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>
8788 !! end
8789
8790 !! test
8791 Image with link parameter (URL target) and unnamed parameter (php)
8792 !! options
8793 php
8794 !! input
8795 [[File:Foobar.jpg|link=http://example.com/|Title]]
8796 !! result
8797 <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>
8798 </p>
8799 !! end
8800
8801 !! test
8802 Image with link parameter (URL target) and unnamed parameter (parsoid)
8803 !! options
8804 parsoid
8805 !! input
8806 [[File:Foobar.jpg|link=http://example.com/|Title]]
8807 !! result
8808 <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>
8809 !! end
8810
8811 !! test
8812 Thumbnail image with link parameter
8813 !! options
8814 php
8815 !! input
8816 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8817 !! result
8818 <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>
8819
8820 !! end
8821
8822 !! test
8823 Manually-specified thumbnail image
8824 !! options
8825 php
8826 !! input
8827 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8828 !! result
8829 <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>
8830
8831 !! end
8832
8833 !! test
8834 Manually-specified thumbnail image with explicit link to wiki page
8835 !! options
8836 php
8837 !! input
8838 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8839 !! result
8840 <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>
8841
8842 !! end
8843
8844 !! test
8845 Manually-specified thumbnail image with explicit link to url
8846 !! options
8847 php
8848 !! input
8849 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8850 !! result
8851 <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>
8852
8853 !! end
8854
8855 !! test
8856 Manually-specified thumbnail image with explicit no link
8857 !! options
8858 php
8859 !! input
8860 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8861 !! result
8862 <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>
8863
8864 !! end
8865
8866 !! test
8867 Manually-specified thumbnail image with explicit link and alt text
8868 !! options
8869 php
8870 !! input
8871 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8872 !! result
8873 <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>
8874
8875 !! end
8876
8877 !! test
8878 Image with frame and link
8879 !! input
8880 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8881 !! result
8882 <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>
8883
8884 !! end
8885
8886 !! test
8887 Image with frame and link and explicit alt
8888 !! input
8889 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8890 !! result
8891 <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>
8892
8893 !! end
8894
8895 !! test
8896 Image with wiki markup in implicit alt
8897 !! input
8898 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8899 !! result
8900 <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>
8901 </p>
8902 !! end
8903
8904 !! test
8905 Image with wiki markup in explicit alt
8906 !! input
8907 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8908 !! result
8909 <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>
8910 </p>
8911 !! end
8912
8913 !! test
8914 Link to image page- image page normally doesn't exists, hence edit link
8915 Add test with existing image page
8916 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8917 !! input
8918 [[:Image:test]]
8919 !! result
8920 <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>
8921 </p>
8922 !! end
8923
8924 !! test
8925 bug 18784 Link to non-existent image page with caption should use caption as link text
8926 !! input
8927 [[:Image:test|caption]]
8928 !! result
8929 <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>
8930 </p>
8931 !! end
8932
8933 !! test
8934 Frameless image caption with a free URL
8935 !! input
8936 [[Image:foobar.jpg|http://example.com]]
8937 !! result
8938 <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>
8939 </p>
8940 !! end
8941
8942 !! test
8943 Thumbnail image caption with a free URL
8944 !! input
8945 [[Image:foobar.jpg|thumb|http://example.com]]
8946 !! result
8947 <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>
8948
8949 !! end
8950
8951 !! test
8952 Thumbnail image caption with a free URL and explicit alt
8953 !! input
8954 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8955 !! result
8956 <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>
8957
8958 !! end
8959
8960 !! test
8961 SVG thumbnails with no language set
8962 !! options
8963 !! input
8964 [[File:Foobar.svg|thumb|width=200]]
8965 !! result
8966 <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>
8967
8968 !! end
8969
8970 !! test
8971 SVG thumbnails with language de
8972 !! options
8973 !! input
8974 [[File:Foobar.svg|thumb|width=200|lang=de]]
8975 !! result
8976 <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>
8977
8978 !! end
8979
8980 !! test
8981 SVG thumbnails with invalid language code
8982 !! options
8983 !! input
8984 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8985 !! result
8986 <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>
8987
8988 !! end
8989
8990 !! test
8991 BUG 1887: A ISBN with a thumbnail
8992 !! input
8993 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8994 !! result
8995 <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>
8996
8997 !! end
8998
8999 !! test
9000 BUG 1887: A RFC with a thumbnail
9001 !! input
9002 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9003 !! result
9004 <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>
9005
9006 !! end
9007
9008 !! test
9009 BUG 1887: A mailto link with a thumbnail
9010 !! input
9011 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9012 !! result
9013 <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>
9014
9015 !! end
9016
9017 # Pending resolution to bug 368
9018 !! test
9019 BUG 648: Frameless image caption with a link
9020 !! input
9021 [[Image:foobar.jpg|text with a [[link]] in it]]
9022 !! result
9023 <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>
9024 </p>
9025 !! end
9026
9027 !! test
9028 BUG 648: Frameless image caption with a link (suffix)
9029 !! input
9030 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9031 !! result
9032 <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>
9033 </p>
9034 !! end
9035
9036 !! test
9037 BUG 648: Frameless image caption with an interwiki link
9038 !! input
9039 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9040 !! result
9041 <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>
9042 </p>
9043 !! end
9044
9045 !! test
9046 BUG 648: Frameless image caption with a piped interwiki link
9047 !! input
9048 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9049 !! result
9050 <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>
9051 </p>
9052 !! end
9053
9054 !! test
9055 Escape HTML special chars in image alt text
9056 !! input
9057 [[Image:foobar.jpg|& < > "]]
9058 !! result
9059 <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>
9060 </p>
9061 !! end
9062
9063 !! test
9064 BUG 499: Alt text should have &#1234;, not &amp;1234;
9065 !! input
9066 [[Image:foobar.jpg|&#9792;]]
9067 !! result
9068 <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>
9069 </p>
9070 !! end
9071
9072 !! test
9073 Broken image caption with link
9074 !! input
9075 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9076 !! result
9077 <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.
9078 </p>
9079 !! end
9080
9081 !! test
9082 Image caption containing another image
9083 !! input
9084 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9085 !! result
9086 <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>
9087
9088 !! end
9089
9090 !! test
9091 Image caption containing a newline
9092 !! input
9093 [[Image:Foobar.jpg|This
9094 *is some text]]
9095 !! result
9096 <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>
9097 </p>
9098 !!end
9099
9100 !!test
9101 Parsoid: Image caption containing leading space
9102 (The leading space should not trigger nowiki escaping in wt2wt mode)
9103 !! input
9104 [[Image:Foobar.jpg|thumb| bar]]
9105 !! result
9106 <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>
9107
9108 !!end
9109
9110 !! test
9111 Bug 3090: External links other than http: in image captions
9112 !! input
9113 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9114 !! result
9115 <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>
9116
9117 !! end
9118
9119 !! test
9120 Custom class
9121 !! input
9122 [[Image:foobar.jpg|a|class=b]]
9123 !! result
9124 <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>
9125 </p>
9126 !! end
9127
9128 !! test
9129 Localized image handling (1).
9130 !! options
9131 language=es
9132 !! input
9133 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9134 !! result
9135 <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>
9136
9137 !! end
9138
9139 !! test
9140 Localized image handling (2).
9141 !! options
9142 language=es
9143 !! input
9144 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9145 !! result
9146 <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>
9147
9148 !! end
9149
9150 !! test
9151 "border", "frameless" and "class" attributes on an image.
9152 !! input
9153 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9154 !! result
9155 <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>
9156 </p>
9157 !! end
9158
9159 !! article
9160 File:Barfoo.jpg
9161 !! text
9162 #REDIRECT [[File:Barfoo.jpg]]
9163 !! endarticle
9164
9165 !! test
9166 Redirected image
9167 !! input
9168 [[Image:Barfoo.jpg]]
9169 !! result
9170 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9171 </p>
9172 !! end
9173
9174 !! test
9175 Missing image with uploads disabled
9176 !! options
9177 wgEnableUploads=0
9178 !! input
9179 [[Image:Foobaz.jpg]]
9180 !! result
9181 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9182 </p>
9183 !! end
9184
9185 # Parsoid-specific testing for images
9186 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9187 # Currently imperfect due to a flaw in the Parsoid testrunner
9188 # Work in progress
9189 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9190 # image tests.
9191
9192 !! test
9193 Parsoid-specific image handling - simple image with size and middle alignment
9194 !! options
9195 parsoid
9196 !! input
9197 [[Image:Foobar.jpg|50px|middle]]
9198 !! result
9199 <p>
9200 <span class="mw-valign-middle" typeof="mw:Image">
9201 <a href="File:Foobar.jpg">
9202 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9203 </a>
9204 </span>
9205 </p>
9206 !! end
9207
9208 !! test
9209 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9210 !! options
9211 parsoid
9212 !! input
9213 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9214 !! result
9215 <p>
9216 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9217 <a href="File:Foobar.jpg">
9218 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9219 </a>
9220 </span>
9221 </p>
9222 !! end
9223
9224 !! test
9225 Parsoid-specific image handling - simple image with border and size spec
9226 !! options
9227 parsoid
9228 !! input
9229 [[Image:Foobar.jpg|50px|border|caption]]
9230 !! result
9231 <p>
9232 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9233 <a href="File:Foobar.jpg">
9234 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9235 </a>
9236 </span>
9237 </p>
9238 !! end
9239
9240 !! test
9241 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9242 !! options
9243 parsoid
9244 !! input
9245 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9246 !! result
9247 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9248 <a href="File:Foobar.jpg">
9249 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9250 </a>
9251 <figcaption>caption content</figcaption>
9252 </figure>
9253 !! end
9254
9255 !! test
9256 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9257 !! options
9258 parsoid
9259 !! input
9260 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9261 !! result
9262 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9263 <a href="File:Foobar.jpg">
9264 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9265 </a>
9266 <figcaption>caption</figcaption>
9267 </figure>
9268 !! end
9269
9270 !! test
9271 Parsoid-specific image handling - framed image with specific size and caption
9272 !! options
9273 parsoid
9274 !! input
9275 [[Image:Foobar.jpg|500x50px|frame|caption]]
9276 !! result
9277 <figure typeof="mw:Image/Frame">
9278 <a href="File:Foobar.jpg">
9279 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9280 </a>
9281 <figcaption>caption</figcaption>
9282 </figure>
9283 !! end
9284
9285 !! test
9286 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9287 !! options
9288 parsoid
9289 !! input
9290 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9291 !! result
9292 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9293 <a href="File:Foobar.jpg">
9294 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9295 </a>
9296 <figcaption>caption</figcaption>
9297 </figure>
9298 !! end
9299
9300 !! test
9301 Parsoid-specific image handling - frameless image with specific size, border, and caption
9302 !! options
9303 parsoid
9304 !! input
9305 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9306 !! result
9307 <p>
9308 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9309 <a href="File:Foobar.jpg">
9310 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9311 </a>
9312 </p>
9313 !! end
9314
9315 #!! test
9316 #Parsoid-specific image handling - simple image with a formatted caption
9317 #!! options
9318 #parsoid
9319 #!! input
9320 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9321 #!! result
9322 #<p>
9323 #<span typeof="mw:Image">
9324 #<a class="mw-default-size" href="Image:Foobar.jpg">
9325 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9326 #</a>
9327 #<span>abc</span>
9328 #</span>
9329 #</p>
9330
9331
9332 ###
9333 ### Subpages
9334 ###
9335 !! article
9336 Subpage test/subpage
9337 !! text
9338 foo
9339 !! endarticle
9340
9341 !! test
9342 Subpage link
9343 !! options
9344 subpage title=[[Subpage test]]
9345 !! input
9346 [[/subpage]]
9347 !! result
9348 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9349 </p>
9350 !! end
9351
9352 !! test
9353 Subpage noslash link
9354 !! options
9355 subpage title=[[Subpage test]]
9356 !!input
9357 [[/subpage/]]
9358 !! result
9359 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9360 </p>
9361 !! end
9362
9363 # TODO: make this PHP-parser compatible!
9364 !! test
9365 Relative subpage noslash link
9366 !! options
9367 parsoid=wt2wt,wt2html,html2html
9368 subpage title=[[Subpage test/1/2/3/4]]
9369 !!input
9370 [[../../subpage/]]
9371
9372 [[../../subpage]]
9373 !! result
9374 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9375 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9376 !! end
9377
9378 # TODO: make this PHP-parser compatible!
9379 !! test
9380 Parsoid: dot-slash prefixed wikilinks
9381 !! options
9382 parsoid=wt2wt,wt2html,html2html
9383 !!input
9384 [[./foo]]
9385
9386 [[././bar]]
9387
9388 [[././baz/]]
9389 !! result
9390 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9391 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9392 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9393 !! end
9394
9395 !! test
9396 Disabled subpages
9397 !! input
9398 [[/subpage]]
9399 !! result
9400 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9401 </p>
9402 !! end
9403
9404 !! test
9405 BUG 561: {{/Subpage}}
9406 !! options
9407 subpage title=[[Page]]
9408 !! input
9409 {{/Subpage}}
9410 !! result
9411 <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>
9412 </p>
9413 !! end
9414
9415 ###
9416 ### Categories
9417 ###
9418 !! article
9419 Category:MediaWiki User's Guide
9420 !! text
9421 blah
9422 !! endarticle
9423
9424 !! test
9425 Link to category
9426 !! input
9427 [[:Category:MediaWiki User's Guide]]
9428 !! result
9429 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9430 </p>
9431 !! end
9432
9433 !! test
9434 Simple category
9435 !! options
9436 cat
9437 !! input
9438 [[Category:MediaWiki User's Guide]]
9439 !! result
9440 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9441 !! end
9442
9443 !! test
9444 PAGESINCATEGORY invalid title fatal (r33546 fix)
9445 !! input
9446 {{PAGESINCATEGORY:<bogus>}}
9447 !! result
9448 <p>0
9449 </p>
9450 !! end
9451
9452 !! test
9453 Category with different sort key
9454 !! options
9455 cat
9456 !! input
9457 [[Category:MediaWiki User's Guide|Foo]]
9458 !! result
9459 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9460 !! end
9461
9462 !! test
9463 Category with identical sort key
9464 !! options
9465 cat
9466 !! input
9467 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9468 !! result
9469 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9470 !! end
9471
9472 !! test
9473 Category with empty sort key
9474 !! options
9475 cat
9476 pst
9477 !! input
9478 [[Category:MediaWiki User's Guide|]]
9479 !! result
9480 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9481 !! end
9482
9483 !! test
9484 Category with empty sort key and parentheses
9485 !! options
9486 cat
9487 pst
9488 !! input
9489 [[Category:Foo (bar)|]]
9490 !! result
9491 [[Category:Foo (bar)|Foo]]
9492 !! end
9493
9494 !! test
9495 Category with link tail
9496 !! options
9497 cat
9498 pst
9499 !! input
9500 123[[Category:Foo]]456
9501 !! result
9502 123[[Category:Foo]]456
9503 !! end
9504
9505 !! test
9506 Category with template
9507 !! options
9508 cat
9509 pst
9510 !! input
9511 [[Category:{{echo|Foo}}]]
9512 !! result
9513 [[Category:{{echo|Foo}}]]
9514 !! end
9515
9516 !! test
9517 Category with template in sort key
9518 !! options
9519 cat
9520 pst
9521 !! input
9522 [[Category:Foo|{{echo|Bar}}]]
9523 !! result
9524 [[Category:Foo|{{echo|Bar}}]]
9525 !! end
9526
9527 !! test
9528 Category with template in sort key and title
9529 !! options
9530 cat
9531 pst
9532 !! input
9533 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9534 !! result
9535 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9536 !! end
9537
9538 !! test
9539 Category / paragraph interactions
9540 !! input
9541 Foo [[Category:Baz]] Bar
9542
9543 Foo [[Category:Baz]]
9544 Bar
9545
9546 Foo
9547 [[Category:Baz]]
9548 Bar
9549
9550 Foo
9551 [[Category:Baz]] Bar
9552
9553 Foo
9554 [[Category:Baz]]
9555 [[Category:Baz]]
9556 [[Category:Baz]]
9557 Bar
9558
9559 [[Category:Baz]]
9560 [[Category:Baz]]
9561 [[Category:Baz]]
9562
9563 [[Category:Baz]]
9564 {{echo|[[Category:Baz]]}}
9565 [[Category:Baz]]
9566 !! result
9567 <p>Foo Bar
9568 </p><p>Foo
9569 Bar
9570 </p><p>Foo
9571 Bar
9572 </p><p>Foo Bar
9573 </p><p>Foo
9574 Bar
9575 </p>
9576 !! end
9577
9578 !! test
9579 Parsoid: Serialize link to category page with colon escape
9580 !! options
9581 parsoid
9582 !! input
9583
9584 [[:Category:Foo]]
9585 [[:Category:Foo|Bar]]
9586 !! result
9587 <p>
9588 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9589 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9590 </p>
9591 !! end
9592
9593 !! test
9594 Parsoid: Link prefix/suffixes aren't applied to category links
9595 !! options
9596 parsoid=wt2html,wt2wt,html2html
9597 language=is
9598 !! input
9599 x[[Category:Foo]]y
9600 !! result
9601 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9602 !! end
9603
9604 !! test
9605 Parsoid: Serialize link to file page with colon escape
9606 !! options
9607 parsoid
9608 !! input
9609
9610 [[:File:Foo.png]]
9611 [[:File:Foo.png|Bar]]
9612 !! result
9613 <p>
9614 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9615 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9616 </p>
9617 !! end
9618
9619 !! test
9620 Parsoid: Serialize a genuine category link without colon escape
9621 !! options
9622 parsoid
9623 !! input
9624 [[Category:Foo]]
9625 [[Category:Foo|Bar]]
9626 !! result
9627 <link rel="mw:WikiLink/Category" href="Category:Foo">
9628 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9629 !! end
9630
9631 ###
9632 ### Inter-language links
9633 ###
9634 !! test
9635 Inter-language links
9636 !! options
9637 ill
9638 !! input
9639 [[es:Alimento]]
9640 [[fr:Nourriture]]
9641 [[zh:&#39135;&#21697;]]
9642 !! result
9643 es:Alimento fr:Nourriture zh:食品
9644 !! end
9645
9646 !! test
9647 Duplicate interlanguage links (bug 24502)
9648 !! options
9649 ill
9650 !! input
9651 [[es:1]]
9652 [[es:2]]
9653 [[fr:1]]
9654 [[fr:2]]
9655 !! result
9656 es:1 fr:1
9657 !! end
9658
9659 ###
9660 ### Sections
9661 ###
9662 !! test
9663 Basic section headings
9664 !! input
9665 == Headline 1 ==
9666 Some text
9667
9668 ==Headline 2==
9669 More
9670 ===Smaller headline===
9671 Blah blah
9672 !! result
9673 <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>
9674 <p>Some text
9675 </p>
9676 <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>
9677 <p>More
9678 </p>
9679 <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>
9680 <p>Blah blah
9681 </p>
9682 !! end
9683
9684 !! test
9685 Section headings with TOC
9686 !! input
9687 == Headline 1 ==
9688 === Subheadline 1 ===
9689 ===== Skipping a level =====
9690 ====== Skipping a level ======
9691
9692 == Headline 2 ==
9693 Some text
9694 ===Another headline===
9695 !! result
9696 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9697 <ul>
9698 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9699 <ul>
9700 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9701 <ul>
9702 <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>
9703 <ul>
9704 <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>
9705 </ul>
9706 </li>
9707 </ul>
9708 </li>
9709 </ul>
9710 </li>
9711 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9712 <ul>
9713 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9714 </ul>
9715 </li>
9716 </ul>
9717 </div>
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 <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>
9720 <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>
9721 <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>
9722 <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>
9723 <p>Some text
9724 </p>
9725 <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>
9726
9727 !! end
9728
9729 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9730 !! test
9731 Handling of sections up to level 6 and beyond
9732 !! input
9733 = Level 1 Heading=
9734 == Level 2 Heading==
9735 === Level 3 Heading===
9736 ==== Level 4 Heading====
9737 ===== Level 5 Heading=====
9738 ====== Level 6 Heading======
9739 ======= Level 7 Heading=======
9740 ======== Level 8 Heading========
9741 ========= Level 9 Heading=========
9742 ========== Level 10 Heading==========
9743 !! result
9744 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9745 <ul>
9746 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9747 <ul>
9748 <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>
9749 <ul>
9750 <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>
9751 <ul>
9752 <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>
9753 <ul>
9754 <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>
9755 <ul>
9756 <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>
9757 <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>
9758 <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>
9759 <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>
9760 <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>
9761 </ul>
9762 </li>
9763 </ul>
9764 </li>
9765 </ul>
9766 </li>
9767 </ul>
9768 </li>
9769 </ul>
9770 </li>
9771 </ul>
9772 </div>
9773 <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>
9774 <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>
9775 <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>
9776 <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>
9777 <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>
9778 <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>
9779 <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>
9780 <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>
9781 <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>
9782 <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>
9783
9784 !! end
9785
9786 !! test
9787 TOC regression (bug 9764)
9788 !! input
9789 == title 1 ==
9790 === title 1.1 ===
9791 ==== title 1.1.1 ====
9792 === title 1.2 ===
9793 == title 2 ==
9794 === title 2.1 ===
9795 !! result
9796 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9797 <ul>
9798 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9799 <ul>
9800 <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>
9801 <ul>
9802 <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>
9803 </ul>
9804 </li>
9805 <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>
9806 </ul>
9807 </li>
9808 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9809 <ul>
9810 <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>
9811 </ul>
9812 </li>
9813 </ul>
9814 </div>
9815 <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>
9816 <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>
9817 <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>
9818 <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>
9819 <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>
9820 <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>
9821
9822 !! end
9823
9824 !! test
9825 TOC with wgMaxTocLevel=3 (bug 6204)
9826 !! options
9827 wgMaxTocLevel=3
9828 !! input
9829 == title 1 ==
9830 === title 1.1 ===
9831 ==== title 1.1.1 ====
9832 === title 1.2 ===
9833 == title 2 ==
9834 === title 2.1 ===
9835 !! result
9836 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9837 <ul>
9838 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9839 <ul>
9840 <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>
9841 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
9842 </ul>
9843 </li>
9844 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9845 <ul>
9846 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
9847 </ul>
9848 </li>
9849 </ul>
9850 </div>
9851 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9852 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9853 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9854 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9855 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9856 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9857
9858 !! end
9859
9860 !! test
9861 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9862 !! options
9863 wgMaxTocLevel=3
9864 !! input
9865 ==Section 1==
9866 ===Section 1.1===
9867 ====Section 1.1.1====
9868 ====Section 1.1.1.1====
9869 ==Section 2==
9870 !! result
9871 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9872 <ul>
9873 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9874 <ul>
9875 <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>
9876 </ul>
9877 </li>
9878 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9879 </ul>
9880 </div>
9881 <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>
9882 <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>
9883 <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>
9884 <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>
9885 <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>
9886
9887 !! end
9888
9889
9890 !! test
9891 Resolving duplicate section names
9892 !! input
9893 == Foo bar ==
9894 == Foo bar ==
9895 !! result
9896 <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>
9897 <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>
9898
9899 !! end
9900
9901 !! test
9902 Resolving duplicate section names with differing case (bug 10721)
9903 !! input
9904 == Foo bar ==
9905 == Foo Bar ==
9906 !! result
9907 <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>
9908 <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>
9909
9910 !! end
9911
9912 !! article
9913 Template:sections
9914 !! text
9915 ===Section 1===
9916 ==Section 2==
9917 !! endarticle
9918
9919 !! test
9920 Template with sections, __NOTOC__
9921 !! input
9922 __NOTOC__
9923 ==Section 0==
9924 {{sections}}
9925 ==Section 4==
9926 !! result
9927 <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>
9928 <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>
9929 <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>
9930 <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>
9931
9932 !! end
9933
9934 !! test
9935 __NOEDITSECTION__ keyword
9936 !! input
9937 __NOEDITSECTION__
9938 ==Section 1==
9939 ==Section 2==
9940 !! result
9941 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9942 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9943
9944 !! end
9945
9946 !! test
9947 Link inside a section heading
9948 !! input
9949 ==Section with a [[Main Page|link]] in it==
9950 !! result
9951 <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>
9952
9953 !! end
9954
9955 !! test
9956 TOC regression (bug 12077)
9957 !! input
9958 __TOC__
9959 == title 1 ==
9960 === title 1.1 ===
9961 == title 2 ==
9962 !! result
9963 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9964 <ul>
9965 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9966 <ul>
9967 <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>
9968 </ul>
9969 </li>
9970 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9971 </ul>
9972 </div>
9973 <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>
9974 <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>
9975 <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>
9976
9977 !! end
9978
9979 !! test
9980 BUG 1219 URL next to image (good)
9981 !! input
9982 http://example.com [[Image:foobar.jpg]]
9983 !! result
9984 <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>
9985 </p>
9986 !!end
9987
9988 !! test
9989 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9990 !! input
9991 ===
9992 The line above must have a trailing space!
9993 === <!--
9994 --> <!-- -->
9995 But just in case it doesn't...
9996 !! result
9997 <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>
9998 <p>The line above must have a trailing space!
9999 </p>
10000 <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>
10001 <p>But just in case it doesn't...
10002 </p>
10003 !! end
10004
10005 !! test
10006 Header with special characters (bug 25462)
10007 !! input
10008 The tooltips shall not show entities to the user (ie. be double escaped)
10009
10010 == text > text ==
10011 section 1
10012
10013 == text < text ==
10014 section 2
10015
10016 == text & text ==
10017 section 3
10018
10019 == text ' text ==
10020 section 4
10021
10022 == text " text ==
10023 section 5
10024 !! result
10025 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10026 </p>
10027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10028 <ul>
10029 <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>
10030 <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>
10031 <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>
10032 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10033 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10034 </ul>
10035 </div>
10036 <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>
10037 <p>section 1
10038 </p>
10039 <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>
10040 <p>section 2
10041 </p>
10042 <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>
10043 <p>section 3
10044 </p>
10045 <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>
10046 <p>section 4
10047 </p>
10048 <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>
10049 <p>section 5
10050 </p>
10051 !! end
10052
10053 !! test
10054 Headers with excess '=' characters
10055 (Are similar tests necessary beyond the 1st level?)
10056 !! input
10057 =foo==
10058 ==foo=
10059 =''italic'' heading==
10060 ==''italic'' heading=
10061 !! result
10062 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10063 <ul>
10064 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10065 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10066 <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>
10067 <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>
10068 </ul>
10069 </div>
10070 <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>
10071 <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>
10072 <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>
10073 <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>
10074
10075 !! end
10076
10077 !! test
10078 HTML headers vs TOC (bug 23393)
10079 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10080 !! input
10081 <h1>Header 1</h1>
10082 == Header 1.1 ==
10083 == Header 1.2 ==
10084
10085 <h1>Header 2
10086 </h1>
10087 == Header 2.1 ==
10088 == Header 2.2 ==
10089 __NOEDITSECTION__
10090 !! result
10091 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10092 <ul>
10093 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10094 <ul>
10095 <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>
10096 <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>
10097 </ul>
10098 </li>
10099 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10100 <ul>
10101 <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>
10102 <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>
10103 </ul>
10104 </li>
10105 </ul>
10106 </div>
10107 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10108 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10109 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10110 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10111 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10112 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10113
10114 !! end
10115
10116 !! test
10117 BUG 1219 URL next to image (broken)
10118 !! input
10119 http://example.com[[Image:foobar.jpg]]
10120 !! result
10121 <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>
10122 </p>
10123 !!end
10124
10125 !! test
10126 Bug 1186 news: in the middle of text
10127 !! input
10128 http://en.wikinews.org/wiki/Wikinews:Workplace
10129 !! result
10130 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10131 </p>
10132 !!end
10133
10134
10135 !! test
10136 Namespaced link must have a title
10137 !! input
10138 [[Project:]]
10139 !! result
10140 <p>[[Project:]]
10141 </p>
10142 !!end
10143
10144 !! test
10145 Namespaced link must have a title (bad fragment version)
10146 !! input
10147 [[Project:#fragment]]
10148 !! result
10149 <p>[[Project:#fragment]]
10150 </p>
10151 !!end
10152
10153
10154 ###
10155 ### HTML tags and HTML attributes
10156 ###
10157
10158 !! test
10159 div with no attributes
10160 !! input
10161 <div>HTML rocks</div>
10162 !! result
10163 <div>HTML rocks</div>
10164
10165 !! end
10166
10167 !! test
10168 div with double-quoted attribute
10169 !! input
10170 <div id="rock">HTML rocks</div>
10171 !! result
10172 <div id="rock">HTML rocks</div>
10173
10174 !! end
10175
10176 !! test
10177 div with single-quoted attribute
10178 !! input
10179 <div id='rock'>HTML rocks</div>
10180 !! result
10181 <div id="rock">HTML rocks</div>
10182
10183 !! end
10184
10185 !! test
10186 div with unquoted attribute
10187 !! input
10188 <div id=rock>HTML rocks</div>
10189 !! result
10190 <div id="rock">HTML rocks</div>
10191
10192 !! end
10193
10194 !! test
10195 div with illegal double attributes
10196 !! input
10197 <div id="a" id="b">HTML rocks</div>
10198 !! result
10199 <div id="b">HTML rocks</div>
10200
10201 !!end
10202
10203 # FIXME: produce empty string instead of "class" in the PHP parser, following
10204 # the HTML5 spec.
10205 !! test
10206 div with empty attribute value, space before equals
10207 !! options
10208 parsoid
10209 !! input
10210 <div class =>HTML rocks</div>
10211 !! result
10212 <div class="">HTML rocks</div>
10213
10214 !! end
10215
10216 # The PHP parser escapes the opening brace to &#123; for some reason, so
10217 # disabled this test for it.
10218 !! test
10219 div with braces in attribute value
10220 !! options
10221 parsoid
10222 !! input
10223 <div title="{}">Foo</div>
10224 !! result
10225 <div title="{}">Foo</div>
10226 !! end
10227
10228 # This it very inconsistent in the PHP parser: it returns
10229 # class="class" if there is a space between the name and the equal sign (see
10230 # 'div with empty attribute value, space before equals'), but strips the
10231 # attribute completely if the space is missing. We hope that not much content
10232 # depends on this, so are implementing the behavior below in Parsoid for
10233 # consistencies' sake. Disabled for the PHP parser.
10234 # FIXME: fix this behavior in the PHP parser?
10235 !! test
10236 div with empty attribute value, no space before equals
10237 !! options
10238 parsoid
10239 !! input
10240 <div class=>HTML rocks</div>
10241 !! result
10242 <div class="">HTML rocks</div>
10243
10244 !! end
10245
10246 !! test
10247 HTML multiple attributes correction
10248 !! input
10249 <p class="error" class="awesome">Awesome!</p>
10250 !! result
10251 <p class="awesome">Awesome!</p>
10252
10253 !!end
10254
10255 !! test
10256 Table multiple attributes correction
10257 !! input
10258 {|
10259 !+ class="error" class="awesome"| status
10260 |}
10261 !! result
10262 <table>
10263 <tr>
10264 <th class="awesome"> status
10265 </th></tr></table>
10266
10267 !!end
10268
10269 !! test
10270 DIV IN UPPERCASE
10271 !! input
10272 <DIV ID="x">HTML ROCKS</DIV>
10273 !! result
10274 <div id="x">HTML ROCKS</div>
10275
10276 !!end
10277
10278 !! test
10279 Non-ASCII pseudo-tags are rendered as text
10280 !! input
10281 <khyô>
10282 !! result
10283 <p>&lt;khyô&gt;
10284 </p>
10285 !! end
10286
10287 !! test
10288 Pseudo-tag with URL 'name' renders as url link
10289 !! input
10290 <http://example.com/>
10291 !! result
10292 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10293 </p>
10294 !! end
10295
10296 !! test
10297 text with amp in the middle of nowhere
10298 !! input
10299 Remember AT&T?
10300 !!result
10301 <p>Remember AT&amp;T?
10302 </p>
10303 !! end
10304
10305 !! test
10306 text with character entity: eacute
10307 !! input
10308 I always thought &eacute; was a cute letter.
10309 !! result
10310 <p>I always thought &#233; was a cute letter.
10311 </p>
10312 !! end
10313
10314 !! test
10315 text with entity-escaped character entity-like string: eacute
10316 !! input
10317 I always thought &amp;eacute; was a cute letter.
10318 !! result
10319 <p>I always thought &amp;eacute; was a cute letter.
10320 </p>
10321 !! end
10322
10323 !! test
10324 text with undefined character entity: xacute
10325 !! input
10326 I always thought &xacute; was a cute letter.
10327 !! result
10328 <p>I always thought &amp;xacute; was a cute letter.
10329 </p>
10330 !! end
10331
10332
10333 ###
10334 ### Nesting tests (see bug 41545, 50604, 51081)
10335 ###
10336
10337 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10338 # Note that html2wt is considerably more difficult if we use <b> in
10339 # the test case, instead of <big>
10340 !! test
10341 Ensure that HTML adoption agency algorithm is properly implemented.
10342 !! input
10343 <big>X<big>Y</big>Z</big>
10344 !! result
10345 <p><big>X<big>Y</big>Z</big>
10346 </p>
10347 !! end
10348
10349 # This was bug 41545 in the PHP parser.
10350 !! test
10351 Nesting of <kbd>
10352 !! input
10353 <kbd>X<kbd>Y</kbd>Z</kbd>
10354 !! result
10355 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10356 </p>
10357 !! end
10358
10359 # The following cases were bug 51081 in the PHP parser.
10360 # Note that there are some other nestable tags (b, i, etc) which are
10361 # not covered; see bug 51081 for discussion.
10362 !! test
10363 Nesting of <em>
10364 !! input
10365 <em>X<em>Y</em>Z</em>
10366 !! result
10367 <p><em>X<em>Y</em>Z</em>
10368 </p>
10369 !! end
10370
10371 !! test
10372 Nesting of <strong>
10373 !! input
10374 <strong>X<strong>Y</strong>Z</strong>
10375 !! result
10376 <p><strong>X<strong>Y</strong>Z</strong>
10377 </p>
10378 !! end
10379
10380 !! test
10381 Nesting of <q>
10382 !! input
10383 <q>X<q>Y</q>Z</q>
10384 !! result
10385 <p><q>X<q>Y</q>Z</q>
10386 </p>
10387 !! end
10388
10389 !! test
10390 Nesting of <ruby>
10391 !! input
10392 <ruby>X<ruby>Y</ruby>Z</ruby>
10393 !! result
10394 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10395 </p>
10396 !! end
10397
10398 !! test
10399 Nesting of <bdo>
10400 !! input
10401 <bdo>X<bdo>Y</bdo>Z</bdo>
10402 !! result
10403 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10404 </p>
10405 !! end
10406
10407
10408 ###
10409 ### Media links
10410 ###
10411
10412 !! test
10413 Media link
10414 !! input
10415 [[Media:Foobar.jpg]]
10416 !! result
10417 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10418 </p>
10419 !! end
10420
10421 !! test
10422 Media link with text
10423 !! input
10424 [[Media:Foobar.jpg|A neat file to look at]]
10425 !! result
10426 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10427 </p>
10428 !! end
10429
10430 # FIXME: this is still bad HTML tag nesting
10431 !! test
10432 Media link with nasty text
10433 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10434 !! input
10435 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10436 !! result
10437 <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>
10438
10439 !! end
10440
10441 !! test
10442 Media link to nonexistent file (bug 1702)
10443 !! input
10444 [[Media:No such.jpg]]
10445 !! result
10446 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10447 </p>
10448 !! end
10449
10450 !! test
10451 Image link to nonexistent file (bug 1850 - good)
10452 !! input
10453 [[Image:No such.jpg]]
10454 !! result
10455 <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>
10456 </p>
10457 !! end
10458
10459 !! test
10460 :Image link to nonexistent file (bug 1850 - bad)
10461 !! input
10462 [[:Image:No such.jpg]]
10463 !! result
10464 <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>
10465 </p>
10466 !! end
10467
10468
10469
10470 !! test
10471 Character reference normalization in link text (bug 1938)
10472 !! input
10473 [[Main Page|this&that]]
10474 !! result
10475 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10476 </p>
10477 !!end
10478
10479 !! article
10480 אַ
10481 !! text
10482 Test for unicode normalization
10483
10484 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10485 !! endarticle
10486
10487 !! test
10488 (bug 19451) Links should refer to the normalized form.
10489 !! input
10490 [[&#xFB2E;]]
10491 [[&#x5d0;&#x5b7;]]
10492 [[&#x5d0;ַ]]
10493 [[א&#x5b7;]]
10494 [[אַ]]
10495 !! result
10496 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10497 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10498 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10499 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10500 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10501 </p>
10502 !! end
10503
10504 !! test
10505 Empty attribute crash test (bug 2067)
10506 !! input
10507 <font color="">foo</font>
10508 !! result
10509 <p><font color="">foo</font>
10510 </p>
10511 !! end
10512
10513 !! test
10514 Empty attribute crash test single-quotes (bug 2067)
10515 !! input
10516 <font color=''>foo</font>
10517 !! result
10518 <p><font color="">foo</font>
10519 </p>
10520 !! end
10521
10522 !! test
10523 Attribute test: equals, then nothing
10524 !! input
10525 <font color=>foo</font>
10526 !! result
10527 <p><font>foo</font>
10528 </p>
10529 !! end
10530
10531 !! test
10532 Attribute test: unquoted value
10533 !! input
10534 <font color=x>foo</font>
10535 !! result
10536 <p><font color="x">foo</font>
10537 </p>
10538 !! end
10539
10540 !! test
10541 Attribute test: unquoted but illegal value (hash)
10542 !! input
10543 <font color=#x>foo</font>
10544 !! result
10545 <p><font color="#x">foo</font>
10546 </p>
10547 !! end
10548
10549 !! test
10550 Attribute test: no value
10551 !! input
10552 <font color>foo</font>
10553 !! result
10554 <p><font color="color">foo</font>
10555 </p>
10556 !! end
10557
10558 !! test
10559 Bug 2095: link with three closing brackets
10560 !! input
10561 [[Main Page]]]
10562 !! result
10563 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10564 </p>
10565 !! end
10566
10567 !! test
10568 Bug 2095: link with pipe and three closing brackets
10569 !! input
10570 [[Main Page|link]]]
10571 !! result
10572 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10573 </p>
10574 !! end
10575
10576 !! test
10577 Bug 2095: link with pipe and three closing brackets, version 2
10578 !! input
10579 [[Main Page|[http://example.com/]]]
10580 !! result
10581 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10582 </p>
10583 !! end
10584
10585
10586 ###
10587 ### Safety
10588 ###
10589
10590 !! article
10591 Template:Dangerous attribute
10592 !! text
10593 " onmouseover="alert(document.cookie)
10594 !! endarticle
10595
10596 !! article
10597 Template:Dangerous style attribute
10598 !! text
10599 border-size: expression(alert(document.cookie))
10600 !! endarticle
10601
10602 !! article
10603 Template:Div style
10604 !! text
10605 <div style="float: right; {{{1}}}">Magic div</div>
10606 !! endarticle
10607
10608 !! test
10609 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10610 !! input
10611 <div title="{{test}}"></div>
10612 !! result
10613 <div title="This is a test template"></div>
10614
10615 !! end
10616
10617 !! test
10618 Bug 2304: HTML attribute safety (dangerous template; 2309)
10619 !! input
10620 <div title="{{dangerous attribute}}"></div>
10621 !! result
10622 <div title=""></div>
10623
10624 !! end
10625
10626 !! test
10627 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10628 !! input
10629 <div style="{{dangerous style attribute}}"></div>
10630 !! result
10631 <div style="/* insecure input */"></div>
10632
10633 !! end
10634
10635 !! test
10636 Bug 2304: HTML attribute safety (safe parameter; 2309)
10637 !! input
10638 {{div style|width: 200px}}
10639 !! result
10640 <div style="float: right; width: 200px">Magic div</div>
10641
10642 !! end
10643
10644 !! test
10645 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10646 !! input
10647 {{div style|width: expression(alert(document.cookie))}}
10648 !! result
10649 <div style="/* insecure input */">Magic div</div>
10650
10651 !! end
10652
10653 !! test
10654 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10655 !! input
10656 {{div style|"><script>alert(document.cookie)</script>}}
10657 !! result
10658 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10659
10660 !! end
10661
10662 !! test
10663 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10664 !! input
10665 {{div style|" ><script>alert(document.cookie)</script>}}
10666 !! result
10667 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10668
10669 !! end
10670
10671 !! test
10672 Bug 2304: HTML attribute safety (link)
10673 !! input
10674 <div title="[[Main Page]]"></div>
10675 !! result
10676 <div title="&#91;&#91;Main Page]]"></div>
10677
10678 !! end
10679
10680 !! test
10681 Bug 2304: HTML attribute safety (italics)
10682 !! input
10683 <div title="''foobar''"></div>
10684 !! result
10685 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10686
10687 !! end
10688
10689 !! test
10690 Bug 2304: HTML attribute safety (bold)
10691 !! input
10692 <div title="'''foobar'''"></div>
10693 !! result
10694 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10695
10696 !! end
10697
10698
10699 !! test
10700 Bug 2304: HTML attribute safety (ISBN)
10701 !! input
10702 <div title="ISBN 1234567890"></div>
10703 !! result
10704 <div title="&#73;SBN 1234567890"></div>
10705
10706 !! end
10707
10708 !! test
10709 Bug 2304: HTML attribute safety (RFC)
10710 !! input
10711 <div title="RFC 1234"></div>
10712 !! result
10713 <div title="&#82;FC 1234"></div>
10714
10715 !! end
10716
10717 !! test
10718 Bug 2304: HTML attribute safety (PMID)
10719 !! input
10720 <div title="PMID 1234567890"></div>
10721 !! result
10722 <div title="&#80;MID 1234567890"></div>
10723
10724 !! end
10725
10726 !! test
10727 Bug 2304: HTML attribute safety (web link)
10728 !! input
10729 <div title="http://example.com/"></div>
10730 !! result
10731 <div title="http&#58;//example.com/"></div>
10732
10733 !! end
10734
10735 !! test
10736 Bug 2304: HTML attribute safety (named web link)
10737 !! input
10738 <div title="[http://example.com/ link]"></div>
10739 !! result
10740 <div title="&#91;http&#58;//example.com/ link]"></div>
10741
10742 !! end
10743
10744 !! test
10745 Bug 3244: HTML attribute safety (extension; safe)
10746 !! input
10747 <div style="<nowiki>background:blue</nowiki>"></div>
10748 !! result
10749 <div style="background:blue"></div>
10750
10751 !! end
10752
10753 !! test
10754 Bug 3244: HTML attribute safety (extension; unsafe)
10755 !! input
10756 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10757 !! result
10758 <div style="/* insecure input */"></div>
10759
10760 !! end
10761
10762 # More MSIE fun discovered by Tom Gilder
10763
10764 !! test
10765 MSIE CSS safety test: spurious slash
10766 !! input
10767 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10768 !! result
10769 <div style="/* insecure input */">evil</div>
10770
10771 !! end
10772
10773 !! test
10774 MSIE CSS safety test: hex code
10775 !! input
10776 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10777 !! result
10778 <div style="/* insecure input */">evil</div>
10779
10780 !! end
10781
10782 !! test
10783 MSIE CSS safety test: comment in url
10784 !! input
10785 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10786 !! result
10787 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10788
10789 !! end
10790
10791 !! test
10792 MSIE CSS safety test: comment in expression
10793 !! input
10794 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10795 !! result
10796 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10797
10798 !! end
10799
10800
10801 !! test
10802 Table attribute legitimate extension
10803 !! input
10804 {|
10805 !+ style="<nowiki>color:blue</nowiki>"| status
10806 |}
10807 !! result
10808 <table>
10809 <tr>
10810 <th style="color:blue"> status
10811 </th></tr></table>
10812
10813 !!end
10814
10815 !! test
10816 Table attribute safety
10817 !! input
10818 {|
10819 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10820 |}
10821 !! result
10822 <table>
10823 <tr>
10824 <th style="/* insecure input */"> status
10825 </th></tr></table>
10826
10827 !! end
10828
10829 !! test
10830 CSS line continuation 1
10831 !! input
10832 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10833 !! result
10834 <div style="/* insecure input */"></div>
10835
10836 !! end
10837
10838 !! test
10839 CSS line continuation 2
10840 !! input
10841 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10842 !! result
10843 <div style="/* insecure input */"></div>
10844
10845 !! end
10846
10847 !! article
10848 Template:Identity
10849 !! text
10850 {{{1}}}
10851 !! endarticle
10852
10853 !! test
10854 Expansion of multi-line templates in attribute values (bug 6255)
10855 !! input
10856 <div style="background: {{identity|#00FF00}}">-</div>
10857 !! result
10858 <div style="background: #00FF00">-</div>
10859
10860 !! end
10861
10862
10863 !! test
10864 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10865 !! input
10866 <div style="background:
10867 #00FF00">-</div>
10868 !! result
10869 <div style="background: #00FF00">-</div>
10870
10871 !! end
10872
10873 !! test
10874 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10875 !! input
10876 <div style="background: &#10;#00FF00">-</div>
10877 !! result
10878 <div style="background: &#10;#00FF00">-</div>
10879
10880 !! end
10881
10882 ###
10883 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10884 ###
10885 !! test
10886 Parser hook: empty input
10887 !! input
10888 <tag></tag>
10889 !! result
10890 <pre>
10891 ''
10892 array (
10893 )
10894 </pre>
10895
10896 !! end
10897
10898 !! test
10899 Parser hook: empty input using terminated empty elements
10900 !! input
10901 <tag/>
10902 !! result
10903 <pre>
10904 NULL
10905 array (
10906 )
10907 </pre>
10908
10909 !! end
10910
10911 !! test
10912 Parser hook: empty input using terminated empty elements (space before)
10913 !! input
10914 <tag />
10915 !! result
10916 <pre>
10917 NULL
10918 array (
10919 )
10920 </pre>
10921
10922 !! end
10923
10924 !! test
10925 Parser hook: basic input
10926 !! input
10927 <tag>input</tag>
10928 !! result
10929 <pre>
10930 'input'
10931 array (
10932 )
10933 </pre>
10934
10935 !! end
10936
10937
10938 !! test
10939 Parser hook: case insensitive
10940 !! input
10941 <TAG>input</TAG>
10942 !! result
10943 <pre>
10944 'input'
10945 array (
10946 )
10947 </pre>
10948
10949 !! end
10950
10951
10952 !! test
10953 Parser hook: case insensitive, redux
10954 !! input
10955 <TaG>input</TAg>
10956 !! result
10957 <pre>
10958 'input'
10959 array (
10960 )
10961 </pre>
10962
10963 !! end
10964
10965 !! test
10966 Parser hook: nested tags
10967 !! options
10968 noxml
10969 !! input
10970 <tag><tag></tag></tag>
10971 !! result
10972 <pre>
10973 '<tag>'
10974 array (
10975 )
10976 </pre>&lt;/tag&gt;
10977
10978 !! end
10979
10980 !! test
10981 Parser hook: basic arguments
10982 !! input
10983 <tag width=200 height = "100" depth = '50' square></tag>
10984 !! result
10985 <pre>
10986 ''
10987 array (
10988 'width' => '200',
10989 'height' => '100',
10990 'depth' => '50',
10991 'square' => 'square',
10992 )
10993 </pre>
10994
10995 !! end
10996
10997 !! test
10998 Parser hook: argument containing a forward slash (bug 5344)
10999 !! input
11000 <tag filename='/tmp/bla'></tag>
11001 !! result
11002 <pre>
11003 ''
11004 array (
11005 'filename' => '/tmp/bla',
11006 )
11007 </pre>
11008
11009 !! end
11010
11011 !! test
11012 Parser hook: empty input using terminated empty elements (bug 2374)
11013 !! input
11014 <tag foo=bar/>text
11015 !! result
11016 <pre>
11017 NULL
11018 array (
11019 'foo' => 'bar',
11020 )
11021 </pre>text
11022
11023 !! end
11024
11025 # </tag> should be output literally since there is no matching tag that begins it
11026 !! test
11027 Parser hook: basic arguments using terminated empty elements (bug 2374)
11028 !! input
11029 <tag width=200 height = "100" depth = '50' square/>
11030 other stuff
11031 </tag>
11032 !! result
11033 <pre>
11034 NULL
11035 array (
11036 'width' => '200',
11037 'height' => '100',
11038 'depth' => '50',
11039 'square' => 'square',
11040 )
11041 </pre>
11042 <p>other stuff
11043 &lt;/tag&gt;
11044 </p>
11045 !! end
11046
11047 ###
11048 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11049 ###
11050
11051 !! test
11052 Parser hook: static parser hook not inside a comment
11053 !! input
11054 <statictag>hello, world</statictag>
11055 <statictag action=flush/>
11056 !! result
11057 <p>hello, world
11058 </p>
11059 !! end
11060
11061
11062 !! test
11063 Parser hook: static parser hook inside a comment
11064 !! input
11065 <!-- <statictag>hello, world</statictag> -->
11066 <statictag action=flush/>
11067 !! result
11068 <p><br />
11069 </p>
11070 !! end
11071
11072 # Nested template calls; this case was broken by Parser.php rev 1.506,
11073 # since reverted.
11074
11075 !! article
11076 Template:One-parameter
11077 !! text
11078 (My parameter is: {{{1}}})
11079 !! endarticle
11080
11081 !! article
11082 Template:Map-one-parameter
11083 !! text
11084 {{{{{1}}}|{{{2}}}}}
11085 !! endarticle
11086
11087 !! test
11088 Nested template calls
11089 !! input
11090 {{Map-one-parameter|One-parameter|param}}
11091 !! result
11092 <p>(My parameter is: param)
11093 </p>
11094 !! end
11095
11096
11097 ###
11098 ### Sanitizer
11099 ###
11100 !! test
11101 Sanitizer: Closing of open tags
11102 !! input
11103 <s></s><table></table>
11104 !! result
11105 <s></s><table></table>
11106
11107 !! end
11108
11109 !! test
11110 Sanitizer: Closing of open but not closed tags
11111 !! input
11112 <s>foo
11113 !! result
11114 <p><s>foo</s>
11115 </p>
11116 !! end
11117
11118 !! test
11119 Sanitizer: Closing of closed but not open tags
11120 !! input
11121 </s>
11122 !! result
11123 <p>&lt;/s&gt;
11124 </p>
11125 !! end
11126
11127 !! test
11128 Sanitizer: Closing of closed but not open table tags
11129 !! input
11130 Table not started</td></tr></table>
11131 !! result
11132 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11133 </p>
11134 !! end
11135
11136 !! test
11137 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11138 !! input
11139 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11140 !! result
11141 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11142 </p>
11143 !! end
11144
11145 !! test
11146 Sanitizer: Validating the contents of the id attribute (bug 4515)
11147 !! options
11148 disabled
11149 !! input
11150 <br id=9 />
11151 !! result
11152 Something, but definitely not <br id="9" />...
11153 !! end
11154
11155 !! test
11156 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11157 !! options
11158 disabled
11159 !! input
11160 <br id="foo" /><br id="foo" />
11161 !! result
11162 Something need to be done. foo-2 ?
11163 !! end
11164
11165 !! test
11166 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11167 !! input
11168 <div itemscope>
11169 <meta itemprop="hello" content="world">
11170 <meta http-equiv="refresh" content="5">
11171 <meta itemprop="hello" http-equiv="refresh" content="5">
11172 <link itemprop="hello" href="{{SERVER}}">
11173 <link rel="stylesheet" href="{{SERVER}}">
11174 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11175 </div>
11176 !! result
11177 <div itemscope="itemscope">
11178 <p> <meta itemprop="hello" content="world" />
11179 &lt;meta http-equiv="refresh" content="5"&gt;
11180 <meta itemprop="hello" content="5" />
11181 </p>
11182 <link itemprop="hello" href="http&#58;//example.org" />
11183 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11184 <link itemprop="hello" href="http&#58;//example.org" />
11185 </div>
11186
11187 !! end
11188
11189 !! test
11190 Language converter: output gets cut off unexpectedly (bug 5757)
11191 !! options
11192 language=zh
11193 !! input
11194 this bit is safe: }-
11195
11196 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11197
11198 then we get cut off here: }-
11199
11200 all additional text is vanished
11201 !! result
11202 <p>this bit is safe: }-
11203 </p><p>but if we add a conversion instance: xxx
11204 </p><p>then we get cut off here: }-
11205 </p><p>all additional text is vanished
11206 </p>
11207 !! end
11208
11209 !! test
11210 Self closed html pairs (bug 5487)
11211 !! options
11212 !! input
11213 <center><font id="bug" />Centered text</center>
11214 <div><font id="bug2" />In div text</div>
11215 !! result
11216 <center>&lt;font id="bug" /&gt;Centered text</center>
11217 <div>&lt;font id="bug2" /&gt;In div text</div>
11218
11219 !! end
11220
11221 #
11222 #
11223 #
11224
11225 !! test
11226 Punctuation: nbsp before exclamation
11227 !! input
11228 C'est grave !
11229 !! result
11230 <p>C'est grave&#160;!
11231 </p>
11232 !! end
11233
11234 !! test
11235 Punctuation: CSS !important (bug 11874)
11236 !! input
11237 <div style="width:50% !important">important</div>
11238 !! result
11239 <div style="width:50% !important">important</div>
11240
11241 !!end
11242
11243 !! test
11244 Punctuation: CSS ! important (bug 11874; with space after)
11245 !! input
11246 <div style="width:50% ! important">important</div>
11247 !! result
11248 <div style="width:50% ! important">important</div>
11249
11250 !!end
11251
11252
11253 !! test
11254 HTML bullet list, closed tags (bug 5497)
11255 !! input
11256 <ul>
11257 <li>One</li>
11258 <li>Two</li>
11259 </ul>
11260 !! result
11261 <ul>
11262 <li>One</li>
11263 <li>Two</li>
11264 </ul>
11265
11266 !! end
11267
11268 !! test
11269 HTML bullet list, unclosed tags (bug 5497)
11270 !! options
11271 disabled
11272 !! input
11273 <ul>
11274 <li>One
11275 <li>Two
11276 </ul>
11277 !! result
11278 <ul>
11279 <li>One
11280 </li><li>Two
11281 </li></ul>
11282
11283 !! end
11284
11285 !! test
11286 HTML ordered list, closed tags (bug 5497)
11287 !! input
11288 <ol>
11289 <li>One</li>
11290 <li>Two</li>
11291 </ol>
11292 !! result
11293 <ol>
11294 <li>One</li>
11295 <li>Two</li>
11296 </ol>
11297
11298 !! end
11299
11300 !! test
11301 HTML ordered list, unclosed tags (bug 5497)
11302 !! options
11303 disabled
11304 !! input
11305 <ol>
11306 <li>One
11307 <li>Two
11308 </ol>
11309 !! result
11310 <ol>
11311 <li>One
11312 </li><li>Two
11313 </li></ol>
11314
11315 !! end
11316
11317 !! test
11318 HTML nested bullet list, closed tags (bug 5497)
11319 !! input
11320 <ul>
11321 <li>One</li>
11322 <li>Two:
11323 <ul>
11324 <li>Sub-one</li>
11325 <li>Sub-two</li>
11326 </ul>
11327 </li>
11328 </ul>
11329 !! result
11330 <ul>
11331 <li>One</li>
11332 <li>Two:
11333 <ul>
11334 <li>Sub-one</li>
11335 <li>Sub-two</li>
11336 </ul>
11337 </li>
11338 </ul>
11339
11340 !! end
11341
11342 !! test
11343 HTML nested bullet list, open tags (bug 5497)
11344 !! options
11345 disabled
11346 !! input
11347 <ul>
11348 <li>One
11349 <li>Two:
11350 <ul>
11351 <li>Sub-one
11352 <li>Sub-two
11353 </ul>
11354 </ul>
11355 !! result
11356 <ul>
11357 <li>One
11358 </li><li>Two:
11359 <ul>
11360 <li>Sub-one
11361 </li><li>Sub-two
11362 </li></ul>
11363 </li></ul>
11364
11365 !! end
11366
11367 !! test
11368 HTML nested ordered list, closed tags (bug 5497)
11369 !! input
11370 <ol>
11371 <li>One</li>
11372 <li>Two:
11373 <ol>
11374 <li>Sub-one</li>
11375 <li>Sub-two</li>
11376 </ol>
11377 </li>
11378 </ol>
11379 !! result
11380 <ol>
11381 <li>One</li>
11382 <li>Two:
11383 <ol>
11384 <li>Sub-one</li>
11385 <li>Sub-two</li>
11386 </ol>
11387 </li>
11388 </ol>
11389
11390 !! end
11391
11392 !! test
11393 HTML nested ordered list, open tags (bug 5497)
11394 !! options
11395 disabled
11396 !! input
11397 <ol>
11398 <li>One
11399 <li>Two:
11400 <ol>
11401 <li>Sub-one
11402 <li>Sub-two
11403 </ol>
11404 </ol>
11405 !! result
11406 <ol>
11407 <li>One
11408 </li><li>Two:
11409 <ol>
11410 <li>Sub-one
11411 </li><li>Sub-two
11412 </li></ol>
11413 </li></ol>
11414
11415 !! end
11416
11417 !! test
11418 HTML ordered list item with parameters oddity
11419 !! input
11420 <ol><li id="fragment">One</li></ol>
11421 !! result
11422 <ol><li id="fragment">One</li></ol>
11423
11424 !! end
11425
11426 !!test
11427 bug 5918: autonumbering
11428 !! input
11429 [http://first/] [http://second] [ftp://ftp]
11430
11431 ftp://inlineftp
11432
11433 [mailto:enclosed@mail.tld With target]
11434
11435 [mailto:enclosed@mail.tld]
11436
11437 mailto:inline@mail.tld
11438 !! result
11439 <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>
11440 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11441 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11442 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11443 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11444 </p>
11445 !! end
11446
11447
11448 #
11449 # Security and HTML correctness
11450 # From Nick Jenkins' fuzz testing
11451 #
11452
11453 !! test
11454 Fuzz testing: Parser13
11455 !! input
11456 {|
11457 | http://a|
11458 !! result
11459 <table>
11460 <tr>
11461 <td>
11462 </td>
11463 </tr>
11464 </table>
11465
11466 !! end
11467
11468 !! test
11469 Fuzz testing: Parser14
11470 !! input
11471 == onmouseover= ==
11472 http://__TOC__
11473 !! result
11474 <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>
11475 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11476 <ul>
11477 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11478 </ul>
11479 </div>
11480
11481 !! end
11482
11483 !! test
11484 Fuzz testing: Parser14-table
11485 !! input
11486 ==a==
11487 {| STYLE=__TOC__
11488 !! result
11489 <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>
11490 <table style="&#95;_TOC&#95;_">
11491 <tr><td></td></tr>
11492 </table>
11493
11494 !! end
11495
11496 # Known to produce bogus xml (extra </td>)
11497 !! test
11498 Fuzz testing: Parser16
11499 !! options
11500 noxml
11501 !! input
11502 {|
11503 !https://||||||
11504 !! result
11505 <table>
11506 <tr>
11507 <th>https://</th>
11508 <th></th>
11509 <th></th>
11510 <th>
11511 </td>
11512 </tr>
11513 </table>
11514
11515 !! end
11516
11517 !! test
11518 Fuzz testing: Parser21
11519 !! input
11520 {|
11521 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11522 |
11523 !! result
11524 <table>
11525 <tr>
11526 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11527 </th>
11528 <td>
11529 </td>
11530 </tr>
11531 </table>
11532
11533 !! end
11534
11535 !! test
11536 Fuzz testing: Parser22
11537 !! input
11538 http://===r:::https://b
11539
11540 {|
11541 !!result
11542 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11543 </p>
11544 <table>
11545 <tr><td></td></tr>
11546 </table>
11547
11548 !! end
11549
11550 # Known to produce bad XML for now
11551 !! test
11552 Fuzz testing: Parser24
11553 !! options
11554 noxml
11555 !! input
11556 {|
11557 {{{|
11558 <u CLASS=
11559 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11560 <br style="onmouseover='alert(document.cookie);' " />
11561
11562 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11563 |
11564 !! result
11565 <table>
11566 {{{|
11567 <u class="&#124;">}}}} &gt;
11568 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11569
11570 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11571 <tr>
11572 <td></u>
11573 </td>
11574 </tr>
11575 </table>
11576
11577 !! end
11578
11579 # Note: the current result listed for this is not what the original one was,
11580 # but the original bug was JavaScript injection, which is fixed in any case.
11581 # It's not clear that the original result listed was any more correct than the
11582 # current one. Original result:
11583 # <p>{{{|
11584 # </p>
11585 # <li class="&#124;&#124;">
11586 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11587 !!test
11588 Fuzz testing: Parser25 (bug 6055)
11589 !! input
11590 {{{
11591 |
11592 <LI CLASS=||
11593 >
11594 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11595 !! result
11596 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11597 </p>
11598 !! end
11599
11600 !!test
11601 Fuzz testing: URL adjacent extension (with space, clean)
11602 !! options
11603 !! input
11604 http://example.com <nowiki>junk</nowiki>
11605 !! result
11606 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11607 </p>
11608 !!end
11609
11610 !!test
11611 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11612 !! options
11613 !! input
11614 http://example.com<nowiki>junk</nowiki>
11615 !! result
11616 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11617 </p>
11618 !!end
11619
11620 !!test
11621 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11622 !! options
11623 !! input
11624 http://example.com<pre>junk</pre>
11625 !! result
11626 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11627
11628 !!end
11629
11630 !!test
11631 Fuzz testing: image with bogus manual thumbnail
11632 !!input
11633 [[Image:foobar.jpg|thumbnail= ]]
11634 !!result
11635 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11636
11637 !!end
11638
11639 !! test
11640 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11641 !! input
11642 <pre dir="&#10;"></pre>
11643 !! result
11644 <pre dir="&#10;"></pre>
11645
11646 !! end
11647
11648 !! test
11649 Parsing optional HTML elements (Bug 6171)
11650 !! options
11651 !! input
11652 <table>
11653 <tr>
11654 <td> Some tabular data</td>
11655 <td> More tabular data ...
11656 <td> And yet som tabular data</td>
11657 </tr>
11658 </table>
11659 !! result
11660 <table>
11661 <tr>
11662 <td> Some tabular data</td>
11663 <td> More tabular data ...
11664 </td><td> And yet som tabular data</td>
11665 </tr>
11666 </table>
11667
11668 !! end
11669
11670 !! test
11671 Correct handling of <td>, <tr> (Bug 6171)
11672 !! options
11673 !! input
11674 <table>
11675 <tr>
11676 <td> Some tabular data</td>
11677 <td> More tabular data ...</td>
11678 <td> And yet som tabular data</td>
11679 </tr>
11680 </table>
11681 !! result
11682 <table>
11683 <tr>
11684 <td> Some tabular data</td>
11685 <td> More tabular data ...</td>
11686 <td> And yet som tabular data</td>
11687 </tr>
11688 </table>
11689
11690 !! end
11691
11692
11693 !! test
11694 Parsing crashing regression (fr:JavaScript)
11695 !! input
11696 </body></x>
11697 !! result
11698 <p>&lt;/body&gt;&lt;/x&gt;
11699 </p>
11700 !! end
11701
11702 !! test
11703 Inline wiki vs wiki block nesting
11704 !! input
11705 '''Bold paragraph
11706
11707 New wiki paragraph
11708 !! result
11709 <p><b>Bold paragraph</b>
11710 </p><p>New wiki paragraph
11711 </p>
11712 !! end
11713
11714 !! test
11715 Inline HTML vs wiki block nesting
11716 !! options
11717 disabled
11718 !! input
11719 <b>Bold paragraph
11720
11721 New wiki paragraph
11722 !! result
11723 <p><b>Bold paragraph</b>
11724 </p><p>New wiki paragraph
11725 </p>
11726 !! end
11727
11728 # Original result was this:
11729 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11730 # </p>
11731 # While that might be marginally more intuitive, maybe, the six-apostrophe
11732 # construct is clearly pathological and the result stated here (which is what
11733 # the parser actually does) is about as reasonable as anything.
11734 !!test
11735 Mixing markup for italics and bold
11736 !! options
11737 !! input
11738 '''bold''''''bold''bolditalics'''''
11739 !! result
11740 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11741 </p>
11742 !! end
11743
11744
11745 !! article
11746 Xyzzyx
11747 !! text
11748 Article for special page transclusion test
11749 !! endarticle
11750
11751 !! test
11752 Special page transclusion
11753 !! options
11754 !! input
11755 {{Special:Prefixindex/Xyzzyx}}
11756 !! result
11757 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11758
11759 !! end
11760
11761 !! test
11762 Special page transclusion twice (bug 5021)
11763 !! options
11764 !! input
11765 {{Special:Prefixindex/Xyzzyx}}
11766 {{Special:Prefixindex/Xyzzyx}}
11767 !! result
11768 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11769 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11770
11771 !! end
11772
11773 !! test
11774 Transclusion of default MediaWiki message
11775 !! input
11776 {{MediaWiki:Mainpage}}
11777 !!result
11778 <p>Main Page
11779 </p>
11780 !! end
11781
11782 !! test
11783 Transclusion of nonexistent MediaWiki message
11784 !! input
11785 {{MediaWiki:Mainpagexxx}}
11786 !!result
11787 <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>
11788 </p>
11789 !! end
11790
11791 !! test
11792 Transclusion of MediaWiki message with underscore
11793 !! input
11794 {{MediaWiki:history_short}}
11795 !! result
11796 <p>History
11797 </p>
11798 !! end
11799
11800 !! test
11801 Transclusion of MediaWiki message with space
11802 !! input
11803 {{MediaWiki:history short}}
11804 !! result
11805 <p>History
11806 </p>
11807 !! end
11808
11809 !! test
11810 Invalid header with following text
11811 !! input
11812 = x = y
11813 !! result
11814 <p>= x = y
11815 </p>
11816 !! end
11817
11818
11819 !! test
11820 Section extraction test (section 0)
11821 !! options
11822 section=0
11823 !! input
11824 start
11825 ==a==
11826 ===aa===
11827 ====aaa====
11828 ==b==
11829 ===ba===
11830 ===bb===
11831 ====bba====
11832 ===bc===
11833 ==c==
11834 ===ca===
11835 !! result
11836 start
11837 !! end
11838
11839 !! test
11840 Section extraction test (section 1)
11841 !! options
11842 section=1
11843 !! input
11844 start
11845 ==a==
11846 ===aa===
11847 ====aaa====
11848 ==b==
11849 ===ba===
11850 ===bb===
11851 ====bba====
11852 ===bc===
11853 ==c==
11854 ===ca===
11855 !! result
11856 ==a==
11857 ===aa===
11858 ====aaa====
11859 !! end
11860
11861 !! test
11862 Section extraction test (section 2)
11863 !! options
11864 section=2
11865 !! input
11866 start
11867 ==a==
11868 ===aa===
11869 ====aaa====
11870 ==b==
11871 ===ba===
11872 ===bb===
11873 ====bba====
11874 ===bc===
11875 ==c==
11876 ===ca===
11877 !! result
11878 ===aa===
11879 ====aaa====
11880 !! end
11881
11882 !! test
11883 Section extraction test (section 3)
11884 !! options
11885 section=3
11886 !! input
11887 start
11888 ==a==
11889 ===aa===
11890 ====aaa====
11891 ==b==
11892 ===ba===
11893 ===bb===
11894 ====bba====
11895 ===bc===
11896 ==c==
11897 ===ca===
11898 !! result
11899 ====aaa====
11900 !! end
11901
11902 !! test
11903 Section extraction test (section 4)
11904 !! options
11905 section=4
11906 !! input
11907 start
11908 ==a==
11909 ===aa===
11910 ====aaa====
11911 ==b==
11912 ===ba===
11913 ===bb===
11914 ====bba====
11915 ===bc===
11916 ==c==
11917 ===ca===
11918 !! result
11919 ==b==
11920 ===ba===
11921 ===bb===
11922 ====bba====
11923 ===bc===
11924 !! end
11925
11926 !! test
11927 Section extraction test (section 5)
11928 !! options
11929 section=5
11930 !! input
11931 start
11932 ==a==
11933 ===aa===
11934 ====aaa====
11935 ==b==
11936 ===ba===
11937 ===bb===
11938 ====bba====
11939 ===bc===
11940 ==c==
11941 ===ca===
11942 !! result
11943 ===ba===
11944 !! end
11945
11946 !! test
11947 Section extraction test (section 6)
11948 !! options
11949 section=6
11950 !! input
11951 start
11952 ==a==
11953 ===aa===
11954 ====aaa====
11955 ==b==
11956 ===ba===
11957 ===bb===
11958 ====bba====
11959 ===bc===
11960 ==c==
11961 ===ca===
11962 !! result
11963 ===bb===
11964 ====bba====
11965 !! end
11966
11967 !! test
11968 Section extraction test (section 7)
11969 !! options
11970 section=7
11971 !! input
11972 start
11973 ==a==
11974 ===aa===
11975 ====aaa====
11976 ==b==
11977 ===ba===
11978 ===bb===
11979 ====bba====
11980 ===bc===
11981 ==c==
11982 ===ca===
11983 !! result
11984 ====bba====
11985 !! end
11986
11987 !! test
11988 Section extraction test (section 8)
11989 !! options
11990 section=8
11991 !! input
11992 start
11993 ==a==
11994 ===aa===
11995 ====aaa====
11996 ==b==
11997 ===ba===
11998 ===bb===
11999 ====bba====
12000 ===bc===
12001 ==c==
12002 ===ca===
12003 !! result
12004 ===bc===
12005 !! end
12006
12007 !! test
12008 Section extraction test (section 9)
12009 !! options
12010 section=9
12011 !! input
12012 start
12013 ==a==
12014 ===aa===
12015 ====aaa====
12016 ==b==
12017 ===ba===
12018 ===bb===
12019 ====bba====
12020 ===bc===
12021 ==c==
12022 ===ca===
12023 !! result
12024 ==c==
12025 ===ca===
12026 !! end
12027
12028 !! test
12029 Section extraction test (section 10)
12030 !! options
12031 section=10
12032 !! input
12033 start
12034 ==a==
12035 ===aa===
12036 ====aaa====
12037 ==b==
12038 ===ba===
12039 ===bb===
12040 ====bba====
12041 ===bc===
12042 ==c==
12043 ===ca===
12044 !! result
12045 ===ca===
12046 !! end
12047
12048 !! test
12049 Section extraction test (nonexistent section 11)
12050 !! options
12051 section=11
12052 !! input
12053 start
12054 ==a==
12055 ===aa===
12056 ====aaa====
12057 ==b==
12058 ===ba===
12059 ===bb===
12060 ====bba====
12061 ===bc===
12062 ==c==
12063 ===ca===
12064 !! result
12065 !! end
12066
12067 !! test
12068 Section extraction test with bogus heading (section 1)
12069 !! options
12070 section=1
12071 !! input
12072 ==a==
12073 ==bogus== not a legal section
12074 ==b==
12075 !! result
12076 ==a==
12077 ==bogus== not a legal section
12078 !! end
12079
12080 !! test
12081 Section extraction test with bogus heading (section 2)
12082 !! options
12083 section=2
12084 !! input
12085 ==a==
12086 ==bogus== not a legal section
12087 ==b==
12088 !! result
12089 ==b==
12090 !! end
12091
12092 !! test
12093 Section extraction test with comment after heading (section 1)
12094 !! options
12095 section=1
12096 !! input
12097 ==a==
12098 ==b== <!-- -->
12099 ==c==
12100 !! result
12101 ==a==
12102 !! end
12103
12104 !! test
12105 Section extraction test with comment after heading (section 2)
12106 !! options
12107 section=2
12108 !! input
12109 ==a==
12110 ==b== <!-- -->
12111 ==c==
12112 !! result
12113 ==b== <!-- -->
12114 !! end
12115
12116 !! test
12117 Section extraction test with bogus <nowiki> heading (section 1)
12118 !! options
12119 section=1
12120 !! input
12121 ==a==
12122 ==bogus== <nowiki>not a legal section</nowiki>
12123 ==b==
12124 !! result
12125 ==a==
12126 ==bogus== <nowiki>not a legal section</nowiki>
12127 !! end
12128
12129 !! test
12130 Section extraction test with bogus <nowiki> heading (section 2)
12131 !! options
12132 section=2
12133 !! input
12134 ==a==
12135 ==bogus== <nowiki>not a legal section</nowiki>
12136 ==b==
12137 !! result
12138 ==b==
12139 !! end
12140
12141
12142 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12143 # instead of respecting commented sections
12144 !! test
12145 Section extraction prefixed by comment (section 1)
12146 !! options
12147 section=1
12148 !! input
12149 <!-- -->==sec1==
12150 ==sec2==
12151 !!result
12152 ==sec2==
12153 !!end
12154
12155 !! test
12156 Section extraction prefixed by comment (section 2)
12157 !! options
12158 section=2
12159 !! input
12160 <!-- -->==sec1==
12161 ==sec2==
12162 !!result
12163
12164 !!end
12165
12166
12167 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12168 # instead of respecting HTML-style headings
12169 !! test
12170 Section extraction, mixed wiki and html (section 1)
12171 !! options
12172 section=1
12173 !! input
12174 <h2>unmarked</h2>
12175 unmarked
12176 ==1==
12177 one
12178 ==2==
12179 two
12180 !! result
12181 ==1==
12182 one
12183 !! end
12184
12185 !! test
12186 Section extraction, mixed wiki and html (section 2)
12187 !! options
12188 section=2
12189 !! input
12190 <h2>unmarked</h2>
12191 unmarked
12192 ==1==
12193 one
12194 ==2==
12195 two
12196 !! result
12197 ==2==
12198 two
12199 !! end
12200
12201
12202 # Formerly testing for bug 3342
12203 !! test
12204 Section extraction, heading surrounded by <noinclude>
12205 !! options
12206 section=1
12207 !! input
12208 <noinclude>==unmarked==</noinclude>
12209 ==marked==
12210 !! result
12211 ==marked==
12212 !!end
12213
12214 # Test behavior of bug 19910
12215 !! test
12216 Sectiion with all-equals
12217 !! options
12218 section=2
12219 !! input
12220 ===
12221 The line above must have a trailing space
12222 === <!--
12223 --> <!-- -->
12224 But just in case it doesn't...
12225 !! result
12226 === <!--
12227 --> <!-- -->
12228 But just in case it doesn't...
12229 !! end
12230
12231 !! test
12232 Section replacement test (section 0)
12233 !! options
12234 replace=0,"xxx"
12235 !! input
12236 start
12237 ==a==
12238 ===aa===
12239 ====aaa====
12240 ==b==
12241 ===ba===
12242 ===bb===
12243 ====bba====
12244 ===bc===
12245 ==c==
12246 ===ca===
12247 !! result
12248 xxx
12249
12250 ==a==
12251 ===aa===
12252 ====aaa====
12253 ==b==
12254 ===ba===
12255 ===bb===
12256 ====bba====
12257 ===bc===
12258 ==c==
12259 ===ca===
12260 !! end
12261
12262 !! test
12263 Section replacement test (section 1)
12264 !! options
12265 replace=1,"xxx"
12266 !! input
12267 start
12268 ==a==
12269 ===aa===
12270 ====aaa====
12271 ==b==
12272 ===ba===
12273 ===bb===
12274 ====bba====
12275 ===bc===
12276 ==c==
12277 ===ca===
12278 !! result
12279 start
12280 xxx
12281
12282 ==b==
12283 ===ba===
12284 ===bb===
12285 ====bba====
12286 ===bc===
12287 ==c==
12288 ===ca===
12289 !! end
12290
12291 !! test
12292 Section replacement test (section 2)
12293 !! options
12294 replace=2,"xxx"
12295 !! input
12296 start
12297 ==a==
12298 ===aa===
12299 ====aaa====
12300 ==b==
12301 ===ba===
12302 ===bb===
12303 ====bba====
12304 ===bc===
12305 ==c==
12306 ===ca===
12307 !! result
12308 start
12309 ==a==
12310 xxx
12311
12312 ==b==
12313 ===ba===
12314 ===bb===
12315 ====bba====
12316 ===bc===
12317 ==c==
12318 ===ca===
12319 !! end
12320
12321 !! test
12322 Section replacement test (section 3)
12323 !! options
12324 replace=3,"xxx"
12325 !! input
12326 start
12327 ==a==
12328 ===aa===
12329 ====aaa====
12330 ==b==
12331 ===ba===
12332 ===bb===
12333 ====bba====
12334 ===bc===
12335 ==c==
12336 ===ca===
12337 !! result
12338 start
12339 ==a==
12340 ===aa===
12341 xxx
12342
12343 ==b==
12344 ===ba===
12345 ===bb===
12346 ====bba====
12347 ===bc===
12348 ==c==
12349 ===ca===
12350 !! end
12351
12352 !! test
12353 Section replacement test (section 4)
12354 !! options
12355 replace=4,"xxx"
12356 !! input
12357 start
12358 ==a==
12359 ===aa===
12360 ====aaa====
12361 ==b==
12362 ===ba===
12363 ===bb===
12364 ====bba====
12365 ===bc===
12366 ==c==
12367 ===ca===
12368 !! result
12369 start
12370 ==a==
12371 ===aa===
12372 ====aaa====
12373 xxx
12374
12375 ==c==
12376 ===ca===
12377 !! end
12378
12379 !! test
12380 Section replacement test (section 5)
12381 !! options
12382 replace=5,"xxx"
12383 !! input
12384 start
12385 ==a==
12386 ===aa===
12387 ====aaa====
12388 ==b==
12389 ===ba===
12390 ===bb===
12391 ====bba====
12392 ===bc===
12393 ==c==
12394 ===ca===
12395 !! result
12396 start
12397 ==a==
12398 ===aa===
12399 ====aaa====
12400 ==b==
12401 xxx
12402
12403 ===bb===
12404 ====bba====
12405 ===bc===
12406 ==c==
12407 ===ca===
12408 !! end
12409
12410 !! test
12411 Section replacement test (section 6)
12412 !! options
12413 replace=6,"xxx"
12414 !! input
12415 start
12416 ==a==
12417 ===aa===
12418 ====aaa====
12419 ==b==
12420 ===ba===
12421 ===bb===
12422 ====bba====
12423 ===bc===
12424 ==c==
12425 ===ca===
12426 !! result
12427 start
12428 ==a==
12429 ===aa===
12430 ====aaa====
12431 ==b==
12432 ===ba===
12433 xxx
12434
12435 ===bc===
12436 ==c==
12437 ===ca===
12438 !! end
12439
12440 !! test
12441 Section replacement test (section 7)
12442 !! options
12443 replace=7,"xxx"
12444 !! input
12445 start
12446 ==a==
12447 ===aa===
12448 ====aaa====
12449 ==b==
12450 ===ba===
12451 ===bb===
12452 ====bba====
12453 ===bc===
12454 ==c==
12455 ===ca===
12456 !! result
12457 start
12458 ==a==
12459 ===aa===
12460 ====aaa====
12461 ==b==
12462 ===ba===
12463 ===bb===
12464 xxx
12465
12466 ===bc===
12467 ==c==
12468 ===ca===
12469 !! end
12470
12471 !! test
12472 Section replacement test (section 8)
12473 !! options
12474 replace=8,"xxx"
12475 !! input
12476 start
12477 ==a==
12478 ===aa===
12479 ====aaa====
12480 ==b==
12481 ===ba===
12482 ===bb===
12483 ====bba====
12484 ===bc===
12485 ==c==
12486 ===ca===
12487 !! result
12488 start
12489 ==a==
12490 ===aa===
12491 ====aaa====
12492 ==b==
12493 ===ba===
12494 ===bb===
12495 ====bba====
12496 xxx
12497
12498 ==c==
12499 ===ca===
12500 !!end
12501
12502 !! test
12503 Section replacement test (section 9)
12504 !! options
12505 replace=9,"xxx"
12506 !! input
12507 start
12508 ==a==
12509 ===aa===
12510 ====aaa====
12511 ==b==
12512 ===ba===
12513 ===bb===
12514 ====bba====
12515 ===bc===
12516 ==c==
12517 ===ca===
12518 !! result
12519 start
12520 ==a==
12521 ===aa===
12522 ====aaa====
12523 ==b==
12524 ===ba===
12525 ===bb===
12526 ====bba====
12527 ===bc===
12528 xxx
12529 !! end
12530
12531 !! test
12532 Section replacement test (section 10)
12533 !! options
12534 replace=10,"xxx"
12535 !! input
12536 start
12537 ==a==
12538 ===aa===
12539 ====aaa====
12540 ==b==
12541 ===ba===
12542 ===bb===
12543 ====bba====
12544 ===bc===
12545 ==c==
12546 ===ca===
12547 !! result
12548 start
12549 ==a==
12550 ===aa===
12551 ====aaa====
12552 ==b==
12553 ===ba===
12554 ===bb===
12555 ====bba====
12556 ===bc===
12557 ==c==
12558 xxx
12559 !! end
12560
12561 !! test
12562 Section replacement test with initial whitespace (bug 13728)
12563 !! options
12564 replace=2,"xxx"
12565 !! input
12566 Preformatted initial line
12567 ==a==
12568 ===a===
12569 !! result
12570 Preformatted initial line
12571 ==a==
12572 xxx
12573 !! end
12574
12575
12576 !! test
12577 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12578 !! options
12579 section=1
12580 !! input
12581 ==a==
12582 a
12583 !! result
12584 ==a==
12585 a
12586 !! end
12587
12588 !! test
12589 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12590 !! options
12591 section=1
12592 !! input
12593 ==a==
12594 a
12595 !! result
12596 ==a==
12597 a
12598 !! end
12599
12600
12601 !! test
12602 Section extraction, <pre> around bogus header (bug 10309)
12603 !! options
12604 noxml section=2
12605 !! input
12606 == Section One ==
12607 <pre>
12608 =======
12609 </pre>
12610
12611 == Section Two ==
12612 stuff
12613 !! result
12614 == Section Two ==
12615 stuff
12616 !! end
12617
12618 !! test
12619 Section replacement, <pre> around bogus header (bug 10309)
12620 !! options
12621 noxml replace=2,"xxx"
12622 !! input
12623 == Section One ==
12624 <pre>
12625 =======
12626 </pre>
12627
12628 == Section Two ==
12629 stuff
12630 !! result
12631 == Section One ==
12632 <pre>
12633 =======
12634 </pre>
12635
12636 xxx
12637 !! end
12638
12639
12640
12641 !! test
12642 Handling of &#x0A; in URLs
12643 !! input
12644 **irc://&#x0A;a
12645 !! result
12646 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12647 </li></ul>
12648 </li></ul>
12649
12650 !!end
12651
12652 !! test
12653 5 quotes, code coverage +1 line (php)
12654 !! options
12655 php
12656 !! input
12657 '''''
12658 !! result
12659 !! end
12660 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12661 !! test
12662 5 quotes, code coverage +1 line (parsoid)
12663 !! options
12664 parsoid
12665 !! input
12666 '''''
12667 !! result
12668 <p><i><b></b></i></p>
12669 !! end
12670
12671 !! test
12672 Special:Search page linking.
12673 !! input
12674 {{Special:search}}
12675 !! result
12676 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12677 </p>
12678 !! end
12679
12680 !! test
12681 Say the magic word
12682 !! options
12683 title=[[Parser test]]
12684 !! input
12685 * {{PAGENAME}}
12686 * {{PAGENAMEE}}
12687 * {{FULLPAGENAME}}
12688 * {{FULLPAGENAMEE}}
12689 * {{BASEPAGENAME}}
12690 * {{BASEPAGENAMEE}}
12691 * {{SUBPAGENAME}}
12692 * {{SUBPAGENAMEE}}
12693 * {{ROOTPAGENAME}}
12694 * {{ROOTPAGENAMEE}}
12695 * {{TALKPAGENAME}}
12696 * {{TALKPAGENAMEE}}
12697 * {{SUBJECTPAGENAME}}
12698 * {{SUBJECTPAGENAMEE}}
12699 * {{NAMESPACEE}}
12700 * {{NAMESPACE}}
12701 * {{NAMESPACENUMBER}}
12702 * {{TALKSPACE}}
12703 * {{TALKSPACEE}}
12704 * {{SUBJECTSPACE}}
12705 * {{SUBJECTSPACEE}}
12706 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12707 !! result
12708 <ul><li> Parser test
12709 </li><li> Parser_test
12710 </li><li> Parser test
12711 </li><li> Parser_test
12712 </li><li> Parser test
12713 </li><li> Parser_test
12714 </li><li> Parser test
12715 </li><li> Parser_test
12716 </li><li> Parser test
12717 </li><li> Parser_test
12718 </li><li> Talk:Parser test
12719 </li><li> Talk:Parser_test
12720 </li><li> Parser test
12721 </li><li> Parser_test
12722 </li><li>
12723 </li><li>
12724 </li><li> 0
12725 </li><li> Talk
12726 </li><li> Talk
12727 </li><li>
12728 </li><li>
12729 </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>
12730 </li></ul>
12731
12732 !! end
12733 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12734
12735 !! test
12736 Gallery
12737 !! input
12738 <gallery>
12739 image1.png |
12740 image2.gif|||||
12741
12742 image3|
12743 image4 |300px| centre
12744 image5.svg| http://///////
12745 [[x|xx]]]]
12746 * image6
12747 </gallery>
12748 !! result
12749 <ul class="gallery">
12750 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12751 <div style="height: 150px;">Image1.png</div>
12752 <div class="gallerytext">
12753 </div>
12754 </div></li>
12755 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12756 <div style="height: 150px;">Image2.gif</div>
12757 <div class="gallerytext">
12758 <p>||||
12759 </p>
12760 </div>
12761 </div></li>
12762 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12763 <div style="height: 150px;">Image3</div>
12764 <div class="gallerytext">
12765 </div>
12766 </div></li>
12767 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12768 <div style="height: 150px;">Image4</div>
12769 <div class="gallerytext">
12770 <p>300px| centre
12771 </p>
12772 </div>
12773 </div></li>
12774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12775 <div style="height: 150px;">Image5.svg</div>
12776 <div class="gallerytext">
12777 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12778 </p>
12779 </div>
12780 </div></li>
12781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12782 <div style="height: 150px;">* image6</div>
12783 <div class="gallerytext">
12784 </div>
12785 </div></li>
12786 </ul>
12787
12788 !! end
12789
12790 !! test
12791 Gallery (with options)
12792 !! input
12793 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12794 File:Nonexistant.jpg|caption
12795 File:Nonexistant.jpg
12796 image:foobar.jpg|some '''caption''' [[Main Page]]
12797 image:foobar.jpg
12798 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12799 </gallery>
12800 !! result
12801 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12802 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12803 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12804 <div style="height: 70px;">Nonexistant.jpg</div>
12805 <div class="gallerytext">
12806 <p>caption
12807 </p>
12808 </div>
12809 </div></li>
12810 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12811 <div style="height: 70px;">Nonexistant.jpg</div>
12812 <div class="gallerytext">
12813 </div>
12814 </div></li>
12815 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12816 <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>
12817 <div class="gallerytext">
12818 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12819 </p>
12820 </div>
12821 </div></li>
12822 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12823 <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>
12824 <div class="gallerytext">
12825 </div>
12826 </div></li>
12827 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12828 <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>
12829 <div class="gallerytext">
12830 <p>Blabla|blabla.
12831 </p>
12832 </div>
12833 </div></li>
12834 </ul>
12835
12836 !! end
12837
12838 !! test
12839 Gallery with wikitext inside caption
12840 !! input
12841 <gallery>
12842 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12843 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12844 </gallery>
12845 !! result
12846 <ul class="gallery">
12847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12848 <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>
12849 <div class="gallerytext">
12850 <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>
12851 </p>
12852 </div>
12853 </div></li>
12854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12855 <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>
12856 <div class="gallerytext">
12857 <p>This is a test template
12858 </p>
12859 </div>
12860 </div></li>
12861 </ul>
12862
12863 !! end
12864
12865 !! test
12866 gallery (with showfilename option)
12867 !! input
12868 <gallery showfilename>
12869 File:Nonexistant.jpg|caption
12870 File:Nonexistant.jpg
12871 image:foobar.jpg|some '''caption''' [[Main Page]]
12872 File:Foobar.jpg
12873 </gallery>
12874 !! result
12875 <ul class="gallery">
12876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12877 <div style="height: 150px;">Nonexistant.jpg</div>
12878 <div class="gallerytext">
12879 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12880 caption
12881 </p>
12882 </div>
12883 </div></li>
12884 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12885 <div style="height: 150px;">Nonexistant.jpg</div>
12886 <div class="gallerytext">
12887 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12888 </p>
12889 </div>
12890 </div></li>
12891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12892 <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>
12893 <div class="gallerytext">
12894 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12895 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</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="Foobar.jpg" 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><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12903 </p>
12904 </div>
12905 </div></li>
12906 </ul>
12907
12908 !! end
12909
12910 !! test
12911 Gallery (with namespace-less filenames)
12912 !! input
12913 <gallery>
12914 File:Nonexistant.jpg
12915 Nonexistant.jpg
12916 image:foobar.jpg
12917 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 </div>
12925 </div></li>
12926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12927 <div style="height: 150px;">Nonexistant.jpg</div>
12928 <div class="gallerytext">
12929 </div>
12930 </div></li>
12931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12932 <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>
12933 <div class="gallerytext">
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="Foobar.jpg" 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 </div>
12940 </div></li>
12941 </ul>
12942
12943 !! end
12944
12945 !! test
12946 HTML Hex character encoding (spells the word "JavaScript")
12947 !! input
12948 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12949 !! result
12950 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12951 </p>
12952 !! end
12953
12954 !! test
12955 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12956 !! input
12957 &#xsee;&#XSEE;
12958 !! result
12959 <p>&amp;#xsee;&amp;#XSEE;
12960 </p>
12961 !! end
12962
12963 !! test
12964 HTML Hex character encoding mixed case
12965 !! input
12966 &#xEE;&#Xee;
12967 !! result
12968 <p>&#xee;&#xee;
12969 </p>
12970 !! end
12971
12972 !! test
12973 __FORCETOC__ override
12974 !! input
12975 __NEWSECTIONLINK__
12976 __FORCETOC__
12977 !! result
12978 <p><br />
12979 </p>
12980 !! end
12981
12982 !! test
12983 ISBN code coverage
12984 !! input
12985 ISBN 978-0-1234-56&#x20;789
12986 !! result
12987 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12988 </p>
12989 !! end
12990
12991 !! test
12992 ISBN followed by 5 spaces
12993 !! input
12994 ISBN
12995 !! result
12996 <p>ISBN
12997 </p>
12998 !! end
12999
13000 !! test
13001 Double ISBN
13002 !! input
13003 ISBN ISBN 1234567890
13004 !! result
13005 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13006 </p>
13007 !! end
13008
13009 !! test
13010 Bug 22905: <abbr> followed by ISBN followed by </a>
13011 !! input
13012 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13013 !! result
13014 <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>
13015 </p>
13016 !! end
13017
13018 !! test
13019 Double RFC
13020 !! input
13021 RFC RFC 1234
13022 !! result
13023 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13024 </p>
13025 !! end
13026
13027 !! test
13028 Double RFC with a wiki link
13029 !! input
13030 RFC [[RFC 1234]]
13031 !! result
13032 <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>
13033 </p>
13034 !! end
13035
13036 !! test
13037 RFC code coverage
13038 !! input
13039 RFC 983&#x20;987
13040 !! result
13041 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13042 </p>
13043 !! end
13044
13045 !! test
13046 Centre-aligned image
13047 !! input
13048 [[Image:foobar.jpg|centre]]
13049 !! result
13050 <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>
13051
13052 !!end
13053
13054 !! test
13055 None-aligned image
13056 !! input
13057 [[Image:foobar.jpg|none]]
13058 !! result
13059 <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>
13060
13061 !!end
13062
13063 !! test
13064 Width + Height sized image (using px) (height is ignored)
13065 !! input
13066 [[Image:foobar.jpg|640x480px]]
13067 !! result
13068 <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>
13069 </p>
13070 !!end
13071
13072 !! test
13073 Width-sized image (using px, no following whitespace)
13074 !! input
13075 [[Image:foobar.jpg|640px]]
13076 !! result
13077 <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>
13078 </p>
13079 !!end
13080
13081 !! test
13082 Width-sized image (using px, with following whitespace - test regression from r39467)
13083 !! input
13084 [[Image:foobar.jpg|640px ]]
13085 !! result
13086 <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>
13087 </p>
13088 !!end
13089
13090 !! test
13091 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13092 !! input
13093 [[Image:foobar.jpg| 640px]]
13094 !! result
13095 <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>
13096 </p>
13097 !!end
13098
13099 !! test
13100 Another italics / bold test
13101 !! input
13102 ''' ''x'
13103 !! result
13104 <pre>'<i> </i>x'
13105 </pre>
13106 !!end
13107
13108 # Note the results may be incorrect, as parserTest output included this:
13109 # XML error: Mismatched tag at byte 6120:
13110 # ...<dd> </dt></dl> </dd...
13111 !! test
13112 dt/dd/dl test
13113 !! options
13114 disabled
13115 !! input
13116 :;;;::
13117 !! result
13118 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13119 </dd></dl>
13120 </dd></dl>
13121 </dt></dl>
13122 </dt></dl>
13123 </dt></dl>
13124 </dd></dl>
13125
13126 !!end
13127
13128
13129 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13130 !! test
13131 Images with the "|" character in the comment
13132 !! input
13133 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13134 !! result
13135 <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>
13136
13137 !!end
13138
13139 !! test
13140 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13141 !! input
13142 <html><script>alert(1);</script></html>
13143 !! result
13144 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13145 </p>
13146 !! end
13147
13148 !! test
13149 HTML with raw HTML ($wgRawHtml==true)
13150 !! options
13151 wgRawHtml=1
13152 !! input
13153 <html><script>alert(1);</script></html>
13154 !! result
13155 <p><script>alert(1);</script>
13156 </p>
13157 !! end
13158
13159 !! test
13160 Parents of subpages, one level up
13161 !! options
13162 subpage title=[[Subpage test/L1/L2/L3]]
13163 !! input
13164 [[../|L2]]
13165 !! result
13166 <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>
13167 </p>
13168 !! end
13169
13170
13171 !! test
13172 Parents of subpages, one level up, not named
13173 !! options
13174 subpage title=[[Subpage test/L1/L2/L3]]
13175 !! input
13176 [[../]]
13177 !! result
13178 <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>
13179 </p>
13180 !! end
13181
13182
13183
13184 !! test
13185 Parents of subpages, two levels up
13186 !! options
13187 subpage title=[[Subpage test/L1/L2/L3]]
13188 !! input
13189 [[../../|L1]]2
13190
13191 [[../../|L1]]l
13192 !! result
13193 <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
13194 </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>
13195 </p>
13196 !! end
13197
13198 !! test
13199 Parents of subpages, two levels up, without trailing slash or name.
13200 !! options
13201 subpage title=[[Subpage test/L1/L2/L3]]
13202 !! input
13203 [[../..]]
13204 !! result
13205 <p>[[../..]]
13206 </p>
13207 !! end
13208
13209 !! test
13210 Parents of subpages, two levels up, with lots of extra trailing slashes.
13211 !! options
13212 subpage title=[[Subpage test/L1/L2/L3]]
13213 !! input
13214 [[../../////]]
13215 !! result
13216 <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>
13217 </p>
13218 !! end
13219
13220 !! article
13221 Subpage test/L1/L2/L3Sibling
13222 !! text
13223 Sibling article
13224 !! endarticle
13225
13226 !! test
13227 Transclusion of a sibling page (one level up)
13228 !! options
13229 subpage title=[[Subpage test/L1/L2/L3]]
13230 !! input
13231 {{../L3Sibling}}
13232 !! result
13233 <p>Sibling article
13234 </p>
13235 !! end
13236
13237 !! test
13238 Transclusion of a child page
13239 !! options
13240 subpage title=[[Subpage test/L1/L2]]
13241 !! input
13242 {{/L3Sibling}}
13243 !! result
13244 <p>Sibling article
13245 </p>
13246 !! end
13247
13248 !! test
13249 Non-transclusion because of too many up levels
13250 !! options
13251 subpage title=[[Subpage test/L1/L2/L3]]
13252 !! input
13253 {{../../../../More than parent}}
13254 !! result
13255 <p>{{../../../../More than parent}}
13256 </p>
13257 !! end
13258
13259 !! test
13260 Definition list code coverage
13261 !! input
13262 ; title : def
13263 ; title : def
13264 ;title: def
13265 !! result
13266 <dl><dt> title &#160;</dt><dd> def
13267 </dd><dt> title&#160;</dt><dd> def
13268 </dd><dt>title</dt><dd> def
13269 </dd></dl>
13270
13271 !! end
13272
13273 !! test
13274 Don't fall for the self-closing div
13275 !! input
13276 <div>hello world</div/>
13277 !! result
13278 <div>hello world</div>
13279
13280 !! end
13281
13282 !! test
13283 MSGNW magic word
13284 !! input
13285 {{MSGNW:msg}}
13286 !! result
13287 <p>&#91;&#91;:Template:Msg&#93;&#93;
13288 </p>
13289 !! end
13290
13291 !! test
13292 RAW magic word
13293 !! input
13294 {{RAW:QUERTY}}
13295 !! result
13296 <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>
13297 </p>
13298 !! end
13299
13300 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13301 !! test
13302 Always escape literal '>' in output, not just after '<'
13303 !! input
13304 ><>
13305 !! result
13306 <p>&gt;&lt;&gt;
13307 </p>
13308 !! end
13309
13310 !! test
13311 Template caching
13312 !! input
13313 {{Test}}
13314 {{Test}}
13315 !! result
13316 <p>This is a test template
13317 This is a test template
13318 </p>
13319 !! end
13320
13321
13322 !! article
13323 MediaWiki:Fake
13324 !! text
13325 ==header==
13326 !! endarticle
13327
13328 !! test
13329 Inclusion of !userCanEdit() content
13330 !! input
13331 {{MediaWiki:Fake}}
13332 !! result
13333 <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>
13334
13335 !! end
13336
13337
13338 !! test
13339 Out-of-order TOC heading levels
13340 !! input
13341 ==2==
13342 ======6======
13343 ===3===
13344 =1=
13345 =====5=====
13346 ==2==
13347 !! result
13348 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13349 <ul>
13350 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13351 <ul>
13352 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13353 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13354 </ul>
13355 </li>
13356 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13357 <ul>
13358 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13359 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13360 </ul>
13361 </li>
13362 </ul>
13363 </div>
13364 <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>
13365 <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>
13366 <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>
13367 <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>
13368 <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>
13369 <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>
13370
13371 !! end
13372
13373
13374 !! test
13375 ISBN with a dummy number
13376 !! input
13377 ISBN ---
13378 !! result
13379 <p>ISBN ---
13380 </p>
13381 !! end
13382
13383
13384 !! test
13385 ISBN with space-delimited number
13386 !! input
13387 ISBN 92 9017 032 8
13388 !! result
13389 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13390 </p>
13391 !! end
13392
13393
13394 !! test
13395 ISBN with multiple spaces, no number
13396 !! input
13397 ISBN foo
13398 !! result
13399 <p>ISBN foo
13400 </p>
13401 !! end
13402
13403
13404 !! test
13405 ISBN length
13406 !! input
13407 ISBN 123456789
13408
13409 ISBN 1234567890
13410
13411 ISBN 12345678901
13412 !! result
13413 <p>ISBN 123456789
13414 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13415 </p><p>ISBN 12345678901
13416 </p>
13417 !! end
13418
13419
13420 !! test
13421 ISBN with trailing year (bug 8110)
13422 !! input
13423 ISBN 1-234-56789-0 - 2006
13424
13425 ISBN 1 234 56789 0 - 2006
13426 !! result
13427 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13428 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13429 </p>
13430 !! end
13431
13432
13433 !! test
13434 anchorencode
13435 !! input
13436 {{anchorencode:foo bar©#%n}}
13437 !! result
13438 <p>foo_bar.C2.A9.23.25n
13439 </p>
13440 !! end
13441
13442 !! test
13443 anchorencode trims spaces
13444 !! input
13445 {{anchorencode: __pretty__please__}}
13446 !! result
13447 <p>pretty_please
13448 </p>
13449 !! end
13450
13451 !! test
13452 anchorencode deals with links
13453 !! input
13454 {{anchorencode: [[hello|world]] [[hi]]}}
13455 !! result
13456 <p>world_hi
13457 </p>
13458 !! end
13459
13460 !! test
13461 anchorencode deals with templates
13462 !! input
13463 {{anchorencode: {{Foo}} }}
13464 !! result
13465 <p>FOO
13466 </p>
13467 !! end
13468
13469 !! test
13470 anchorencode encodes like the TOC generator: (bug 18431)
13471 !! input
13472 === _ +:.3A%3A&&amp;]] ===
13473 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13474 __NOEDITSECTION__
13475 !! result
13476 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13477 <p>.2B:.3A.253A.26.26.5D.5D
13478 </p>
13479 !! end
13480
13481 # Expected output in the following test is not necessarily expected (there
13482 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13483 # only testing for well-formedness.
13484 !! test
13485 Bug 6200: blockquotes and paragraph formatting
13486 !! input
13487 <blockquote>
13488 foo
13489 </blockquote>
13490
13491 bar
13492
13493 baz
13494 !! result
13495 <blockquote>
13496 foo
13497 </blockquote>
13498 <p>bar
13499 </p>
13500 <pre>baz
13501 </pre>
13502 !! end
13503
13504 !! test
13505 Bug 8293: Use of center tag ruins paragraph formatting
13506 !! input
13507 <center>
13508 foo
13509 </center>
13510
13511 bar
13512
13513 baz
13514 !! result
13515 <center>
13516 <p>foo
13517 </p>
13518 </center>
13519 <p>bar
13520 </p>
13521 <pre>baz
13522 </pre>
13523 !! end
13524
13525 !!test
13526 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13527 !!options
13528 php
13529 !!input
13530 <span><s>x</span></s>
13531 !!result
13532 <p><span><s>x&lt;/span&gt;</s></span>
13533 </p>
13534 !!end
13535
13536 !!test
13537 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13538 !!options
13539 parsoid
13540 !!input
13541 <span><s>x</span></s>
13542 !!result
13543 <p><span><s>x</s></span><s></s>
13544 </p>
13545 !!end
13546
13547 ###
13548 ### Language variants related tests
13549 ###
13550 !! test
13551 Self-link in language variants
13552 !! options
13553 title=[[Dunav]] language=sr
13554 !! input
13555 Both [[Dunav]] and [[Дунав]] are names for this river.
13556 !! result
13557 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13558 </p>
13559 !!end
13560
13561 !! article
13562 Дуна
13563 !! text
13564 content
13565 !! endarticle
13566
13567 !! test
13568 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13569 !! options
13570 title=[[Duna]] language=sr
13571 !! input
13572 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13573 !! result
13574 <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.
13575 </p>
13576 !! end
13577
13578 !! test
13579 Link to pages in language variants
13580 !! options
13581 language=sr
13582 !! input
13583 Main Page can be written as [[Маин Паге]]
13584 !! result
13585 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13586 </p>
13587 !!end
13588
13589
13590 !! test
13591 Multiple links to pages in language variants
13592 !! options
13593 language=sr
13594 !! input
13595 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13596 !! result
13597 <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>.
13598 </p>
13599 !!end
13600
13601
13602 !! test
13603 Simple template in language variants
13604 !! options
13605 language=sr
13606 !! input
13607 {{тест}}
13608 !! result
13609 <p>This is a test template
13610 </p>
13611 !! end
13612
13613
13614 !! test
13615 Template with explicit namespace in language variants
13616 !! options
13617 language=sr
13618 !! input
13619 {{Template:тест}}
13620 !! result
13621 <p>This is a test template
13622 </p>
13623 !! end
13624
13625
13626 !! test
13627 Basic test for template parameter in language variants
13628 !! options
13629 language=sr
13630 !! input
13631 {{парамтест|param=foo}}
13632 !! result
13633 <p>This is a test template with parameter foo
13634 </p>
13635 !! end
13636
13637
13638 !! test
13639 Simple category in language variants
13640 !! options
13641 language=sr cat
13642 !! input
13643 [[Category:МедиаWики Усер'с Гуиде]]
13644 !! result
13645 <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>
13646 !! end
13647
13648
13649 !! article
13650 Category:分类
13651 !! text
13652 blah
13653 !! endarticle
13654
13655 !! article
13656 Category:分類
13657 !! text
13658 blah
13659 !! endarticle
13660
13661 !! test
13662 Don't convert blue categorylinks to another variant (bug 33210)
13663 !! options
13664 language=zh cat
13665 !! input
13666 [[A]][[Category:分类]]
13667 !! result
13668 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13669 !! end
13670
13671
13672 !! test
13673 Stripping -{}- tags (language variants)
13674 !! options
13675 language=sr
13676 !! input
13677 Latin proverb: -{Ne nuntium necare}-
13678 !! result
13679 <p>Latin proverb: Ne nuntium necare
13680 </p>
13681 !! end
13682
13683
13684 !! test
13685 Prevent conversion with -{}- tags (language variants)
13686 !! options
13687 language=sr variant=sr-ec
13688 !! input
13689 Latinski: -{Ne nuntium necare}-
13690 !! result
13691 <p>Латински: Ne nuntium necare
13692 </p>
13693 !! end
13694
13695
13696 !! test
13697 Prevent conversion of text with -{}- tags (language variants)
13698 !! options
13699 language=sr variant=sr-ec
13700 !! input
13701 Latinski: -{Ne nuntium necare}-
13702 !! result
13703 <p>Латински: Ne nuntium necare
13704 </p>
13705 !! end
13706
13707
13708 !! test
13709 Prevent conversion of links with -{}- tags (language variants)
13710 !! options
13711 language=sr variant=sr-ec
13712 !! input
13713 -{[[Main Page]]}-
13714 !! result
13715 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13716 </p>
13717 !! end
13718
13719
13720 !! test
13721 -{}- tags within headlines (within html for parserConvert())
13722 !! options
13723 language=sr variant=sr-ec
13724 !! input
13725 == -{Naslov}- ==
13726 !! result
13727 <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>
13728
13729 !! end
13730
13731
13732 !! test
13733 Explicit definition of language variant alternatives
13734 !! options
13735 language=zh variant=zh-tw
13736 !! input
13737 -{zh:China;zh-tw:Taiwan}-, not China
13738 !! result
13739 <p>Taiwan, not China
13740 </p>
13741 !! end
13742
13743
13744 !! test
13745 Conversion around HTML tags
13746 !! options
13747 language=sr variant=sr-ec
13748 !! input
13749 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13750 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13751 !! result
13752 <p>
13753 <span title="ЛаCтин">ски</span>
13754 </p>
13755 !! end
13756
13757
13758 !! test
13759 Explicit session-wise language variant mapping (A flag and - flag)
13760 !! options
13761 language=zh variant=zh-tw
13762 !! input
13763 Taiwan is not China.
13764 But -{A|zh:China;zh-tw:Taiwan}- is China,
13765 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13766 and -{China}- is China.
13767 !! result
13768 <p>Taiwan is not China.
13769 But Taiwan is Taiwan,
13770 (This should be stripped!)
13771 and China is China.
13772 </p>
13773 !! end
13774
13775 !! test
13776 Explicit session-wise language variant mapping (H flag for hide)
13777 !! options
13778 language=zh variant=zh-tw
13779 !! input
13780 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13781 Taiwan is China.
13782 !! result
13783 <p>(This should be stripped!)
13784 Taiwan is Taiwan.
13785 </p>
13786 !! end
13787
13788 !! test
13789 Adding explicit conversion rule for title (T flag)
13790 !! options
13791 language=zh variant=zh-tw showtitle
13792 !! input
13793 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13794 !! result
13795 Taiwan
13796 <p>Should be stripped!
13797 </p>
13798 !! end
13799
13800 !! test
13801 Testing that changing the language variant here in the tests actually works
13802 !! options
13803 language=zh variant=zh showtitle
13804 !! input
13805 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13806 !! result
13807 China
13808 <p>Should be stripped!
13809 </p>
13810 !! end
13811
13812 !! test
13813 Recursive conversion of alt and title attrs shouldn't clear converter state
13814 !! options
13815 language=zh variant=zh-cn showtitle
13816 !! input
13817 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13818 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13819 !! result
13820 China
13821 <p>
13822 Should be stripped<span title="Exclamation">!</span>
13823 </p>
13824 !! end
13825
13826 !! test
13827 Bug 24072: more test on conversion rule for title
13828 !! options
13829 language=zh variant=zh-tw showtitle
13830 !! input
13831 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13832 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13833 !! result
13834 Taiwan
13835 <p>This should be stripped!
13836 This won't take interferes with the title rule.
13837 </p>
13838 !! end
13839
13840 !! test
13841 Partly disable title conversion if variant == main language code
13842 !! options
13843 language=zh variant=zh title=[[ZH]] showtitle
13844 !! input
13845 -{T|zh-cn:CN;zh-tw:TW}-
13846 !! result
13847 ZH
13848 <p>
13849 </p>
13850 !! end
13851
13852 !! test
13853 Partly disable title conversion if variant == main language code, more
13854 !! options
13855 language=zh variant=zh title=[[ZH]] showtitle
13856 !! input
13857 -{T|TW}-
13858 !! result
13859 ZH
13860 <p>
13861 </p>
13862 !! end
13863
13864 !! test
13865 Raw output of variant escape tags (R flag)
13866 !! options
13867 language=zh variant=zh-tw
13868 !! input
13869 Raw: -{R|zh:China;zh-tw:Taiwan}-
13870 !! result
13871 <p>Raw: zh:China;zh-tw:Taiwan
13872 </p>
13873 !! end
13874
13875 !! test
13876 Nested using of manual convert syntax
13877 !! options
13878 language=zh variant=zh-hk
13879 !! input
13880 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13881 !! result
13882 <p>Nested: Hello Hong Kong!
13883 </p>
13884 !! end
13885
13886 !! test
13887 Proper conversion of text in external links
13888 !! options
13889 language=sr variant=sr-ec
13890 !! input
13891 http://www.google.com
13892 gopher://www.google.com
13893 [http://www.google.com http://www.google.com]
13894 [gopher://www.google.com gopher://www.google.com]
13895 [https://www.google.com irc://www.google.com]
13896 [ftp://www.google.com www.google.com/ftp://dir]
13897 [//www.google.com www.google.com]
13898 !! result
13899 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13900 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13901 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13902 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13903 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13904 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13905 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13906 </p>
13907 !! end
13908
13909 !! test
13910 Do not convert roman numbers to language variants
13911 !! options
13912 language=sr variant=sr-ec
13913 !! input
13914 Fridrih IV je car.
13915 !! result
13916 <p>Фридрих IV је цар.
13917 </p>
13918 !! end
13919
13920 !! test
13921 Unclosed language converter markup "-{"
13922 !! options
13923 language=sr
13924 !! input
13925 -{T|hello
13926 !! result
13927 <p>-{T|hello
13928 </p>
13929 !! end
13930
13931 !! test
13932 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13933 !! options
13934 language=sr
13935 !! input
13936 -{R|=&gt;}-
13937 !! result
13938 <p>=&gt;
13939 </p>
13940 !!end
13941
13942 !! test
13943 Bug 529: Uncovered bullet
13944 !! input
13945 * Foo {{bullet}}
13946 !! result
13947 <ul><li> Foo
13948 </li><li> Bar
13949 </li></ul>
13950
13951 !! end
13952
13953 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13954 # Templates in Wikipedia rely on this behavior, as tidy has always been
13955 # enabled there. These tests are normally run *without* tidy, so specify the
13956 # full output here.
13957 # To test realistic parsing behavior, apply a tidy-like transformation to both
13958 # the expected output and your parser's output.
13959 !! test
13960 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13961 !! input
13962 ******* Foo {{bullet}}
13963 !! result
13964 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13965 </li></ul>
13966 </li></ul>
13967 </li></ul>
13968 </li></ul>
13969 </li></ul>
13970 </li></ul>
13971 </li><li> Bar
13972 </li></ul>
13973
13974 !! end
13975
13976 !! test
13977 Bug 529: Uncovered table already at line-start
13978 !! input
13979 x
13980
13981 {{table}}
13982 y
13983 !! result
13984 <p>x
13985 </p>
13986 <table>
13987 <tr>
13988 <td> 1 </td>
13989 <td> 2
13990 </td></tr>
13991 <tr>
13992 <td> 3 </td>
13993 <td> 4
13994 </td></tr></table>
13995 <p>y
13996 </p>
13997 !! end
13998
13999 !! test
14000 Bug 529: Uncovered bullet in parser function result
14001 !! input
14002 * Foo {{lc:{{bullet}} }}
14003 !! result
14004 <ul><li> Foo
14005 </li><li> bar
14006 </li></ul>
14007
14008 !! end
14009
14010 !! test
14011 Bug 5678: Double-parsed template argument
14012 !! input
14013 {{lc:{{{1}}}|hello}}
14014 !! result
14015 <p>{{{1}}}
14016 </p>
14017 !! end
14018
14019 !! test
14020 Bug 5678: Double-parsed template invocation
14021 !! input
14022 {{lc:{{paramtest {{!}} param = hello }} }}
14023 !! result
14024 <p>{{paramtest | param = hello }}
14025 </p>
14026 !! end
14027
14028 !! test
14029 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14030 !! options
14031 language=cs
14032 title=[[Main Page]]
14033 !! input
14034 {{PRVNÍVELKÉ:ěščř}}
14035 {{prvnívelké:ěščř}}
14036 {{PRVNÍMALÉ:ěščř}}
14037 {{prvnímalé:ěščř}}
14038 {{MALÁ:ěščř}}
14039 {{malá:ěščř}}
14040 {{VELKÁ:ěščř}}
14041 {{velká:ěščř}}
14042 !! result
14043 <p>Ěščř
14044 Ěščř
14045 ěščř
14046 ěščř
14047 ěščř
14048 ěščř
14049 ĚŠČŘ
14050 ĚŠČŘ
14051 </p>
14052 !! end
14053
14054 !! test
14055 Morwen/13: Unclosed link followed by heading
14056 !! input
14057 [[link
14058 ==heading==
14059 !! result
14060 <p>[[link
14061 </p>
14062 <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>
14063
14064 !! end
14065
14066 !! test
14067 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14068 !! input
14069 {{foo|
14070 =heading=
14071 !! result
14072 <p>{{foo|
14073 </p>
14074 <h1><span class="mw-headline" id="heading">heading</span></h1>
14075
14076 !! end
14077
14078 !! test
14079 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14080 !! input
14081 {{foo|
14082 ==heading==
14083 !! result
14084 <p>{{foo|
14085 </p>
14086 <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>
14087
14088 !! end
14089
14090 !! test
14091 Tildes in comments
14092 !! options
14093 pst
14094 !! input
14095 <!-- ~~~~ -->
14096 !! result
14097 <!-- ~~~~ -->
14098 !! end
14099
14100 !! test
14101 Paragraphs inside divs (no extra line breaks)
14102 !! input
14103 <div>Line one
14104
14105 Line two</div>
14106 !! result
14107 <div>Line one
14108 Line two</div>
14109
14110 !! end
14111
14112 !! test
14113 Paragraphs inside divs (extra line break on open)
14114 !! input
14115 <div>
14116 Line one
14117
14118 Line two</div>
14119 !! result
14120 <div>
14121 <p>Line one
14122 </p>
14123 Line two</div>
14124
14125 !! end
14126
14127 !! test
14128 Paragraphs inside divs (extra line break on close)
14129 !! input
14130 <div>Line one
14131
14132 Line two
14133 </div>
14134 !! result
14135 <div>Line one
14136 <p>Line two
14137 </p>
14138 </div>
14139
14140 !! end
14141
14142 !! test
14143 Paragraphs inside divs (extra line break on open and close)
14144 !! input
14145 <div>
14146 Line one
14147
14148 Line two
14149 </div>
14150 !! result
14151 <div>
14152 <p>Line one
14153 </p><p>Line two
14154 </p>
14155 </div>
14156
14157 !! end
14158
14159 !! test
14160 Nesting tags, paragraphs on lines which begin with <div>
14161 !! options
14162 disabled
14163 !! input
14164 <div></div><strong>A
14165 B</strong>
14166 !! result
14167 <div></div>
14168 <p><strong>A
14169 B</strong>
14170 </p>
14171 !! end
14172
14173 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14174 !! test
14175 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14176 !! options
14177 disabled
14178 !! input
14179 <blockquote>Line one
14180
14181 Line two</blockquote>
14182 !! result
14183 <blockquote>Line one
14184 Line two</blockquote>
14185
14186 !! end
14187
14188 !! test
14189 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14190 !! options
14191 disabled
14192 !! input
14193 <blockquote>
14194 Line one
14195
14196 Line two</blockquote>
14197 !! result
14198 <blockquote>
14199 <p>Line one
14200 </p>
14201 Line two</blockquote>
14202
14203 !! end
14204
14205 !! test
14206 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14207 !! options
14208 disabled
14209 !! input
14210 <blockquote>Line one
14211
14212 Line two
14213 </blockquote>
14214 !! result
14215 <blockquote>Line one
14216 <p>Line two
14217 </p>
14218 </blockquote>
14219
14220 !! end
14221
14222 !! test
14223 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14224 !! options
14225 disabled
14226 !! input
14227 <blockquote>
14228 Line one
14229
14230 Line two
14231 </blockquote>
14232 !! result
14233 <blockquote>
14234 <p>Line one
14235 </p><p>Line two
14236 </p>
14237 </blockquote>
14238
14239 !! end
14240
14241 !! test
14242 Paragraphs inside blockquotes/divs (no extra line breaks)
14243 !! input
14244 <blockquote><div>Line one
14245
14246 Line two</div></blockquote>
14247 !! result
14248 <blockquote><div>Line one
14249 Line two</div></blockquote>
14250
14251 !! end
14252
14253 !! test
14254 Paragraphs inside blockquotes/divs (extra line break on open)
14255 !! input
14256 <blockquote><div>
14257 Line one
14258
14259 Line two</div></blockquote>
14260 !! result
14261 <blockquote><div>
14262 <p>Line one
14263 </p>
14264 Line two</div></blockquote>
14265
14266 !! end
14267
14268 !! test
14269 Paragraphs inside blockquotes/divs (extra line break on close)
14270 !! input
14271 <blockquote><div>Line one
14272
14273 Line two
14274 </div></blockquote>
14275 !! result
14276 <blockquote><div>Line one
14277 <p>Line two
14278 </p>
14279 </div></blockquote>
14280
14281 !! end
14282
14283 !! test
14284 Paragraphs inside blockquotes/divs (extra line break on open and close)
14285 !! input
14286 <blockquote><div>
14287 Line one
14288
14289 Line two
14290 </div></blockquote>
14291 !! result
14292 <blockquote><div>
14293 <p>Line one
14294 </p><p>Line two
14295 </p>
14296 </div></blockquote>
14297
14298 !! end
14299
14300 !! test
14301 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14302 !! options
14303 wgLinkHolderBatchSize=0
14304 !! input
14305 [[meatball:1]]
14306 [[meatball:2]]
14307 [[meatball:3]]
14308 !! result
14309 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14310 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14311 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14312 </p>
14313 !! end
14314
14315 !! test
14316 Free external link invading image caption
14317 !! input
14318 [[Image:Foobar.jpg|thumb|http://x|hello]]
14319 !! result
14320 <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>
14321
14322 !! end
14323
14324 !! test
14325 Bug 15196: localised external link numbers
14326 !! options
14327 language=fa
14328 !! input
14329 [http://en.wikipedia.org/]
14330 !! result
14331 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14332 </p>
14333 !! end
14334
14335 !! test
14336 Multibyte character in padleft
14337 !! input
14338 {{padleft:-Hello|7|Æ}}
14339 !! result
14340 <p>Æ-Hello
14341 </p>
14342 !! end
14343
14344 !! test
14345 Multibyte character in padright
14346 !! input
14347 {{padright:Hello-|7|Æ}}
14348 !! result
14349 <p>Hello-Æ
14350 </p>
14351 !! end
14352
14353 !!test
14354 formatdate parser function
14355 !!input
14356 {{#formatdate:2009-03-24}}
14357 !! result
14358 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14359 </p>
14360 !! end
14361
14362 !!test
14363 formatdate parser function, with default format
14364 !!input
14365 {{#formatdate:2009-03-24|mdy}}
14366 !! result
14367 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14368 </p>
14369 !! end
14370
14371 !! test
14372 Spacing of numbers in formatted dates
14373 !! input
14374 {{#formatdate:January 15}}
14375 !! result
14376 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14377 </p>
14378 !! end
14379
14380 !! test
14381 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
14382 !! options
14383 language=nl title=[[MediaWiki:Common.css]]
14384 !! input
14385 {{#formatdate:2009-03-24|dmy}}
14386 !! result
14387 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14388 </p>
14389 !! end
14390
14391 #
14392 #
14393 #
14394
14395 #
14396 # Edit comments
14397 #
14398
14399 !! test
14400 Edit comment with link
14401 !! options
14402 comment
14403 !! input
14404 I like the [[Main Page]] a lot
14405 !! result
14406 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14407 !!end
14408
14409 !! test
14410 Edit comment with link and link text
14411 !! options
14412 comment
14413 !! input
14414 I like the [[Main Page|best pages]] a lot
14415 !! result
14416 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14417 !!end
14418
14419 !! test
14420 Edit comment with link and link text with suffix
14421 !! options
14422 comment
14423 !! input
14424 I like the [[Main Page|best page]]s a lot
14425 !! result
14426 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14427 !!end
14428
14429 !! test
14430 Edit comment with section link (non-local, eg in history list)
14431 !! options
14432 comment title=[[Main Page]]
14433 !! input
14434 /* External links */ removed bogus entries
14435 !! result
14436 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14437 !!end
14438
14439 !! test
14440 Edit comment with section link and text before it (non-local, eg in history list)
14441 !! options
14442 comment title=[[Main Page]]
14443 !! input
14444 pre-comment text /* External links */ removed bogus entries
14445 !! result
14446 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>
14447 !!end
14448
14449 !! test
14450 Edit comment with section link (local, eg in diff view)
14451 !! options
14452 comment local title=[[Main Page]]
14453 !! input
14454 /* External links */ removed bogus entries
14455 !! result
14456 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14457 !!end
14458
14459 !! test
14460 Edit comment with subpage link (bug 14080)
14461 !! options
14462 comment
14463 subpage
14464 title=[[Subpage test]]
14465 !! input
14466 Poked at a [[/subpage]] here...
14467 !! result
14468 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14469 !!end
14470
14471 !! test
14472 Edit comment with subpage link and link text (bug 14080)
14473 !! options
14474 comment
14475 subpage
14476 title=[[Subpage test]]
14477 !! input
14478 Poked at a [[/subpage|neat little page]] here...
14479 !! result
14480 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14481 !!end
14482
14483 !! test
14484 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14485 !! options
14486 comment
14487 title=[[Subpage test]]
14488 !! input
14489 Poked at a [[/subpage]] here...
14490 !! result
14491 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...
14492 !!end
14493
14494 !! test
14495 Edit comment with bare anchor link (local, as on diff)
14496 !! options
14497 comment
14498 local
14499 title=[[Main Page]]
14500 !!input
14501 [[#section]]
14502 !! result
14503 <a href="#section">#section</a>
14504 !! end
14505
14506 !! test
14507 Edit comment with bare anchor link (non-local, as on history)
14508 !! options
14509 comment
14510 title=[[Main Page]]
14511 !!input
14512 [[#section]]
14513 !! result
14514 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14515 !! end
14516
14517 !! test
14518 Anchor starting with underscore
14519 !!input
14520 [[#_ref|One]]
14521 !! result
14522 <p><a href="#_ref">One</a>
14523 </p>
14524 !! end
14525
14526 !! test
14527 Id starting with underscore
14528 !!input
14529 <div id="_ref"></div>
14530 !! result
14531 <div id="_ref"></div>
14532
14533 !! end
14534
14535 !! test
14536 Space normalisation on autocomment (bug 22784)
14537 !! options
14538 comment
14539 title=[[Main Page]]
14540 !!input
14541 /* __hello__world__ */
14542 !! result
14543 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14544 !! end
14545
14546 !! test
14547 percent-encoding and + signs in comments (Bug 26410)
14548 !! options
14549 comment
14550 !!input
14551 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14552 !! result
14553 <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>
14554 !! end
14555
14556 !! test
14557 Bad images - basic functionality
14558 !! options
14559 disabled
14560 !! input
14561 [[File:Bad.jpg]]
14562 !! result
14563 !! end
14564
14565 !! test
14566 Bad images - bug 16039: text after bad image disappears
14567 !! options
14568 disabled
14569 !! input
14570 Foo bar
14571 [[File:Bad.jpg]]
14572 Bar foo
14573 !! result
14574 <p>Foo bar
14575 </p><p>Bar foo
14576 </p>
14577 !! end
14578
14579 !! test
14580 Verify that displaytitle works (bug #22501) no displaytitle
14581 !! options
14582 showtitle
14583 !! config
14584 wgAllowDisplayTitle=true
14585 wgRestrictDisplayTitle=false
14586 !! input
14587 this is not the the title
14588 !! result
14589 Parser test
14590 <p>this is not the the title
14591 </p>
14592 !! end
14593
14594 !! test
14595 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14596 !! options
14597 showtitle
14598 title=[[Screen]]
14599 !! config
14600 wgAllowDisplayTitle=true
14601 wgRestrictDisplayTitle=false
14602 !! input
14603 this is not the the title
14604 {{DISPLAYTITLE:whatever}}
14605 !! result
14606 whatever
14607 <p>this is not the the title
14608 </p>
14609 !! end
14610
14611 !! test
14612 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14613 !! options
14614 showtitle
14615 title=[[Screen]]
14616 !! config
14617 wgAllowDisplayTitle=true
14618 wgRestrictDisplayTitle=true
14619 !! input
14620 this is not the the title
14621 {{DISPLAYTITLE:whatever}}
14622 !! result
14623 Screen
14624 <p>this is not the the title
14625 </p>
14626 !! end
14627
14628 !! test
14629 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14630 !! options
14631 showtitle
14632 title=[[Screen]]
14633 !! config
14634 wgAllowDisplayTitle=true
14635 wgRestrictDisplayTitle=true
14636 !! input
14637 this is not the the title
14638 {{DISPLAYTITLE:screen}}
14639 !! result
14640 screen
14641 <p>this is not the the title
14642 </p>
14643 !! end
14644
14645 !! test
14646 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14647 !! options
14648 showtitle
14649 title=[[Screen]]
14650 !! config
14651 wgAllowDisplayTitle=false
14652 !! input
14653 this is not the the title
14654 {{DISPLAYTITLE:screen}}
14655 !! result
14656 Screen
14657 <p>this is not the the title
14658 <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>
14659 </p>
14660 !! end
14661
14662 !! test
14663 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14664 !! options
14665 showtitle
14666 title=[[Screen]]
14667 !! config
14668 wgAllowDisplayTitle=false
14669 !! input
14670 this is not the the title
14671 !! result
14672 Screen
14673 <p>this is not the the title
14674 </p>
14675 !! end
14676
14677 !! test
14678 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14679 !! options
14680 showtitle
14681 title=[[Screen]]
14682 !! config
14683 wgAllowDisplayTitle=true
14684 wgRestrictDisplayTitle=true
14685 !! input
14686 this is not the the title
14687 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14688 !! result
14689 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14690 <p>this is not the the title
14691 </p>
14692 !! end
14693
14694 !! test
14695 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14696 !! options
14697 showtitle
14698 title=[[Screen]]
14699 !! config
14700 wgAllowDisplayTitle=true
14701 wgRestrictDisplayTitle=true
14702 !! input
14703 this is not the the title
14704 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14705 !! result
14706 <span style="color: red;">s</span>creen
14707 <p>this is not the the title
14708 </p>
14709 !! end
14710
14711 !! test
14712 preload: check <noinclude> and <includeonly>
14713 !! options
14714 preload
14715 !! input
14716 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14717 !! result
14718 Hello kind world.
14719 !! end
14720
14721 !! test
14722 preload: check <onlyinclude>
14723 !! options
14724 preload
14725 !! input
14726 Goodbye <onlyinclude>Hello world</onlyinclude>
14727 !! result
14728 Hello world
14729 !! end
14730
14731 !! test
14732 preload: can pass tags through if we want to
14733 !! options
14734 preload
14735 !! input
14736 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14737 !! result
14738 <includeonly>Hello world</includeonly>
14739 !! end
14740
14741 !! test
14742 preload: check that it doesn't try to do tricks
14743 !! options
14744 preload
14745 !! input
14746 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14747 !! result
14748 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14749 !! end
14750
14751 !! test
14752 Play a bit with r67090 and bug 3158
14753 !! options
14754 disabled
14755 !! input
14756 <div style="width:50% !important">&nbsp;</div>
14757 <div style="width:50%&nbsp;!important">&nbsp;</div>
14758 <div style="width:50%&#160;!important">&nbsp;</div>
14759 <div style="border : solid;">&nbsp;</div>
14760 !! result
14761 <div style="width:50% !important">&nbsp;</div>
14762 <div style="width:50% !important">&nbsp;</div>
14763 <div style="width:50% !important">&nbsp;</div>
14764 <div style="border&#160;: solid;">&nbsp;</div>
14765
14766 !! end
14767
14768 !! test
14769 HTML5 data attributes
14770 !! input
14771 <span data-foo="bar">Baz</span>
14772 <p data-abc-def_hij="">Quuz</p>
14773 !! result
14774 <p><span data-foo="bar">Baz</span>
14775 </p>
14776 <p data-abc-def_hij="">Quuz</p>
14777
14778 !! end
14779
14780 !! test
14781 percent-encoding and + signs in internal links (Bug 26410)
14782 !! input
14783 [[User:+%]] [[Page+title%]]
14784 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14785 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14786 [[%33%45]] [[%33%45+]]
14787 !! result
14788 <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>
14789 <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>
14790 <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>
14791 <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>
14792 </p>
14793 !! end
14794
14795 !! test
14796 Special characters in embedded file links (bug 27679)
14797 !! input
14798 [[File:Contains & ampersand.jpg]]
14799 [[File:Does not exist.jpg|Title with & ampersand]]
14800 !! result
14801 <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>
14802 <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>
14803 </p>
14804 !! end
14805
14806
14807 !! test
14808 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14809 !! input
14810 Text&apos;s been normalized?
14811 !! result
14812 <p>Text&#39;s been normalized?
14813 </p>
14814 !! end
14815
14816 !! test
14817 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14818 !! input
14819 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14820 !! result
14821 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14822 </p>
14823 !! end
14824
14825 !! test
14826 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14827 !! input
14828 [http://www.example.org/ ideograms]
14829 !! result
14830 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14831 </p>
14832 !! end
14833
14834 !! test
14835 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14836 !! input
14837 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14838 !! result
14839 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14840 </p>
14841 !! end
14842
14843 !! article
14844 Mediawiki:loop1
14845 !! text
14846 {{Identical|A}}
14847 !! endarticle
14848
14849 !! article
14850 Mediawiki:loop2
14851 !! text
14852 {{Identical|B}}
14853 !! endarticle
14854
14855 !! article
14856 Template:Identical
14857 !! text
14858 {{int:loop1}}
14859 {{int:loop2}}
14860 !! endarticle
14861
14862 !! test
14863 Bug 31098 Template which includes system messages which includes the template
14864 !! input
14865 {{Identical}}
14866 !! result
14867 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14868 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14869 </p>
14870 !! end
14871
14872 !! test
14873 Bug31490 Turkish: ucfirst 'blah'
14874 !! options
14875 language=tr
14876 !! input
14877 {{ucfirst:blah}}
14878 !! result
14879 <p>Blah
14880 </p>
14881 !! end
14882
14883 !! test
14884 Bug31490 Turkish: ucfirst 'ix'
14885 !! options
14886 language=tr
14887 !! input
14888 {{ucfirst:ix}}
14889 !! result
14890 <p>İx
14891 </p>
14892 !! end
14893
14894 !! test
14895 Bug31490 Turkish: lcfirst 'BLAH'
14896 !! options
14897 language=tr
14898 !! input
14899 {{lcfirst:BLAH}}
14900 !! result
14901 <p>bLAH
14902 </p>
14903 !! end
14904
14905 !! test
14906 Bug31490 Turkish: ucfırst (with a dotless i)
14907 !! options
14908 language=tr
14909 !! input
14910 {{ucfırst:blah}}
14911 !! result
14912 <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>
14913 </p>
14914 !! end
14915
14916 !! test
14917 Bug31490 ucfırst (with a dotless i) with English language
14918 !! options
14919 language=en
14920 !! input
14921 {{ucfırst:blah}}
14922 !! result
14923 <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>
14924 </p>
14925 !! end
14926
14927 !! test
14928 Bug 26375: TOC with italics
14929 !! options
14930 title=[[Main Page]]
14931 !! input
14932 __TOC__
14933 == ''Lost'' episodes ==
14934 !! result
14935 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14936 <ul>
14937 <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>
14938 </ul>
14939 </div>
14940 <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>
14941
14942 !! end
14943
14944 !! test
14945 Bug 26375: TOC with bold
14946 !! options
14947 title=[[Main Page]]
14948 !! input
14949 __TOC__
14950 == '''should be bold''' then normal text ==
14951 !! result
14952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14953 <ul>
14954 <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>
14955 </ul>
14956 </div>
14957 <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>
14958
14959 !! end
14960
14961 !! test
14962 Bug 33845: Headings become cursive in TOC when they contain an image
14963 !! options
14964 title=[[Main Page]]
14965 !! input
14966 __TOC__
14967 == Image [[Image:foobar.jpg]] ==
14968 !! result
14969 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14970 <ul>
14971 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14972 </ul>
14973 </div>
14974 <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>
14975
14976 !! end
14977
14978 !! test
14979 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14980 !! options
14981 title=[[Main Page]]
14982 !! input
14983 __TOC__
14984 == <blockquote>Quote</blockquote> ==
14985 !! result
14986 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14987 <ul>
14988 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14989 </ul>
14990 </div>
14991 <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>
14992
14993 !! end
14994
14995 !! test
14996 Unclosed tags in TOC
14997 !! options
14998 title=[[Main Page]]
14999 !! input
15000 __TOC__
15001 == Proof: 2 < 3 ==
15002 <small>Hanc marginis exiguitas non caperet.</small>
15003 QED
15004 !! result
15005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15006 <ul>
15007 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
15008 </ul>
15009 </div>
15010 <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>
15011 <p><small>Hanc marginis exiguitas non caperet.</small>
15012 QED
15013 </p>
15014 !! end
15015
15016 !! test
15017 Multiple tags in TOC
15018 !! input
15019 __TOC__
15020 == <i>Foo</i> <b>Bar</b> ==
15021
15022 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15023 !! result
15024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15025 <ul>
15026 <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>
15027 <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>
15028 </ul>
15029 </div>
15030 <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>
15031 <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>
15032
15033 !! end
15034
15035 !! test
15036 Tags with parameters in TOC
15037 !! input
15038 __TOC__
15039 == <sup class="in-h2">Hello</sup> ==
15040
15041 == <sup class="a > b">Evilbye</sup> ==
15042 !! result
15043 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15044 <ul>
15045 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15046 <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>
15047 </ul>
15048 </div>
15049 <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>
15050 <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>
15051
15052 !! end
15053
15054 !! test
15055 span tags with directionality in TOC
15056 !! input
15057 __TOC__
15058 == <span dir="ltr">C++</span> ==
15059
15060 == <span dir="rtl">זבנג!</span> ==
15061
15062 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15063
15064 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15065
15066 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15067 !! result
15068 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15069 <ul>
15070 <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>
15071 <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>
15072 <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>
15073 <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>
15074 <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>
15075 </ul>
15076 </div>
15077 <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>
15078 <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>
15079 <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>
15080 <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>
15081 <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>
15082
15083 !! end
15084
15085 !! article
15086 MediaWiki:Bug32057
15087 !! text
15088 == {{int:headline_sample}} ==
15089 !! endarticle
15090
15091 !! test
15092 Bug 32057: Title needed when expanding <h> nodes.
15093 !! options
15094 title=[[Main Page]]
15095 !! input
15096 {{int:Bug32057}}
15097 !! result
15098 <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>
15099
15100 !! end
15101
15102 !! test
15103 Strip marker in urlencode
15104 !! input
15105 {{urlencode:x<nowiki/>y}}
15106 {{urlencode:x<nowiki/>y|wiki}}
15107 {{urlencode:x<nowiki/>y|path}}
15108 !! result
15109 <p>xy
15110 xy
15111 xy
15112 </p>
15113 !! end
15114
15115 !! test
15116 Strip marker in lc
15117 !! input
15118 {{lc:x<nowiki/>y}}
15119 !! result
15120 <p>xy
15121 </p>
15122 !! end
15123
15124 !! test
15125 Strip marker in uc
15126 !! input
15127 {{uc:x<nowiki/>y}}
15128 !! result
15129 <p>XY
15130 </p>
15131 !! end
15132
15133 !! test
15134 Strip marker in formatNum
15135 !! input
15136 {{formatnum:1<nowiki/>2}}
15137 {{formatnum:1<nowiki/>2|R}}
15138 !! result
15139 <p>12
15140 12
15141 </p>
15142 !! end
15143
15144 !! test
15145 Check noCommafy in formatNum
15146 !! options
15147 language=be-tarask
15148 !! input
15149 {{formatnum:123456.78}}
15150 {{formatnum:123456.78|NOSEP}}
15151 !! result
15152 <p>123 456,78
15153 123456.78
15154 </p>
15155 !! end
15156
15157 !! test
15158 Strip marker in grammar
15159 !! options
15160 language=fi
15161 !! input
15162 {{grammar:elative|foo<nowiki/>bar}}
15163 !! result
15164 <p>foobarista
15165 </p>
15166 !! end
15167
15168 !! test
15169 Strip marker in padleft
15170 !! input
15171 {{padleft:|2|x<nowiki/>y}}
15172 !! result
15173 <p>xy
15174 </p>
15175 !! end
15176
15177 !! test
15178 Strip marker in padright
15179 !! input
15180 {{padright:|2|x<nowiki/>y}}
15181 !! result
15182 <p>xy
15183 </p>
15184 !! end
15185
15186 !! test
15187 Strip marker in anchorencode
15188 !! input
15189 {{anchorencode:x<nowiki/>y}}
15190 !! result
15191 <p>xy
15192 </p>
15193 !! end
15194
15195 !! test
15196 nowiki inside link inside heading (bug 18295)
15197 !! input
15198 ==[[foo|x<nowiki>y</nowiki>z]]==
15199 !! result
15200 <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>
15201
15202 !! end
15203
15204 !! test
15205 new support for bdi element (bug 31817)
15206 !! input
15207 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15208 !! result
15209 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15210
15211 !!end
15212
15213 !! test
15214 Ignore pipe between table row attributes
15215 !! input
15216 {|
15217 | quux
15218 |- id=foo | style='color: red'
15219 | bar
15220 |}
15221 !! result
15222 <table>
15223 <tr>
15224 <td> quux
15225 </td></tr>
15226 <tr id="foo" style="color: red">
15227 <td> bar
15228 </td></tr></table>
15229
15230 !! end
15231
15232 !!test
15233 Gallery override link with WikiLink (bug 34852)
15234 !! input
15235 <gallery>
15236 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15237 </gallery>
15238 !! result
15239 <ul class="gallery">
15240 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15241 <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>
15242 <div class="gallerytext">
15243 <p>caption
15244 </p>
15245 </div>
15246 </div></li>
15247 </ul>
15248
15249 !! end
15250
15251 !!test
15252 Gallery override link with absolute external link (bug 34852)
15253 !! input
15254 <gallery>
15255 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15256 </gallery>
15257 !! result
15258 <ul class="gallery">
15259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15260 <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>
15261 <div class="gallerytext">
15262 <p>caption
15263 </p>
15264 </div>
15265 </div></li>
15266 </ul>
15267
15268 !! end
15269
15270 !!test
15271 Gallery override link with malicious javascript (bug 34852)
15272 !! input
15273 <gallery>
15274 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15275 </gallery>
15276 !! result
15277 <ul class="gallery">
15278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15279 <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>
15280 <div class="gallerytext">
15281 <p>caption
15282 </p>
15283 </div>
15284 </div></li>
15285 </ul>
15286
15287 !! end
15288
15289 !!test
15290 Gallery with invalid title as link (bug 43964)
15291 !! input
15292 <gallery>
15293 File:foobar.jpg|link=<
15294 </gallery>
15295 !! result
15296 <ul class="gallery">
15297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15298 <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>
15299 <div class="gallerytext">
15300 </div>
15301 </div></li>
15302 </ul>
15303
15304 !! end
15305
15306 !!test
15307 Language parser function
15308 !! input
15309 {{#language:ar}}
15310 !! result
15311 <p>العربية
15312 </p>
15313 !! end
15314
15315 !!test
15316 Padleft and padright as substr
15317 !! input
15318 {{padleft:|3|abcde}}
15319 {{padright:|3|abcde}}
15320 !! result
15321 <p>abc
15322 abc
15323 </p>
15324 !! end
15325
15326 !!test
15327 Special parser function
15328 !! input
15329 {{#special:RandomPage}}
15330 {{#special:BaDtItLe}}
15331 {{#special:Foobar}}
15332 !! result
15333 <p>Special:Random
15334 Special:Badtitle
15335 Special:Foobar
15336 </p>
15337 !! end
15338
15339 !!test
15340 Bug 34939 - Case insensitive link parsing ([HttP://])
15341 !! input
15342 [HttP://MediaWiki.Org/]
15343 !! result
15344 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15345 </p>
15346 !! end
15347
15348 !!test
15349 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15350 !! input
15351 [HttP://MediaWiki.Org/ MediaWiki]
15352 !! result
15353 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15354 </p>
15355 !! end
15356
15357 !!test
15358 Bug 34939 - Case insensitive link parsing (HttP://)
15359 !! input
15360 HttP://MediaWiki.Org/
15361 !! result
15362 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15363 </p>
15364 !! end
15365
15366
15367 ###
15368 ### Parsoids-specific tests
15369 ### Parsoid-PHP parser incompatibilities
15370 ###
15371 !!test
15372 1. SOL-sensitive wikitext tokens as template-args
15373 !!options
15374 parsoid=wt2html,wt2wt
15375 !!input
15376 {{echo|*a}}
15377 {{echo|#a}}
15378 {{echo|:a}}
15379 !!result
15380 <span about="#mwt1" typeof="mw:Transclusion">
15381 </span><ul about="#mwt1"><li>a</li></ul>
15382 <span about="#mwt2" typeof="mw:Transclusion">
15383 </span><ol about="#mwt2"><li>a</li></ol>
15384 <span about="#mwt3" typeof="mw:Transclusion">
15385 </span><dl about="#mwt3"><dd>a</dd></dl>
15386 !!end
15387
15388 #### ----------------------------------------------------------------
15389 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15390 #### tags. Parsoid's output for these tags differs from that of the
15391 #### PHP parser.
15392 #### ----------------------------------------------------------------
15393
15394 !!test
15395 Ref: 1. ref-location should be replaced with an index span
15396 !!options
15397 parsoid
15398 !!input
15399 A <ref>foo</ref>
15400 B <ref name="x">foo</ref>
15401 C <ref name="y" />
15402 !!result
15403 <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>
15404 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>
15405 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>
15406 !!end
15407
15408 !!test
15409 Ref: 2. ref-tags with identical names should all get the same index
15410 !!options
15411 parsoid
15412 !!input
15413 A <ref name="x">foo</ref>
15414 B <ref name="x" />
15415 !!result
15416 <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>
15417 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>
15418 !!end
15419
15420 !!test
15421 Ref: 3. spaces in ref-names should be ignored
15422 !!options
15423 parsoid
15424 !!input
15425 A <ref name="x">foo</ref>
15426 B <ref name=" x " />
15427 C <ref name= x />
15428 !!result
15429 <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>
15430 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>
15431 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>
15432 !!end
15433
15434 !!test
15435 Ref: 4. 'constructor' should be accepted as a valid ref-name
15436 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15437 !!options
15438 parsoid
15439 !!input
15440 A <ref name="constructor">foo</ref>
15441 !!result
15442 <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>
15443 !!end
15444
15445 !!test
15446 Ref: 5. body should accept generic wikitext
15447 !!options
15448 parsoid
15449 !!input
15450 A <ref>
15451 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15452 </ref>
15453
15454 <references />
15455 !!result
15456 <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>
15457
15458 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15459 <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>
15460 </li></ol>
15461 !!end
15462
15463 !!test
15464 Ref: 6. indent-pres should not be output in ref-body
15465 !!options
15466 parsoid
15467 !!input
15468 A <ref>
15469 foo
15470 bar
15471 baz
15472 </ref>
15473
15474 <references />
15475 !!result
15476 <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>
15477
15478 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15479 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15480 bar
15481 baz
15482 </li></ol>
15483 !!end
15484
15485 !!test
15486 Ref: 6. No p-wrapping in ref-body
15487 !!options
15488 parsoid
15489 !!input
15490 A <ref>
15491 foo
15492
15493 bar
15494
15495
15496 baz
15497
15498
15499
15500 booz
15501 </ref>
15502
15503 <references />
15504 !!result
15505 <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>
15506
15507 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15508 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15509
15510 bar
15511
15512
15513 baz
15514
15515
15516
15517 booz
15518 </li></ol>
15519 !!end
15520
15521 !!test
15522 Ref: 8. transclusion wikitext has lower precedence
15523 !!options
15524 parsoid
15525 !!input
15526 A <ref> foo {{echo|</ref> B C}}
15527
15528 <references />
15529 !!result
15530 <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>
15531
15532 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15533 <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>
15534 !!end
15535
15536 !!test
15537 Ref: 9. unclosed comments should not leak out of ref-body
15538 !!options
15539 parsoid
15540 !!input
15541 A <ref> foo <!--</ref> B C
15542
15543 <references />
15544 !!result
15545 <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>
15546
15547 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15548 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15549 !!end
15550
15551 !!test
15552 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15553 !!options
15554 parsoid
15555 !!input
15556 A <ref> <b> foo </ref> B C
15557
15558 <references />
15559 !!result
15560 <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>
15561
15562 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15563 <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>
15564 !!end
15565
15566 !!test
15567 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15568 !!options
15569 parsoid
15570 !!input
15571 A <ref>foo</ref> B
15572 C <ref>bar</ref> D
15573 !!result
15574 <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
15575 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>
15576 !!end
15577
15578 !!test
15579 Ref: 12. ref-tags act as trailing newline migration barrier
15580 !!options
15581 parsoid
15582 !!input
15583 <!--the newline at the end of this line moves out of the p-tag-->a
15584
15585 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15586 <ref />
15587
15588 c
15589 !!result
15590 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15591
15592
15593 <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>
15594 <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>
15595
15596
15597 <p>c</p>
15598 !!end
15599
15600 !!test
15601 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15602 !!options
15603 parsoid
15604 !!input
15605 <ref>foo</ref> A
15606 <ref>bar
15607 </ref> B
15608 !!result
15609 <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
15610 <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>
15611 !!end
15612
15613 !!test
15614 Ref: 14. A nested ref-tag should be emitted as plain text
15615 !!options
15616 parsoid
15617 !!input
15618 <ref>foo <ref>bar</ref> baz</ref>
15619
15620 <references />
15621 !!result
15622 <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>
15623
15624 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15625 <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>
15626 !!end
15627
15628 !!test
15629 Ref: 15. ref-tags with identical names should get identical indexes
15630 !!options
15631 parsoid
15632 !!input
15633 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15634 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15635
15636 <references />
15637 !!result
15638 <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>
15639 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>
15640
15641 <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>
15642 !!end
15643
15644 !!test
15645 References: 1. references tag without any refs should be handled properly
15646 !!options
15647 parsoid
15648 !!input
15649 <references />
15650 !!result
15651 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15652 !!end
15653
15654 !!test
15655 References: 2. references tag with group only outputs references from that group
15656 !!options
15657 parsoid
15658 !!input
15659 A <ref group="a">foo</ref>
15660 B <ref group="b">bar</ref>
15661
15662 <references group='a' />
15663 !!result
15664 <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>
15665 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>
15666
15667 <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>
15668 !!end
15669
15670 !!test
15671 References: 3. ref list should be cleared after processing references
15672 !!options
15673 parsoid
15674 !!input
15675 A <ref>foo</ref>
15676
15677 <references />
15678
15679 B <ref>bar</ref>
15680
15681 <references />
15682 !!result
15683 <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>
15684
15685 <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>
15686
15687 <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>
15688
15689 <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>
15690 !!end
15691
15692 !!test
15693 References: 4. only referenced group should be cleared after processing references
15694 !!options
15695 parsoid
15696 !!input
15697 A <ref group="a">afoo</ref>
15698 B <ref>bfoo</ref>
15699
15700 <references group="a"/>
15701
15702 C <ref>cfoo</ref>
15703
15704 <references />
15705 !!result
15706 <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>
15707 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>
15708
15709 <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>
15710
15711 <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>
15712
15713 <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>
15714 !!end
15715
15716 !!test
15717 References: 5. ref tags in references should be processed while ignoring all other content
15718 !!options
15719 parsoid
15720 !!input
15721 A <ref name="a" />
15722 B <ref name="b">bar</ref>
15723
15724 <references>
15725 <ref name="a">foo</ref>
15726 This should just get lost.
15727 </references>
15728 !!result
15729 <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>
15730 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>
15731
15732 <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>
15733 !!end
15734
15735 !!test
15736 References: 6. <references /> from a transclusion
15737 !!options
15738 parsoid
15739 !!input
15740 {{echo|<references />}}
15741 !!result
15742 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15743 !!end
15744
15745 !! test
15746 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15747 !! options
15748 parsoid
15749 !! input
15750 A <ref>foo bar for a</ref>
15751 B <ref name="b" />
15752
15753 <references />
15754
15755 <references>
15756 <ref name="b">foo</ref>
15757 </references>
15758 !! result
15759 <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>
15760 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>
15761
15762 <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>
15763
15764 <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>
15765
15766 !! end
15767
15768 #### ----------------------------------------------------------------
15769 #### The following section of tests are primarily to test
15770 #### wikitext escaping capabilities of Parsoid. Given that
15771 #### escaping can be done any number of ways, the wikitext (input)
15772 #### is always adjusted to reflect how Parsoid adds nowiki
15773 #### escape tags.
15774 ####
15775 #### We are marking several tests as parsoid-only since the
15776 #### HTML in the result section is different from what the
15777 #### PHP parser generates for it.
15778 #### ----------------------------------------------------------------
15779
15780
15781 #### --------------- Headings ---------------
15782 #### 0. Unnested
15783 #### 1. Nested inside html <h1>=foo=</h1>
15784 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15785 #### 3. Nested inside html with wikitext split by html tags
15786 #### 4. No escape needed
15787 #### 5. Empty headings <h1></h1>
15788 #### 6. Heading chars in SOL context
15789 #### ----------------------------------------
15790 !! test
15791 Headings: 0. Unnested
15792 !! options
15793 parsoid
15794 !! input
15795 <nowiki>=foo=</nowiki>
15796
15797 <nowiki> =foo= </nowiki>
15798 <!--cmt-->
15799 <nowiki>=foo=</nowiki>
15800
15801 =foo''a''<nowiki>=</nowiki>
15802 !! result
15803 <p><span typeof="mw:Nowiki">=foo=</span></p>
15804
15805 <p><span typeof="mw:Nowiki"> =foo= </span>
15806 <!--cmt-->
15807 <span typeof="mw:Nowiki">=foo=</span></p>
15808
15809 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15810 !!end
15811
15812 !! test
15813 Headings: 1. Nested inside html
15814 !! options
15815 parsoid
15816 !! input
15817 =<nowiki>=foo=</nowiki>=
15818
15819 ==<nowiki>=foo=</nowiki>==
15820
15821 ===<nowiki>=foo=</nowiki>===
15822
15823 ====<nowiki>=foo=</nowiki>====
15824
15825 =====<nowiki>=foo=</nowiki>=====
15826
15827 ======<nowiki>=foo=</nowiki>======
15828 !! result
15829 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15830 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15831 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15832 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15833 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15834 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15835 !!end
15836
15837 !! test
15838 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15839 !! options
15840 parsoid
15841 !! input
15842 =foo=
15843 <nowiki>*</nowiki>bar
15844
15845 =foo=
15846 =bar
15847
15848 =foo=
15849 <nowiki>=bar=</nowiki>
15850 !! result
15851 <h1>foo</h1>*bar
15852 <h1>foo</h1>=bar
15853 <h1>foo</h1>=bar=
15854 !!end
15855
15856 !! test
15857 Headings: 3. Nested inside html with wikitext split by html tags
15858 !! options
15859 parsoid
15860 !! input
15861 =='''bold'''<nowiki>foo=</nowiki>=
15862 !! result
15863 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15864 !!end
15865
15866 !! test
15867 Headings: 4a. No escaping needed (testing just h1 and h2)
15868 !! options
15869 parsoid
15870 !! input
15871 ==foo=
15872
15873 =foo==
15874
15875 = =foo= =
15876
15877 ==foo= bar=
15878
15879 ===foo==
15880
15881 ==foo===
15882
15883 =''=''foo==
15884
15885 =<nowiki>=</nowiki>=
15886 !! result
15887 <h1>=foo</h1>
15888 <h1>foo=</h1>
15889 <h1> =foo= </h1>
15890 <h1>=foo= bar</h1>
15891 <h2>=foo</h2>
15892 <h2>foo=</h2>
15893 <h1><i>=</i>foo=</h1>
15894 <h1><span typeof="mw:Nowiki">=</span></h1>
15895 !!end
15896
15897 !! test
15898 Headings: 4b. No escaping needed (inside p-tags)
15899 !! options
15900 parsoid
15901 !! input
15902 ===
15903 =foo= x
15904 =foo= <s></s>
15905 !! result
15906 <p>===
15907 =foo= x
15908 =foo= <s></s>
15909 </p>
15910 !!end
15911
15912 !! test
15913 Headings: 5. Empty headings
15914 !! options
15915 parsoid
15916 !! input
15917 =<nowiki/>=
15918
15919 ==<nowiki/>==
15920
15921 ===<nowiki/>===
15922
15923 ====<nowiki/>====
15924
15925 =====<nowiki/>=====
15926
15927 ======<nowiki/>======
15928 !! result
15929 <h1></h1>
15930 <h2></h2>
15931 <h3></h3>
15932 <h4></h4>
15933 <h5></h5>
15934 <h6></h6>
15935 !!end
15936
15937 !! test
15938 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15939 !! options
15940 parsoid
15941 !! input
15942 <nowiki>=a=</nowiki>
15943
15944 <nowiki>=a=</nowiki>
15945
15946 <nowiki>=a=</nowiki>
15947
15948 <nowiki>=a=</nowiki>
15949 !! result
15950 <p>=a=</p>
15951 <p>=a= </p>
15952 <p>=a= </p>
15953 <p>=a= </p>
15954 !!end
15955
15956 !! test
15957 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15958 !! options
15959 parsoid
15960 !! input
15961 <nowiki>=a=
15962 b</nowiki>
15963
15964 <nowiki>=a=
15965 b</nowiki>
15966
15967 <nowiki>=a=
15968 b</nowiki>
15969
15970 <nowiki>=a=
15971 b</nowiki>
15972 !! result
15973 <p>=a=
15974 b</p>
15975 <p>=a=
15976 b</p>
15977 <p>=a=
15978 b</p>
15979 <p>=a=
15980 b</p>
15981 </p>
15982 !!end
15983
15984 !! test
15985 Headings: 6c. Heading chars in SOL context (leading newline break)
15986 !! options
15987 parsoid
15988 !! input
15989 a
15990 <nowiki>=b=</nowiki>
15991 !! result
15992 <p>a
15993 =b=</p>
15994 !!end
15995
15996 !! test
15997 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15998 !! options
15999 parsoid
16000 !! input
16001 <!--c0--><nowiki>=a=</nowiki>
16002 <!--c1-->
16003 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16004 !! result
16005 <p><!--c0-->=a=</p>
16006 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16007 !!end
16008
16009 !! test
16010 Headings: 6d. Heading chars in SOL context (No escaping needed)
16011 !! options
16012 parsoid=html2wt
16013 !! input
16014 =a=<div>b</div>
16015 !! result
16016 =a=<div>b</div>
16017 !!end
16018
16019 #### --------------- Lists ---------------
16020 #### 0. Outside nests (*foo, etc.)
16021 #### 1. Nested inside html <ul><li>*foo</li></ul>
16022 #### 2. Inside definition lists
16023 #### 3. Only bullets at start should be escaped
16024 #### 4. No escapes needed
16025 #### 5. No unnecessary escapes
16026 #### 6. Escape bullets in SOL position
16027 #### 7. Escape bullets in a multi-line context
16028 #### ----------------------------------------
16029
16030 !! test
16031 Lists: 0. Outside nests
16032 !! input
16033 <nowiki>*</nowiki>foo
16034
16035 <nowiki>#</nowiki>foo
16036 !! result
16037 <p>*foo
16038 </p><p>#foo
16039 </p>
16040 !!end
16041
16042 !! test
16043 Lists: 1. Nested inside html
16044 !! input
16045 *<nowiki>*foo</nowiki>
16046
16047 *<nowiki>#foo</nowiki>
16048
16049 *<nowiki>:foo</nowiki>
16050
16051 *<nowiki>;foo</nowiki>
16052
16053 #<nowiki>*foo</nowiki>
16054
16055 #<nowiki>#foo</nowiki>
16056
16057 #<nowiki>:foo</nowiki>
16058
16059 #<nowiki>;foo</nowiki>
16060 !! result
16061 <ul><li>*foo
16062 </li></ul>
16063 <ul><li>#foo
16064 </li></ul>
16065 <ul><li>:foo
16066 </li></ul>
16067 <ul><li>;foo
16068 </li></ul>
16069 <ol><li>*foo
16070 </li></ol>
16071 <ol><li>#foo
16072 </li></ol>
16073 <ol><li>:foo
16074 </li></ol>
16075 <ol><li>;foo
16076 </li></ol>
16077
16078 !!end
16079
16080 !! test
16081 Lists: 2. Inside definition lists
16082 !! input
16083 ;<nowiki>;foo</nowiki>
16084
16085 ;<nowiki>:foo</nowiki>
16086
16087 ;<nowiki>:foo</nowiki>
16088 :bar
16089
16090 :<nowiki>:foo</nowiki>
16091 !! result
16092 <dl><dt>;foo
16093 </dt></dl>
16094 <dl><dt>:foo
16095 </dt></dl>
16096 <dl><dt>:foo
16097 </dt><dd>bar
16098 </dd></dl>
16099 <dl><dd>:foo
16100 </dd></dl>
16101
16102 !!end
16103
16104 !! test
16105 Lists: 3. Only bullets at start of text should be escaped
16106 !! input
16107 *<nowiki>*foo*bar</nowiki>
16108
16109 *<nowiki>*foo</nowiki>''it''*bar
16110 !! result
16111 <ul><li>*foo*bar
16112 </li></ul>
16113 <ul><li>*foo<i>it</i>*bar
16114 </li></ul>
16115
16116 !!end
16117
16118 !! test
16119 Lists: 4. No escapes needed
16120 !! options
16121 parsoid
16122 !! input
16123 *foo*bar
16124
16125 *''foo''*bar
16126
16127 *[[Foo]]: bar
16128 !! result
16129 <ul><li>foo*bar
16130 </li></ul>
16131 <ul><li><i>foo</i>*bar
16132 </li></ul>
16133 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16134 </li></ul>
16135 !!end
16136
16137 !! test
16138 Lists: 5. No unnecessary escapes
16139 !! input
16140 * bar <span><nowiki>[[foo]]</nowiki></span>
16141
16142 *=bar <span><nowiki>[[foo]]</nowiki></span>
16143
16144 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16145
16146 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16147
16148 *=bar <span>foo]]</span>=
16149
16150 * <s></s>: a
16151 !! result
16152 <ul><li> bar <span>[[foo]]</span>
16153 </li></ul>
16154 <ul><li>=bar <span>[[foo]]</span>
16155 </li></ul>
16156 <ul><li>[[bar <span>[[foo]]</span>
16157 </li></ul>
16158 <ul><li>]]bar <span>[[foo]]</span>
16159 </li></ul>
16160 <ul><li>=bar <span>foo]]</span>=
16161 </li></ul>
16162 <ul><li> <s></s>: a
16163 </li></ul>
16164
16165 !!end
16166
16167 !! test
16168 Lists: 6. Escape bullets in SOL position
16169 !! options
16170 parsoid
16171 !! input
16172 <!--cmt--><nowiki>*foo</nowiki>
16173 !! result
16174 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16175 !!end
16176
16177 !! test
16178 Lists: 7. Escape bullets in a multi-line context
16179 !! input
16180 a
16181 <nowiki>*</nowiki>b
16182 !! result
16183 <p>a
16184 *b
16185 </p>
16186 !!end
16187
16188 #### --------------- HRs ---------------
16189 #### 1. Single line
16190 #### -----------------------------------
16191
16192 !! test
16193 HRs: 1. Single line
16194 !! options
16195 parsoid
16196 !! input
16197 ----<nowiki>----</nowiki>
16198 ----=foo=
16199 ----*foo
16200 !! result
16201 <hr><span typeof="mw:Nowiki">----</span>
16202 <hr>=foo=
16203 <hr>*foo
16204 !! end
16205
16206 #### --------------- Tables ---------------
16207 #### 1a. Simple example
16208 #### 1b. No escaping needed (!foo)
16209 #### 1c. No escaping needed (|foo)
16210 #### 1d. No escaping needed (|}foo)
16211 ####
16212 #### 2a. Nested in td (<td>foo|bar</td>)
16213 #### 2b. Nested in td (<td>foo||bar</td>)
16214 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16215 ####
16216 #### 3a. Nested in th (<th>foo!bar</th>)
16217 #### 3b. Nested in th (<th>foo!!bar</th>)
16218 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16219 ####
16220 #### 4a. Escape -
16221 #### 4b. Escape +
16222 #### 4c. No escaping needed
16223 #### --------------------------------------
16224
16225 !! test
16226 Tables: 1a. Simple example
16227 !! input
16228 <nowiki>{|
16229 |}</nowiki>
16230 !! result
16231 <p>{|
16232 |}
16233 </p>
16234 !! end
16235
16236 !! test
16237 Tables: 1b. No escaping needed
16238 !! input
16239 !foo
16240 !! result
16241 <p>!foo
16242 </p>
16243 !! end
16244
16245 !! test
16246 Tables: 1c. No escaping needed
16247 !! input
16248 |foo
16249 !! result
16250 <p>|foo
16251 </p>
16252 !! end
16253
16254 !! test
16255 Tables: 1d. No escaping needed
16256 !! input
16257 |}foo
16258 !! result
16259 <p>|}foo
16260 </p>
16261 !! end
16262
16263 !! test
16264 Tables: 2a. Nested in td
16265 !! options
16266 parsoid
16267 !! input
16268 {|
16269 |<nowiki>foo|bar</nowiki>
16270 |}
16271 !! result
16272 <table><tbody><tr>
16273 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16274 !! end
16275
16276 !! test
16277 Tables: 2b. Nested in td
16278 !! options
16279 parsoid
16280 !! input
16281 {|
16282 |<nowiki>foo||bar</nowiki>
16283 |''it''<nowiki>foo||bar</nowiki>
16284 |}
16285 !! result
16286 <table><tbody><tr>
16287 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16288 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16289 !! end
16290
16291 !! test
16292 Tables: 2c. Nested in td -- no escaping needed
16293 !! options
16294 parsoid
16295 !! input
16296 {|
16297 |foo!!bar
16298 |}
16299 !! result
16300 <table><tbody><tr><td>foo!!bar
16301 </td></tr></tbody></table>
16302
16303 !! end
16304
16305 !! test
16306 Tables: 3a. Nested in th
16307 !! options
16308 parsoid
16309 !! input
16310 {|
16311 !foo!bar
16312 |}
16313 !! result
16314 <table><tbody><tr><th>foo!bar
16315 </th></tr></tbody></table>
16316
16317 !! end
16318
16319 !! test
16320 Tables: 3b. Nested in th
16321 !! options
16322 parsoid
16323 !! input
16324 {|
16325 !<nowiki>foo!!bar</nowiki>
16326 |}
16327 !! result
16328 <table>
16329 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16330 </tbody></table>
16331 !! end
16332
16333 !! test
16334 Tables: 3c. Nested in th -- no escaping needed
16335 !! options
16336 parsoid
16337 !! input
16338 {|
16339 !<nowiki>foo||bar</nowiki>
16340 |}
16341 !! result
16342 <table><tbody><tr>
16343 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16344 !! end
16345
16346 !! test
16347 Tables: 4a. Escape -
16348 !! options
16349 parsoid
16350 !! input
16351 {|
16352 |-
16353 !-bar
16354 |-
16355 |<nowiki>-bar</nowiki>
16356 |}
16357 !! result
16358 <table><tbody>
16359 <tr><th>-bar</th></tr>
16360 <tr>
16361 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16362 !! end
16363
16364 !! test
16365 Tables: 4b. Escape +
16366 !! options
16367 parsoid
16368 !! input
16369 {|
16370 |-
16371 !+bar
16372 |-
16373 |<nowiki>+bar</nowiki>
16374 |}
16375 !! result
16376 <table><tbody>
16377 <tr><th>+bar</th></tr>
16378 <tr>
16379 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16380 !! end
16381
16382 !! test
16383 Tables: 4c. No escaping needed
16384 !! options
16385 parsoid
16386 !! input
16387 {|
16388 |-
16389 |foo-bar
16390 |foo+bar
16391 |-
16392 |''foo''-bar
16393 |''foo''+bar
16394 |-
16395 |foo
16396 bar|baz
16397 +bar
16398 -bar
16399 |}
16400 !! result
16401 <table><tbody>
16402 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16403 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16404 <tr><td>foo
16405 <p>bar|baz
16406 +bar
16407 -bar</p></td></tr>
16408 </tbody></table>
16409 !! end
16410
16411 ### SSS FIXME: Disabled right now because accurate html2wt
16412 ### on this snippet requires data-parsoid flags that we've
16413 ### stripped out of these tests. We should scheme how we
16414 ### we want to handle these kind of tests that require
16415 ### data-parsoid flags for accurate html2wt serialization
16416
16417 !! test
16418 Tables: 4d. No escaping needed
16419 !! options
16420 disabled
16421 !! input
16422 {|
16423 ||+1
16424 ||-2
16425 |}
16426 !! result
16427 <table>
16428 <tr>
16429 <td>+1
16430 </td>
16431 <td>-2
16432 </td></tr></table>
16433
16434 !! end
16435
16436 #### --------------- Links ----------------
16437 #### 1. Quote marks in link text
16438 #### 2. Wikilinks: Escapes needed
16439 #### 3. Wikilinks: No escapes needed
16440 #### 4. Extlinks: Escapes needed
16441 #### 5. Extlinks: No escapes needed
16442 #### --------------------------------------
16443 !! test
16444 Links 1. Quote marks in link text
16445 !! options
16446 parsoid
16447 !! input
16448 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16449 !! result
16450 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16451 !! end
16452
16453 !! test
16454 Links 2. WikiLinks: Escapes needed
16455 !! options
16456 parsoid
16457 !! input
16458 [[Foo|<nowiki>[Foobar]</nowiki>]]
16459 [[Foo|<nowiki>Foobar]</nowiki>]]
16460 [[Foo|x [Foobar] x]]
16461 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16462 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16463 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16464 [[Foo|<nowiki>|Bar</nowiki>]]
16465 [[Foo|<nowiki>]]bar</nowiki>]]
16466 [[Foo|<nowiki>[[bar</nowiki>]]
16467 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16468 !! result
16469 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16470 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16471 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16472 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16473 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16474 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16475 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16476 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16477 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16478 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16479 !! end
16480
16481 !! test
16482 Links 3. WikiLinks: No escapes needed
16483 !! options
16484 parsoid
16485 !! input
16486 [[Foo|[Foobar]]
16487 [[Foo|foo|bar]]
16488 !! result
16489 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16490 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16491 !! end
16492
16493 !! test
16494 Links 4. ExtLinks: Escapes needed
16495 !! options
16496 parsoid
16497 !! input
16498 [http://google.com <nowiki>[google]</nowiki>]
16499 [http://google.com <nowiki>google]</nowiki>]
16500 !! result
16501 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16502 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16503 !! end
16504
16505 !! test
16506 Links 5. ExtLinks: No escapes needed
16507 !! options
16508 parsoid
16509 !! input
16510 [http://google.com [google]
16511 !! result
16512 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16513 !! end
16514
16515 #### --------------- Quotes ---------------
16516 #### 1. Quotes inside <b> and <i>
16517 #### 2. Link fragments separated by <i> and <b> tags
16518 #### 3. Link fragments inside <i> and <b>
16519 #### 4. No escaping needed
16520 #### --------------------------------------
16521 !! test
16522 1. Quotes inside <b> and <i>
16523 !! options
16524 parsoid=html2wt,wt2wt
16525 !! input
16526 ''<nowiki>'foo'</nowiki>''
16527 ''<nowiki>''foo''</nowiki>''
16528 ''<nowiki>'''foo'''</nowiki>''
16529 ''foo''<nowiki/>'s
16530 '''<nowiki>'foo'</nowiki>'''
16531 '''<nowiki>''foo''</nowiki>'''
16532 '''<nowiki>'''foo'''</nowiki>'''
16533 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16534 '''foo'''<nowiki/>'s
16535 '''foo''
16536 ''foo''<nowiki/>'
16537 '<nowiki/>''foo''<nowiki/>'
16538 ''''foo'''
16539 '''foo'''<nowiki/>'
16540 '<nowiki/>'''foo'''<nowiki/>'
16541 !! result
16542 <p><i>'foo'</i>
16543 <i>''foo''</i>
16544 <i>'''foo'''</i>
16545 <i>foo</i>'s
16546 <b>'foo'</b>
16547 <b>''foo''</b>
16548 <b>'''foo'''</b>
16549 <b>foo'<i>bar'</i>baz</b>
16550 <b>foo</b>'s
16551 '<i>foo</i>
16552 <i>foo</i>'
16553 '<i>foo</i>'
16554 '<b>foo</b>
16555 <b>foo</b>'
16556 '<b>foo</b>'</p>
16557 !! end
16558
16559 !! test
16560 2. Link fragments separated by <i> and <b> tags
16561 !! input
16562 [[''foo''<nowiki>hello]]</nowiki>
16563
16564 [['''foo'''<nowiki>hello]]</nowiki>
16565 !! result
16566 <p>[[<i>foo</i>hello]]
16567 </p><p>[[<b>foo</b>hello]]
16568 </p>
16569 !! end
16570
16571 !! test
16572 3. Link fragments inside <i> and <b>
16573 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16574 this is one of the shortcomings of this format)
16575 !! input
16576 ''[[foo''<nowiki>]]</nowiki>
16577
16578 '''[[foo'''<nowiki>]]</nowiki>
16579 !! result
16580 <p><i>[[foo</i>]]
16581 </p><p><b>[[foo</b>]]
16582 </p>
16583 !! end
16584
16585 !! test
16586 4. No escaping needed
16587 !! input
16588 '<span>''bar''</span>'
16589 '<span>'''bar'''</span>'
16590 !! result
16591 <p>'<span><i>bar</i></span>'
16592 '<span><b>bar</b></span>'
16593 </p>
16594 !! end
16595
16596 #### ----------- Paragraphs ---------------
16597 #### 1. No unnecessary escapes
16598 #### --------------------------------------
16599
16600 !! test
16601 1. No unnecessary escapes
16602 !! input
16603 bar <span><nowiki>[[foo]]</nowiki></span>
16604
16605 =bar <span><nowiki>[[foo]]</nowiki></span>
16606
16607 [[bar <span><nowiki>[[foo]]</nowiki></span>
16608
16609 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16610
16611 =bar <span>foo]]</span><nowiki>=</nowiki>
16612 !! result
16613 <p>bar <span>[[foo]]</span>
16614 </p><p>=bar <span>[[foo]]</span>
16615 </p><p>[[bar <span>[[foo]]</span>
16616 </p><p>]]bar <span>[[foo]]</span>
16617 </p><p>=bar <span>foo]]</span>=
16618 </p>
16619 !!end
16620
16621 #### ----------------------- PRE --------------------------
16622 #### 1. Leading whitespace in SOL context should be escaped
16623 #### ------------------------------------------------------
16624 !! test
16625 1. Leading whitespace in SOL context should be escaped
16626 !! options
16627 parsoid
16628 !! input
16629 <nowiki> </nowiki>a
16630
16631 <nowiki> </nowiki> a
16632
16633 <nowiki> </nowiki>a(tab)
16634
16635 <nowiki> </nowiki> a
16636 <!--cmt-->
16637 <nowiki> </nowiki> a
16638
16639 a
16640 <nowiki> </nowiki>b
16641
16642 a
16643 <nowiki> </nowiki>b
16644
16645 a
16646 <nowiki> </nowiki> b
16647 !! result
16648 <p> a</p>
16649 <p> a</p>
16650 <p> a(tab)</p>
16651 <p> a</p>
16652 <p><!--cmt--> a</p>
16653 <p>a
16654 b</p>
16655 <p>a
16656 b</p>
16657 <p>a
16658 b</p>
16659 !! end
16660
16661 #### --------------- HTML tags ---------------
16662 #### 1. a tags
16663 #### 2. other tags
16664 #### 3. multi-line html tag
16665 #### -----------------------------------------
16666 !! test
16667 1. a tags
16668 !! options
16669 parsoid
16670 !! input
16671 <a href="http://google.com">google</a>
16672 !! result
16673 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16674 !! end
16675
16676 !! test
16677 2. other tags
16678 !! input
16679 <nowiki><div>foo</div>
16680 <div style="color:red">foo</div></nowiki>
16681 !! result
16682 <p>&lt;div&gt;foo&lt;/div&gt;
16683 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16684 </p>
16685 !! end
16686
16687 !! test
16688 3. multi-line html tag
16689 !! input
16690 <nowiki><div
16691 >foo</div
16692 ></nowiki>
16693 !! result
16694 <p>&lt;div
16695 &gt;foo&lt;/div
16696 &gt;
16697 </p>
16698 !! end
16699
16700 !! test
16701 4. extension tags
16702 !! input
16703 <nowiki><ref>foo</ref></nowiki>
16704 !! result
16705 <p>&lt;ref&gt;foo&lt;/ref&gt;
16706 </p>
16707 !! end
16708
16709 #### --------------- Others ---------------
16710 !! test
16711 Escaping nowikis
16712 !! input
16713 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16714 !! result
16715 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16716 </p>
16717 !! end
16718
16719 ## The quote-char in the input is necessary for triggering the bug
16720 !! test
16721 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16722 !! options
16723 parsoid=wt2wt,html2wt
16724 !! input
16725 foo's bar :
16726 !! result
16727 <p>foo's bar :</p>
16728 !! end
16729
16730 !! test
16731
16732 Tag-like HTML structures are passed through as text
16733 !! input
16734 <x y>
16735
16736 <x.y>
16737
16738 <x-y>
16739
16740 1>2
16741
16742 x<y
16743
16744 a>b
16745
16746 1<d e>f
16747 !! result
16748 <p>&lt;x y&gt;
16749 </p><p>&lt;x.y&gt;
16750 </p><p>&lt;x-y&gt;
16751 </p><p>1&gt;2
16752 </p><p>x&lt;y
16753 </p><p>a&gt;b
16754 </p><p>1&lt;d e&gt;f
16755 </p>
16756 !! end
16757
16758
16759 # This was a bug in the PHP parser (see bug 17663 and its dups,
16760 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16761 !! test
16762 Tag names followed by punctuation should not be recognized as tags
16763 !! input
16764 <s.ome> text
16765 !! result
16766 <p>&lt;s.ome&gt; text
16767 </p>
16768 !! end
16769
16770 !! test
16771 HTML tag with necessary entities in attributes
16772 !! input
16773 <span title="&amp;amp;">foo</span>
16774 !! result
16775 <p><span title="&amp;amp;">foo</span>
16776 </p>
16777 !! end
16778
16779 !! test
16780 HTML tag with 'unnecessary' entity encoding in attributes
16781 !! input
16782 <span title="&amp;">foo</span>
16783 !! result
16784 <p><span title="&amp;">foo</span>
16785 </p>
16786 !! end
16787
16788 !! test
16789 HTML tag with broken attribute value quoting
16790 !! input
16791 <span title="Hello world>Foo</span>
16792 !! result
16793 <p><span>Foo</span>
16794 </p>
16795 !! end
16796
16797 !! test
16798 Parsoid-only: HTML tag with broken attribute value quoting
16799 !! options
16800 parsoid
16801 !! input
16802 <span title="Hello world>Foo</span>
16803 !! result
16804 <p><span title="Hello world">Foo</span>
16805 </p>
16806 !! end
16807
16808 !! test
16809 Table with broken attribute value quoting
16810 !! input
16811 {|
16812 | title="Hello world|Foo
16813 |}
16814 !! result
16815 <table>
16816 <tr>
16817 <td>Foo
16818 </td></tr></table>
16819
16820 !! end
16821
16822 !! test
16823 Table with broken attribute value quoting on consecutive lines
16824 !! input
16825 {|
16826 | title="Hello world|Foo
16827 | style="color:red|Bar
16828 |}
16829 !! result
16830 <table>
16831 <tr>
16832 <td>Foo
16833 </td>
16834 <td>Bar
16835 </td></tr></table>
16836
16837 !! end
16838
16839 !! test
16840 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16841 !! options
16842 parsoid
16843 !! input
16844 {|
16845 | title="Hello world|Foo
16846 | style="color:red|Bar
16847 |}
16848 !! result
16849 <table><tbody>
16850 <tr>
16851 <td title="Hello world">Foo
16852 </td><td style="color: red">Bar
16853 </td></tr></tbody></table>
16854
16855 !! end
16856
16857 !! test
16858 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16859 !! options
16860 parsoid
16861 !! input
16862 {{}}
16863 !! result
16864 {{}}
16865 !! end
16866
16867 !! test
16868 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16869 !! options
16870 parsoid
16871 !! input
16872 }}{{
16873 !! result
16874 }}{{
16875 !! end
16876
16877 !!test
16878 Accept empty td cell attribute
16879 !!input
16880 {|
16881 | align="center" | foo || |
16882 |}
16883 !!result
16884 <table>
16885 <tr>
16886 <td align="center"> foo </td>
16887 <td>
16888 </td></tr></table>
16889
16890 !!end
16891
16892 !!test
16893 Non-empty attributes in th-cells
16894 !!input
16895 {|
16896 ! Foo !! style="color: red" | Bar
16897 |}
16898 !!result
16899 <table>
16900 <tr>
16901 <th> Foo </th>
16902 <th style="color: red"> Bar
16903 </th></tr></table>
16904
16905 !!end
16906
16907 !!test
16908 Accept empty attributes in th-cells
16909 !!input
16910 {|
16911 !| foo !!| bar
16912 |}
16913 !!result
16914 <table>
16915 <tr>
16916 <th> foo </th>
16917 <th> bar
16918 </th></tr></table>
16919
16920 !!end
16921
16922 !!test
16923 Empty table rows go away
16924 !!input
16925 {|
16926 | Hello
16927 | there
16928 |- class="foo"
16929 |-
16930 |}
16931 !! result
16932 <table>
16933 <tr>
16934 <td> Hello
16935 </td>
16936 <td> there
16937 </td></tr>
16938
16939 </table>
16940
16941 !! end
16942
16943 ###
16944 ### Parsoid-centric tests for testing RTing of inter-element separators
16945 ### Edge cases not tested by existing parser tests and specific to
16946 ### Parsoid-specific serialization strategies.
16947 ###
16948
16949 !!test
16950 RT-ed inter-element separators should be valid separators
16951 !!input
16952 {|
16953 |- [[foo]]
16954 |}
16955 !!result
16956 <table>
16957
16958 </table>
16959
16960 !!end
16961
16962 !!test
16963 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16964 (Parsoid-only since PHP parser relies on Tidy for correct output)
16965 !!options
16966 parsoid
16967 !!input
16968 {|
16969 |<small>foo
16970 bar
16971 |}
16972
16973 {|
16974 |<small>foo<small>
16975 |}
16976 !!result
16977 !!end
16978
16979 !!test
16980 Empty TD followed by TD with tpl-generated attribute
16981 !!input
16982 {|
16983 |-
16984 |
16985 |{{echo|style='color:red'}}|foo
16986 |}
16987 !!result
16988 <table>
16989
16990 <tr>
16991 <td>
16992 </td>
16993 <td>foo
16994 </td></tr></table>
16995
16996 !!end
16997
16998 !!test
16999 Indented table with an empty td
17000 !!input
17001 {|
17002 |-
17003 |
17004 |foo
17005 |}
17006 !!result
17007 <table>
17008
17009 <tr>
17010 <td>
17011 </td>
17012 <td>foo
17013 </td></tr></table>
17014
17015 !!end
17016
17017 !!test
17018 Empty TR followed by a template-generated TR
17019 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17020 !!options
17021 parsoid=wt2html,wt2wt
17022 !!input
17023 {|
17024 |-
17025 {{echo|<tr><td>foo</td></tr>}}
17026 |}
17027 !!result
17028 <table>
17029 <tbody>
17030 <tr></tr>
17031 <tr typeof="mw:Transclusion">
17032 <td>foo</td></tr></tbody></table>
17033 !!end
17034
17035 ## PHP and parsoid output differ for this, and since this is primarily
17036 ## for testing Parsoid's serializer, marking this Parsoid only
17037 !!test
17038 Empty TR followed by mixed-ws-comment line should RT correctly
17039 !!options
17040 parsoid
17041 !!input
17042 {|
17043 |-
17044 <!--c-->
17045 |-
17046 <!--c--> <!--d-->
17047 |}
17048 !!result
17049 <table>
17050 <tbody>
17051 <tr>
17052 <td> <!--c--></td></tr>
17053 <tr>
17054 <td><!--c--> <!--d--></td></tr>
17055 </tbody></table>
17056
17057 !!end
17058
17059 !!test
17060 Multi-line image caption generated by templates with/without trailing newlines
17061 !!options
17062 parsoid
17063 !!input
17064 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17065 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17066 !!result
17067 <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>
17068 <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>
17069
17070 !!end
17071
17072 ## PHP emits broken html for this, and since this is primarily
17073 ## a Parsoid serializer test, marking this Parsoid only
17074 !!test
17075 Improperly nested inline or quotes tags with whitespace in between
17076 !!options
17077 parsoid
17078 !!input
17079 <span> <s>x</span> </s>
17080 ''' ''x''' ''
17081 !!result
17082 <p><span> <s>x</s></span><s> </s>
17083 <b> <i>x</i></b><i> </i>
17084 </p>
17085 !!end
17086
17087 !!test
17088 Encapsulate protected attributes from wt
17089 !!options
17090 parsoid
17091 !!input
17092 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17093 !!result
17094 <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>
17095 </body>
17096 !!end
17097
17098 # -----------------------------------------------------------------
17099 # The following section of tests are primarily to spec requirements
17100 # around serialization of new/edited content.
17101 #
17102 # All these tests are marked Parsoid html2wt and html2html only
17103 # ----------------------------------------------------------------
17104
17105 !! test
17106 Image: Modifying size of an image
17107 !! options
17108 parsoid=html2wt
17109 !! input
17110 [[Image:Wiki.png|230x230px]]
17111 !! result
17112 <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>
17113 !!end
17114
17115 !! test
17116 Image: New block level image should have \n before and after
17117 !! options
17118 parsoid=html2wt
17119 !! input
17120 123
17121 [[File:Wiki.png|right|thumb|150x150px]]
17122 456
17123 !! result
17124 <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>
17125 !!end
17126
17127 # Wacky -- the leading newline in input is required because
17128 # that is what the serializer emits. To be fixed. Not fixing
17129 # the test because this test is required to test serialization of
17130 # new content and preferred whitespace style.
17131 !! test
17132 Lists: Add space after bullets
17133 !! options
17134 parsoid=html2wt
17135 !! input
17136
17137 * foo
17138 * bar
17139 * <span> baz</span>
17140 !! result
17141 <ul>
17142 <li>foo</li>
17143 <li> bar</li>
17144 <li><span> baz</span></li>
17145 </ul>
17146 !! end
17147
17148 !! test
17149 Parsoid: Serialize positional parameters with = in them as named parameter
17150 !! options
17151 parsoid=html2wt
17152 !! input
17153 {{echo|1 = f=oo}}
17154 !! result
17155 <p about="#mwt1" typeof="mw:Transclusion"
17156 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17157 >foo</p>
17158 !! end
17159
17160 # -----------------------------------------------------------------
17161 # End of section for Parsoid-only html2wt tests for serialization
17162 # of new content
17163 # -----------------------------------------------------------------
17164
17165 TODO:
17166 more images
17167 more tables
17168 character entities
17169 and much more
17170 Try for 100% code coverage