Merge "Avoid "Transaction already in progress" errors in SiteStatsUpdate::doUpdate"
[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 neither 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 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5547 !!input
5548 *a
5549 <!--This line will NOT split the list-->
5550 *b
5551 <!--This line will NOT split the list either-->
5552 *c
5553 <!--foo--> <!----> <!--This line NOT split the list
5554 either-->
5555 *d
5556 !!result
5557 <ul><li>a
5558 </li><li>b
5559 </li><li>c
5560 </li><li>d
5561 </li></ul>
5562
5563 !!end
5564
5565 !!test
5566 Test the li-hack
5567 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5568 !!options
5569 parsoid=wt2html,wt2wt
5570 !!input
5571 * foo
5572 * <li>li-hack
5573 * {{echo|<li>templated li-hack}}
5574 * <!--foo--> <li> unsupported li-hack with preceding comments
5575
5576 <ul>
5577 <li><li>not a li-hack
5578 </li>
5579 </ul>
5580 !!result
5581 <ul><li> foo</li>
5582 <li>li-hack</li>
5583 <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>
5584 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5585
5586 <ul>
5587 <li></li><li>not a li-hack
5588 </li>
5589 </ul>
5590 !!end
5591
5592 !! test
5593 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5594 !! options
5595 parsoid
5596 !! input
5597 # foo
5598 ## bar
5599 * foo
5600 ** bar
5601 : foo
5602 :: bar
5603 !! result
5604 <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>
5605 !! end
5606
5607 !! test
5608 Parsoid: Test of whitespace serialization with Templated bullets
5609 !! options
5610 parsoid
5611 !! input
5612 * {{bullet}}
5613 !! result
5614 <ul>
5615 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}'> Bar</li>
5616 </ul>
5617 !! end
5618
5619 # ------------------------------------------------------------------------
5620 # The next set of tests are about Parsoid's ability to handle badly nested
5621 # tags (parse, minimize scope of fixup, and roundtrip back)
5622 # ------------------------------------------------------------------------
5623
5624 !! test
5625 Unbalanced closing block tags break a list
5626 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5627 !! options
5628 parsoid
5629 !! input
5630 <div>
5631 *a</div><div>
5632 *b</div>
5633 !! result
5634 <div>
5635 <ul><li>a
5636 </li></ul></div><div>
5637 <ul><li>b
5638 </li></ul></div>
5639 !! end
5640
5641 !! test
5642 Unbalanced closing non-block tags don't break a list
5643 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5644 !! options
5645 parsoid
5646 !! input
5647 <span>
5648 *a</span><span>
5649 *b</span>
5650 !! result
5651 <p><span></span>
5652 </p>
5653 <ul><li>a<span></span>
5654 </li><li>b
5655 </li></ul>
5656 !! end
5657
5658 !! test
5659 Unclosed formatting tags that straddle lists are closed and reopened
5660 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5661 !! options
5662 parsoid
5663 !! input
5664 # <s> a
5665 # b </s>
5666 !! result
5667 <ol><li> <s> a </s>
5668 </li><li> <s> b </s>
5669 </li></ol>
5670 !! end
5671
5672 !!test
5673 List embedded in a non-block tag
5674 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5675 !! options
5676 parsoid
5677 !!input
5678 <small>
5679 * foo
5680 </small>
5681 !!result
5682 <p><small></small></p>
5683 <small>
5684 <ul>
5685 <li> foo</li>
5686 </ul>
5687 </small>
5688 <p><small></small></p>
5689 !!end
5690
5691 ###
5692 ### Magic Words
5693 ###
5694
5695 # Note that the current date is hard-coded as
5696 # 1970-01-01T00:02:03Z (a Thursday)
5697 # when running parser tests. The timezone is also fixed to GMT, so
5698 # local date will be identical to current date.
5699
5700 !! test
5701 Magic Word: {{CURRENTDAY}}
5702 !! input
5703 {{CURRENTDAY}}
5704 !! result
5705 <p>1
5706 </p>
5707 !! end
5708
5709 !! test
5710 Magic Word: {{CURRENTDAY2}}
5711 !! input
5712 {{CURRENTDAY2}}
5713 !! result
5714 <p>01
5715 </p>
5716 !! end
5717
5718 !! test
5719 Magic Word: {{CURRENTDAYNAME}}
5720 !! input
5721 {{CURRENTDAYNAME}}
5722 !! result
5723 <p>Thursday
5724 </p>
5725 !! end
5726
5727 !! test
5728 Magic Word: {{CURRENTDOW}}
5729 !! input
5730 {{CURRENTDOW}}
5731 !! result
5732 <p>4
5733 </p>
5734 !! end
5735
5736 !! test
5737 Magic Word: {{CURRENTMONTH}}
5738 !! input
5739 {{CURRENTMONTH}}
5740 !! result
5741 <p>01
5742 </p>
5743 !! end
5744
5745 !! test
5746 Magic Word: {{CURRENTMONTH1}}
5747 !! input
5748 {{CURRENTMONTH1}}
5749 !! result
5750 <p>1
5751 </p>
5752 !! end
5753
5754 !! test
5755 Magic Word: {{CURRENTMONTHABBREV}}
5756 !! input
5757 {{CURRENTMONTHABBREV}}
5758 !! result
5759 <p>Jan
5760 </p>
5761 !! end
5762
5763 !! test
5764 Magic Word: {{CURRENTMONTHNAME}}
5765 !! input
5766 {{CURRENTMONTHNAME}}
5767 !! result
5768 <p>January
5769 </p>
5770 !! end
5771
5772 !! test
5773 Magic Word: {{CURRENTMONTHNAMEGEN}}
5774 !! input
5775 {{CURRENTMONTHNAMEGEN}}
5776 !! result
5777 <p>January
5778 </p>
5779 !! end
5780
5781 !! test
5782 Magic Word: {{CURRENTTIME}}
5783 !! input
5784 {{CURRENTTIME}}
5785 !! result
5786 <p>00:02
5787 </p>
5788 !! end
5789
5790 !! test
5791 Magic Word: {{CURRENTHOUR}}
5792 !! input
5793 {{CURRENTHOUR}}
5794 !! result
5795 <p>00
5796 </p>
5797 !! end
5798
5799 !! test
5800 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5801 !! input
5802 {{CURRENTWEEK}}
5803 !! result
5804 <p>1
5805 </p>
5806 !! end
5807
5808 !! test
5809 Magic Word: {{CURRENTYEAR}}
5810 !! input
5811 {{CURRENTYEAR}}
5812 !! result
5813 <p>1970
5814 </p>
5815 !! end
5816
5817 !! test
5818 Magic Word: {{CURRENTTIMESTAMP}}
5819 !! input
5820 {{CURRENTTIMESTAMP}}
5821 !! result
5822 <p>19700101000203
5823 </p>
5824 !! end
5825
5826 !! test
5827 Magic Words LOCAL (UTC)
5828 !! input
5829 * {{LOCALMONTH}}
5830 * {{LOCALMONTH1}}
5831 * {{LOCALMONTHNAME}}
5832 * {{LOCALMONTHNAMEGEN}}
5833 * {{LOCALMONTHABBREV}}
5834 * {{LOCALDAY}}
5835 * {{LOCALDAY2}}
5836 * {{LOCALDAYNAME}}
5837 * {{LOCALYEAR}}
5838 * {{LOCALTIME}}
5839 * {{LOCALHOUR}}
5840 * {{LOCALWEEK}}
5841 * {{LOCALDOW}}
5842 * {{LOCALTIMESTAMP}}
5843 !! result
5844 <ul><li> 01
5845 </li><li> 1
5846 </li><li> January
5847 </li><li> January
5848 </li><li> Jan
5849 </li><li> 1
5850 </li><li> 01
5851 </li><li> Thursday
5852 </li><li> 1970
5853 </li><li> 00:02
5854 </li><li> 00
5855 </li><li> 1
5856 </li><li> 4
5857 </li><li> 19700101000203
5858 </li></ul>
5859
5860 !! end
5861
5862 !! test
5863 Magic Word: {{FULLPAGENAME}}
5864 !! options
5865 title=[[User:Ævar Arnfjörð Bjarmason]]
5866 !! input
5867 {{FULLPAGENAME}}
5868 !! result
5869 <p>User:Ævar Arnfjörð Bjarmason
5870 </p>
5871 !! end
5872
5873 !! test
5874 Magic Word: {{FULLPAGENAMEE}}
5875 !! options
5876 title=[[User:Ævar Arnfjörð Bjarmason]]
5877 !! input
5878 {{FULLPAGENAMEE}}
5879 !! result
5880 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5881 </p>
5882 !! end
5883
5884 !! test
5885 Magic Word: {{TALKSPACE}}
5886 !! options
5887 title=[[User:Ævar Arnfjörð Bjarmason]]
5888 !! input
5889 {{TALKSPACE}}
5890 !! result
5891 <p>User talk
5892 </p>
5893 !! end
5894
5895 !! test
5896 Magic Word: {{TALKSPACE}}, same namespace
5897 !! options
5898 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5899 !! input
5900 {{TALKSPACE}}
5901 !! result
5902 <p>User talk
5903 </p>
5904 !! end
5905
5906 !! test
5907 Magic Word: {{TALKSPACE}}, main namespace
5908 !! options
5909 title=[[Parser Test]]
5910 !! input
5911 {{TALKSPACE}}
5912 !! result
5913 <p>Talk
5914 </p>
5915 !! end
5916
5917 !! test
5918 Magic Word: {{TALKSPACEE}}
5919 !! options
5920 title=[[User:Ævar Arnfjörð Bjarmason]]
5921 !! input
5922 {{TALKSPACEE}}
5923 !! result
5924 <p>User_talk
5925 </p>
5926 !! end
5927
5928 !! test
5929 Magic Word: {{SUBJECTSPACE}}
5930 !! options
5931 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5932 !! input
5933 {{SUBJECTSPACE}}
5934 !! result
5935 <p>User
5936 </p>
5937 !! end
5938
5939 !! test
5940 Magic Word: {{SUBJECTSPACE}}, same namespace
5941 !! options
5942 title=[[User:Ævar Arnfjörð Bjarmason]]
5943 !! input
5944 {{SUBJECTSPACE}}
5945 !! result
5946 <p>User
5947 </p>
5948 !! end
5949
5950 !! test
5951 Magic Word: {{SUBJECTSPACE}}, main namespace
5952 !! options
5953 title=[[Parser Test]]
5954 !! input
5955 {{SUBJECTSPACE}}
5956 !! result
5957
5958 !! end
5959
5960 !! test
5961 Magic Word: {{SUBJECTSPACEE}}
5962 !! options
5963 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5964 !! input
5965 {{SUBJECTSPACEE}}
5966 !! result
5967 <p>User
5968 </p>
5969 !! end
5970
5971 !! test
5972 Magic Word: {{NAMESPACE}}
5973 !! options
5974 title=[[User:Ævar Arnfjörð Bjarmason]]
5975 !! input
5976 {{NAMESPACE}}
5977 !! result
5978 <p>User
5979 </p>
5980 !! end
5981
5982 !! test
5983 Magic Word: {{NAMESPACEE}}
5984 !! options
5985 title=[[User:Ævar Arnfjörð Bjarmason]]
5986 !! input
5987 {{NAMESPACEE}}
5988 !! result
5989 <p>User
5990 </p>
5991 !! end
5992
5993 !! test
5994 Magic Word: {{NAMESPACENUMBER}}
5995 !! options
5996 title=[[User:Ævar Arnfjörð Bjarmason]]
5997 !! input
5998 {{NAMESPACENUMBER}}
5999 !! result
6000 <p>2
6001 </p>
6002 !! end
6003
6004 !! test
6005 Magic Word: {{SUBPAGENAME}}
6006 !! options
6007 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6008 !! input
6009 {{SUBPAGENAME}}
6010 !! result
6011 <p>sub ö
6012 </p>
6013 !! end
6014
6015 !! test
6016 Magic Word: {{SUBPAGENAMEE}}
6017 !! options
6018 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6019 !! input
6020 {{SUBPAGENAMEE}}
6021 !! result
6022 <p>sub_%C3%B6
6023 </p>
6024 !! end
6025
6026 !! test
6027 Magic Word: {{ROOTPAGENAME}}
6028 !! options
6029 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6030 !! input
6031 {{ROOTPAGENAME}}
6032 !! result
6033 <p>Ævar Arnfjörð Bjarmason
6034 </p>
6035 !! end
6036
6037 !! test
6038 Magic Word: {{ROOTPAGENAMEE}}
6039 !! options
6040 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6041 !! input
6042 {{ROOTPAGENAMEE}}
6043 !! result
6044 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6045 </p>
6046 !! end
6047
6048 !! test
6049 Magic Word: {{BASEPAGENAME}}
6050 !! options
6051 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6052 !! input
6053 {{BASEPAGENAME}}
6054 !! result
6055 <p>Ævar Arnfjörð Bjarmason
6056 </p>
6057 !! end
6058
6059 !! test
6060 Magic Word: {{BASEPAGENAMEE}}
6061 !! options
6062 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6063 !! input
6064 {{BASEPAGENAMEE}}
6065 !! result
6066 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6067 </p>
6068 !! end
6069
6070 !! test
6071 Magic Word: {{TALKPAGENAME}}
6072 !! options
6073 title=[[User:Ævar Arnfjörð Bjarmason]]
6074 !! input
6075 {{TALKPAGENAME}}
6076 !! result
6077 <p>User talk:Ævar Arnfjörð Bjarmason
6078 </p>
6079 !! end
6080
6081 !! test
6082 Magic Word: {{TALKPAGENAMEE}}
6083 !! options
6084 title=[[User:Ævar Arnfjörð Bjarmason]]
6085 !! input
6086 {{TALKPAGENAMEE}}
6087 !! result
6088 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6089 </p>
6090 !! end
6091
6092 !! test
6093 Magic Word: {{SUBJECTPAGENAME}}
6094 !! options
6095 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6096 !! input
6097 {{SUBJECTPAGENAME}}
6098 !! result
6099 <p>User:Ævar Arnfjörð Bjarmason
6100 </p>
6101 !! end
6102
6103 !! test
6104 Magic Word: {{SUBJECTPAGENAMEE}}
6105 !! options
6106 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6107 !! input
6108 {{SUBJECTPAGENAMEE}}
6109 !! result
6110 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6111 </p>
6112 !! end
6113
6114 !! test
6115 Magic Word: {{NUMBEROFFILES}}
6116 !! input
6117 {{NUMBEROFFILES}}
6118 !! result
6119 <p>4
6120 </p>
6121 !! end
6122
6123 !! test
6124 Magic Word: {{PAGENAME}}
6125 !! options
6126 title=[[User:Ævar Arnfjörð Bjarmason]]
6127 !! input
6128 {{PAGENAME}}
6129 !! result
6130 <p>Ævar Arnfjörð Bjarmason
6131 </p>
6132 !! end
6133
6134 !! test
6135 Magic Word: {{PAGENAME}} with metacharacters
6136 !! options
6137 title=[['foo & bar = baz']]
6138 !! input
6139 ''{{PAGENAME}}''
6140 !! result
6141 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6142 </p>
6143 !! end
6144
6145 !! test
6146 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6147 !! options
6148 title=[[*RFC 1234 http://example.com/]]
6149 !! input
6150 {{PAGENAME}}
6151 !! result
6152 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6153 </p>
6154 !! end
6155
6156 !! test
6157 Magic Word: {{PAGENAMEE}}
6158 !! options
6159 title=[[User:Ævar Arnfjörð Bjarmason]]
6160 !! input
6161 {{PAGENAMEE}}
6162 !! result
6163 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6164 </p>
6165 !! end
6166
6167 !! test
6168 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6169 !! options
6170 title=[[*RFC 1234 http://example.com/]]
6171 !! input
6172 {{PAGENAMEE}}
6173 !! result
6174 <p>&#42;RFC_1234_http&#58;//example.com/
6175 </p>
6176 !! end
6177
6178 !! test
6179 Magic Word: {{REVISIONID}}
6180 !! input
6181 {{REVISIONID}}
6182 !! result
6183 <p>1337
6184 </p>
6185 !! end
6186
6187 !! test
6188 Magic Word: {{SCRIPTPATH}}
6189 !! input
6190 {{SCRIPTPATH}}
6191 !! result
6192 <p>/
6193 </p>
6194 !! end
6195
6196 !! test
6197 Magic Word: {{STYLEPATH}}
6198 !! input
6199 {{STYLEPATH}}
6200 !! result
6201 <p>/skins
6202 </p>
6203 !! end
6204
6205 !! test
6206 Magic Word: {{SERVER}}
6207 !! input
6208 {{SERVER}}
6209 !! result
6210 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6211 </p>
6212 !! end
6213
6214 !! test
6215 Magic Word: {{SERVERNAME}}
6216 !! input
6217 {{SERVERNAME}}
6218 !! result
6219 <p>example.org
6220 </p>
6221 !! end
6222
6223 !! test
6224 Magic Word: {{SITENAME}}
6225 !! input
6226 {{SITENAME}}
6227 !! result
6228 <p>MediaWiki
6229 </p>
6230 !! end
6231
6232 !! test
6233 Case-sensitive magic words, when cased differently, should just be template transclusions
6234 !! input
6235 {{CurrentMonth}}
6236 {{currentday}}
6237 {{cURreNTweEK}}
6238 {{currentHour}}
6239 !! result
6240 <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>
6241 <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>
6242 <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>
6243 <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>
6244 </p>
6245 !! end
6246
6247 !! test
6248 Case-insensitive magic words should still work with weird casing.
6249 !! input
6250 {{sErVeRNaMe}}
6251 {{LCFirst:AOEU}}
6252 {{ucFIRST:aoeu}}
6253 {{SERver}}
6254 !! result
6255 <p>example.org
6256 aOEU
6257 Aoeu
6258 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6259 </p>
6260 !! end
6261
6262 !! test
6263 Namespace 1 {{ns:1}}
6264 !! input
6265 {{ns:1}}
6266 !! result
6267 <p>Talk
6268 </p>
6269 !! end
6270
6271 !! test
6272 Namespace 1 {{ns:01}}
6273 !! input
6274 {{ns:01}}
6275 !! result
6276 <p>Talk
6277 </p>
6278 !! end
6279
6280 !! test
6281 Namespace 0 {{ns:0}} (bug 4783)
6282 !! input
6283 {{ns:0}}
6284 !! result
6285
6286 !! end
6287
6288 !! test
6289 Namespace 0 {{ns:00}} (bug 4783)
6290 !! input
6291 {{ns:00}}
6292 !! result
6293
6294 !! end
6295
6296 !! test
6297 Namespace -1 {{ns:-1}}
6298 !! input
6299 {{ns:-1}}
6300 !! result
6301 <p>Special
6302 </p>
6303 !! end
6304
6305 !! test
6306 Namespace User {{ns:User}}
6307 !! input
6308 {{ns:User}}
6309 !! result
6310 <p>User
6311 </p>
6312 !! end
6313
6314 !! test
6315 Namespace User talk {{ns:User_talk}}
6316 !! input
6317 {{ns:User_talk}}
6318 !! result
6319 <p>User talk
6320 </p>
6321 !! end
6322
6323 !! test
6324 Namespace User talk {{ns:uSeR tAlK}}
6325 !! input
6326 {{ns:uSeR tAlK}}
6327 !! result
6328 <p>User talk
6329 </p>
6330 !! end
6331
6332 !! test
6333 Namespace File {{ns:File}}
6334 !! input
6335 {{ns:File}}
6336 !! result
6337 <p>File
6338 </p>
6339 !! end
6340
6341 !! test
6342 Namespace File {{ns:Image}}
6343 !! input
6344 {{ns:Image}}
6345 !! result
6346 <p>File
6347 </p>
6348 !! end
6349
6350 !! test
6351 Namespace (lang=de) Benutzer {{ns:User}}
6352 !! options
6353 language=de
6354 !! input
6355 {{ns:User}}
6356 !! result
6357 <p>Benutzer
6358 </p>
6359 !! end
6360
6361 !! test
6362 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6363 !! options
6364 language=de
6365 !! input
6366 {{ns:3}}
6367 !! result
6368 <p>Benutzer Diskussion
6369 </p>
6370 !! end
6371
6372
6373 !! test
6374 Urlencode
6375 !! input
6376 {{urlencode:hi world?!}}
6377 {{urlencode:hi world?!|WIKI}}
6378 {{urlencode:hi world?!|PATH}}
6379 {{urlencode:hi world?!|QUERY}}
6380 !! result
6381 <p>hi+world%3F%21
6382 hi_world%3F!
6383 hi%20world%3F%21
6384 hi+world%3F%21
6385 </p>
6386 !! end
6387
6388 ###
6389 ### Magic links
6390 ###
6391 !! test
6392 Magic links: internal link to RFC (bug 479)
6393 !! input
6394 [[RFC 123]]
6395 !! result
6396 <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>
6397 </p>
6398 !! end
6399
6400 !! test
6401 Magic links: RFC (bug 479)
6402 !! input
6403 RFC 822
6404 !! result
6405 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Magic links: ISBN (bug 1937)
6411 !! input
6412 ISBN 0-306-40615-2
6413 !! result
6414 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6415 </p>
6416 !! end
6417
6418 !! test
6419 Magic links: PMID incorrectly converts space to underscore
6420 !! input
6421 PMID 1234
6422 !! result
6423 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6424 </p>
6425 !! end
6426
6427 ###
6428 ### Templates
6429 ####
6430
6431 !! test
6432 Nonexistent template
6433 !! input
6434 {{thistemplatedoesnotexist}}
6435 !! result
6436 <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>
6437 </p>
6438 !! end
6439
6440 !! test
6441 Template with invalid target containing tags
6442 !! input
6443 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6444 !! result
6445 <p>{{a<b>b</b>|foo|a=b|a = b}}
6446 </p>
6447 !! end
6448
6449 !! test
6450 Template with invalid target containing unclosed tag
6451 !! input
6452 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6453 !! result
6454 <p>{{a<b>|foo|a=b|a = b}}</b>
6455 </p>
6456 !! end
6457
6458 !! article
6459 Template:test
6460 !! text
6461 This is a test template
6462 !! endarticle
6463
6464 !! test
6465 Simple template
6466 !! input
6467 {{test}}
6468 !! result
6469 <p>This is a test template
6470 </p>
6471 !! end
6472
6473 !! test
6474 Template with explicit namespace
6475 !! input
6476 {{Template:test}}
6477 !! result
6478 <p>This is a test template
6479 </p>
6480 !! end
6481
6482
6483 !! article
6484 Template:paramtest
6485 !! text
6486 This is a test template with parameter {{{param}}}
6487 !! endarticle
6488
6489 !! test
6490 Template parameter
6491 !! input
6492 {{paramtest|param=foo}}
6493 !! result
6494 <p>This is a test template with parameter foo
6495 </p>
6496 !! end
6497
6498 !! article
6499 Template:paramtestnum
6500 !! text
6501 [[{{{1}}}|{{{2}}}]]
6502 !! endarticle
6503
6504 !! test
6505 Template unnamed parameter
6506 !! input
6507 {{paramtestnum|Main Page|the main page}}
6508 !! result
6509 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6510 </p>
6511 !! end
6512
6513 !! article
6514 Template:templatesimple
6515 !! text
6516 (test)
6517 !! endarticle
6518
6519 !! article
6520 Template:templateredirect
6521 !! text
6522 #redirect [[Template:templatesimple]]
6523 !! endarticle
6524
6525 !! article
6526 Template:templateasargtestnum
6527 !! text
6528 {{{{{1}}}}}
6529 !! endarticle
6530
6531 !! article
6532 Template:templateasargtest
6533 !! text
6534 {{template{{{templ}}}}}
6535 !! endarticle
6536
6537 !! article
6538 Template:templateasargtest2
6539 !! text
6540 {{{{{templ}}}}}
6541 !! endarticle
6542
6543 !! test
6544 Template with template name as unnamed argument
6545 !! input
6546 {{templateasargtestnum|templatesimple}}
6547 !! result
6548 <p>(test)
6549 </p>
6550 !! end
6551
6552 !! test
6553 Template with template name as argument
6554 !! input
6555 {{templateasargtest|templ=simple}}
6556 !! result
6557 <p>(test)
6558 </p>
6559 !! end
6560
6561 !! test
6562 Template with template name as argument (2)
6563 !! input
6564 {{templateasargtest2|templ=templatesimple}}
6565 !! result
6566 <p>(test)
6567 </p>
6568 !! end
6569
6570 !! article
6571 Template:templateasargtestdefault
6572 !! text
6573 {{{{{templ|templatesimple}}}}}
6574 !! endarticle
6575
6576 !! article
6577 Template:templa
6578 !! text
6579 '''templ'''
6580 !! endarticle
6581
6582 !! test
6583 Template with default value
6584 !! input
6585 {{templateasargtestdefault}}
6586 !! result
6587 <p>(test)
6588 </p>
6589 !! end
6590
6591 !! test
6592 Template with default value (value set)
6593 !! input
6594 {{templateasargtestdefault|templ=templa}}
6595 !! result
6596 <p><b>templ</b>
6597 </p>
6598 !! end
6599
6600 !! test
6601 Template redirect
6602 !! input
6603 {{templateredirect}}
6604 !! result
6605 <p>(test)
6606 </p>
6607 !! end
6608
6609 !! test
6610 Template with argument in separate line
6611 !! input
6612 {{ templateasargtest |
6613 templ = simple }}
6614 !! result
6615 <p>(test)
6616 </p>
6617 !! end
6618
6619 !! test
6620 Template with complex template as argument
6621 !! input
6622 {{paramtest|
6623 param ={{ templateasargtest |
6624 templ = simple }}}}
6625 !! result
6626 <p>This is a test template with parameter (test)
6627 </p>
6628 !! end
6629
6630 !! test
6631 Template with thumb image (with link in description)
6632 !! input
6633 {{paramtest|
6634 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6635 !! result
6636 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>
6637
6638 !! end
6639
6640 !! article
6641 Template:complextemplate
6642 !! text
6643 {{{1}}} {{paramtest|
6644 param ={{{param}}}}}
6645 !! endarticle
6646
6647 !! test
6648 Template with complex arguments
6649 !! input
6650 {{complextemplate|
6651 param ={{ templateasargtest |
6652 templ = simple }}|[[Template:complextemplate|link]]}}
6653 !! result
6654 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6655 </p>
6656 !! end
6657
6658 !! test
6659 BUG 553: link with two variables in a piped link
6660 !! input
6661 {|
6662 |[[{{{1}}}|{{{2}}}]]
6663 |}
6664 !! result
6665 <table>
6666 <tr>
6667 <td>[[{{{1}}}|{{{2}}}]]
6668 </td></tr></table>
6669
6670 !! end
6671
6672 !! test
6673 Magic variable as template parameter
6674 !! input
6675 {{paramtest|param={{SITENAME}}}}
6676 !! result
6677 <p>This is a test template with parameter MediaWiki
6678 </p>
6679 !! end
6680
6681 !! article
6682 Template:linktest
6683 !! text
6684 [[{{{param}}}|link]]
6685 !! endarticle
6686
6687 !! test
6688 Template parameter as link source
6689 !! input
6690 {{linktest|param=Main Page}}
6691 !! result
6692 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6693 </p>
6694 !! end
6695
6696 !!test
6697 Template-generated attribute string (k='v')
6698 !!input
6699 <span {{attr_str|id|v1}}>bar</span>
6700 !!result
6701 <p><span id="v1">bar</span>
6702 </p>
6703 !!end
6704
6705 !!article
6706 Template:paramtest2
6707 !! text
6708 including another template, {{paramtest|param={{{arg}}}}}
6709 !! endarticle
6710
6711 !! test
6712 Template passing argument to another template
6713 !! input
6714 {{paramtest2|arg='hmm'}}
6715 !! result
6716 <p>including another template, This is a test template with parameter 'hmm'
6717 </p>
6718 !! end
6719
6720 !! article
6721 Template:Linktest2
6722 !! text
6723 Main Page
6724 !! endarticle
6725
6726 !! test
6727 Template as link source
6728 !! input
6729 [[{{linktest2}}]]
6730
6731 [[{{linktest2}}|Main Page]]
6732
6733 [[{{linktest2}}]]Page
6734 !! result
6735 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6736 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6737 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6738 </p>
6739 !! end
6740
6741
6742 !! article
6743 Template:loop1
6744 !! text
6745 {{loop2}}
6746 !! endarticle
6747
6748 !! article
6749 Template:loop2
6750 !! text
6751 {{loop1}}
6752 !! endarticle
6753
6754 !! test
6755 Template infinite loop
6756 !! input
6757 {{loop1}}
6758 !! result
6759 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6760 </p>
6761 !! end
6762
6763 !! test
6764 Template from main namespace
6765 !! input
6766 {{:Main Page}}
6767 !! result
6768 <p>blah blah
6769 </p>
6770 !! end
6771
6772 !! article
6773 Template:table
6774 !! text
6775 {|
6776 | 1 || 2
6777 |-
6778 | 3 || 4
6779 |}
6780 !! endarticle
6781
6782 !! test
6783 BUG 529: Template with table, not included at beginning of line
6784 !! input
6785 foo {{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 523: Template shouldn't eat newline (or add an extra one before table)
6803 !! input
6804 foo
6805 {{table}}
6806 !! result
6807 <p>foo
6808 </p>
6809 <table>
6810 <tr>
6811 <td> 1 </td>
6812 <td> 2
6813 </td></tr>
6814 <tr>
6815 <td> 3 </td>
6816 <td> 4
6817 </td></tr></table>
6818
6819 !! end
6820
6821 !! test
6822 BUG 41: Template parameters shown as broken links
6823 !! input
6824 {{{parameter}}}
6825 !! result
6826 <p>{{{parameter}}}
6827 </p>
6828 !! end
6829
6830 !! test
6831 Template with targets containing wikilinks
6832 !! input
6833 {{[[foo]]}}
6834
6835 {{[[{{echo|foo}}]]}}
6836
6837 {{{{echo|[[foo}}]]}}
6838 !! result
6839 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6840 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6841 </p><p>{{[[foo}}]]
6842 </p>
6843 !! end
6844
6845 !! article
6846 Template:MSGNW test
6847 !! text
6848 ''None'' of '''this''' should be
6849 * interpreted
6850 but rather passed unmodified
6851 {{test}}
6852 !! endarticle
6853
6854 # hmm, fix this or just deprecate msgnw and document its behavior?
6855 !! test
6856 msgnw keyword
6857 !! options
6858 disabled
6859 !! input
6860 {{msgnw:MSGNW test}}
6861 !! result
6862 <p>''None'' of '''this''' should be
6863 * interpreted
6864 but rather passed unmodified
6865 {{test}}
6866 </p>
6867 !! end
6868
6869 !! test
6870 int keyword
6871 !! input
6872 {{int:youhavenewmessages|lots of money|not!}}
6873 !! result
6874 <p>You have lots of money (not!).
6875 </p>
6876 !! end
6877
6878 !! article
6879 Template:Includes
6880 !! text
6881 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6882 !! endarticle
6883
6884 !! test
6885 <includeonly> and <noinclude> being included
6886 !! input
6887 {{Includes}}
6888 !! result
6889 <p>Foobar
6890 </p>
6891 !! end
6892
6893 !! article
6894 Template:Includes2
6895 !! text
6896 <onlyinclude>Foo</onlyinclude>bar
6897 !! endarticle
6898
6899 !! test
6900 <onlyinclude> being included
6901 !! input
6902 {{Includes2}}
6903 !! result
6904 <p>Foo
6905 </p>
6906 !! end
6907
6908
6909 !! article
6910 Template:Includes3
6911 !! text
6912 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6913 !! endarticle
6914
6915 !! test
6916 <onlyinclude> and <includeonly> being included
6917 !! input
6918 {{Includes3}}
6919 !! result
6920 <p>Foo
6921 </p>
6922 !! end
6923
6924 !! test
6925 <includeonly> and <noinclude> on a page
6926 !! input
6927 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6928 !! result
6929 <p>Foozar
6930 </p>
6931 !! end
6932
6933 !! test
6934 Un-closed <noinclude>
6935 !! input
6936 <noinclude>
6937 !! result
6938 !! end
6939
6940 !! test
6941 <onlyinclude> on a page
6942 !! input
6943 <onlyinclude>Foo</onlyinclude>bar
6944 !! result
6945 <p>Foobar
6946 </p>
6947 !! end
6948
6949 !! test
6950 Un-closed <onlyinclude>
6951 !! input
6952 <onlyinclude>
6953 !! result
6954 !! end
6955
6956 !!test
6957 Self-closed noinclude, includeonly, onlyinclude tags
6958 !!input
6959 <noinclude />
6960 <includeonly />
6961 <onlyinclude />
6962 !!result
6963 <p><br />
6964 </p>
6965 !!end
6966
6967 !!test
6968 Unbalanced includeonly and noinclude tags
6969 !!input
6970 {|
6971 |a</noinclude>
6972 |b</noinclude></noinclude>
6973 |c</noinclude></includeonly>
6974 |d</includeonly></includeonly>
6975 |}
6976 !!result
6977 <table>
6978 <tr>
6979 <td>a
6980 </td>
6981 <td>b
6982 </td>
6983 <td>c&lt;/includeonly&gt;
6984 </td>
6985 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6986 </td></tr></table>
6987
6988 !!end
6989
6990 !! article
6991 Template:Includeonly section
6992 !! text
6993 <includeonly>
6994 ==Includeonly section==
6995 </includeonly>
6996 ==Section T-1==
6997 !!endarticle
6998
6999 !! test
7000 Bug 6563: Edit link generation for section shown by <includeonly>
7001 !! input
7002 {{includeonly section}}
7003 !! result
7004 <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>
7005 <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>
7006
7007 !! end
7008
7009 # Uses same input as the contents of [[Template:Includeonly section]]
7010 !! test
7011 Bug 6563: Section extraction for section shown by <includeonly>
7012 !! options
7013 section=T-2
7014 !! input
7015 <includeonly>
7016 ==Includeonly section==
7017 </includeonly>
7018 ==Section T-2==
7019 !! result
7020 ==Section T-2==
7021 !! end
7022
7023 !! test
7024 Bug 6563: Edit link generation for section suppressed by <includeonly>
7025 !! input
7026 <includeonly>
7027 ==Includeonly section==
7028 </includeonly>
7029 ==Section 1==
7030 !! result
7031 <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>
7032
7033 !! end
7034
7035 !! test
7036 Bug 6563: Section extraction for section suppressed by <includeonly>
7037 !! options
7038 section=1
7039 !! input
7040 <includeonly>
7041 ==Includeonly section==
7042 </includeonly>
7043 ==Section 1==
7044 !! result
7045 ==Section 1==
7046 !! end
7047
7048 !! test
7049 Un-closed <includeonly>
7050 !! input
7051 <includeonly>
7052 !! result
7053 !! end
7054
7055 # TODO: test with DOM fragment reuse!
7056 !! test
7057 Parsoid: DOM fragment reuse
7058 !! options
7059 parsoid=wt2wt,wt2html
7060 !! input
7061 a{{echo|b<table></table>c}}d
7062
7063 a{{echo|b
7064 <table></table>
7065 c}}d
7066
7067 {{echo|a
7068
7069 <table></table>
7070
7071 b}}
7072 !! result
7073 a<span typeof="mw:Transclusion">b</span>
7074 <table></table><span>c</span>d
7075 <p typeof="mw:Transclusion">ab</p>
7076 <table></table>
7077 <p>cd</p>
7078 <p typeof="mw:Transclusion">a</p>
7079 <table></table>
7080 <p>b</p>
7081 !! end
7082
7083 ###
7084 ### <includeonly> and <noinclude> in attributes
7085 ###
7086 !!test
7087 0. includeonly around the entire attribute
7088 !!input
7089 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7090 !!result
7091 <p><span id="v2">bar</span>
7092 </p>
7093 !!end
7094
7095 !!test
7096 1. includeonly in html attr key
7097 !!input
7098 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7099 !!result
7100 <p><span id="foo">bar</span>
7101 </p>
7102 !!end
7103
7104 !!test
7105 2. includeonly in html attr value
7106 !!input
7107 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7108 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7109 !!result
7110 <p><span id="v1">bar</span>
7111 <span id="v1">bar</span>
7112 </p>
7113 !!end
7114
7115 !!test
7116 3. includeonly in part of an attr value
7117 !!input
7118 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7119 !!result
7120 <p><span style="color:red;">bar</span>
7121 </p>
7122 !!end
7123
7124 ###
7125 ### Testing parsing of templates where a template arg
7126 ### has the same name as the template itself.
7127 ###
7128
7129 !! article
7130 Template:quote
7131 !! text
7132 {{{quote|{{{1}}}}}}
7133 !! endarticle
7134
7135 !!test
7136 Templates: Template Name/Arg clash: 1. Use of positional param
7137 !!input
7138 {{quote|foo}}
7139 !!result
7140 <p>foo
7141 </p>
7142 !!end
7143
7144 !!test
7145 Templates: Template Name/Arg clash: 2. Use of named param
7146 !!input
7147 {{quote|quote=foo}}
7148 !!result
7149 <p>foo
7150 </p>
7151 !!end
7152
7153 !!test
7154 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7155 !!input
7156 {{quote|quote}}
7157 !!result
7158 <p>quote
7159 </p>
7160 !!end
7161
7162 ###
7163 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7164 ###
7165
7166 !!test
7167 Templates: 1. Simple use
7168 !!input
7169 {{echo|Foo}}
7170 !!result
7171 <p>Foo
7172 </p>
7173 !!end
7174
7175 !!test
7176 Templates: 2. Inside a block tag
7177 !!input
7178 <div>{{echo|Foo}}</div>
7179 !!result
7180 <div>Foo</div>
7181
7182 !!end
7183
7184 !!test
7185 Templates: P-wrapping: 1a. Templates on consecutive lines
7186 !!input
7187 {{echo|Foo}}
7188 {{echo|bar}}
7189 !!result
7190 <p>Foo
7191 bar
7192 </p>
7193 !!end
7194
7195 !!test
7196 Templates: P-wrapping: 1b. Templates on consecutive lines
7197 !!input
7198 Foo
7199
7200 {{echo|bar}}
7201 {{echo|baz}}
7202 !!result
7203 <p>Foo
7204 </p><p>bar
7205 baz
7206 </p>
7207 !!end
7208
7209 !!test
7210 Templates: P-wrapping: 1c. Templates on consecutive lines
7211 !!input
7212 {{echo|Foo}}
7213 {{echo|bar}} <div>baz</div>
7214 !!result
7215 <p>Foo
7216 </p>
7217 bar <div>baz</div>
7218
7219 !!end
7220
7221 !!test
7222 Templates: P-wrapping: 1d. Template preceded by comment-only line
7223 !!options
7224 parsoid=wt2html,wt2wt
7225 !!input
7226 <!-- foo -->
7227 {{echo|Bar}}
7228 !!result
7229 <!-- foo -->
7230 <p typeof="mw:Transclusion">Bar
7231 </p>
7232 !!end
7233
7234 !!test
7235 Templates: Inline Text: 1. Multiple tmeplate uses
7236 !!input
7237 {{echo|Foo}}bar{{echo|baz}}
7238 !!result
7239 <p>Foobarbaz
7240 </p>
7241 !!end
7242
7243 !!test
7244 Templates: Inline Text: 2. Back-to-back template uses
7245 !!input
7246 {{echo|Foo}}{{echo|bar}}
7247 !!result
7248 <p>Foobar
7249 </p>
7250 !!end
7251
7252 !!test
7253 Templates: Block Tags: 1. Multiple template uses
7254 !!input
7255 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7256 !!result
7257 <div>Foo</div><div>bar</div><div>baz</div>
7258
7259 !!end
7260
7261 !!test
7262 Templates: Block Tags: 2. Back-to-back template uses
7263 !!input
7264 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7265 !!result
7266 <div>Foo</div><div>bar</div>
7267
7268 !!end
7269
7270 !!test
7271 Templates: Links: 1. Simple example
7272 !!input
7273 {{echo|[[Foo|bar]]}}
7274 !!result
7275 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7276 </p>
7277 !!end
7278
7279 !!test
7280 Templates: Links: 2. Generation of link href
7281 !!input
7282 [[{{echo|Foo}}|bar]]
7283 !!result
7284 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7285 </p>
7286 !!end
7287
7288 !!test
7289 Templates: Links: 3. Generation of part of a link href
7290 !!input
7291 [[Fo{{echo|o}}|bar]]
7292
7293 [[Foo{{echo|bar}}]]
7294
7295 [[Foo{{echo|bar}}baz]]
7296
7297 [[Foo{{echo|bar}}|bar]]
7298
7299 [[:Foo{{echo|bar}}]]
7300
7301 [[:Foo{{echo|bar}}|bar]]
7302 !!result
7303 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7304 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7305 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7306 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7307 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7308 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7309 </p>
7310 !!end
7311
7312 !!test
7313 Templates: Links: 4. Multiple templates generating link href
7314 !!input
7315 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7316 !!result
7317 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7318 </p>
7319 !!end
7320
7321 !!test
7322 Templates: Links: 5. Generation of link text
7323 !!input
7324 [[Foo|{{echo|bar}}]]
7325 !!result
7326 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7327 </p>
7328 !!end
7329
7330 !!test
7331 Templates: Links: 5. Nested templates (only outermost template should be marked)
7332 !!input
7333 {{echo|[[{{echo|Foo}}|bar]]}}
7334 !!result
7335 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7336 </p>
7337 !!end
7338
7339 !!test
7340 Templates: HTML Tag: 1. Generation of HTML attr. key
7341 !!input
7342 <div {{echo|style}}="color:red;">foo</div>
7343 !!result
7344 <div style="color:red;">foo</div>
7345
7346 !!end
7347
7348 !!test
7349 Templates: HTML Tag: 2. Generation of HTML attr. value
7350 !!input
7351 <div style={{echo|'color:red;'}}>foo</div>
7352 !!result
7353 <div style="color:red;">foo</div>
7354
7355 !!end
7356
7357 !!test
7358 Templates: HTML Tag: 3. Generation of HTML attr key and value
7359 !!input
7360 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7361 !!result
7362 <div style="color:red;">foo</div>
7363
7364 !!end
7365
7366 !!test
7367 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7368 !!input
7369 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7370 !!result
7371 <div title="This is a long title with just one piece templated">foo</div>
7372
7373 !!end
7374
7375 !!test
7376 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7377 !!input
7378 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7379 !!result
7380 <div title="This is a long title with just one piece templated">foo</div>
7381
7382 !!end
7383
7384 !!test
7385 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7386 !!input
7387 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7388 !!result
7389 <div title="This is a long title with just one piece templated">foo</div>
7390
7391 !!end
7392
7393 !!test
7394 Templates: HTML Tag: 7. Generation of partial attribute key string
7395 !!input
7396 <div st{{echo|yle}}="color:red;">foo</div>
7397 !!result
7398 <div style="color:red;">foo</div>
7399
7400 !!end
7401
7402 !!test
7403 Templates: HTML Tables: 1. Generating start of a HTML table
7404 !!input
7405 {{echo|<table><tr><td>foo</td>}}</tr></table>
7406 !!result
7407 <table><tr><td>foo</td></tr></table>
7408
7409 !!end
7410
7411 !!test
7412 Templates: HTML Tables: 2a. Generating middle of a HTML table
7413 !!input
7414 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7415 !!result
7416 <table><tr><td>foo</td></tr></table>
7417
7418 !!end
7419
7420 !!test
7421 Templates: HTML Tables: 2b. Generating middle of a HTML table
7422 !!input
7423 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7424 !!result
7425 <table><tr><td>foo</td></tr></table>
7426
7427 !!end
7428
7429 !!test
7430 Templates: HTML Tables: 3. Generating end of a HTML table
7431 !!input
7432 <table><tr>{{echo|<td>foo</td></tr></table>}}
7433 !!result
7434 <table><tr><td>foo</td></tr></table>
7435
7436 !!end
7437
7438 !!test
7439 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7440 !!input
7441 {{echo|<table>}}<tr><td>foo</td></tr></table>
7442 !!result
7443 <table><tr><td>foo</td></tr></table>
7444
7445 !!end
7446
7447 !!test
7448 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7449 !!input
7450 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7451 !!result
7452 <table><tr><td>foo</td></tr></table>
7453
7454 !!end
7455
7456 !!test
7457 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7458 !!input
7459 <table><tr>{{echo|<td>}}foo</td></tr></table>
7460 !!result
7461 <table><tr><td>foo</td></tr></table>
7462
7463 !!end
7464
7465 !!test
7466 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7467 !!input
7468 <table><tr><td>foo{{echo|</td>}}</tr></table>
7469 !!result
7470 <table><tr><td>foo</td></tr></table>
7471
7472 !!end
7473
7474 !!test
7475 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7476 !!input
7477 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7478 !!result
7479 <table><tr><td>foo</td></tr></table>
7480
7481 !!end
7482
7483 !!test
7484 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7485 !!input
7486 <table><tr><td>foo</td></tr>{{echo|</table>}}
7487 !!result
7488 <table><tr><td>foo</td></tr></table>
7489
7490 !!end
7491
7492 !!test
7493 Templates: HTML Tables: 5. Proper fostering of categories from inside
7494 !!options
7495 parsoid=wt2html,wt2wt
7496 !!input
7497 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7498 <!--Two categories (Bug 50330)-->
7499 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7500 !!result
7501 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7502 <!--Two categories (Bug 50330)-->
7503 <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>
7504 !!end
7505
7506 !!test
7507 Templates: Wiki Tables: 1a. Fostering of entire template content
7508 !!input
7509 {|
7510 {{echo|a}}
7511 |}
7512 !!result
7513 <table>
7514 a
7515 <tr><td></td></tr></table>
7516
7517 !!end
7518
7519 !!test
7520 Templates: Wiki Tables: 1b. Fostering of entire template content
7521 !!input
7522 {|
7523 {{echo|<div>}}
7524 foo
7525 {{echo|</div>}}
7526 |}
7527 !!result
7528 <table>
7529 <div>
7530 <p>foo
7531 </p>
7532 </div>
7533 <tr><td></td></tr></table>
7534
7535 !!end
7536
7537 !!test
7538 Templates: Wiki Tables: 2. Fostering of partial template content
7539 !!input
7540 {|
7541 {{echo|a
7542 <div>b</div>}}
7543 |}
7544 !!result
7545 <table>
7546 a
7547 <div>b</div>
7548 <tr><td></td></tr></table>
7549
7550 !!end
7551
7552 !!test
7553 Templates: Wiki Tables: 3. td-content via multiple templates
7554 !!input
7555 {|
7556 {{echo|{{pipe}}a}}{{echo|b}}
7557 |}
7558 !!result
7559 <table>
7560 <tr>
7561 <td>ab
7562 </td></tr></table>
7563
7564 !!end
7565
7566 !!test
7567 Templates: Wiki Tables: 4. Templated tags, no content
7568 !!input
7569 {{tbl-start}}
7570 {{tbl-end}}
7571 !!result
7572 <table>
7573 <tr><td></td></tr></table>
7574
7575 !!end
7576
7577 !!test
7578 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7579 !!input
7580 {{tbl-start}}
7581 |foo
7582 {{tbl-end}}
7583 !!result
7584 <table>
7585 <tr>
7586 <td>foo
7587 </td></tr></table>
7588
7589 !!end
7590
7591 !!test
7592 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7593 !!input
7594 {{tbl-start}}
7595 {{!}}foo
7596 {{tbl-end}}
7597 !!result
7598 <table>
7599 <tr>
7600 <td>foo
7601 </td></tr></table>
7602
7603 !!end
7604
7605 !!test
7606 Templates: Lists: Multi-line list-items via templates
7607 !!input
7608 *{{echo|a {{nonexistent|
7609 unused}}}}
7610 *{{echo|b {{nonexistent|
7611 unused}}}}
7612 !!result
7613 <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>
7614 </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>
7615 </li></ul>
7616
7617 !!end
7618
7619 !!test
7620 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7621 !!input
7622 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7623 !!result
7624 <p><i>ab</i>c<i>d</i>e
7625 </p>
7626 !!end
7627
7628 !!test
7629 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7630 (PHP parser generates misnested html)
7631 !! options
7632 parsoid=wt2html,wt2wt
7633 !!input
7634 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7635 !!result
7636 <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>
7637 !!end
7638
7639 !!test
7640 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7641 (PHP parser generates misnested html)
7642 !! options
7643 parsoid=wt2html,wt2wt
7644 !!input
7645 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7646 !!result
7647 <div typeof="mw:Transclusion"><i>a</i></div>
7648 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7649 <div typeof="mw:Transclusion">e</div>
7650 !!end
7651
7652 !!test
7653 Templates: Ugly nesting: 4. Divs opened/closed across templates
7654 !!input
7655 a<div>b{{echo|c</div>d}}e
7656 !!result
7657 a<div>bc</div>de
7658
7659 !!end
7660
7661 !!test
7662 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7663 (Parsoid-centric)
7664 !! options
7665 parsoid
7666 !!input
7667 {|
7668 |{{echo|foo</table>}}
7669 |bar
7670 |}
7671 !!result
7672 <table typeof="mw:Transclusion">
7673 <tbody>
7674 <tr>
7675 <td>foo</td></tr></tbody></table><span>bar</span>
7676 !!end
7677
7678 !!test
7679 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7680 (Parsoid-centric)
7681 !! options
7682 parsoid
7683 !!input
7684 <table>
7685 <tr>
7686 <td>
7687 <table>
7688 <tr>
7689 <td>1. {{echo|foo </table>}}</td>
7690 <td> bar </td>
7691 <td>2. {{echo|baz </table>}}</td>
7692 </tr>
7693 <tr>
7694 <td>abc</td>
7695 </tr>
7696 </table>
7697 </td>
7698 </tr>
7699 <tr>
7700 <td>xyz</td>
7701 </tr>
7702 </table>
7703 !!result
7704 <table about="#mwt1" typeof="mw:Transclusion">
7705 <tbody><tr >
7706 <td >
7707 <table >
7708 <tbody><tr >
7709 <td >1. foo </td></tr></tbody></table></td>
7710 <td > bar </td>
7711 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7712 </span><span about="#mwt1">
7713
7714 abc</span><span about="#mwt1">
7715 </span><span about="#mwt1">
7716 </span><span about="#mwt1">
7717 </span><span about="#mwt1">
7718 </span><span about="#mwt1">
7719
7720 xyz</span><span about="#mwt1">
7721 </span><span about="#mwt1">
7722 </span>
7723 !!end
7724
7725 !! test
7726 Templates: Ugly templates: 3. newline-only template parameter
7727 !! input
7728 foo {{echo|
7729 }}
7730 !! result
7731 <p>foo
7732 </p>
7733 !! end
7734
7735 # This looks like a bug: a single newline triggers p/br for some reason.
7736 !! test
7737 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7738 !! input
7739 {{echo|
7740 }}
7741 !! result
7742 <p><br />
7743 </p>
7744 !! end
7745
7746
7747 !!test
7748 Parser Functions: 1. Simple example
7749 !!input
7750 {{uc:foo}}
7751 !!result
7752 <p>FOO
7753 </p>
7754 !!end
7755
7756 !!test
7757 Parser Functions: 2. Nested use (only outermost should be marked up)
7758 !!input
7759 {{uc:{{lc:FOO}}}}
7760 !!result
7761 <p>FOO
7762 </p>
7763 !!end
7764
7765 ###
7766 ### Pre-save transform tests
7767 ###
7768 !! test
7769 pre-save transform: subst:
7770 !! options
7771 PST
7772 !! input
7773 {{subst:test}}
7774 !! result
7775 This is a test template
7776 !! end
7777
7778 !! test
7779 pre-save transform: normal template
7780 !! options
7781 PST
7782 !! input
7783 {{test}}
7784 !! result
7785 {{test}}
7786 !! end
7787
7788 !! test
7789 pre-save transform: nonexistent template
7790 !! options
7791 PST
7792 !! input
7793 {{thistemplatedoesnotexist}}
7794 !! result
7795 {{thistemplatedoesnotexist}}
7796 !! end
7797
7798
7799 !! test
7800 pre-save transform: subst magic variables
7801 !! options
7802 PST
7803 !! input
7804 {{subst:SITENAME}}
7805 !! result
7806 MediaWiki
7807 !! end
7808
7809 # This is bug 89, which I fixed. -- wtm
7810 !! test
7811 pre-save transform: subst: templates with parameters
7812 !! options
7813 pst
7814 !! input
7815 {{subst:paramtest|param="something else"}}
7816 !! result
7817 This is a test template with parameter "something else"
7818 !! end
7819
7820 !! article
7821 Template:nowikitest
7822 !! text
7823 <nowiki>'''not wiki'''</nowiki>
7824 !! endarticle
7825
7826 !! test
7827 pre-save transform: nowiki in subst (bug 1188)
7828 !! options
7829 pst
7830 !! input
7831 {{subst:nowikitest}}
7832 !! result
7833 <nowiki>'''not wiki'''</nowiki>
7834 !! end
7835
7836
7837 !! article
7838 Template:commenttest
7839 !! text
7840 This template has <!-- a comment --> in it.
7841 !! endarticle
7842
7843 !! test
7844 pre-save transform: comment in subst (bug 1936)
7845 !! options
7846 pst
7847 !! input
7848 {{subst:commenttest}}
7849 !! result
7850 This template has <!-- a comment --> in it.
7851 !! end
7852
7853 !! test
7854 pre-save transform: unclosed tag
7855 !! options
7856 pst noxml
7857 !! input
7858 <nowiki>'''not wiki'''
7859 !! result
7860 <nowiki>'''not wiki'''
7861 !! end
7862
7863 !! test
7864 pre-save transform: mixed tag case
7865 !! options
7866 pst noxml
7867 !! input
7868 <NOwiki>'''not wiki'''</noWIKI>
7869 !! result
7870 <NOwiki>'''not wiki'''</noWIKI>
7871 !! end
7872
7873 !! test
7874 pre-save transform: unclosed comment in <nowiki>
7875 !! options
7876 pst noxml
7877 !! input
7878 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7879 !! result
7880 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7881 !!end
7882
7883 # Leading @ in this template definition works around a limitation
7884 # in parsoid's parserTests which otherwise strips the <span> from the
7885 # result (confusing it for a template wrapper)
7886 !! article
7887 Template:dangerous
7888 !!text
7889 @<span onmouseover="alert('crap')">Oh no</span>
7890 !!endarticle
7891
7892 !!test
7893 (confirming safety of fix for subst bug 1936)
7894 !! input
7895 {{Template:dangerous}}
7896 !! result
7897 <p>@<span>Oh no</span>
7898 </p>
7899 !! end
7900
7901 !! test
7902 pre-save transform: comment containing gallery (bug 5024)
7903 !! options
7904 pst
7905 !! input
7906 <!-- <gallery>data</gallery> -->
7907 !!result
7908 <!-- <gallery>data</gallery> -->
7909 !!end
7910
7911 !! test
7912 pre-save transform: comment containing extension
7913 !! options
7914 pst
7915 !! input
7916 <!-- <tag>data</tag> -->
7917 !!result
7918 <!-- <tag>data</tag> -->
7919 !!end
7920
7921 !! test
7922 pre-save transform: comment containing nowiki
7923 !! options
7924 pst
7925 !! input
7926 <!-- <nowiki>data</nowiki> -->
7927 !!result
7928 <!-- <nowiki>data</nowiki> -->
7929 !!end
7930
7931 !! test
7932 pre-save transform: <noinclude> in subst (bug 3298)
7933 !! options
7934 pst
7935 !! input
7936 {{subst:Includes}}
7937 !! result
7938 Foobar
7939 !! end
7940
7941 !! test
7942 pre-save transform: <onlyinclude> in subst (bug 3298)
7943 !! options
7944 pst
7945 !! input
7946 {{subst:Includes2}}
7947 !! result
7948 Foo
7949 !! end
7950
7951 !! article
7952 Template:SubstTest
7953 !!text
7954 {{<includeonly>subst:</includeonly>Includes}}
7955 !! endarticle
7956
7957 !! article
7958 Template:SafeSubstTest
7959 !! text
7960 {{<includeonly>safesubst:</includeonly>Includes}}
7961 !! endarticle
7962
7963 !! test
7964 bug 22297: safesubst: works during PST
7965 !! options
7966 pst
7967 !! input
7968 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7969 !! result
7970 FoobarFoobar
7971 !! end
7972
7973 !! test
7974 bug 22297: safesubst: works during normal parse
7975 !! input
7976 {{SafeSubstTest}}
7977 !! result
7978 <p>Foobar
7979 </p>
7980 !! end
7981
7982 !! test:
7983 subst: does not work during normal parse
7984 !! input
7985 {{SubstTest}}
7986 !! result
7987 <p>{{subst:Includes}}
7988 </p>
7989 !! end
7990
7991 !! test
7992 pre-save transform: context links ("pipe trick")
7993 !! options
7994 pst
7995 !! input
7996 [[Article (context)|]]
7997 [[Bar:Article|]]
7998 [[:Bar:Article|]]
7999 [[Bar:Article (context)|]]
8000 [[:Bar:Article (context)|]]
8001 [[|Article]]
8002 [[|Article (context)]]
8003 [[Bar:X (Y) Z|]]
8004 [[:Bar:X (Y) Z|]]
8005 !! result
8006 [[Article (context)|Article]]
8007 [[Bar:Article|Article]]
8008 [[:Bar:Article|Article]]
8009 [[Bar:Article (context)|Article]]
8010 [[:Bar:Article (context)|Article]]
8011 [[Article]]
8012 [[Article (context)]]
8013 [[Bar:X (Y) Z|X (Y) Z]]
8014 [[:Bar:X (Y) Z|X (Y) Z]]
8015 !! end
8016
8017 !! test
8018 pre-save transform: context links ("pipe trick") with interwiki prefix
8019 !! options
8020 pst
8021 !! input
8022 [[interwiki:Article|]]
8023 [[:interwiki:Article|]]
8024 [[interwiki:Bar:Article|]]
8025 [[:interwiki:Bar:Article|]]
8026 !! result
8027 [[interwiki:Article|Article]]
8028 [[:interwiki:Article|Article]]
8029 [[interwiki:Bar:Article|Bar:Article]]
8030 [[:interwiki:Bar:Article|Bar:Article]]
8031 !! end
8032
8033 !! test
8034 pre-save transform: context links ("pipe trick") with parens in title
8035 !! options
8036 pst title=[[Somearticle (context)]]
8037 !! input
8038 [[|Article]]
8039 !! result
8040 [[Article (context)|Article]]
8041 !! end
8042
8043 !! test
8044 pre-save transform: context links ("pipe trick") with comma in title
8045 !! options
8046 pst title=[[Someplace, Somewhere]]
8047 !! input
8048 [[|Otherplace]]
8049 [[Otherplace, Elsewhere|]]
8050 [[Otherplace, Elsewhere, Anywhere|]]
8051 !! result
8052 [[Otherplace, Somewhere|Otherplace]]
8053 [[Otherplace, Elsewhere|Otherplace]]
8054 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8055 !! end
8056
8057 !! test
8058 pre-save transform: context links ("pipe trick") with parens and comma
8059 !! options
8060 pst title=[[Someplace (IGNORED), Somewhere]]
8061 !! input
8062 [[|Otherplace]]
8063 [[Otherplace (place), Elsewhere|]]
8064 !! result
8065 [[Otherplace, Somewhere|Otherplace]]
8066 [[Otherplace (place), Elsewhere|Otherplace]]
8067 !! end
8068
8069 !! test
8070 pre-save transform: context links ("pipe trick") with comma and parens
8071 !! options
8072 pst title=[[Who, me? (context)]]
8073 !! input
8074 [[|Yes, you.]]
8075 [[Me, Myself, and I (1937 song)|]]
8076 !! result
8077 [[Yes, you. (context)|Yes, you.]]
8078 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8079 !! end
8080
8081 !! test
8082 pre-save transform: context links ("pipe trick") with namespace
8083 !! options
8084 pst title=[[Ns:Somearticle]]
8085 !! input
8086 [[|Article]]
8087 !! result
8088 [[Ns:Article|Article]]
8089 !! end
8090
8091 !! test
8092 pre-save transform: context links ("pipe trick") with namespace and parens
8093 !! options
8094 pst title=[[Ns:Somearticle (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 and comma
8103 !! options
8104 pst title=[[Ns:Somearticle, Context, Whatever]]
8105 !! input
8106 [[|Article]]
8107 !! result
8108 [[Ns:Article, Context, Whatever|Article]]
8109 !! end
8110
8111 !! test
8112 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8113 !! options
8114 pst title=[[Ns:Somearticle, Context (context)]]
8115 !! input
8116 [[|Article]]
8117 !! result
8118 [[Ns:Article (context)|Article]]
8119 !! end
8120
8121 !! test
8122 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8123 !! options
8124 pst title=[[Ns:Somearticle (IGNORED), Context]]
8125 !! input
8126 [[|Article]]
8127 !! result
8128 [[Ns:Article, Context|Article]]
8129 !! end
8130
8131 !! test
8132 pre-save transform: context links ("pipe trick") with full-width parens and no 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 full-width parens and space (Japanese and Chinese 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 parens and no space (Korean style, bug 30149)
8173 !! options
8174 pst
8175 !! input
8176 [[Article(context)|]]
8177 [[Bar:Article(context)|]]
8178 [[:Bar:Article(context)|]]
8179 [[|Article(context)]]
8180 [[Bar:X(Y)Z|]]
8181 [[:Bar:X(Y)Z|]]
8182 !! result
8183 [[Article(context)|Article]]
8184 [[Bar:Article(context)|Article]]
8185 [[:Bar:Article(context)|Article]]
8186 [[Article(context)]]
8187 [[Bar:X(Y)Z|X(Y)Z]]
8188 [[:Bar:X(Y)Z|X(Y)Z]]
8189 !! end
8190
8191 !! test
8192 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8193 !! options
8194 pst
8195 !! input
8196 [[Article (context), context|]]
8197 [[Article (context),context|]]
8198 [[Bar:Article (context), context|]]
8199 [[Bar:Article (context),context|]]
8200 [[:Bar:Article (context), context|]]
8201 [[:Bar:Article (context),context|]]
8202 !! result
8203 [[Article (context), context|Article]]
8204 [[Article (context),context|Article]]
8205 [[Bar:Article (context), context|Article]]
8206 [[Bar:Article (context),context|Article]]
8207 [[:Bar:Article (context), context|Article]]
8208 [[:Bar:Article (context),context|Article]]
8209 !! end
8210
8211 !! test
8212 pre-save transform: trim trailing empty lines
8213 !! options
8214 pst
8215 !! input
8216 Empty lines are trimmed
8217
8218
8219
8220
8221 !! result
8222 Empty lines are trimmed
8223 !! end
8224
8225 !! test
8226 pre-save transform: Signature expansion
8227 !! options
8228 pst
8229 !! input
8230 * ~~~
8231 * <noinclude>~~~</noinclude>
8232 * <includeonly>~~~</includeonly>
8233 * <onlyinclude>~~~</onlyinclude>
8234 !! result
8235 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8236 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8237 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8238 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8239 !! end
8240
8241
8242 !! test
8243 pre-save transform: Signature expansion in nowiki tags (bug 93)
8244 !! options
8245 pst disabled
8246 !! input
8247 Shall not expand:
8248
8249 <nowiki>~~~~</nowiki>
8250
8251 <includeonly><nowiki>~~~~</nowiki></includeonly>
8252
8253 <noinclude><nowiki>~~~~</nowiki></noinclude>
8254
8255 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8256
8257 {{subst:Foo}} shall be converted to FOO
8258
8259 As well as inside noinclude/onlyinclude
8260 <noinclude>{{subst:Foo}}</noinclude>
8261 <onlyinclude>{{subst:Foo}}</onlyinclude>
8262
8263 But not inside includeonly
8264 <includeonly>{{subst:Foo}}</includeonly>
8265 !! result
8266 Shall not expand:
8267
8268 <nowiki>~~~~</nowiki>
8269
8270 <includeonly><nowiki>~~~~</nowiki></includeonly>
8271
8272 <noinclude><nowiki>~~~~</nowiki></noinclude>
8273
8274 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8275
8276 FOO shall be converted to FOO
8277
8278 As well as inside noinclude/onlyinclude
8279 <noinclude>FOO</noinclude>
8280 <onlyinclude>FOO</onlyinclude>
8281
8282 But not inside includeonly
8283 <includeonly>{{subst:Foo}}</includeonly>
8284 !! end
8285
8286 !! test
8287 Parsoid: Recognize nowiki with trailing space in tags
8288 !! options
8289 parsoid=wt2html
8290 !! input
8291 <nowiki ><div>[[foo]]</nowiki >
8292
8293 a<nowiki / >b
8294
8295 c<nowiki />d
8296
8297 e<nowiki/ >f
8298 !! result
8299 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8300 <p>ab</p>
8301 <p>cd</p>
8302 <p>ef</p>
8303 !! end
8304
8305 !! test
8306 Parsoid: Recognize nowiki with odd capitalization
8307 !! options
8308 parsoid=wt2html
8309 !! input
8310 <noWikI ><div>[[foo]]</Nowiki >
8311 !! result
8312 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8313 !! end
8314
8315
8316 !! test
8317 Parsoid: Escape nowiki with trailing space in tags
8318 !! options
8319 parsoid=html2wt
8320 !! input
8321 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8322
8323 a&lt;nowiki /&gt;b
8324
8325 c&lt;nowiki/ &gt;d
8326 !! result
8327 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8328 <p>a&lt;nowiki /&gt;b</p>
8329 <p>c&lt;nowiki/ &gt;d</p>
8330 !! end
8331
8332 !! test
8333 Parsoid: Escape weird noWikI capitalizations
8334 !! options
8335 parsoid=html2wt
8336 !! input
8337 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8338 !! result
8339 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8340 !! end
8341
8342 ###
8343 ### Message transform tests
8344 ###
8345 !! test
8346 message transform: magic variables
8347 !! options
8348 msg
8349 !! input
8350 {{SITENAME}}
8351 !! result
8352 MediaWiki
8353 !! end
8354
8355 !! test
8356 message transform: should not transform wiki markup
8357 !! options
8358 msg
8359 !! input
8360 ''test''
8361 !! result
8362 ''test''
8363 !! end
8364
8365 !! test
8366 message transform: <noinclude> in transcluded template (bug 4926)
8367 !! options
8368 msg
8369 !! input
8370 {{Includes}}
8371 !! result
8372 Foobar
8373 !! end
8374
8375 !! test
8376 message transform: <onlyinclude> in transcluded template (bug 4926)
8377 !! options
8378 msg
8379 !! input
8380 {{Includes2}}
8381 !! result
8382 Foo
8383 !! end
8384
8385 !! test
8386 {{#special:}} page name, known
8387 !! options
8388 msg
8389 !! input
8390 {{#special:Recentchanges}}
8391 !! result
8392 Special:RecentChanges
8393 !! end
8394
8395 !! test
8396 {{#special:}} page name with subpage, known
8397 !! options
8398 msg
8399 !! input
8400 {{#special:Recentchanges/param}}
8401 !! result
8402 Special:RecentChanges/param
8403 !! end
8404
8405 !! test
8406 {{#special:}} page name, unknown
8407 !! options
8408 msg
8409 !! input
8410 {{#special:foobar nonexistent}}
8411 !! result
8412 Special:Foobar nonexistent
8413 !! end
8414
8415 !! test
8416 {{#speciale:}} page name, known
8417 !! options
8418 msg
8419 !! input
8420 {{#speciale:Recentchanges}}
8421 !! result
8422 Special:RecentChanges
8423 !! end
8424
8425 !! test
8426 {{#speciale:}} page name with subpage, known
8427 !! options
8428 msg
8429 !! input
8430 {{#speciale:Recentchanges/param}}
8431 !! result
8432 Special:RecentChanges/param
8433 !! end
8434
8435 !! test
8436 {{#speciale:}} page name, unknown
8437 !! options
8438 msg
8439 !! input
8440 {{#speciale:foobar nonexistent}}
8441 !! result
8442 Special:Foobar_nonexistent
8443 !! end
8444
8445 ###
8446 ### Images
8447 ###
8448 ### For Parsoid-specific tests, see
8449 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8450
8451 !! test
8452 Simple image (php)
8453 !! options
8454 php
8455 !! input
8456 [[Image:foobar.jpg]]
8457 !! result
8458 <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>
8459 </p>
8460 !! end
8461
8462 !! test
8463 Simple image (parsoid)
8464 !! options
8465 parsoid=wt2html
8466 !! input
8467 [[Image:foobar.jpg]]
8468 !! result
8469 <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>
8470 </p>
8471 !! end
8472
8473 !! test
8474 Simple image (using File: namespace, now canonical) (php)
8475 !! options
8476 php
8477 !! input
8478 [[File:foobar.jpg]]
8479 !! result
8480 <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>
8481 </p>
8482 !! end
8483
8484 !! test
8485 Simple image (using File: namespace, now canonical) (parsoid)
8486 !! options
8487 parsoid
8488 !! input
8489 [[File:Foobar.jpg]]
8490 !! result
8491 <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>
8492 </p>
8493 !! end
8494
8495 !! test
8496 Right-aligned image (php)
8497 !! options
8498 php
8499 !! input
8500 [[Image:foobar.jpg|right]]
8501 !! result
8502 <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>
8503
8504 !! end
8505
8506 !! test
8507 Right-aligned image (parsoid)
8508 !! options
8509 parsoid
8510 !! input
8511 [[File:Foobar.jpg|right]]
8512 !! result
8513 <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>
8514 !! end
8515
8516 !! test
8517 Image with caption (php)
8518 !! options
8519 php
8520 !! input
8521 [[File:Foobar.jpg|right|Caption text]]
8522 !! result
8523 <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>
8524
8525 !! end
8526
8527 !! test
8528 Image with caption (parsoid)
8529 !! options
8530 parsoid
8531 !! input
8532 [[File:Foobar.jpg|right|Caption text]]
8533 !! result
8534 <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>
8535 !! end
8536
8537 !! test
8538 Image with empty attribute (php)
8539 !! options
8540 php
8541 !! input
8542 [[File:Foobar.jpg|right||Caption text]]
8543 !! result
8544 <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>
8545
8546 !! end
8547
8548 !! test
8549 Image with empty attribute (parsoid)
8550 !! options
8551 parsoid=wt2html
8552 !! input
8553 [[File:Foobar.jpg|right||Caption text]]
8554 !! result
8555 <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>
8556 !! end
8557
8558 !! test
8559 Image with attributes from template (php)
8560 !! options
8561 php
8562 !! input
8563 [[File:Foobar.jpg|{{image_attribs}}]]
8564 !! result
8565 <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>
8566
8567 !! end
8568
8569 !! test
8570 Image with attributes from template (parsoid)
8571 !! options
8572 parsoid
8573 !! input
8574 [[File:Foobar.jpg|{{image_attribs}}]]
8575 !! result
8576 <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>
8577 !! end
8578
8579 !! test
8580 Image with link tails (php)
8581 !! options
8582 php
8583 !! input
8584 123[[File:Foobar.jpg]]456
8585 123[[File:Foobar.jpg|right]]456
8586 123[[File:Foobar.jpg|thumb]]456
8587 !! result
8588 <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
8589 </p>
8590 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
8591 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
8592
8593 !! end
8594
8595 !! test
8596 Image with link tails (parsoid)
8597 !! options
8598 parsoid
8599 !! input
8600 123[[File:Foobar.jpg]]456
8601 123[[File:Foobar.jpg|right]]456
8602 123[[File:Foobar.jpg|thumb]]456
8603 !! result
8604 <p>123<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>
8605 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
8606 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
8607 !! end
8608
8609 !! test
8610 Image with multiple captions -- only last one is accepted (php)
8611 !! options
8612 php
8613 !! input
8614 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8615 !! result
8616 <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>
8617
8618 !! end
8619
8620 !! test
8621 Image with multiple captions -- only last one is accepted (parsoid)
8622 !! options
8623 parsoid
8624 !! input
8625 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8626 !! result
8627 <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>
8628 !! end
8629
8630 !! test
8631 Image with width attribute at different positions (php)
8632 !! options
8633 php
8634 !! input
8635 [[File:Foobar.jpg|200px|right|Caption]]
8636 [[File:Foobar.jpg|right|200px|Caption]]
8637 [[File:Foobar.jpg|right|Caption|200px]]
8638 !! result
8639 <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>
8640 <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>
8641 <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>
8642
8643 !! end
8644
8645 !! test
8646 Image with width attribute at different positions (parsoid)
8647 !! options
8648 parsoid
8649 !! input
8650 [[File:Foobar.jpg|200px|right|Caption]]
8651 [[File:Foobar.jpg|right|200px|Caption]]
8652 [[File:Foobar.jpg|right|Caption|200px]]
8653 !! result
8654 <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>
8655 <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>
8656 <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>
8657 !! end
8658
8659 !! test
8660 Image with link parameter, wiki target (php)
8661 !! options
8662 php
8663 !! input
8664 [[File:Foobar.jpg|link=Main Page]]
8665 !! result
8666 <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>
8667 </p>
8668 !! end
8669
8670 !! test
8671 Image with link parameter, wiki target (parsoid)
8672 !! options
8673 parsoid
8674 !! input
8675 [[File:Foobar.jpg|link=Main Page]]
8676 !! result
8677 <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>
8678 !! end
8679
8680 !! test
8681 Image with link parameter, URL target (php)
8682 !! options
8683 php
8684 !! input
8685 [[File:Foobar.jpg|link=http://example.com/]]
8686 !! result
8687 <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>
8688 </p>
8689 !! end
8690
8691 # parsoid bug 49293 (part 1)
8692 !! test
8693 Image with link parameter, URL target (parsoid)
8694 !! options
8695 parsoid
8696 !! input
8697 [[File:Foobar.jpg|link=http://example.com/]]
8698 !! result
8699 <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>
8700 !! end
8701
8702 !! test
8703 Image with link parameter, protocol-less URL target (php)
8704 !! options
8705 php
8706 !! input
8707 [[File:Foobar.jpg|link=//example.com/]]
8708 !! result
8709 <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>
8710 </p>
8711 !! end
8712
8713 # parsoid bug 49293 (part 2)
8714 !! test
8715 Image with link parameter, protocol-less URL target (parsoid)
8716 !! options
8717 parsoid
8718 !! input
8719 [[File:Foobar.jpg|link=//example.com/]]
8720 !! result
8721 <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>
8722 !! end
8723
8724 !! test
8725 Image with link parameter, wgExternalLinkTarget
8726 !! input
8727 [[Image:foobar.jpg|link=http://example.com/]]
8728 !! config
8729 wgExternalLinkTarget='foobar'
8730 !! result
8731 <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>
8732 </p>
8733 !! end
8734
8735 !! test
8736 Image with link parameter, wgNoFollowLinks set to false
8737 !! input
8738 [[Image:foobar.jpg|link=http://example.com/]]
8739 !! config
8740 wgNoFollowLinks=false
8741 !! result
8742 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8743 </p>
8744 !! end
8745
8746 !! test
8747 Image with link parameter, wgNoFollowDomainExceptions
8748 !! input
8749 [[Image:foobar.jpg|link=http://example.com/]]
8750 !! config
8751 wgNoFollowDomainExceptions='example.com'
8752 !! result
8753 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8754 </p>
8755 !! end
8756
8757 !! test
8758 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8759 !! input
8760 [[Image:foobar.jpg|link=http://example.com/|Title]]
8761 !! config
8762 wgExternalLinkTarget='foobar'
8763 !! result
8764 <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>
8765 </p>
8766 !! end
8767
8768 !! test
8769 Image with empty link parameter (php)
8770 !! options
8771 php
8772 !! input
8773 [[File:Foobar.jpg|link=]]
8774 !! result
8775 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8776 </p>
8777 !! end
8778
8779 !! test
8780 Image with empty link parameter (parsoid)
8781 !! options
8782 parsoid
8783 !! input
8784 [[File:Foobar.jpg|link=]]
8785 !! result
8786 <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>
8787 !! end
8788
8789 !! test
8790 Image with link parameter (wiki target) and unnamed parameter (php)
8791 !! options
8792 php
8793 !! input
8794 [[File:Foobar.jpg|link=Main Page|Title]]
8795 !! result
8796 <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>
8797 </p>
8798 !! end
8799
8800 !! test
8801 Image with link parameter (wiki target) and unnamed parameter (parsoid)
8802 !! options
8803 parsoid
8804 !! input
8805 [[File:Foobar.jpg|link=Main Page|Title]]
8806 !! result
8807 <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>
8808 !! end
8809
8810 !! test
8811 Image with link parameter (URL target) and unnamed parameter (php)
8812 !! options
8813 php
8814 !! input
8815 [[File:Foobar.jpg|link=http://example.com/|Title]]
8816 !! result
8817 <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>
8818 </p>
8819 !! end
8820
8821 !! test
8822 Image with link parameter (URL target) and unnamed parameter (parsoid)
8823 !! options
8824 parsoid
8825 !! input
8826 [[File:Foobar.jpg|link=http://example.com/|Title]]
8827 !! result
8828 <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>
8829 !! end
8830
8831 !! test
8832 Thumbnail image with link parameter
8833 !! options
8834 php
8835 !! input
8836 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8837 !! result
8838 <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>
8839
8840 !! end
8841
8842 !! test
8843 Manually-specified thumbnail image
8844 !! options
8845 php
8846 !! input
8847 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8848 !! result
8849 <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>
8850
8851 !! end
8852
8853 !! test
8854 Manually-specified thumbnail image with explicit link to wiki page
8855 !! options
8856 php
8857 !! input
8858 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8859 !! result
8860 <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>
8861
8862 !! end
8863
8864 !! test
8865 Manually-specified thumbnail image with explicit link to url
8866 !! options
8867 php
8868 !! input
8869 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8870 !! result
8871 <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>
8872
8873 !! end
8874
8875 !! test
8876 Manually-specified thumbnail image with explicit no link
8877 !! options
8878 php
8879 !! input
8880 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8881 !! result
8882 <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>
8883
8884 !! end
8885
8886 !! test
8887 Manually-specified thumbnail image with explicit link and alt text
8888 !! options
8889 php
8890 !! input
8891 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8892 !! result
8893 <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>
8894
8895 !! end
8896
8897 !! test
8898 Image with frame and link
8899 !! input
8900 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8901 !! result
8902 <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>
8903
8904 !! end
8905
8906 !! test
8907 Image with frame and link and explicit alt
8908 !! input
8909 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8910 !! result
8911 <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>
8912
8913 !! end
8914
8915 !! test
8916 Image with wiki markup in implicit alt
8917 !! input
8918 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8919 !! result
8920 <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>
8921 </p>
8922 !! end
8923
8924 !! test
8925 Image with wiki markup in explicit alt
8926 !! input
8927 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8928 !! result
8929 <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>
8930 </p>
8931 !! end
8932
8933 !! test
8934 Link to image page- image page normally doesn't exists, hence edit link
8935 Add test with existing image page
8936 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8937 !! input
8938 [[:Image:test]]
8939 !! result
8940 <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>
8941 </p>
8942 !! end
8943
8944 !! test
8945 bug 18784 Link to non-existent image page with caption should use caption as link text
8946 !! input
8947 [[:Image:test|caption]]
8948 !! result
8949 <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>
8950 </p>
8951 !! end
8952
8953 !! test
8954 Frameless image caption with a free URL
8955 !! input
8956 [[Image:foobar.jpg|http://example.com]]
8957 !! result
8958 <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>
8959 </p>
8960 !! end
8961
8962 !! test
8963 Thumbnail image caption with a free URL
8964 !! input
8965 [[Image:foobar.jpg|thumb|http://example.com]]
8966 !! result
8967 <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>
8968
8969 !! end
8970
8971 !! test
8972 Thumbnail image caption with a free URL and explicit alt
8973 !! input
8974 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8975 !! result
8976 <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>
8977
8978 !! end
8979
8980 !! test
8981 SVG thumbnails with no language set
8982 !! options
8983 !! input
8984 [[File:Foobar.svg|thumb|width=200]]
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>width=200</div></div></div>
8987
8988 !! end
8989
8990 !! test
8991 SVG thumbnails with language de
8992 !! options
8993 !! input
8994 [[File:Foobar.svg|thumb|width=200|lang=de]]
8995 !! result
8996 <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>
8997
8998 !! end
8999
9000 !! test
9001 SVG thumbnails with invalid language code
9002 !! options
9003 !! input
9004 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9005 !! result
9006 <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>
9007
9008 !! end
9009
9010 !! test
9011 BUG 1887: A ISBN with a thumbnail
9012 !! input
9013 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9014 !! result
9015 <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>
9016
9017 !! end
9018
9019 !! test
9020 BUG 1887: A RFC with a thumbnail
9021 !! input
9022 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9023 !! result
9024 <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>
9025
9026 !! end
9027
9028 !! test
9029 BUG 1887: A mailto link with a thumbnail
9030 !! input
9031 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9032 !! result
9033 <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>
9034
9035 !! end
9036
9037 # Pending resolution to bug 368
9038 !! test
9039 BUG 648: Frameless image caption with a link
9040 !! input
9041 [[Image:foobar.jpg|text with a [[link]] in it]]
9042 !! result
9043 <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>
9044 </p>
9045 !! end
9046
9047 !! test
9048 BUG 648: Frameless image caption with a link (suffix)
9049 !! input
9050 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9051 !! result
9052 <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>
9053 </p>
9054 !! end
9055
9056 !! test
9057 BUG 648: Frameless image caption with an interwiki link
9058 !! input
9059 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9060 !! result
9061 <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>
9062 </p>
9063 !! end
9064
9065 !! test
9066 BUG 648: Frameless image caption with a piped interwiki link
9067 !! input
9068 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9069 !! result
9070 <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>
9071 </p>
9072 !! end
9073
9074 !! test
9075 Escape HTML special chars in image alt text
9076 !! input
9077 [[Image:foobar.jpg|& < > "]]
9078 !! result
9079 <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>
9080 </p>
9081 !! end
9082
9083 !! test
9084 BUG 499: Alt text should have &#1234;, not &amp;1234;
9085 !! input
9086 [[Image:foobar.jpg|&#9792;]]
9087 !! result
9088 <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>
9089 </p>
9090 !! end
9091
9092 !! test
9093 Broken image caption with link
9094 !! input
9095 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9096 !! result
9097 <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.
9098 </p>
9099 !! end
9100
9101 !! test
9102 Image caption containing another image
9103 !! input
9104 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
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>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>
9107
9108 !! end
9109
9110 !! test
9111 Image caption containing a newline
9112 !! input
9113 [[Image:Foobar.jpg|This
9114 *is some text]]
9115 !! result
9116 <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>
9117 </p>
9118 !!end
9119
9120 !!test
9121 Parsoid: Image caption containing leading space
9122 (The leading space should not trigger nowiki escaping in wt2wt mode)
9123 !! input
9124 [[Image:Foobar.jpg|thumb| bar]]
9125 !! result
9126 <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>
9127
9128 !!end
9129
9130 !! test
9131 Bug 3090: External links other than http: in image captions
9132 !! input
9133 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9134 !! result
9135 <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>
9136
9137 !! end
9138
9139 !! test
9140 Custom class
9141 !! input
9142 [[Image:foobar.jpg|a|class=b]]
9143 !! result
9144 <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>
9145 </p>
9146 !! end
9147
9148 !! test
9149 Localized image handling (1).
9150 !! options
9151 language=es
9152 !! input
9153 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9154 !! result
9155 <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>
9156
9157 !! end
9158
9159 !! test
9160 Localized image handling (2).
9161 !! options
9162 language=es
9163 !! input
9164 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9165 !! result
9166 <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>
9167
9168 !! end
9169
9170 !! test
9171 "border", "frameless" and "class" attributes on an image.
9172 !! input
9173 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9174 !! result
9175 <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>
9176 </p>
9177 !! end
9178
9179 !! article
9180 File:Barfoo.jpg
9181 !! text
9182 #REDIRECT [[File:Barfoo.jpg]]
9183 !! endarticle
9184
9185 !! test
9186 Redirected image
9187 !! input
9188 [[Image:Barfoo.jpg]]
9189 !! result
9190 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9191 </p>
9192 !! end
9193
9194 !! test
9195 Missing image with uploads disabled
9196 !! options
9197 wgEnableUploads=0
9198 !! input
9199 [[Image:Foobaz.jpg]]
9200 !! result
9201 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9202 </p>
9203 !! end
9204
9205 # Parsoid-specific testing for images
9206 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9207 # Currently imperfect due to a flaw in the Parsoid testrunner
9208 # Work in progress
9209 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9210 # image tests.
9211
9212 !! test
9213 Parsoid-specific image handling - simple image with size and middle alignment
9214 !! options
9215 parsoid
9216 !! input
9217 [[Image:Foobar.jpg|50px|middle]]
9218 !! result
9219 <p>
9220 <span class="mw-valign-middle" typeof="mw:Image">
9221 <a href="File:Foobar.jpg">
9222 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9223 </a>
9224 </span>
9225 </p>
9226 !! end
9227
9228 !! test
9229 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9230 !! options
9231 parsoid
9232 !! input
9233 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9234 !! result
9235 <p>
9236 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9237 <a href="File:Foobar.jpg">
9238 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9239 </a>
9240 </span>
9241 </p>
9242 !! end
9243
9244 !! test
9245 Parsoid-specific image handling - simple image with border and size spec
9246 !! options
9247 parsoid
9248 !! input
9249 [[Image:Foobar.jpg|50px|border|caption]]
9250 !! result
9251 <p>
9252 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9253 <a href="File:Foobar.jpg">
9254 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9255 </a>
9256 </span>
9257 </p>
9258 !! end
9259
9260 !! test
9261 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9262 !! options
9263 parsoid
9264 !! input
9265 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9266 !! result
9267 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9268 <a href="File:Foobar.jpg">
9269 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9270 </a>
9271 <figcaption>caption content</figcaption>
9272 </figure>
9273 !! end
9274
9275 !! test
9276 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9277 !! options
9278 parsoid
9279 !! input
9280 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9281 !! result
9282 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9283 <a href="File:Foobar.jpg">
9284 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9285 </a>
9286 <figcaption>caption</figcaption>
9287 </figure>
9288 !! end
9289
9290 !! test
9291 Parsoid-specific image handling - framed image with specific size and caption
9292 !! options
9293 parsoid
9294 !! input
9295 [[Image:Foobar.jpg|500x50px|frame|caption]]
9296 !! result
9297 <figure typeof="mw:Image/Frame">
9298 <a href="File:Foobar.jpg">
9299 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9300 </a>
9301 <figcaption>caption</figcaption>
9302 </figure>
9303 !! end
9304
9305 !! test
9306 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9307 !! options
9308 parsoid
9309 !! input
9310 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9311 !! result
9312 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9313 <a href="File:Foobar.jpg">
9314 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9315 </a>
9316 <figcaption>caption</figcaption>
9317 </figure>
9318 !! end
9319
9320 !! test
9321 Parsoid-specific image handling - frameless image with specific size, border, and caption
9322 !! options
9323 parsoid
9324 !! input
9325 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9326 !! result
9327 <p>
9328 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9329 <a href="File:Foobar.jpg">
9330 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9331 </a>
9332 </p>
9333 !! end
9334
9335 #!! test
9336 #Parsoid-specific image handling - simple image with a formatted caption
9337 #!! options
9338 #parsoid
9339 #!! input
9340 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9341 #!! result
9342 #<p>
9343 #<span typeof="mw:Image">
9344 #<a class="mw-default-size" href="Image:Foobar.jpg">
9345 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9346 #</a>
9347 #<span>abc</span>
9348 #</span>
9349 #</p>
9350
9351
9352 ###
9353 ### Subpages
9354 ###
9355 !! article
9356 Subpage test/subpage
9357 !! text
9358 foo
9359 !! endarticle
9360
9361 !! test
9362 Subpage link
9363 !! options
9364 subpage title=[[Subpage test]]
9365 !! input
9366 [[/subpage]]
9367 !! result
9368 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9369 </p>
9370 !! end
9371
9372 !! test
9373 Subpage noslash link
9374 !! options
9375 subpage title=[[Subpage test]]
9376 !!input
9377 [[/subpage/]]
9378 !! result
9379 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9380 </p>
9381 !! end
9382
9383 # TODO: make this PHP-parser compatible!
9384 !! test
9385 Relative subpage noslash link
9386 !! options
9387 parsoid=wt2wt,wt2html,html2html
9388 subpage title=[[Subpage test/1/2/3/4]]
9389 !!input
9390 [[../../subpage/]]
9391
9392 [[../../subpage]]
9393 !! result
9394 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9395 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9396 !! end
9397
9398 # TODO: make this PHP-parser compatible!
9399 !! test
9400 Parsoid: dot-slash prefixed wikilinks
9401 !! options
9402 parsoid=wt2wt,wt2html,html2html
9403 !!input
9404 [[./foo]]
9405
9406 [[././bar]]
9407
9408 [[././baz/]]
9409 !! result
9410 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9411 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9412 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9413 !! end
9414
9415 !! test
9416 Disabled subpages
9417 !! input
9418 [[/subpage]]
9419 !! result
9420 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9421 </p>
9422 !! end
9423
9424 !! test
9425 BUG 561: {{/Subpage}}
9426 !! options
9427 subpage title=[[Page]]
9428 !! input
9429 {{/Subpage}}
9430 !! result
9431 <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>
9432 </p>
9433 !! end
9434
9435 ###
9436 ### Categories
9437 ###
9438 !! article
9439 Category:MediaWiki User's Guide
9440 !! text
9441 blah
9442 !! endarticle
9443
9444 !! test
9445 Link to category
9446 !! input
9447 [[:Category:MediaWiki User's Guide]]
9448 !! result
9449 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9450 </p>
9451 !! end
9452
9453 !! test
9454 Simple category
9455 !! options
9456 cat
9457 !! input
9458 [[Category:MediaWiki User's Guide]]
9459 !! result
9460 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9461 !! end
9462
9463 !! test
9464 PAGESINCATEGORY invalid title fatal (r33546 fix)
9465 !! input
9466 {{PAGESINCATEGORY:<bogus>}}
9467 !! result
9468 <p>0
9469 </p>
9470 !! end
9471
9472 !! test
9473 Category with different sort key
9474 !! options
9475 cat
9476 !! input
9477 [[Category:MediaWiki User's Guide|Foo]]
9478 !! result
9479 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9480 !! end
9481
9482 !! test
9483 Category with identical sort key
9484 !! options
9485 cat
9486 !! input
9487 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9488 !! result
9489 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9490 !! end
9491
9492 !! test
9493 Category with empty sort key
9494 !! options
9495 cat
9496 pst
9497 !! input
9498 [[Category:MediaWiki User's Guide|]]
9499 !! result
9500 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9501 !! end
9502
9503 !! test
9504 Category with empty sort key and parentheses
9505 !! options
9506 cat
9507 pst
9508 !! input
9509 [[Category:Foo (bar)|]]
9510 !! result
9511 [[Category:Foo (bar)|Foo]]
9512 !! end
9513
9514 !! test
9515 Category with link tail
9516 !! options
9517 cat
9518 pst
9519 !! input
9520 123[[Category:Foo]]456
9521 !! result
9522 123[[Category:Foo]]456
9523 !! end
9524
9525 !! test
9526 Category with template
9527 !! options
9528 cat
9529 pst
9530 !! input
9531 [[Category:{{echo|Foo}}]]
9532 !! result
9533 [[Category:{{echo|Foo}}]]
9534 !! end
9535
9536 !! test
9537 Category with template in sort key
9538 !! options
9539 cat
9540 pst
9541 !! input
9542 [[Category:Foo|{{echo|Bar}}]]
9543 !! result
9544 [[Category:Foo|{{echo|Bar}}]]
9545 !! end
9546
9547 !! test
9548 Category with template in sort key and title
9549 !! options
9550 cat
9551 pst
9552 !! input
9553 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9554 !! result
9555 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9556 !! end
9557
9558 !! test
9559 Category / paragraph interactions
9560 !! input
9561 Foo [[Category:Baz]] Bar
9562
9563 Foo [[Category:Baz]]
9564 Bar
9565
9566 Foo
9567 [[Category:Baz]]
9568 Bar
9569
9570 Foo
9571 [[Category:Baz]] Bar
9572
9573 Foo
9574 [[Category:Baz]]
9575 [[Category:Baz]]
9576 [[Category:Baz]]
9577 Bar
9578
9579 [[Category:Baz]]
9580 [[Category:Baz]]
9581 [[Category:Baz]]
9582
9583 [[Category:Baz]]
9584 {{echo|[[Category:Baz]]}}
9585 [[Category:Baz]]
9586 !! result
9587 <p>Foo Bar
9588 </p><p>Foo
9589 Bar
9590 </p><p>Foo
9591 Bar
9592 </p><p>Foo Bar
9593 </p><p>Foo
9594 Bar
9595 </p>
9596 !! end
9597
9598 !! test
9599 Parsoid: Serialize link to category page with colon escape
9600 !! options
9601 parsoid
9602 !! input
9603
9604 [[:Category:Foo]]
9605 [[:Category:Foo|Bar]]
9606 !! result
9607 <p>
9608 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9609 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9610 </p>
9611 !! end
9612
9613 !! test
9614 Parsoid: Link prefix/suffixes aren't applied to category links
9615 !! options
9616 parsoid=wt2html,wt2wt,html2html
9617 language=is
9618 !! input
9619 x[[Category:Foo]]y
9620 !! result
9621 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9622 !! end
9623
9624 !! test
9625 Parsoid: Serialize link to file page with colon escape
9626 !! options
9627 parsoid
9628 !! input
9629
9630 [[:File:Foo.png]]
9631 [[:File:Foo.png|Bar]]
9632 !! result
9633 <p>
9634 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9635 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9636 </p>
9637 !! end
9638
9639 !! test
9640 Parsoid: Serialize a genuine category link without colon escape
9641 !! options
9642 parsoid
9643 !! input
9644 [[Category:Foo]]
9645 [[Category:Foo|Bar]]
9646 !! result
9647 <link rel="mw:WikiLink/Category" href="Category:Foo">
9648 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9649 !! end
9650
9651 ###
9652 ### Inter-language links
9653 ###
9654 !! test
9655 Inter-language links
9656 !! options
9657 ill
9658 !! input
9659 [[es:Alimento]]
9660 [[fr:Nourriture]]
9661 [[zh:&#39135;&#21697;]]
9662 !! result
9663 es:Alimento fr:Nourriture zh:食品
9664 !! end
9665
9666 !! test
9667 Duplicate interlanguage links (bug 24502)
9668 !! options
9669 ill
9670 !! input
9671 [[es:1]]
9672 [[es:2]]
9673 [[fr:1]]
9674 [[fr:2]]
9675 !! result
9676 es:1 fr:1
9677 !! end
9678
9679 ###
9680 ### Sections
9681 ###
9682 !! test
9683 Basic section headings
9684 !! input
9685 == Headline 1 ==
9686 Some text
9687
9688 ==Headline 2==
9689 More
9690 ===Smaller headline===
9691 Blah blah
9692 !! result
9693 <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>
9694 <p>Some text
9695 </p>
9696 <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>
9697 <p>More
9698 </p>
9699 <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>
9700 <p>Blah blah
9701 </p>
9702 !! end
9703
9704 !! test
9705 Section headings with TOC
9706 !! input
9707 == Headline 1 ==
9708 === Subheadline 1 ===
9709 ===== Skipping a level =====
9710 ====== Skipping a level ======
9711
9712 == Headline 2 ==
9713 Some text
9714 ===Another headline===
9715 !! result
9716 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9717 <ul>
9718 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9719 <ul>
9720 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9721 <ul>
9722 <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>
9723 <ul>
9724 <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>
9725 </ul>
9726 </li>
9727 </ul>
9728 </li>
9729 </ul>
9730 </li>
9731 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9732 <ul>
9733 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9734 </ul>
9735 </li>
9736 </ul>
9737 </div>
9738 <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>
9739 <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>
9740 <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>
9741 <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>
9742 <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>
9743 <p>Some text
9744 </p>
9745 <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>
9746
9747 !! end
9748
9749 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9750 !! test
9751 Handling of sections up to level 6 and beyond
9752 !! input
9753 = Level 1 Heading=
9754 == Level 2 Heading==
9755 === Level 3 Heading===
9756 ==== Level 4 Heading====
9757 ===== Level 5 Heading=====
9758 ====== Level 6 Heading======
9759 ======= Level 7 Heading=======
9760 ======== Level 8 Heading========
9761 ========= Level 9 Heading=========
9762 ========== Level 10 Heading==========
9763 !! result
9764 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9765 <ul>
9766 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9767 <ul>
9768 <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>
9769 <ul>
9770 <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>
9771 <ul>
9772 <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>
9773 <ul>
9774 <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>
9775 <ul>
9776 <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>
9777 <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>
9778 <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>
9779 <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>
9780 <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>
9781 </ul>
9782 </li>
9783 </ul>
9784 </li>
9785 </ul>
9786 </li>
9787 </ul>
9788 </li>
9789 </ul>
9790 </li>
9791 </ul>
9792 </div>
9793 <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>
9794 <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>
9795 <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>
9796 <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>
9797 <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>
9798 <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>
9799 <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>
9800 <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>
9801 <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>
9802 <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>
9803
9804 !! end
9805
9806 !! test
9807 TOC regression (bug 9764)
9808 !! input
9809 == title 1 ==
9810 === title 1.1 ===
9811 ==== title 1.1.1 ====
9812 === title 1.2 ===
9813 == title 2 ==
9814 === title 2.1 ===
9815 !! result
9816 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9817 <ul>
9818 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9819 <ul>
9820 <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>
9821 <ul>
9822 <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>
9823 </ul>
9824 </li>
9825 <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>
9826 </ul>
9827 </li>
9828 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9829 <ul>
9830 <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>
9831 </ul>
9832 </li>
9833 </ul>
9834 </div>
9835 <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>
9836 <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>
9837 <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>
9838 <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>
9839 <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>
9840 <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>
9841
9842 !! end
9843
9844 !! test
9845 TOC with wgMaxTocLevel=3 (bug 6204)
9846 !! options
9847 wgMaxTocLevel=3
9848 !! input
9849 == title 1 ==
9850 === title 1.1 ===
9851 ==== title 1.1.1 ====
9852 === title 1.2 ===
9853 == title 2 ==
9854 === title 2.1 ===
9855 !! result
9856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9857 <ul>
9858 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9859 <ul>
9860 <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>
9861 <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>
9862 </ul>
9863 </li>
9864 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9865 <ul>
9866 <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>
9867 </ul>
9868 </li>
9869 </ul>
9870 </div>
9871 <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>
9872 <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>
9873 <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>
9874 <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>
9875 <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>
9876 <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>
9877
9878 !! end
9879
9880 !! test
9881 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9882 !! options
9883 wgMaxTocLevel=3
9884 !! input
9885 ==Section 1==
9886 ===Section 1.1===
9887 ====Section 1.1.1====
9888 ====Section 1.1.1.1====
9889 ==Section 2==
9890 !! result
9891 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9892 <ul>
9893 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9894 <ul>
9895 <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>
9896 </ul>
9897 </li>
9898 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9899 </ul>
9900 </div>
9901 <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>
9902 <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>
9903 <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>
9904 <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>
9905 <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>
9906
9907 !! end
9908
9909
9910 !! test
9911 Resolving duplicate section names
9912 !! input
9913 == Foo bar ==
9914 == Foo bar ==
9915 !! result
9916 <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>
9917 <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>
9918
9919 !! end
9920
9921 !! test
9922 Resolving duplicate section names with differing case (bug 10721)
9923 !! input
9924 == Foo bar ==
9925 == Foo Bar ==
9926 !! result
9927 <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>
9928 <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>
9929
9930 !! end
9931
9932 !! article
9933 Template:sections
9934 !! text
9935 ===Section 1===
9936 ==Section 2==
9937 !! endarticle
9938
9939 !! test
9940 Template with sections, __NOTOC__
9941 !! input
9942 __NOTOC__
9943 ==Section 0==
9944 {{sections}}
9945 ==Section 4==
9946 !! result
9947 <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>
9948 <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>
9949 <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>
9950 <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>
9951
9952 !! end
9953
9954 !! test
9955 __NOEDITSECTION__ keyword
9956 !! input
9957 __NOEDITSECTION__
9958 ==Section 1==
9959 ==Section 2==
9960 !! result
9961 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9962 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9963
9964 !! end
9965
9966 !! test
9967 Link inside a section heading
9968 !! input
9969 ==Section with a [[Main Page|link]] in it==
9970 !! result
9971 <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>
9972
9973 !! end
9974
9975 !! test
9976 TOC regression (bug 12077)
9977 !! input
9978 __TOC__
9979 == title 1 ==
9980 === title 1.1 ===
9981 == title 2 ==
9982 !! result
9983 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9984 <ul>
9985 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9986 <ul>
9987 <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>
9988 </ul>
9989 </li>
9990 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9991 </ul>
9992 </div>
9993 <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>
9994 <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>
9995 <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>
9996
9997 !! end
9998
9999 !! test
10000 BUG 1219 URL next to image (good)
10001 !! input
10002 http://example.com [[Image:foobar.jpg]]
10003 !! result
10004 <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>
10005 </p>
10006 !!end
10007
10008 !! test
10009 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10010 !! input
10011 ===
10012 The line above must have a trailing space!
10013 === <!--
10014 --> <!-- -->
10015 But just in case it doesn't...
10016 !! result
10017 <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>
10018 <p>The line above must have a trailing space!
10019 </p>
10020 <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>
10021 <p>But just in case it doesn't...
10022 </p>
10023 !! end
10024
10025 !! test
10026 Header with special characters (bug 25462)
10027 !! input
10028 The tooltips shall not show entities to the user (ie. be double escaped)
10029
10030 == text > text ==
10031 section 1
10032
10033 == text < text ==
10034 section 2
10035
10036 == text & text ==
10037 section 3
10038
10039 == text ' text ==
10040 section 4
10041
10042 == text " text ==
10043 section 5
10044 !! result
10045 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10046 </p>
10047 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10048 <ul>
10049 <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>
10050 <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>
10051 <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>
10052 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10053 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10054 </ul>
10055 </div>
10056 <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>
10057 <p>section 1
10058 </p>
10059 <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>
10060 <p>section 2
10061 </p>
10062 <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>
10063 <p>section 3
10064 </p>
10065 <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>
10066 <p>section 4
10067 </p>
10068 <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>
10069 <p>section 5
10070 </p>
10071 !! end
10072
10073 !! test
10074 Headers with excess '=' characters
10075 (Are similar tests necessary beyond the 1st level?)
10076 !! input
10077 =foo==
10078 ==foo=
10079 =''italic'' heading==
10080 ==''italic'' heading=
10081 !! result
10082 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10083 <ul>
10084 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10085 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10086 <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>
10087 <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>
10088 </ul>
10089 </div>
10090 <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>
10091 <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>
10092 <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>
10093 <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>
10094
10095 !! end
10096
10097 !! test
10098 HTML headers vs TOC (bug 23393)
10099 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10100 !! input
10101 <h1>Header 1</h1>
10102 == Header 1.1 ==
10103 == Header 1.2 ==
10104
10105 <h1>Header 2
10106 </h1>
10107 == Header 2.1 ==
10108 == Header 2.2 ==
10109 __NOEDITSECTION__
10110 !! result
10111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10112 <ul>
10113 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10114 <ul>
10115 <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>
10116 <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>
10117 </ul>
10118 </li>
10119 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10120 <ul>
10121 <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>
10122 <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>
10123 </ul>
10124 </li>
10125 </ul>
10126 </div>
10127 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10128 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10129 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10130 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10131 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10132 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10133
10134 !! end
10135
10136 !! test
10137 BUG 1219 URL next to image (broken)
10138 !! input
10139 http://example.com[[Image:foobar.jpg]]
10140 !! result
10141 <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>
10142 </p>
10143 !!end
10144
10145 !! test
10146 Bug 1186 news: in the middle of text
10147 !! input
10148 http://en.wikinews.org/wiki/Wikinews:Workplace
10149 !! result
10150 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10151 </p>
10152 !!end
10153
10154
10155 !! test
10156 Namespaced link must have a title
10157 !! input
10158 [[Project:]]
10159 !! result
10160 <p>[[Project:]]
10161 </p>
10162 !!end
10163
10164 !! test
10165 Namespaced link must have a title (bad fragment version)
10166 !! input
10167 [[Project:#fragment]]
10168 !! result
10169 <p>[[Project:#fragment]]
10170 </p>
10171 !!end
10172
10173
10174 ###
10175 ### HTML tags and HTML attributes
10176 ###
10177
10178 !! test
10179 div with no attributes
10180 !! input
10181 <div>HTML rocks</div>
10182 !! result
10183 <div>HTML rocks</div>
10184
10185 !! end
10186
10187 !! test
10188 div with double-quoted attribute
10189 !! input
10190 <div id="rock">HTML rocks</div>
10191 !! result
10192 <div id="rock">HTML rocks</div>
10193
10194 !! end
10195
10196 !! test
10197 div with single-quoted attribute
10198 !! input
10199 <div id='rock'>HTML rocks</div>
10200 !! result
10201 <div id="rock">HTML rocks</div>
10202
10203 !! end
10204
10205 !! test
10206 div with unquoted attribute
10207 !! input
10208 <div id=rock>HTML rocks</div>
10209 !! result
10210 <div id="rock">HTML rocks</div>
10211
10212 !! end
10213
10214 !! test
10215 div with illegal double attributes
10216 !! input
10217 <div id="a" id="b">HTML rocks</div>
10218 !! result
10219 <div id="b">HTML rocks</div>
10220
10221 !!end
10222
10223 # FIXME: produce empty string instead of "class" in the PHP parser, following
10224 # the HTML5 spec.
10225 !! test
10226 div with empty attribute value, space before equals
10227 !! options
10228 parsoid
10229 !! input
10230 <div class =>HTML rocks</div>
10231 !! result
10232 <div class="">HTML rocks</div>
10233
10234 !! end
10235
10236 # The PHP parser escapes the opening brace to &#123; for some reason, so
10237 # disabled this test for it.
10238 !! test
10239 div with braces in attribute value
10240 !! options
10241 parsoid
10242 !! input
10243 <div title="{}">Foo</div>
10244 !! result
10245 <div title="{}">Foo</div>
10246 !! end
10247
10248 # This it very inconsistent in the PHP parser: it returns
10249 # class="class" if there is a space between the name and the equal sign (see
10250 # 'div with empty attribute value, space before equals'), but strips the
10251 # attribute completely if the space is missing. We hope that not much content
10252 # depends on this, so are implementing the behavior below in Parsoid for
10253 # consistencies' sake. Disabled for the PHP parser.
10254 # FIXME: fix this behavior in the PHP parser?
10255 !! test
10256 div with empty attribute value, no space before equals
10257 !! options
10258 parsoid
10259 !! input
10260 <div class=>HTML rocks</div>
10261 !! result
10262 <div class="">HTML rocks</div>
10263
10264 !! end
10265
10266 !! test
10267 HTML multiple attributes correction
10268 !! input
10269 <p class="error" class="awesome">Awesome!</p>
10270 !! result
10271 <p class="awesome">Awesome!</p>
10272
10273 !!end
10274
10275 !! test
10276 Table multiple attributes correction
10277 !! input
10278 {|
10279 !+ class="error" class="awesome"| status
10280 |}
10281 !! result
10282 <table>
10283 <tr>
10284 <th class="awesome"> status
10285 </th></tr></table>
10286
10287 !!end
10288
10289 !! test
10290 DIV IN UPPERCASE
10291 !! input
10292 <DIV ID="x">HTML ROCKS</DIV>
10293 !! result
10294 <div id="x">HTML ROCKS</div>
10295
10296 !!end
10297
10298 !! test
10299 Non-ASCII pseudo-tags are rendered as text
10300 !! input
10301 <khyô>
10302 !! result
10303 <p>&lt;khyô&gt;
10304 </p>
10305 !! end
10306
10307 !! test
10308 Pseudo-tag with URL 'name' renders as url link
10309 !! input
10310 <http://example.com/>
10311 !! result
10312 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10313 </p>
10314 !! end
10315
10316 !! test
10317 text with amp in the middle of nowhere
10318 !! input
10319 Remember AT&T?
10320 !!result
10321 <p>Remember AT&amp;T?
10322 </p>
10323 !! end
10324
10325 !! test
10326 text with character entity: eacute
10327 !! input
10328 I always thought &eacute; was a cute letter.
10329 !! result
10330 <p>I always thought &#233; was a cute letter.
10331 </p>
10332 !! end
10333
10334 !! test
10335 text with entity-escaped character entity-like string: eacute
10336 !! input
10337 I always thought &amp;eacute; was a cute letter.
10338 !! result
10339 <p>I always thought &amp;eacute; was a cute letter.
10340 </p>
10341 !! end
10342
10343 !! test
10344 text with undefined character entity: xacute
10345 !! input
10346 I always thought &xacute; was a cute letter.
10347 !! result
10348 <p>I always thought &amp;xacute; was a cute letter.
10349 </p>
10350 !! end
10351
10352
10353 ###
10354 ### Nesting tests (see bug 41545, 50604, 51081)
10355 ###
10356
10357 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10358 # Note that html2wt is considerably more difficult if we use <b> in
10359 # the test case, instead of <big>
10360 !! test
10361 Ensure that HTML adoption agency algorithm is properly implemented.
10362 !! input
10363 <big>X<big>Y</big>Z</big>
10364 !! result
10365 <p><big>X<big>Y</big>Z</big>
10366 </p>
10367 !! end
10368
10369 # This was bug 41545 in the PHP parser.
10370 !! test
10371 Nesting of <kbd>
10372 !! input
10373 <kbd>X<kbd>Y</kbd>Z</kbd>
10374 !! result
10375 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10376 </p>
10377 !! end
10378
10379 # The following cases were bug 51081 in the PHP parser.
10380 # Note that there are some other nestable tags (b, i, etc) which are
10381 # not covered; see bug 51081 for discussion.
10382 !! test
10383 Nesting of <em>
10384 !! input
10385 <em>X<em>Y</em>Z</em>
10386 !! result
10387 <p><em>X<em>Y</em>Z</em>
10388 </p>
10389 !! end
10390
10391 !! test
10392 Nesting of <strong>
10393 !! input
10394 <strong>X<strong>Y</strong>Z</strong>
10395 !! result
10396 <p><strong>X<strong>Y</strong>Z</strong>
10397 </p>
10398 !! end
10399
10400 !! test
10401 Nesting of <q>
10402 !! input
10403 <q>X<q>Y</q>Z</q>
10404 !! result
10405 <p><q>X<q>Y</q>Z</q>
10406 </p>
10407 !! end
10408
10409 !! test
10410 Nesting of <ruby>
10411 !! input
10412 <ruby>X<ruby>Y</ruby>Z</ruby>
10413 !! result
10414 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10415 </p>
10416 !! end
10417
10418 !! test
10419 Nesting of <bdo>
10420 !! input
10421 <bdo>X<bdo>Y</bdo>Z</bdo>
10422 !! result
10423 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10424 </p>
10425 !! end
10426
10427
10428 ###
10429 ### Media links
10430 ###
10431
10432 !! test
10433 Media link
10434 !! input
10435 [[Media:Foobar.jpg]]
10436 !! result
10437 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10438 </p>
10439 !! end
10440
10441 !! test
10442 Media link with text
10443 !! input
10444 [[Media:Foobar.jpg|A neat file to look at]]
10445 !! result
10446 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10447 </p>
10448 !! end
10449
10450 # FIXME: this is still bad HTML tag nesting
10451 !! test
10452 Media link with nasty text
10453 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10454 !! input
10455 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10456 !! result
10457 <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>
10458
10459 !! end
10460
10461 !! test
10462 Media link to nonexistent file (bug 1702)
10463 !! input
10464 [[Media:No such.jpg]]
10465 !! result
10466 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10467 </p>
10468 !! end
10469
10470 !! test
10471 Image link to nonexistent file (bug 1850 - good)
10472 !! input
10473 [[Image:No such.jpg]]
10474 !! result
10475 <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>
10476 </p>
10477 !! end
10478
10479 !! test
10480 :Image link to nonexistent file (bug 1850 - bad)
10481 !! input
10482 [[:Image:No such.jpg]]
10483 !! result
10484 <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>
10485 </p>
10486 !! end
10487
10488
10489
10490 !! test
10491 Character reference normalization in link text (bug 1938)
10492 !! input
10493 [[Main Page|this&that]]
10494 !! result
10495 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10496 </p>
10497 !!end
10498
10499 !! article
10500 אַ
10501 !! text
10502 Test for unicode normalization
10503
10504 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10505 !! endarticle
10506
10507 !! test
10508 (bug 19451) Links should refer to the normalized form.
10509 !! input
10510 [[&#xFB2E;]]
10511 [[&#x5d0;&#x5b7;]]
10512 [[&#x5d0;ַ]]
10513 [[א&#x5b7;]]
10514 [[אַ]]
10515 !! result
10516 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10517 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10518 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10519 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10520 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10521 </p>
10522 !! end
10523
10524 !! test
10525 Empty attribute crash test (bug 2067)
10526 !! input
10527 <font color="">foo</font>
10528 !! result
10529 <p><font color="">foo</font>
10530 </p>
10531 !! end
10532
10533 !! test
10534 Empty attribute crash test single-quotes (bug 2067)
10535 !! input
10536 <font color=''>foo</font>
10537 !! result
10538 <p><font color="">foo</font>
10539 </p>
10540 !! end
10541
10542 !! test
10543 Attribute test: equals, then nothing
10544 !! input
10545 <font color=>foo</font>
10546 !! result
10547 <p><font>foo</font>
10548 </p>
10549 !! end
10550
10551 !! test
10552 Attribute test: unquoted value
10553 !! input
10554 <font color=x>foo</font>
10555 !! result
10556 <p><font color="x">foo</font>
10557 </p>
10558 !! end
10559
10560 !! test
10561 Attribute test: unquoted but illegal value (hash)
10562 !! input
10563 <font color=#x>foo</font>
10564 !! result
10565 <p><font color="#x">foo</font>
10566 </p>
10567 !! end
10568
10569 !! test
10570 Attribute test: no value
10571 !! input
10572 <font color>foo</font>
10573 !! result
10574 <p><font color="color">foo</font>
10575 </p>
10576 !! end
10577
10578 !! test
10579 Bug 2095: link with three closing brackets
10580 !! input
10581 [[Main Page]]]
10582 !! result
10583 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10584 </p>
10585 !! end
10586
10587 !! test
10588 Bug 2095: link with pipe and three closing brackets
10589 !! input
10590 [[Main Page|link]]]
10591 !! result
10592 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10593 </p>
10594 !! end
10595
10596 !! test
10597 Bug 2095: link with pipe and three closing brackets, version 2
10598 !! input
10599 [[Main Page|[http://example.com/]]]
10600 !! result
10601 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10602 </p>
10603 !! end
10604
10605
10606 ###
10607 ### Safety
10608 ###
10609
10610 !! article
10611 Template:Dangerous attribute
10612 !! text
10613 " onmouseover="alert(document.cookie)
10614 !! endarticle
10615
10616 !! article
10617 Template:Dangerous style attribute
10618 !! text
10619 border-size: expression(alert(document.cookie))
10620 !! endarticle
10621
10622 !! article
10623 Template:Div style
10624 !! text
10625 <div style="float: right; {{{1}}}">Magic div</div>
10626 !! endarticle
10627
10628 !! test
10629 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10630 !! input
10631 <div title="{{test}}"></div>
10632 !! result
10633 <div title="This is a test template"></div>
10634
10635 !! end
10636
10637 !! test
10638 Bug 2304: HTML attribute safety (dangerous template; 2309)
10639 !! input
10640 <div title="{{dangerous attribute}}"></div>
10641 !! result
10642 <div title=""></div>
10643
10644 !! end
10645
10646 !! test
10647 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10648 !! input
10649 <div style="{{dangerous style attribute}}"></div>
10650 !! result
10651 <div style="/* insecure input */"></div>
10652
10653 !! end
10654
10655 !! test
10656 Bug 2304: HTML attribute safety (safe parameter; 2309)
10657 !! input
10658 {{div style|width: 200px}}
10659 !! result
10660 <div style="float: right; width: 200px">Magic div</div>
10661
10662 !! end
10663
10664 !! test
10665 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10666 !! input
10667 {{div style|width: expression(alert(document.cookie))}}
10668 !! result
10669 <div style="/* insecure input */">Magic div</div>
10670
10671 !! end
10672
10673 !! test
10674 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10675 !! input
10676 {{div style|"><script>alert(document.cookie)</script>}}
10677 !! result
10678 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10679
10680 !! end
10681
10682 !! test
10683 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10684 !! input
10685 {{div style|" ><script>alert(document.cookie)</script>}}
10686 !! result
10687 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10688
10689 !! end
10690
10691 !! test
10692 Bug 2304: HTML attribute safety (link)
10693 !! input
10694 <div title="[[Main Page]]"></div>
10695 !! result
10696 <div title="&#91;&#91;Main Page]]"></div>
10697
10698 !! end
10699
10700 !! test
10701 Bug 2304: HTML attribute safety (italics)
10702 !! input
10703 <div title="''foobar''"></div>
10704 !! result
10705 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10706
10707 !! end
10708
10709 !! test
10710 Bug 2304: HTML attribute safety (bold)
10711 !! input
10712 <div title="'''foobar'''"></div>
10713 !! result
10714 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10715
10716 !! end
10717
10718
10719 !! test
10720 Bug 2304: HTML attribute safety (ISBN)
10721 !! input
10722 <div title="ISBN 1234567890"></div>
10723 !! result
10724 <div title="&#73;SBN 1234567890"></div>
10725
10726 !! end
10727
10728 !! test
10729 Bug 2304: HTML attribute safety (RFC)
10730 !! input
10731 <div title="RFC 1234"></div>
10732 !! result
10733 <div title="&#82;FC 1234"></div>
10734
10735 !! end
10736
10737 !! test
10738 Bug 2304: HTML attribute safety (PMID)
10739 !! input
10740 <div title="PMID 1234567890"></div>
10741 !! result
10742 <div title="&#80;MID 1234567890"></div>
10743
10744 !! end
10745
10746 !! test
10747 Bug 2304: HTML attribute safety (web link)
10748 !! input
10749 <div title="http://example.com/"></div>
10750 !! result
10751 <div title="http&#58;//example.com/"></div>
10752
10753 !! end
10754
10755 !! test
10756 Bug 2304: HTML attribute safety (named web link)
10757 !! input
10758 <div title="[http://example.com/ link]"></div>
10759 !! result
10760 <div title="&#91;http&#58;//example.com/ link]"></div>
10761
10762 !! end
10763
10764 !! test
10765 Bug 3244: HTML attribute safety (extension; safe)
10766 !! input
10767 <div style="<nowiki>background:blue</nowiki>"></div>
10768 !! result
10769 <div style="background:blue"></div>
10770
10771 !! end
10772
10773 !! test
10774 Bug 3244: HTML attribute safety (extension; unsafe)
10775 !! input
10776 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10777 !! result
10778 <div style="/* insecure input */"></div>
10779
10780 !! end
10781
10782 # More MSIE fun discovered by Tom Gilder
10783
10784 !! test
10785 MSIE CSS safety test: spurious slash
10786 !! input
10787 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10788 !! result
10789 <div style="/* insecure input */">evil</div>
10790
10791 !! end
10792
10793 !! test
10794 MSIE CSS safety test: hex code
10795 !! input
10796 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10797 !! result
10798 <div style="/* insecure input */">evil</div>
10799
10800 !! end
10801
10802 !! test
10803 MSIE CSS safety test: comment in url
10804 !! input
10805 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10806 !! result
10807 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10808
10809 !! end
10810
10811 !! test
10812 MSIE CSS safety test: comment in expression
10813 !! input
10814 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10815 !! result
10816 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10817
10818 !! end
10819
10820
10821 !! test
10822 Table attribute legitimate extension
10823 !! input
10824 {|
10825 !+ style="<nowiki>color:blue</nowiki>"| status
10826 |}
10827 !! result
10828 <table>
10829 <tr>
10830 <th style="color:blue"> status
10831 </th></tr></table>
10832
10833 !!end
10834
10835 !! test
10836 Table attribute safety
10837 !! input
10838 {|
10839 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10840 |}
10841 !! result
10842 <table>
10843 <tr>
10844 <th style="/* insecure input */"> status
10845 </th></tr></table>
10846
10847 !! end
10848
10849 !! test
10850 CSS line continuation 1
10851 !! input
10852 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10853 !! result
10854 <div style="/* insecure input */"></div>
10855
10856 !! end
10857
10858 !! test
10859 CSS line continuation 2
10860 !! input
10861 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10862 !! result
10863 <div style="/* insecure input */"></div>
10864
10865 !! end
10866
10867 !! article
10868 Template:Identity
10869 !! text
10870 {{{1}}}
10871 !! endarticle
10872
10873 !! test
10874 Expansion of multi-line templates in attribute values (bug 6255)
10875 !! input
10876 <div style="background: {{identity|#00FF00}}">-</div>
10877 !! result
10878 <div style="background: #00FF00">-</div>
10879
10880 !! end
10881
10882
10883 !! test
10884 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10885 !! input
10886 <div style="background:
10887 #00FF00">-</div>
10888 !! result
10889 <div style="background: #00FF00">-</div>
10890
10891 !! end
10892
10893 !! test
10894 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10895 !! input
10896 <div style="background: &#10;#00FF00">-</div>
10897 !! result
10898 <div style="background: &#10;#00FF00">-</div>
10899
10900 !! end
10901
10902 ###
10903 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10904 ###
10905 !! test
10906 Parser hook: empty input
10907 !! input
10908 <tag></tag>
10909 !! result
10910 <pre>
10911 ''
10912 array (
10913 )
10914 </pre>
10915
10916 !! end
10917
10918 !! test
10919 Parser hook: empty input using terminated empty elements
10920 !! input
10921 <tag/>
10922 !! result
10923 <pre>
10924 NULL
10925 array (
10926 )
10927 </pre>
10928
10929 !! end
10930
10931 !! test
10932 Parser hook: empty input using terminated empty elements (space before)
10933 !! input
10934 <tag />
10935 !! result
10936 <pre>
10937 NULL
10938 array (
10939 )
10940 </pre>
10941
10942 !! end
10943
10944 !! test
10945 Parser hook: basic input
10946 !! input
10947 <tag>input</tag>
10948 !! result
10949 <pre>
10950 'input'
10951 array (
10952 )
10953 </pre>
10954
10955 !! end
10956
10957
10958 !! test
10959 Parser hook: case insensitive
10960 !! input
10961 <TAG>input</TAG>
10962 !! result
10963 <pre>
10964 'input'
10965 array (
10966 )
10967 </pre>
10968
10969 !! end
10970
10971
10972 !! test
10973 Parser hook: case insensitive, redux
10974 !! input
10975 <TaG>input</TAg>
10976 !! result
10977 <pre>
10978 'input'
10979 array (
10980 )
10981 </pre>
10982
10983 !! end
10984
10985 !! test
10986 Parser hook: nested tags
10987 !! options
10988 noxml
10989 !! input
10990 <tag><tag></tag></tag>
10991 !! result
10992 <pre>
10993 '<tag>'
10994 array (
10995 )
10996 </pre>&lt;/tag&gt;
10997
10998 !! end
10999
11000 !! test
11001 Parser hook: basic arguments
11002 !! input
11003 <tag width=200 height = "100" depth = '50' square></tag>
11004 !! result
11005 <pre>
11006 ''
11007 array (
11008 'width' => '200',
11009 'height' => '100',
11010 'depth' => '50',
11011 'square' => 'square',
11012 )
11013 </pre>
11014
11015 !! end
11016
11017 !! test
11018 Parser hook: argument containing a forward slash (bug 5344)
11019 !! input
11020 <tag filename='/tmp/bla'></tag>
11021 !! result
11022 <pre>
11023 ''
11024 array (
11025 'filename' => '/tmp/bla',
11026 )
11027 </pre>
11028
11029 !! end
11030
11031 !! test
11032 Parser hook: empty input using terminated empty elements (bug 2374)
11033 !! input
11034 <tag foo=bar/>text
11035 !! result
11036 <pre>
11037 NULL
11038 array (
11039 'foo' => 'bar',
11040 )
11041 </pre>text
11042
11043 !! end
11044
11045 # </tag> should be output literally since there is no matching tag that begins it
11046 !! test
11047 Parser hook: basic arguments using terminated empty elements (bug 2374)
11048 !! input
11049 <tag width=200 height = "100" depth = '50' square/>
11050 other stuff
11051 </tag>
11052 !! result
11053 <pre>
11054 NULL
11055 array (
11056 'width' => '200',
11057 'height' => '100',
11058 'depth' => '50',
11059 'square' => 'square',
11060 )
11061 </pre>
11062 <p>other stuff
11063 &lt;/tag&gt;
11064 </p>
11065 !! end
11066
11067 ###
11068 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11069 ###
11070
11071 !! test
11072 Parser hook: static parser hook not inside a comment
11073 !! input
11074 <statictag>hello, world</statictag>
11075 <statictag action=flush/>
11076 !! result
11077 <p>hello, world
11078 </p>
11079 !! end
11080
11081
11082 !! test
11083 Parser hook: static parser hook inside a comment
11084 !! input
11085 <!-- <statictag>hello, world</statictag> -->
11086 <statictag action=flush/>
11087 !! result
11088 <p><br />
11089 </p>
11090 !! end
11091
11092 # Nested template calls; this case was broken by Parser.php rev 1.506,
11093 # since reverted.
11094
11095 !! article
11096 Template:One-parameter
11097 !! text
11098 (My parameter is: {{{1}}})
11099 !! endarticle
11100
11101 !! article
11102 Template:Map-one-parameter
11103 !! text
11104 {{{{{1}}}|{{{2}}}}}
11105 !! endarticle
11106
11107 !! test
11108 Nested template calls
11109 !! input
11110 {{Map-one-parameter|One-parameter|param}}
11111 !! result
11112 <p>(My parameter is: param)
11113 </p>
11114 !! end
11115
11116
11117 ###
11118 ### Sanitizer
11119 ###
11120 !! test
11121 Sanitizer: Closing of open tags
11122 !! input
11123 <s></s><table></table>
11124 !! result
11125 <s></s><table></table>
11126
11127 !! end
11128
11129 !! test
11130 Sanitizer: Closing of open but not closed tags
11131 !! input
11132 <s>foo
11133 !! result
11134 <p><s>foo</s>
11135 </p>
11136 !! end
11137
11138 !! test
11139 Sanitizer: Closing of closed but not open tags
11140 !! input
11141 </s>
11142 !! result
11143 <p>&lt;/s&gt;
11144 </p>
11145 !! end
11146
11147 !! test
11148 Sanitizer: Closing of closed but not open table tags
11149 !! input
11150 Table not started</td></tr></table>
11151 !! result
11152 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11153 </p>
11154 !! end
11155
11156 !! test
11157 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11158 !! input
11159 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11160 !! result
11161 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11162 </p>
11163 !! end
11164
11165 !! test
11166 Sanitizer: Validating the contents of the id attribute (bug 4515)
11167 !! options
11168 disabled
11169 !! input
11170 <br id=9 />
11171 !! result
11172 Something, but definitely not <br id="9" />...
11173 !! end
11174
11175 !! test
11176 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11177 !! options
11178 disabled
11179 !! input
11180 <br id="foo" /><br id="foo" />
11181 !! result
11182 Something need to be done. foo-2 ?
11183 !! end
11184
11185 !! test
11186 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11187 !! input
11188 <div itemscope>
11189 <meta itemprop="hello" content="world">
11190 <meta http-equiv="refresh" content="5">
11191 <meta itemprop="hello" http-equiv="refresh" content="5">
11192 <link itemprop="hello" href="{{SERVER}}">
11193 <link rel="stylesheet" href="{{SERVER}}">
11194 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11195 </div>
11196 !! result
11197 <div itemscope="itemscope">
11198 <p> <meta itemprop="hello" content="world" />
11199 &lt;meta http-equiv="refresh" content="5"&gt;
11200 <meta itemprop="hello" content="5" />
11201 </p>
11202 <link itemprop="hello" href="http&#58;//example.org" />
11203 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11204 <link itemprop="hello" href="http&#58;//example.org" />
11205 </div>
11206
11207 !! end
11208
11209 !! test
11210 Language converter: output gets cut off unexpectedly (bug 5757)
11211 !! options
11212 language=zh
11213 !! input
11214 this bit is safe: }-
11215
11216 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11217
11218 then we get cut off here: }-
11219
11220 all additional text is vanished
11221 !! result
11222 <p>this bit is safe: }-
11223 </p><p>but if we add a conversion instance: xxx
11224 </p><p>then we get cut off here: }-
11225 </p><p>all additional text is vanished
11226 </p>
11227 !! end
11228
11229 !! test
11230 Self closed html pairs (bug 5487)
11231 !! options
11232 !! input
11233 <center><font id="bug" />Centered text</center>
11234 <div><font id="bug2" />In div text</div>
11235 !! result
11236 <center>&lt;font id="bug" /&gt;Centered text</center>
11237 <div>&lt;font id="bug2" /&gt;In div text</div>
11238
11239 !! end
11240
11241 #
11242 #
11243 #
11244
11245 !! test
11246 Punctuation: nbsp before exclamation
11247 !! input
11248 C'est grave !
11249 !! result
11250 <p>C'est grave&#160;!
11251 </p>
11252 !! end
11253
11254 !! test
11255 Punctuation: CSS !important (bug 11874)
11256 !! input
11257 <div style="width:50% !important">important</div>
11258 !! result
11259 <div style="width:50% !important">important</div>
11260
11261 !!end
11262
11263 !! test
11264 Punctuation: CSS ! important (bug 11874; with space after)
11265 !! input
11266 <div style="width:50% ! important">important</div>
11267 !! result
11268 <div style="width:50% ! important">important</div>
11269
11270 !!end
11271
11272
11273 !! test
11274 HTML bullet list, closed tags (bug 5497)
11275 !! input
11276 <ul>
11277 <li>One</li>
11278 <li>Two</li>
11279 </ul>
11280 !! result
11281 <ul>
11282 <li>One</li>
11283 <li>Two</li>
11284 </ul>
11285
11286 !! end
11287
11288 !! test
11289 HTML bullet list, unclosed tags (bug 5497)
11290 !! options
11291 disabled
11292 !! input
11293 <ul>
11294 <li>One
11295 <li>Two
11296 </ul>
11297 !! result
11298 <ul>
11299 <li>One
11300 </li><li>Two
11301 </li></ul>
11302
11303 !! end
11304
11305 !! test
11306 HTML ordered list, closed tags (bug 5497)
11307 !! input
11308 <ol>
11309 <li>One</li>
11310 <li>Two</li>
11311 </ol>
11312 !! result
11313 <ol>
11314 <li>One</li>
11315 <li>Two</li>
11316 </ol>
11317
11318 !! end
11319
11320 !! test
11321 HTML ordered list, unclosed tags (bug 5497)
11322 !! options
11323 disabled
11324 !! input
11325 <ol>
11326 <li>One
11327 <li>Two
11328 </ol>
11329 !! result
11330 <ol>
11331 <li>One
11332 </li><li>Two
11333 </li></ol>
11334
11335 !! end
11336
11337 !! test
11338 HTML nested bullet list, closed tags (bug 5497)
11339 !! input
11340 <ul>
11341 <li>One</li>
11342 <li>Two:
11343 <ul>
11344 <li>Sub-one</li>
11345 <li>Sub-two</li>
11346 </ul>
11347 </li>
11348 </ul>
11349 !! result
11350 <ul>
11351 <li>One</li>
11352 <li>Two:
11353 <ul>
11354 <li>Sub-one</li>
11355 <li>Sub-two</li>
11356 </ul>
11357 </li>
11358 </ul>
11359
11360 !! end
11361
11362 !! test
11363 HTML nested bullet list, open tags (bug 5497)
11364 !! options
11365 disabled
11366 !! input
11367 <ul>
11368 <li>One
11369 <li>Two:
11370 <ul>
11371 <li>Sub-one
11372 <li>Sub-two
11373 </ul>
11374 </ul>
11375 !! result
11376 <ul>
11377 <li>One
11378 </li><li>Two:
11379 <ul>
11380 <li>Sub-one
11381 </li><li>Sub-two
11382 </li></ul>
11383 </li></ul>
11384
11385 !! end
11386
11387 !! test
11388 HTML nested ordered list, closed tags (bug 5497)
11389 !! input
11390 <ol>
11391 <li>One</li>
11392 <li>Two:
11393 <ol>
11394 <li>Sub-one</li>
11395 <li>Sub-two</li>
11396 </ol>
11397 </li>
11398 </ol>
11399 !! result
11400 <ol>
11401 <li>One</li>
11402 <li>Two:
11403 <ol>
11404 <li>Sub-one</li>
11405 <li>Sub-two</li>
11406 </ol>
11407 </li>
11408 </ol>
11409
11410 !! end
11411
11412 !! test
11413 HTML nested ordered list, open tags (bug 5497)
11414 !! options
11415 disabled
11416 !! input
11417 <ol>
11418 <li>One
11419 <li>Two:
11420 <ol>
11421 <li>Sub-one
11422 <li>Sub-two
11423 </ol>
11424 </ol>
11425 !! result
11426 <ol>
11427 <li>One
11428 </li><li>Two:
11429 <ol>
11430 <li>Sub-one
11431 </li><li>Sub-two
11432 </li></ol>
11433 </li></ol>
11434
11435 !! end
11436
11437 !! test
11438 HTML ordered list item with parameters oddity
11439 !! input
11440 <ol><li id="fragment">One</li></ol>
11441 !! result
11442 <ol><li id="fragment">One</li></ol>
11443
11444 !! end
11445
11446 !!test
11447 bug 5918: autonumbering
11448 !! input
11449 [http://first/] [http://second] [ftp://ftp]
11450
11451 ftp://inlineftp
11452
11453 [mailto:enclosed@mail.tld With target]
11454
11455 [mailto:enclosed@mail.tld]
11456
11457 mailto:inline@mail.tld
11458 !! result
11459 <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>
11460 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11461 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11462 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11463 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11464 </p>
11465 !! end
11466
11467
11468 #
11469 # Security and HTML correctness
11470 # From Nick Jenkins' fuzz testing
11471 #
11472
11473 !! test
11474 Fuzz testing: Parser13
11475 !! input
11476 {|
11477 | http://a|
11478 !! result
11479 <table>
11480 <tr>
11481 <td>
11482 </td>
11483 </tr>
11484 </table>
11485
11486 !! end
11487
11488 !! test
11489 Fuzz testing: Parser14
11490 !! input
11491 == onmouseover= ==
11492 http://__TOC__
11493 !! result
11494 <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>
11495 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11496 <ul>
11497 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11498 </ul>
11499 </div>
11500
11501 !! end
11502
11503 !! test
11504 Fuzz testing: Parser14-table
11505 !! input
11506 ==a==
11507 {| STYLE=__TOC__
11508 !! result
11509 <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>
11510 <table style="&#95;_TOC&#95;_">
11511 <tr><td></td></tr>
11512 </table>
11513
11514 !! end
11515
11516 # Known to produce bogus xml (extra </td>)
11517 !! test
11518 Fuzz testing: Parser16
11519 !! options
11520 noxml
11521 !! input
11522 {|
11523 !https://||||||
11524 !! result
11525 <table>
11526 <tr>
11527 <th>https://</th>
11528 <th></th>
11529 <th></th>
11530 <th>
11531 </td>
11532 </tr>
11533 </table>
11534
11535 !! end
11536
11537 !! test
11538 Fuzz testing: Parser21
11539 !! input
11540 {|
11541 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11542 |
11543 !! result
11544 <table>
11545 <tr>
11546 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11547 </th>
11548 <td>
11549 </td>
11550 </tr>
11551 </table>
11552
11553 !! end
11554
11555 !! test
11556 Fuzz testing: Parser22
11557 !! input
11558 http://===r:::https://b
11559
11560 {|
11561 !!result
11562 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11563 </p>
11564 <table>
11565 <tr><td></td></tr>
11566 </table>
11567
11568 !! end
11569
11570 # Known to produce bad XML for now
11571 !! test
11572 Fuzz testing: Parser24
11573 !! options
11574 noxml
11575 !! input
11576 {|
11577 {{{|
11578 <u CLASS=
11579 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11580 <br style="onmouseover='alert(document.cookie);' " />
11581
11582 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11583 |
11584 !! result
11585 <table>
11586 {{{|
11587 <u class="&#124;">}}}} &gt;
11588 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11589
11590 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11591 <tr>
11592 <td></u>
11593 </td>
11594 </tr>
11595 </table>
11596
11597 !! end
11598
11599 # Note: the current result listed for this is not what the original one was,
11600 # but the original bug was JavaScript injection, which is fixed in any case.
11601 # It's not clear that the original result listed was any more correct than the
11602 # current one. Original result:
11603 # <p>{{{|
11604 # </p>
11605 # <li class="&#124;&#124;">
11606 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11607 !!test
11608 Fuzz testing: Parser25 (bug 6055)
11609 !! input
11610 {{{
11611 |
11612 <LI CLASS=||
11613 >
11614 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11615 !! result
11616 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11617 </p>
11618 !! end
11619
11620 !!test
11621 Fuzz testing: URL adjacent extension (with space, clean)
11622 !! options
11623 !! input
11624 http://example.com <nowiki>junk</nowiki>
11625 !! result
11626 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11627 </p>
11628 !!end
11629
11630 !!test
11631 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11632 !! options
11633 !! input
11634 http://example.com<nowiki>junk</nowiki>
11635 !! result
11636 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11637 </p>
11638 !!end
11639
11640 !!test
11641 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11642 !! options
11643 !! input
11644 http://example.com<pre>junk</pre>
11645 !! result
11646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11647
11648 !!end
11649
11650 !!test
11651 Fuzz testing: image with bogus manual thumbnail
11652 !!input
11653 [[Image:foobar.jpg|thumbnail= ]]
11654 !!result
11655 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11656
11657 !!end
11658
11659 !! test
11660 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11661 !! input
11662 <pre dir="&#10;"></pre>
11663 !! result
11664 <pre dir="&#10;"></pre>
11665
11666 !! end
11667
11668 !! test
11669 Parsing optional HTML elements (Bug 6171)
11670 !! options
11671 !! input
11672 <table>
11673 <tr>
11674 <td> Some tabular data</td>
11675 <td> More tabular data ...
11676 <td> And yet som tabular data</td>
11677 </tr>
11678 </table>
11679 !! result
11680 <table>
11681 <tr>
11682 <td> Some tabular data</td>
11683 <td> More tabular data ...
11684 </td><td> And yet som tabular data</td>
11685 </tr>
11686 </table>
11687
11688 !! end
11689
11690 !! test
11691 Correct handling of <td>, <tr> (Bug 6171)
11692 !! options
11693 !! input
11694 <table>
11695 <tr>
11696 <td> Some tabular data</td>
11697 <td> More tabular data ...</td>
11698 <td> And yet som tabular data</td>
11699 </tr>
11700 </table>
11701 !! result
11702 <table>
11703 <tr>
11704 <td> Some tabular data</td>
11705 <td> More tabular data ...</td>
11706 <td> And yet som tabular data</td>
11707 </tr>
11708 </table>
11709
11710 !! end
11711
11712
11713 !! test
11714 Parsing crashing regression (fr:JavaScript)
11715 !! input
11716 </body></x>
11717 !! result
11718 <p>&lt;/body&gt;&lt;/x&gt;
11719 </p>
11720 !! end
11721
11722 !! test
11723 Inline wiki vs wiki block nesting
11724 !! input
11725 '''Bold paragraph
11726
11727 New wiki paragraph
11728 !! result
11729 <p><b>Bold paragraph</b>
11730 </p><p>New wiki paragraph
11731 </p>
11732 !! end
11733
11734 !! test
11735 Inline HTML vs wiki block nesting
11736 !! options
11737 disabled
11738 !! input
11739 <b>Bold paragraph
11740
11741 New wiki paragraph
11742 !! result
11743 <p><b>Bold paragraph</b>
11744 </p><p>New wiki paragraph
11745 </p>
11746 !! end
11747
11748 # Original result was this:
11749 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11750 # </p>
11751 # While that might be marginally more intuitive, maybe, the six-apostrophe
11752 # construct is clearly pathological and the result stated here (which is what
11753 # the parser actually does) is about as reasonable as anything.
11754 !!test
11755 Mixing markup for italics and bold
11756 !! options
11757 !! input
11758 '''bold''''''bold''bolditalics'''''
11759 !! result
11760 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11761 </p>
11762 !! end
11763
11764
11765 !! article
11766 Xyzzyx
11767 !! text
11768 Article for special page transclusion test
11769 !! endarticle
11770
11771 !! test
11772 Special page transclusion
11773 !! options
11774 !! input
11775 {{Special:Prefixindex/Xyzzyx}}
11776 !! result
11777 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11778
11779 !! end
11780
11781 !! test
11782 Special page transclusion twice (bug 5021)
11783 !! options
11784 !! input
11785 {{Special:Prefixindex/Xyzzyx}}
11786 {{Special:Prefixindex/Xyzzyx}}
11787 !! result
11788 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11789 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11790
11791 !! end
11792
11793 !! test
11794 Transclusion of default MediaWiki message
11795 !! input
11796 {{MediaWiki:Mainpage}}
11797 !!result
11798 <p>Main Page
11799 </p>
11800 !! end
11801
11802 !! test
11803 Transclusion of nonexistent MediaWiki message
11804 !! input
11805 {{MediaWiki:Mainpagexxx}}
11806 !!result
11807 <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>
11808 </p>
11809 !! end
11810
11811 !! test
11812 Transclusion of MediaWiki message with underscore
11813 !! input
11814 {{MediaWiki:history_short}}
11815 !! result
11816 <p>History
11817 </p>
11818 !! end
11819
11820 !! test
11821 Transclusion of MediaWiki message with space
11822 !! input
11823 {{MediaWiki:history short}}
11824 !! result
11825 <p>History
11826 </p>
11827 !! end
11828
11829 !! test
11830 Invalid header with following text
11831 !! input
11832 = x = y
11833 !! result
11834 <p>= x = y
11835 </p>
11836 !! end
11837
11838
11839 !! test
11840 Section extraction test (section 0)
11841 !! options
11842 section=0
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 start
11857 !! end
11858
11859 !! test
11860 Section extraction test (section 1)
11861 !! options
11862 section=1
11863 !! input
11864 start
11865 ==a==
11866 ===aa===
11867 ====aaa====
11868 ==b==
11869 ===ba===
11870 ===bb===
11871 ====bba====
11872 ===bc===
11873 ==c==
11874 ===ca===
11875 !! result
11876 ==a==
11877 ===aa===
11878 ====aaa====
11879 !! end
11880
11881 !! test
11882 Section extraction test (section 2)
11883 !! options
11884 section=2
11885 !! input
11886 start
11887 ==a==
11888 ===aa===
11889 ====aaa====
11890 ==b==
11891 ===ba===
11892 ===bb===
11893 ====bba====
11894 ===bc===
11895 ==c==
11896 ===ca===
11897 !! result
11898 ===aa===
11899 ====aaa====
11900 !! end
11901
11902 !! test
11903 Section extraction test (section 3)
11904 !! options
11905 section=3
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 ====aaa====
11920 !! end
11921
11922 !! test
11923 Section extraction test (section 4)
11924 !! options
11925 section=4
11926 !! input
11927 start
11928 ==a==
11929 ===aa===
11930 ====aaa====
11931 ==b==
11932 ===ba===
11933 ===bb===
11934 ====bba====
11935 ===bc===
11936 ==c==
11937 ===ca===
11938 !! result
11939 ==b==
11940 ===ba===
11941 ===bb===
11942 ====bba====
11943 ===bc===
11944 !! end
11945
11946 !! test
11947 Section extraction test (section 5)
11948 !! options
11949 section=5
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 ===ba===
11964 !! end
11965
11966 !! test
11967 Section extraction test (section 6)
11968 !! options
11969 section=6
11970 !! input
11971 start
11972 ==a==
11973 ===aa===
11974 ====aaa====
11975 ==b==
11976 ===ba===
11977 ===bb===
11978 ====bba====
11979 ===bc===
11980 ==c==
11981 ===ca===
11982 !! result
11983 ===bb===
11984 ====bba====
11985 !! end
11986
11987 !! test
11988 Section extraction test (section 7)
11989 !! options
11990 section=7
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 ====bba====
12005 !! end
12006
12007 !! test
12008 Section extraction test (section 8)
12009 !! options
12010 section=8
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 ===bc===
12025 !! end
12026
12027 !! test
12028 Section extraction test (section 9)
12029 !! options
12030 section=9
12031 !! input
12032 start
12033 ==a==
12034 ===aa===
12035 ====aaa====
12036 ==b==
12037 ===ba===
12038 ===bb===
12039 ====bba====
12040 ===bc===
12041 ==c==
12042 ===ca===
12043 !! result
12044 ==c==
12045 ===ca===
12046 !! end
12047
12048 !! test
12049 Section extraction test (section 10)
12050 !! options
12051 section=10
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 ===ca===
12066 !! end
12067
12068 !! test
12069 Section extraction test (nonexistent section 11)
12070 !! options
12071 section=11
12072 !! input
12073 start
12074 ==a==
12075 ===aa===
12076 ====aaa====
12077 ==b==
12078 ===ba===
12079 ===bb===
12080 ====bba====
12081 ===bc===
12082 ==c==
12083 ===ca===
12084 !! result
12085 !! end
12086
12087 !! test
12088 Section extraction test with bogus heading (section 1)
12089 !! options
12090 section=1
12091 !! input
12092 ==a==
12093 ==bogus== not a legal section
12094 ==b==
12095 !! result
12096 ==a==
12097 ==bogus== not a legal section
12098 !! end
12099
12100 !! test
12101 Section extraction test with bogus heading (section 2)
12102 !! options
12103 section=2
12104 !! input
12105 ==a==
12106 ==bogus== not a legal section
12107 ==b==
12108 !! result
12109 ==b==
12110 !! end
12111
12112 !! test
12113 Section extraction test with comment after heading (section 1)
12114 !! options
12115 section=1
12116 !! input
12117 ==a==
12118 ==b== <!-- -->
12119 ==c==
12120 !! result
12121 ==a==
12122 !! end
12123
12124 !! test
12125 Section extraction test with comment after heading (section 2)
12126 !! options
12127 section=2
12128 !! input
12129 ==a==
12130 ==b== <!-- -->
12131 ==c==
12132 !! result
12133 ==b== <!-- -->
12134 !! end
12135
12136 !! test
12137 Section extraction test with bogus <nowiki> heading (section 1)
12138 !! options
12139 section=1
12140 !! input
12141 ==a==
12142 ==bogus== <nowiki>not a legal section</nowiki>
12143 ==b==
12144 !! result
12145 ==a==
12146 ==bogus== <nowiki>not a legal section</nowiki>
12147 !! end
12148
12149 !! test
12150 Section extraction test with bogus <nowiki> heading (section 2)
12151 !! options
12152 section=2
12153 !! input
12154 ==a==
12155 ==bogus== <nowiki>not a legal section</nowiki>
12156 ==b==
12157 !! result
12158 ==b==
12159 !! end
12160
12161
12162 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12163 # instead of respecting commented sections
12164 !! test
12165 Section extraction prefixed by comment (section 1)
12166 !! options
12167 section=1
12168 !! input
12169 <!-- -->==sec1==
12170 ==sec2==
12171 !!result
12172 ==sec2==
12173 !!end
12174
12175 !! test
12176 Section extraction prefixed by comment (section 2)
12177 !! options
12178 section=2
12179 !! input
12180 <!-- -->==sec1==
12181 ==sec2==
12182 !!result
12183
12184 !!end
12185
12186
12187 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12188 # instead of respecting HTML-style headings
12189 !! test
12190 Section extraction, mixed wiki and html (section 1)
12191 !! options
12192 section=1
12193 !! input
12194 <h2>unmarked</h2>
12195 unmarked
12196 ==1==
12197 one
12198 ==2==
12199 two
12200 !! result
12201 ==1==
12202 one
12203 !! end
12204
12205 !! test
12206 Section extraction, mixed wiki and html (section 2)
12207 !! options
12208 section=2
12209 !! input
12210 <h2>unmarked</h2>
12211 unmarked
12212 ==1==
12213 one
12214 ==2==
12215 two
12216 !! result
12217 ==2==
12218 two
12219 !! end
12220
12221
12222 # Formerly testing for bug 3342
12223 !! test
12224 Section extraction, heading surrounded by <noinclude>
12225 !! options
12226 section=1
12227 !! input
12228 <noinclude>==unmarked==</noinclude>
12229 ==marked==
12230 !! result
12231 ==marked==
12232 !!end
12233
12234 # Test behavior of bug 19910
12235 !! test
12236 Sectiion with all-equals
12237 !! options
12238 section=2
12239 !! input
12240 ===
12241 The line above must have a trailing space
12242 === <!--
12243 --> <!-- -->
12244 But just in case it doesn't...
12245 !! result
12246 === <!--
12247 --> <!-- -->
12248 But just in case it doesn't...
12249 !! end
12250
12251 !! test
12252 Section replacement test (section 0)
12253 !! options
12254 replace=0,"xxx"
12255 !! input
12256 start
12257 ==a==
12258 ===aa===
12259 ====aaa====
12260 ==b==
12261 ===ba===
12262 ===bb===
12263 ====bba====
12264 ===bc===
12265 ==c==
12266 ===ca===
12267 !! result
12268 xxx
12269
12270 ==a==
12271 ===aa===
12272 ====aaa====
12273 ==b==
12274 ===ba===
12275 ===bb===
12276 ====bba====
12277 ===bc===
12278 ==c==
12279 ===ca===
12280 !! end
12281
12282 !! test
12283 Section replacement test (section 1)
12284 !! options
12285 replace=1,"xxx"
12286 !! input
12287 start
12288 ==a==
12289 ===aa===
12290 ====aaa====
12291 ==b==
12292 ===ba===
12293 ===bb===
12294 ====bba====
12295 ===bc===
12296 ==c==
12297 ===ca===
12298 !! result
12299 start
12300 xxx
12301
12302 ==b==
12303 ===ba===
12304 ===bb===
12305 ====bba====
12306 ===bc===
12307 ==c==
12308 ===ca===
12309 !! end
12310
12311 !! test
12312 Section replacement test (section 2)
12313 !! options
12314 replace=2,"xxx"
12315 !! input
12316 start
12317 ==a==
12318 ===aa===
12319 ====aaa====
12320 ==b==
12321 ===ba===
12322 ===bb===
12323 ====bba====
12324 ===bc===
12325 ==c==
12326 ===ca===
12327 !! result
12328 start
12329 ==a==
12330 xxx
12331
12332 ==b==
12333 ===ba===
12334 ===bb===
12335 ====bba====
12336 ===bc===
12337 ==c==
12338 ===ca===
12339 !! end
12340
12341 !! test
12342 Section replacement test (section 3)
12343 !! options
12344 replace=3,"xxx"
12345 !! input
12346 start
12347 ==a==
12348 ===aa===
12349 ====aaa====
12350 ==b==
12351 ===ba===
12352 ===bb===
12353 ====bba====
12354 ===bc===
12355 ==c==
12356 ===ca===
12357 !! result
12358 start
12359 ==a==
12360 ===aa===
12361 xxx
12362
12363 ==b==
12364 ===ba===
12365 ===bb===
12366 ====bba====
12367 ===bc===
12368 ==c==
12369 ===ca===
12370 !! end
12371
12372 !! test
12373 Section replacement test (section 4)
12374 !! options
12375 replace=4,"xxx"
12376 !! input
12377 start
12378 ==a==
12379 ===aa===
12380 ====aaa====
12381 ==b==
12382 ===ba===
12383 ===bb===
12384 ====bba====
12385 ===bc===
12386 ==c==
12387 ===ca===
12388 !! result
12389 start
12390 ==a==
12391 ===aa===
12392 ====aaa====
12393 xxx
12394
12395 ==c==
12396 ===ca===
12397 !! end
12398
12399 !! test
12400 Section replacement test (section 5)
12401 !! options
12402 replace=5,"xxx"
12403 !! input
12404 start
12405 ==a==
12406 ===aa===
12407 ====aaa====
12408 ==b==
12409 ===ba===
12410 ===bb===
12411 ====bba====
12412 ===bc===
12413 ==c==
12414 ===ca===
12415 !! result
12416 start
12417 ==a==
12418 ===aa===
12419 ====aaa====
12420 ==b==
12421 xxx
12422
12423 ===bb===
12424 ====bba====
12425 ===bc===
12426 ==c==
12427 ===ca===
12428 !! end
12429
12430 !! test
12431 Section replacement test (section 6)
12432 !! options
12433 replace=6,"xxx"
12434 !! input
12435 start
12436 ==a==
12437 ===aa===
12438 ====aaa====
12439 ==b==
12440 ===ba===
12441 ===bb===
12442 ====bba====
12443 ===bc===
12444 ==c==
12445 ===ca===
12446 !! result
12447 start
12448 ==a==
12449 ===aa===
12450 ====aaa====
12451 ==b==
12452 ===ba===
12453 xxx
12454
12455 ===bc===
12456 ==c==
12457 ===ca===
12458 !! end
12459
12460 !! test
12461 Section replacement test (section 7)
12462 !! options
12463 replace=7,"xxx"
12464 !! input
12465 start
12466 ==a==
12467 ===aa===
12468 ====aaa====
12469 ==b==
12470 ===ba===
12471 ===bb===
12472 ====bba====
12473 ===bc===
12474 ==c==
12475 ===ca===
12476 !! result
12477 start
12478 ==a==
12479 ===aa===
12480 ====aaa====
12481 ==b==
12482 ===ba===
12483 ===bb===
12484 xxx
12485
12486 ===bc===
12487 ==c==
12488 ===ca===
12489 !! end
12490
12491 !! test
12492 Section replacement test (section 8)
12493 !! options
12494 replace=8,"xxx"
12495 !! input
12496 start
12497 ==a==
12498 ===aa===
12499 ====aaa====
12500 ==b==
12501 ===ba===
12502 ===bb===
12503 ====bba====
12504 ===bc===
12505 ==c==
12506 ===ca===
12507 !! result
12508 start
12509 ==a==
12510 ===aa===
12511 ====aaa====
12512 ==b==
12513 ===ba===
12514 ===bb===
12515 ====bba====
12516 xxx
12517
12518 ==c==
12519 ===ca===
12520 !!end
12521
12522 !! test
12523 Section replacement test (section 9)
12524 !! options
12525 replace=9,"xxx"
12526 !! input
12527 start
12528 ==a==
12529 ===aa===
12530 ====aaa====
12531 ==b==
12532 ===ba===
12533 ===bb===
12534 ====bba====
12535 ===bc===
12536 ==c==
12537 ===ca===
12538 !! result
12539 start
12540 ==a==
12541 ===aa===
12542 ====aaa====
12543 ==b==
12544 ===ba===
12545 ===bb===
12546 ====bba====
12547 ===bc===
12548 xxx
12549 !! end
12550
12551 !! test
12552 Section replacement test (section 10)
12553 !! options
12554 replace=10,"xxx"
12555 !! input
12556 start
12557 ==a==
12558 ===aa===
12559 ====aaa====
12560 ==b==
12561 ===ba===
12562 ===bb===
12563 ====bba====
12564 ===bc===
12565 ==c==
12566 ===ca===
12567 !! result
12568 start
12569 ==a==
12570 ===aa===
12571 ====aaa====
12572 ==b==
12573 ===ba===
12574 ===bb===
12575 ====bba====
12576 ===bc===
12577 ==c==
12578 xxx
12579 !! end
12580
12581 !! test
12582 Section replacement test with initial whitespace (bug 13728)
12583 !! options
12584 replace=2,"xxx"
12585 !! input
12586 Preformatted initial line
12587 ==a==
12588 ===a===
12589 !! result
12590 Preformatted initial line
12591 ==a==
12592 xxx
12593 !! end
12594
12595
12596 !! test
12597 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12598 !! options
12599 section=1
12600 !! input
12601 ==a==
12602 a
12603 !! result
12604 ==a==
12605 a
12606 !! end
12607
12608 !! test
12609 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12610 !! options
12611 section=1
12612 !! input
12613 ==a==
12614 a
12615 !! result
12616 ==a==
12617 a
12618 !! end
12619
12620
12621 !! test
12622 Section extraction, <pre> around bogus header (bug 10309)
12623 !! options
12624 noxml section=2
12625 !! input
12626 == Section One ==
12627 <pre>
12628 =======
12629 </pre>
12630
12631 == Section Two ==
12632 stuff
12633 !! result
12634 == Section Two ==
12635 stuff
12636 !! end
12637
12638 !! test
12639 Section replacement, <pre> around bogus header (bug 10309)
12640 !! options
12641 noxml replace=2,"xxx"
12642 !! input
12643 == Section One ==
12644 <pre>
12645 =======
12646 </pre>
12647
12648 == Section Two ==
12649 stuff
12650 !! result
12651 == Section One ==
12652 <pre>
12653 =======
12654 </pre>
12655
12656 xxx
12657 !! end
12658
12659
12660
12661 !! test
12662 Handling of &#x0A; in URLs
12663 !! input
12664 **irc://&#x0A;a
12665 !! result
12666 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12667 </li></ul>
12668 </li></ul>
12669
12670 !!end
12671
12672 !! test
12673 5 quotes, code coverage +1 line (php)
12674 !! options
12675 php
12676 !! input
12677 '''''
12678 !! result
12679 !! end
12680 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12681 !! test
12682 5 quotes, code coverage +1 line (parsoid)
12683 !! options
12684 parsoid
12685 !! input
12686 '''''
12687 !! result
12688 <p><i><b></b></i></p>
12689 !! end
12690
12691 !! test
12692 Special:Search page linking.
12693 !! input
12694 {{Special:search}}
12695 !! result
12696 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12697 </p>
12698 !! end
12699
12700 !! test
12701 Say the magic word
12702 !! options
12703 title=[[Parser test]]
12704 !! input
12705 * {{PAGENAME}}
12706 * {{PAGENAMEE}}
12707 * {{FULLPAGENAME}}
12708 * {{FULLPAGENAMEE}}
12709 * {{BASEPAGENAME}}
12710 * {{BASEPAGENAMEE}}
12711 * {{SUBPAGENAME}}
12712 * {{SUBPAGENAMEE}}
12713 * {{ROOTPAGENAME}}
12714 * {{ROOTPAGENAMEE}}
12715 * {{TALKPAGENAME}}
12716 * {{TALKPAGENAMEE}}
12717 * {{SUBJECTPAGENAME}}
12718 * {{SUBJECTPAGENAMEE}}
12719 * {{NAMESPACEE}}
12720 * {{NAMESPACE}}
12721 * {{NAMESPACENUMBER}}
12722 * {{TALKSPACE}}
12723 * {{TALKSPACEE}}
12724 * {{SUBJECTSPACE}}
12725 * {{SUBJECTSPACEE}}
12726 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12727 !! result
12728 <ul><li> Parser test
12729 </li><li> Parser_test
12730 </li><li> Parser test
12731 </li><li> Parser_test
12732 </li><li> Parser test
12733 </li><li> Parser_test
12734 </li><li> Parser test
12735 </li><li> Parser_test
12736 </li><li> Parser test
12737 </li><li> Parser_test
12738 </li><li> Talk:Parser test
12739 </li><li> Talk:Parser_test
12740 </li><li> Parser test
12741 </li><li> Parser_test
12742 </li><li>
12743 </li><li>
12744 </li><li> 0
12745 </li><li> Talk
12746 </li><li> Talk
12747 </li><li>
12748 </li><li>
12749 </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>
12750 </li></ul>
12751
12752 !! end
12753 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12754
12755 !! test
12756 Gallery
12757 !! input
12758 <gallery>
12759 image1.png |
12760 image2.gif|||||
12761
12762 image3|
12763 image4 |300px| centre
12764 image5.svg| http://///////
12765 [[x|xx]]]]
12766 * image6
12767 </gallery>
12768 !! result
12769 <ul class="gallery mw-gallery-traditional">
12770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12771 <div class="thumb" style="height: 150px;">Image1.png</div>
12772 <div class="gallerytext">
12773 </div>
12774 </div></li>
12775 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12776 <div class="thumb" style="height: 150px;">Image2.gif</div>
12777 <div class="gallerytext">
12778 <p>||||
12779 </p>
12780 </div>
12781 </div></li>
12782 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12783 <div class="thumb" style="height: 150px;">Image3</div>
12784 <div class="gallerytext">
12785 </div>
12786 </div></li>
12787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12788 <div class="thumb" style="height: 150px;">Image4</div>
12789 <div class="gallerytext">
12790 <p>300px| centre
12791 </p>
12792 </div>
12793 </div></li>
12794 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12795 <div class="thumb" style="height: 150px;">Image5.svg</div>
12796 <div class="gallerytext">
12797 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12798 </p>
12799 </div>
12800 </div></li>
12801 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12802 <div class="thumb" style="height: 150px;">* image6</div>
12803 <div class="gallerytext">
12804 </div>
12805 </div></li>
12806 </ul>
12807
12808 !! end
12809
12810 !! test
12811 Gallery (with options)
12812 !! input
12813 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12814 File:Nonexistant.jpg|caption
12815 File:Nonexistant.jpg
12816 image:foobar.jpg|some '''caption''' [[Main Page]]
12817 image:foobar.jpg
12818 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12819 </gallery>
12820 !! result
12821 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
12822 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12823 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12824 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12825 <div class="gallerytext">
12826 <p>caption
12827 </p>
12828 </div>
12829 </div></li>
12830 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12831 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
12832 <div class="gallerytext">
12833 </div>
12834 </div></li>
12835 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12836 <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>
12837 <div class="gallerytext">
12838 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12839 </p>
12840 </div>
12841 </div></li>
12842 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12843 <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>
12844 <div class="gallerytext">
12845 </div>
12846 </div></li>
12847 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12848 <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>
12849 <div class="gallerytext">
12850 <p>Blabla|blabla.
12851 </p>
12852 </div>
12853 </div></li>
12854 </ul>
12855
12856 !! end
12857
12858 !! test
12859 Gallery with wikitext inside caption
12860 !! input
12861 <gallery>
12862 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12863 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12864 </gallery>
12865 !! result
12866 <ul class="gallery mw-gallery-traditional">
12867 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12868 <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>
12869 <div class="gallerytext">
12870 <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>
12871 </p>
12872 </div>
12873 </div></li>
12874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12875 <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>
12876 <div class="gallerytext">
12877 <p>This is a test template
12878 </p>
12879 </div>
12880 </div></li>
12881 </ul>
12882
12883 !! end
12884
12885 !! test
12886 gallery (with showfilename option)
12887 !! input
12888 <gallery showfilename>
12889 File:Nonexistant.jpg|caption
12890 File:Nonexistant.jpg
12891 image:foobar.jpg|some '''caption''' [[Main Page]]
12892 File:Foobar.jpg
12893 </gallery>
12894 !! result
12895 <ul class="gallery mw-gallery-traditional">
12896 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12897 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12898 <div class="gallerytext">
12899 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12900 caption
12901 </p>
12902 </div>
12903 </div></li>
12904 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12905 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12906 <div class="gallerytext">
12907 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12908 </p>
12909 </div>
12910 </div></li>
12911 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12912 <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>
12913 <div class="gallerytext">
12914 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12915 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12916 </p>
12917 </div>
12918 </div></li>
12919 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12920 <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>
12921 <div class="gallerytext">
12922 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12923 </p>
12924 </div>
12925 </div></li>
12926 </ul>
12927
12928 !! end
12929
12930 !! test
12931 Gallery (with namespace-less filenames)
12932 !! input
12933 <gallery>
12934 File:Nonexistant.jpg
12935 Nonexistant.jpg
12936 image:foobar.jpg
12937 foobar.jpg
12938 </gallery>
12939 !! result
12940 <ul class="gallery mw-gallery-traditional">
12941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12942 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12943 <div class="gallerytext">
12944 </div>
12945 </div></li>
12946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12947 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
12948 <div class="gallerytext">
12949 </div>
12950 </div></li>
12951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12952 <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>
12953 <div class="gallerytext">
12954 </div>
12955 </div></li>
12956 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12957 <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>
12958 <div class="gallerytext">
12959 </div>
12960 </div></li>
12961 </ul>
12962
12963 !! end
12964
12965 !! test
12966 HTML Hex character encoding (spells the word "JavaScript")
12967 !! input
12968 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12969 !! result
12970 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12971 </p>
12972 !! end
12973
12974 !! test
12975 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12976 !! input
12977 &#xsee;&#XSEE;
12978 !! result
12979 <p>&amp;#xsee;&amp;#XSEE;
12980 </p>
12981 !! end
12982
12983 !! test
12984 HTML Hex character encoding mixed case
12985 !! input
12986 &#xEE;&#Xee;
12987 !! result
12988 <p>&#xee;&#xee;
12989 </p>
12990 !! end
12991
12992 !! test
12993 __FORCETOC__ override
12994 !! input
12995 __NEWSECTIONLINK__
12996 __FORCETOC__
12997 !! result
12998 <p><br />
12999 </p>
13000 !! end
13001
13002 !! test
13003 ISBN code coverage
13004 !! input
13005 ISBN 978-0-1234-56&#x20;789
13006 !! result
13007 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13008 </p>
13009 !! end
13010
13011 !! test
13012 ISBN followed by 5 spaces
13013 !! input
13014 ISBN
13015 !! result
13016 <p>ISBN
13017 </p>
13018 !! end
13019
13020 !! test
13021 Double ISBN
13022 !! input
13023 ISBN ISBN 1234567890
13024 !! result
13025 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13026 </p>
13027 !! end
13028
13029 !! test
13030 Bug 22905: <abbr> followed by ISBN followed by </a>
13031 !! input
13032 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13033 !! result
13034 <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>
13035 </p>
13036 !! end
13037
13038 !! test
13039 Double RFC
13040 !! input
13041 RFC RFC 1234
13042 !! result
13043 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13044 </p>
13045 !! end
13046
13047 !! test
13048 Double RFC with a wiki link
13049 !! input
13050 RFC [[RFC 1234]]
13051 !! result
13052 <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>
13053 </p>
13054 !! end
13055
13056 !! test
13057 RFC code coverage
13058 !! input
13059 RFC 983&#x20;987
13060 !! result
13061 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13062 </p>
13063 !! end
13064
13065 !! test
13066 Centre-aligned image
13067 !! input
13068 [[Image:foobar.jpg|centre]]
13069 !! result
13070 <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>
13071
13072 !!end
13073
13074 !! test
13075 None-aligned image
13076 !! input
13077 [[Image:foobar.jpg|none]]
13078 !! result
13079 <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>
13080
13081 !!end
13082
13083 !! test
13084 Width + Height sized image (using px) (height is ignored)
13085 !! input
13086 [[Image:foobar.jpg|640x480px]]
13087 !! result
13088 <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>
13089 </p>
13090 !!end
13091
13092 !! test
13093 Width-sized image (using px, no following whitespace)
13094 !! input
13095 [[Image:foobar.jpg|640px]]
13096 !! result
13097 <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>
13098 </p>
13099 !!end
13100
13101 !! test
13102 Width-sized image (using px, with following whitespace - test regression from r39467)
13103 !! input
13104 [[Image:foobar.jpg|640px ]]
13105 !! result
13106 <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>
13107 </p>
13108 !!end
13109
13110 !! test
13111 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13112 !! input
13113 [[Image:foobar.jpg| 640px]]
13114 !! result
13115 <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>
13116 </p>
13117 !!end
13118
13119 !! test
13120 Another italics / bold test
13121 !! input
13122 ''' ''x'
13123 !! result
13124 <pre>'<i> </i>x'
13125 </pre>
13126 !!end
13127
13128 # Note the results may be incorrect, as parserTest output included this:
13129 # XML error: Mismatched tag at byte 6120:
13130 # ...<dd> </dt></dl> </dd...
13131 !! test
13132 dt/dd/dl test
13133 !! options
13134 disabled
13135 !! input
13136 :;;;::
13137 !! result
13138 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13139 </dd></dl>
13140 </dd></dl>
13141 </dt></dl>
13142 </dt></dl>
13143 </dt></dl>
13144 </dd></dl>
13145
13146 !!end
13147
13148
13149 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13150 !! test
13151 Images with the "|" character in the comment
13152 !! input
13153 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13154 !! result
13155 <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>
13156
13157 !!end
13158
13159 !! test
13160 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13161 !! input
13162 <html><script>alert(1);</script></html>
13163 !! result
13164 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13165 </p>
13166 !! end
13167
13168 !! test
13169 HTML with raw HTML ($wgRawHtml==true)
13170 !! options
13171 wgRawHtml=1
13172 !! input
13173 <html><script>alert(1);</script></html>
13174 !! result
13175 <p><script>alert(1);</script>
13176 </p>
13177 !! end
13178
13179 !! test
13180 Parents of subpages, one level up
13181 !! options
13182 subpage title=[[Subpage test/L1/L2/L3]]
13183 !! input
13184 [[../|L2]]
13185 !! result
13186 <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>
13187 </p>
13188 !! end
13189
13190
13191 !! test
13192 Parents of subpages, one level up, not named
13193 !! options
13194 subpage title=[[Subpage test/L1/L2/L3]]
13195 !! input
13196 [[../]]
13197 !! result
13198 <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>
13199 </p>
13200 !! end
13201
13202
13203
13204 !! test
13205 Parents of subpages, two levels up
13206 !! options
13207 subpage title=[[Subpage test/L1/L2/L3]]
13208 !! input
13209 [[../../|L1]]2
13210
13211 [[../../|L1]]l
13212 !! result
13213 <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
13214 </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>
13215 </p>
13216 !! end
13217
13218 !! test
13219 Parents of subpages, two levels up, without trailing slash or name.
13220 !! options
13221 subpage title=[[Subpage test/L1/L2/L3]]
13222 !! input
13223 [[../..]]
13224 !! result
13225 <p>[[../..]]
13226 </p>
13227 !! end
13228
13229 !! test
13230 Parents of subpages, two levels up, with lots of extra trailing slashes.
13231 !! options
13232 subpage title=[[Subpage test/L1/L2/L3]]
13233 !! input
13234 [[../../////]]
13235 !! result
13236 <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>
13237 </p>
13238 !! end
13239
13240 !! article
13241 Subpage test/L1/L2/L3Sibling
13242 !! text
13243 Sibling article
13244 !! endarticle
13245
13246 !! test
13247 Transclusion of a sibling page (one level up)
13248 !! options
13249 subpage title=[[Subpage test/L1/L2/L3]]
13250 !! input
13251 {{../L3Sibling}}
13252 !! result
13253 <p>Sibling article
13254 </p>
13255 !! end
13256
13257 !! test
13258 Transclusion of a child page
13259 !! options
13260 subpage title=[[Subpage test/L1/L2]]
13261 !! input
13262 {{/L3Sibling}}
13263 !! result
13264 <p>Sibling article
13265 </p>
13266 !! end
13267
13268 !! test
13269 Non-transclusion because of too many up levels
13270 !! options
13271 subpage title=[[Subpage test/L1/L2/L3]]
13272 !! input
13273 {{../../../../More than parent}}
13274 !! result
13275 <p>{{../../../../More than parent}}
13276 </p>
13277 !! end
13278
13279 !! test
13280 Definition list code coverage
13281 !! input
13282 ; title : def
13283 ; title : def
13284 ;title: def
13285 !! result
13286 <dl><dt> title &#160;</dt><dd> def
13287 </dd><dt> title&#160;</dt><dd> def
13288 </dd><dt>title</dt><dd> def
13289 </dd></dl>
13290
13291 !! end
13292
13293 !! test
13294 Don't fall for the self-closing div
13295 !! input
13296 <div>hello world</div/>
13297 !! result
13298 <div>hello world</div>
13299
13300 !! end
13301
13302 !! test
13303 MSGNW magic word
13304 !! input
13305 {{MSGNW:msg}}
13306 !! result
13307 <p>&#91;&#91;:Template:Msg&#93;&#93;
13308 </p>
13309 !! end
13310
13311 !! test
13312 RAW magic word
13313 !! input
13314 {{RAW:QUERTY}}
13315 !! result
13316 <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>
13317 </p>
13318 !! end
13319
13320 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13321 !! test
13322 Always escape literal '>' in output, not just after '<'
13323 !! input
13324 ><>
13325 !! result
13326 <p>&gt;&lt;&gt;
13327 </p>
13328 !! end
13329
13330 !! test
13331 Template caching
13332 !! input
13333 {{Test}}
13334 {{Test}}
13335 !! result
13336 <p>This is a test template
13337 This is a test template
13338 </p>
13339 !! end
13340
13341
13342 !! article
13343 MediaWiki:Fake
13344 !! text
13345 ==header==
13346 !! endarticle
13347
13348 !! test
13349 Inclusion of !userCanEdit() content
13350 !! input
13351 {{MediaWiki:Fake}}
13352 !! result
13353 <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>
13354
13355 !! end
13356
13357
13358 !! test
13359 Out-of-order TOC heading levels
13360 !! input
13361 ==2==
13362 ======6======
13363 ===3===
13364 =1=
13365 =====5=====
13366 ==2==
13367 !! result
13368 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13369 <ul>
13370 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13371 <ul>
13372 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13373 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13374 </ul>
13375 </li>
13376 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13377 <ul>
13378 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13379 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13380 </ul>
13381 </li>
13382 </ul>
13383 </div>
13384 <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>
13385 <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>
13386 <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>
13387 <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>
13388 <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>
13389 <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>
13390
13391 !! end
13392
13393
13394 !! test
13395 ISBN with a dummy number
13396 !! input
13397 ISBN ---
13398 !! result
13399 <p>ISBN ---
13400 </p>
13401 !! end
13402
13403
13404 !! test
13405 ISBN with space-delimited number
13406 !! input
13407 ISBN 92 9017 032 8
13408 !! result
13409 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13410 </p>
13411 !! end
13412
13413
13414 !! test
13415 ISBN with multiple spaces, no number
13416 !! input
13417 ISBN foo
13418 !! result
13419 <p>ISBN foo
13420 </p>
13421 !! end
13422
13423
13424 !! test
13425 ISBN length
13426 !! input
13427 ISBN 123456789
13428
13429 ISBN 1234567890
13430
13431 ISBN 12345678901
13432 !! result
13433 <p>ISBN 123456789
13434 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13435 </p><p>ISBN 12345678901
13436 </p>
13437 !! end
13438
13439
13440 !! test
13441 ISBN with trailing year (bug 8110)
13442 !! input
13443 ISBN 1-234-56789-0 - 2006
13444
13445 ISBN 1 234 56789 0 - 2006
13446 !! result
13447 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13448 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13449 </p>
13450 !! end
13451
13452
13453 !! test
13454 anchorencode
13455 !! input
13456 {{anchorencode:foo bar©#%n}}
13457 !! result
13458 <p>foo_bar.C2.A9.23.25n
13459 </p>
13460 !! end
13461
13462 !! test
13463 anchorencode trims spaces
13464 !! input
13465 {{anchorencode: __pretty__please__}}
13466 !! result
13467 <p>pretty_please
13468 </p>
13469 !! end
13470
13471 !! test
13472 anchorencode deals with links
13473 !! input
13474 {{anchorencode: [[hello|world]] [[hi]]}}
13475 !! result
13476 <p>world_hi
13477 </p>
13478 !! end
13479
13480 !! test
13481 anchorencode deals with templates
13482 !! input
13483 {{anchorencode: {{Foo}} }}
13484 !! result
13485 <p>FOO
13486 </p>
13487 !! end
13488
13489 !! test
13490 anchorencode encodes like the TOC generator: (bug 18431)
13491 !! input
13492 === _ +:.3A%3A&&amp;]] ===
13493 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13494 __NOEDITSECTION__
13495 !! result
13496 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13497 <p>.2B:.3A.253A.26.26.5D.5D
13498 </p>
13499 !! end
13500
13501 # Expected output in the following test is not necessarily expected (there
13502 # should probably be <p> tags inside the <blockquote> in the output) -- it's
13503 # only testing for well-formedness.
13504 !! test
13505 Bug 6200: blockquotes and paragraph formatting
13506 !! input
13507 <blockquote>
13508 foo
13509 </blockquote>
13510
13511 bar
13512
13513 baz
13514 !! result
13515 <blockquote>
13516 foo
13517 </blockquote>
13518 <p>bar
13519 </p>
13520 <pre>baz
13521 </pre>
13522 !! end
13523
13524 !! test
13525 Bug 8293: Use of center tag ruins paragraph formatting
13526 !! input
13527 <center>
13528 foo
13529 </center>
13530
13531 bar
13532
13533 baz
13534 !! result
13535 <center>
13536 <p>foo
13537 </p>
13538 </center>
13539 <p>bar
13540 </p>
13541 <pre>baz
13542 </pre>
13543 !! end
13544
13545 !!test
13546 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13547 !!options
13548 php
13549 !!input
13550 <span><s>x</span></s>
13551 !!result
13552 <p><span><s>x&lt;/span&gt;</s></span>
13553 </p>
13554 !!end
13555
13556 !!test
13557 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13558 !!options
13559 parsoid
13560 !!input
13561 <span><s>x</span></s>
13562 !!result
13563 <p><span><s>x</s></span><s></s>
13564 </p>
13565 !!end
13566
13567 ###
13568 ### Language variants related tests
13569 ###
13570 !! test
13571 Self-link in language variants
13572 !! options
13573 title=[[Dunav]] language=sr
13574 !! input
13575 Both [[Dunav]] and [[Дунав]] are names for this river.
13576 !! result
13577 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13578 </p>
13579 !!end
13580
13581 !! article
13582 Дуна
13583 !! text
13584 content
13585 !! endarticle
13586
13587 !! test
13588 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13589 !! options
13590 title=[[Duna]] language=sr
13591 !! input
13592 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13593 !! result
13594 <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.
13595 </p>
13596 !! end
13597
13598 !! test
13599 Link to pages in language variants
13600 !! options
13601 language=sr
13602 !! input
13603 Main Page can be written as [[Маин Паге]]
13604 !! result
13605 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13606 </p>
13607 !!end
13608
13609
13610 !! test
13611 Multiple links to pages in language variants
13612 !! options
13613 language=sr
13614 !! input
13615 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13616 !! result
13617 <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>.
13618 </p>
13619 !!end
13620
13621
13622 !! test
13623 Simple template in language variants
13624 !! options
13625 language=sr
13626 !! input
13627 {{тест}}
13628 !! result
13629 <p>This is a test template
13630 </p>
13631 !! end
13632
13633
13634 !! test
13635 Template with explicit namespace in language variants
13636 !! options
13637 language=sr
13638 !! input
13639 {{Template:тест}}
13640 !! result
13641 <p>This is a test template
13642 </p>
13643 !! end
13644
13645
13646 !! test
13647 Basic test for template parameter in language variants
13648 !! options
13649 language=sr
13650 !! input
13651 {{парамтест|param=foo}}
13652 !! result
13653 <p>This is a test template with parameter foo
13654 </p>
13655 !! end
13656
13657
13658 !! test
13659 Simple category in language variants
13660 !! options
13661 language=sr cat
13662 !! input
13663 [[Category:МедиаWики Усер'с Гуиде]]
13664 !! result
13665 <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>
13666 !! end
13667
13668
13669 !! article
13670 Category:分类
13671 !! text
13672 blah
13673 !! endarticle
13674
13675 !! article
13676 Category:分類
13677 !! text
13678 blah
13679 !! endarticle
13680
13681 !! test
13682 Don't convert blue categorylinks to another variant (bug 33210)
13683 !! options
13684 language=zh cat
13685 !! input
13686 [[A]][[Category:分类]]
13687 !! result
13688 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13689 !! end
13690
13691
13692 !! test
13693 Stripping -{}- tags (language variants)
13694 !! options
13695 language=sr
13696 !! input
13697 Latin proverb: -{Ne nuntium necare}-
13698 !! result
13699 <p>Latin proverb: Ne nuntium necare
13700 </p>
13701 !! end
13702
13703
13704 !! test
13705 Prevent conversion with -{}- tags (language variants)
13706 !! options
13707 language=sr variant=sr-ec
13708 !! input
13709 Latinski: -{Ne nuntium necare}-
13710 !! result
13711 <p>Латински: Ne nuntium necare
13712 </p>
13713 !! end
13714
13715
13716 !! test
13717 Prevent conversion of text with -{}- tags (language variants)
13718 !! options
13719 language=sr variant=sr-ec
13720 !! input
13721 Latinski: -{Ne nuntium necare}-
13722 !! result
13723 <p>Латински: Ne nuntium necare
13724 </p>
13725 !! end
13726
13727
13728 !! test
13729 Prevent conversion of links with -{}- tags (language variants)
13730 !! options
13731 language=sr variant=sr-ec
13732 !! input
13733 -{[[Main Page]]}-
13734 !! result
13735 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13736 </p>
13737 !! end
13738
13739
13740 !! test
13741 -{}- tags within headlines (within html for parserConvert())
13742 !! options
13743 language=sr variant=sr-ec
13744 !! input
13745 == -{Naslov}- ==
13746 !! result
13747 <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>
13748
13749 !! end
13750
13751
13752 !! test
13753 Explicit definition of language variant alternatives
13754 !! options
13755 language=zh variant=zh-tw
13756 !! input
13757 -{zh:China;zh-tw:Taiwan}-, not China
13758 !! result
13759 <p>Taiwan, not China
13760 </p>
13761 !! end
13762
13763
13764 !! test
13765 Conversion around HTML tags
13766 !! options
13767 language=sr variant=sr-ec
13768 !! input
13769 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13770 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13771 !! result
13772 <p>
13773 <span title="ЛаCтин">ски</span>
13774 </p>
13775 !! end
13776
13777
13778 !! test
13779 Explicit session-wise language variant mapping (A flag and - flag)
13780 !! options
13781 language=zh variant=zh-tw
13782 !! input
13783 Taiwan is not China.
13784 But -{A|zh:China;zh-tw:Taiwan}- is China,
13785 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13786 and -{China}- is China.
13787 !! result
13788 <p>Taiwan is not China.
13789 But Taiwan is Taiwan,
13790 (This should be stripped!)
13791 and China is China.
13792 </p>
13793 !! end
13794
13795 !! test
13796 Explicit session-wise language variant mapping (H flag for hide)
13797 !! options
13798 language=zh variant=zh-tw
13799 !! input
13800 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13801 Taiwan is China.
13802 !! result
13803 <p>(This should be stripped!)
13804 Taiwan is Taiwan.
13805 </p>
13806 !! end
13807
13808 !! test
13809 Adding explicit conversion rule for title (T flag)
13810 !! options
13811 language=zh variant=zh-tw showtitle
13812 !! input
13813 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13814 !! result
13815 Taiwan
13816 <p>Should be stripped!
13817 </p>
13818 !! end
13819
13820 !! test
13821 Testing that changing the language variant here in the tests actually works
13822 !! options
13823 language=zh variant=zh showtitle
13824 !! input
13825 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13826 !! result
13827 China
13828 <p>Should be stripped!
13829 </p>
13830 !! end
13831
13832 !! test
13833 Recursive conversion of alt and title attrs shouldn't clear converter state
13834 !! options
13835 language=zh variant=zh-cn showtitle
13836 !! input
13837 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13838 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13839 !! result
13840 China
13841 <p>
13842 Should be stripped<span title="Exclamation">!</span>
13843 </p>
13844 !! end
13845
13846 !! test
13847 Bug 24072: more test on conversion rule for title
13848 !! options
13849 language=zh variant=zh-tw showtitle
13850 !! input
13851 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13852 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13853 !! result
13854 Taiwan
13855 <p>This should be stripped!
13856 This won't take interferes with the title rule.
13857 </p>
13858 !! end
13859
13860 !! test
13861 Partly disable title conversion if variant == main language code
13862 !! options
13863 language=zh variant=zh title=[[ZH]] showtitle
13864 !! input
13865 -{T|zh-cn:CN;zh-tw:TW}-
13866 !! result
13867 ZH
13868 <p>
13869 </p>
13870 !! end
13871
13872 !! test
13873 Partly disable title conversion if variant == main language code, more
13874 !! options
13875 language=zh variant=zh title=[[ZH]] showtitle
13876 !! input
13877 -{T|TW}-
13878 !! result
13879 ZH
13880 <p>
13881 </p>
13882 !! end
13883
13884 !! test
13885 Raw output of variant escape tags (R flag)
13886 !! options
13887 language=zh variant=zh-tw
13888 !! input
13889 Raw: -{R|zh:China;zh-tw:Taiwan}-
13890 !! result
13891 <p>Raw: zh:China;zh-tw:Taiwan
13892 </p>
13893 !! end
13894
13895 !! test
13896 Nested using of manual convert syntax
13897 !! options
13898 language=zh variant=zh-hk
13899 !! input
13900 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13901 !! result
13902 <p>Nested: Hello Hong Kong!
13903 </p>
13904 !! end
13905
13906 !! test
13907 Proper conversion of text in external links
13908 !! options
13909 language=sr variant=sr-ec
13910 !! input
13911 http://www.google.com
13912 gopher://www.google.com
13913 [http://www.google.com http://www.google.com]
13914 [gopher://www.google.com gopher://www.google.com]
13915 [https://www.google.com irc://www.google.com]
13916 [ftp://www.google.com www.google.com/ftp://dir]
13917 [//www.google.com www.google.com]
13918 !! result
13919 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13920 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13921 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13922 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13923 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13924 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13925 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13926 </p>
13927 !! end
13928
13929 !! test
13930 Do not convert roman numbers to language variants
13931 !! options
13932 language=sr variant=sr-ec
13933 !! input
13934 Fridrih IV je car.
13935 !! result
13936 <p>Фридрих IV је цар.
13937 </p>
13938 !! end
13939
13940 !! test
13941 Unclosed language converter markup "-{"
13942 !! options
13943 language=sr
13944 !! input
13945 -{T|hello
13946 !! result
13947 <p>-{T|hello
13948 </p>
13949 !! end
13950
13951 !! test
13952 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13953 !! options
13954 language=sr
13955 !! input
13956 -{R|=&gt;}-
13957 !! result
13958 <p>=&gt;
13959 </p>
13960 !!end
13961
13962 !! test
13963 Bug 529: Uncovered bullet
13964 !! input
13965 * Foo {{bullet}}
13966 !! result
13967 <ul><li> Foo
13968 </li><li> Bar
13969 </li></ul>
13970
13971 !! end
13972
13973 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13974 # Templates in Wikipedia rely on this behavior, as tidy has always been
13975 # enabled there. These tests are normally run *without* tidy, so specify the
13976 # full output here.
13977 # To test realistic parsing behavior, apply a tidy-like transformation to both
13978 # the expected output and your parser's output.
13979 !! test
13980 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13981 !! input
13982 ******* Foo {{bullet}}
13983 !! result
13984 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13985 </li></ul>
13986 </li></ul>
13987 </li></ul>
13988 </li></ul>
13989 </li></ul>
13990 </li></ul>
13991 </li><li> Bar
13992 </li></ul>
13993
13994 !! end
13995
13996 !! test
13997 Bug 529: Uncovered table already at line-start
13998 !! input
13999 x
14000
14001 {{table}}
14002 y
14003 !! result
14004 <p>x
14005 </p>
14006 <table>
14007 <tr>
14008 <td> 1 </td>
14009 <td> 2
14010 </td></tr>
14011 <tr>
14012 <td> 3 </td>
14013 <td> 4
14014 </td></tr></table>
14015 <p>y
14016 </p>
14017 !! end
14018
14019 !! test
14020 Bug 529: Uncovered bullet in parser function result
14021 !! input
14022 * Foo {{lc:{{bullet}} }}
14023 !! result
14024 <ul><li> Foo
14025 </li><li> bar
14026 </li></ul>
14027
14028 !! end
14029
14030 !! test
14031 Bug 5678: Double-parsed template argument
14032 !! input
14033 {{lc:{{{1}}}|hello}}
14034 !! result
14035 <p>{{{1}}}
14036 </p>
14037 !! end
14038
14039 !! test
14040 Bug 5678: Double-parsed template invocation
14041 !! input
14042 {{lc:{{paramtest {{!}} param = hello }} }}
14043 !! result
14044 <p>{{paramtest | param = hello }}
14045 </p>
14046 !! end
14047
14048 !! test
14049 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14050 !! options
14051 language=cs
14052 title=[[Main Page]]
14053 !! input
14054 {{PRVNÍVELKÉ:ěščř}}
14055 {{prvnívelké:ěščř}}
14056 {{PRVNÍMALÉ:ěščř}}
14057 {{prvnímalé:ěščř}}
14058 {{MALÁ:ěščř}}
14059 {{malá:ěščř}}
14060 {{VELKÁ:ěščř}}
14061 {{velká:ěščř}}
14062 !! result
14063 <p>Ěščř
14064 Ěščř
14065 ěščř
14066 ěščř
14067 ěščř
14068 ěščř
14069 ĚŠČŘ
14070 ĚŠČŘ
14071 </p>
14072 !! end
14073
14074 !! test
14075 Morwen/13: Unclosed link followed by heading
14076 !! input
14077 [[link
14078 ==heading==
14079 !! result
14080 <p>[[link
14081 </p>
14082 <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>
14083
14084 !! end
14085
14086 !! test
14087 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14088 !! input
14089 {{foo|
14090 =heading=
14091 !! result
14092 <p>{{foo|
14093 </p>
14094 <h1><span class="mw-headline" id="heading">heading</span></h1>
14095
14096 !! end
14097
14098 !! test
14099 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14100 !! input
14101 {{foo|
14102 ==heading==
14103 !! result
14104 <p>{{foo|
14105 </p>
14106 <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>
14107
14108 !! end
14109
14110 !! test
14111 Tildes in comments
14112 !! options
14113 pst
14114 !! input
14115 <!-- ~~~~ -->
14116 !! result
14117 <!-- ~~~~ -->
14118 !! end
14119
14120 !! test
14121 Paragraphs inside divs (no extra line breaks)
14122 !! input
14123 <div>Line one
14124
14125 Line two</div>
14126 !! result
14127 <div>Line one
14128 Line two</div>
14129
14130 !! end
14131
14132 !! test
14133 Paragraphs inside divs (extra line break on open)
14134 !! input
14135 <div>
14136 Line one
14137
14138 Line two</div>
14139 !! result
14140 <div>
14141 <p>Line one
14142 </p>
14143 Line two</div>
14144
14145 !! end
14146
14147 !! test
14148 Paragraphs inside divs (extra line break on close)
14149 !! input
14150 <div>Line one
14151
14152 Line two
14153 </div>
14154 !! result
14155 <div>Line one
14156 <p>Line two
14157 </p>
14158 </div>
14159
14160 !! end
14161
14162 !! test
14163 Paragraphs inside divs (extra line break on open and close)
14164 !! input
14165 <div>
14166 Line one
14167
14168 Line two
14169 </div>
14170 !! result
14171 <div>
14172 <p>Line one
14173 </p><p>Line two
14174 </p>
14175 </div>
14176
14177 !! end
14178
14179 !! test
14180 Nesting tags, paragraphs on lines which begin with <div>
14181 !! options
14182 disabled
14183 !! input
14184 <div></div><strong>A
14185 B</strong>
14186 !! result
14187 <div></div>
14188 <p><strong>A
14189 B</strong>
14190 </p>
14191 !! end
14192
14193 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14194 !! test
14195 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14196 !! options
14197 disabled
14198 !! input
14199 <blockquote>Line one
14200
14201 Line two</blockquote>
14202 !! result
14203 <blockquote>Line one
14204 Line two</blockquote>
14205
14206 !! end
14207
14208 !! test
14209 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14210 !! options
14211 disabled
14212 !! input
14213 <blockquote>
14214 Line one
14215
14216 Line two</blockquote>
14217 !! result
14218 <blockquote>
14219 <p>Line one
14220 </p>
14221 Line two</blockquote>
14222
14223 !! end
14224
14225 !! test
14226 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14227 !! options
14228 disabled
14229 !! input
14230 <blockquote>Line one
14231
14232 Line two
14233 </blockquote>
14234 !! result
14235 <blockquote>Line one
14236 <p>Line two
14237 </p>
14238 </blockquote>
14239
14240 !! end
14241
14242 !! test
14243 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14244 !! options
14245 disabled
14246 !! input
14247 <blockquote>
14248 Line one
14249
14250 Line two
14251 </blockquote>
14252 !! result
14253 <blockquote>
14254 <p>Line one
14255 </p><p>Line two
14256 </p>
14257 </blockquote>
14258
14259 !! end
14260
14261 !! test
14262 Paragraphs inside blockquotes/divs (no extra line breaks)
14263 !! input
14264 <blockquote><div>Line one
14265
14266 Line two</div></blockquote>
14267 !! result
14268 <blockquote><div>Line one
14269 Line two</div></blockquote>
14270
14271 !! end
14272
14273 !! test
14274 Paragraphs inside blockquotes/divs (extra line break on open)
14275 !! input
14276 <blockquote><div>
14277 Line one
14278
14279 Line two</div></blockquote>
14280 !! result
14281 <blockquote><div>
14282 <p>Line one
14283 </p>
14284 Line two</div></blockquote>
14285
14286 !! end
14287
14288 !! test
14289 Paragraphs inside blockquotes/divs (extra line break on close)
14290 !! input
14291 <blockquote><div>Line one
14292
14293 Line two
14294 </div></blockquote>
14295 !! result
14296 <blockquote><div>Line one
14297 <p>Line two
14298 </p>
14299 </div></blockquote>
14300
14301 !! end
14302
14303 !! test
14304 Paragraphs inside blockquotes/divs (extra line break on open and close)
14305 !! input
14306 <blockquote><div>
14307 Line one
14308
14309 Line two
14310 </div></blockquote>
14311 !! result
14312 <blockquote><div>
14313 <p>Line one
14314 </p><p>Line two
14315 </p>
14316 </div></blockquote>
14317
14318 !! end
14319
14320 !! test
14321 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14322 !! options
14323 wgLinkHolderBatchSize=0
14324 !! input
14325 [[meatball:1]]
14326 [[meatball:2]]
14327 [[meatball:3]]
14328 !! result
14329 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14330 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14331 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14332 </p>
14333 !! end
14334
14335 !! test
14336 Free external link invading image caption
14337 !! input
14338 [[Image:Foobar.jpg|thumb|http://x|hello]]
14339 !! result
14340 <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>
14341
14342 !! end
14343
14344 !! test
14345 Bug 15196: localised external link numbers
14346 !! options
14347 language=fa
14348 !! input
14349 [http://en.wikipedia.org/]
14350 !! result
14351 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14352 </p>
14353 !! end
14354
14355 !! test
14356 Multibyte character in padleft
14357 !! input
14358 {{padleft:-Hello|7|Æ}}
14359 !! result
14360 <p>Æ-Hello
14361 </p>
14362 !! end
14363
14364 !! test
14365 Multibyte character in padright
14366 !! input
14367 {{padright:Hello-|7|Æ}}
14368 !! result
14369 <p>Hello-Æ
14370 </p>
14371 !! end
14372
14373 !!test
14374 formatdate parser function
14375 !!input
14376 {{#formatdate:2009-03-24}}
14377 !! result
14378 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14379 </p>
14380 !! end
14381
14382 !!test
14383 formatdate parser function, with default format
14384 !!input
14385 {{#formatdate:2009-03-24|mdy}}
14386 !! result
14387 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14388 </p>
14389 !! end
14390
14391 !! test
14392 Spacing of numbers in formatted dates
14393 !! input
14394 {{#formatdate:January 15}}
14395 !! result
14396 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14397 </p>
14398 !! end
14399
14400 !! test
14401 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
14402 !! options
14403 language=nl title=[[MediaWiki:Common.css]]
14404 !! input
14405 {{#formatdate:2009-03-24|dmy}}
14406 !! result
14407 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14408 </p>
14409 !! end
14410
14411 #
14412 #
14413 #
14414
14415 #
14416 # Edit comments
14417 #
14418
14419 !! test
14420 Edit comment with link
14421 !! options
14422 comment
14423 !! input
14424 I like the [[Main Page]] a lot
14425 !! result
14426 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14427 !!end
14428
14429 !! test
14430 Edit comment with link and link text
14431 !! options
14432 comment
14433 !! input
14434 I like the [[Main Page|best pages]] a lot
14435 !! result
14436 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14437 !!end
14438
14439 !! test
14440 Edit comment with link and link text with suffix
14441 !! options
14442 comment
14443 !! input
14444 I like the [[Main Page|best page]]s a lot
14445 !! result
14446 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14447 !!end
14448
14449 !! test
14450 Edit comment with section link (non-local, eg in history list)
14451 !! options
14452 comment title=[[Main Page]]
14453 !! input
14454 /* External links */ removed bogus entries
14455 !! result
14456 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14457 !!end
14458
14459 !! test
14460 Edit comment with section link and text before it (non-local, eg in history list)
14461 !! options
14462 comment title=[[Main Page]]
14463 !! input
14464 pre-comment text /* External links */ removed bogus entries
14465 !! result
14466 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>
14467 !!end
14468
14469 !! test
14470 Edit comment with section link (local, eg in diff view)
14471 !! options
14472 comment local title=[[Main Page]]
14473 !! input
14474 /* External links */ removed bogus entries
14475 !! result
14476 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14477 !!end
14478
14479 !! test
14480 Edit comment with subpage link (bug 14080)
14481 !! options
14482 comment
14483 subpage
14484 title=[[Subpage test]]
14485 !! input
14486 Poked at a [[/subpage]] here...
14487 !! result
14488 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14489 !!end
14490
14491 !! test
14492 Edit comment with subpage link and link text (bug 14080)
14493 !! options
14494 comment
14495 subpage
14496 title=[[Subpage test]]
14497 !! input
14498 Poked at a [[/subpage|neat little page]] here...
14499 !! result
14500 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14501 !!end
14502
14503 !! test
14504 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14505 !! options
14506 comment
14507 title=[[Subpage test]]
14508 !! input
14509 Poked at a [[/subpage]] here...
14510 !! result
14511 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...
14512 !!end
14513
14514 !! test
14515 Edit comment with bare anchor link (local, as on diff)
14516 !! options
14517 comment
14518 local
14519 title=[[Main Page]]
14520 !!input
14521 [[#section]]
14522 !! result
14523 <a href="#section">#section</a>
14524 !! end
14525
14526 !! test
14527 Edit comment with bare anchor link (non-local, as on history)
14528 !! options
14529 comment
14530 title=[[Main Page]]
14531 !!input
14532 [[#section]]
14533 !! result
14534 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14535 !! end
14536
14537 !! test
14538 Anchor starting with underscore
14539 !!input
14540 [[#_ref|One]]
14541 !! result
14542 <p><a href="#_ref">One</a>
14543 </p>
14544 !! end
14545
14546 !! test
14547 Id starting with underscore
14548 !!input
14549 <div id="_ref"></div>
14550 !! result
14551 <div id="_ref"></div>
14552
14553 !! end
14554
14555 !! test
14556 Space normalisation on autocomment (bug 22784)
14557 !! options
14558 comment
14559 title=[[Main Page]]
14560 !!input
14561 /* __hello__world__ */
14562 !! result
14563 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14564 !! end
14565
14566 !! test
14567 percent-encoding and + signs in comments (Bug 26410)
14568 !! options
14569 comment
14570 !!input
14571 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14572 !! result
14573 <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>
14574 !! end
14575
14576 !! test
14577 Bad images - basic functionality
14578 !! options
14579 disabled
14580 !! input
14581 [[File:Bad.jpg]]
14582 !! result
14583 !! end
14584
14585 !! test
14586 Bad images - bug 16039: text after bad image disappears
14587 !! options
14588 disabled
14589 !! input
14590 Foo bar
14591 [[File:Bad.jpg]]
14592 Bar foo
14593 !! result
14594 <p>Foo bar
14595 </p><p>Bar foo
14596 </p>
14597 !! end
14598
14599 !! test
14600 Verify that displaytitle works (bug #22501) no displaytitle
14601 !! options
14602 showtitle
14603 !! config
14604 wgAllowDisplayTitle=true
14605 wgRestrictDisplayTitle=false
14606 !! input
14607 this is not the the title
14608 !! result
14609 Parser test
14610 <p>this is not the the title
14611 </p>
14612 !! end
14613
14614 !! test
14615 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14616 !! options
14617 showtitle
14618 title=[[Screen]]
14619 !! config
14620 wgAllowDisplayTitle=true
14621 wgRestrictDisplayTitle=false
14622 !! input
14623 this is not the the title
14624 {{DISPLAYTITLE:whatever}}
14625 !! result
14626 whatever
14627 <p>this is not the the title
14628 </p>
14629 !! end
14630
14631 !! test
14632 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14633 !! options
14634 showtitle
14635 title=[[Screen]]
14636 !! config
14637 wgAllowDisplayTitle=true
14638 wgRestrictDisplayTitle=true
14639 !! input
14640 this is not the the title
14641 {{DISPLAYTITLE:whatever}}
14642 !! result
14643 Screen
14644 <p>this is not the the title
14645 </p>
14646 !! end
14647
14648 !! test
14649 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14650 !! options
14651 showtitle
14652 title=[[Screen]]
14653 !! config
14654 wgAllowDisplayTitle=true
14655 wgRestrictDisplayTitle=true
14656 !! input
14657 this is not the the title
14658 {{DISPLAYTITLE:screen}}
14659 !! result
14660 screen
14661 <p>this is not the the title
14662 </p>
14663 !! end
14664
14665 !! test
14666 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14667 !! options
14668 showtitle
14669 title=[[Screen]]
14670 !! config
14671 wgAllowDisplayTitle=false
14672 !! input
14673 this is not the the title
14674 {{DISPLAYTITLE:screen}}
14675 !! result
14676 Screen
14677 <p>this is not the the title
14678 <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>
14679 </p>
14680 !! end
14681
14682 !! test
14683 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14684 !! options
14685 showtitle
14686 title=[[Screen]]
14687 !! config
14688 wgAllowDisplayTitle=false
14689 !! input
14690 this is not the the title
14691 !! result
14692 Screen
14693 <p>this is not the the title
14694 </p>
14695 !! end
14696
14697 !! test
14698 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14699 !! options
14700 showtitle
14701 title=[[Screen]]
14702 !! config
14703 wgAllowDisplayTitle=true
14704 wgRestrictDisplayTitle=true
14705 !! input
14706 this is not the the title
14707 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14708 !! result
14709 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14710 <p>this is not the the title
14711 </p>
14712 !! end
14713
14714 !! test
14715 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14716 !! options
14717 showtitle
14718 title=[[Screen]]
14719 !! config
14720 wgAllowDisplayTitle=true
14721 wgRestrictDisplayTitle=true
14722 !! input
14723 this is not the the title
14724 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14725 !! result
14726 <span style="color: red;">s</span>creen
14727 <p>this is not the the title
14728 </p>
14729 !! end
14730
14731 !! test
14732 preload: check <noinclude> and <includeonly>
14733 !! options
14734 preload
14735 !! input
14736 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14737 !! result
14738 Hello kind world.
14739 !! end
14740
14741 !! test
14742 preload: check <onlyinclude>
14743 !! options
14744 preload
14745 !! input
14746 Goodbye <onlyinclude>Hello world</onlyinclude>
14747 !! result
14748 Hello world
14749 !! end
14750
14751 !! test
14752 preload: can pass tags through if we want to
14753 !! options
14754 preload
14755 !! input
14756 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14757 !! result
14758 <includeonly>Hello world</includeonly>
14759 !! end
14760
14761 !! test
14762 preload: check that it doesn't try to do tricks
14763 !! options
14764 preload
14765 !! input
14766 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14767 !! result
14768 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14769 !! end
14770
14771 !! test
14772 Play a bit with r67090 and bug 3158
14773 !! options
14774 disabled
14775 !! input
14776 <div style="width:50% !important">&nbsp;</div>
14777 <div style="width:50%&nbsp;!important">&nbsp;</div>
14778 <div style="width:50%&#160;!important">&nbsp;</div>
14779 <div style="border : solid;">&nbsp;</div>
14780 !! result
14781 <div style="width:50% !important">&nbsp;</div>
14782 <div style="width:50% !important">&nbsp;</div>
14783 <div style="width:50% !important">&nbsp;</div>
14784 <div style="border&#160;: solid;">&nbsp;</div>
14785
14786 !! end
14787
14788 !! test
14789 HTML5 data attributes
14790 !! input
14791 <span data-foo="bar">Baz</span>
14792 <p data-abc-def_hij="">Quuz</p>
14793 !! result
14794 <p><span data-foo="bar">Baz</span>
14795 </p>
14796 <p data-abc-def_hij="">Quuz</p>
14797
14798 !! end
14799
14800 !! test
14801 percent-encoding and + signs in internal links (Bug 26410)
14802 !! input
14803 [[User:+%]] [[Page+title%]]
14804 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14805 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14806 [[%33%45]] [[%33%45+]]
14807 !! result
14808 <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>
14809 <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>
14810 <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>
14811 <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>
14812 </p>
14813 !! end
14814
14815 !! test
14816 Special characters in embedded file links (bug 27679)
14817 !! input
14818 [[File:Contains & ampersand.jpg]]
14819 [[File:Does not exist.jpg|Title with & ampersand]]
14820 !! result
14821 <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>
14822 <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>
14823 </p>
14824 !! end
14825
14826
14827 !! test
14828 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14829 !! input
14830 Text&apos;s been normalized?
14831 !! result
14832 <p>Text&#39;s been normalized?
14833 </p>
14834 !! end
14835
14836 !! test
14837 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14838 !! input
14839 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14840 !! result
14841 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14842 </p>
14843 !! end
14844
14845 !! test
14846 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14847 !! input
14848 [http://www.example.org/ ideograms]
14849 !! result
14850 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14851 </p>
14852 !! end
14853
14854 !! test
14855 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14856 !! input
14857 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14858 !! result
14859 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14860 </p>
14861 !! end
14862
14863 !! article
14864 Mediawiki:loop1
14865 !! text
14866 {{Identical|A}}
14867 !! endarticle
14868
14869 !! article
14870 Mediawiki:loop2
14871 !! text
14872 {{Identical|B}}
14873 !! endarticle
14874
14875 !! article
14876 Template:Identical
14877 !! text
14878 {{int:loop1}}
14879 {{int:loop2}}
14880 !! endarticle
14881
14882 !! test
14883 Bug 31098 Template which includes system messages which includes the template
14884 !! input
14885 {{Identical}}
14886 !! result
14887 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14888 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14889 </p>
14890 !! end
14891
14892 !! test
14893 Bug31490 Turkish: ucfirst 'blah'
14894 !! options
14895 language=tr
14896 !! input
14897 {{ucfirst:blah}}
14898 !! result
14899 <p>Blah
14900 </p>
14901 !! end
14902
14903 !! test
14904 Bug31490 Turkish: ucfirst 'ix'
14905 !! options
14906 language=tr
14907 !! input
14908 {{ucfirst:ix}}
14909 !! result
14910 <p>İx
14911 </p>
14912 !! end
14913
14914 !! test
14915 Bug31490 Turkish: lcfirst 'BLAH'
14916 !! options
14917 language=tr
14918 !! input
14919 {{lcfirst:BLAH}}
14920 !! result
14921 <p>bLAH
14922 </p>
14923 !! end
14924
14925 !! test
14926 Bug31490 Turkish: ucfırst (with a dotless i)
14927 !! options
14928 language=tr
14929 !! input
14930 {{ucfırst:blah}}
14931 !! result
14932 <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>
14933 </p>
14934 !! end
14935
14936 !! test
14937 Bug31490 ucfırst (with a dotless i) with English language
14938 !! options
14939 language=en
14940 !! input
14941 {{ucfırst:blah}}
14942 !! result
14943 <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>
14944 </p>
14945 !! end
14946
14947 !! test
14948 Bug 26375: TOC with italics
14949 !! options
14950 title=[[Main Page]]
14951 !! input
14952 __TOC__
14953 == ''Lost'' episodes ==
14954 !! result
14955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14956 <ul>
14957 <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>
14958 </ul>
14959 </div>
14960 <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>
14961
14962 !! end
14963
14964 !! test
14965 Bug 26375: TOC with bold
14966 !! options
14967 title=[[Main Page]]
14968 !! input
14969 __TOC__
14970 == '''should be bold''' then normal text ==
14971 !! result
14972 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14973 <ul>
14974 <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>
14975 </ul>
14976 </div>
14977 <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>
14978
14979 !! end
14980
14981 !! test
14982 Bug 33845: Headings become cursive in TOC when they contain an image
14983 !! options
14984 title=[[Main Page]]
14985 !! input
14986 __TOC__
14987 == Image [[Image:foobar.jpg]] ==
14988 !! result
14989 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14990 <ul>
14991 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14992 </ul>
14993 </div>
14994 <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>
14995
14996 !! end
14997
14998 !! test
14999 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15000 !! options
15001 title=[[Main Page]]
15002 !! input
15003 __TOC__
15004 == <blockquote>Quote</blockquote> ==
15005 !! result
15006 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15007 <ul>
15008 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15009 </ul>
15010 </div>
15011 <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>
15012
15013 !! end
15014
15015 !! test
15016 Unclosed tags in TOC
15017 !! options
15018 title=[[Main Page]]
15019 !! input
15020 __TOC__
15021 == Proof: 2 < 3 ==
15022 <small>Hanc marginis exiguitas non caperet.</small>
15023 QED
15024 !! result
15025 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15026 <ul>
15027 <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>
15028 </ul>
15029 </div>
15030 <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>
15031 <p><small>Hanc marginis exiguitas non caperet.</small>
15032 QED
15033 </p>
15034 !! end
15035
15036 !! test
15037 Multiple tags in TOC
15038 !! input
15039 __TOC__
15040 == <i>Foo</i> <b>Bar</b> ==
15041
15042 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15043 !! result
15044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15045 <ul>
15046 <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>
15047 <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>
15048 </ul>
15049 </div>
15050 <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>
15051 <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>
15052
15053 !! end
15054
15055 !! test
15056 Tags with parameters in TOC
15057 !! input
15058 __TOC__
15059 == <sup class="in-h2">Hello</sup> ==
15060
15061 == <sup class="a > b">Evilbye</sup> ==
15062 !! result
15063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15064 <ul>
15065 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15066 <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>
15067 </ul>
15068 </div>
15069 <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>
15070 <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>
15071
15072 !! end
15073
15074 !! test
15075 span tags with directionality in TOC
15076 !! input
15077 __TOC__
15078 == <span dir="ltr">C++</span> ==
15079
15080 == <span dir="rtl">זבנג!</span> ==
15081
15082 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15083
15084 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15085
15086 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15087 !! result
15088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15089 <ul>
15090 <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>
15091 <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>
15092 <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>
15093 <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>
15094 <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>
15095 </ul>
15096 </div>
15097 <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>
15098 <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>
15099 <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>
15100 <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>
15101 <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>
15102
15103 !! end
15104
15105 !! article
15106 MediaWiki:Bug32057
15107 !! text
15108 == {{int:headline_sample}} ==
15109 !! endarticle
15110
15111 !! test
15112 Bug 32057: Title needed when expanding <h> nodes.
15113 !! options
15114 title=[[Main Page]]
15115 !! input
15116 {{int:Bug32057}}
15117 !! result
15118 <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>
15119
15120 !! end
15121
15122 !! test
15123 Strip marker in urlencode
15124 !! input
15125 {{urlencode:x<nowiki/>y}}
15126 {{urlencode:x<nowiki/>y|wiki}}
15127 {{urlencode:x<nowiki/>y|path}}
15128 !! result
15129 <p>xy
15130 xy
15131 xy
15132 </p>
15133 !! end
15134
15135 !! test
15136 Strip marker in lc
15137 !! input
15138 {{lc:x<nowiki/>y}}
15139 !! result
15140 <p>xy
15141 </p>
15142 !! end
15143
15144 !! test
15145 Strip marker in uc
15146 !! input
15147 {{uc:x<nowiki/>y}}
15148 !! result
15149 <p>XY
15150 </p>
15151 !! end
15152
15153 !! test
15154 Strip marker in formatNum
15155 !! input
15156 {{formatnum:1<nowiki/>2}}
15157 {{formatnum:1<nowiki/>2|R}}
15158 !! result
15159 <p>12
15160 12
15161 </p>
15162 !! end
15163
15164 !! test
15165 Check noCommafy in formatNum
15166 !! options
15167 language=be-tarask
15168 !! input
15169 {{formatnum:123456.78}}
15170 {{formatnum:123456.78|NOSEP}}
15171 !! result
15172 <p>123 456,78
15173 123456.78
15174 </p>
15175 !! end
15176
15177 !! test
15178 Strip marker in grammar
15179 !! options
15180 language=fi
15181 !! input
15182 {{grammar:elative|foo<nowiki/>bar}}
15183 !! result
15184 <p>foobarista
15185 </p>
15186 !! end
15187
15188 !! test
15189 Strip marker in padleft
15190 !! input
15191 {{padleft:|2|x<nowiki/>y}}
15192 !! result
15193 <p>xy
15194 </p>
15195 !! end
15196
15197 !! test
15198 Strip marker in padright
15199 !! input
15200 {{padright:|2|x<nowiki/>y}}
15201 !! result
15202 <p>xy
15203 </p>
15204 !! end
15205
15206 !! test
15207 Strip marker in anchorencode
15208 !! input
15209 {{anchorencode:x<nowiki/>y}}
15210 !! result
15211 <p>xy
15212 </p>
15213 !! end
15214
15215 !! test
15216 nowiki inside link inside heading (bug 18295)
15217 !! input
15218 ==[[foo|x<nowiki>y</nowiki>z]]==
15219 !! result
15220 <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>
15221
15222 !! end
15223
15224 !! test
15225 new support for bdi element (bug 31817)
15226 !! input
15227 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15228 !! result
15229 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15230
15231 !!end
15232
15233 !! test
15234 Ignore pipe between table row attributes
15235 !! input
15236 {|
15237 | quux
15238 |- id=foo | style='color: red'
15239 | bar
15240 |}
15241 !! result
15242 <table>
15243 <tr>
15244 <td> quux
15245 </td></tr>
15246 <tr id="foo" style="color: red">
15247 <td> bar
15248 </td></tr></table>
15249
15250 !! end
15251
15252 !!test
15253 Gallery override link with WikiLink (bug 34852)
15254 !! input
15255 <gallery>
15256 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15257 </gallery>
15258 !! result
15259 <ul class="gallery mw-gallery-traditional">
15260 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15261 <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>
15262 <div class="gallerytext">
15263 <p>caption
15264 </p>
15265 </div>
15266 </div></li>
15267 </ul>
15268
15269 !! end
15270
15271 !!test
15272 Gallery override link with absolute external link (bug 34852)
15273 !! input
15274 <gallery>
15275 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15276 </gallery>
15277 !! result
15278 <ul class="gallery mw-gallery-traditional">
15279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15280 <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>
15281 <div class="gallerytext">
15282 <p>caption
15283 </p>
15284 </div>
15285 </div></li>
15286 </ul>
15287
15288 !! end
15289
15290 !!test
15291 Gallery override link with malicious javascript (bug 34852)
15292 !! input
15293 <gallery>
15294 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15295 </gallery>
15296 !! result
15297 <ul class="gallery mw-gallery-traditional">
15298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15299 <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>
15300 <div class="gallerytext">
15301 <p>caption
15302 </p>
15303 </div>
15304 </div></li>
15305 </ul>
15306
15307 !! end
15308
15309 !!test
15310 Gallery with invalid title as link (bug 43964)
15311 !! input
15312 <gallery>
15313 File:foobar.jpg|link=<
15314 </gallery>
15315 !! result
15316 <ul class="gallery mw-gallery-traditional">
15317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15318 <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>
15319 <div class="gallerytext">
15320 </div>
15321 </div></li>
15322 </ul>
15323
15324 !! end
15325
15326 !!test
15327 Language parser function
15328 !! input
15329 {{#language:ar}}
15330 !! result
15331 <p>العربية
15332 </p>
15333 !! end
15334
15335 !!test
15336 Padleft and padright as substr
15337 !! input
15338 {{padleft:|3|abcde}}
15339 {{padright:|3|abcde}}
15340 !! result
15341 <p>abc
15342 abc
15343 </p>
15344 !! end
15345
15346 !!test
15347 Special parser function
15348 !! input
15349 {{#special:RandomPage}}
15350 {{#special:BaDtItLe}}
15351 {{#special:Foobar}}
15352 !! result
15353 <p>Special:Random
15354 Special:Badtitle
15355 Special:Foobar
15356 </p>
15357 !! end
15358
15359 !!test
15360 Bug 34939 - Case insensitive link parsing ([HttP://])
15361 !! input
15362 [HttP://MediaWiki.Org/]
15363 !! result
15364 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15365 </p>
15366 !! end
15367
15368 !!test
15369 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15370 !! input
15371 [HttP://MediaWiki.Org/ MediaWiki]
15372 !! result
15373 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15374 </p>
15375 !! end
15376
15377 !!test
15378 Bug 34939 - Case insensitive link parsing (HttP://)
15379 !! input
15380 HttP://MediaWiki.Org/
15381 !! result
15382 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15383 </p>
15384 !! end
15385
15386
15387 ###
15388 ### Parsoids-specific tests
15389 ### Parsoid-PHP parser incompatibilities
15390 ###
15391 !!test
15392 1. SOL-sensitive wikitext tokens as template-args
15393 !!options
15394 parsoid=wt2html,wt2wt
15395 !!input
15396 {{echo|*a}}
15397 {{echo|#a}}
15398 {{echo|:a}}
15399 !!result
15400 <span about="#mwt1" typeof="mw:Transclusion">
15401 </span><ul about="#mwt1"><li>a</li></ul>
15402 <span about="#mwt2" typeof="mw:Transclusion">
15403 </span><ol about="#mwt2"><li>a</li></ol>
15404 <span about="#mwt3" typeof="mw:Transclusion">
15405 </span><dl about="#mwt3"><dd>a</dd></dl>
15406 !!end
15407
15408 #### ----------------------------------------------------------------
15409 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15410 #### tags. Parsoid's output for these tags differs from that of the
15411 #### PHP parser.
15412 #### ----------------------------------------------------------------
15413
15414 !!test
15415 Ref: 1. ref-location should be replaced with an index span
15416 !!options
15417 parsoid
15418 !!input
15419 A <ref>foo</ref>
15420 B <ref name="x">foo</ref>
15421 C <ref name="y" />
15422 !!result
15423 <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>
15424 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>
15425 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>
15426 !!end
15427
15428 !!test
15429 Ref: 2. ref-tags with identical names should all get the same index
15430 !!options
15431 parsoid
15432 !!input
15433 A <ref name="x">foo</ref>
15434 B <ref name="x" />
15435 !!result
15436 <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>
15437 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>
15438 !!end
15439
15440 !!test
15441 Ref: 3. spaces in ref-names should be ignored
15442 !!options
15443 parsoid
15444 !!input
15445 A <ref name="x">foo</ref>
15446 B <ref name=" x " />
15447 C <ref name= x />
15448 !!result
15449 <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>
15450 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>
15451 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>
15452 !!end
15453
15454 !!test
15455 Ref: 4. 'constructor' should be accepted as a valid ref-name
15456 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15457 !!options
15458 parsoid
15459 !!input
15460 A <ref name="constructor">foo</ref>
15461 !!result
15462 <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>
15463 !!end
15464
15465 !!test
15466 Ref: 5. body should accept generic wikitext
15467 !!options
15468 parsoid
15469 !!input
15470 A <ref>
15471 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15472 </ref>
15473
15474 <references />
15475 !!result
15476 <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>
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> 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>
15480 </li></ol>
15481 !!end
15482
15483 !!test
15484 Ref: 6. indent-pres should not be output in ref-body
15485 !!options
15486 parsoid
15487 !!input
15488 A <ref>
15489 foo
15490 bar
15491 baz
15492 </ref>
15493
15494 <references />
15495 !!result
15496 <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>
15497
15498 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15499 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15500 bar
15501 baz
15502 </li></ol>
15503 !!end
15504
15505 !!test
15506 Ref: 6. No p-wrapping in ref-body
15507 !!options
15508 parsoid
15509 !!input
15510 A <ref>
15511 foo
15512
15513 bar
15514
15515
15516 baz
15517
15518
15519
15520 booz
15521 </ref>
15522
15523 <references />
15524 !!result
15525 <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>
15526
15527 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15528 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15529
15530 bar
15531
15532
15533 baz
15534
15535
15536
15537 booz
15538 </li></ol>
15539 !!end
15540
15541 !!test
15542 Ref: 8. transclusion wikitext has lower precedence
15543 !!options
15544 parsoid
15545 !!input
15546 A <ref> foo {{echo|</ref> B C}}
15547
15548 <references />
15549 !!result
15550 <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>
15551
15552 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15553 <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>
15554 !!end
15555
15556 !!test
15557 Ref: 9. unclosed comments should not leak out of ref-body
15558 !!options
15559 parsoid
15560 !!input
15561 A <ref> foo <!--</ref> B C
15562
15563 <references />
15564 !!result
15565 <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>
15566
15567 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15568 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15569 !!end
15570
15571 !!test
15572 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15573 !!options
15574 parsoid
15575 !!input
15576 A <ref> <b> foo </ref> B C
15577
15578 <references />
15579 !!result
15580 <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>
15581
15582 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15583 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
15584 !!end
15585
15586 !!test
15587 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15588 !!options
15589 parsoid
15590 !!input
15591 A <ref>foo</ref> B
15592 C <ref>bar</ref> D
15593 !!result
15594 <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
15595 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>
15596 !!end
15597
15598 !!test
15599 Ref: 12. ref-tags act as trailing newline migration barrier
15600 !!options
15601 parsoid
15602 !!input
15603 <!--the newline at the end of this line moves out of the p-tag-->a
15604
15605 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15606 <ref />
15607
15608 c
15609 !!result
15610 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15611
15612
15613 <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>
15614 <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>
15615
15616
15617 <p>c</p>
15618 !!end
15619
15620 !!test
15621 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15622 !!options
15623 parsoid
15624 !!input
15625 <ref>foo</ref> A
15626 <ref>bar
15627 </ref> B
15628 !!result
15629 <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
15630 <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>
15631 !!end
15632
15633 !!test
15634 Ref: 14. A nested ref-tag should be emitted as plain text
15635 !!options
15636 parsoid
15637 !!input
15638 <ref>foo <ref>bar</ref> baz</ref>
15639
15640 <references />
15641 !!result
15642 <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>
15643
15644 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15645 <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>
15646 !!end
15647
15648 !!test
15649 Ref: 15. ref-tags with identical names should get identical indexes
15650 !!options
15651 parsoid
15652 !!input
15653 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15654 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15655
15656 <references />
15657 !!result
15658 <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>
15659 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>
15660
15661 <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>
15662 !!end
15663
15664 !!test
15665 References: 1. references tag without any refs should be handled properly
15666 !!options
15667 parsoid
15668 !!input
15669 <references />
15670 !!result
15671 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15672 !!end
15673
15674 !!test
15675 References: 2. references tag with group only outputs references from that group
15676 !!options
15677 parsoid
15678 !!input
15679 A <ref group="a">foo</ref>
15680 B <ref group="b">bar</ref>
15681
15682 <references group='a' />
15683 !!result
15684 <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>
15685 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>
15686
15687 <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>
15688 !!end
15689
15690 !!test
15691 References: 3. ref list should be cleared after processing references
15692 !!options
15693 parsoid
15694 !!input
15695 A <ref>foo</ref>
15696
15697 <references />
15698
15699 B <ref>bar</ref>
15700
15701 <references />
15702 !!result
15703 <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>
15704
15705 <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>
15706
15707 <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>
15708
15709 <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>
15710 !!end
15711
15712 !!test
15713 References: 4. only referenced group should be cleared after processing references
15714 !!options
15715 parsoid
15716 !!input
15717 A <ref group="a">afoo</ref>
15718 B <ref>bfoo</ref>
15719
15720 <references group="a"/>
15721
15722 C <ref>cfoo</ref>
15723
15724 <references />
15725 !!result
15726 <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>
15727 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>
15728
15729 <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>
15730
15731 <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>
15732
15733 <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>
15734 !!end
15735
15736 !!test
15737 References: 5. ref tags in references should be processed while ignoring all other content
15738 !!options
15739 parsoid
15740 !!input
15741 A <ref name="a" />
15742 B <ref name="b">bar</ref>
15743
15744 <references>
15745 <ref name="a">foo</ref>
15746 This should just get lost.
15747 </references>
15748 !!result
15749 <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>
15750 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>
15751
15752 <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>
15753 !!end
15754
15755 !!test
15756 References: 6. <references /> from a transclusion
15757 !!options
15758 parsoid
15759 !!input
15760 {{echo|<references />}}
15761 !!result
15762 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15763 !!end
15764
15765 !! test
15766 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15767 !! options
15768 parsoid
15769 !! input
15770 A <ref>foo bar for a</ref>
15771 B <ref name="b" />
15772
15773 <references />
15774
15775 <references>
15776 <ref name="b">foo</ref>
15777 </references>
15778 !! result
15779 <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>
15780 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>
15781
15782 <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>
15783
15784 <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>
15785
15786 !! end
15787
15788 #### ----------------------------------------------------------------
15789 #### The following section of tests are primarily to test
15790 #### wikitext escaping capabilities of Parsoid. Given that
15791 #### escaping can be done any number of ways, the wikitext (input)
15792 #### is always adjusted to reflect how Parsoid adds nowiki
15793 #### escape tags.
15794 ####
15795 #### We are marking several tests as parsoid-only since the
15796 #### HTML in the result section is different from what the
15797 #### PHP parser generates for it.
15798 #### ----------------------------------------------------------------
15799
15800
15801 #### --------------- Headings ---------------
15802 #### 0. Unnested
15803 #### 1. Nested inside html <h1>=foo=</h1>
15804 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15805 #### 3. Nested inside html with wikitext split by html tags
15806 #### 4. No escape needed
15807 #### 5. Empty headings <h1></h1>
15808 #### 6. Heading chars in SOL context
15809 #### ----------------------------------------
15810 !! test
15811 Headings: 0. Unnested
15812 !! options
15813 parsoid
15814 !! input
15815 <nowiki>=foo=</nowiki>
15816
15817 <nowiki> =foo= </nowiki>
15818 <!--cmt-->
15819 <nowiki>=foo=</nowiki>
15820
15821 =foo''a''<nowiki>=</nowiki>
15822 !! result
15823 <p><span typeof="mw:Nowiki">=foo=</span></p>
15824
15825 <p><span typeof="mw:Nowiki"> =foo= </span>
15826 <!--cmt-->
15827 <span typeof="mw:Nowiki">=foo=</span></p>
15828
15829 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15830 !!end
15831
15832 !! test
15833 Headings: 1. Nested inside html
15834 !! options
15835 parsoid
15836 !! input
15837 =<nowiki>=foo=</nowiki>=
15838
15839 ==<nowiki>=foo=</nowiki>==
15840
15841 ===<nowiki>=foo=</nowiki>===
15842
15843 ====<nowiki>=foo=</nowiki>====
15844
15845 =====<nowiki>=foo=</nowiki>=====
15846
15847 ======<nowiki>=foo=</nowiki>======
15848 !! result
15849 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15850 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15851 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15852 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15853 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15854 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15855 !!end
15856
15857 !! test
15858 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15859 !! options
15860 parsoid
15861 !! input
15862 =foo=
15863 <nowiki>*</nowiki>bar
15864
15865 =foo=
15866 =bar
15867
15868 =foo=
15869 <nowiki>=bar=</nowiki>
15870 !! result
15871 <h1>foo</h1>*bar
15872 <h1>foo</h1>=bar
15873 <h1>foo</h1>=bar=
15874 !!end
15875
15876 !! test
15877 Headings: 3. Nested inside html with wikitext split by html tags
15878 !! options
15879 parsoid
15880 !! input
15881 =='''bold'''<nowiki>foo=</nowiki>=
15882 !! result
15883 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15884 !!end
15885
15886 !! test
15887 Headings: 4a. No escaping needed (testing just h1 and h2)
15888 !! options
15889 parsoid
15890 !! input
15891 ==foo=
15892
15893 =foo==
15894
15895 = =foo= =
15896
15897 ==foo= bar=
15898
15899 ===foo==
15900
15901 ==foo===
15902
15903 =''=''foo==
15904
15905 =<nowiki>=</nowiki>=
15906 !! result
15907 <h1>=foo</h1>
15908 <h1>foo=</h1>
15909 <h1> =foo= </h1>
15910 <h1>=foo= bar</h1>
15911 <h2>=foo</h2>
15912 <h2>foo=</h2>
15913 <h1><i>=</i>foo=</h1>
15914 <h1><span typeof="mw:Nowiki">=</span></h1>
15915 !!end
15916
15917 !! test
15918 Headings: 4b. No escaping needed (inside p-tags)
15919 !! options
15920 parsoid
15921 !! input
15922 ===
15923 =foo= x
15924 =foo= <s></s>
15925 !! result
15926 <p>===
15927 =foo= x
15928 =foo= <s></s>
15929 </p>
15930 !!end
15931
15932 !! test
15933 Headings: 5. Empty headings
15934 !! options
15935 parsoid
15936 !! input
15937 =<nowiki/>=
15938
15939 ==<nowiki/>==
15940
15941 ===<nowiki/>===
15942
15943 ====<nowiki/>====
15944
15945 =====<nowiki/>=====
15946
15947 ======<nowiki/>======
15948 !! result
15949 <h1></h1>
15950 <h2></h2>
15951 <h3></h3>
15952 <h4></h4>
15953 <h5></h5>
15954 <h6></h6>
15955 !!end
15956
15957 !! test
15958 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15959 !! options
15960 parsoid
15961 !! input
15962 <nowiki>=a=</nowiki>
15963
15964 <nowiki>=a=</nowiki>
15965
15966 <nowiki>=a=</nowiki>
15967
15968 <nowiki>=a=</nowiki>
15969 !! result
15970 <p>=a=</p>
15971 <p>=a= </p>
15972 <p>=a= </p>
15973 <p>=a= </p>
15974 !!end
15975
15976 !! test
15977 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15978 !! options
15979 parsoid
15980 !! input
15981 <nowiki>=a=
15982 b</nowiki>
15983
15984 <nowiki>=a=
15985 b</nowiki>
15986
15987 <nowiki>=a=
15988 b</nowiki>
15989
15990 <nowiki>=a=
15991 b</nowiki>
15992 !! result
15993 <p>=a=
15994 b</p>
15995 <p>=a=
15996 b</p>
15997 <p>=a=
15998 b</p>
15999 <p>=a=
16000 b</p>
16001 </p>
16002 !!end
16003
16004 !! test
16005 Headings: 6c. Heading chars in SOL context (leading newline break)
16006 !! options
16007 parsoid
16008 !! input
16009 a
16010 <nowiki>=b=</nowiki>
16011 !! result
16012 <p>a
16013 =b=</p>
16014 !!end
16015
16016 !! test
16017 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16018 !! options
16019 parsoid
16020 !! input
16021 <!--c0--><nowiki>=a=</nowiki>
16022 <!--c1-->
16023 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16024 !! result
16025 <p><!--c0-->=a=</p>
16026 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16027 !!end
16028
16029 !! test
16030 Headings: 6d. Heading chars in SOL context (No escaping needed)
16031 !! options
16032 parsoid=html2wt
16033 !! input
16034 =a=<div>b</div>
16035 !! result
16036 =a=<div>b</div>
16037 !!end
16038
16039 #### --------------- Lists ---------------
16040 #### 0. Outside nests (*foo, etc.)
16041 #### 1. Nested inside html <ul><li>*foo</li></ul>
16042 #### 2. Inside definition lists
16043 #### 3. Only bullets at start should be escaped
16044 #### 4. No escapes needed
16045 #### 5. No unnecessary escapes
16046 #### 6. Escape bullets in SOL position
16047 #### 7. Escape bullets in a multi-line context
16048 #### ----------------------------------------
16049
16050 !! test
16051 Lists: 0. Outside nests
16052 !! input
16053 <nowiki>*</nowiki>foo
16054
16055 <nowiki>#</nowiki>foo
16056 !! result
16057 <p>*foo
16058 </p><p>#foo
16059 </p>
16060 !!end
16061
16062 !! test
16063 Lists: 1. Nested inside html
16064 !! input
16065 *<nowiki>*foo</nowiki>
16066
16067 *<nowiki>#foo</nowiki>
16068
16069 *<nowiki>:foo</nowiki>
16070
16071 *<nowiki>;foo</nowiki>
16072
16073 #<nowiki>*foo</nowiki>
16074
16075 #<nowiki>#foo</nowiki>
16076
16077 #<nowiki>:foo</nowiki>
16078
16079 #<nowiki>;foo</nowiki>
16080 !! result
16081 <ul><li>*foo
16082 </li></ul>
16083 <ul><li>#foo
16084 </li></ul>
16085 <ul><li>:foo
16086 </li></ul>
16087 <ul><li>;foo
16088 </li></ul>
16089 <ol><li>*foo
16090 </li></ol>
16091 <ol><li>#foo
16092 </li></ol>
16093 <ol><li>:foo
16094 </li></ol>
16095 <ol><li>;foo
16096 </li></ol>
16097
16098 !!end
16099
16100 !! test
16101 Lists: 2. Inside definition lists
16102 !! input
16103 ;<nowiki>;foo</nowiki>
16104
16105 ;<nowiki>:foo</nowiki>
16106
16107 ;<nowiki>:foo</nowiki>
16108 :bar
16109
16110 :<nowiki>:foo</nowiki>
16111 !! result
16112 <dl><dt>;foo
16113 </dt></dl>
16114 <dl><dt>:foo
16115 </dt></dl>
16116 <dl><dt>:foo
16117 </dt><dd>bar
16118 </dd></dl>
16119 <dl><dd>:foo
16120 </dd></dl>
16121
16122 !!end
16123
16124 !! test
16125 Lists: 3. Only bullets at start of text should be escaped
16126 !! input
16127 *<nowiki>*foo*bar</nowiki>
16128
16129 *<nowiki>*foo</nowiki>''it''*bar
16130 !! result
16131 <ul><li>*foo*bar
16132 </li></ul>
16133 <ul><li>*foo<i>it</i>*bar
16134 </li></ul>
16135
16136 !!end
16137
16138 !! test
16139 Lists: 4. No escapes needed
16140 !! options
16141 parsoid
16142 !! input
16143 *foo*bar
16144
16145 *''foo''*bar
16146
16147 *[[Foo]]: bar
16148 !! result
16149 <ul><li>foo*bar
16150 </li></ul>
16151 <ul><li><i>foo</i>*bar
16152 </li></ul>
16153 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16154 </li></ul>
16155 !!end
16156
16157 !! test
16158 Lists: 5. No unnecessary escapes
16159 !! input
16160 * bar <span><nowiki>[[foo]]</nowiki></span>
16161
16162 *=bar <span><nowiki>[[foo]]</nowiki></span>
16163
16164 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16165
16166 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16167
16168 *=bar <span>foo]]</span>=
16169
16170 * <s></s>: a
16171 !! result
16172 <ul><li> bar <span>[[foo]]</span>
16173 </li></ul>
16174 <ul><li>=bar <span>[[foo]]</span>
16175 </li></ul>
16176 <ul><li>[[bar <span>[[foo]]</span>
16177 </li></ul>
16178 <ul><li>]]bar <span>[[foo]]</span>
16179 </li></ul>
16180 <ul><li>=bar <span>foo]]</span>=
16181 </li></ul>
16182 <ul><li> <s></s>: a
16183 </li></ul>
16184
16185 !!end
16186
16187 !! test
16188 Lists: 6. Escape bullets in SOL position
16189 !! options
16190 parsoid
16191 !! input
16192 <!--cmt--><nowiki>*foo</nowiki>
16193 !! result
16194 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16195 !!end
16196
16197 !! test
16198 Lists: 7. Escape bullets in a multi-line context
16199 !! input
16200 a
16201 <nowiki>*</nowiki>b
16202 !! result
16203 <p>a
16204 *b
16205 </p>
16206 !!end
16207
16208 #### --------------- HRs ---------------
16209 #### 1. Single line
16210 #### -----------------------------------
16211
16212 !! test
16213 HRs: 1. Single line
16214 !! options
16215 parsoid
16216 !! input
16217 ----<nowiki>----</nowiki>
16218 ----=foo=
16219 ----*foo
16220 !! result
16221 <hr><span typeof="mw:Nowiki">----</span>
16222 <hr>=foo=
16223 <hr>*foo
16224 !! end
16225
16226 #### --------------- Tables ---------------
16227 #### 1a. Simple example
16228 #### 1b. No escaping needed (!foo)
16229 #### 1c. No escaping needed (|foo)
16230 #### 1d. No escaping needed (|}foo)
16231 ####
16232 #### 2a. Nested in td (<td>foo|bar</td>)
16233 #### 2b. Nested in td (<td>foo||bar</td>)
16234 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16235 ####
16236 #### 3a. Nested in th (<th>foo!bar</th>)
16237 #### 3b. Nested in th (<th>foo!!bar</th>)
16238 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16239 ####
16240 #### 4a. Escape -
16241 #### 4b. Escape +
16242 #### 4c. No escaping needed
16243 #### --------------------------------------
16244
16245 !! test
16246 Tables: 1a. Simple example
16247 !! input
16248 <nowiki>{|
16249 |}</nowiki>
16250 !! result
16251 <p>{|
16252 |}
16253 </p>
16254 !! end
16255
16256 !! test
16257 Tables: 1b. No escaping needed
16258 !! input
16259 !foo
16260 !! result
16261 <p>!foo
16262 </p>
16263 !! end
16264
16265 !! test
16266 Tables: 1c. No escaping needed
16267 !! input
16268 |foo
16269 !! result
16270 <p>|foo
16271 </p>
16272 !! end
16273
16274 !! test
16275 Tables: 1d. No escaping needed
16276 !! input
16277 |}foo
16278 !! result
16279 <p>|}foo
16280 </p>
16281 !! end
16282
16283 !! test
16284 Tables: 2a. Nested in td
16285 !! options
16286 parsoid
16287 !! input
16288 {|
16289 |<nowiki>foo|bar</nowiki>
16290 |}
16291 !! result
16292 <table><tbody><tr>
16293 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16294 !! end
16295
16296 !! test
16297 Tables: 2b. Nested in td
16298 !! options
16299 parsoid
16300 !! input
16301 {|
16302 |<nowiki>foo||bar</nowiki>
16303 |''it''<nowiki>foo||bar</nowiki>
16304 |}
16305 !! result
16306 <table><tbody><tr>
16307 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16308 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16309 !! end
16310
16311 !! test
16312 Tables: 2c. Nested in td -- no escaping needed
16313 !! options
16314 parsoid
16315 !! input
16316 {|
16317 |foo!!bar
16318 |}
16319 !! result
16320 <table><tbody><tr><td>foo!!bar
16321 </td></tr></tbody></table>
16322
16323 !! end
16324
16325 !! test
16326 Tables: 3a. Nested in th
16327 !! options
16328 parsoid
16329 !! input
16330 {|
16331 !foo!bar
16332 |}
16333 !! result
16334 <table><tbody><tr><th>foo!bar
16335 </th></tr></tbody></table>
16336
16337 !! end
16338
16339 !! test
16340 Tables: 3b. Nested in th
16341 !! options
16342 parsoid
16343 !! input
16344 {|
16345 !<nowiki>foo!!bar</nowiki>
16346 |}
16347 !! result
16348 <table>
16349 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16350 </tbody></table>
16351 !! end
16352
16353 !! test
16354 Tables: 3c. Nested in th -- no escaping needed
16355 !! options
16356 parsoid
16357 !! input
16358 {|
16359 !<nowiki>foo||bar</nowiki>
16360 |}
16361 !! result
16362 <table><tbody><tr>
16363 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16364 !! end
16365
16366 !! test
16367 Tables: 4a. Escape -
16368 !! options
16369 parsoid
16370 !! input
16371 {|
16372 |-
16373 !-bar
16374 |-
16375 |<nowiki>-bar</nowiki>
16376 |}
16377 !! result
16378 <table><tbody>
16379 <tr><th>-bar</th></tr>
16380 <tr>
16381 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16382 !! end
16383
16384 !! test
16385 Tables: 4b. Escape +
16386 !! options
16387 parsoid
16388 !! input
16389 {|
16390 |-
16391 !+bar
16392 |-
16393 |<nowiki>+bar</nowiki>
16394 |}
16395 !! result
16396 <table><tbody>
16397 <tr><th>+bar</th></tr>
16398 <tr>
16399 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16400 !! end
16401
16402 !! test
16403 Tables: 4c. No escaping needed
16404 !! options
16405 parsoid
16406 !! input
16407 {|
16408 |-
16409 |foo-bar
16410 |foo+bar
16411 |-
16412 |''foo''-bar
16413 |''foo''+bar
16414 |-
16415 |foo
16416 bar|baz
16417 +bar
16418 -bar
16419 |}
16420 !! result
16421 <table><tbody>
16422 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16423 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16424 <tr><td>foo
16425 <p>bar|baz
16426 +bar
16427 -bar</p></td></tr>
16428 </tbody></table>
16429 !! end
16430
16431 ### SSS FIXME: Disabled right now because accurate html2wt
16432 ### on this snippet requires data-parsoid flags that we've
16433 ### stripped out of these tests. We should scheme how we
16434 ### we want to handle these kind of tests that require
16435 ### data-parsoid flags for accurate html2wt serialization
16436
16437 !! test
16438 Tables: 4d. No escaping needed
16439 !! options
16440 disabled
16441 !! input
16442 {|
16443 ||+1
16444 ||-2
16445 |}
16446 !! result
16447 <table>
16448 <tr>
16449 <td>+1
16450 </td>
16451 <td>-2
16452 </td></tr></table>
16453
16454 !! end
16455
16456 #### --------------- Links ----------------
16457 #### 1. Quote marks in link text
16458 #### 2. Wikilinks: Escapes needed
16459 #### 3. Wikilinks: No escapes needed
16460 #### 4. Extlinks: Escapes needed
16461 #### 5. Extlinks: No escapes needed
16462 #### --------------------------------------
16463 !! test
16464 Links 1. Quote marks in link text
16465 !! options
16466 parsoid
16467 !! input
16468 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16469 !! result
16470 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16471 !! end
16472
16473 !! test
16474 Links 2. WikiLinks: Escapes needed
16475 !! options
16476 parsoid
16477 !! input
16478 [[Foo|<nowiki>[Foobar]</nowiki>]]
16479 [[Foo|<nowiki>Foobar]</nowiki>]]
16480 [[Foo|x [Foobar] x]]
16481 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16482 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16483 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16484 [[Foo|<nowiki>|Bar</nowiki>]]
16485 [[Foo|<nowiki>]]bar</nowiki>]]
16486 [[Foo|<nowiki>[[bar</nowiki>]]
16487 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16488 !! result
16489 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16490 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16491 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16492 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16493 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16494 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16495 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16496 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16497 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16498 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16499 !! end
16500
16501 !! test
16502 Links 3. WikiLinks: No escapes needed
16503 !! options
16504 parsoid
16505 !! input
16506 [[Foo|[Foobar]]
16507 [[Foo|foo|bar]]
16508 !! result
16509 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16510 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16511 !! end
16512
16513 !! test
16514 Links 4. ExtLinks: Escapes needed
16515 !! options
16516 parsoid
16517 !! input
16518 [http://google.com <nowiki>[google]</nowiki>]
16519 [http://google.com <nowiki>google]</nowiki>]
16520 !! result
16521 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16522 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16523 !! end
16524
16525 !! test
16526 Links 5. ExtLinks: No escapes needed
16527 !! options
16528 parsoid
16529 !! input
16530 [http://google.com [google]
16531 !! result
16532 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16533 !! end
16534
16535 #### --------------- Quotes ---------------
16536 #### 1. Quotes inside <b> and <i>
16537 #### 2. Link fragments separated by <i> and <b> tags
16538 #### 3. Link fragments inside <i> and <b>
16539 #### 4. No escaping needed
16540 #### --------------------------------------
16541 !! test
16542 1. Quotes inside <b> and <i>
16543 !! options
16544 parsoid=html2wt,wt2wt
16545 !! input
16546 ''<nowiki>'foo'</nowiki>''
16547 ''<nowiki>''foo''</nowiki>''
16548 ''<nowiki>'''foo'''</nowiki>''
16549 ''foo''<nowiki/>'s
16550 '''<nowiki>'foo'</nowiki>'''
16551 '''<nowiki>''foo''</nowiki>'''
16552 '''<nowiki>'''foo'''</nowiki>'''
16553 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16554 '''foo'''<nowiki/>'s
16555 '''foo''
16556 ''foo''<nowiki/>'
16557 '<nowiki/>''foo''<nowiki/>'
16558 ''''foo'''
16559 '''foo'''<nowiki/>'
16560 '<nowiki/>'''foo'''<nowiki/>'
16561 !! result
16562 <p><i>'foo'</i>
16563 <i>''foo''</i>
16564 <i>'''foo'''</i>
16565 <i>foo</i>'s
16566 <b>'foo'</b>
16567 <b>''foo''</b>
16568 <b>'''foo'''</b>
16569 <b>foo'<i>bar'</i>baz</b>
16570 <b>foo</b>'s
16571 '<i>foo</i>
16572 <i>foo</i>'
16573 '<i>foo</i>'
16574 '<b>foo</b>
16575 <b>foo</b>'
16576 '<b>foo</b>'</p>
16577 !! end
16578
16579 !! test
16580 2. Link fragments separated by <i> and <b> tags
16581 !! input
16582 [[''foo''<nowiki>hello]]</nowiki>
16583
16584 [['''foo'''<nowiki>hello]]</nowiki>
16585 !! result
16586 <p>[[<i>foo</i>hello]]
16587 </p><p>[[<b>foo</b>hello]]
16588 </p>
16589 !! end
16590
16591 !! test
16592 3. Link fragments inside <i> and <b>
16593 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16594 this is one of the shortcomings of this format)
16595 !! input
16596 ''[[foo''<nowiki>]]</nowiki>
16597
16598 '''[[foo'''<nowiki>]]</nowiki>
16599 !! result
16600 <p><i>[[foo</i>]]
16601 </p><p><b>[[foo</b>]]
16602 </p>
16603 !! end
16604
16605 !! test
16606 4. No escaping needed
16607 !! input
16608 '<span>''bar''</span>'
16609 '<span>'''bar'''</span>'
16610 !! result
16611 <p>'<span><i>bar</i></span>'
16612 '<span><b>bar</b></span>'
16613 </p>
16614 !! end
16615
16616 #### ----------- Paragraphs ---------------
16617 #### 1. No unnecessary escapes
16618 #### --------------------------------------
16619
16620 !! test
16621 1. No unnecessary escapes
16622 !! input
16623 bar <span><nowiki>[[foo]]</nowiki></span>
16624
16625 =bar <span><nowiki>[[foo]]</nowiki></span>
16626
16627 [[bar <span><nowiki>[[foo]]</nowiki></span>
16628
16629 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16630
16631 =bar <span>foo]]</span><nowiki>=</nowiki>
16632 !! result
16633 <p>bar <span>[[foo]]</span>
16634 </p><p>=bar <span>[[foo]]</span>
16635 </p><p>[[bar <span>[[foo]]</span>
16636 </p><p>]]bar <span>[[foo]]</span>
16637 </p><p>=bar <span>foo]]</span>=
16638 </p>
16639 !!end
16640
16641 #### ----------------------- PRE --------------------------
16642 #### 1. Leading whitespace in SOL context should be escaped
16643 #### ------------------------------------------------------
16644 !! test
16645 1. Leading whitespace in SOL context should be escaped
16646 !! options
16647 parsoid
16648 !! input
16649 <nowiki> </nowiki>a
16650
16651 <nowiki> </nowiki> a
16652
16653 <nowiki> </nowiki>a(tab)
16654
16655 <nowiki> </nowiki> a
16656 <!--cmt-->
16657 <nowiki> </nowiki> a
16658
16659 a
16660 <nowiki> </nowiki>b
16661
16662 a
16663 <nowiki> </nowiki>b
16664
16665 a
16666 <nowiki> </nowiki> b
16667 !! result
16668 <p> a</p>
16669 <p> a</p>
16670 <p> a(tab)</p>
16671 <p> a</p>
16672 <p><!--cmt--> a</p>
16673 <p>a
16674 b</p>
16675 <p>a
16676 b</p>
16677 <p>a
16678 b</p>
16679 !! end
16680
16681 #### --------------- HTML tags ---------------
16682 #### 1. a tags
16683 #### 2. other tags
16684 #### 3. multi-line html tag
16685 #### -----------------------------------------
16686 !! test
16687 1. a tags
16688 !! options
16689 parsoid
16690 !! input
16691 <a href="http://google.com">google</a>
16692 !! result
16693 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16694 !! end
16695
16696 !! test
16697 2. other tags
16698 !! input
16699 <nowiki><div>foo</div>
16700 <div style="color:red">foo</div></nowiki>
16701 !! result
16702 <p>&lt;div&gt;foo&lt;/div&gt;
16703 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16704 </p>
16705 !! end
16706
16707 !! test
16708 3. multi-line html tag
16709 !! input
16710 <nowiki><div
16711 >foo</div
16712 ></nowiki>
16713 !! result
16714 <p>&lt;div
16715 &gt;foo&lt;/div
16716 &gt;
16717 </p>
16718 !! end
16719
16720 !! test
16721 4. extension tags
16722 !! input
16723 <nowiki><ref>foo</ref></nowiki>
16724 !! result
16725 <p>&lt;ref&gt;foo&lt;/ref&gt;
16726 </p>
16727 !! end
16728
16729 #### --------------- Others ---------------
16730 !! test
16731 Escaping nowikis
16732 !! input
16733 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16734 !! result
16735 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16736 </p>
16737 !! end
16738
16739 ## The quote-char in the input is necessary for triggering the bug
16740 !! test
16741 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16742 !! options
16743 parsoid=wt2wt,html2wt
16744 !! input
16745 foo's bar :
16746 !! result
16747 <p>foo's bar :</p>
16748 !! end
16749
16750 !! test
16751
16752 Tag-like HTML structures are passed through as text
16753 !! input
16754 <x y>
16755
16756 <x.y>
16757
16758 <x-y>
16759
16760 1>2
16761
16762 x<y
16763
16764 a>b
16765
16766 1<d e>f
16767 !! result
16768 <p>&lt;x y&gt;
16769 </p><p>&lt;x.y&gt;
16770 </p><p>&lt;x-y&gt;
16771 </p><p>1&gt;2
16772 </p><p>x&lt;y
16773 </p><p>a&gt;b
16774 </p><p>1&lt;d e&gt;f
16775 </p>
16776 !! end
16777
16778
16779 # This was a bug in the PHP parser (see bug 17663 and its dups,
16780 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16781 !! test
16782 Tag names followed by punctuation should not be recognized as tags
16783 !! input
16784 <s.ome> text
16785 !! result
16786 <p>&lt;s.ome&gt; text
16787 </p>
16788 !! end
16789
16790 !! test
16791 HTML tag with necessary entities in attributes
16792 !! input
16793 <span title="&amp;amp;">foo</span>
16794 !! result
16795 <p><span title="&amp;amp;">foo</span>
16796 </p>
16797 !! end
16798
16799 !! test
16800 HTML tag with 'unnecessary' entity encoding in attributes
16801 !! input
16802 <span title="&amp;">foo</span>
16803 !! result
16804 <p><span title="&amp;">foo</span>
16805 </p>
16806 !! end
16807
16808 !! test
16809 HTML tag with broken attribute value quoting
16810 !! input
16811 <span title="Hello world>Foo</span>
16812 !! result
16813 <p><span>Foo</span>
16814 </p>
16815 !! end
16816
16817 !! test
16818 Parsoid-only: HTML tag with broken attribute value quoting
16819 !! options
16820 parsoid
16821 !! input
16822 <span title="Hello world>Foo</span>
16823 !! result
16824 <p><span title="Hello world">Foo</span>
16825 </p>
16826 !! end
16827
16828 !! test
16829 Table with broken attribute value quoting
16830 !! input
16831 {|
16832 | title="Hello world|Foo
16833 |}
16834 !! result
16835 <table>
16836 <tr>
16837 <td>Foo
16838 </td></tr></table>
16839
16840 !! end
16841
16842 !! test
16843 Table with broken attribute value quoting on consecutive lines
16844 !! input
16845 {|
16846 | title="Hello world|Foo
16847 | style="color:red|Bar
16848 |}
16849 !! result
16850 <table>
16851 <tr>
16852 <td>Foo
16853 </td>
16854 <td>Bar
16855 </td></tr></table>
16856
16857 !! end
16858
16859 !! test
16860 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16861 !! options
16862 parsoid
16863 !! input
16864 {|
16865 | title="Hello world|Foo
16866 | style="color:red|Bar
16867 |}
16868 !! result
16869 <table><tbody>
16870 <tr>
16871 <td title="Hello world">Foo
16872 </td><td style="color: red">Bar
16873 </td></tr></tbody></table>
16874
16875 !! end
16876
16877 !! test
16878 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16879 !! options
16880 parsoid
16881 !! input
16882 {{}}
16883 !! result
16884 {{}}
16885 !! end
16886
16887 !! test
16888 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16889 !! options
16890 parsoid
16891 !! input
16892 }}{{
16893 !! result
16894 }}{{
16895 !! end
16896
16897 !!test
16898 Accept empty td cell attribute
16899 !!input
16900 {|
16901 | align="center" | foo || |
16902 |}
16903 !!result
16904 <table>
16905 <tr>
16906 <td align="center"> foo </td>
16907 <td>
16908 </td></tr></table>
16909
16910 !!end
16911
16912 !!test
16913 Non-empty attributes in th-cells
16914 !!input
16915 {|
16916 ! Foo !! style="color: red" | Bar
16917 |}
16918 !!result
16919 <table>
16920 <tr>
16921 <th> Foo </th>
16922 <th style="color: red"> Bar
16923 </th></tr></table>
16924
16925 !!end
16926
16927 !!test
16928 Accept empty attributes in th-cells
16929 !!input
16930 {|
16931 !| foo !!| bar
16932 |}
16933 !!result
16934 <table>
16935 <tr>
16936 <th> foo </th>
16937 <th> bar
16938 </th></tr></table>
16939
16940 !!end
16941
16942 !!test
16943 Empty table rows go away
16944 !!input
16945 {|
16946 | Hello
16947 | there
16948 |- class="foo"
16949 |-
16950 |}
16951 !! result
16952 <table>
16953 <tr>
16954 <td> Hello
16955 </td>
16956 <td> there
16957 </td></tr>
16958
16959 </table>
16960
16961 !! end
16962
16963 ###
16964 ### Parsoid-centric tests for testing RTing of inter-element separators
16965 ### Edge cases not tested by existing parser tests and specific to
16966 ### Parsoid-specific serialization strategies.
16967 ###
16968
16969 !!test
16970 RT-ed inter-element separators should be valid separators
16971 !!input
16972 {|
16973 |- [[foo]]
16974 |}
16975 !!result
16976 <table>
16977
16978 </table>
16979
16980 !!end
16981
16982 !!test
16983 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16984 (Parsoid-only since PHP parser relies on Tidy for correct output)
16985 !!options
16986 parsoid
16987 !!input
16988 {|
16989 |<small>foo
16990 bar
16991 |}
16992
16993 {|
16994 |<small>foo<small>
16995 |}
16996 !!result
16997 !!end
16998
16999 !!test
17000 Empty TD followed by TD with tpl-generated attribute
17001 !!input
17002 {|
17003 |-
17004 |
17005 |{{echo|style='color:red'}}|foo
17006 |}
17007 !!result
17008 <table>
17009
17010 <tr>
17011 <td>
17012 </td>
17013 <td>foo
17014 </td></tr></table>
17015
17016 !!end
17017
17018 !!test
17019 Indented table with an empty td
17020 !!input
17021 {|
17022 |-
17023 |
17024 |foo
17025 |}
17026 !!result
17027 <table>
17028
17029 <tr>
17030 <td>
17031 </td>
17032 <td>foo
17033 </td></tr></table>
17034
17035 !!end
17036
17037 !!test
17038 Empty TR followed by a template-generated TR
17039 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17040 !!options
17041 parsoid=wt2html,wt2wt
17042 !!input
17043 {|
17044 |-
17045 {{echo|<tr><td>foo</td></tr>}}
17046 |}
17047 !!result
17048 <table>
17049 <tbody>
17050 <tr></tr>
17051 <tr typeof="mw:Transclusion">
17052 <td>foo</td></tr></tbody></table>
17053 !!end
17054
17055 ## PHP and parsoid output differ for this, and since this is primarily
17056 ## for testing Parsoid's serializer, marking this Parsoid only
17057 !!test
17058 Empty TR followed by mixed-ws-comment line should RT correctly
17059 !!options
17060 parsoid
17061 !!input
17062 {|
17063 |-
17064 <!--c-->
17065 |-
17066 <!--c--> <!--d-->
17067 |}
17068 !!result
17069 <table>
17070 <tbody>
17071 <tr>
17072 <td> <!--c--></td></tr>
17073 <tr>
17074 <td><!--c--> <!--d--></td></tr>
17075 </tbody></table>
17076
17077 !!end
17078
17079 !!test
17080 Multi-line image caption generated by templates with/without trailing newlines
17081 !!options
17082 parsoid
17083 !!input
17084 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17085 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17086 !!result
17087 <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>
17088 <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>
17089
17090 !!end
17091
17092 ## PHP emits broken html for this, and since this is primarily
17093 ## a Parsoid serializer test, marking this Parsoid only
17094 !!test
17095 Improperly nested inline or quotes tags with whitespace in between
17096 !!options
17097 parsoid
17098 !!input
17099 <span> <s>x</span> </s>
17100 ''' ''x''' ''
17101 !!result
17102 <p><span> <s>x</s></span><s> </s>
17103 <b> <i>x</i></b><i> </i>
17104 </p>
17105 !!end
17106
17107 !!test
17108 Encapsulate protected attributes from wt
17109 !!options
17110 parsoid
17111 !!input
17112 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17113 !!result
17114 <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>
17115 </body>
17116 !!end
17117
17118 # -----------------------------------------------------------------
17119 # The following section of tests are primarily to spec requirements
17120 # around serialization of new/edited content.
17121 #
17122 # All these tests are marked Parsoid html2wt and html2html only
17123 # ----------------------------------------------------------------
17124
17125 !! test
17126 Image: Modifying size of an image
17127 !! options
17128 parsoid=html2wt
17129 !! input
17130 [[Image:Wiki.png|230x230px]]
17131 !! result
17132 <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>
17133 !!end
17134
17135 !! test
17136 Image: New block level image should have \n before and after
17137 !! options
17138 parsoid=html2wt
17139 !! input
17140 123
17141 [[File:Wiki.png|right|thumb|150x150px]]
17142 456
17143 !! result
17144 <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>
17145 !!end
17146
17147 # Wacky -- the leading newline in input is required because
17148 # that is what the serializer emits. To be fixed. Not fixing
17149 # the test because this test is required to test serialization of
17150 # new content and preferred whitespace style.
17151 !! test
17152 Lists: Add space after bullets
17153 !! options
17154 parsoid=html2wt
17155 !! input
17156
17157 * foo
17158 * bar
17159 * <span> baz</span>
17160 !! result
17161 <ul>
17162 <li>foo</li>
17163 <li> bar</li>
17164 <li><span> baz</span></li>
17165 </ul>
17166 !! end
17167
17168 !! test
17169 Parsoid: Serialize positional parameters with = in them as named parameter
17170 !! options
17171 parsoid=html2wt
17172 !! input
17173 {{echo|1 = f=oo}}
17174 !! result
17175 <p about="#mwt1" typeof="mw:Transclusion"
17176 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
17177 >foo</p>
17178 !! end
17179
17180 # -----------------------------------------------------------------
17181 # End of section for Parsoid-only html2wt tests for serialization
17182 # of new content
17183 # -----------------------------------------------------------------
17184
17185 TODO:
17186 more images
17187 more tables
17188 character entities
17189 and much more
17190 Try for 100% code coverage