Add more parser tests for magic words.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 ###
143 ### Basic tests
144 ###
145 !! test
146 Blank input
147 !! input
148 !! result
149 !! end
150
151
152 !! test
153 Simple paragraph
154 !! input
155 This is a simple paragraph.
156 !! result
157 <p>This is a simple paragraph.
158 </p>
159 !! end
160
161 !! test
162 Paragraphs with extra newline spacing
163 !! input
164 foo
165
166 bar
167
168
169 baz
170
171
172
173 booz
174 !! result
175 <p>foo
176 </p><p>bar
177 </p><p><br />
178 baz
179 </p><p><br />
180 </p><p>booz
181 </p>
182 !! end
183
184 !! test
185 Paragraphs with newline spacing with comment lines in between
186 !! input
187 ----
188 a
189 <!--foo-->
190 b
191 ----
192 a
193 <!--foo--><!--More than 1 comment disables stripping of this line!-->
194 b
195 ----
196 a
197 <!--foo-->
198
199 b
200 ----
201 a
202
203 <!--foo-->
204 b
205 ----
206 a
207 <!--foo-->
208
209
210 b
211 ----
212 a
213
214
215 <!--foo-->
216 b
217 ----
218 !! result
219 <hr />
220 <p>a
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p>b
226 </p>
227 <hr />
228 <p>a
229 </p><p>b
230 </p>
231 <hr />
232 <p>a
233 </p><p>b
234 </p>
235 <hr />
236 <p>a
237 </p><p><br />
238 b
239 </p>
240 <hr />
241 <p>a
242 </p><p><br />
243 b
244 </p>
245 <hr />
246
247 !! end
248
249 !! test
250 Paragraphs with newline spacing with non-empty white-space lines in between
251 !! input
252 ----
253 a
254
255 b
256 ----
257 a
258
259
260 b
261 ----
262 !! result
263 <hr />
264 <p>a
265 </p><p>b
266 </p>
267 <hr />
268 <p>a
269 </p><p><br />
270 b
271 </p>
272 <hr />
273
274 !! end
275
276 !! test
277 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
278 !! input
279 ----
280 a
281 <!--foo-->
282 b
283 ----
284 a
285 <!--foo--><!--More than 1 comment disables stripping of this line!-->
286 b
287 ----
288 a
289
290 <!--foo-->
291 <!--bar-->
292 b
293 ----
294 a
295
296 <!--foo-->
297 <!--bar-->
298
299 b
300 ----
301 !! result
302 <hr />
303 <p>a
304 b
305 </p>
306 <hr />
307 <p>a
308 </p><p>b
309 </p>
310 <hr />
311 <p>a
312 </p><p>b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 <hr />
320
321 !! end
322
323 !! test
324 Extra newlines: More paragraphs with indented comment
325 !! input
326 a
327
328 <!--boo-->
329
330 b
331 !!result
332 <p>a
333 </p><p><br />
334 b
335 </p>
336 !!end
337
338 !! test
339 Extra newlines followed by heading
340 !! input
341 a
342
343
344
345 =b=
346 [[a]]
347
348
349 =b=
350 !! result
351 <p>a
352 </p><p><br />
353 </p>
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p><p><br />
357 </p>
358 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
359
360 !! end
361
362 !! test
363 Extra newlines between heading and content are swallowed
364 !! input
365 =b=
366
367
368
369 [[a]]
370 !! result
371 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
372 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
373 </p>
374 !! end
375
376 !! test
377 Parsing an URL
378 !! input
379 http://fr.wikipedia.org/wiki/🍺
380 <!-- EasterEgg we love beer, better be able be able to link to it -->
381 !! result
382 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
383 </p>
384 !! end
385
386 !! test
387 Simple list
388 !! input
389 * Item 1
390 * Item 2
391 !! result
392 <ul><li> Item 1
393 </li><li> Item 2
394 </li></ul>
395
396 !! end
397
398 !! test
399 Italics and bold
400 !! input
401 * plain
402 * plain''italic''plain
403 * plain''italic''plain''italic''plain
404 * plain'''bold'''plain
405 * plain'''bold'''plain'''bold'''plain
406 * plain''italic''plain'''bold'''plain
407 * plain'''bold'''plain''italic''plain
408 * plain''italic'''bold-italic'''italic''plain
409 * plain'''bold''bold-italic''bold'''plain
410 * plain'''''bold-italic'''italic''plain
411 * plain'''''bold-italic''bold'''plain
412 * plain''italic'''bold-italic'''''plain
413 * plain'''bold''bold-italic'''''plain
414 * plain l'''italic''plain
415 * plain l''''bold''' plain
416 !! result
417 <ul><li> plain
418 </li><li> plain<i>italic</i>plain
419 </li><li> plain<i>italic</i>plain<i>italic</i>plain
420 </li><li> plain<b>bold</b>plain
421 </li><li> plain<b>bold</b>plain<b>bold</b>plain
422 </li><li> plain<i>italic</i>plain<b>bold</b>plain
423 </li><li> plain<b>bold</b>plain<i>italic</i>plain
424 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
425 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
426 </li><li> plain<i><b>bold-italic</b>italic</i>plain
427 </li><li> plain<b><i>bold-italic</i>bold</b>plain
428 </li><li> plain<i>italic<b>bold-italic</b></i>plain
429 </li><li> plain<b>bold<i>bold-italic</i></b>plain
430 </li><li> plain l'<i>italic</i>plain
431 </li><li> plain l'<b>bold</b> plain
432 </li></ul>
433
434 !! end
435
436 # this example taken from the simple/Moon article
437 !! test
438 Italics and possessives
439 !! input
440 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
441 !! result
442 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
443 </p>
444 !! end
445
446 ###
447 ### 2-quote opening sequence tests
448 ###
449 !! test
450 Italics and bold: 2-quote opening sequence: (2,2)
451 !! input
452 ''foo''
453 !! result
454 <p><i>foo</i>
455 </p>
456 !!end
457
458
459 !! test
460 Italics and bold: 2-quote opening sequence: (2,3)
461 !! input
462 ''foo'''
463 !! result
464 <p><i>foo'</i>
465 </p>
466 !!end
467
468
469 !! test
470 Italics and bold: 2-quote opening sequence: (2,4)
471 !! input
472 ''foo''''
473 !! result
474 <p><i>foo''</i>
475 </p>
476 !!end
477
478
479 !! test
480 Italics and bold: 2-quote opening sequence: (2,5) (php)
481 !! options
482 php
483 !! input
484 ''foo'''''
485 !! result
486 <p><i>foo</i>
487 </p>
488 !!end
489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
490 !! test
491 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
492 !! options
493 parsoid
494 !! input
495 ''foo'''''
496 !! result
497 <p><i>foo</i><b></b>
498 </p>
499 !!end
500
501
502 ###
503 ### 3-quote opening sequence tests
504 ###
505
506 !! test
507 Italics and bold: 3-quote opening sequence: (3,2)
508 !! input
509 '''foo''
510 !! result
511 <p>'<i>foo</i>
512 </p>
513 !!end
514
515
516 !! test
517 Italics and bold: 3-quote opening sequence: (3,3)
518 !! input
519 '''foo'''
520 !! result
521 <p><b>foo</b>
522 </p>
523 !!end
524
525
526 !! test
527 Italics and bold: 3-quote opening sequence: (3,4)
528 !! input
529 '''foo''''
530 !! result
531 <p><b>foo'</b>
532 </p>
533 !!end
534
535
536 !! test
537 Italics and bold: 3-quote opening sequence: (3,5) (php)
538 !! options
539 php
540 !! input
541 '''foo'''''
542 !! result
543 <p><b>foo</b>
544 </p>
545 !!end
546 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
547 !! test
548 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
549 !! options
550 parsoid
551 !! input
552 '''foo'''''
553 !! result
554 <p><b>foo<i></i></b>
555 </p>
556 !!end
557
558
559 ###
560 ### 4-quote opening sequence tests
561 ###
562
563 !! test
564 Italics and bold: 4-quote opening sequence: (4,2)
565 !! input
566 ''''foo''
567 !! result
568 <p>''<i>foo</i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 4-quote opening sequence: (4,3)
575 !! input
576 ''''foo'''
577 !! result
578 <p>'<b>foo</b>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 4-quote opening sequence: (4,4)
585 !! input
586 ''''foo''''
587 !! result
588 <p>'<b>foo'</b>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 4-quote opening sequence: (4,5) (php)
595 !! options
596 php
597 !! input
598 ''''foo'''''
599 !! result
600 <p>'<b>foo</b>
601 </p>
602 !!end
603 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
604 !! test
605 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
606 !! options
607 parsoid
608 !! input
609 ''''foo'''''
610 !! result
611 <p>'<b>foo<i></i></b>
612 </p>
613 !!end
614
615
616 ###
617 ### 5-quote opening sequence tests
618 ###
619
620 !! test
621 Italics and bold: 5-quote opening sequence: (5,2) (php)
622 !! options
623 php
624 !! input
625 '''''foo''
626 !! result
627 <p><b><i>foo</i></b>
628 </p>
629 !!end
630 # Parsoid reverses the nesting order, compared to the PHP parser
631 !! test
632 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
633 !! options
634 parsoid
635 !! input
636 '''''foo''
637 !! result
638 <p><i><b>foo</b></i>
639 </p>
640 !!end
641
642
643 !! test
644 Italics and bold: 5-quote opening sequence: (5,3)
645 !! input
646 '''''foo'''
647 !! result
648 <p><i><b>foo</b></i>
649 </p>
650 !!end
651
652
653 !! test
654 Italics and bold: 5-quote opening sequence: (5,4)
655 !! input
656 '''''foo''''
657 !! result
658 <p><i><b>foo'</b></i>
659 </p>
660 !!end
661
662
663 !! test
664 Italics and bold: 5-quote opening sequence: (5,5)
665 !! input
666 '''''foo'''''
667 !! result
668 <p><i><b>foo</b></i>
669 </p>
670 !!end
671
672 ###
673 ### multiple quote sequences in a line
674 ###
675 !! test
676 Italics and bold: multiple quote sequences: (2,4,2)
677 !! input
678 ''foo''''bar''
679 !! result
680 <p><i>foo'<b>bar</b></i>
681 </p>
682 !!end
683
684
685 !! test
686 Italics and bold: multiple quote sequences: (2,4,3)
687 !! input
688 ''foo''''bar'''
689 !! result
690 <p><i>foo'<b>bar</b></i>
691 </p>
692 !!end
693
694
695 !! test
696 Italics and bold: multiple quote sequences: (2,4,4)
697 !! input
698 ''foo''''bar''''
699 !! result
700 <p><i>foo'<b>bar'</b></i>
701 </p>
702 !!end
703
704
705 !! test
706 Italics and bold: multiple quote sequences: (3,4,2) (php)
707 !! options
708 php
709 !! input
710 '''foo''''bar''
711 !! result
712 <p><b>foo'</b>bar
713 </p>
714 !!end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
718 !! options
719 parsoid
720 !! input
721 '''foo''''bar''
722 !! result
723 <p><b>foo'</b>bar<i></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,3) (php)
730 !! options
731 php
732 !! input
733 '''foo''''bar'''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar'''
745 !! result
746 <p><b>foo'</b>bar<b></b>
747 </p>
748 !!end
749
750 ###
751 ### other quote tests
752 ###
753 !! test
754 Italics and bold: other quote tests: (2,3,5)
755 !! input
756 ''this is about '''foo's family'''''
757 !! result
758 <p><i>this is about <b>foo's family</b></i>
759 </p>
760 !!end
761
762
763 !! test
764 Italics and bold: other quote tests: (2,(3,3),2)
765 !! input
766 ''this is about '''foo's''' family''
767 !! result
768 <p><i>this is about <b>foo's</b> family</i>
769 </p>
770 !!end
771
772
773 !! test
774 Italics and bold: other quote tests: (3,2,3,2)
775 !! input
776 '''this is about ''foo'''s family''
777 !! result
778 <p><b>this is about <i>foo</i></b><i>s family</i>
779 </p>
780 !!end
781
782
783 # The Parsoid team believes the PHP parser's output on this test is wrong.
784 # It only checks for convert-to-bold-on-single-character-word when the word
785 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
786 # This means that the bold token in position 2 (0-indexed) gets converted by
787 # parsoid, but doesn't get changed by the PHP parser.
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3) (php)
790 !! options
791 php
792 !! input
793 '''this is about ''foo'''s family'''
794 !! result
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798 # This is the output the Parsoid team believes to be correct.
799 !! test
800 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
801 !! options
802 parsoid
803 !! input
804 '''this is about ''foo'''s family'''
805 !! result
806 <p><b>this is about <i>foo'</i>s family</b>
807 </p>
808 !!end
809
810
811 !! test
812 Italics and bold: other quote tests: (3,(2,2),3)
813 !! input
814 '''this is about ''foo's'' family'''
815 !! result
816 <p><b>this is about <i>foo's</i> family</b>
817 </p>
818 !!end
819
820
821 !! test
822 Italicized possessive
823 !! input
824 The ''[[Main Page]]'''s talk page.
825 !! result
826 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
827 </p>
828 !! end
829
830 !! test
831 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
832 (Requires tidy for PHP parser output to be fixed up)
833 !! options
834 parsoid=wt2html,wt2wt
835 !! input
836 {|
837 !''a!!''b
838 |''a||''b
839 |}
840 !! result
841 <table>
842 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
843 <td><i>a</i></td><td><i>b</i></td></tr>
844 </tbody></table>
845 !! end
846
847 ###
848 ### Non-html5 tags
849 ###
850
851 !! test
852 Non-html5 tags should be accepted
853 !! input
854 <center>''foo''</center>
855 <big>''foo''</big>
856 <font>''foo''</font>
857 <strike>''foo''</strike>
858 <tt>''foo''</tt>
859 !! result
860 <center><i>foo</i></center>
861 <p><big><i>foo</i></big>
862 <font><i>foo</i></font>
863 <strike><i>foo</i></strike>
864 <tt><i>foo</i></tt>
865 </p>
866 !! end
867
868 !! test
869 <wbr> is valid wikitext (bug 52468)
870 !! input
871 <wbr>
872 !! result
873 <p><wbr />
874 </p>
875 !! end
876
877 # <strike> is HTML4, <s> is HTML4/5.
878 !! test
879 <s> or <strike> for strikethrough
880 !! input
881 <strike>strike</strike>
882
883 <s>s</s>
884 !! result
885 <p><strike>strike</strike>
886 </p><p><s>s</s>
887 </p>
888 !! end
889
890 !! test
891 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
892 !! input
893 <b→> doesn't work! </b>
894
895 <bä> doesn't work! </b>
896
897 <boo> works fine </b>
898
899 <s.foo>foo</s>
900
901 <s.foo>s.foo</s.foo>
902
903 <sub-ID#1>
904 !! result
905 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
906 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
907 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
908 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
909 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
910 </p><p>&lt;sub-ID#1&gt;
911 </p>
912 !! end
913
914 ###
915 ### Special characters
916 ###
917
918 !! test
919 Bare pipe character (bug 52363)
920 !! input
921 |
922 !! result
923 <p>|
924 </p>
925 !! end
926
927 !! test
928 Bare pipe character from a template (bug 52363)
929 !! input
930 {{pipe}}
931 !! result
932 <p>|
933 </p>
934 !! end
935
936 ###
937 ### <nowiki> test cases
938 ###
939
940 !! test
941 <nowiki> unordered list
942 !! input
943 <nowiki>* This is not an unordered list item.</nowiki>
944 !! result
945 <p>* This is not an unordered list item.
946 </p>
947 !! end
948
949 !! test
950 <nowiki> spacing
951 !! input
952 <nowiki>Lorem ipsum dolor
953
954 sed abit.
955 sed nullum.
956
957 :and a colon
958 </nowiki>
959 !! result
960 <p>Lorem ipsum dolor
961
962 sed abit.
963 sed nullum.
964
965 :and a colon
966
967 </p>
968 !! end
969
970 !! test
971 nowiki 3
972 !! input
973 :There is not nowiki.
974 :There is <nowiki>nowiki</nowiki>.
975
976 #There is not nowiki.
977 #There is <nowiki>nowiki</nowiki>.
978
979 *There is not nowiki.
980 *There is <nowiki>nowiki</nowiki>.
981 !! result
982 <dl><dd>There is not nowiki.
983 </dd><dd>There is nowiki.
984 </dd></dl>
985 <ol><li>There is not nowiki.
986 </li><li>There is nowiki.
987 </li></ol>
988 <ul><li>There is not nowiki.
989 </li><li>There is nowiki.
990 </li></ul>
991
992 !! end
993
994 !! test
995 Entities inside <nowiki>
996 !! input
997 <nowiki>&lt;</nowiki>
998 !! result
999 <p>&lt;
1000 </p>
1001 !! end
1002
1003 !! test
1004 Entities inside template parameters
1005 !! options
1006 parsoid
1007 !! input
1008 {{echo|&ndash;}}
1009 !! result
1010 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1011 </p>
1012 !! end
1013
1014 ###
1015 ### Comments
1016 ###
1017 !! test
1018 Comments and Indent-Pre
1019 !! input
1020 <!-- comment 1 --> asdf
1021
1022 <!-- comment 1 --> asdf
1023 <!-- comment 2 -->
1024
1025 <!-- comment 1 --> asdf
1026 <!-- comment 2 -->xyz
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 --> xyz
1030 !! result
1031 <pre>asdf
1032 </pre>
1033 <pre>asdf
1034 </pre>
1035 <pre>asdf
1036 </pre>
1037 <p>xyz
1038 </p>
1039 <pre>asdf
1040 xyz
1041 </pre>
1042 !! end
1043
1044 !! test
1045 Comment test 2a
1046 !! input
1047 asdf
1048 <!-- comment 1 -->
1049 jkl
1050 !! result
1051 <p>asdf
1052 jkl
1053 </p>
1054 !! end
1055
1056 !! test
1057 Comment test 2b
1058 !! input
1059 asdf
1060 <!-- comment 1 -->
1061
1062 jkl
1063 !! result
1064 <p>asdf
1065 </p><p>jkl
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment test 3
1071 !! input
1072 asdf
1073 <!-- comment 1 -->
1074 <!-- comment 2 -->
1075 jkl
1076 !! result
1077 <p>asdf
1078 jkl
1079 </p>
1080 !! end
1081
1082 !! test
1083 Comment test 4
1084 !! input
1085 asdf<!-- comment 1 -->jkl
1086 !! result
1087 <p>asdfjkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment spacing
1093 !! input
1094 a
1095 <!-- foo --> b <!-- bar -->
1096 c
1097 !! result
1098 <p>a
1099 </p>
1100 <pre> b
1101 </pre>
1102 <p>c
1103 </p>
1104 !! end
1105
1106 !! test
1107 Comment whitespace
1108 !! input
1109 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1110 !! result
1111
1112 !! end
1113
1114 !! test
1115 Comment semantics and delimiters
1116 !! input
1117 <!-- --><!----><!-----><!------>
1118 !! result
1119
1120 !! end
1121
1122 !! test
1123 Comment semantics and delimiters, redux
1124 !! input
1125 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1126 -- foo -- funky huh? ... -->
1127 !! result
1128
1129 !! end
1130
1131 !! test
1132 Comment semantics and delimiters: directors cut
1133 !! input
1134 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1135 everything starting with < followed by !-- until the first -- and > we see,
1136 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1137 -->-->
1138 !! result
1139 <p>--&gt;
1140 </p>
1141 !! end
1142
1143 !! test
1144 Comment semantics: nesting
1145 !! input
1146 <!--<!-- no, we're not going to do anything fancy here -->-->
1147 !! result
1148 <p>--&gt;
1149 </p>
1150 !! end
1151
1152 !! test
1153 Comment semantics: unclosed comment at end
1154 !! input
1155 <!--This comment will run out to the end of the document
1156 !! result
1157
1158 !! end
1159
1160 !! test
1161 Comment in template title
1162 !! input
1163 {{f<!---->oo}}
1164 !! result
1165 <p>FOO
1166 </p>
1167 !! end
1168
1169 !! test
1170 Comment on its own line post-expand
1171 !! input
1172 a
1173 {{blank}}<!---->
1174 b
1175 !! result
1176 <p>a
1177 </p><p>b
1178 </p>
1179 !! end
1180
1181 !! test
1182 Comment on its own line post-expand with non-significant whitespace
1183 !! input
1184 a
1185 {{blank}} <!---->
1186 b
1187 !! result
1188 <p>a
1189 </p><p>b
1190 </p>
1191 !! end
1192
1193 ###
1194 ### paragraph wrapping tests
1195 ###
1196 !! test
1197 No block tags
1198 !! input
1199 a
1200
1201 b
1202 !! result
1203 <p>a
1204 </p><p>b
1205 </p>
1206 !! end
1207 !! test
1208 Block tag on one line
1209 !! input
1210 a <div>foo</div>
1211
1212 b
1213 !! result
1214 a <div>foo</div>
1215 <p>b
1216 </p>
1217 !! end
1218
1219 !! test
1220 Block tag on both lines
1221 !! input
1222 a <div>foo</div>
1223
1224 b <div>foo</div>
1225 !! result
1226 a <div>foo</div>
1227 b <div>foo</div>
1228
1229 !! end
1230
1231 !! test
1232 Multiple lines without block tags
1233 !! input
1234 <div>foo</div> a
1235 b
1236 c
1237 d<!--foo--> e
1238 x <div>foo</div> z
1239 !! result
1240 <div>foo</div> a
1241 <p>b
1242 c
1243 d e
1244 </p>
1245 x <div>foo</div> z
1246
1247 !! end
1248
1249 !! test
1250 Empty lines between lines with block tags
1251 !! input
1252 <div></div>
1253
1254
1255 <div></div>a
1256
1257 b
1258 <div>a</div>b
1259
1260 <div>b</div>d
1261
1262
1263 <div>e</div>
1264 !! result
1265 <div></div>
1266 <p><br />
1267 </p>
1268 <div></div>a
1269 <p>b
1270 </p>
1271 <div>a</div>b
1272 <div>b</div>d
1273 <p><br />
1274 </p>
1275 <div>e</div>
1276
1277 !! end
1278
1279 ###
1280 ### Preformatted text
1281 ###
1282 !! test
1283 Preformatted text
1284 !! input
1285 This is some
1286 Preformatted text
1287 With ''italic''
1288 And '''bold'''
1289 And a [[Main Page|link]]
1290 !! result
1291 <pre>This is some
1292 Preformatted text
1293 With <i>italic</i>
1294 And <b>bold</b>
1295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1296 </pre>
1297 !! end
1298
1299 !! test
1300 Ident preformatting with inline content
1301 !! input
1302 a
1303 ''b''
1304 !! result
1305 <pre>a
1306 <i>b</i>
1307 </pre>
1308 !! end
1309
1310 !! test
1311 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1312 !! input
1313 <pre><nowiki>
1314 <b>
1315 <cite>
1316 <em>
1317 </nowiki></pre>
1318 !! result
1319 <pre>
1320 &lt;b&gt;
1321 &lt;cite&gt;
1322 &lt;em&gt;
1323 </pre>
1324
1325 !! end
1326
1327 !! test
1328 Regression with preformatted in <center>
1329 !! input
1330 <center>
1331 Blah
1332 </center>
1333 !! result
1334 <center>
1335 <pre>Blah
1336 </pre>
1337 </center>
1338
1339 !! end
1340
1341 !! test
1342 Bug 6200: Preformatted in <blockquote>
1343 !! input
1344 <blockquote>
1345 Blah
1346 </blockquote>
1347 !! result
1348 <blockquote>
1349 <pre>Blah
1350 </pre>
1351 </blockquote>
1352
1353 !! end
1354
1355 !! test
1356 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1357 !! input
1358 <blockquote>
1359 Foo
1360
1361 Bar
1362 </blockquote>
1363 !! result
1364 <blockquote>
1365 <p>Foo
1366 </p><p>Bar
1367 </p>
1368 </blockquote>
1369
1370 !! end
1371
1372 !! test
1373 Bug 15491: <ins>/<del> in blockquote
1374 !! input
1375 <blockquote>
1376 Foo <del>bar</del> <ins>baz</ins> quux
1377 </blockquote>
1378 !! result
1379 <blockquote>
1380 <p>Foo <del>bar</del> <ins>baz</ins> quux
1381 </p>
1382 </blockquote>
1383
1384 !! end
1385
1386 # Note that the p-wrapping is newline sensitive, which could be
1387 # considered a bug: tidy will wrap only the 'Foo' in the example
1388 # below in a <p> tag. (see comment 23-25 of bug #6200)
1389 !! test
1390 Bug 15491: <ins>/<del> in blockquote (2)
1391 !! input
1392 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1393 </blockquote>
1394 !! result
1395 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1396 </blockquote>
1397
1398 !! end
1399
1400 !! test
1401 <pre> with attributes (bug 3202)
1402 !! input
1403 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1404 !! result
1405 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1406
1407 !! end
1408
1409 !! test
1410 <pre> with width attribute (bug 3202)
1411 !! input
1412 <pre width="8">Narrow screen goodies</pre>
1413 !! result
1414 <pre width="8">Narrow screen goodies</pre>
1415
1416 !! end
1417
1418 !! test
1419 <pre> with forbidden attribute (bug 3202)
1420 !! input
1421 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1422 !! result
1423 <pre width="8">Narrow screen goodies</pre>
1424
1425 !! end
1426
1427 !! test
1428 Entities inside <pre>
1429 !! input
1430 <pre>&lt;</pre>
1431 !! result
1432 <pre>&lt;</pre>
1433
1434 !! end
1435
1436 !! test
1437 <pre> with forbidden attribute values (bug 3202)
1438 !! input
1439 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1440 !! result
1441 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1442
1443 !! end
1444
1445 !! test
1446 <nowiki> inside <pre> (bug 13238)
1447 !! input
1448 <pre>
1449 <nowiki>
1450 </pre>
1451 <pre>
1452 <nowiki></nowiki>
1453 </pre>
1454 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1455 !! result
1456 <pre>
1457 &lt;nowiki&gt;
1458 </pre>
1459 <pre>
1460
1461 </pre>
1462 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1463
1464 !! end
1465
1466 !! test
1467 <nowiki> and <pre> preference (first one wins)
1468 !! input
1469 <pre>
1470 <nowiki>
1471 </pre>
1472 </nowiki>
1473 </pre>
1474
1475 <nowiki>
1476 <pre>
1477 <nowiki>
1478 </pre>
1479 </nowiki>
1480 </pre>
1481
1482 !! result
1483 <pre>
1484 &lt;nowiki&gt;
1485 </pre>
1486 <p>&lt;/nowiki&gt;
1487 &lt;/pre&gt;
1488 </p><p>
1489 &lt;pre&gt;
1490 &lt;nowiki&gt;
1491 &lt;/pre&gt;
1492
1493 &lt;/pre&gt;
1494 </p>
1495 !! end
1496
1497 !! test
1498 </pre> inside nowiki
1499 !! input
1500 <nowiki></pre></nowiki>
1501 !! result
1502 <p>&lt;/pre&gt;
1503 </p>
1504 !! end
1505
1506 !!test
1507 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1508 !!input
1509 {{echo|}}
1510 !!result
1511
1512 !!end
1513
1514 !!test
1515 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1516 !!input
1517 {{echo|
1518 foo}}
1519 !!result
1520 <p>foo
1521 </p>
1522 !!end
1523
1524 !! test
1525 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1526 !! input
1527 {{echo|a
1528 b}}
1529 !!result
1530 <pre>a
1531 </pre>
1532 <p>b
1533 </p>
1534 !!end
1535
1536 !! test
1537 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1538 !! input
1539 {{echo|a
1540 b
1541 c
1542 d
1543 e
1544 }}
1545 !!result
1546 <pre>a
1547 </pre>
1548 <p>b
1549 c
1550 </p>
1551 <pre>d
1552 </pre>
1553 <p>e
1554 </p>
1555 !!end
1556
1557 !!test
1558 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1559 !!input
1560 {{echo| foo}}
1561
1562 {{echo| foo}}{{echo| bar}}
1563
1564 {{echo| foo}}
1565 {{echo| bar}}
1566
1567 {{echo|<!--cmt--> foo}}
1568
1569 <!--cmt-->{{echo| foo}}
1570
1571 {{echo|{{echo| }}bar}}
1572 !!result
1573 <pre>foo
1574 </pre>
1575 <pre>foo bar
1576 </pre>
1577 <pre>foo
1578 bar
1579 </pre>
1580 <pre>foo
1581 </pre>
1582 <pre>foo
1583 </pre>
1584 <pre>bar
1585 </pre>
1586 !!end
1587
1588 !! test
1589 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1590 !! input
1591 {{echo| }}a
1592
1593 {{echo|
1594 }}a
1595
1596 {{echo|
1597 b}}
1598
1599 {{echo|a
1600 }}b
1601
1602 {{echo|a
1603 }} b
1604 !!result
1605 <pre>a
1606 </pre>
1607 <p><br />
1608 </p>
1609 <pre>a
1610 </pre>
1611 <p><br />
1612 </p>
1613 <pre>b
1614 </pre>
1615 <p>a
1616 </p>
1617 <pre>b
1618 </pre>
1619 <p>a
1620 </p>
1621 <pre>b
1622 </pre>
1623 !!end
1624
1625 !! test
1626 Templates: Single-line variant of parameter whitespace stripping test
1627 !! input
1628 {{echo| a}}
1629
1630 {{echo|1= a}}
1631
1632 {{echo|{{echo| a}}}}
1633
1634 {{echo|1={{echo| a}}}}
1635 !! result
1636 <pre>a
1637 </pre>
1638 <p>a
1639 </p>
1640 <pre>a
1641 </pre>
1642 <p>a
1643 </p>
1644 !! end
1645
1646 !! test
1647 Templates: Strip whitespace from named parameters, but not positional ones
1648 !! input
1649 {{echo|
1650 foo}}
1651
1652 {{echo|
1653 * foo}}
1654
1655 {{echo| 1 =
1656 foo}}
1657
1658 {{echo| 1 =
1659 * foo}}
1660 !! result
1661 <pre>foo
1662 </pre>
1663 <p><br />
1664 </p>
1665 <ul><li> foo
1666 </li></ul>
1667 <p>foo
1668 </p>
1669 <ul><li> foo
1670 </li></ul>
1671
1672 !! end
1673
1674 !! test
1675 Templates: Dont strip whitespace from whitespace/comment-only arguments
1676 !! input
1677 {{echo| }}
1678 {{echo|<!--cmt-->}}
1679 {{echo| <!--cmt--> }}
1680 !! result
1681 <p><br />
1682 </p>
1683 !! end
1684
1685 !! test
1686 Templates: Parsoid parameter escaping test 1
1687 !! options
1688 parsoid
1689 !! input
1690 {{echo|[foo]|{{echo|[bar]}}}}
1691 !! result
1692 <p about="#mwt1" typeof="mw:Transclusion"
1693 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>
1694 !! end
1695
1696 !! test
1697 Parsoid: Pipes in external links in template parameter
1698 !! options
1699 parsoid
1700 !! input
1701 {{echo|[{{echo|http://example.com}} link]}}
1702 !! result
1703 <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>
1704 !! end
1705
1706 !! test
1707 Parsoid: pipe in transclusion parameter
1708 !! options
1709 parsoid
1710 !! input
1711 {{echo|http://foo.com/a&#124;b}}
1712 !! result
1713 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1714 typeof="mw:Transclusion"
1715 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>
1716 !! end
1717
1718 !! test
1719 Parsoid: Pipe in external link target and content in template parameter
1720 !! options
1721 parsoid=html2wt,wt2wt
1722 !! input
1723 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1724 !! result
1725 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1726 typeof="mw:Transclusion"
1727 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1728 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1729 !! end
1730
1731 !! test
1732 Templates: Dont escape already nowiki-escaped text in template parameters
1733 !! options
1734 parsoid=html2wt,wt2wt
1735 !! input
1736 {{echo|foo<nowiki>|</nowiki>bar}}
1737 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1738 {{echo|<nowiki></nowiki>}}
1739 !! result
1740 <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>
1741 <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>
1742 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1743 </p>
1744 !! end
1745
1746 ###
1747 ### Parsoid-centric tests for testing RT edge cases for pre
1748 ###
1749
1750 !!test
1751 1a. Indent-Pre and Comments
1752 !!input
1753 a
1754 <!--a-->
1755 c
1756 !!result
1757 <pre>a
1758 </pre>
1759 <p>c
1760 </p>
1761 !!end
1762
1763 !!test
1764 1b. Indent-Pre and Comments
1765 !!input
1766 a
1767 <!--a-->
1768 c
1769 !!result
1770 <pre>a
1771 </pre>
1772 <p>c
1773 </p>
1774 !!end
1775
1776 !!test
1777 1c. Indent-Pre and Comments
1778 !!input
1779 <!--a--> a
1780
1781 <!--a--> a
1782 !!result
1783 <pre> a
1784 </pre>
1785 <pre> a
1786 </pre>
1787 !!end
1788
1789 !!test
1790 2a. Indent-Pre and tables
1791 !!input
1792 {|
1793 |-
1794 !h1!!h2
1795 |foo||bar
1796 |}
1797 !!result
1798 <table>
1799
1800 <tr>
1801 <th>h1</th>
1802 <th>h2
1803 </th>
1804 <td>foo</td>
1805 <td>bar
1806 </td></tr></table>
1807
1808 !!end
1809
1810 !!test
1811 2b. Indent-Pre and tables
1812 !!input
1813 {|
1814 |-
1815 |foo
1816 |}
1817 !!result
1818 <table>
1819
1820 <tr>
1821 <td>foo
1822 </td></tr></table>
1823
1824 !!end
1825
1826 !!test
1827 2c. Indent-Pre and tables (bug 42252)
1828 !!input
1829 {|
1830 |+ foo
1831 ! | bar
1832 |}
1833 !!result
1834 <table>
1835 <caption> foo
1836 </caption>
1837 <tr>
1838 <th> bar
1839 </th></tr></table>
1840
1841 !!end
1842
1843 !!test
1844 3a. Indent-Pre and block tags (single-line html)
1845 !!input
1846 <p> foo </p>
1847 <div> foo </div>
1848 <span> foo </span>
1849 !!result
1850 <p> foo </p>
1851 <div> foo </div>
1852 <pre><span> foo </span>
1853 </pre>
1854 !!end
1855
1856 !!test
1857 3b. Indent-Pre and block tags (pre-content on separate line)
1858 !!input
1859 <p>
1860 foo
1861 </p>
1862
1863 <div>
1864 foo
1865 </div>
1866
1867 <center>
1868 foo
1869 </center>
1870
1871 <blockquote>
1872 foo
1873 </blockquote>
1874
1875 <table><tr><td>
1876 foo
1877 </td></tr></table>
1878
1879 <ul><li>
1880 foo
1881 </li></ul>
1882
1883 !!result
1884 <p>
1885 foo
1886 </p>
1887 <div>
1888 <pre>foo
1889 </pre>
1890 </div>
1891 <center>
1892 <pre>foo
1893 </pre>
1894 </center>
1895 <blockquote>
1896 <pre>foo
1897 </pre>
1898 </blockquote>
1899 <table><tr><td>
1900 <pre>foo
1901 </pre>
1902 </td></tr></table>
1903 <ul><li>
1904 foo
1905 </li></ul>
1906
1907 !!end
1908
1909 !!test
1910 4. Multiple spaces at start-of-line
1911 !!input
1912 <p> foo </p>
1913 foo
1914 {|
1915 |foo
1916 |}
1917 !!result
1918 <p> foo </p>
1919 <pre> foo
1920 </pre>
1921 <table>
1922 <tr>
1923 <td>foo
1924 </td></tr></table>
1925
1926 !!end
1927
1928 !! test
1929 5. White-space in indent-pre
1930 NOTE: the white-space char on 2nd line is significant
1931 !! input
1932 a<br/>
1933
1934 b
1935 !! result
1936 <pre>a<br />
1937
1938 b
1939 </pre>
1940 !! end
1941
1942 ###
1943 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1944 ###
1945
1946 !!test
1947 HTML-pre: 1. embedded newlines
1948 !!input
1949 <pre>foo</pre>
1950
1951 <pre>
1952 foo
1953 </pre>
1954
1955 <pre>
1956
1957 foo
1958 </pre>
1959
1960 <pre>
1961
1962
1963 foo
1964 </pre>
1965 !!result
1966 <pre>foo</pre>
1967 <pre>
1968 foo
1969 </pre>
1970 <pre>
1971
1972 foo
1973 </pre>
1974 <pre>
1975
1976
1977 foo
1978 </pre>
1979
1980 !!end
1981
1982 !!test
1983 HTML-pre: 2: indented text
1984 !!input
1985 <pre>
1986 foo
1987 </pre>
1988 !!result
1989 <pre>
1990 foo
1991 </pre>
1992
1993 !!end
1994
1995 !!test
1996 HTML-pre: 3: other wikitext
1997 !!input
1998 <pre>
1999 * foo
2000 # bar
2001 = no-h =
2002 '' no-italic ''
2003 [[ NoLink ]]
2004 </pre>
2005 !!result
2006 <pre>
2007 * foo
2008 # bar
2009 = no-h =
2010 '' no-italic ''
2011 [[ NoLink ]]
2012 </pre>
2013
2014 !!end
2015
2016 ###
2017 ### Definition lists
2018 ###
2019 !! test
2020 Simple definition
2021 !! input
2022 ; name : Definition
2023 !! result
2024 <dl><dt> name&#160;</dt><dd> Definition
2025 </dd></dl>
2026
2027 !! end
2028
2029 !! test
2030 Definition list for indentation only
2031 !! input
2032 : Indented text
2033 !! result
2034 <dl><dd> Indented text
2035 </dd></dl>
2036
2037 !! end
2038
2039 !! test
2040 Definition list with no space
2041 !! input
2042 ;name:Definition
2043 !! result
2044 <dl><dt>name</dt><dd>Definition
2045 </dd></dl>
2046
2047 !!end
2048
2049 !! test
2050 Definition list with URL link
2051 !! input
2052 ; http://example.com/ : definition
2053 !! result
2054 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2055 </dd></dl>
2056
2057 !! end
2058
2059 !! test
2060 Definition list with bracketed URL link
2061 !! input
2062 ;[http://www.example.com/ Example]:Something about it
2063 !! result
2064 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2065 </dd></dl>
2066
2067 !! end
2068
2069 !! test
2070 Definition list with wikilink containing colon
2071 !! input
2072 ; [[Help:FAQ]]: The least-read page on Wikipedia
2073 !! result
2074 <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
2075 </dd></dl>
2076
2077 !! end
2078
2079 # At Brion's and JeLuF's insistence... :)
2080 !! test
2081 Definition list with news link containing colon
2082 !! input
2083 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2084 !! result
2085 <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!
2086 </dd></dl>
2087
2088 !! end
2089
2090 !! test
2091 Malformed definition list with colon
2092 !! input
2093 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2094 !! result
2095 <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
2096 </dt></dl>
2097
2098 !! end
2099
2100 !! test
2101 Definition lists: colon in external link text
2102 !! input
2103 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2104 !! result
2105 <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
2106 </dd></dl>
2107
2108 !! end
2109
2110 !! test
2111 Definition lists: colon in HTML attribute
2112 !! input
2113 ;<b style="display: inline">bold</b>
2114 !! result
2115 <dl><dt><b style="display: inline">bold</b>
2116 </dt></dl>
2117
2118 !! end
2119
2120 !! test
2121 Definition lists: self-closed tag
2122 !! input
2123 ;one<br/>two : two-line fun
2124 !! result
2125 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2126 </dd></dl>
2127
2128 !! end
2129
2130 !! test
2131 Bug 11748: Literal closing tags
2132 !! input
2133 <dl>
2134 <dt>test 1</dt>
2135 <dd>test test test test test</dd>
2136 <dt>test 2</dt>
2137 <dd>test test test test test</dd>
2138 </dl>
2139 !! result
2140 <dl>
2141 <dt>test 1</dt>
2142 <dd>test test test test test</dd>
2143 <dt>test 2</dt>
2144 <dd>test test test test test</dd>
2145 </dl>
2146
2147 !! end
2148
2149 !! test
2150 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2151 !! input
2152 <ul><li>
2153 ; term : description
2154 * unordered
2155 </li>
2156 </ul>
2157 !! result
2158 <ul><li>
2159 <dl><dt> term&#160;</dt><dd> description
2160 </dd></dl>
2161 <ul><li> unordered
2162 </li></ul>
2163 </li>
2164 </ul>
2165
2166 !! end
2167
2168 !! test
2169
2170 Definition list with empty definition and following paragraph
2171 !! input
2172 ; term:
2173 Paragraph text
2174 !! result
2175 <dl><dt> term</dt><dd>
2176 </dd></dl>
2177 <p>Paragraph text
2178 </p>
2179 !! end
2180
2181 !! test
2182 Nested definition lists using html syntax
2183 !! input
2184 <dl><dd>
2185 <dl>
2186 <dd>Foo</dd>
2187 </dl>
2188 </dd></dl>
2189 !! result
2190 <dl><dd>
2191 <dl>
2192 <dd>Foo</dd>
2193 </dl>
2194 </dd></dl>
2195
2196 !! end
2197
2198 !! test
2199 Definition Lists: No nesting: Multiple dd's
2200 !! input
2201 ;x
2202 :a
2203 :b
2204 !! result
2205 <dl><dt>x
2206 </dt><dd>a
2207 </dd><dd>b
2208 </dd></dl>
2209
2210 !! end
2211
2212 !! test
2213 Definition Lists: Indentation: Regular
2214 !! input
2215 :i1
2216 ::i2
2217 :::i3
2218 !! result
2219 <dl><dd>i1
2220 <dl><dd>i2
2221 <dl><dd>i3
2222 </dd></dl>
2223 </dd></dl>
2224 </dd></dl>
2225
2226 !! end
2227
2228 !! test
2229 Definition Lists: Indentation: Missing 1st level
2230 !! input
2231 ::i2
2232 :::i3
2233 !! result
2234 <dl><dd><dl><dd>i2
2235 <dl><dd>i3
2236 </dd></dl>
2237 </dd></dl>
2238 </dd></dl>
2239
2240 !! end
2241
2242 !! test
2243 Definition Lists: Indentation: Multi-level indent
2244 !! input
2245 :::i3
2246 !! result
2247 <dl><dd><dl><dd><dl><dd>i3
2248 </dd></dl>
2249 </dd></dl>
2250 </dd></dl>
2251
2252 !! end
2253
2254 !! test
2255 Definition Lists: Hacky use to indent tables
2256 !! input
2257 ::{|
2258 |foo
2259 |bar
2260 |}
2261 this text
2262 should be left alone
2263 !! result
2264 <dl><dd><dl><dd><table>
2265 <tr>
2266 <td>foo
2267 </td>
2268 <td>bar
2269 </td></tr></table></dd></dl></dd></dl>
2270 <p>this text
2271 should be left alone
2272 </p>
2273 !! end
2274 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2275 ## as an empty dt item. It also ignores all but the last ";" when followed
2276 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2277 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2278 ## ";"s.
2279 ##
2280 ## Ex: ";;t2 ::d2" is transformed into:
2281 ##
2282 ## <dl>
2283 ## <dt>t2 </dt>
2284 ## <dd>
2285 ## <dl>
2286 ## <dt></dt>
2287 ## <dd>d2</dd>
2288 ## </dl>
2289 ## </dd>
2290 ## </dl>
2291 ##
2292 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2293 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2294 ##
2295 ## <dl>
2296 ## <dt>
2297 ## <dl>
2298 ## <dt>t2 </dt>
2299 ## <dd>:d2</dd>
2300 ## </dl>
2301 ## </dt>
2302 ## </dl>
2303 ##
2304 ## All Parsoid only definition list tests have this difference.
2305 ##
2306 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2307 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2308
2309 !! test
2310 Table / list interaction: indented table with lists in table contents
2311 !! input
2312 :{|
2313 |-
2314 | a
2315 * b
2316 |-
2317 | c
2318 * d
2319 |}
2320 !! result
2321 <dl><dd><table>
2322
2323 <tr>
2324 <td> a
2325 <ul><li> b
2326 </li></ul>
2327 </td></tr>
2328 <tr>
2329 <td> c
2330 <ul><li> d
2331 </li></ul>
2332 </td></tr></table></dd></dl>
2333
2334 !! end
2335
2336 !!test
2337 Table / list interaction: lists nested in tables nested in indented lists
2338 !!input
2339 :{|
2340 |
2341 :a
2342 :b
2343 |
2344 *c
2345 *d
2346 |}
2347
2348 *e
2349 *f
2350 !!result
2351 <dl><dd><table>
2352 <tr>
2353 <td>
2354 <dl><dd>a
2355 </dd><dd>b
2356 </dd></dl>
2357 </td>
2358 <td>
2359 <ul><li>c
2360 </li><li>d
2361 </li></ul>
2362 </td></tr></table></dd></dl>
2363 <ul><li>e
2364 </li><li>f
2365 </li></ul>
2366
2367 !!end
2368
2369 !! test
2370 Definition Lists: Nesting: Multi-level (Parsoid only)
2371 !! options
2372 parsoid
2373 !! input
2374 ;t1 :d1
2375 ;;t2 ::d2
2376 ;;;t3 :::d3
2377 !! result
2378 <dl>
2379 <dt>t1 </dt>
2380 <dd>d1</dd>
2381 <dt>
2382 <dl>
2383 <dt>t2 </dt>
2384 <dd>:d2</dd>
2385 <dt>
2386 <dl>
2387 <dt>t3 </dt>
2388 <dd>::d3</dd>
2389 </dl>
2390 </dt>
2391 </dl>
2392 </dt>
2393 </dl>
2394
2395
2396 !! end
2397
2398
2399 !! test
2400 Definition Lists: Nesting: Test 2 (Parsoid only)
2401 !! options
2402 parsoid
2403 !! input
2404 ;t1
2405 ::d2
2406 !! result
2407 <dl>
2408 <dt>t1</dt>
2409 <dd>
2410 <dl>
2411 <dd>d2</dd>
2412 </dl>
2413 </dd>
2414 </dl>
2415
2416 !! end
2417
2418
2419 !! test
2420 Definition Lists: Nesting: Test 3 (Parsoid only)
2421 !! options
2422 parsoid
2423 !! input
2424 :;t1
2425 ::::d2
2426 !! result
2427 <dl>
2428 <dd>
2429 <dl>
2430 <dt>t1</dt>
2431 <dd>
2432 <dl>
2433 <dd>
2434 <dl>
2435 <dd>d2</dd>
2436 </dl>
2437 </dd>
2438 </dl>
2439 </dd>
2440 </dl>
2441 </dd>
2442 </dl>
2443
2444 !! end
2445
2446
2447 !! test
2448 Definition Lists: Nesting: Test 4
2449 !! input
2450 ::;t3
2451 :::d3
2452 !! result
2453 <dl><dd><dl><dd><dl><dt>t3
2454 </dt><dd>d3
2455 </dd></dl>
2456 </dd></dl>
2457 </dd></dl>
2458
2459 !! end
2460
2461
2462 ## The Parsoid team believes the following three test exposes a
2463 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2464 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2465 !! test
2466 Definition Lists: Mixed Lists: Test 1 (php)
2467 !! options
2468 php
2469 !! input
2470 :;* foo
2471 ::* bar
2472 :; baz
2473 !! result
2474 <dl><dd><dl><dt><ul><li> foo
2475 </li><li> bar
2476 </li></ul>
2477 </dt></dl>
2478 <dl><dt> baz
2479 </dt></dl>
2480 </dd></dl>
2481
2482 !! end
2483 !! test
2484 Definition Lists: Mixed Lists: Test 1 (parsoid)
2485 !! options
2486 parsoid
2487 !! input
2488 :;* foo
2489 ::* bar
2490 :; baz
2491 !! result
2492 <dl><dd><dl><dt><ul><li> foo
2493 </li></ul></dt><dd><ul><li> bar
2494 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2495 !! end
2496
2497 !! test
2498 Definition Lists: Mixed Lists: Test 2
2499 !! input
2500 *: d1
2501 *: d2
2502 !! result
2503 <ul><li><dl><dd> d1
2504 </dd><dd> d2
2505 </dd></dl>
2506 </li></ul>
2507
2508 !! end
2509
2510
2511 !! test
2512 Definition Lists: Mixed Lists: Test 3
2513 !! input
2514 *::: d1
2515 *::: d2
2516 !! result
2517 <ul><li><dl><dd><dl><dd><dl><dd> d1
2518 </dd><dd> d2
2519 </dd></dl>
2520 </dd></dl>
2521 </dd></dl>
2522 </li></ul>
2523
2524 !! end
2525
2526
2527 !! test
2528 Definition Lists: Mixed Lists: Test 4
2529 !! input
2530 *;d1 :d2
2531 *;d3 :d4
2532 !! result
2533 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2534 </dd><dt>d3&#160;</dt><dd>d4
2535 </dd></dl>
2536 </li></ul>
2537
2538 !! end
2539
2540
2541 !! test
2542 Definition Lists: Mixed Lists: Test 5
2543 !! input
2544 *:d1
2545 *:: d2
2546 !! result
2547 <ul><li><dl><dd>d1
2548 <dl><dd> d2
2549 </dd></dl>
2550 </dd></dl>
2551 </li></ul>
2552
2553 !! end
2554
2555
2556 !! test
2557 Definition Lists: Mixed Lists: Test 6
2558 !! input
2559 #*:d1
2560 #*::: d3
2561 !! result
2562 <ol><li><ul><li><dl><dd>d1
2563 <dl><dd><dl><dd> d3
2564 </dd></dl>
2565 </dd></dl>
2566 </dd></dl>
2567 </li></ul>
2568 </li></ol>
2569
2570 !! end
2571
2572
2573 !! test
2574 Definition Lists: Mixed Lists: Test 7
2575 !! input
2576 :* d1
2577 :* d2
2578 !! result
2579 <dl><dd><ul><li> d1
2580 </li><li> d2
2581 </li></ul>
2582 </dd></dl>
2583
2584 !! end
2585
2586
2587 !! test
2588 Definition Lists: Mixed Lists: Test 8
2589 !! input
2590 :* d1
2591 ::* d2
2592 !! result
2593 <dl><dd><ul><li> d1
2594 </li></ul>
2595 <dl><dd><ul><li> d2
2596 </li></ul>
2597 </dd></dl>
2598 </dd></dl>
2599
2600 !! end
2601
2602
2603 !! test
2604 Definition Lists: Mixed Lists: Test 9
2605 !! input
2606 *;foo :bar
2607 !! result
2608 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2609 </dd></dl>
2610 </li></ul>
2611
2612 !! end
2613
2614
2615 !! test
2616 Definition Lists: Mixed Lists: Test 10
2617 !! input
2618 *#;foo :bar
2619 !! result
2620 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2621 </dd></dl>
2622 </li></ol>
2623 </li></ul>
2624
2625 !! end
2626
2627 # The Parsoid team disagrees with the PHP parser's seemingly-random
2628 # rules regarding dd/dt on the next two tests. Parsoid is more
2629 # consistent, and recognizes the shared nesting and keeps the
2630 # still-open tags around until the nesting is complete.
2631
2632 !! test
2633 Definition Lists: Mixed Lists: Test 11 (php)
2634 !! options
2635 php
2636 !! input
2637 *#*#;*;;foo :bar
2638 *#*#;boo :baz
2639 !! result
2640 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2641 </dt></dl>
2642 </dd></dl>
2643 </li></ul>
2644 </dd></dl>
2645 <dl><dt>boo&#160;</dt><dd>baz
2646 </dd></dl>
2647 </li></ol>
2648 </li></ul>
2649 </li></ol>
2650 </li></ul>
2651
2652 !! end
2653 !! test
2654 Definition Lists: Mixed Lists: Test 11 (parsoid)
2655 !! options
2656 parsoid
2657 !! input
2658 *#*#;*;;foo :bar
2659 *#*#;boo :baz
2660 !! result
2661 <ul>
2662 <li>
2663 <ol>
2664 <li>
2665 <ul>
2666 <li>
2667 <ol>
2668 <li>
2669 <dl>
2670 <dt>
2671 <ul>
2672 <li>
2673 <dl>
2674 <dt>
2675 <dl>
2676 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2677 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2678 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2679 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2680 !! end
2681
2682
2683 !! test
2684 Definition Lists: Weird Ones: Test 1 (php)
2685 !! options
2686 php
2687 !! input
2688 *#;*::;; foo : bar (who uses this?)
2689 !! result
2690 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2691 </dt></dl>
2692 </dd></dl>
2693 </dd></dl>
2694 </dd></dl>
2695 </li></ul>
2696 </dd></dl>
2697 </li></ol>
2698 </li></ul>
2699
2700 !! end
2701 !! test
2702 Definition Lists: Weird Ones: Test 1 (parsoid)
2703 !! options
2704 parsoid
2705 !! input
2706 *#;*::;; foo : bar (who uses this?)
2707 !! result
2708 <ul>
2709 <li>
2710 <ol>
2711 <li>
2712 <dl>
2713 <dt>
2714 <ul>
2715 <li>
2716 <dl>
2717 <dd>
2718 <dl>
2719 <dd>
2720 <dl>
2721 <dt>
2722 <dl>
2723 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2724 <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>
2725 !! end
2726
2727 ###
2728 ### External links
2729 ###
2730 !! test
2731 External links: non-bracketed
2732 !! input
2733 Non-bracketed: http://example.com
2734 !! result
2735 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2736 </p>
2737 !! end
2738
2739 !! test
2740 External links: numbered
2741 !! input
2742 Numbered: [http://example.com]
2743 Numbered: [http://example.net]
2744 Numbered: [http://example.com]
2745 !! result
2746 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2747 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2748 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2749 </p>
2750 !!end
2751
2752 !! test
2753 External links: specified text
2754 !! input
2755 Specified text: [http://example.com link]
2756 !! result
2757 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2758 </p>
2759 !!end
2760
2761 !! test
2762 External links: trail
2763 !! input
2764 Linktrails should not work for external links: [http://example.com link]s
2765 !! result
2766 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2767 </p>
2768 !! end
2769
2770 !! test
2771 External links: dollar sign in URL
2772 !! input
2773 http://example.com/1$2345
2774 !! result
2775 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2776 </p>
2777 !! end
2778
2779 !! test
2780 External links: dollar sign in URL (named)
2781 !! input
2782 [http://example.com/1$2345]
2783 !! result
2784 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2785 </p>
2786 !!end
2787
2788 !! test
2789 External links: open square bracket forbidden in URL (bug 4377)
2790 !! input
2791 http://example.com/1[2345
2792 !! result
2793 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2794 </p>
2795 !! end
2796
2797 !! test
2798 External links: open square bracket forbidden in URL (named) (bug 4377)
2799 !! input
2800 [http://example.com/1[2345]
2801 !! result
2802 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2803 </p>
2804 !!end
2805
2806 !! test
2807 External links: nowiki in URL link text (bug 6230)
2808 !!input
2809 [http://example.com/ <nowiki>''example site''</nowiki>]
2810 !! result
2811 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2812 </p>
2813 !! end
2814
2815 !! test
2816 External links: newline forbidden in text (bug 6230 regression check)
2817 !! input
2818 [http://example.com/ first
2819 second]
2820 !! result
2821 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2822 second]
2823 </p>
2824 !!end
2825
2826 !! test
2827 External links: Pipe char between url and text
2828 !! input
2829 [http://example.com | link]
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2832 </p>
2833 !!end
2834
2835 !! test
2836 External links: protocol-relative URL in brackets
2837 !! input
2838 [//example.com/ Test]
2839 !! result
2840 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2841 </p>
2842 !! end
2843
2844 !! test
2845 External links: protocol-relative URL in brackets without text
2846 !! input
2847 [//example.com]
2848 !! result
2849 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2850 </p>
2851 !! end
2852
2853 !! test
2854 External links: protocol-relative URL in free text is left alone
2855 !! input
2856 //example.com/Foo
2857 !! result
2858 <p>//example.com/Foo
2859 </p>
2860 !!end
2861
2862 !! test
2863 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2864 !! input
2865 foo//example.com/Foo
2866 !! result
2867 <p>foo//example.com/Foo
2868 </p>
2869 !! end
2870
2871 !! test
2872 External image
2873 !! input
2874 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2875 !! result
2876 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2877 </p>
2878 !! end
2879
2880 !! test
2881 External image from https
2882 !! input
2883 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2884 !! result
2885 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2886 </p>
2887 !! end
2888
2889 !! test
2890 External image (when not allowed)
2891 !! options
2892 wgAllowExternalImages=0
2893 !! input
2894 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2895 !! result
2896 <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>
2897 </p>
2898 !! end
2899
2900 !! test
2901 Link to non-http image, no img tag
2902 !! input
2903 Link to non-http image, no img tag: ftp://example.com/test.jpg
2904 !! result
2905 <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>
2906 </p>
2907 !! end
2908
2909 !! test
2910 External links: terminating separator
2911 !! input
2912 Terminating separator: http://example.com/thing,
2913 !! result
2914 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2915 </p>
2916 !! end
2917
2918 !! test
2919 External links: intervening separator
2920 !! input
2921 Intervening separator: http://example.com/1,2,3
2922 !! result
2923 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2924 </p>
2925 !! end
2926
2927 !! test
2928 External links: old bug with URL in query
2929 !! input
2930 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2931 !! result
2932 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2933 </p>
2934 !! end
2935
2936 !! test
2937 External links: old URL-in-URL bug, mixed protocols
2938 !! input
2939 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2940 !! result
2941 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2942 </p>
2943 !!end
2944
2945 !! test
2946 External links: URL in text
2947 !! input
2948 URL in text: [http://example.com http://example.com]
2949 !! result
2950 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2951 </p>
2952 !! end
2953
2954 !! test
2955 External links: Clickable images
2956 !! input
2957 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2958 !! result
2959 <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>
2960 </p>
2961 !!end
2962
2963 !! test
2964 External links: raw ampersand
2965 !! input
2966 Old &amp; use: http://x&y
2967 !! result
2968 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2969 </p>
2970 !! end
2971
2972 !! test
2973 External links: encoded ampersand
2974 !! input
2975 Old &amp; use: http://x&amp;y
2976 !! result
2977 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2978 </p>
2979 !! end
2980
2981 !! test
2982 External links: encoded equals (bug 6102)
2983 !! input
2984 http://example.com/?foo&#61;bar
2985 !! result
2986 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2987 </p>
2988 !! end
2989
2990 !! test
2991 External links: [raw ampersand]
2992 !! input
2993 Old &amp; use: [http://x&y]
2994 !! result
2995 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2996 </p>
2997 !! end
2998
2999 !! test
3000 External links: [encoded ampersand]
3001 !! input
3002 Old &amp; use: [http://x&amp;y]
3003 !! result
3004 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3005 </p>
3006 !! end
3007
3008 !! test
3009 External links: [encoded equals] (bug 6102)
3010 !! input
3011 [http://example.com/?foo&#61;bar]
3012 !! result
3013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3014 </p>
3015 !! end
3016
3017 !! test
3018 External links: [IDN ignored character reference in hostname; strip it right off]
3019 !! input
3020 [http://e&zwnj;xample.com/]
3021 !! result
3022 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3023 </p>
3024 !! end
3025
3026 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3027 # Where an external link could easily circumvent the sanitization of the text of
3028 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3029 # test demands a higher standard. That's a bit strange.
3030 #
3031 # Example:
3032 #
3033 # http://e‌xample.com -> [http://example.com|http://example.com]
3034 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3035 #
3036 # The first example is sanitized, but the second is not. Any security benefits
3037 # from this production are trivial to circumvent. Either remove this test and
3038 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3039 # the test accordingly.
3040 #
3041 # All our love,
3042 # The Parsoid team.
3043 !! test
3044 External links: IDN ignored character reference in hostname; strip it right off
3045 !! input
3046 http://e&zwnj;xample.com/
3047 !! result
3048 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3049 </p>
3050 !! end
3051
3052 !! test
3053 External links: www.jpeg.org (bug 554)
3054 !! input
3055 http://www.jpeg.org
3056 !!result
3057 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3058 </p>
3059 !! end
3060
3061 !! test
3062 External links: URL within URL (original bug 2)
3063 !! input
3064 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3065 !! result
3066 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3067 </p>
3068 !! end
3069
3070 !! test
3071 BUG 361: URL inside bracketed URL
3072 !! input
3073 [http://www.example.com/foo http://www.example.com/bar]
3074 !! result
3075 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3076 </p>
3077 !! end
3078
3079 !! test
3080 BUG 361: URL within URL, not bracketed
3081 !! input
3082 http://www.example.com/foo?=http://www.example.com/bar
3083 !! result
3084 <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>
3085 </p>
3086 !! end
3087
3088 !! test
3089 BUG 289: ">"-token in URL-tail
3090 !! input
3091 http://www.example.com/<hello>
3092 !! result
3093 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3094 </p>
3095 !!end
3096
3097 !! test
3098 BUG 289: literal ">"-token in URL-tail
3099 !! input
3100 http://www.example.com/<b>html</b>
3101 !! result
3102 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3103 </p>
3104 !!end
3105
3106 !! test
3107 BUG 289: ">"-token in bracketed URL
3108 !! input
3109 [http://www.example.com/<hello> stuff]
3110 !! result
3111 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3112 </p>
3113 !!end
3114
3115 !! test
3116 BUG 289: literal ">"-token in bracketed URL
3117 !! input
3118 [http://www.example.com/<b>html</b> stuff]
3119 !! result
3120 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3121 </p>
3122 !!end
3123
3124 !! test
3125 BUG 289: literal double quote at end of URL
3126 !! input
3127 http://www.example.com/"hello"
3128 !! result
3129 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3130 </p>
3131 !!end
3132
3133 !! test
3134 BUG 289: literal double quote in bracketed URL
3135 !! input
3136 [http://www.example.com/"hello" stuff]
3137 !! result
3138 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3139 </p>
3140 !!end
3141
3142 !! test
3143 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3144 !! input
3145 [http://www.example.com test]
3146 !! result
3147 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3148 </p>
3149 !! end
3150
3151 !! test
3152 External links: link text with spaces
3153 !! input
3154 [http://www.example.com a b c]
3155 [http://www.example.com ''a'' ''b'']
3156 !! result
3157 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3158 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3159 </p>
3160 !! end
3161
3162 !! test
3163 External links: wiki links within external link (Bug 3695)
3164 !! input
3165 [http://example.com [[wikilink]] embedded in ext link]
3166 !! result
3167 <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>
3168 </p>
3169 !! end
3170
3171 !! test
3172 BUG 787: Links with one slash after the url protocol are invalid
3173 !! input
3174 http:/example.com
3175
3176 [http:/example.com title]
3177 !! result
3178 <p>http:/example.com
3179 </p><p>[http:/example.com title]
3180 </p>
3181 !! end
3182
3183 !! test
3184 Bracketed external links with template-generated invalid target
3185 !! input
3186 [{{echo|http:/example.com}} title]
3187 !! result
3188 <p>[http:/example.com title]
3189 </p>
3190 !! end
3191
3192 !! test
3193 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3194 !! input
3195 ''[http://example.com text'']
3196 [http://example.com '''text]'''
3197 ''Something [http://example.com in italic'']
3198 ''Something [http://example.com mixed''''', even bold]'''
3199 '''''Now [http://example.com both''''']
3200 !! result
3201 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3202 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3203 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3204 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3205 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3206 </p>
3207 !! end
3208
3209
3210 !! test
3211 Bug 4781: %26 in URL
3212 !! input
3213 http://www.example.com/?title=AT%26T
3214 !! result
3215 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3216 </p>
3217 !! end
3218
3219 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3220 # % is actually legal in HTML5. Any change in output would need testing though.
3221 !! test
3222 Bug 4781, 5267: %25 in URL
3223 !! input
3224 http://www.example.com/?title=100%25_Bran
3225 !! result
3226 <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>
3227 </p>
3228 !! end
3229
3230 !! test
3231 Bug 4781, 5267: %28, %29 in URL
3232 !! input
3233 http://www.example.com/?title=Ben-Hur_%281959_film%29
3234 !! result
3235 <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>
3236 </p>
3237 !! end
3238
3239
3240 !! test
3241 Bug 4781: %26 in autonumber URL
3242 !! input
3243 [http://www.example.com/?title=AT%26T]
3244 !! result
3245 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3246 </p>
3247 !! end
3248
3249 !! test
3250 Bug 4781, 5267: %26 in autonumber URL
3251 !! input
3252 [http://www.example.com/?title=100%25_Bran]
3253 !! result
3254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3255 </p>
3256 !! end
3257
3258 !! test
3259 Bug 4781, 5267: %28, %29 in autonumber URL
3260 !! input
3261 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3262 !! result
3263 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3264 </p>
3265 !! end
3266
3267
3268 !! test
3269 Bug 4781: %26 in bracketed URL
3270 !! input
3271 [http://www.example.com/?title=AT%26T link]
3272 !! result
3273 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3274 </p>
3275 !! end
3276
3277 !! test
3278 Bug 4781, 5267: %26 in bracketed URL
3279 !! input
3280 [http://www.example.com/?title=100%25_Bran link]
3281 !! result
3282 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3283 </p>
3284 !! end
3285
3286 !! test
3287 Bug 4781, 5267: %28, %29 in bracketed URL
3288 !! input
3289 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3290 !! result
3291 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3292 </p>
3293 !! end
3294
3295 !! test
3296 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3297 !! input
3298 Some [http://example.com/ pretty ''italics'' and stuff]!
3299 !! result
3300 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3301 </p>
3302 !! end
3303
3304 !! test
3305 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3306 !! input
3307 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3308 !! result
3309 <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>
3310 </p>
3311 !! end
3312
3313 !! test
3314 External link containing double-single-quotes with no space separating the url from text in italics
3315 !! input
3316 [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]].]
3317 !! result
3318 <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>
3319 </p>
3320 !! end
3321
3322 !! test
3323 External link with comments in link text
3324 !! input
3325 [http://www.google.com Google <!-- comment -->]
3326 !! result
3327 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3328 </p>
3329 !! end
3330
3331 !! test
3332 URL-encoding in URL functions (single parameter)
3333 !! input
3334 {{localurl:Some page|amp=&}}
3335 !! result
3336 <p>/index.php?title=Some_page&amp;amp=&amp;
3337 </p>
3338 !! end
3339
3340 !! test
3341 URL-encoding in URL functions (multiple parameters)
3342 !! input
3343 {{localurl:Some page|q=?&amp=&}}
3344 !! result
3345 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3346 </p>
3347 !! end
3348
3349 !! test
3350 Brackets in urls
3351 !! input
3352 http://example.com/index.php?foozoid%5B%5D=bar
3353
3354 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3355 !! result
3356 <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>
3357 </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>
3358 </p>
3359 !! end
3360
3361 !! test
3362 IPv6 urls (bug 21261)
3363 !! options
3364 disabled
3365 !! input
3366 http://[2404:130:0:1000::187:2]/index.php
3367 !! result
3368 <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>
3369 </p>
3370 !! end
3371
3372 !! test
3373 Non-extlinks in brackets
3374 !! input
3375 [foo]
3376 [foo bar]
3377 [foo ''bar'']
3378 [fool's] errand
3379 [fool's errand]
3380 [{{echo|foo}}]
3381 [{{echo|foo}} bar]
3382 [{{echo|foo}} ''bar'']
3383 [{{echo|foo}}l's] errand
3384 [{{echo|foo}}l's errand]
3385 [url={{echo|foo}}]
3386 [url=http://example.com]
3387 !! result
3388 <p>[foo]
3389 [foo bar]
3390 [foo <i>bar</i>]
3391 [fool's] errand
3392 [fool's errand]
3393 [foo]
3394 [foo bar]
3395 [foo <i>bar</i>]
3396 [fool's] errand
3397 [fool's errand]
3398 [url=foo]
3399 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3400 </p>
3401 !! end
3402
3403 !! test
3404 Parsoid: Percent encoding in external links
3405 !! options
3406 parsoid
3407 !! input
3408 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3409 !! result
3410 <p><a rel="mw:ExtLink"
3411 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3412 !! end
3413
3414 !! test
3415 Parsoid: use url link syntax for links where the content is equal the link
3416 target
3417 !! options
3418 parsoid
3419 !! input
3420 http://example.com
3421 !! result
3422 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3423 !! end
3424
3425 ###
3426 ### Quotes
3427 ###
3428
3429 !! test
3430 Quotes
3431 !! input
3432 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3433
3434 Normal text. '''''Bold italic text.''''' Normal text.
3435 !!result
3436 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3437 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3438 </p>
3439 !! end
3440
3441
3442 !! test
3443 Unclosed and unmatched quotes (php)
3444 !! options
3445 php
3446 !! input
3447 '''''Bold italic text '''with bold deactivated''' in between.'''''
3448
3449 '''''Bold italic text ''with italic deactivated'' in between.'''''
3450
3451 '''Bold text..
3452
3453 ..spanning two paragraphs (should not work).'''
3454
3455 '''Bold tag left open
3456
3457 ''Italic tag left open
3458
3459 Normal text.
3460
3461 <!-- Unmatching number of opening, closing tags: -->
3462 '''This year''''s election ''should'' beat '''last year''''s.
3463
3464 ''Tom'''s car is bigger than ''Susan'''s.
3465
3466 Plain ''italic'''s plain
3467 !! result
3468 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3469 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3470 </p><p><b>Bold text..</b>
3471 </p><p>..spanning two paragraphs (should not work).
3472 </p><p><b>Bold tag left open</b>
3473 </p><p><i>Italic tag left open</i>
3474 </p><p>Normal text.
3475 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3476 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3477 </p><p>Plain <i>italic'</i>s plain
3478 </p>
3479 !! end
3480 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3481 # parser strips. The wikitext contains just the first half of the bold
3482 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3483 # differently than the PHP parser.)
3484 !! test
3485 Unclosed and unmatched quotes (parsoid)
3486 !! options
3487 parsoid
3488 !! input
3489 '''''Bold italic text '''with bold deactivated''' in between.'''''
3490
3491 '''''Bold italic text ''with italic deactivated'' in between.'''''
3492
3493 '''Bold text..
3494
3495 ..spanning two paragraphs (should not work).'''
3496
3497 '''Bold tag left open
3498
3499 ''Italic tag left open
3500
3501 Normal text.
3502
3503 <!-- Unmatching number of opening, closing tags: -->
3504 '''This year''''s election ''should'' beat '''last year''''s.
3505
3506 ''Tom'''s car is bigger than ''Susan'''s.
3507
3508 Plain ''italic'''s plain
3509 !! result
3510 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3511 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3512 </p><p><b>Bold text..</b>
3513 </p><p>..spanning two paragraphs (should not work).<b></b>
3514 </p><p><b>Bold tag left open</b>
3515 </p><p><i>Italic tag left open</i>
3516 </p><p>Normal text.
3517 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3518 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3519 </p><p>Plain <i>italic'</i>s plain
3520 </p>
3521 !! end
3522
3523 ###
3524 ### Tables
3525 ###
3526 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3527 ###
3528
3529 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3530 # is the bare minimum required by the spec, see:
3531 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3532 !! test
3533 A table with no data. (php)
3534 !! options
3535 php
3536 !! input
3537 {||}
3538 !! result
3539 !! end
3540 # Parsoid team replies: empty table tags are legal in HTML5
3541 !! test
3542 A table with no data. (parsoid)
3543 !! options
3544 parsoid
3545 !! input
3546 {||}
3547 !! result
3548 <table></table>
3549 !! end
3550
3551 # A table with nothing but a caption is invalid XHTML, we might want to render
3552 # this as <p>caption</p>
3553 !! test
3554 A table with nothing but a caption (php)
3555 !! options
3556 php
3557 !! input
3558 {|
3559 |+ caption
3560 |}
3561 !! result
3562 <table>
3563 <caption> caption
3564 </caption><tr><td></td></tr></table>
3565
3566 !! end
3567 # Parsoid team replies: table with only a caption is legal in HTML5
3568 !! test
3569 A table with nothing but a caption (parsoid)
3570 !! options
3571 parsoid
3572 !! input
3573 {|
3574 |+ caption
3575 |}
3576 !! result
3577 <table><caption> caption</caption></table>
3578 !! end
3579
3580 !! test
3581 A table with caption with default-spaced attributes and a table row
3582 !! input
3583 {|
3584 |+ style="color: red;" | caption1
3585 |-
3586 | foo
3587 |}
3588 !! result
3589 <table>
3590 <caption style="color: red;"> caption1
3591 </caption>
3592 <tr>
3593 <td> foo
3594 </td></tr></table>
3595
3596 !! end
3597
3598 !! test
3599 A table with captions with non-default spaced attributes and a table row
3600 !! input
3601 {|
3602 |+style="color: red;"|caption2
3603 |+ style="color: red;"| caption3
3604 |-
3605 | foo
3606 |}
3607 !! result
3608 <table>
3609 <caption style="color: red;">caption2
3610 </caption>
3611 <caption style="color: red;"> caption3
3612 </caption>
3613 <tr>
3614 <td> foo
3615 </td></tr></table>
3616
3617 !! end
3618
3619 !! test
3620 Table td-cell syntax variations
3621 !! input
3622 {|
3623 | foo bar foo | baz
3624 | foo bar foo || baz
3625 | style='color:red;' | baz
3626 | style='color:red;' || baz
3627 |}
3628 !! result
3629 <table>
3630 <tr>
3631 <td> baz
3632 </td>
3633 <td> foo bar foo </td>
3634 <td> baz
3635 </td>
3636 <td style="color:red;"> baz
3637 </td>
3638 <td> style='color:red;' </td>
3639 <td> baz
3640 </td></tr></table>
3641
3642 !! end
3643
3644 !! test
3645 Simple table
3646 !! input
3647 {|
3648 | 1 || 2
3649 |-
3650 | 3 || 4
3651 |}
3652 !! result
3653 <table>
3654 <tr>
3655 <td> 1 </td>
3656 <td> 2
3657 </td></tr>
3658 <tr>
3659 <td> 3 </td>
3660 <td> 4
3661 </td></tr></table>
3662
3663 !! end
3664
3665 !! test
3666 Simple table but with multiple dashes for row wikitext
3667 !! input
3668 {|
3669 | foo
3670 |-----
3671 | bar
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td> foo
3677 </td></tr>
3678 <tr>
3679 <td> bar
3680 </td></tr></table>
3681
3682 !! end
3683 !! test
3684 Multiplication table
3685 !! input
3686 {| border="1" cellpadding="2"
3687 |+Multiplication table
3688 |-
3689 ! &times; !! 1 !! 2 !! 3
3690 |-
3691 ! 1
3692 | 1 || 2 || 3
3693 |-
3694 ! 2
3695 | 2 || 4 || 6
3696 |-
3697 ! 3
3698 | 3 || 6 || 9
3699 |-
3700 ! 4
3701 | 4 || 8 || 12
3702 |-
3703 ! 5
3704 | 5 || 10 || 15
3705 |}
3706 !! result
3707 <table border="1" cellpadding="2">
3708 <caption>Multiplication table
3709 </caption>
3710 <tr>
3711 <th> &#215; </th>
3712 <th> 1 </th>
3713 <th> 2 </th>
3714 <th> 3
3715 </th></tr>
3716 <tr>
3717 <th> 1
3718 </th>
3719 <td> 1 </td>
3720 <td> 2 </td>
3721 <td> 3
3722 </td></tr>
3723 <tr>
3724 <th> 2
3725 </th>
3726 <td> 2 </td>
3727 <td> 4 </td>
3728 <td> 6
3729 </td></tr>
3730 <tr>
3731 <th> 3
3732 </th>
3733 <td> 3 </td>
3734 <td> 6 </td>
3735 <td> 9
3736 </td></tr>
3737 <tr>
3738 <th> 4
3739 </th>
3740 <td> 4 </td>
3741 <td> 8 </td>
3742 <td> 12
3743 </td></tr>
3744 <tr>
3745 <th> 5
3746 </th>
3747 <td> 5 </td>
3748 <td> 10 </td>
3749 <td> 15
3750 </td></tr></table>
3751
3752 !! end
3753
3754 !! test
3755 Accept "||" in table headings
3756 !! input
3757 {|
3758 !h1 || h2
3759 |}
3760 !! result
3761 <table>
3762 <tr>
3763 <th>h1 </th>
3764 <th> h2
3765 </th></tr></table>
3766
3767 !! end
3768
3769 !! test
3770 Accept "||" in indented table headings
3771 !! input
3772 :{|
3773 !h1 || h2
3774 |}
3775 !! result
3776 <dl><dd><table>
3777 <tr>
3778 <th>h1 </th>
3779 <th> h2
3780 </th></tr></table></dd></dl>
3781
3782 !! end
3783
3784 !! test
3785 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3786 !! input
3787 {|
3788 !| h1
3789 || a
3790 |}
3791 !! result
3792 <table>
3793 <tr>
3794 <th> h1
3795 </th>
3796 <td> a
3797 </td></tr></table>
3798
3799 !! end
3800
3801 !!test
3802 Accept "| !" at start of line in tables (ignore !-attribute)
3803 !!input
3804 {|
3805 |-
3806 | !style="color:red" | bar
3807 |}
3808 !!result
3809 <table>
3810
3811 <tr>
3812 <td> bar
3813 </td></tr></table>
3814
3815 !!end
3816
3817 !!test
3818 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 +/-
3819 !!input
3820 {|
3821 |-
3822 |style='color:red;'|+1
3823 |style='color:blue;'|-1
3824 |-
3825 | 1 || 2 || 3
3826 | 1 ||+2 ||-3
3827 |-
3828 | +1
3829 | -1
3830 |}
3831 !!result
3832 <table>
3833
3834 <tr>
3835 <td style="color:red;">+1
3836 </td>
3837 <td style="color:blue;">-1
3838 </td></tr>
3839 <tr>
3840 <td> 1 </td>
3841 <td> 2 </td>
3842 <td> 3
3843 </td>
3844 <td> 1 </td>
3845 <td>+2 </td>
3846 <td>-3
3847 </td></tr>
3848 <tr>
3849 <td> +1
3850 </td>
3851 <td> -1
3852 </td></tr></table>
3853
3854 !!end
3855
3856 !! test
3857 Table rowspan
3858 !! input
3859 {| border=1
3860 | Cell 1, row 1
3861 |rowspan=2| Cell 2, row 1 (and 2)
3862 | Cell 3, row 1
3863 |-
3864 | Cell 1, row 2
3865 | Cell 3, row 2
3866 |}
3867 !! result
3868 <table border="1">
3869 <tr>
3870 <td> Cell 1, row 1
3871 </td>
3872 <td rowspan="2"> Cell 2, row 1 (and 2)
3873 </td>
3874 <td> Cell 3, row 1
3875 </td></tr>
3876 <tr>
3877 <td> Cell 1, row 2
3878 </td>
3879 <td> Cell 3, row 2
3880 </td></tr></table>
3881
3882 !! end
3883
3884 !! test
3885 Nested table
3886 !! input
3887 {| border=1
3888 | &alpha;
3889 |
3890 {| bgcolor=#ABCDEF border=2
3891 |nested
3892 |-
3893 |table
3894 |}
3895 |the original table again
3896 |}
3897 !! result
3898 <table border="1">
3899 <tr>
3900 <td> &#945;
3901 </td>
3902 <td>
3903 <table bgcolor="#ABCDEF" border="2">
3904 <tr>
3905 <td>nested
3906 </td></tr>
3907 <tr>
3908 <td>table
3909 </td></tr></table>
3910 </td>
3911 <td>the original table again
3912 </td></tr></table>
3913
3914 !! end
3915
3916 !! test
3917 Invalid attributes in table cell (bug 1830)
3918 !! input
3919 {|
3920 |Cell:|broken
3921 |}
3922 !! result
3923 <table>
3924 <tr>
3925 <td>broken
3926 </td></tr></table>
3927
3928 !! end
3929
3930
3931 !! test
3932 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3933 !! input
3934 {|
3935 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3936 !! result
3937 <table>
3938 <tr>
3939 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3940 <td>]" onmouseover="alert(document.cookie)"&gt;test
3941 </td>
3942 </tr>
3943 </table>
3944
3945 !! end
3946
3947
3948 !! test
3949 Indented table markup mixed with indented pre content (proposed in bug 6200)
3950 !! input
3951 <table>
3952 <tr>
3953 <td>
3954 Text that should be rendered preformatted
3955 </td>
3956 </tr>
3957 </table>
3958 !! result
3959 <table>
3960 <tr>
3961 <td>
3962 <pre>Text that should be rendered preformatted
3963 </pre>
3964 </td>
3965 </tr>
3966 </table>
3967
3968 !! end
3969
3970 !! test
3971 Template-generated table cell attributes and cell content
3972 !! input
3973 {|
3974 |{{table_attribs}}
3975 |}
3976 !! result
3977 <table>
3978 <tr>
3979 <td style="color: red"> Foo
3980 </td></tr></table>
3981
3982 !! end
3983
3984 !! test
3985 Template-generated table cell attributes and cell content (2)
3986 !! input
3987 {|
3988 |align=center {{table_attribs}}
3989 |}
3990 !! result
3991 <table>
3992 <tr>
3993 <td align="center" style="color: red"> Foo
3994 </td></tr></table>
3995
3996 !! end
3997
3998 !! test
3999 Template-generated table cell attributes and cell content (3)
4000 !! input
4001 {|
4002 |align=center {{table_cells}}
4003 |}
4004 !! result
4005 <table>
4006 <tr>
4007 <td align="center" style="color: red"> Foo </td>
4008 <td> Bar </td>
4009 <td> Baz
4010 </td></tr></table>
4011
4012 !! end
4013
4014 !! test
4015 Table with row followed by newlines and table heading
4016 !! input
4017 {|
4018 |-
4019
4020 ! foo
4021 |}
4022 !! result
4023 <table>
4024
4025
4026 <tr>
4027 <th> foo
4028 </th></tr></table>
4029
4030 !! end
4031
4032 !! test
4033 Table with empty line following the start tag
4034 !! input
4035 {|
4036
4037 |-
4038 | foo
4039 |}
4040 !! result
4041 <table>
4042
4043
4044 <tr>
4045 <td> foo
4046 </td></tr></table>
4047
4048 !! end
4049
4050 # FIXME: Preserve the attribute properly (with an empty string as value) in
4051 # the PHP parser. Parsoid implements the behavior below.
4052 !! test
4053 Table attributes with empty value
4054 !! options
4055 parsoid
4056 !! input
4057 {|
4058 | style=| hello
4059 |}
4060 !! result
4061 <table>
4062 <tbody>
4063 <tr>
4064 <td style=""> hello
4065 </td></tr></tbody></table>
4066
4067 !! end
4068
4069 !! test
4070 Wikitext table with a lot of comments
4071 !! input
4072 {|
4073 <!-- c0 -->
4074 | foo
4075 <!-- c1 -->
4076 |- <!-- c2 -->
4077 <!-- c3 -->
4078 |<!-- c4 -->
4079 <!-- c5 -->
4080 |}
4081 !! result
4082 <table>
4083 <tr>
4084 <td> foo
4085 </td></tr>
4086 <tr>
4087 <td>
4088 </td></tr></table>
4089
4090 !! end
4091
4092 !! test
4093 Wikitext table with double-line table cell
4094 !! input
4095 {|
4096 |a
4097 b
4098 |}
4099 !! result
4100 <table>
4101 <tr>
4102 <td>a
4103 <p>b
4104 </p>
4105 </td></tr></table>
4106
4107 !! end
4108
4109 !! test
4110 Table cell with a single comment
4111 !! input
4112 {|
4113 | <!-- c1 -->
4114 | a
4115 |}
4116 !! result
4117 <table>
4118 <tr>
4119 <td>
4120 </td>
4121 <td> a
4122 </td></tr></table>
4123
4124 !! end
4125
4126 # The expected HTML structure in this test is debatable. The PHP parser does
4127 # not parse this kind of table at all. The main focus for Parsoid is on
4128 # round-tripping, so this output is ok for now. TODO: revisit!
4129 !! test
4130 Wikitext table with html-syntax row (Parsoid)
4131 !! options
4132 parsoid
4133 !! input
4134 {|
4135 |-
4136 <td>foo</td>
4137 |}
4138 !! result
4139 <table>
4140 <tbody>
4141 <tr>
4142 <td>foo</td></tr></tbody></table>
4143 !! end
4144
4145 !! test
4146 Implicit <td> after a |-
4147 (PHP parser relies on Tidy to add the missing <td> tags)
4148 !! options
4149 parsoid=wt2html,wt2wt
4150 !! input
4151 {|
4152 |-
4153 a
4154 |}
4155 !! result
4156 <table>
4157 <tr><td>a</td></tr>
4158 </table>
4159 !! end
4160
4161 !! test
4162 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4163 (PHP parser relies on Tidy to add the missing <td> tags)
4164 !! options
4165 parsoid=wt2html,wt2wt
4166 !! input
4167 {|
4168 |-
4169 |
4170 a
4171 |-
4172 b
4173 |}
4174 !! result
4175 <table>
4176 <tbody>
4177 <tr><td><pre>a</pre></td></tr>
4178 <tr><td> b</td></tr>
4179 </tbody>
4180 </table>
4181 !! end
4182
4183 !! test
4184 Lists should be recognized in an implicit <td> context
4185 (PHP parser relies on Tidy to add the missing <td> tags)
4186 !! options
4187 parsoid=wt2html,wt2wt
4188 !! input
4189 {|
4190 |-
4191 *a
4192 |}
4193 !! result
4194 <table>
4195 <tr>
4196 <td><ul><li>a</li></ul></td>
4197 </tr>
4198 </table>
4199 !! end
4200
4201 ###
4202 ### Internal links
4203 ###
4204 !! test
4205 Plain link, capitalized
4206 !! input
4207 [[Main Page]]
4208 !! result
4209 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4210 </p>
4211 !! end
4212
4213 !! test
4214 Plain link, uncapitalized
4215 !! input
4216 [[main Page]]
4217 !! result
4218 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4219 </p>
4220 !! end
4221
4222 !! test
4223 Piped link
4224 !! input
4225 [[Main Page|The Main Page]]
4226 !! result
4227 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Piped link with comment in link text
4233 !! input
4234 [[Main Page|The Main<!--front--> Page]]
4235 !! result
4236 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4237 </p>
4238 !! end
4239
4240 !! test
4241 Broken link
4242 !! input
4243 [[Zigzagzogzagzig]]
4244 !! result
4245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4246 </p>
4247 !! end
4248
4249 !! test
4250 Broken link with fragment
4251 !! input
4252 [[Zigzagzogzagzig#zug]]
4253 !! result
4254 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4255 </p>
4256 !! end
4257
4258 !! test
4259 Special page link with fragment
4260 !! input
4261 [[Special:Version#anchor]]
4262 !! result
4263 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4264 </p>
4265 !! end
4266
4267 !! test
4268 Nonexistent special page link with fragment
4269 !! input
4270 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4271 !! result
4272 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4273 </p>
4274 !! end
4275
4276 !! test
4277 Link with prefix
4278 !! input
4279 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4280 !! result
4281 <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>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Link with suffix
4287 !! input
4288 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4289 !! result
4290 <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>!!!
4291 </p>
4292 !! end
4293
4294 !! article
4295 prefixed article
4296 !! text
4297 Some text
4298 !! endarticle
4299
4300 !! test
4301 Bug 43661: Piped links with identical prefixes
4302 !! input
4303 [[prefixed article|prefixed articles with spaces]]
4304
4305 [[prefixed article|prefixed articlesaoeu]]
4306
4307 [[Main Page|Main Page test]]
4308 !! result
4309 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4310 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4311 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4312 </p>
4313 !! end
4314
4315
4316 !! test
4317 Link with HTML entity in suffix / tail
4318 !! input
4319 [[Main Page]]&quot;, [[Main Page]]&#97;
4320 !! result
4321 <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;
4322 </p>
4323 !! end
4324
4325 !! test
4326 Link with 3 brackets
4327 !! input
4328 [[[main page]]]
4329 !! result
4330 <p>[[[main page]]]
4331 </p>
4332 !! end
4333
4334 !! test
4335 Piped link with 3 brackets
4336 !! input
4337 [[[main page|the main page]]]
4338 !! result
4339 <p>[[[main page|the main page]]]
4340 </p>
4341 !! end
4342
4343 !! test
4344 Link with multiple pipes
4345 !! input
4346 [[Main Page|The|Main|Page]]
4347 !! result
4348 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 Link to namespaces
4354 !! input
4355 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4356 !! result
4357 <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>
4358 </p>
4359 !! end
4360
4361 !! test
4362 Piped link to namespace
4363 !! input
4364 [[Meta:Disclaimers|The disclaimers]]
4365 !! result
4366 <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>
4367 </p>
4368 !! end
4369
4370 !! test
4371 Link containing }
4372 !! input
4373 [[Usually caused by a typo (oops}]]
4374 !! result
4375 <p>[[Usually caused by a typo (oops}]]
4376 </p>
4377 !! end
4378
4379 !! test
4380 Link containing % (not as a hex sequence)
4381 !! input
4382 [[7% Solution]]
4383 !! result
4384 <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>
4385 </p>
4386 !! end
4387
4388 !! test
4389 Link containing % as a single hex sequence interpreted to char
4390 !! input
4391 [[7%25 Solution]]
4392 !! result
4393 <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>
4394 </p>
4395 !!end
4396
4397 !! test
4398 Link containing % as a double hex sequence interpreted to hex sequence
4399 !! input
4400 [[7%2525 Solution]]
4401 !! result
4402 <p>[[7%2525 Solution]]
4403 </p>
4404 !!end
4405
4406 !! test
4407 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4408 Example for such a section: == < ==
4409 !! input
4410 [[%23%3c]][[%23%3e]]
4411 !! result
4412 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4413 </p>
4414 !! end
4415
4416 !! test
4417 Link containing "<#" and ">#" as a hex sequences
4418 !! input
4419 [[%3c%23]][[%3e%23]]
4420 !! result
4421 <p>[[%3c%23]][[%3e%23]]
4422 </p>
4423 !! end
4424
4425 !! test
4426 Link containing an equals sign
4427 !! input
4428 [[Special:BookSources/isbn=4-00-026157-6]]
4429 !! result
4430 <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>
4431 </p>
4432 !! end
4433
4434 !! article
4435 Foo~bar
4436 !! text
4437 Just a test of an article title containing a tilde.
4438 !! endarticle
4439
4440 # note that links containing signatures, like [[Foo~~~~]], are
4441 # massaged by the pre-save transform (PST) and so the tildes are never
4442 # seen by the parser.
4443 !! test
4444 Link containing a tilde
4445 !! input
4446 [[Foo~bar]]
4447 !! result
4448 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4449 </p>
4450 !! end
4451
4452 !! test
4453 Link containing double-single-quotes '' (bug 4598)
4454 !! input
4455 [[Lista d''e paise d''o munno]]
4456 !! result
4457 <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>
4458 </p>
4459 !! end
4460
4461 !! test
4462 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4463 !! input
4464 Some [[Link|pretty ''italics'' and stuff]]!
4465 !! result
4466 <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>!
4467 </p>
4468 !! end
4469
4470 !! test
4471 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4472 !! input
4473 ''Some [[Link|pretty ''italics'' and stuff]]!
4474 !! result
4475 <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>
4476 </p>
4477 !! end
4478
4479 !! test
4480 Link with double quotes in title part (literal) and alternate part (interpreted)
4481 !! input
4482 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4483
4484 [[''Pentecoste'']]
4485
4486 [[''Pentecoste''|Pentecoste]]
4487
4488 [[''Pentecoste''|''Pentecoste'']]
4489 !! result
4490 <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>
4491 </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>
4492 </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>
4493 </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>
4494 </p>
4495 !! end
4496
4497 !! test
4498 Broken image links with HTML captions (bug 39700)
4499 !! input
4500 [[File:Nonexistent|<script></script>]]
4501 [[File:Nonexistent|100px|<script></script>]]
4502 [[File:Nonexistent|&lt;]]
4503 [[File:Nonexistent|a<i>b</i>c]]
4504 !! result
4505 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4506 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4507 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4508 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4509 </p>
4510 !! end
4511
4512 !! test
4513 Plain link to URL
4514 !! input
4515 [[http://www.example.com]]
4516 !! result
4517 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4518 </p>
4519 !! end
4520
4521 !! test
4522 Plain link to URL with link text
4523 !! input
4524 [[http://www.example.com Link text]]
4525 !! result
4526 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4527 </p>
4528 !! end
4529
4530 !! test
4531 Plain link to protocol-relative URL
4532 !! input
4533 [[//www.example.com]]
4534 !! result
4535 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4536 </p>
4537 !! end
4538
4539 !! test
4540 Plain link to protocol-relative URL with link text
4541 !! input
4542 [[//www.example.com Link text]]
4543 !! result
4544 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4545 </p>
4546 !! end
4547
4548 !! test
4549 Plain link to page with question mark in title
4550 !! input
4551 [[A?b]]
4552
4553 [[A?b|Baz]]
4554 !! result
4555 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4556 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4557 </p>
4558 !! end
4559
4560
4561 # I'm fairly sure the expected result here is wrong.
4562 # We want these to be URL links, not pseudo-pages with URLs for titles....
4563 # However the current output is also pretty screwy.
4564 #
4565 # ----
4566 # I'm changing it to match the current output--it arguably makes more
4567 # sense in the light of the test above. Old expected result was:
4568 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4569 #</p>
4570 # But I think this test is bordering on "garbage in, garbage out" anyway.
4571 # -- wtm
4572 !! test
4573 Piped link to URL
4574 !! input
4575 Piped link to URL: [[http://www.example.com|an example URL]]
4576 !! result
4577 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4578 </p>
4579 !! end
4580
4581 !! test
4582 BUG 2: [[page|http://url/]] should link to page, not http://url/
4583 !! input
4584 [[Main Page|http://url/]]
4585 !! result
4586 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4587 </p>
4588 !! end
4589
4590 !! test
4591 BUG 337: Escaped self-links should be bold
4592 !! options
4593 title=[[Bug462]]
4594 !! input
4595 [[Bu&#103;462]] [[Bug462]]
4596 !! result
4597 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4598 </p>
4599 !! end
4600
4601 !! test
4602 Self-link to section should not be bold
4603 !! options
4604 title=[[Main Page]]
4605 !! input
4606 [[Main Page#section]]
4607 !! result
4608 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4609 </p>
4610 !! end
4611
4612 !! article
4613 00
4614 !! text
4615 This is 00.
4616 !! endarticle
4617
4618 !!test
4619 Self-link to numeric title
4620 !!options
4621 title=[[0]]
4622 !!input
4623 [[0]]
4624 !!result
4625 <p><strong class="selflink">0</strong>
4626 </p>
4627 !!end
4628
4629 !!test
4630 Link to numeric-equivalent title
4631 !!options
4632 title=[[0]]
4633 !!input
4634 [[00]]
4635 !!result
4636 <p><a href="/wiki/00" title="00">00</a>
4637 </p>
4638 !!end
4639
4640 !! test
4641 <nowiki> inside a link
4642 !! input
4643 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4644 !! result
4645 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4646 </p>
4647 !! end
4648
4649 !! test
4650 Non-breaking spaces in title
4651 !! input
4652 [[&nbsp; Main &nbsp; Page &nbsp;]]
4653 !! result
4654 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4655 </p>
4656 !!end
4657
4658 !! test
4659 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4660 !! options
4661 language=ca
4662 !! input
4663 '''[[Main Page]]'''
4664 !! result
4665 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4666 </p>
4667 !! end
4668
4669 !! test
4670 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4671 !! options
4672 language=ca
4673 !! input
4674 ''[[Main Page]]''
4675 !! result
4676 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4677 </p>
4678 !! end
4679
4680 !! test
4681 Internal link with en linktrail: no apostrophes (bug 27473)
4682 !! options
4683 language=en
4684 !! input
4685 [[Something]]'nice
4686 !! result
4687 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4688 </p>
4689 !! end
4690
4691 !! test
4692 Internal link with ca linktrail with apostrophes (bug 27473)
4693 !! options
4694 language=ca
4695 !! input
4696 [[Something]]'nice
4697 !! result
4698 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4699 </p>
4700 !! end
4701
4702 !! test
4703 Internal link with kaa linktrail with apostrophes (bug 27473)
4704 !! options
4705 language=kaa
4706 !! input
4707 [[Something]]'nice
4708 !! result
4709 <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>
4710 </p>
4711 !! end
4712
4713 !! article
4714 Söfnuður
4715 !! text
4716 Test.
4717 !! endarticle
4718
4719 !! test
4720 Internal link with is link prefix
4721 !! options
4722 language=is
4723 !! input
4724 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4725 !! result
4726 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4727 </p>
4728 !! end
4729
4730 !! article
4731 Mótmælendatrú
4732 !! text
4733 Test.
4734 !! endarticle
4735
4736 !! test
4737 Internal link with is link trail and link prefix
4738 !! options
4739 language=is
4740 !! input
4741 [[mótmælendatrú|xxx]]ar
4742 [[mótmælendatrú]]ar
4743 mótmælenda[[söfnuður]]
4744 mótmælenda[[söfnuður|söfnuðir]]
4745 mótmælenda[[söfnuður|söfnuðir]]xxx
4746 !! result
4747 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4748 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4749 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4750 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4751 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Parsoid link trail escaping
4757 !! options
4758 parsoid=html2wt,html2html
4759 !! input
4760 [[apple]]<nowiki/>s
4761 !! result
4762 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4763 !! end
4764
4765 !! test
4766 Parsoid link prefix escaping
4767 !! options
4768 language=is
4769 parsoid=html2wt,html2html
4770 !! input
4771 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4772 !! result
4773 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4774 !! end
4775
4776 !! test
4777 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4778 !! input
4779 [[Foo| bar]]
4780
4781 [[Foo| ''bar'']]
4782
4783 [http://wp.org foo]
4784
4785 [http://wp.org ''foo'']
4786 !! result
4787 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4788 </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>
4789 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4790 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4791 </p>
4792 !! end
4793
4794 ###
4795 ### Interwiki links (see maintenance/interwiki.sql)
4796 ###
4797
4798 !! test
4799 Inline interwiki link
4800 !! input
4801 [[MeatBall:SoftSecurity]]
4802 !! result
4803 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Inline interwiki link with empty title (bug 2372)
4809 !! input
4810 [[MeatBall:]]
4811 !! result
4812 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4813 </p>
4814 !! end
4815
4816 !! test
4817 Interwiki link encoding conversion (bug 1636)
4818 !! input
4819 *[[Wikipedia:ro:Olteni&#0355;a]]
4820 *[[Wikipedia:ro:Olteni&#355;a]]
4821 !! result
4822 <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>
4823 </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>
4824 </li></ul>
4825
4826 !! end
4827
4828 !! test
4829 Interwiki link with fragment (bug 2130)
4830 !! input
4831 [[MeatBall:SoftSecurity#foo]]
4832 !! result
4833 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4834 </p>
4835 !! end
4836
4837 !! test
4838 Interlanguage link
4839 !! input
4840 Blah blah blah
4841 [[zh:Chinese]]
4842 !!result
4843 <p>Blah blah blah
4844 </p>
4845 !! end
4846
4847 !! test
4848 Double interlanguage link
4849 !! input
4850 Blah blah blah
4851 [[es:Spanish]]
4852 [[zh:Chinese]]
4853 !!result
4854 <p>Blah blah blah
4855 </p>
4856 !! end
4857
4858 !! test
4859 Interlanguage link, with prefix links
4860 !! options
4861 language=ln
4862 !! input
4863 Blah blah blah
4864 [[zh:Chinese]]
4865 !!result
4866 <p>Blah blah blah
4867 </p>
4868 !! end
4869
4870 !! test
4871 Double interlanguage link, with prefix links (bug 8897)
4872 !! options
4873 language=ln
4874 !! input
4875 Blah blah blah
4876 [[es:Spanish]]
4877 [[zh:Chinese]]
4878 !!result
4879 <p>Blah blah blah
4880 </p>
4881 !! end
4882
4883 !! test
4884 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4885 !! options
4886 language=ln
4887 !! input
4888 [[WW&nbsp;II]]
4889 !!result
4890 <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>
4891 </p>
4892 !! end
4893
4894 !! test
4895 Parsoid: handle constructor well
4896 !! options
4897 parsoid
4898 !! input
4899 [[constructor]]
4900
4901 [[constructor:foo]]
4902 !! result
4903 <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>
4904
4905
4906 <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>
4907 !! end
4908
4909 ##
4910 ## Redirects, Parsoid-only
4911 ##
4912 !! test
4913 Simple redirect to page
4914 !! options
4915 parsoid
4916 !! input
4917 #REDIRECT [[Main Page]]
4918 !! result
4919 <link rel="mw:PageProp/redirect" href="./Main_Page">
4920 !! end
4921
4922 !! test
4923 Redirect to category
4924 !! options
4925 parsoid=wt2html
4926 !! input
4927 #REDIRECT [[Category:Foo]]
4928 !! result
4929 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4930 !! end
4931
4932 !! test
4933 Redirect to category page
4934 !! options
4935 parsoid=wt2html,html2html
4936 !! input
4937 #REDIRECT [[:Category:Foo]]
4938 !! result
4939 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4940 !! end
4941
4942 !! test
4943 Redirect to image page
4944 !! options
4945 parsoid
4946 !! input
4947 #REDIRECT [[File:Wiki.png]]
4948 !! result
4949 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4950 !! end
4951
4952 !! test
4953 Redirect to language
4954 !! options
4955 parsoid
4956 !! input
4957 #REDIRECT [[en:File:Wiki.png]]
4958 !! result
4959 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4960 !! end
4961
4962 !! test
4963 Redirect to interwiki
4964 !! options
4965 parsoid
4966 !! input
4967 #REDIRECT [[meatball:File:Wiki.png]]
4968 !! result
4969 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4970 !! end
4971
4972 ##
4973 ## XHTML tidiness
4974 ###
4975
4976 !! test
4977 <br> to <br />
4978 !! input
4979 1<br>2<br />3
4980 !! result
4981 <p>1<br />2<br />3
4982 </p>
4983 !! end
4984
4985 !! test
4986 Broken br tag sanitization
4987 !! options
4988 php
4989 !! input
4990 </br>
4991 !! result
4992 <p>&lt;/br&gt;
4993 </p>
4994 !! end
4995
4996 # TODO: Fix html2html mode (bug 51055)!
4997 !! test
4998 Parsoid: Broken br tag recognition
4999 !! options
5000 parsoid=wt2html
5001 !! input
5002 </br>
5003 !! result
5004 <p><br></p>
5005 !! end
5006
5007 !! test
5008 Incorrecly removing closing slashes from correctly formed XHTML
5009 !! input
5010 <br style="clear:both;" />
5011 !! result
5012 <p><br style="clear:both;" />
5013 </p>
5014 !! end
5015
5016 !! test
5017 Failing to transform badly formed HTML into correct XHTML
5018 !! input
5019 <br style="clear: left;">
5020 <br style="clear: right;">
5021 <br style="clear: both;">
5022 !! result
5023 <p><br style="clear: left;" />
5024 <br style="clear: right;" />
5025 <br style="clear: both;" />
5026 </p>
5027 !!end
5028
5029 !! test
5030 Handling html with a div self-closing tag
5031 !! input
5032 <div title />
5033 <div title/>
5034 <div title/ >
5035 <div title=bar />
5036 <div title=bar/>
5037 <div title=bar/ >
5038 !! result
5039 <p>&lt;div title /&gt;
5040 &lt;div title/&gt;
5041 </p>
5042 <div>
5043 <p>&lt;div title=bar /&gt;
5044 &lt;div title=bar/&gt;
5045 </p>
5046 <div title="bar/"></div>
5047 </div>
5048
5049 !! end
5050
5051 !! test
5052 Handling html with a br self-closing tag
5053 !! input
5054 <br title />
5055 <br title/>
5056 <br title/ >
5057 <br title=bar />
5058 <br title=bar/>
5059 <br title=bar/ >
5060 !! result
5061 <p><br title="title" />
5062 <br title="title" />
5063 <br />
5064 <br title="bar" />
5065 <br title="bar" />
5066 <br title="bar/" />
5067 </p>
5068 !! end
5069
5070 !! test
5071 Horizontal ruler (should it add that extra space?)
5072 !! input
5073 <hr>
5074 <hr >
5075 foo <hr
5076 > bar
5077 !! result
5078 <hr />
5079 <hr />
5080 foo <hr /> bar
5081
5082 !! end
5083
5084 !! test
5085 Horizontal ruler -- 4+ dashes render hr
5086 !! input
5087 ----
5088 !! result
5089 <hr />
5090
5091 !! end
5092
5093 !! test
5094 Horizontal ruler -- eats additional dashes on the same line
5095 !! input
5096 ---------
5097 !! result
5098 <hr />
5099
5100 !! end
5101
5102 !! test
5103 Horizontal ruler -- does not collapse dashes on consecutive lines
5104 !! input
5105 ----
5106 ----
5107 !! result
5108 <hr />
5109 <hr />
5110
5111 !! end
5112
5113 !! test
5114 Horizontal ruler -- <4 dashes render as plain text
5115 !! input
5116 ---
5117 !! result
5118 <p>---
5119 </p>
5120 !! end
5121
5122 !! test
5123 Horizontal ruler -- Supports content following dashes on same line
5124 !! input
5125 ---- Foo
5126 !! result
5127 <hr /> Foo
5128
5129 !! end
5130
5131 ###
5132 ### Block-level elements
5133 ###
5134 !! test
5135 Common list
5136 !! input
5137 *Common list
5138 * item 2
5139 *item 3
5140 !! result
5141 <ul><li>Common list
5142 </li><li> item 2
5143 </li><li>item 3
5144 </li></ul>
5145
5146 !! end
5147
5148 !! test
5149 Numbered list
5150 !! input
5151 #Numbered list
5152 #item 2
5153 # item 3
5154 !! result
5155 <ol><li>Numbered list
5156 </li><li>item 2
5157 </li><li> item 3
5158 </li></ol>
5159
5160 !! end
5161
5162 !! test
5163 Mixed list
5164 !! input
5165 *Mixed list
5166 *# with numbers
5167 ** and bullets
5168 *# and numbers
5169 *bullets again
5170 **bullet level 2
5171 ***bullet level 3
5172 ***#Number on level 4
5173 **bullet level 2
5174 **#Number on level 3
5175 **#Number on level 3
5176 *#number level 2
5177 *Level 1
5178 *** Level 3
5179 #** Level 3, but ordered
5180 !! result
5181 <ul><li>Mixed list
5182 <ol><li> with numbers
5183 </li></ol>
5184 <ul><li> and bullets
5185 </li></ul>
5186 <ol><li> and numbers
5187 </li></ol>
5188 </li><li>bullets again
5189 <ul><li>bullet level 2
5190 <ul><li>bullet level 3
5191 <ol><li>Number on level 4
5192 </li></ol>
5193 </li></ul>
5194 </li><li>bullet level 2
5195 <ol><li>Number on level 3
5196 </li><li>Number on level 3
5197 </li></ol>
5198 </li></ul>
5199 <ol><li>number level 2
5200 </li></ol>
5201 </li><li>Level 1
5202 <ul><li><ul><li> Level 3
5203 </li></ul>
5204 </li></ul>
5205 </li></ul>
5206 <ol><li><ul><li><ul><li> Level 3, but ordered
5207 </li></ul>
5208 </li></ul>
5209 </li></ol>
5210
5211 !! end
5212
5213 !! test
5214 Nested lists 1
5215 !! input
5216 *foo
5217 **bar
5218 !! result
5219 <ul><li>foo
5220 <ul><li>bar
5221 </li></ul>
5222 </li></ul>
5223
5224 !! end
5225
5226 !! test
5227 Nested lists 2
5228 !! input
5229 **foo
5230 *bar
5231 !! result
5232 <ul><li><ul><li>foo
5233 </li></ul>
5234 </li><li>bar
5235 </li></ul>
5236
5237 !! end
5238
5239 !! test
5240 Nested lists 3 (first element empty)
5241 !! input
5242 *
5243 **bar
5244 !! result
5245 <ul><li>
5246 <ul><li>bar
5247 </li></ul>
5248 </li></ul>
5249
5250 !! end
5251
5252 !! test
5253 Nested lists 4 (first element empty)
5254 !! input
5255 **
5256 *bar
5257 !! result
5258 <ul><li><ul><li>
5259 </li></ul>
5260 </li><li>bar
5261 </li></ul>
5262
5263 !! end
5264
5265 !! test
5266 Nested lists 5 (both elements empty)
5267 !! input
5268 **
5269 *
5270 !! result
5271 <ul><li><ul><li>
5272 </li></ul>
5273 </li><li>
5274 </li></ul>
5275
5276 !! end
5277
5278 !! test
5279 Nested lists 6 (both elements empty)
5280 !! input
5281 *
5282 **
5283 !! result
5284 <ul><li>
5285 <ul><li>
5286 </li></ul>
5287 </li></ul>
5288
5289 !! end
5290
5291 !! test
5292 Nested lists 7 (skip initial nesting levels)
5293 !! input
5294 *** foo
5295 !! result
5296 <ul><li><ul><li><ul><li> foo
5297 </li></ul>
5298 </li></ul>
5299 </li></ul>
5300
5301 !! end
5302
5303 !! test
5304 Nested lists 8 (multiple nesting transitions)
5305 !! input
5306 * foo
5307 *** bar
5308 ** baz
5309 * boo
5310 !! result
5311 <ul><li> foo
5312 <ul><li><ul><li> bar
5313 </li></ul>
5314 </li><li> baz
5315 </li></ul>
5316 </li><li> boo
5317 </li></ul>
5318
5319 !! end
5320
5321 !! test
5322 1. Lists with start-of-line-transparent tokens before bullets: Comments
5323 !! input
5324 *foo
5325 *<!--cmt-->bar
5326 <!--cmt-->*baz
5327 !! result
5328 <ul><li>foo
5329 </li><li>bar
5330 </li><li>baz
5331 </li></ul>
5332
5333 !! end
5334
5335 !! test
5336 2. Lists with start-of-line-transparent tokens before bullets: Template close
5337 !! input
5338 *foo {{echo|bar
5339 }}*baz
5340 !! result
5341 <ul><li>foo bar
5342 </li><li>baz
5343 </li></ul>
5344
5345 !! end
5346
5347 !! test
5348 List items are not parsed correctly following a <pre> block (bug 785)
5349 !! input
5350 * <pre>foo</pre>
5351 * <pre>bar</pre>
5352 * zar
5353 !! result
5354 <ul><li> <pre>foo</pre>
5355 </li><li> <pre>bar</pre>
5356 </li><li> zar
5357 </li></ul>
5358
5359 !! end
5360
5361 !! test
5362 List items from template
5363 !! input
5364
5365 {{inner list}}
5366 * item 2
5367
5368 * item 0
5369 {{inner list}}
5370 * item 2
5371
5372 * item 0
5373 * notSOL{{inner list}}
5374 * item 2
5375 !! result
5376 <ul><li> item 1
5377 </li><li> item 2
5378 </li></ul>
5379 <ul><li> item 0
5380 </li><li> item 1
5381 </li><li> item 2
5382 </li></ul>
5383 <ul><li> item 0
5384 </li><li> notSOL
5385 </li><li> item 1
5386 </li><li> item 2
5387 </li></ul>
5388
5389 !! end
5390
5391 !! test
5392 List interrupted by empty line or heading
5393 !! input
5394 * foo
5395
5396 ** bar
5397 == A heading ==
5398 * Another list item
5399 !! result
5400 <ul><li> foo
5401 </li></ul>
5402 <ul><li><ul><li> bar
5403 </li></ul>
5404 </li></ul>
5405 <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>
5406 <ul><li> Another list item
5407 </li></ul>
5408
5409 !!end
5410
5411 !!test
5412 Multiple list tags generated by templates
5413 !!input
5414 {{echo|<li>}}a
5415 {{echo|<li>}}b
5416 {{echo|<li>}}c
5417 !!result
5418 <li>a
5419 <li>b
5420 <li>c</li>
5421 </li>
5422 </li>
5423
5424 !!end
5425
5426 !!test
5427 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5428 !!input
5429 *a
5430 <!--This line will NOT split the list-->
5431 *b
5432 <!--This line will NOT split the list either-->
5433 *c
5434 <!--foo--> <!--This line with more than 1 comment will split the list-->
5435 *d
5436 !!result
5437 <ul><li>a
5438 </li><li>b
5439 </li><li>c
5440 </li></ul>
5441 <ul><li>d
5442 </li></ul>
5443
5444 !!end
5445
5446 !!test
5447 Test the li-hack
5448 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5449 !!options
5450 parsoid=wt2html,wt2wt
5451 !!input
5452 * foo
5453 * <li>li-hack
5454 * {{echo|<li>templated li-hack}}
5455 * <!--foo--> <li> unsupported li-hack with preceding comments
5456
5457 <ul>
5458 <li><li>not a li-hack
5459 </li>
5460 </ul>
5461 !!result
5462 <ul><li> foo</li>
5463 <li>li-hack</li>
5464 <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>
5465 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5466
5467 <ul>
5468 <li></li><li>not a li-hack
5469 </li>
5470 </ul>
5471 !!end
5472
5473 !! test
5474 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5475 !! options
5476 parsoid
5477 !! input
5478 # foo
5479 ## bar
5480 * foo
5481 ** bar
5482 : foo
5483 :: bar
5484 !! result
5485 <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>
5486 !! end
5487
5488 # ------------------------------------------------------------------------
5489 # The next set of tests are about Parsoid's ability to handle badly nested
5490 # tags (parse, minimize scope of fixup, and roundtrip back)
5491 # ------------------------------------------------------------------------
5492
5493 !! test
5494 Unbalanced closing block tags break a list
5495 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5496 !! options
5497 parsoid
5498 !! input
5499 <div>
5500 *a</div><div>
5501 *b</div>
5502 !! result
5503 <div>
5504 <ul><li>a
5505 </li></ul></div><div>
5506 <ul><li>b
5507 </li></ul></div>
5508 !! end
5509
5510 !! test
5511 Unbalanced closing non-block tags don't break a list
5512 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5513 !! options
5514 parsoid
5515 !! input
5516 <span>
5517 *a</span><span>
5518 *b</span>
5519 !! result
5520 <p><span></span>
5521 </p>
5522 <ul><li>a<span></span>
5523 </li><li>b
5524 </li></ul>
5525 !! end
5526
5527 !! test
5528 Unclosed formatting tags that straddle lists are closed and reopened
5529 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5530 !! options
5531 parsoid
5532 !! input
5533 # <s> a
5534 # b </s>
5535 !! result
5536 <ol><li> <s> a </s>
5537 </li><li> <s> b </s>
5538 </li></ol>
5539 !! end
5540
5541 !!test
5542 List embedded in a non-block tag
5543 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5544 !! options
5545 parsoid
5546 !!input
5547 <small>
5548 * foo
5549 </small>
5550 !!result
5551 <p><small></small></p>
5552 <small>
5553 <ul>
5554 <li> foo</li>
5555 </ul>
5556 </small>
5557 <p><small></small></p>
5558 !!end
5559
5560 ###
5561 ### Magic Words
5562 ###
5563
5564 # Note that the current date is hard-coded as
5565 # 1970-01-01T00:02:03Z (a Thursday)
5566 # when running parser tests. The timezone is also fixed to GMT, so
5567 # local date will be identical to current date.
5568
5569 !! test
5570 Magic Word: {{CURRENTDAY}}
5571 !! input
5572 {{CURRENTDAY}}
5573 !! result
5574 <p>1
5575 </p>
5576 !! end
5577
5578 !! test
5579 Magic Word: {{CURRENTDAY2}}
5580 !! input
5581 {{CURRENTDAY2}}
5582 !! result
5583 <p>01
5584 </p>
5585 !! end
5586
5587 !! test
5588 Magic Word: {{CURRENTDAYNAME}}
5589 !! input
5590 {{CURRENTDAYNAME}}
5591 !! result
5592 <p>Thursday
5593 </p>
5594 !! end
5595
5596 !! test
5597 Magic Word: {{CURRENTDOW}}
5598 !! input
5599 {{CURRENTDOW}}
5600 !! result
5601 <p>4
5602 </p>
5603 !! end
5604
5605 !! test
5606 Magic Word: {{CURRENTMONTH}}
5607 !! input
5608 {{CURRENTMONTH}}
5609 !! result
5610 <p>01
5611 </p>
5612 !! end
5613
5614 !! test
5615 Magic Word: {{CURRENTMONTH1}}
5616 !! input
5617 {{CURRENTMONTH1}}
5618 !! result
5619 <p>1
5620 </p>
5621 !! end
5622
5623 !! test
5624 Magic Word: {{CURRENTMONTHABBREV}}
5625 !! input
5626 {{CURRENTMONTHABBREV}}
5627 !! result
5628 <p>Jan
5629 </p>
5630 !! end
5631
5632 !! test
5633 Magic Word: {{CURRENTMONTHNAME}}
5634 !! input
5635 {{CURRENTMONTHNAME}}
5636 !! result
5637 <p>January
5638 </p>
5639 !! end
5640
5641 !! test
5642 Magic Word: {{CURRENTMONTHNAMEGEN}}
5643 !! input
5644 {{CURRENTMONTHNAMEGEN}}
5645 !! result
5646 <p>January
5647 </p>
5648 !! end
5649
5650 !! test
5651 Magic Word: {{CURRENTTIME}}
5652 !! input
5653 {{CURRENTTIME}}
5654 !! result
5655 <p>00:02
5656 </p>
5657 !! end
5658
5659 !! test
5660 Magic Word: {{CURRENTHOUR}}
5661 !! input
5662 {{CURRENTHOUR}}
5663 !! result
5664 <p>00
5665 </p>
5666 !! end
5667
5668 !! test
5669 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5670 !! input
5671 {{CURRENTWEEK}}
5672 !! result
5673 <p>1
5674 </p>
5675 !! end
5676
5677 !! test
5678 Magic Word: {{CURRENTYEAR}}
5679 !! input
5680 {{CURRENTYEAR}}
5681 !! result
5682 <p>1970
5683 </p>
5684 !! end
5685
5686 !! test
5687 Magic Word: {{CURRENTTIMESTAMP}}
5688 !! input
5689 {{CURRENTTIMESTAMP}}
5690 !! result
5691 <p>19700101000203
5692 </p>
5693 !! end
5694
5695 !! test
5696 Magic Words LOCAL (UTC)
5697 !! input
5698 * {{LOCALMONTH}}
5699 * {{LOCALMONTH1}}
5700 * {{LOCALMONTHNAME}}
5701 * {{LOCALMONTHNAMEGEN}}
5702 * {{LOCALMONTHABBREV}}
5703 * {{LOCALDAY}}
5704 * {{LOCALDAY2}}
5705 * {{LOCALDAYNAME}}
5706 * {{LOCALYEAR}}
5707 * {{LOCALTIME}}
5708 * {{LOCALHOUR}}
5709 * {{LOCALWEEK}}
5710 * {{LOCALDOW}}
5711 * {{LOCALTIMESTAMP}}
5712 !! result
5713 <ul><li> 01
5714 </li><li> 1
5715 </li><li> January
5716 </li><li> January
5717 </li><li> Jan
5718 </li><li> 1
5719 </li><li> 01
5720 </li><li> Thursday
5721 </li><li> 1970
5722 </li><li> 00:02
5723 </li><li> 00
5724 </li><li> 1
5725 </li><li> 4
5726 </li><li> 19700101000203
5727 </li></ul>
5728
5729 !! end
5730
5731 !! test
5732 Magic Word: {{FULLPAGENAME}}
5733 !! options
5734 title=[[User:Ævar Arnfjörð Bjarmason]]
5735 !! input
5736 {{FULLPAGENAME}}
5737 !! result
5738 <p>User:Ævar Arnfjörð Bjarmason
5739 </p>
5740 !! end
5741
5742 !! test
5743 Magic Word: {{FULLPAGENAMEE}}
5744 !! options
5745 title=[[User:Ævar Arnfjörð Bjarmason]]
5746 !! input
5747 {{FULLPAGENAMEE}}
5748 !! result
5749 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5750 </p>
5751 !! end
5752
5753 !! test
5754 Magic Word: {{TALKSPACE}}
5755 !! options
5756 title=[[User:Ævar Arnfjörð Bjarmason]]
5757 !! input
5758 {{TALKSPACE}}
5759 !! result
5760 <p>User talk
5761 </p>
5762 !! end
5763
5764 !! test
5765 Magic Word: {{TALKSPACE}}, same namespace
5766 !! options
5767 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5768 !! input
5769 {{TALKSPACE}}
5770 !! result
5771 <p>User talk
5772 </p>
5773 !! end
5774
5775 !! test
5776 Magic Word: {{TALKSPACE}}, main namespace
5777 !! options
5778 title=[[Parser Test]]
5779 !! input
5780 {{TALKSPACE}}
5781 !! result
5782 <p>Talk
5783 </p>
5784 !! end
5785
5786 !! test
5787 Magic Word: {{TALKSPACEE}}
5788 !! options
5789 title=[[User:Ævar Arnfjörð Bjarmason]]
5790 !! input
5791 {{TALKSPACEE}}
5792 !! result
5793 <p>User_talk
5794 </p>
5795 !! end
5796
5797 !! test
5798 Magic Word: {{SUBJECTSPACE}}
5799 !! options
5800 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5801 !! input
5802 {{SUBJECTSPACE}}
5803 !! result
5804 <p>User
5805 </p>
5806 !! end
5807
5808 !! test
5809 Magic Word: {{SUBJECTSPACE}}, same namespace
5810 !! options
5811 title=[[User:Ævar Arnfjörð Bjarmason]]
5812 !! input
5813 {{SUBJECTSPACE}}
5814 !! result
5815 <p>User
5816 </p>
5817 !! end
5818
5819 !! test
5820 Magic Word: {{SUBJECTSPACE}}, main namespace
5821 !! options
5822 title=[[Parser Test]]
5823 !! input
5824 {{SUBJECTSPACE}}
5825 !! result
5826
5827 !! end
5828
5829 !! test
5830 Magic Word: {{SUBJECTSPACEE}}
5831 !! options
5832 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5833 !! input
5834 {{SUBJECTSPACEE}}
5835 !! result
5836 <p>User
5837 </p>
5838 !! end
5839
5840 !! test
5841 Magic Word: {{NAMESPACE}}
5842 !! options
5843 title=[[User:Ævar Arnfjörð Bjarmason]]
5844 !! input
5845 {{NAMESPACE}}
5846 !! result
5847 <p>User
5848 </p>
5849 !! end
5850
5851 !! test
5852 Magic Word: {{NAMESPACEE}}
5853 !! options
5854 title=[[User:Ævar Arnfjörð Bjarmason]]
5855 !! input
5856 {{NAMESPACEE}}
5857 !! result
5858 <p>User
5859 </p>
5860 !! end
5861
5862 !! test
5863 Magic Word: {{NAMESPACENUMBER}}
5864 !! options
5865 title=[[User:Ævar Arnfjörð Bjarmason]]
5866 !! input
5867 {{NAMESPACENUMBER}}
5868 !! result
5869 <p>2
5870 </p>
5871 !! end
5872
5873 !! test
5874 Magic Word: {{SUBPAGENAME}}
5875 !! options
5876 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5877 !! input
5878 {{SUBPAGENAME}}
5879 !! result
5880 <p>sub ö
5881 </p>
5882 !! end
5883
5884 !! test
5885 Magic Word: {{SUBPAGENAMEE}}
5886 !! options
5887 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5888 !! input
5889 {{SUBPAGENAMEE}}
5890 !! result
5891 <p>sub_%C3%B6
5892 </p>
5893 !! end
5894
5895 !! test
5896 Magic Word: {{ROOTPAGENAME}}
5897 !! options
5898 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
5899 !! input
5900 {{ROOTPAGENAME}}
5901 !! result
5902 <p>Ævar Arnfjörð Bjarmason
5903 </p>
5904 !! end
5905
5906 !! test
5907 Magic Word: {{ROOTPAGENAMEE}}
5908 !! options
5909 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
5910 !! input
5911 {{ROOTPAGENAMEE}}
5912 !! result
5913 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5914 </p>
5915 !! end
5916
5917 !! test
5918 Magic Word: {{BASEPAGENAME}}
5919 !! options
5920 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
5921 !! input
5922 {{BASEPAGENAME}}
5923 !! result
5924 <p>Ævar Arnfjörð Bjarmason
5925 </p>
5926 !! end
5927
5928 !! test
5929 Magic Word: {{BASEPAGENAMEE}}
5930 !! options
5931 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
5932 !! input
5933 {{BASEPAGENAMEE}}
5934 !! result
5935 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5936 </p>
5937 !! end
5938
5939 !! test
5940 Magic Word: {{TALKPAGENAME}}
5941 !! options
5942 title=[[User:Ævar Arnfjörð Bjarmason]]
5943 !! input
5944 {{TALKPAGENAME}}
5945 !! result
5946 <p>User talk:Ævar Arnfjörð Bjarmason
5947 </p>
5948 !! end
5949
5950 !! test
5951 Magic Word: {{TALKPAGENAMEE}}
5952 !! options
5953 title=[[User:Ævar Arnfjörð Bjarmason]]
5954 !! input
5955 {{TALKPAGENAMEE}}
5956 !! result
5957 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5958 </p>
5959 !! end
5960
5961 !! test
5962 Magic Word: {{SUBJECTPAGENAME}}
5963 !! options
5964 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5965 !! input
5966 {{SUBJECTPAGENAME}}
5967 !! result
5968 <p>User:Ævar Arnfjörð Bjarmason
5969 </p>
5970 !! end
5971
5972 !! test
5973 Magic Word: {{SUBJECTPAGENAMEE}}
5974 !! options
5975 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5976 !! input
5977 {{SUBJECTPAGENAMEE}}
5978 !! result
5979 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5980 </p>
5981 !! end
5982
5983 !! test
5984 Magic Word: {{NUMBEROFFILES}}
5985 !! input
5986 {{NUMBEROFFILES}}
5987 !! result
5988 <p>4
5989 </p>
5990 !! end
5991
5992 !! test
5993 Magic Word: {{PAGENAME}}
5994 !! options
5995 title=[[User:Ævar Arnfjörð Bjarmason]]
5996 !! input
5997 {{PAGENAME}}
5998 !! result
5999 <p>Ævar Arnfjörð Bjarmason
6000 </p>
6001 !! end
6002
6003 !! test
6004 Magic Word: {{PAGENAME}} with metacharacters
6005 !! options
6006 title=[['foo & bar = baz']]
6007 !! input
6008 ''{{PAGENAME}}''
6009 !! result
6010 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6011 </p>
6012 !! end
6013
6014 !! test
6015 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6016 !! options
6017 title=[[*RFC 1234 http://example.com/]]
6018 !! input
6019 {{PAGENAME}}
6020 !! result
6021 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6022 </p>
6023 !! end
6024
6025 !! test
6026 Magic Word: {{PAGENAMEE}}
6027 !! options
6028 title=[[User:Ævar Arnfjörð Bjarmason]]
6029 !! input
6030 {{PAGENAMEE}}
6031 !! result
6032 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6033 </p>
6034 !! end
6035
6036 !! test
6037 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6038 !! options
6039 title=[[*RFC 1234 http://example.com/]]
6040 !! input
6041 {{PAGENAMEE}}
6042 !! result
6043 <p>&#42;RFC_1234_http&#58;//example.com/
6044 </p>
6045 !! end
6046
6047 !! test
6048 Magic Word: {{REVISIONID}}
6049 !! input
6050 {{REVISIONID}}
6051 !! result
6052 <p>1337
6053 </p>
6054 !! end
6055
6056 !! test
6057 Magic Word: {{SCRIPTPATH}}
6058 !! input
6059 {{SCRIPTPATH}}
6060 !! result
6061 <p>/
6062 </p>
6063 !! end
6064
6065 !! test
6066 Magic Word: {{STYLEPATH}}
6067 !! input
6068 {{STYLEPATH}}
6069 !! result
6070 <p>/skins
6071 </p>
6072 !! end
6073
6074 !! test
6075 Magic Word: {{SERVER}}
6076 !! input
6077 {{SERVER}}
6078 !! result
6079 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Magic Word: {{SERVERNAME}}
6085 !! input
6086 {{SERVERNAME}}
6087 !! result
6088 <p>example.org
6089 </p>
6090 !! end
6091
6092 !! test
6093 Magic Word: {{SITENAME}}
6094 !! input
6095 {{SITENAME}}
6096 !! result
6097 <p>MediaWiki
6098 </p>
6099 !! end
6100
6101 !! test
6102 Case-sensitive magic words, when cased differently, should just be template transclusions
6103 !! input
6104 {{CurrentMonth}}
6105 {{currentday}}
6106 {{cURreNTweEK}}
6107 {{currentHour}}
6108 !! result
6109 <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>
6110 <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>
6111 <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>
6112 <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>
6113 </p>
6114 !! end
6115
6116 !! test
6117 Case-insensitive magic words should still work with weird casing.
6118 !! input
6119 {{sErVeRNaMe}}
6120 {{LCFirst:AOEU}}
6121 {{ucFIRST:aoeu}}
6122 {{SERver}}
6123 !! result
6124 <p>example.org
6125 aOEU
6126 Aoeu
6127 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6128 </p>
6129 !! end
6130
6131 !! test
6132 Namespace 1 {{ns:1}}
6133 !! input
6134 {{ns:1}}
6135 !! result
6136 <p>Talk
6137 </p>
6138 !! end
6139
6140 !! test
6141 Namespace 1 {{ns:01}}
6142 !! input
6143 {{ns:01}}
6144 !! result
6145 <p>Talk
6146 </p>
6147 !! end
6148
6149 !! test
6150 Namespace 0 {{ns:0}} (bug 4783)
6151 !! input
6152 {{ns:0}}
6153 !! result
6154
6155 !! end
6156
6157 !! test
6158 Namespace 0 {{ns:00}} (bug 4783)
6159 !! input
6160 {{ns:00}}
6161 !! result
6162
6163 !! end
6164
6165 !! test
6166 Namespace -1 {{ns:-1}}
6167 !! input
6168 {{ns:-1}}
6169 !! result
6170 <p>Special
6171 </p>
6172 !! end
6173
6174 !! test
6175 Namespace User {{ns:User}}
6176 !! input
6177 {{ns:User}}
6178 !! result
6179 <p>User
6180 </p>
6181 !! end
6182
6183 !! test
6184 Namespace User talk {{ns:User_talk}}
6185 !! input
6186 {{ns:User_talk}}
6187 !! result
6188 <p>User talk
6189 </p>
6190 !! end
6191
6192 !! test
6193 Namespace User talk {{ns:uSeR tAlK}}
6194 !! input
6195 {{ns:uSeR tAlK}}
6196 !! result
6197 <p>User talk
6198 </p>
6199 !! end
6200
6201 !! test
6202 Namespace File {{ns:File}}
6203 !! input
6204 {{ns:File}}
6205 !! result
6206 <p>File
6207 </p>
6208 !! end
6209
6210 !! test
6211 Namespace File {{ns:Image}}
6212 !! input
6213 {{ns:Image}}
6214 !! result
6215 <p>File
6216 </p>
6217 !! end
6218
6219 !! test
6220 Namespace (lang=de) Benutzer {{ns:User}}
6221 !! options
6222 language=de
6223 !! input
6224 {{ns:User}}
6225 !! result
6226 <p>Benutzer
6227 </p>
6228 !! end
6229
6230 !! test
6231 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6232 !! options
6233 language=de
6234 !! input
6235 {{ns:3}}
6236 !! result
6237 <p>Benutzer Diskussion
6238 </p>
6239 !! end
6240
6241
6242 !! test
6243 Urlencode
6244 !! input
6245 {{urlencode:hi world?!}}
6246 {{urlencode:hi world?!|WIKI}}
6247 {{urlencode:hi world?!|PATH}}
6248 {{urlencode:hi world?!|QUERY}}
6249 !! result
6250 <p>hi+world%3F%21
6251 hi_world%3F!
6252 hi%20world%3F%21
6253 hi+world%3F%21
6254 </p>
6255 !! end
6256
6257 ###
6258 ### Magic links
6259 ###
6260 !! test
6261 Magic links: internal link to RFC (bug 479)
6262 !! input
6263 [[RFC 123]]
6264 !! result
6265 <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>
6266 </p>
6267 !! end
6268
6269 !! test
6270 Magic links: RFC (bug 479)
6271 !! input
6272 RFC 822
6273 !! result
6274 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6275 </p>
6276 !! end
6277
6278 !! test
6279 Magic links: ISBN (bug 1937)
6280 !! input
6281 ISBN 0-306-40615-2
6282 !! result
6283 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6284 </p>
6285 !! end
6286
6287 !! test
6288 Magic links: PMID incorrectly converts space to underscore
6289 !! input
6290 PMID 1234
6291 !! result
6292 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6293 </p>
6294 !! end
6295
6296 ###
6297 ### Templates
6298 ####
6299
6300 !! test
6301 Nonexistent template
6302 !! input
6303 {{thistemplatedoesnotexist}}
6304 !! result
6305 <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>
6306 </p>
6307 !! end
6308
6309 !! test
6310 Template with invalid target containing tags
6311 !! input
6312 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6313 !! result
6314 <p>{{a<b>b</b>|foo|a=b|a = b}}
6315 </p>
6316 !! end
6317
6318 !! test
6319 Template with invalid target containing unclosed tag
6320 !! input
6321 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6322 !! result
6323 <p>{{a<b>|foo|a=b|a = b}}</b>
6324 </p>
6325 !! end
6326
6327 !! article
6328 Template:test
6329 !! text
6330 This is a test template
6331 !! endarticle
6332
6333 !! test
6334 Simple template
6335 !! input
6336 {{test}}
6337 !! result
6338 <p>This is a test template
6339 </p>
6340 !! end
6341
6342 !! test
6343 Template with explicit namespace
6344 !! input
6345 {{Template:test}}
6346 !! result
6347 <p>This is a test template
6348 </p>
6349 !! end
6350
6351
6352 !! article
6353 Template:paramtest
6354 !! text
6355 This is a test template with parameter {{{param}}}
6356 !! endarticle
6357
6358 !! test
6359 Template parameter
6360 !! input
6361 {{paramtest|param=foo}}
6362 !! result
6363 <p>This is a test template with parameter foo
6364 </p>
6365 !! end
6366
6367 !! article
6368 Template:paramtestnum
6369 !! text
6370 [[{{{1}}}|{{{2}}}]]
6371 !! endarticle
6372
6373 !! test
6374 Template unnamed parameter
6375 !! input
6376 {{paramtestnum|Main Page|the main page}}
6377 !! result
6378 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6379 </p>
6380 !! end
6381
6382 !! article
6383 Template:templatesimple
6384 !! text
6385 (test)
6386 !! endarticle
6387
6388 !! article
6389 Template:templateredirect
6390 !! text
6391 #redirect [[Template:templatesimple]]
6392 !! endarticle
6393
6394 !! article
6395 Template:templateasargtestnum
6396 !! text
6397 {{{{{1}}}}}
6398 !! endarticle
6399
6400 !! article
6401 Template:templateasargtest
6402 !! text
6403 {{template{{{templ}}}}}
6404 !! endarticle
6405
6406 !! article
6407 Template:templateasargtest2
6408 !! text
6409 {{{{{templ}}}}}
6410 !! endarticle
6411
6412 !! test
6413 Template with template name as unnamed argument
6414 !! input
6415 {{templateasargtestnum|templatesimple}}
6416 !! result
6417 <p>(test)
6418 </p>
6419 !! end
6420
6421 !! test
6422 Template with template name as argument
6423 !! input
6424 {{templateasargtest|templ=simple}}
6425 !! result
6426 <p>(test)
6427 </p>
6428 !! end
6429
6430 !! test
6431 Template with template name as argument (2)
6432 !! input
6433 {{templateasargtest2|templ=templatesimple}}
6434 !! result
6435 <p>(test)
6436 </p>
6437 !! end
6438
6439 !! article
6440 Template:templateasargtestdefault
6441 !! text
6442 {{{{{templ|templatesimple}}}}}
6443 !! endarticle
6444
6445 !! article
6446 Template:templa
6447 !! text
6448 '''templ'''
6449 !! endarticle
6450
6451 !! test
6452 Template with default value
6453 !! input
6454 {{templateasargtestdefault}}
6455 !! result
6456 <p>(test)
6457 </p>
6458 !! end
6459
6460 !! test
6461 Template with default value (value set)
6462 !! input
6463 {{templateasargtestdefault|templ=templa}}
6464 !! result
6465 <p><b>templ</b>
6466 </p>
6467 !! end
6468
6469 !! test
6470 Template redirect
6471 !! input
6472 {{templateredirect}}
6473 !! result
6474 <p>(test)
6475 </p>
6476 !! end
6477
6478 !! test
6479 Template with argument in separate line
6480 !! input
6481 {{ templateasargtest |
6482 templ = simple }}
6483 !! result
6484 <p>(test)
6485 </p>
6486 !! end
6487
6488 !! test
6489 Template with complex template as argument
6490 !! input
6491 {{paramtest|
6492 param ={{ templateasargtest |
6493 templ = simple }}}}
6494 !! result
6495 <p>This is a test template with parameter (test)
6496 </p>
6497 !! end
6498
6499 !! test
6500 Template with thumb image (with link in description)
6501 !! input
6502 {{paramtest|
6503 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6504 !! result
6505 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>
6506
6507 !! end
6508
6509 !! article
6510 Template:complextemplate
6511 !! text
6512 {{{1}}} {{paramtest|
6513 param ={{{param}}}}}
6514 !! endarticle
6515
6516 !! test
6517 Template with complex arguments
6518 !! input
6519 {{complextemplate|
6520 param ={{ templateasargtest |
6521 templ = simple }}|[[Template:complextemplate|link]]}}
6522 !! result
6523 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6524 </p>
6525 !! end
6526
6527 !! test
6528 BUG 553: link with two variables in a piped link
6529 !! input
6530 {|
6531 |[[{{{1}}}|{{{2}}}]]
6532 |}
6533 !! result
6534 <table>
6535 <tr>
6536 <td>[[{{{1}}}|{{{2}}}]]
6537 </td></tr></table>
6538
6539 !! end
6540
6541 !! test
6542 Magic variable as template parameter
6543 !! input
6544 {{paramtest|param={{SITENAME}}}}
6545 !! result
6546 <p>This is a test template with parameter MediaWiki
6547 </p>
6548 !! end
6549
6550 !! article
6551 Template:linktest
6552 !! text
6553 [[{{{param}}}|link]]
6554 !! endarticle
6555
6556 !! test
6557 Template parameter as link source
6558 !! input
6559 {{linktest|param=Main Page}}
6560 !! result
6561 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6562 </p>
6563 !! end
6564
6565 !!test
6566 Template-generated attribute string (k='v')
6567 !!input
6568 <span {{attr_str|id|v1}}>bar</span>
6569 !!result
6570 <p><span id="v1">bar</span>
6571 </p>
6572 !!end
6573
6574 !!article
6575 Template:paramtest2
6576 !! text
6577 including another template, {{paramtest|param={{{arg}}}}}
6578 !! endarticle
6579
6580 !! test
6581 Template passing argument to another template
6582 !! input
6583 {{paramtest2|arg='hmm'}}
6584 !! result
6585 <p>including another template, This is a test template with parameter 'hmm'
6586 </p>
6587 !! end
6588
6589 !! article
6590 Template:Linktest2
6591 !! text
6592 Main Page
6593 !! endarticle
6594
6595 !! test
6596 Template as link source
6597 !! input
6598 [[{{linktest2}}]]
6599
6600 [[{{linktest2}}|Main Page]]
6601
6602 [[{{linktest2}}]]Page
6603 !! result
6604 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6605 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6606 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6607 </p>
6608 !! end
6609
6610
6611 !! article
6612 Template:loop1
6613 !! text
6614 {{loop2}}
6615 !! endarticle
6616
6617 !! article
6618 Template:loop2
6619 !! text
6620 {{loop1}}
6621 !! endarticle
6622
6623 !! test
6624 Template infinite loop
6625 !! input
6626 {{loop1}}
6627 !! result
6628 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6629 </p>
6630 !! end
6631
6632 !! test
6633 Template from main namespace
6634 !! input
6635 {{:Main Page}}
6636 !! result
6637 <p>blah blah
6638 </p>
6639 !! end
6640
6641 !! article
6642 Template:table
6643 !! text
6644 {|
6645 | 1 || 2
6646 |-
6647 | 3 || 4
6648 |}
6649 !! endarticle
6650
6651 !! test
6652 BUG 529: Template with table, not included at beginning of line
6653 !! input
6654 foo {{table}}
6655 !! result
6656 <p>foo
6657 </p>
6658 <table>
6659 <tr>
6660 <td> 1 </td>
6661 <td> 2
6662 </td></tr>
6663 <tr>
6664 <td> 3 </td>
6665 <td> 4
6666 </td></tr></table>
6667
6668 !! end
6669
6670 !! test
6671 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6672 !! input
6673 foo
6674 {{table}}
6675 !! result
6676 <p>foo
6677 </p>
6678 <table>
6679 <tr>
6680 <td> 1 </td>
6681 <td> 2
6682 </td></tr>
6683 <tr>
6684 <td> 3 </td>
6685 <td> 4
6686 </td></tr></table>
6687
6688 !! end
6689
6690 !! test
6691 BUG 41: Template parameters shown as broken links
6692 !! input
6693 {{{parameter}}}
6694 !! result
6695 <p>{{{parameter}}}
6696 </p>
6697 !! end
6698
6699 !! test
6700 Template with targets containing wikilinks
6701 !! input
6702 {{[[foo]]}}
6703
6704 {{[[{{echo|foo}}]]}}
6705
6706 {{{{echo|[[foo}}]]}}
6707 !! result
6708 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6709 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6710 </p><p>{{[[foo}}]]
6711 </p>
6712 !! end
6713
6714 !! article
6715 Template:MSGNW test
6716 !! text
6717 ''None'' of '''this''' should be
6718 * interpreted
6719 but rather passed unmodified
6720 {{test}}
6721 !! endarticle
6722
6723 # hmm, fix this or just deprecate msgnw and document its behavior?
6724 !! test
6725 msgnw keyword
6726 !! options
6727 disabled
6728 !! input
6729 {{msgnw:MSGNW test}}
6730 !! result
6731 <p>''None'' of '''this''' should be
6732 * interpreted
6733 but rather passed unmodified
6734 {{test}}
6735 </p>
6736 !! end
6737
6738 !! test
6739 int keyword
6740 !! input
6741 {{int:youhavenewmessages|lots of money|not!}}
6742 !! result
6743 <p>You have lots of money (not!).
6744 </p>
6745 !! end
6746
6747 !! article
6748 Template:Includes
6749 !! text
6750 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6751 !! endarticle
6752
6753 !! test
6754 <includeonly> and <noinclude> being included
6755 !! input
6756 {{Includes}}
6757 !! result
6758 <p>Foobar
6759 </p>
6760 !! end
6761
6762 !! article
6763 Template:Includes2
6764 !! text
6765 <onlyinclude>Foo</onlyinclude>bar
6766 !! endarticle
6767
6768 !! test
6769 <onlyinclude> being included
6770 !! input
6771 {{Includes2}}
6772 !! result
6773 <p>Foo
6774 </p>
6775 !! end
6776
6777
6778 !! article
6779 Template:Includes3
6780 !! text
6781 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6782 !! endarticle
6783
6784 !! test
6785 <onlyinclude> and <includeonly> being included
6786 !! input
6787 {{Includes3}}
6788 !! result
6789 <p>Foo
6790 </p>
6791 !! end
6792
6793 !! test
6794 <includeonly> and <noinclude> on a page
6795 !! input
6796 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6797 !! result
6798 <p>Foozar
6799 </p>
6800 !! end
6801
6802 !! test
6803 Un-closed <noinclude>
6804 !! input
6805 <noinclude>
6806 !! result
6807 !! end
6808
6809 !! test
6810 <onlyinclude> on a page
6811 !! input
6812 <onlyinclude>Foo</onlyinclude>bar
6813 !! result
6814 <p>Foobar
6815 </p>
6816 !! end
6817
6818 !! test
6819 Un-closed <onlyinclude>
6820 !! input
6821 <onlyinclude>
6822 !! result
6823 !! end
6824
6825 !!test
6826 Self-closed noinclude, includeonly, onlyinclude tags
6827 !!input
6828 <noinclude />
6829 <includeonly />
6830 <onlyinclude />
6831 !!result
6832 <p><br />
6833 </p>
6834 !!end
6835
6836 !!test
6837 Unbalanced includeonly and noinclude tags
6838 !!input
6839 {|
6840 |a</noinclude>
6841 |b</noinclude></noinclude>
6842 |c</noinclude></includeonly>
6843 |d</includeonly></includeonly>
6844 |}
6845 !!result
6846 <table>
6847 <tr>
6848 <td>a
6849 </td>
6850 <td>b
6851 </td>
6852 <td>c&lt;/includeonly&gt;
6853 </td>
6854 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6855 </td></tr></table>
6856
6857 !!end
6858
6859 !! article
6860 Template:Includeonly section
6861 !! text
6862 <includeonly>
6863 ==Includeonly section==
6864 </includeonly>
6865 ==Section T-1==
6866 !!endarticle
6867
6868 !! test
6869 Bug 6563: Edit link generation for section shown by <includeonly>
6870 !! input
6871 {{includeonly section}}
6872 !! result
6873 <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>
6874 <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>
6875
6876 !! end
6877
6878 # Uses same input as the contents of [[Template:Includeonly section]]
6879 !! test
6880 Bug 6563: Section extraction for section shown by <includeonly>
6881 !! options
6882 section=T-2
6883 !! input
6884 <includeonly>
6885 ==Includeonly section==
6886 </includeonly>
6887 ==Section T-2==
6888 !! result
6889 ==Section T-2==
6890 !! end
6891
6892 !! test
6893 Bug 6563: Edit link generation for section suppressed by <includeonly>
6894 !! input
6895 <includeonly>
6896 ==Includeonly section==
6897 </includeonly>
6898 ==Section 1==
6899 !! result
6900 <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>
6901
6902 !! end
6903
6904 !! test
6905 Bug 6563: Section extraction for section suppressed by <includeonly>
6906 !! options
6907 section=1
6908 !! input
6909 <includeonly>
6910 ==Includeonly section==
6911 </includeonly>
6912 ==Section 1==
6913 !! result
6914 ==Section 1==
6915 !! end
6916
6917 !! test
6918 Un-closed <includeonly>
6919 !! input
6920 <includeonly>
6921 !! result
6922 !! end
6923
6924 # TODO: test with DOM fragment reuse!
6925 !! test
6926 Parsoid: DOM fragment reuse
6927 !! options
6928 parsoid=wt2wt,wt2html
6929 !! input
6930 a{{echo|b<table></table>c}}d
6931
6932 a{{echo|b
6933 <table></table>
6934 c}}d
6935
6936 {{echo|a
6937
6938 <table></table>
6939
6940 b}}
6941 !! result
6942 a<span typeof="mw:Transclusion">b</span>
6943 <table></table><span>c</span>d
6944 <p typeof="mw:Transclusion">ab</p>
6945 <table></table>
6946 <p>cd</p>
6947 <p typeof="mw:Transclusion">a</p>
6948 <table></table>
6949 <p>b</p>
6950 !! end
6951
6952 ###
6953 ### <includeonly> and <noinclude> in attributes
6954 ###
6955 !!test
6956 0. includeonly around the entire attribute
6957 !!input
6958 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6959 !!result
6960 <p><span id="v2">bar</span>
6961 </p>
6962 !!end
6963
6964 !!test
6965 1. includeonly in html attr key
6966 !!input
6967 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6968 !!result
6969 <p><span id="foo">bar</span>
6970 </p>
6971 !!end
6972
6973 !!test
6974 2. includeonly in html attr value
6975 !!input
6976 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6977 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6978 !!result
6979 <p><span id="v1">bar</span>
6980 <span id="v1">bar</span>
6981 </p>
6982 !!end
6983
6984 !!test
6985 3. includeonly in part of an attr value
6986 !!input
6987 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6988 !!result
6989 <p><span style="color:red;">bar</span>
6990 </p>
6991 !!end
6992
6993 ###
6994 ### Testing parsing of templates where a template arg
6995 ### has the same name as the template itself.
6996 ###
6997
6998 !! article
6999 Template:quote
7000 !! text
7001 {{{quote|{{{1}}}}}}
7002 !! endarticle
7003
7004 !!test
7005 Templates: Template Name/Arg clash: 1. Use of positional param
7006 !!input
7007 {{quote|foo}}
7008 !!result
7009 <p>foo
7010 </p>
7011 !!end
7012
7013 !!test
7014 Templates: Template Name/Arg clash: 2. Use of named param
7015 !!input
7016 {{quote|quote=foo}}
7017 !!result
7018 <p>foo
7019 </p>
7020 !!end
7021
7022 !!test
7023 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7024 !!input
7025 {{quote|quote}}
7026 !!result
7027 <p>quote
7028 </p>
7029 !!end
7030
7031 ###
7032 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7033 ###
7034
7035 !!test
7036 Templates: 1. Simple use
7037 !!input
7038 {{echo|Foo}}
7039 !!result
7040 <p>Foo
7041 </p>
7042 !!end
7043
7044 !!test
7045 Templates: 2. Inside a block tag
7046 !!input
7047 <div>{{echo|Foo}}</div>
7048 !!result
7049 <div>Foo</div>
7050
7051 !!end
7052
7053 !!test
7054 Templates: P-wrapping: 1a. Templates on consecutive lines
7055 !!input
7056 {{echo|Foo}}
7057 {{echo|bar}}
7058 !!result
7059 <p>Foo
7060 bar
7061 </p>
7062 !!end
7063
7064 !!test
7065 Templates: P-wrapping: 1b. Templates on consecutive lines
7066 !!input
7067 Foo
7068
7069 {{echo|bar}}
7070 {{echo|baz}}
7071 !!result
7072 <p>Foo
7073 </p><p>bar
7074 baz
7075 </p>
7076 !!end
7077
7078 !!test
7079 Templates: P-wrapping: 1c. Templates on consecutive lines
7080 !!input
7081 {{echo|Foo}}
7082 {{echo|bar}} <div>baz</div>
7083 !!result
7084 <p>Foo
7085 </p>
7086 bar <div>baz</div>
7087
7088 !!end
7089
7090 !!test
7091 Templates: P-wrapping: 1d. Template preceded by comment-only line
7092 !!options
7093 parsoid=wt2html,wt2wt
7094 !!input
7095 <!-- foo -->
7096 {{echo|Bar}}
7097 !!result
7098 <!-- foo -->
7099 <p typeof="mw:Transclusion">Bar
7100 </p>
7101 !!end
7102
7103 !!test
7104 Templates: Inline Text: 1. Multiple tmeplate uses
7105 !!input
7106 {{echo|Foo}}bar{{echo|baz}}
7107 !!result
7108 <p>Foobarbaz
7109 </p>
7110 !!end
7111
7112 !!test
7113 Templates: Inline Text: 2. Back-to-back template uses
7114 !!input
7115 {{echo|Foo}}{{echo|bar}}
7116 !!result
7117 <p>Foobar
7118 </p>
7119 !!end
7120
7121 !!test
7122 Templates: Block Tags: 1. Multiple template uses
7123 !!input
7124 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7125 !!result
7126 <div>Foo</div><div>bar</div><div>baz</div>
7127
7128 !!end
7129
7130 !!test
7131 Templates: Block Tags: 2. Back-to-back template uses
7132 !!input
7133 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7134 !!result
7135 <div>Foo</div><div>bar</div>
7136
7137 !!end
7138
7139 !!test
7140 Templates: Links: 1. Simple example
7141 !!input
7142 {{echo|[[Foo|bar]]}}
7143 !!result
7144 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7145 </p>
7146 !!end
7147
7148 !!test
7149 Templates: Links: 2. Generation of link href
7150 !!input
7151 [[{{echo|Foo}}|bar]]
7152 !!result
7153 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7154 </p>
7155 !!end
7156
7157 !!test
7158 Templates: Links: 3. Generation of part of a link href
7159 !!input
7160 [[Fo{{echo|o}}|bar]]
7161
7162 [[Foo{{echo|bar}}]]
7163
7164 [[Foo{{echo|bar}}baz]]
7165
7166 [[Foo{{echo|bar}}|bar]]
7167
7168 [[:Foo{{echo|bar}}]]
7169
7170 [[:Foo{{echo|bar}}|bar]]
7171 !!result
7172 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7173 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7174 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7175 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7176 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7177 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7178 </p>
7179 !!end
7180
7181 !!test
7182 Templates: Links: 4. Multiple templates generating link href
7183 !!input
7184 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7185 !!result
7186 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7187 </p>
7188 !!end
7189
7190 !!test
7191 Templates: Links: 5. Generation of link text
7192 !!input
7193 [[Foo|{{echo|bar}}]]
7194 !!result
7195 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7196 </p>
7197 !!end
7198
7199 !!test
7200 Templates: Links: 5. Nested templates (only outermost template should be marked)
7201 !!input
7202 {{echo|[[{{echo|Foo}}|bar]]}}
7203 !!result
7204 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7205 </p>
7206 !!end
7207
7208 !!test
7209 Templates: HTML Tag: 1. Generation of HTML attr. key
7210 !!input
7211 <div {{echo|style}}="color:red;">foo</div>
7212 !!result
7213 <div style="color:red;">foo</div>
7214
7215 !!end
7216
7217 !!test
7218 Templates: HTML Tag: 2. Generation of HTML attr. value
7219 !!input
7220 <div style={{echo|'color:red;'}}>foo</div>
7221 !!result
7222 <div style="color:red;">foo</div>
7223
7224 !!end
7225
7226 !!test
7227 Templates: HTML Tag: 3. Generation of HTML attr key and value
7228 !!input
7229 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7230 !!result
7231 <div style="color:red;">foo</div>
7232
7233 !!end
7234
7235 !!test
7236 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7237 !!input
7238 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7239 !!result
7240 <div title="This is a long title with just one piece templated">foo</div>
7241
7242 !!end
7243
7244 !!test
7245 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7246 !!input
7247 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7248 !!result
7249 <div title="This is a long title with just one piece templated">foo</div>
7250
7251 !!end
7252
7253 !!test
7254 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7255 !!input
7256 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7257 !!result
7258 <div title="This is a long title with just one piece templated">foo</div>
7259
7260 !!end
7261
7262 !!test
7263 Templates: HTML Tag: 7. Generation of partial attribute key string
7264 !!input
7265 <div st{{echo|yle}}="color:red;">foo</div>
7266 !!result
7267 <div style="color:red;">foo</div>
7268
7269 !!end
7270
7271 !!test
7272 Templates: HTML Tables: 1. Generating start of a HTML table
7273 !!input
7274 {{echo|<table><tr><td>foo</td>}}</tr></table>
7275 !!result
7276 <table><tr><td>foo</td></tr></table>
7277
7278 !!end
7279
7280 !!test
7281 Templates: HTML Tables: 2a. Generating middle of a HTML table
7282 !!input
7283 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7284 !!result
7285 <table><tr><td>foo</td></tr></table>
7286
7287 !!end
7288
7289 !!test
7290 Templates: HTML Tables: 2b. Generating middle of a HTML table
7291 !!input
7292 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7293 !!result
7294 <table><tr><td>foo</td></tr></table>
7295
7296 !!end
7297
7298 !!test
7299 Templates: HTML Tables: 3. Generating end of a HTML table
7300 !!input
7301 <table><tr>{{echo|<td>foo</td></tr></table>}}
7302 !!result
7303 <table><tr><td>foo</td></tr></table>
7304
7305 !!end
7306
7307 !!test
7308 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7309 !!input
7310 {{echo|<table>}}<tr><td>foo</td></tr></table>
7311 !!result
7312 <table><tr><td>foo</td></tr></table>
7313
7314 !!end
7315
7316 !!test
7317 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7318 !!input
7319 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7320 !!result
7321 <table><tr><td>foo</td></tr></table>
7322
7323 !!end
7324
7325 !!test
7326 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7327 !!input
7328 <table><tr>{{echo|<td>}}foo</td></tr></table>
7329 !!result
7330 <table><tr><td>foo</td></tr></table>
7331
7332 !!end
7333
7334 !!test
7335 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7336 !!input
7337 <table><tr><td>foo{{echo|</td>}}</tr></table>
7338 !!result
7339 <table><tr><td>foo</td></tr></table>
7340
7341 !!end
7342
7343 !!test
7344 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7345 !!input
7346 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7347 !!result
7348 <table><tr><td>foo</td></tr></table>
7349
7350 !!end
7351
7352 !!test
7353 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7354 !!input
7355 <table><tr><td>foo</td></tr>{{echo|</table>}}
7356 !!result
7357 <table><tr><td>foo</td></tr></table>
7358
7359 !!end
7360
7361 !!test
7362 Templates: HTML Tables: 5. Proper fostering of categories from inside
7363 !!options
7364 parsoid=wt2html,wt2wt
7365 !!input
7366 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7367 <!--Two categories (Bug 50330)-->
7368 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7369 !!result
7370 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7371 <!--Two categories (Bug 50330)-->
7372 <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>
7373 !!end
7374
7375 !!test
7376 Templates: Wiki Tables: 1a. Fostering of entire template content
7377 !!input
7378 {|
7379 {{echo|a}}
7380 |}
7381 !!result
7382 <table>
7383 a
7384 <tr><td></td></tr></table>
7385
7386 !!end
7387
7388 !!test
7389 Templates: Wiki Tables: 1b. Fostering of entire template content
7390 !!input
7391 {|
7392 {{echo|<div>}}
7393 foo
7394 {{echo|</div>}}
7395 |}
7396 !!result
7397 <table>
7398 <div>
7399 <p>foo
7400 </p>
7401 </div>
7402 <tr><td></td></tr></table>
7403
7404 !!end
7405
7406 !!test
7407 Templates: Wiki Tables: 2. Fostering of partial template content
7408 !!input
7409 {|
7410 {{echo|a
7411 <div>b</div>}}
7412 |}
7413 !!result
7414 <table>
7415 a
7416 <div>b</div>
7417 <tr><td></td></tr></table>
7418
7419 !!end
7420
7421 !!test
7422 Templates: Wiki Tables: 3. td-content via multiple templates
7423 !!input
7424 {|
7425 {{echo|{{pipe}}a}}{{echo|b}}
7426 |}
7427 !!result
7428 <table>
7429 <tr>
7430 <td>ab
7431 </td></tr></table>
7432
7433 !!end
7434
7435 !!test
7436 Templates: Wiki Tables: 4. Templated tags, no content
7437 !!input
7438 {{tbl-start}}
7439 {{tbl-end}}
7440 !!result
7441 <table>
7442 <tr><td></td></tr></table>
7443
7444 !!end
7445
7446 !!test
7447 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7448 !!input
7449 {{tbl-start}}
7450 |foo
7451 {{tbl-end}}
7452 !!result
7453 <table>
7454 <tr>
7455 <td>foo
7456 </td></tr></table>
7457
7458 !!end
7459
7460 !!test
7461 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7462 !!input
7463 {{tbl-start}}
7464 {{!}}foo
7465 {{tbl-end}}
7466 !!result
7467 <table>
7468 <tr>
7469 <td>foo
7470 </td></tr></table>
7471
7472 !!end
7473
7474 !!test
7475 Templates: Lists: Multi-line list-items via templates
7476 !!input
7477 *{{echo|a {{nonexistent|
7478 unused}}}}
7479 *{{echo|b {{nonexistent|
7480 unused}}}}
7481 !!result
7482 <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>
7483 </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>
7484 </li></ul>
7485
7486 !!end
7487
7488 !!test
7489 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7490 !!input
7491 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7492 !!result
7493 <p><i>ab</i>c<i>d</i>e
7494 </p>
7495 !!end
7496
7497 !!test
7498 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7499 (PHP parser generates misnested html)
7500 !! options
7501 parsoid=wt2html,wt2wt
7502 !!input
7503 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7504 !!result
7505 <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>
7506 !!end
7507
7508 !!test
7509 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7510 (PHP parser generates misnested html)
7511 !! options
7512 parsoid=wt2html,wt2wt
7513 !!input
7514 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7515 !!result
7516 <div typeof="mw:Transclusion"><i>a</i></div>
7517 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7518 <div typeof="mw:Transclusion">e</div>
7519 !!end
7520
7521 !!test
7522 Templates: Ugly nesting: 4. Divs opened/closed across templates
7523 !!input
7524 a<div>b{{echo|c</div>d}}e
7525 !!result
7526 a<div>bc</div>de
7527
7528 !!end
7529
7530 !!test
7531 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7532 (Parsoid-centric)
7533 !! options
7534 parsoid
7535 !!input
7536 {|
7537 |{{echo|foo</table>}}
7538 |bar
7539 |}
7540 !!result
7541 <table typeof="mw:Transclusion">
7542 <tbody>
7543 <tr>
7544 <td>foo</td></tr></tbody></table><span>bar</span>
7545 !!end
7546
7547 !!test
7548 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7549 (Parsoid-centric)
7550 !! options
7551 parsoid
7552 !!input
7553 <table>
7554 <tr>
7555 <td>
7556 <table>
7557 <tr>
7558 <td>1. {{echo|foo </table>}}</td>
7559 <td> bar </td>
7560 <td>2. {{echo|baz </table>}}</td>
7561 </tr>
7562 <tr>
7563 <td>abc</td>
7564 </tr>
7565 </table>
7566 </td>
7567 </tr>
7568 <tr>
7569 <td>xyz</td>
7570 </tr>
7571 </table>
7572 !!result
7573 <table about="#mwt1" typeof="mw:Transclusion">
7574 <tbody><tr >
7575 <td >
7576 <table >
7577 <tbody><tr >
7578 <td >1. foo </td></tr></tbody></table></td>
7579 <td > bar </td>
7580 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7581 </span><span about="#mwt1">
7582
7583 abc</span><span about="#mwt1">
7584 </span><span about="#mwt1">
7585 </span><span about="#mwt1">
7586 </span><span about="#mwt1">
7587 </span><span about="#mwt1">
7588
7589 xyz</span><span about="#mwt1">
7590 </span><span about="#mwt1">
7591 </span>
7592 !!end
7593
7594 !! test
7595 Templates: Ugly templates: 3. newline-only template parameter
7596 !! input
7597 foo {{echo|
7598 }}
7599 !! result
7600 <p>foo
7601 </p>
7602 !! end
7603
7604 # This looks like a bug: a single newline triggers p/br for some reason.
7605 !! test
7606 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7607 !! input
7608 {{echo|
7609 }}
7610 !! result
7611 <p><br />
7612 </p>
7613 !! end
7614
7615
7616 !!test
7617 Parser Functions: 1. Simple example
7618 !!input
7619 {{uc:foo}}
7620 !!result
7621 <p>FOO
7622 </p>
7623 !!end
7624
7625 !!test
7626 Parser Functions: 2. Nested use (only outermost should be marked up)
7627 !!input
7628 {{uc:{{lc:FOO}}}}
7629 !!result
7630 <p>FOO
7631 </p>
7632 !!end
7633
7634 ###
7635 ### Pre-save transform tests
7636 ###
7637 !! test
7638 pre-save transform: subst:
7639 !! options
7640 PST
7641 !! input
7642 {{subst:test}}
7643 !! result
7644 This is a test template
7645 !! end
7646
7647 !! test
7648 pre-save transform: normal template
7649 !! options
7650 PST
7651 !! input
7652 {{test}}
7653 !! result
7654 {{test}}
7655 !! end
7656
7657 !! test
7658 pre-save transform: nonexistent template
7659 !! options
7660 PST
7661 !! input
7662 {{thistemplatedoesnotexist}}
7663 !! result
7664 {{thistemplatedoesnotexist}}
7665 !! end
7666
7667
7668 !! test
7669 pre-save transform: subst magic variables
7670 !! options
7671 PST
7672 !! input
7673 {{subst:SITENAME}}
7674 !! result
7675 MediaWiki
7676 !! end
7677
7678 # This is bug 89, which I fixed. -- wtm
7679 !! test
7680 pre-save transform: subst: templates with parameters
7681 !! options
7682 pst
7683 !! input
7684 {{subst:paramtest|param="something else"}}
7685 !! result
7686 This is a test template with parameter "something else"
7687 !! end
7688
7689 !! article
7690 Template:nowikitest
7691 !! text
7692 <nowiki>'''not wiki'''</nowiki>
7693 !! endarticle
7694
7695 !! test
7696 pre-save transform: nowiki in subst (bug 1188)
7697 !! options
7698 pst
7699 !! input
7700 {{subst:nowikitest}}
7701 !! result
7702 <nowiki>'''not wiki'''</nowiki>
7703 !! end
7704
7705
7706 !! article
7707 Template:commenttest
7708 !! text
7709 This template has <!-- a comment --> in it.
7710 !! endarticle
7711
7712 !! test
7713 pre-save transform: comment in subst (bug 1936)
7714 !! options
7715 pst
7716 !! input
7717 {{subst:commenttest}}
7718 !! result
7719 This template has <!-- a comment --> in it.
7720 !! end
7721
7722 !! test
7723 pre-save transform: unclosed tag
7724 !! options
7725 pst noxml
7726 !! input
7727 <nowiki>'''not wiki'''
7728 !! result
7729 <nowiki>'''not wiki'''
7730 !! end
7731
7732 !! test
7733 pre-save transform: mixed tag case
7734 !! options
7735 pst noxml
7736 !! input
7737 <NOwiki>'''not wiki'''</noWIKI>
7738 !! result
7739 <NOwiki>'''not wiki'''</noWIKI>
7740 !! end
7741
7742 !! test
7743 pre-save transform: unclosed comment in <nowiki>
7744 !! options
7745 pst noxml
7746 !! input
7747 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7748 !! result
7749 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7750 !!end
7751
7752 # Leading @ in this template definition works around a limitation
7753 # in parsoid's parserTests which otherwise strips the <span> from the
7754 # result (confusing it for a template wrapper)
7755 !! article
7756 Template:dangerous
7757 !!text
7758 @<span onmouseover="alert('crap')">Oh no</span>
7759 !!endarticle
7760
7761 !!test
7762 (confirming safety of fix for subst bug 1936)
7763 !! input
7764 {{Template:dangerous}}
7765 !! result
7766 <p>@<span>Oh no</span>
7767 </p>
7768 !! end
7769
7770 !! test
7771 pre-save transform: comment containing gallery (bug 5024)
7772 !! options
7773 pst
7774 !! input
7775 <!-- <gallery>data</gallery> -->
7776 !!result
7777 <!-- <gallery>data</gallery> -->
7778 !!end
7779
7780 !! test
7781 pre-save transform: comment containing extension
7782 !! options
7783 pst
7784 !! input
7785 <!-- <tag>data</tag> -->
7786 !!result
7787 <!-- <tag>data</tag> -->
7788 !!end
7789
7790 !! test
7791 pre-save transform: comment containing nowiki
7792 !! options
7793 pst
7794 !! input
7795 <!-- <nowiki>data</nowiki> -->
7796 !!result
7797 <!-- <nowiki>data</nowiki> -->
7798 !!end
7799
7800 !! test
7801 pre-save transform: <noinclude> in subst (bug 3298)
7802 !! options
7803 pst
7804 !! input
7805 {{subst:Includes}}
7806 !! result
7807 Foobar
7808 !! end
7809
7810 !! test
7811 pre-save transform: <onlyinclude> in subst (bug 3298)
7812 !! options
7813 pst
7814 !! input
7815 {{subst:Includes2}}
7816 !! result
7817 Foo
7818 !! end
7819
7820 !! article
7821 Template:SubstTest
7822 !!text
7823 {{<includeonly>subst:</includeonly>Includes}}
7824 !! endarticle
7825
7826 !! article
7827 Template:SafeSubstTest
7828 !! text
7829 {{<includeonly>safesubst:</includeonly>Includes}}
7830 !! endarticle
7831
7832 !! test
7833 bug 22297: safesubst: works during PST
7834 !! options
7835 pst
7836 !! input
7837 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7838 !! result
7839 FoobarFoobar
7840 !! end
7841
7842 !! test
7843 bug 22297: safesubst: works during normal parse
7844 !! input
7845 {{SafeSubstTest}}
7846 !! result
7847 <p>Foobar
7848 </p>
7849 !! end
7850
7851 !! test:
7852 subst: does not work during normal parse
7853 !! input
7854 {{SubstTest}}
7855 !! result
7856 <p>{{subst:Includes}}
7857 </p>
7858 !! end
7859
7860 !! test
7861 pre-save transform: context links ("pipe trick")
7862 !! options
7863 pst
7864 !! input
7865 [[Article (context)|]]
7866 [[Bar:Article|]]
7867 [[:Bar:Article|]]
7868 [[Bar:Article (context)|]]
7869 [[:Bar:Article (context)|]]
7870 [[|Article]]
7871 [[|Article (context)]]
7872 [[Bar:X (Y) Z|]]
7873 [[:Bar:X (Y) Z|]]
7874 !! result
7875 [[Article (context)|Article]]
7876 [[Bar:Article|Article]]
7877 [[:Bar:Article|Article]]
7878 [[Bar:Article (context)|Article]]
7879 [[:Bar:Article (context)|Article]]
7880 [[Article]]
7881 [[Article (context)]]
7882 [[Bar:X (Y) Z|X (Y) Z]]
7883 [[:Bar:X (Y) Z|X (Y) Z]]
7884 !! end
7885
7886 !! test
7887 pre-save transform: context links ("pipe trick") with interwiki prefix
7888 !! options
7889 pst
7890 !! input
7891 [[interwiki:Article|]]
7892 [[:interwiki:Article|]]
7893 [[interwiki:Bar:Article|]]
7894 [[:interwiki:Bar:Article|]]
7895 !! result
7896 [[interwiki:Article|Article]]
7897 [[:interwiki:Article|Article]]
7898 [[interwiki:Bar:Article|Bar:Article]]
7899 [[:interwiki:Bar:Article|Bar:Article]]
7900 !! end
7901
7902 !! test
7903 pre-save transform: context links ("pipe trick") with parens in title
7904 !! options
7905 pst title=[[Somearticle (context)]]
7906 !! input
7907 [[|Article]]
7908 !! result
7909 [[Article (context)|Article]]
7910 !! end
7911
7912 !! test
7913 pre-save transform: context links ("pipe trick") with comma in title
7914 !! options
7915 pst title=[[Someplace, Somewhere]]
7916 !! input
7917 [[|Otherplace]]
7918 [[Otherplace, Elsewhere|]]
7919 [[Otherplace, Elsewhere, Anywhere|]]
7920 !! result
7921 [[Otherplace, Somewhere|Otherplace]]
7922 [[Otherplace, Elsewhere|Otherplace]]
7923 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7924 !! end
7925
7926 !! test
7927 pre-save transform: context links ("pipe trick") with parens and comma
7928 !! options
7929 pst title=[[Someplace (IGNORED), Somewhere]]
7930 !! input
7931 [[|Otherplace]]
7932 [[Otherplace (place), Elsewhere|]]
7933 !! result
7934 [[Otherplace, Somewhere|Otherplace]]
7935 [[Otherplace (place), Elsewhere|Otherplace]]
7936 !! end
7937
7938 !! test
7939 pre-save transform: context links ("pipe trick") with comma and parens
7940 !! options
7941 pst title=[[Who, me? (context)]]
7942 !! input
7943 [[|Yes, you.]]
7944 [[Me, Myself, and I (1937 song)|]]
7945 !! result
7946 [[Yes, you. (context)|Yes, you.]]
7947 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7948 !! end
7949
7950 !! test
7951 pre-save transform: context links ("pipe trick") with namespace
7952 !! options
7953 pst title=[[Ns:Somearticle]]
7954 !! input
7955 [[|Article]]
7956 !! result
7957 [[Ns:Article|Article]]
7958 !! end
7959
7960 !! test
7961 pre-save transform: context links ("pipe trick") with namespace and parens
7962 !! options
7963 pst title=[[Ns:Somearticle (context)]]
7964 !! input
7965 [[|Article]]
7966 !! result
7967 [[Ns:Article (context)|Article]]
7968 !! end
7969
7970 !! test
7971 pre-save transform: context links ("pipe trick") with namespace and comma
7972 !! options
7973 pst title=[[Ns:Somearticle, Context, Whatever]]
7974 !! input
7975 [[|Article]]
7976 !! result
7977 [[Ns:Article, Context, Whatever|Article]]
7978 !! end
7979
7980 !! test
7981 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7982 !! options
7983 pst title=[[Ns:Somearticle, Context (context)]]
7984 !! input
7985 [[|Article]]
7986 !! result
7987 [[Ns:Article (context)|Article]]
7988 !! end
7989
7990 !! test
7991 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7992 !! options
7993 pst title=[[Ns:Somearticle (IGNORED), Context]]
7994 !! input
7995 [[|Article]]
7996 !! result
7997 [[Ns:Article, Context|Article]]
7998 !! end
7999
8000 !! test
8001 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8002 !! options
8003 pst
8004 !! input
8005 [[Article(context)|]]
8006 [[Bar:Article(context)|]]
8007 [[:Bar:Article(context)|]]
8008 [[|Article(context)]]
8009 [[Bar:X(Y)Z|]]
8010 [[:Bar:X(Y)Z|]]
8011 !! result
8012 [[Article(context)|Article]]
8013 [[Bar:Article(context)|Article]]
8014 [[:Bar:Article(context)|Article]]
8015 [[Article(context)]]
8016 [[Bar:X(Y)Z|X(Y)Z]]
8017 [[:Bar:X(Y)Z|X(Y)Z]]
8018 !! end
8019
8020 !! test
8021 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8022 !! options
8023 pst
8024 !! input
8025 [[Article (context)|]]
8026 [[Bar:Article (context)|]]
8027 [[:Bar:Article (context)|]]
8028 [[|Article (context)]]
8029 [[Bar:X (Y) Z|]]
8030 [[:Bar:X (Y) Z|]]
8031 !! result
8032 [[Article (context)|Article]]
8033 [[Bar:Article (context)|Article]]
8034 [[:Bar:Article (context)|Article]]
8035 [[Article (context)]]
8036 [[Bar:X (Y) Z|X (Y) Z]]
8037 [[:Bar:X (Y) Z|X (Y) Z]]
8038 !! end
8039
8040 !! test
8041 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8042 !! options
8043 pst
8044 !! input
8045 [[Article(context)|]]
8046 [[Bar:Article(context)|]]
8047 [[:Bar:Article(context)|]]
8048 [[|Article(context)]]
8049 [[Bar:X(Y)Z|]]
8050 [[:Bar:X(Y)Z|]]
8051 !! result
8052 [[Article(context)|Article]]
8053 [[Bar:Article(context)|Article]]
8054 [[:Bar:Article(context)|Article]]
8055 [[Article(context)]]
8056 [[Bar:X(Y)Z|X(Y)Z]]
8057 [[:Bar:X(Y)Z|X(Y)Z]]
8058 !! end
8059
8060 !! test
8061 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8062 !! options
8063 pst
8064 !! input
8065 [[Article (context), context|]]
8066 [[Article (context),context|]]
8067 [[Bar:Article (context), context|]]
8068 [[Bar:Article (context),context|]]
8069 [[:Bar:Article (context), context|]]
8070 [[:Bar:Article (context),context|]]
8071 !! result
8072 [[Article (context), context|Article]]
8073 [[Article (context),context|Article]]
8074 [[Bar:Article (context), context|Article]]
8075 [[Bar:Article (context),context|Article]]
8076 [[:Bar:Article (context), context|Article]]
8077 [[:Bar:Article (context),context|Article]]
8078 !! end
8079
8080 !! test
8081 pre-save transform: trim trailing empty lines
8082 !! options
8083 pst
8084 !! input
8085 Empty lines are trimmed
8086
8087
8088
8089
8090 !! result
8091 Empty lines are trimmed
8092 !! end
8093
8094 !! test
8095 pre-save transform: Signature expansion
8096 !! options
8097 pst
8098 !! input
8099 * ~~~
8100 * <noinclude>~~~</noinclude>
8101 * <includeonly>~~~</includeonly>
8102 * <onlyinclude>~~~</onlyinclude>
8103 !! result
8104 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8105 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8106 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8107 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8108 !! end
8109
8110
8111 !! test
8112 pre-save transform: Signature expansion in nowiki tags (bug 93)
8113 !! options
8114 pst disabled
8115 !! input
8116 Shall not expand:
8117
8118 <nowiki>~~~~</nowiki>
8119
8120 <includeonly><nowiki>~~~~</nowiki></includeonly>
8121
8122 <noinclude><nowiki>~~~~</nowiki></noinclude>
8123
8124 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8125
8126 {{subst:Foo}} shall be converted to FOO
8127
8128 As well as inside noinclude/onlyinclude
8129 <noinclude>{{subst:Foo}}</noinclude>
8130 <onlyinclude>{{subst:Foo}}</onlyinclude>
8131
8132 But not inside includeonly
8133 <includeonly>{{subst:Foo}}</includeonly>
8134 !! result
8135 Shall not expand:
8136
8137 <nowiki>~~~~</nowiki>
8138
8139 <includeonly><nowiki>~~~~</nowiki></includeonly>
8140
8141 <noinclude><nowiki>~~~~</nowiki></noinclude>
8142
8143 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8144
8145 FOO shall be converted to FOO
8146
8147 As well as inside noinclude/onlyinclude
8148 <noinclude>FOO</noinclude>
8149 <onlyinclude>FOO</onlyinclude>
8150
8151 But not inside includeonly
8152 <includeonly>{{subst:Foo}}</includeonly>
8153 !! end
8154
8155 !! test
8156 Parsoid: Recognize nowiki with trailing space in tags
8157 !! options
8158 parsoid=wt2html
8159 !! input
8160 <nowiki ><div>[[foo]]</nowiki >
8161
8162 a<nowiki / >b
8163
8164 c<nowiki />d
8165
8166 e<nowiki/ >f
8167 !! result
8168 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8169 <p>ab</p>
8170 <p>cd</p>
8171 <p>ef</p>
8172 !! end
8173
8174 !! test
8175 Parsoid: Recognize nowiki with odd capitalization
8176 !! options
8177 parsoid=wt2html
8178 !! input
8179 <noWikI ><div>[[foo]]</Nowiki >
8180 !! result
8181 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8182 !! end
8183
8184
8185 !! test
8186 Parsoid: Escape nowiki with trailing space in tags
8187 !! options
8188 parsoid=html2wt
8189 !! input
8190 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8191
8192 a&lt;nowiki /&gt;b
8193
8194 c&lt;nowiki/ &gt;d
8195 !! result
8196 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8197 <p>a&lt;nowiki /&gt;b</p>
8198 <p>c&lt;nowiki/ &gt;d</p>
8199 !! end
8200
8201 !! test
8202 Parsoid: Escape weird noWikI capitalizations
8203 !! options
8204 parsoid=html2wt
8205 !! input
8206 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8207 !! result
8208 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8209 !! end
8210
8211 ###
8212 ### Message transform tests
8213 ###
8214 !! test
8215 message transform: magic variables
8216 !! options
8217 msg
8218 !! input
8219 {{SITENAME}}
8220 !! result
8221 MediaWiki
8222 !! end
8223
8224 !! test
8225 message transform: should not transform wiki markup
8226 !! options
8227 msg
8228 !! input
8229 ''test''
8230 !! result
8231 ''test''
8232 !! end
8233
8234 !! test
8235 message transform: <noinclude> in transcluded template (bug 4926)
8236 !! options
8237 msg
8238 !! input
8239 {{Includes}}
8240 !! result
8241 Foobar
8242 !! end
8243
8244 !! test
8245 message transform: <onlyinclude> in transcluded template (bug 4926)
8246 !! options
8247 msg
8248 !! input
8249 {{Includes2}}
8250 !! result
8251 Foo
8252 !! end
8253
8254 !! test
8255 {{#special:}} page name, known
8256 !! options
8257 msg
8258 !! input
8259 {{#special:Recentchanges}}
8260 !! result
8261 Special:RecentChanges
8262 !! end
8263
8264 !! test
8265 {{#special:}} page name with subpage, known
8266 !! options
8267 msg
8268 !! input
8269 {{#special:Recentchanges/param}}
8270 !! result
8271 Special:RecentChanges/param
8272 !! end
8273
8274 !! test
8275 {{#special:}} page name, unknown
8276 !! options
8277 msg
8278 !! input
8279 {{#special:foobar nonexistent}}
8280 !! result
8281 Special:Foobar nonexistent
8282 !! end
8283
8284 !! test
8285 {{#speciale:}} page name, known
8286 !! options
8287 msg
8288 !! input
8289 {{#speciale:Recentchanges}}
8290 !! result
8291 Special:RecentChanges
8292 !! end
8293
8294 !! test
8295 {{#speciale:}} page name with subpage, known
8296 !! options
8297 msg
8298 !! input
8299 {{#speciale:Recentchanges/param}}
8300 !! result
8301 Special:RecentChanges/param
8302 !! end
8303
8304 !! test
8305 {{#speciale:}} page name, unknown
8306 !! options
8307 msg
8308 !! input
8309 {{#speciale:foobar nonexistent}}
8310 !! result
8311 Special:Foobar_nonexistent
8312 !! end
8313
8314 ###
8315 ### Images
8316 ###
8317 !! test
8318 Simple image
8319 !! input
8320 [[Image:foobar.jpg]]
8321 !! result
8322 <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>
8323 </p>
8324 !! end
8325
8326 !! test
8327 Right-aligned image
8328 !! input
8329 [[Image:foobar.jpg|right]]
8330 !! result
8331 <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>
8332
8333 !! end
8334
8335 !! test
8336 Simple image (using File: namespace, now canonical)
8337 !! input
8338 [[File:foobar.jpg]]
8339 !! result
8340 <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>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Image with caption
8346 !! input
8347 [[Image:foobar.jpg|right|Caption text]]
8348 !! result
8349 <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>
8350
8351 !! end
8352
8353 !! test
8354 Image with empty attribute
8355 !! input
8356 [[Image:foobar.jpg|right||Caption text]]
8357 !! result
8358 <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>
8359
8360 !! end
8361
8362 !! test
8363 Image with attributes from template.
8364 !! input
8365 [[Image:foobar.jpg|{{image_attribs}}]]
8366 !! result
8367 <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>
8368
8369 !! end
8370
8371 !! test
8372 Image with link tails
8373 !! input
8374 123[[Image:foobar.jpg]]456
8375 123[[Image:foobar.jpg|right]]456
8376 123[[Image:foobar.jpg|thumb]]456
8377 !! result
8378 <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
8379 </p>
8380 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
8381 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
8382
8383 !! end
8384
8385 !! test
8386 Image with multiple captions -- only last one is accepted
8387 !! input
8388 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8389 !! result
8390 <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>
8391
8392 !! end
8393
8394 !! test
8395 Image with width attribute at different positions
8396 !! input
8397 [[Image:foobar.jpg|200px|right|Caption]]
8398 [[Image:foobar.jpg|right|200px|Caption]]
8399 [[Image:foobar.jpg|right|Caption|200px]]
8400 !! result
8401 <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>
8402 <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>
8403 <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>
8404
8405 !! end
8406
8407 !! test
8408 Image with link parameter, wiki target
8409 !! input
8410 [[Image:foobar.jpg|link=Target page]]
8411 !! result
8412 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8413 </p>
8414 !! end
8415
8416 !! test
8417 Image with link parameter, URL target
8418 !! input
8419 [[Image:foobar.jpg|link=http://example.com/]]
8420 !! result
8421 <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>
8422 </p>
8423 !! end
8424
8425 !! test
8426 Image with link parameter, wgExternalLinkTarget
8427 !! input
8428 [[Image:foobar.jpg|link=http://example.com/]]
8429 !! config
8430 wgExternalLinkTarget='foobar'
8431 !! result
8432 <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>
8433 </p>
8434 !! end
8435
8436 !! test
8437 Image with link parameter, wgNoFollowLinks set to false
8438 !! input
8439 [[Image:foobar.jpg|link=http://example.com/]]
8440 !! config
8441 wgNoFollowLinks=false
8442 !! result
8443 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8444 </p>
8445 !! end
8446
8447 !! test
8448 Image with link parameter, wgNoFollowDomainExceptions
8449 !! input
8450 [[Image:foobar.jpg|link=http://example.com/]]
8451 !! config
8452 wgNoFollowDomainExceptions='example.com'
8453 !! result
8454 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8455 </p>
8456 !! end
8457
8458 !! test
8459 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8460 !! input
8461 [[Image:foobar.jpg|link=http://example.com/|Title]]
8462 !! config
8463 wgExternalLinkTarget='foobar'
8464 !! result
8465 <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>
8466 </p>
8467 !! end
8468
8469 !! test
8470 Image with empty link parameter
8471 !! input
8472 [[Image:foobar.jpg|link=]]
8473 !! result
8474 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8475 </p>
8476 !! end
8477
8478 !! test
8479 Image with link parameter (wiki target) and unnamed parameter
8480 !! input
8481 [[Image:foobar.jpg|link=Target page|Title]]
8482 !! result
8483 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8484 </p>
8485 !! end
8486
8487 !! test
8488 Image with link parameter (URL target) and unnamed parameter
8489 !! input
8490 [[Image:foobar.jpg|link=http://example.com/|Title]]
8491 !! result
8492 <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>
8493 </p>
8494 !! end
8495
8496 !! test
8497 Thumbnail image with link parameter
8498 !! options
8499 php
8500 !! input
8501 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8502 !! result
8503 <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>
8504
8505 !! end
8506
8507 !! test
8508 Manually-specified thumbnail image
8509 !! options
8510 php
8511 !! input
8512 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8513 !! result
8514 <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>
8515
8516 !! end
8517
8518 !! test
8519 Manually-specified thumbnail image with explicit link to wiki page
8520 !! options
8521 php
8522 !! input
8523 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8524 !! result
8525 <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>
8526
8527 !! end
8528
8529 !! test
8530 Manually-specified thumbnail image with explicit link to url
8531 !! options
8532 php
8533 !! input
8534 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8535 !! result
8536 <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>
8537
8538 !! end
8539
8540 !! test
8541 Manually-specified thumbnail image with explicit no link
8542 !! options
8543 php
8544 !! input
8545 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8546 !! result
8547 <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>
8548
8549 !! end
8550
8551 !! test
8552 Manually-specified thumbnail image with explicit link and alt text
8553 !! options
8554 php
8555 !! input
8556 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8557 !! result
8558 <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>
8559
8560 !! end
8561
8562 !! test
8563 Image with frame and link
8564 !! input
8565 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8566 !! result
8567 <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>
8568
8569 !! end
8570
8571 !! test
8572 Image with frame and link and explicit alt
8573 !! input
8574 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8575 !! result
8576 <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>
8577
8578 !! end
8579
8580 !! test
8581 Image with wiki markup in implicit alt
8582 !! input
8583 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8584 !! result
8585 <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>
8586 </p>
8587 !! end
8588
8589 !! test
8590 Image with wiki markup in explicit alt
8591 !! input
8592 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8593 !! result
8594 <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>
8595 </p>
8596 !! end
8597
8598 !! test
8599 Link to image page- image page normally doesn't exists, hence edit link
8600 Add test with existing image page
8601 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8602 !! input
8603 [[:Image:test]]
8604 !! result
8605 <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>
8606 </p>
8607 !! end
8608
8609 !! test
8610 bug 18784 Link to non-existent image page with caption should use caption as link text
8611 !! input
8612 [[:Image:test|caption]]
8613 !! result
8614 <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>
8615 </p>
8616 !! end
8617
8618 !! test
8619 Frameless image caption with a free URL
8620 !! input
8621 [[Image:foobar.jpg|http://example.com]]
8622 !! result
8623 <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>
8624 </p>
8625 !! end
8626
8627 !! test
8628 Thumbnail image caption with a free URL
8629 !! input
8630 [[Image:foobar.jpg|thumb|http://example.com]]
8631 !! result
8632 <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>
8633
8634 !! end
8635
8636 !! test
8637 Thumbnail image caption with a free URL and explicit alt
8638 !! input
8639 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8640 !! result
8641 <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>
8642
8643 !! end
8644
8645 !! test
8646 SVG thumbnails with no language set
8647 !! options
8648 !! input
8649 [[File:Foobar.svg|thumb|width=200]]
8650 !! result
8651 <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>
8652
8653 !! end
8654
8655 !! test
8656 SVG thumbnails with language de
8657 !! options
8658 !! input
8659 [[File:Foobar.svg|thumb|width=200|lang=de]]
8660 !! result
8661 <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>
8662
8663 !! end
8664
8665 !! test
8666 SVG thumbnails with invalid language code
8667 !! options
8668 !! input
8669 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8670 !! result
8671 <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>
8672
8673 !! end
8674
8675 !! test
8676 BUG 1887: A ISBN with a thumbnail
8677 !! input
8678 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8679 !! result
8680 <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>
8681
8682 !! end
8683
8684 !! test
8685 BUG 1887: A RFC with a thumbnail
8686 !! input
8687 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8688 !! result
8689 <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>
8690
8691 !! end
8692
8693 !! test
8694 BUG 1887: A mailto link with a thumbnail
8695 !! input
8696 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8697 !! result
8698 <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>
8699
8700 !! end
8701
8702 # Pending resolution to bug 368
8703 !! test
8704 BUG 648: Frameless image caption with a link
8705 !! input
8706 [[Image:foobar.jpg|text with a [[link]] in it]]
8707 !! result
8708 <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>
8709 </p>
8710 !! end
8711
8712 !! test
8713 BUG 648: Frameless image caption with a link (suffix)
8714 !! input
8715 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8716 !! result
8717 <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>
8718 </p>
8719 !! end
8720
8721 !! test
8722 BUG 648: Frameless image caption with an interwiki link
8723 !! input
8724 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8725 !! result
8726 <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>
8727 </p>
8728 !! end
8729
8730 !! test
8731 BUG 648: Frameless image caption with a piped interwiki link
8732 !! input
8733 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8734 !! result
8735 <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>
8736 </p>
8737 !! end
8738
8739 !! test
8740 Escape HTML special chars in image alt text
8741 !! input
8742 [[Image:foobar.jpg|& < > "]]
8743 !! result
8744 <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>
8745 </p>
8746 !! end
8747
8748 !! test
8749 BUG 499: Alt text should have &#1234;, not &amp;1234;
8750 !! input
8751 [[Image:foobar.jpg|&#9792;]]
8752 !! result
8753 <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>
8754 </p>
8755 !! end
8756
8757 !! test
8758 Broken image caption with link
8759 !! input
8760 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8761 !! result
8762 <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.
8763 </p>
8764 !! end
8765
8766 !! test
8767 Image caption containing another image
8768 !! input
8769 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8770 !! result
8771 <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>
8772
8773 !! end
8774
8775 !! test
8776 Image caption containing a newline
8777 !! input
8778 [[Image:Foobar.jpg|This
8779 *is some text]]
8780 !! result
8781 <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>
8782 </p>
8783 !!end
8784
8785 !!test
8786 Parsoid: Image caption containing leading space
8787 (The leading space should not trigger nowiki escaping in wt2wt mode)
8788 !! input
8789 [[Image:Foobar.jpg|thumb| bar]]
8790 !! result
8791 <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>
8792
8793 !!end
8794
8795 !! test
8796 Bug 3090: External links other than http: in image captions
8797 !! input
8798 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8799 !! result
8800 <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>
8801
8802 !! end
8803
8804 !! test
8805 Custom class
8806 !! input
8807 [[Image:foobar.jpg|a|class=b]]
8808 !! result
8809 <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>
8810 </p>
8811 !! end
8812
8813 !! test
8814 Localized image handling (1).
8815 !! options
8816 language=es
8817 !! input
8818 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8819 !! result
8820 <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>
8821
8822 !! end
8823
8824 !! test
8825 Localized image handling (2).
8826 !! options
8827 language=es
8828 !! input
8829 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8830 !! result
8831 <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>
8832
8833 !! end
8834
8835 !! test
8836 "border", "frameless" and "class" attributes on an image.
8837 !! input
8838 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8839 !! result
8840 <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>
8841 </p>
8842 !! end
8843
8844 !! article
8845 File:Barfoo.jpg
8846 !! text
8847 #REDIRECT [[File:Barfoo.jpg]]
8848 !! endarticle
8849
8850 !! test
8851 Redirected image
8852 !! input
8853 [[Image:Barfoo.jpg]]
8854 !! result
8855 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8856 </p>
8857 !! end
8858
8859 !! test
8860 Missing image with uploads disabled
8861 !! options
8862 wgEnableUploads=0
8863 !! input
8864 [[Image:Foobaz.jpg]]
8865 !! result
8866 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8867 </p>
8868 !! end
8869
8870 # Parsoid-specific testing for images
8871 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8872 # Currently imperfect due to a flaw in the Parsoid testrunner
8873 # Work in progress
8874
8875 !! test
8876 Parsoid-specific image handling - simple image
8877 !! options
8878 parsoid
8879 !! input
8880 [[Image:Foobar.jpg]]
8881 !! result
8882 <p>
8883 <span class="mw-default-size" typeof="mw:Image">
8884 <a href="File:Foobar.jpg">
8885 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8886 </a>
8887 </span>
8888 </p>
8889 !! end
8890
8891 !! test
8892 Parsoid-specific image handling - simple image without link
8893 !! options
8894 parsoid
8895 !! input
8896 [[Image:Foobar.jpg|link=]]
8897 !! result
8898 <p>
8899 <span class="mw-default-size" typeof="mw:Image">
8900 <span>
8901 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8902 </span>
8903 </span>
8904 </p>
8905 !! end
8906
8907 !! test
8908 Parsoid-specific image handling - simple image with specific link
8909 !! options
8910 parsoid
8911 !! input
8912 [[Image:Foobar.jpg|link=Main Page]]
8913 !! result
8914 <p>
8915 <span class="mw-default-size" typeof="mw:Image">
8916 <a href="Main_Page">
8917 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8918 </a>
8919 </span>
8920 </p>
8921 !! end
8922
8923 !! test
8924 Parsoid-specific image handling - simple image with size and middle alignment
8925 !! options
8926 parsoid
8927 !! input
8928 [[Image:Foobar.jpg|50px|middle]]
8929 !! result
8930 <p>
8931 <span class="mw-valign-middle" typeof="mw:Image">
8932 <a href="File:Foobar.jpg">
8933 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8934 </a>
8935 </span>
8936 </p>
8937 !! end
8938
8939 !! test
8940 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8941 !! options
8942 parsoid
8943 !! input
8944 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8945 !! result
8946 <p>
8947 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8948 <a href="File:Foobar.jpg">
8949 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8950 </a>
8951 </span>
8952 </p>
8953 !! end
8954
8955 !! test
8956 Parsoid-specific image handling - simple image with border and size spec
8957 !! options
8958 parsoid
8959 !! input
8960 [[Image:Foobar.jpg|50px|border|caption]]
8961 !! result
8962 <p>
8963 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8964 <a href="File:Foobar.jpg">
8965 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8966 </a>
8967 </span>
8968 </p>
8969 !! end
8970
8971 !! test
8972 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8973 !! options
8974 parsoid
8975 !! input
8976 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8977 !! result
8978 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8979 <a href="File:Foobar.jpg">
8980 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8981 </a>
8982 <figcaption>caption content</figcaption>
8983 </figure>
8984 !! end
8985
8986 !! test
8987 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8988 !! options
8989 parsoid
8990 !! input
8991 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8992 !! result
8993 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8994 <a href="File:Foobar.jpg">
8995 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8996 </a>
8997 <figcaption>caption</figcaption>
8998 </figure>
8999 !! end
9000
9001 !! test
9002 Parsoid-specific image handling - framed image with specific size and caption
9003 !! options
9004 parsoid
9005 !! input
9006 [[Image:Foobar.jpg|500x50px|frame|caption]]
9007 !! result
9008 <figure typeof="mw:Image/Frame">
9009 <a href="File:Foobar.jpg">
9010 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9011 </a>
9012 <figcaption>caption</figcaption>
9013 </figure>
9014 !! end
9015
9016 !! test
9017 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9018 !! options
9019 parsoid
9020 !! input
9021 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9022 !! result
9023 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9024 <a href="File:Foobar.jpg">
9025 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9026 </a>
9027 <figcaption>caption</figcaption>
9028 </figure>
9029 !! end
9030
9031 !! test
9032 Parsoid-specific image handling - frameless image with specific size, border, and caption
9033 !! options
9034 parsoid
9035 !! input
9036 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9037 !! result
9038 <p>
9039 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9040 <a href="File:Foobar.jpg">
9041 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9042 </a>
9043 </p>
9044 !! end
9045
9046 #!! test
9047 #Parsoid-specific image handling - simple image with a formatted caption
9048 #!! options
9049 #parsoid
9050 #!! input
9051 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9052 #!! result
9053 #<p>
9054 #<span typeof="mw:Image">
9055 #<a class="mw-default-size" href="Image:Foobar.jpg">
9056 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
9057 #</a>
9058 #<span>abc</span>
9059 #</span>
9060 #</p>
9061
9062
9063 ###
9064 ### Subpages
9065 ###
9066 !! article
9067 Subpage test/subpage
9068 !! text
9069 foo
9070 !! endarticle
9071
9072 !! test
9073 Subpage link
9074 !! options
9075 subpage title=[[Subpage test]]
9076 !! input
9077 [[/subpage]]
9078 !! result
9079 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9080 </p>
9081 !! end
9082
9083 !! test
9084 Subpage noslash link
9085 !! options
9086 subpage title=[[Subpage test]]
9087 !!input
9088 [[/subpage/]]
9089 !! result
9090 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9091 </p>
9092 !! end
9093
9094 # TODO: make this PHP-parser compatible!
9095 !! test
9096 Relative subpage noslash link
9097 !! options
9098 parsoid=wt2wt,wt2html,html2html
9099 subpage title=[[Subpage test/1/2/3/4]]
9100 !!input
9101 [[../../subpage/]]
9102
9103 [[../../subpage]]
9104 !! result
9105 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9106 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9107 !! end
9108
9109 # TODO: make this PHP-parser compatible!
9110 !! test
9111 Parsoid: dot-slash prefixed wikilinks
9112 !! options
9113 parsoid=wt2wt,wt2html,html2html
9114 !!input
9115 [[./foo]]
9116
9117 [[././bar]]
9118
9119 [[././baz/]]
9120 !! result
9121 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9122 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9123 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9124 !! end
9125
9126 !! test
9127 Disabled subpages
9128 !! input
9129 [[/subpage]]
9130 !! result
9131 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9132 </p>
9133 !! end
9134
9135 !! test
9136 BUG 561: {{/Subpage}}
9137 !! options
9138 subpage title=[[Page]]
9139 !! input
9140 {{/Subpage}}
9141 !! result
9142 <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>
9143 </p>
9144 !! end
9145
9146 ###
9147 ### Categories
9148 ###
9149 !! article
9150 Category:MediaWiki User's Guide
9151 !! text
9152 blah
9153 !! endarticle
9154
9155 !! test
9156 Link to category
9157 !! input
9158 [[:Category:MediaWiki User's Guide]]
9159 !! result
9160 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9161 </p>
9162 !! end
9163
9164 !! test
9165 Simple category
9166 !! options
9167 cat
9168 !! input
9169 [[Category:MediaWiki User's Guide]]
9170 !! result
9171 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9172 !! end
9173
9174 !! test
9175 PAGESINCATEGORY invalid title fatal (r33546 fix)
9176 !! input
9177 {{PAGESINCATEGORY:<bogus>}}
9178 !! result
9179 <p>0
9180 </p>
9181 !! end
9182
9183 !! test
9184 Category with different sort key
9185 !! options
9186 cat
9187 !! input
9188 [[Category:MediaWiki User's Guide|Foo]]
9189 !! result
9190 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9191 !! end
9192
9193 !! test
9194 Category with identical sort key
9195 !! options
9196 cat
9197 !! input
9198 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9199 !! result
9200 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9201 !! end
9202
9203 !! test
9204 Category with empty sort key
9205 !! options
9206 cat
9207 pst
9208 !! input
9209 [[Category:MediaWiki User's Guide|]]
9210 !! result
9211 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9212 !! end
9213
9214 !! test
9215 Category with empty sort key and parentheses
9216 !! options
9217 cat
9218 pst
9219 !! input
9220 [[Category:Foo (bar)|]]
9221 !! result
9222 [[Category:Foo (bar)|Foo]]
9223 !! end
9224
9225 !! test
9226 Category with link tail
9227 !! options
9228 cat
9229 pst
9230 !! input
9231 123[[Category:Foo]]456
9232 !! result
9233 123[[Category:Foo]]456
9234 !! end
9235
9236 !! test
9237 Category with template
9238 !! options
9239 cat
9240 pst
9241 !! input
9242 [[Category:{{echo|Foo}}]]
9243 !! result
9244 [[Category:{{echo|Foo}}]]
9245 !! end
9246
9247 !! test
9248 Category with template in sort key
9249 !! options
9250 cat
9251 pst
9252 !! input
9253 [[Category:Foo|{{echo|Bar}}]]
9254 !! result
9255 [[Category:Foo|{{echo|Bar}}]]
9256 !! end
9257
9258 !! test
9259 Category with template in sort key and title
9260 !! options
9261 cat
9262 pst
9263 !! input
9264 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9265 !! result
9266 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9267 !! end
9268
9269 !! test
9270 Category / paragraph interactions
9271 !! input
9272 Foo [[Category:Baz]] Bar
9273
9274 Foo [[Category:Baz]]
9275 Bar
9276
9277 Foo
9278 [[Category:Baz]]
9279 Bar
9280
9281 Foo
9282 [[Category:Baz]] Bar
9283
9284 Foo
9285 [[Category:Baz]]
9286 [[Category:Baz]]
9287 [[Category:Baz]]
9288 Bar
9289
9290 [[Category:Baz]]
9291 [[Category:Baz]]
9292 [[Category:Baz]]
9293
9294 [[Category:Baz]]
9295 {{echo|[[Category:Baz]]}}
9296 [[Category:Baz]]
9297 !! result
9298 <p>Foo Bar
9299 </p><p>Foo
9300 Bar
9301 </p><p>Foo
9302 Bar
9303 </p><p>Foo Bar
9304 </p><p>Foo
9305 Bar
9306 </p>
9307 !! end
9308
9309 !! test
9310 Parsoid: Serialize link to category page with colon escape
9311 !! options
9312 parsoid
9313 !! input
9314
9315 [[:Category:Foo]]
9316 [[:Category:Foo|Bar]]
9317 !! result
9318 <p>
9319 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9320 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9321 </p>
9322 !! end
9323
9324 !! test
9325 Parsoid: Link prefix/suffixes aren't applied to category links
9326 !! options
9327 parsoid=wt2html,wt2wt,html2html
9328 language=is
9329 !! input
9330 x[[Category:Foo]]y
9331 !! result
9332 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9333 !! end
9334
9335 !! test
9336 Parsoid: Serialize link to file page with colon escape
9337 !! options
9338 parsoid
9339 !! input
9340
9341 [[:File:Foo.png]]
9342 [[:File:Foo.png|Bar]]
9343 !! result
9344 <p>
9345 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9346 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9347 </p>
9348 !! end
9349
9350 !! test
9351 Parsoid: Serialize a genuine category link without colon escape
9352 !! options
9353 parsoid
9354 !! input
9355 [[Category:Foo]]
9356 [[Category:Foo|Bar]]
9357 !! result
9358 <link rel="mw:WikiLink/Category" href="Category:Foo">
9359 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9360 !! end
9361
9362 ###
9363 ### Inter-language links
9364 ###
9365 !! test
9366 Inter-language links
9367 !! options
9368 ill
9369 !! input
9370 [[es:Alimento]]
9371 [[fr:Nourriture]]
9372 [[zh:&#39135;&#21697;]]
9373 !! result
9374 es:Alimento fr:Nourriture zh:食品
9375 !! end
9376
9377 !! test
9378 Duplicate interlanguage links (bug 24502)
9379 !! options
9380 ill
9381 !! input
9382 [[es:1]]
9383 [[es:2]]
9384 [[fr:1]]
9385 [[fr:2]]
9386 !! result
9387 es:1 fr:1
9388 !! end
9389
9390 ###
9391 ### Sections
9392 ###
9393 !! test
9394 Basic section headings
9395 !! input
9396 == Headline 1 ==
9397 Some text
9398
9399 ==Headline 2==
9400 More
9401 ===Smaller headline===
9402 Blah blah
9403 !! result
9404 <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>
9405 <p>Some text
9406 </p>
9407 <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>
9408 <p>More
9409 </p>
9410 <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>
9411 <p>Blah blah
9412 </p>
9413 !! end
9414
9415 !! test
9416 Section headings with TOC
9417 !! input
9418 == Headline 1 ==
9419 === Subheadline 1 ===
9420 ===== Skipping a level =====
9421 ====== Skipping a level ======
9422
9423 == Headline 2 ==
9424 Some text
9425 ===Another headline===
9426 !! result
9427 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9428 <ul>
9429 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9430 <ul>
9431 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9432 <ul>
9433 <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>
9434 <ul>
9435 <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>
9436 </ul>
9437 </li>
9438 </ul>
9439 </li>
9440 </ul>
9441 </li>
9442 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9443 <ul>
9444 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9445 </ul>
9446 </li>
9447 </ul>
9448 </div>
9449 <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>
9450 <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>
9451 <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>
9452 <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>
9453 <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>
9454 <p>Some text
9455 </p>
9456 <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>
9457
9458 !! end
9459
9460 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9461 !! test
9462 Handling of sections up to level 6 and beyond
9463 !! input
9464 = Level 1 Heading=
9465 == Level 2 Heading==
9466 === Level 3 Heading===
9467 ==== Level 4 Heading====
9468 ===== Level 5 Heading=====
9469 ====== Level 6 Heading======
9470 ======= Level 7 Heading=======
9471 ======== Level 8 Heading========
9472 ========= Level 9 Heading=========
9473 ========== Level 10 Heading==========
9474 !! result
9475 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9476 <ul>
9477 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9478 <ul>
9479 <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>
9480 <ul>
9481 <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>
9482 <ul>
9483 <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>
9484 <ul>
9485 <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>
9486 <ul>
9487 <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>
9488 <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>
9489 <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>
9490 <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>
9491 <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>
9492 </ul>
9493 </li>
9494 </ul>
9495 </li>
9496 </ul>
9497 </li>
9498 </ul>
9499 </li>
9500 </ul>
9501 </li>
9502 </ul>
9503 </div>
9504 <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>
9505 <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>
9506 <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>
9507 <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>
9508 <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>
9509 <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>
9510 <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>
9511 <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>
9512 <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>
9513 <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>
9514
9515 !! end
9516
9517 !! test
9518 TOC regression (bug 9764)
9519 !! input
9520 == title 1 ==
9521 === title 1.1 ===
9522 ==== title 1.1.1 ====
9523 === title 1.2 ===
9524 == title 2 ==
9525 === title 2.1 ===
9526 !! result
9527 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9528 <ul>
9529 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9530 <ul>
9531 <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>
9532 <ul>
9533 <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>
9534 </ul>
9535 </li>
9536 <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>
9537 </ul>
9538 </li>
9539 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9540 <ul>
9541 <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>
9542 </ul>
9543 </li>
9544 </ul>
9545 </div>
9546 <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>
9547 <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>
9548 <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>
9549 <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>
9550 <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>
9551 <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>
9552
9553 !! end
9554
9555 !! test
9556 TOC with wgMaxTocLevel=3 (bug 6204)
9557 !! options
9558 wgMaxTocLevel=3
9559 !! input
9560 == title 1 ==
9561 === title 1.1 ===
9562 ==== title 1.1.1 ====
9563 === title 1.2 ===
9564 == title 2 ==
9565 === title 2.1 ===
9566 !! result
9567 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9568 <ul>
9569 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9570 <ul>
9571 <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>
9572 <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>
9573 </ul>
9574 </li>
9575 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9576 <ul>
9577 <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>
9578 </ul>
9579 </li>
9580 </ul>
9581 </div>
9582 <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>
9583 <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>
9584 <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>
9585 <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>
9586 <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>
9587 <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>
9588
9589 !! end
9590
9591 !! test
9592 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9593 !! options
9594 wgMaxTocLevel=3
9595 !! input
9596 ==Section 1==
9597 ===Section 1.1===
9598 ====Section 1.1.1====
9599 ====Section 1.1.1.1====
9600 ==Section 2==
9601 !! result
9602 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9603 <ul>
9604 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9605 <ul>
9606 <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>
9607 </ul>
9608 </li>
9609 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9610 </ul>
9611 </div>
9612 <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>
9613 <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>
9614 <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>
9615 <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>
9616 <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>
9617
9618 !! end
9619
9620
9621 !! test
9622 Resolving duplicate section names
9623 !! input
9624 == Foo bar ==
9625 == Foo bar ==
9626 !! result
9627 <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>
9628 <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>
9629
9630 !! end
9631
9632 !! test
9633 Resolving duplicate section names with differing case (bug 10721)
9634 !! input
9635 == Foo bar ==
9636 == Foo Bar ==
9637 !! result
9638 <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>
9639 <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>
9640
9641 !! end
9642
9643 !! article
9644 Template:sections
9645 !! text
9646 ===Section 1===
9647 ==Section 2==
9648 !! endarticle
9649
9650 !! test
9651 Template with sections, __NOTOC__
9652 !! input
9653 __NOTOC__
9654 ==Section 0==
9655 {{sections}}
9656 ==Section 4==
9657 !! result
9658 <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>
9659 <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>
9660 <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>
9661 <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>
9662
9663 !! end
9664
9665 !! test
9666 __NOEDITSECTION__ keyword
9667 !! input
9668 __NOEDITSECTION__
9669 ==Section 1==
9670 ==Section 2==
9671 !! result
9672 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9673 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9674
9675 !! end
9676
9677 !! test
9678 Link inside a section heading
9679 !! input
9680 ==Section with a [[Main Page|link]] in it==
9681 !! result
9682 <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>
9683
9684 !! end
9685
9686 !! test
9687 TOC regression (bug 12077)
9688 !! input
9689 __TOC__
9690 == title 1 ==
9691 === title 1.1 ===
9692 == title 2 ==
9693 !! result
9694 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9695 <ul>
9696 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9697 <ul>
9698 <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>
9699 </ul>
9700 </li>
9701 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9702 </ul>
9703 </div>
9704 <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>
9705 <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>
9706 <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>
9707
9708 !! end
9709
9710 !! test
9711 BUG 1219 URL next to image (good)
9712 !! input
9713 http://example.com [[Image:foobar.jpg]]
9714 !! result
9715 <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>
9716 </p>
9717 !!end
9718
9719 !! test
9720 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9721 !! input
9722 ===
9723 The line above must have a trailing space!
9724 === <!--
9725 --> <!-- -->
9726 But just in case it doesn't...
9727 !! result
9728 <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>
9729 <p>The line above must have a trailing space!
9730 </p>
9731 <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>
9732 <p>But just in case it doesn't...
9733 </p>
9734 !! end
9735
9736 !! test
9737 Header with special characters (bug 25462)
9738 !! input
9739 The tooltips shall not show entities to the user (ie. be double escaped)
9740
9741 == text > text ==
9742 section 1
9743
9744 == text < text ==
9745 section 2
9746
9747 == text & text ==
9748 section 3
9749
9750 == text ' text ==
9751 section 4
9752
9753 == text " text ==
9754 section 5
9755 !! result
9756 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9757 </p>
9758 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9759 <ul>
9760 <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>
9761 <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>
9762 <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>
9763 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9764 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9765 </ul>
9766 </div>
9767 <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>
9768 <p>section 1
9769 </p>
9770 <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>
9771 <p>section 2
9772 </p>
9773 <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>
9774 <p>section 3
9775 </p>
9776 <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>
9777 <p>section 4
9778 </p>
9779 <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>
9780 <p>section 5
9781 </p>
9782 !! end
9783
9784 !! test
9785 Headers with excess '=' characters
9786 (Are similar tests necessary beyond the 1st level?)
9787 !! input
9788 =foo==
9789 ==foo=
9790 =''italic'' heading==
9791 ==''italic'' heading=
9792 !! result
9793 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9794 <ul>
9795 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9796 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9797 <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>
9798 <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>
9799 </ul>
9800 </div>
9801 <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>
9802 <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>
9803 <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>
9804 <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>
9805
9806 !! end
9807
9808 !! test
9809 HTML headers vs TOC (bug 23393)
9810 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9811 !! input
9812 <h1>Header 1</h1>
9813 == Header 1.1 ==
9814 == Header 1.2 ==
9815
9816 <h1>Header 2
9817 </h1>
9818 == Header 2.1 ==
9819 == Header 2.2 ==
9820 __NOEDITSECTION__
9821 !! result
9822 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9823 <ul>
9824 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9825 <ul>
9826 <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>
9827 <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>
9828 </ul>
9829 </li>
9830 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9831 <ul>
9832 <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>
9833 <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>
9834 </ul>
9835 </li>
9836 </ul>
9837 </div>
9838 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9839 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9840 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9841 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9842 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9843 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9844
9845 !! end
9846
9847 !! test
9848 BUG 1219 URL next to image (broken)
9849 !! input
9850 http://example.com[[Image:foobar.jpg]]
9851 !! result
9852 <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>
9853 </p>
9854 !!end
9855
9856 !! test
9857 Bug 1186 news: in the middle of text
9858 !! input
9859 http://en.wikinews.org/wiki/Wikinews:Workplace
9860 !! result
9861 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9862 </p>
9863 !!end
9864
9865
9866 !! test
9867 Namespaced link must have a title
9868 !! input
9869 [[Project:]]
9870 !! result
9871 <p>[[Project:]]
9872 </p>
9873 !!end
9874
9875 !! test
9876 Namespaced link must have a title (bad fragment version)
9877 !! input
9878 [[Project:#fragment]]
9879 !! result
9880 <p>[[Project:#fragment]]
9881 </p>
9882 !!end
9883
9884
9885 ###
9886 ### HTML tags and HTML attributes
9887 ###
9888
9889 !! test
9890 div with no attributes
9891 !! input
9892 <div>HTML rocks</div>
9893 !! result
9894 <div>HTML rocks</div>
9895
9896 !! end
9897
9898 !! test
9899 div with double-quoted attribute
9900 !! input
9901 <div id="rock">HTML rocks</div>
9902 !! result
9903 <div id="rock">HTML rocks</div>
9904
9905 !! end
9906
9907 !! test
9908 div with single-quoted attribute
9909 !! input
9910 <div id='rock'>HTML rocks</div>
9911 !! result
9912 <div id="rock">HTML rocks</div>
9913
9914 !! end
9915
9916 !! test
9917 div with unquoted attribute
9918 !! input
9919 <div id=rock>HTML rocks</div>
9920 !! result
9921 <div id="rock">HTML rocks</div>
9922
9923 !! end
9924
9925 !! test
9926 div with illegal double attributes
9927 !! input
9928 <div id="a" id="b">HTML rocks</div>
9929 !! result
9930 <div id="b">HTML rocks</div>
9931
9932 !!end
9933
9934 # FIXME: produce empty string instead of "class" in the PHP parser, following
9935 # the HTML5 spec.
9936 !! test
9937 div with empty attribute value, space before equals
9938 !! options
9939 parsoid
9940 !! input
9941 <div class =>HTML rocks</div>
9942 !! result
9943 <div class="">HTML rocks</div>
9944
9945 !! end
9946
9947 # The PHP parser escapes the opening brace to &#123; for some reason, so
9948 # disabled this test for it.
9949 !! test
9950 div with braces in attribute value
9951 !! options
9952 parsoid
9953 !! input
9954 <div title="{}">Foo</div>
9955 !! result
9956 <div title="{}">Foo</div>
9957 !! end
9958
9959 # This it very inconsistent in the PHP parser: it returns
9960 # class="class" if there is a space between the name and the equal sign (see
9961 # 'div with empty attribute value, space before equals'), but strips the
9962 # attribute completely if the space is missing. We hope that not much content
9963 # depends on this, so are implementing the behavior below in Parsoid for
9964 # consistencies' sake. Disabled for the PHP parser.
9965 # FIXME: fix this behavior in the PHP parser?
9966 !! test
9967 div with empty attribute value, no space before equals
9968 !! options
9969 parsoid
9970 !! input
9971 <div class=>HTML rocks</div>
9972 !! result
9973 <div class="">HTML rocks</div>
9974
9975 !! end
9976
9977 !! test
9978 HTML multiple attributes correction
9979 !! input
9980 <p class="error" class="awesome">Awesome!</p>
9981 !! result
9982 <p class="awesome">Awesome!</p>
9983
9984 !!end
9985
9986 !! test
9987 Table multiple attributes correction
9988 !! input
9989 {|
9990 !+ class="error" class="awesome"| status
9991 |}
9992 !! result
9993 <table>
9994 <tr>
9995 <th class="awesome"> status
9996 </th></tr></table>
9997
9998 !!end
9999
10000 !! test
10001 DIV IN UPPERCASE
10002 !! input
10003 <DIV ID="x">HTML ROCKS</DIV>
10004 !! result
10005 <div id="x">HTML ROCKS</div>
10006
10007 !!end
10008
10009 !! test
10010 Non-ASCII pseudo-tags are rendered as text
10011 !! input
10012 <khyô>
10013 !! result
10014 <p>&lt;khyô&gt;
10015 </p>
10016 !! end
10017
10018 !! test
10019 Pseudo-tag with URL 'name' renders as url link
10020 !! input
10021 <http://example.com/>
10022 !! result
10023 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10024 </p>
10025 !! end
10026
10027 !! test
10028 text with amp in the middle of nowhere
10029 !! input
10030 Remember AT&T?
10031 !!result
10032 <p>Remember AT&amp;T?
10033 </p>
10034 !! end
10035
10036 !! test
10037 text with character entity: eacute
10038 !! input
10039 I always thought &eacute; was a cute letter.
10040 !! result
10041 <p>I always thought &#233; was a cute letter.
10042 </p>
10043 !! end
10044
10045 !! test
10046 text with entity-escaped character entity-like string: eacute
10047 !! input
10048 I always thought &amp;eacute; was a cute letter.
10049 !! result
10050 <p>I always thought &amp;eacute; was a cute letter.
10051 </p>
10052 !! end
10053
10054 !! test
10055 text with undefined character entity: xacute
10056 !! input
10057 I always thought &xacute; was a cute letter.
10058 !! result
10059 <p>I always thought &amp;xacute; was a cute letter.
10060 </p>
10061 !! end
10062
10063
10064 ###
10065 ### Nesting tests (see bug 41545, 50604, 51081)
10066 ###
10067
10068 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10069 # Note that html2wt is considerably more difficult if we use <b> in
10070 # the test case, instead of <big>
10071 !! test
10072 Ensure that HTML adoption agency algorithm is properly implemented.
10073 !! input
10074 <big>X<big>Y</big>Z</big>
10075 !! result
10076 <p><big>X<big>Y</big>Z</big>
10077 </p>
10078 !! end
10079
10080 # This was bug 41545 in the PHP parser.
10081 !! test
10082 Nesting of <kbd>
10083 !! input
10084 <kbd>X<kbd>Y</kbd>Z</kbd>
10085 !! result
10086 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10087 </p>
10088 !! end
10089
10090 # The following cases were bug 51081 in the PHP parser.
10091 # Note that there are some other nestable tags (b, i, etc) which are
10092 # not covered; see bug 51081 for discussion.
10093 !! test
10094 Nesting of <em>
10095 !! input
10096 <em>X<em>Y</em>Z</em>
10097 !! result
10098 <p><em>X<em>Y</em>Z</em>
10099 </p>
10100 !! end
10101
10102 !! test
10103 Nesting of <strong>
10104 !! input
10105 <strong>X<strong>Y</strong>Z</strong>
10106 !! result
10107 <p><strong>X<strong>Y</strong>Z</strong>
10108 </p>
10109 !! end
10110
10111 !! test
10112 Nesting of <q>
10113 !! input
10114 <q>X<q>Y</q>Z</q>
10115 !! result
10116 <p><q>X<q>Y</q>Z</q>
10117 </p>
10118 !! end
10119
10120 !! test
10121 Nesting of <ruby>
10122 !! input
10123 <ruby>X<ruby>Y</ruby>Z</ruby>
10124 !! result
10125 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10126 </p>
10127 !! end
10128
10129 !! test
10130 Nesting of <bdo>
10131 !! input
10132 <bdo>X<bdo>Y</bdo>Z</bdo>
10133 !! result
10134 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10135 </p>
10136 !! end
10137
10138
10139 ###
10140 ### Media links
10141 ###
10142
10143 !! test
10144 Media link
10145 !! input
10146 [[Media:Foobar.jpg]]
10147 !! result
10148 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10149 </p>
10150 !! end
10151
10152 !! test
10153 Media link with text
10154 !! input
10155 [[Media:Foobar.jpg|A neat file to look at]]
10156 !! result
10157 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10158 </p>
10159 !! end
10160
10161 # FIXME: this is still bad HTML tag nesting
10162 !! test
10163 Media link with nasty text
10164 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10165 !! input
10166 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10167 !! result
10168 <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>
10169
10170 !! end
10171
10172 !! test
10173 Media link to nonexistent file (bug 1702)
10174 !! input
10175 [[Media:No such.jpg]]
10176 !! result
10177 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10178 </p>
10179 !! end
10180
10181 !! test
10182 Image link to nonexistent file (bug 1850 - good)
10183 !! input
10184 [[Image:No such.jpg]]
10185 !! result
10186 <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>
10187 </p>
10188 !! end
10189
10190 !! test
10191 :Image link to nonexistent file (bug 1850 - bad)
10192 !! input
10193 [[:Image:No such.jpg]]
10194 !! result
10195 <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>
10196 </p>
10197 !! end
10198
10199
10200
10201 !! test
10202 Character reference normalization in link text (bug 1938)
10203 !! input
10204 [[Main Page|this&that]]
10205 !! result
10206 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10207 </p>
10208 !!end
10209
10210 !! article
10211 אַ
10212 !! text
10213 Test for unicode normalization
10214
10215 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10216 !! endarticle
10217
10218 !! test
10219 (bug 19451) Links should refer to the normalized form.
10220 !! input
10221 [[&#xFB2E;]]
10222 [[&#x5d0;&#x5b7;]]
10223 [[&#x5d0;ַ]]
10224 [[א&#x5b7;]]
10225 [[אַ]]
10226 !! result
10227 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10228 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10229 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10230 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10231 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10232 </p>
10233 !! end
10234
10235 !! test
10236 Empty attribute crash test (bug 2067)
10237 !! input
10238 <font color="">foo</font>
10239 !! result
10240 <p><font color="">foo</font>
10241 </p>
10242 !! end
10243
10244 !! test
10245 Empty attribute crash test single-quotes (bug 2067)
10246 !! input
10247 <font color=''>foo</font>
10248 !! result
10249 <p><font color="">foo</font>
10250 </p>
10251 !! end
10252
10253 !! test
10254 Attribute test: equals, then nothing
10255 !! input
10256 <font color=>foo</font>
10257 !! result
10258 <p><font>foo</font>
10259 </p>
10260 !! end
10261
10262 !! test
10263 Attribute test: unquoted value
10264 !! input
10265 <font color=x>foo</font>
10266 !! result
10267 <p><font color="x">foo</font>
10268 </p>
10269 !! end
10270
10271 !! test
10272 Attribute test: unquoted but illegal value (hash)
10273 !! input
10274 <font color=#x>foo</font>
10275 !! result
10276 <p><font color="#x">foo</font>
10277 </p>
10278 !! end
10279
10280 !! test
10281 Attribute test: no value
10282 !! input
10283 <font color>foo</font>
10284 !! result
10285 <p><font color="color">foo</font>
10286 </p>
10287 !! end
10288
10289 !! test
10290 Bug 2095: link with three closing brackets
10291 !! input
10292 [[Main Page]]]
10293 !! result
10294 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10295 </p>
10296 !! end
10297
10298 !! test
10299 Bug 2095: link with pipe and three closing brackets
10300 !! input
10301 [[Main Page|link]]]
10302 !! result
10303 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10304 </p>
10305 !! end
10306
10307 !! test
10308 Bug 2095: link with pipe and three closing brackets, version 2
10309 !! input
10310 [[Main Page|[http://example.com/]]]
10311 !! result
10312 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10313 </p>
10314 !! end
10315
10316
10317 ###
10318 ### Safety
10319 ###
10320
10321 !! article
10322 Template:Dangerous attribute
10323 !! text
10324 " onmouseover="alert(document.cookie)
10325 !! endarticle
10326
10327 !! article
10328 Template:Dangerous style attribute
10329 !! text
10330 border-size: expression(alert(document.cookie))
10331 !! endarticle
10332
10333 !! article
10334 Template:Div style
10335 !! text
10336 <div style="float: right; {{{1}}}">Magic div</div>
10337 !! endarticle
10338
10339 !! test
10340 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10341 !! input
10342 <div title="{{test}}"></div>
10343 !! result
10344 <div title="This is a test template"></div>
10345
10346 !! end
10347
10348 !! test
10349 Bug 2304: HTML attribute safety (dangerous template; 2309)
10350 !! input
10351 <div title="{{dangerous attribute}}"></div>
10352 !! result
10353 <div title=""></div>
10354
10355 !! end
10356
10357 !! test
10358 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10359 !! input
10360 <div style="{{dangerous style attribute}}"></div>
10361 !! result
10362 <div style="/* insecure input */"></div>
10363
10364 !! end
10365
10366 !! test
10367 Bug 2304: HTML attribute safety (safe parameter; 2309)
10368 !! input
10369 {{div style|width: 200px}}
10370 !! result
10371 <div style="float: right; width: 200px">Magic div</div>
10372
10373 !! end
10374
10375 !! test
10376 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10377 !! input
10378 {{div style|width: expression(alert(document.cookie))}}
10379 !! result
10380 <div style="/* insecure input */">Magic div</div>
10381
10382 !! end
10383
10384 !! test
10385 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10386 !! input
10387 {{div style|"><script>alert(document.cookie)</script>}}
10388 !! result
10389 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10390
10391 !! end
10392
10393 !! test
10394 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10395 !! input
10396 {{div style|" ><script>alert(document.cookie)</script>}}
10397 !! result
10398 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10399
10400 !! end
10401
10402 !! test
10403 Bug 2304: HTML attribute safety (link)
10404 !! input
10405 <div title="[[Main Page]]"></div>
10406 !! result
10407 <div title="&#91;&#91;Main Page]]"></div>
10408
10409 !! end
10410
10411 !! test
10412 Bug 2304: HTML attribute safety (italics)
10413 !! input
10414 <div title="''foobar''"></div>
10415 !! result
10416 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10417
10418 !! end
10419
10420 !! test
10421 Bug 2304: HTML attribute safety (bold)
10422 !! input
10423 <div title="'''foobar'''"></div>
10424 !! result
10425 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10426
10427 !! end
10428
10429
10430 !! test
10431 Bug 2304: HTML attribute safety (ISBN)
10432 !! input
10433 <div title="ISBN 1234567890"></div>
10434 !! result
10435 <div title="&#73;SBN 1234567890"></div>
10436
10437 !! end
10438
10439 !! test
10440 Bug 2304: HTML attribute safety (RFC)
10441 !! input
10442 <div title="RFC 1234"></div>
10443 !! result
10444 <div title="&#82;FC 1234"></div>
10445
10446 !! end
10447
10448 !! test
10449 Bug 2304: HTML attribute safety (PMID)
10450 !! input
10451 <div title="PMID 1234567890"></div>
10452 !! result
10453 <div title="&#80;MID 1234567890"></div>
10454
10455 !! end
10456
10457 !! test
10458 Bug 2304: HTML attribute safety (web link)
10459 !! input
10460 <div title="http://example.com/"></div>
10461 !! result
10462 <div title="http&#58;//example.com/"></div>
10463
10464 !! end
10465
10466 !! test
10467 Bug 2304: HTML attribute safety (named web link)
10468 !! input
10469 <div title="[http://example.com/ link]"></div>
10470 !! result
10471 <div title="&#91;http&#58;//example.com/ link]"></div>
10472
10473 !! end
10474
10475 !! test
10476 Bug 3244: HTML attribute safety (extension; safe)
10477 !! input
10478 <div style="<nowiki>background:blue</nowiki>"></div>
10479 !! result
10480 <div style="background:blue"></div>
10481
10482 !! end
10483
10484 !! test
10485 Bug 3244: HTML attribute safety (extension; unsafe)
10486 !! input
10487 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10488 !! result
10489 <div style="/* insecure input */"></div>
10490
10491 !! end
10492
10493 # More MSIE fun discovered by Tom Gilder
10494
10495 !! test
10496 MSIE CSS safety test: spurious slash
10497 !! input
10498 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10499 !! result
10500 <div style="/* insecure input */">evil</div>
10501
10502 !! end
10503
10504 !! test
10505 MSIE CSS safety test: hex code
10506 !! input
10507 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10508 !! result
10509 <div style="/* insecure input */">evil</div>
10510
10511 !! end
10512
10513 !! test
10514 MSIE CSS safety test: comment in url
10515 !! input
10516 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10517 !! result
10518 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10519
10520 !! end
10521
10522 !! test
10523 MSIE CSS safety test: comment in expression
10524 !! input
10525 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10526 !! result
10527 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10528
10529 !! end
10530
10531
10532 !! test
10533 Table attribute legitimate extension
10534 !! input
10535 {|
10536 !+ style="<nowiki>color:blue</nowiki>"| status
10537 |}
10538 !! result
10539 <table>
10540 <tr>
10541 <th style="color:blue"> status
10542 </th></tr></table>
10543
10544 !!end
10545
10546 !! test
10547 Table attribute safety
10548 !! input
10549 {|
10550 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10551 |}
10552 !! result
10553 <table>
10554 <tr>
10555 <th style="/* insecure input */"> status
10556 </th></tr></table>
10557
10558 !! end
10559
10560 !! test
10561 CSS line continuation 1
10562 !! input
10563 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10564 !! result
10565 <div style="/* insecure input */"></div>
10566
10567 !! end
10568
10569 !! test
10570 CSS line continuation 2
10571 !! input
10572 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10573 !! result
10574 <div style="/* insecure input */"></div>
10575
10576 !! end
10577
10578 !! article
10579 Template:Identity
10580 !! text
10581 {{{1}}}
10582 !! endarticle
10583
10584 !! test
10585 Expansion of multi-line templates in attribute values (bug 6255)
10586 !! input
10587 <div style="background: {{identity|#00FF00}}">-</div>
10588 !! result
10589 <div style="background: #00FF00">-</div>
10590
10591 !! end
10592
10593
10594 !! test
10595 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10596 !! input
10597 <div style="background:
10598 #00FF00">-</div>
10599 !! result
10600 <div style="background: #00FF00">-</div>
10601
10602 !! end
10603
10604 !! test
10605 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10606 !! input
10607 <div style="background: &#10;#00FF00">-</div>
10608 !! result
10609 <div style="background: &#10;#00FF00">-</div>
10610
10611 !! end
10612
10613 ###
10614 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10615 ###
10616 !! test
10617 Parser hook: empty input
10618 !! input
10619 <tag></tag>
10620 !! result
10621 <pre>
10622 ''
10623 array (
10624 )
10625 </pre>
10626
10627 !! end
10628
10629 !! test
10630 Parser hook: empty input using terminated empty elements
10631 !! input
10632 <tag/>
10633 !! result
10634 <pre>
10635 NULL
10636 array (
10637 )
10638 </pre>
10639
10640 !! end
10641
10642 !! test
10643 Parser hook: empty input using terminated empty elements (space before)
10644 !! input
10645 <tag />
10646 !! result
10647 <pre>
10648 NULL
10649 array (
10650 )
10651 </pre>
10652
10653 !! end
10654
10655 !! test
10656 Parser hook: basic input
10657 !! input
10658 <tag>input</tag>
10659 !! result
10660 <pre>
10661 'input'
10662 array (
10663 )
10664 </pre>
10665
10666 !! end
10667
10668
10669 !! test
10670 Parser hook: case insensitive
10671 !! input
10672 <TAG>input</TAG>
10673 !! result
10674 <pre>
10675 'input'
10676 array (
10677 )
10678 </pre>
10679
10680 !! end
10681
10682
10683 !! test
10684 Parser hook: case insensitive, redux
10685 !! input
10686 <TaG>input</TAg>
10687 !! result
10688 <pre>
10689 'input'
10690 array (
10691 )
10692 </pre>
10693
10694 !! end
10695
10696 !! test
10697 Parser hook: nested tags
10698 !! options
10699 noxml
10700 !! input
10701 <tag><tag></tag></tag>
10702 !! result
10703 <pre>
10704 '<tag>'
10705 array (
10706 )
10707 </pre>&lt;/tag&gt;
10708
10709 !! end
10710
10711 !! test
10712 Parser hook: basic arguments
10713 !! input
10714 <tag width=200 height = "100" depth = '50' square></tag>
10715 !! result
10716 <pre>
10717 ''
10718 array (
10719 'width' => '200',
10720 'height' => '100',
10721 'depth' => '50',
10722 'square' => 'square',
10723 )
10724 </pre>
10725
10726 !! end
10727
10728 !! test
10729 Parser hook: argument containing a forward slash (bug 5344)
10730 !! input
10731 <tag filename='/tmp/bla'></tag>
10732 !! result
10733 <pre>
10734 ''
10735 array (
10736 'filename' => '/tmp/bla',
10737 )
10738 </pre>
10739
10740 !! end
10741
10742 !! test
10743 Parser hook: empty input using terminated empty elements (bug 2374)
10744 !! input
10745 <tag foo=bar/>text
10746 !! result
10747 <pre>
10748 NULL
10749 array (
10750 'foo' => 'bar',
10751 )
10752 </pre>text
10753
10754 !! end
10755
10756 # </tag> should be output literally since there is no matching tag that begins it
10757 !! test
10758 Parser hook: basic arguments using terminated empty elements (bug 2374)
10759 !! input
10760 <tag width=200 height = "100" depth = '50' square/>
10761 other stuff
10762 </tag>
10763 !! result
10764 <pre>
10765 NULL
10766 array (
10767 'width' => '200',
10768 'height' => '100',
10769 'depth' => '50',
10770 'square' => 'square',
10771 )
10772 </pre>
10773 <p>other stuff
10774 &lt;/tag&gt;
10775 </p>
10776 !! end
10777
10778 ###
10779 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
10780 ###
10781
10782 !! test
10783 Parser hook: static parser hook not inside a comment
10784 !! input
10785 <statictag>hello, world</statictag>
10786 <statictag action=flush/>
10787 !! result
10788 <p>hello, world
10789 </p>
10790 !! end
10791
10792
10793 !! test
10794 Parser hook: static parser hook inside a comment
10795 !! input
10796 <!-- <statictag>hello, world</statictag> -->
10797 <statictag action=flush/>
10798 !! result
10799 <p><br />
10800 </p>
10801 !! end
10802
10803 # Nested template calls; this case was broken by Parser.php rev 1.506,
10804 # since reverted.
10805
10806 !! article
10807 Template:One-parameter
10808 !! text
10809 (My parameter is: {{{1}}})
10810 !! endarticle
10811
10812 !! article
10813 Template:Map-one-parameter
10814 !! text
10815 {{{{{1}}}|{{{2}}}}}
10816 !! endarticle
10817
10818 !! test
10819 Nested template calls
10820 !! input
10821 {{Map-one-parameter|One-parameter|param}}
10822 !! result
10823 <p>(My parameter is: param)
10824 </p>
10825 !! end
10826
10827
10828 ###
10829 ### Sanitizer
10830 ###
10831 !! test
10832 Sanitizer: Closing of open tags
10833 !! input
10834 <s></s><table></table>
10835 !! result
10836 <s></s><table></table>
10837
10838 !! end
10839
10840 !! test
10841 Sanitizer: Closing of open but not closed tags
10842 !! input
10843 <s>foo
10844 !! result
10845 <p><s>foo</s>
10846 </p>
10847 !! end
10848
10849 !! test
10850 Sanitizer: Closing of closed but not open tags
10851 !! input
10852 </s>
10853 !! result
10854 <p>&lt;/s&gt;
10855 </p>
10856 !! end
10857
10858 !! test
10859 Sanitizer: Closing of closed but not open table tags
10860 !! input
10861 Table not started</td></tr></table>
10862 !! result
10863 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10864 </p>
10865 !! end
10866
10867 !! test
10868 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10869 !! input
10870 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10871 !! result
10872 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10873 </p>
10874 !! end
10875
10876 !! test
10877 Sanitizer: Validating the contents of the id attribute (bug 4515)
10878 !! options
10879 disabled
10880 !! input
10881 <br id=9 />
10882 !! result
10883 Something, but definitely not <br id="9" />...
10884 !! end
10885
10886 !! test
10887 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10888 !! options
10889 disabled
10890 !! input
10891 <br id="foo" /><br id="foo" />
10892 !! result
10893 Something need to be done. foo-2 ?
10894 !! end
10895
10896 !! test
10897 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10898 !! input
10899 <div itemscope>
10900 <meta itemprop="hello" content="world">
10901 <meta http-equiv="refresh" content="5">
10902 <meta itemprop="hello" http-equiv="refresh" content="5">
10903 <link itemprop="hello" href="{{SERVER}}">
10904 <link rel="stylesheet" href="{{SERVER}}">
10905 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10906 </div>
10907 !! result
10908 <div itemscope="itemscope">
10909 <p> <meta itemprop="hello" content="world" />
10910 &lt;meta http-equiv="refresh" content="5"&gt;
10911 <meta itemprop="hello" content="5" />
10912 </p>
10913 <link itemprop="hello" href="http&#58;//example.org" />
10914 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10915 <link itemprop="hello" href="http&#58;//example.org" />
10916 </div>
10917
10918 !! end
10919
10920 !! test
10921 Language converter: output gets cut off unexpectedly (bug 5757)
10922 !! options
10923 language=zh
10924 !! input
10925 this bit is safe: }-
10926
10927 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10928
10929 then we get cut off here: }-
10930
10931 all additional text is vanished
10932 !! result
10933 <p>this bit is safe: }-
10934 </p><p>but if we add a conversion instance: xxx
10935 </p><p>then we get cut off here: }-
10936 </p><p>all additional text is vanished
10937 </p>
10938 !! end
10939
10940 !! test
10941 Self closed html pairs (bug 5487)
10942 !! options
10943 !! input
10944 <center><font id="bug" />Centered text</center>
10945 <div><font id="bug2" />In div text</div>
10946 !! result
10947 <center>&lt;font id="bug" /&gt;Centered text</center>
10948 <div>&lt;font id="bug2" /&gt;In div text</div>
10949
10950 !! end
10951
10952 #
10953 #
10954 #
10955
10956 !! test
10957 Punctuation: nbsp before exclamation
10958 !! input
10959 C'est grave !
10960 !! result
10961 <p>C'est grave&#160;!
10962 </p>
10963 !! end
10964
10965 !! test
10966 Punctuation: CSS !important (bug 11874)
10967 !! input
10968 <div style="width:50% !important">important</div>
10969 !! result
10970 <div style="width:50% !important">important</div>
10971
10972 !!end
10973
10974 !! test
10975 Punctuation: CSS ! important (bug 11874; with space after)
10976 !! input
10977 <div style="width:50% ! important">important</div>
10978 !! result
10979 <div style="width:50% ! important">important</div>
10980
10981 !!end
10982
10983
10984 !! test
10985 HTML bullet list, closed tags (bug 5497)
10986 !! input
10987 <ul>
10988 <li>One</li>
10989 <li>Two</li>
10990 </ul>
10991 !! result
10992 <ul>
10993 <li>One</li>
10994 <li>Two</li>
10995 </ul>
10996
10997 !! end
10998
10999 !! test
11000 HTML bullet list, unclosed tags (bug 5497)
11001 !! options
11002 disabled
11003 !! input
11004 <ul>
11005 <li>One
11006 <li>Two
11007 </ul>
11008 !! result
11009 <ul>
11010 <li>One
11011 </li><li>Two
11012 </li></ul>
11013
11014 !! end
11015
11016 !! test
11017 HTML ordered list, closed tags (bug 5497)
11018 !! input
11019 <ol>
11020 <li>One</li>
11021 <li>Two</li>
11022 </ol>
11023 !! result
11024 <ol>
11025 <li>One</li>
11026 <li>Two</li>
11027 </ol>
11028
11029 !! end
11030
11031 !! test
11032 HTML ordered list, unclosed tags (bug 5497)
11033 !! options
11034 disabled
11035 !! input
11036 <ol>
11037 <li>One
11038 <li>Two
11039 </ol>
11040 !! result
11041 <ol>
11042 <li>One
11043 </li><li>Two
11044 </li></ol>
11045
11046 !! end
11047
11048 !! test
11049 HTML nested bullet list, closed tags (bug 5497)
11050 !! input
11051 <ul>
11052 <li>One</li>
11053 <li>Two:
11054 <ul>
11055 <li>Sub-one</li>
11056 <li>Sub-two</li>
11057 </ul>
11058 </li>
11059 </ul>
11060 !! result
11061 <ul>
11062 <li>One</li>
11063 <li>Two:
11064 <ul>
11065 <li>Sub-one</li>
11066 <li>Sub-two</li>
11067 </ul>
11068 </li>
11069 </ul>
11070
11071 !! end
11072
11073 !! test
11074 HTML nested bullet list, open tags (bug 5497)
11075 !! options
11076 disabled
11077 !! input
11078 <ul>
11079 <li>One
11080 <li>Two:
11081 <ul>
11082 <li>Sub-one
11083 <li>Sub-two
11084 </ul>
11085 </ul>
11086 !! result
11087 <ul>
11088 <li>One
11089 </li><li>Two:
11090 <ul>
11091 <li>Sub-one
11092 </li><li>Sub-two
11093 </li></ul>
11094 </li></ul>
11095
11096 !! end
11097
11098 !! test
11099 HTML nested ordered list, closed tags (bug 5497)
11100 !! input
11101 <ol>
11102 <li>One</li>
11103 <li>Two:
11104 <ol>
11105 <li>Sub-one</li>
11106 <li>Sub-two</li>
11107 </ol>
11108 </li>
11109 </ol>
11110 !! result
11111 <ol>
11112 <li>One</li>
11113 <li>Two:
11114 <ol>
11115 <li>Sub-one</li>
11116 <li>Sub-two</li>
11117 </ol>
11118 </li>
11119 </ol>
11120
11121 !! end
11122
11123 !! test
11124 HTML nested ordered list, open tags (bug 5497)
11125 !! options
11126 disabled
11127 !! input
11128 <ol>
11129 <li>One
11130 <li>Two:
11131 <ol>
11132 <li>Sub-one
11133 <li>Sub-two
11134 </ol>
11135 </ol>
11136 !! result
11137 <ol>
11138 <li>One
11139 </li><li>Two:
11140 <ol>
11141 <li>Sub-one
11142 </li><li>Sub-two
11143 </li></ol>
11144 </li></ol>
11145
11146 !! end
11147
11148 !! test
11149 HTML ordered list item with parameters oddity
11150 !! input
11151 <ol><li id="fragment">One</li></ol>
11152 !! result
11153 <ol><li id="fragment">One</li></ol>
11154
11155 !! end
11156
11157 !!test
11158 bug 5918: autonumbering
11159 !! input
11160 [http://first/] [http://second] [ftp://ftp]
11161
11162 ftp://inlineftp
11163
11164 [mailto:enclosed@mail.tld With target]
11165
11166 [mailto:enclosed@mail.tld]
11167
11168 mailto:inline@mail.tld
11169 !! result
11170 <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>
11171 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11172 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11173 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11174 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11175 </p>
11176 !! end
11177
11178
11179 #
11180 # Security and HTML correctness
11181 # From Nick Jenkins' fuzz testing
11182 #
11183
11184 !! test
11185 Fuzz testing: Parser13
11186 !! input
11187 {|
11188 | http://a|
11189 !! result
11190 <table>
11191 <tr>
11192 <td>
11193 </td>
11194 </tr>
11195 </table>
11196
11197 !! end
11198
11199 !! test
11200 Fuzz testing: Parser14
11201 !! input
11202 == onmouseover= ==
11203 http://__TOC__
11204 !! result
11205 <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>
11206 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11207 <ul>
11208 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11209 </ul>
11210 </div>
11211
11212 !! end
11213
11214 !! test
11215 Fuzz testing: Parser14-table
11216 !! input
11217 ==a==
11218 {| STYLE=__TOC__
11219 !! result
11220 <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>
11221 <table style="&#95;_TOC&#95;_">
11222 <tr><td></td></tr>
11223 </table>
11224
11225 !! end
11226
11227 # Known to produce bogus xml (extra </td>)
11228 !! test
11229 Fuzz testing: Parser16
11230 !! options
11231 noxml
11232 !! input
11233 {|
11234 !https://||||||
11235 !! result
11236 <table>
11237 <tr>
11238 <th>https://</th>
11239 <th></th>
11240 <th></th>
11241 <th>
11242 </td>
11243 </tr>
11244 </table>
11245
11246 !! end
11247
11248 !! test
11249 Fuzz testing: Parser21
11250 !! input
11251 {|
11252 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11253 |
11254 !! result
11255 <table>
11256 <tr>
11257 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11258 </th>
11259 <td>
11260 </td>
11261 </tr>
11262 </table>
11263
11264 !! end
11265
11266 !! test
11267 Fuzz testing: Parser22
11268 !! input
11269 http://===r:::https://b
11270
11271 {|
11272 !!result
11273 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11274 </p>
11275 <table>
11276 <tr><td></td></tr>
11277 </table>
11278
11279 !! end
11280
11281 # Known to produce bad XML for now
11282 !! test
11283 Fuzz testing: Parser24
11284 !! options
11285 noxml
11286 !! input
11287 {|
11288 {{{|
11289 <u CLASS=
11290 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11291 <br style="onmouseover='alert(document.cookie);' " />
11292
11293 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11294 |
11295 !! result
11296 <table>
11297 {{{|
11298 <u class="&#124;">}}}} &gt;
11299 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11300
11301 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11302 <tr>
11303 <td></u>
11304 </td>
11305 </tr>
11306 </table>
11307
11308 !! end
11309
11310 # Note: the current result listed for this is not what the original one was,
11311 # but the original bug was JavaScript injection, which is fixed in any case.
11312 # It's not clear that the original result listed was any more correct than the
11313 # current one. Original result:
11314 # <p>{{{|
11315 # </p>
11316 # <li class="&#124;&#124;">
11317 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11318 !!test
11319 Fuzz testing: Parser25 (bug 6055)
11320 !! input
11321 {{{
11322 |
11323 <LI CLASS=||
11324 >
11325 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11326 !! result
11327 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11328 </p>
11329 !! end
11330
11331 !!test
11332 Fuzz testing: URL adjacent extension (with space, clean)
11333 !! options
11334 !! input
11335 http://example.com <nowiki>junk</nowiki>
11336 !! result
11337 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11338 </p>
11339 !!end
11340
11341 !!test
11342 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11343 !! options
11344 !! input
11345 http://example.com<nowiki>junk</nowiki>
11346 !! result
11347 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11348 </p>
11349 !!end
11350
11351 !!test
11352 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11353 !! options
11354 !! input
11355 http://example.com<pre>junk</pre>
11356 !! result
11357 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11358
11359 !!end
11360
11361 !!test
11362 Fuzz testing: image with bogus manual thumbnail
11363 !!input
11364 [[Image:foobar.jpg|thumbnail= ]]
11365 !!result
11366 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11367
11368 !!end
11369
11370 !! test
11371 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11372 !! input
11373 <pre dir="&#10;"></pre>
11374 !! result
11375 <pre dir="&#10;"></pre>
11376
11377 !! end
11378
11379 !! test
11380 Parsing optional HTML elements (Bug 6171)
11381 !! options
11382 !! input
11383 <table>
11384 <tr>
11385 <td> Some tabular data</td>
11386 <td> More tabular data ...
11387 <td> And yet som tabular data</td>
11388 </tr>
11389 </table>
11390 !! result
11391 <table>
11392 <tr>
11393 <td> Some tabular data</td>
11394 <td> More tabular data ...
11395 </td><td> And yet som tabular data</td>
11396 </tr>
11397 </table>
11398
11399 !! end
11400
11401 !! test
11402 Correct handling of <td>, <tr> (Bug 6171)
11403 !! options
11404 !! input
11405 <table>
11406 <tr>
11407 <td> Some tabular data</td>
11408 <td> More tabular data ...</td>
11409 <td> And yet som tabular data</td>
11410 </tr>
11411 </table>
11412 !! result
11413 <table>
11414 <tr>
11415 <td> Some tabular data</td>
11416 <td> More tabular data ...</td>
11417 <td> And yet som tabular data</td>
11418 </tr>
11419 </table>
11420
11421 !! end
11422
11423
11424 !! test
11425 Parsing crashing regression (fr:JavaScript)
11426 !! input
11427 </body></x>
11428 !! result
11429 <p>&lt;/body&gt;&lt;/x&gt;
11430 </p>
11431 !! end
11432
11433 !! test
11434 Inline wiki vs wiki block nesting
11435 !! input
11436 '''Bold paragraph
11437
11438 New wiki paragraph
11439 !! result
11440 <p><b>Bold paragraph</b>
11441 </p><p>New wiki paragraph
11442 </p>
11443 !! end
11444
11445 !! test
11446 Inline HTML vs wiki block nesting
11447 !! options
11448 disabled
11449 !! input
11450 <b>Bold paragraph
11451
11452 New wiki paragraph
11453 !! result
11454 <p><b>Bold paragraph</b>
11455 </p><p>New wiki paragraph
11456 </p>
11457 !! end
11458
11459 # Original result was this:
11460 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11461 # </p>
11462 # While that might be marginally more intuitive, maybe, the six-apostrophe
11463 # construct is clearly pathological and the result stated here (which is what
11464 # the parser actually does) is about as reasonable as anything.
11465 !!test
11466 Mixing markup for italics and bold
11467 !! options
11468 !! input
11469 '''bold''''''bold''bolditalics'''''
11470 !! result
11471 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11472 </p>
11473 !! end
11474
11475
11476 !! article
11477 Xyzzyx
11478 !! text
11479 Article for special page transclusion test
11480 !! endarticle
11481
11482 !! test
11483 Special page transclusion
11484 !! options
11485 !! input
11486 {{Special:Prefixindex/Xyzzyx}}
11487 !! result
11488 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11489
11490 !! end
11491
11492 !! test
11493 Special page transclusion twice (bug 5021)
11494 !! options
11495 !! input
11496 {{Special:Prefixindex/Xyzzyx}}
11497 {{Special:Prefixindex/Xyzzyx}}
11498 !! result
11499 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11500 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11501
11502 !! end
11503
11504 !! test
11505 Transclusion of default MediaWiki message
11506 !! input
11507 {{MediaWiki:Mainpage}}
11508 !!result
11509 <p>Main Page
11510 </p>
11511 !! end
11512
11513 !! test
11514 Transclusion of nonexistent MediaWiki message
11515 !! input
11516 {{MediaWiki:Mainpagexxx}}
11517 !!result
11518 <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>
11519 </p>
11520 !! end
11521
11522 !! test
11523 Transclusion of MediaWiki message with underscore
11524 !! input
11525 {{MediaWiki:history_short}}
11526 !! result
11527 <p>History
11528 </p>
11529 !! end
11530
11531 !! test
11532 Transclusion of MediaWiki message with space
11533 !! input
11534 {{MediaWiki:history short}}
11535 !! result
11536 <p>History
11537 </p>
11538 !! end
11539
11540 !! test
11541 Invalid header with following text
11542 !! input
11543 = x = y
11544 !! result
11545 <p>= x = y
11546 </p>
11547 !! end
11548
11549
11550 !! test
11551 Section extraction test (section 0)
11552 !! options
11553 section=0
11554 !! input
11555 start
11556 ==a==
11557 ===aa===
11558 ====aaa====
11559 ==b==
11560 ===ba===
11561 ===bb===
11562 ====bba====
11563 ===bc===
11564 ==c==
11565 ===ca===
11566 !! result
11567 start
11568 !! end
11569
11570 !! test
11571 Section extraction test (section 1)
11572 !! options
11573 section=1
11574 !! input
11575 start
11576 ==a==
11577 ===aa===
11578 ====aaa====
11579 ==b==
11580 ===ba===
11581 ===bb===
11582 ====bba====
11583 ===bc===
11584 ==c==
11585 ===ca===
11586 !! result
11587 ==a==
11588 ===aa===
11589 ====aaa====
11590 !! end
11591
11592 !! test
11593 Section extraction test (section 2)
11594 !! options
11595 section=2
11596 !! input
11597 start
11598 ==a==
11599 ===aa===
11600 ====aaa====
11601 ==b==
11602 ===ba===
11603 ===bb===
11604 ====bba====
11605 ===bc===
11606 ==c==
11607 ===ca===
11608 !! result
11609 ===aa===
11610 ====aaa====
11611 !! end
11612
11613 !! test
11614 Section extraction test (section 3)
11615 !! options
11616 section=3
11617 !! input
11618 start
11619 ==a==
11620 ===aa===
11621 ====aaa====
11622 ==b==
11623 ===ba===
11624 ===bb===
11625 ====bba====
11626 ===bc===
11627 ==c==
11628 ===ca===
11629 !! result
11630 ====aaa====
11631 !! end
11632
11633 !! test
11634 Section extraction test (section 4)
11635 !! options
11636 section=4
11637 !! input
11638 start
11639 ==a==
11640 ===aa===
11641 ====aaa====
11642 ==b==
11643 ===ba===
11644 ===bb===
11645 ====bba====
11646 ===bc===
11647 ==c==
11648 ===ca===
11649 !! result
11650 ==b==
11651 ===ba===
11652 ===bb===
11653 ====bba====
11654 ===bc===
11655 !! end
11656
11657 !! test
11658 Section extraction test (section 5)
11659 !! options
11660 section=5
11661 !! input
11662 start
11663 ==a==
11664 ===aa===
11665 ====aaa====
11666 ==b==
11667 ===ba===
11668 ===bb===
11669 ====bba====
11670 ===bc===
11671 ==c==
11672 ===ca===
11673 !! result
11674 ===ba===
11675 !! end
11676
11677 !! test
11678 Section extraction test (section 6)
11679 !! options
11680 section=6
11681 !! input
11682 start
11683 ==a==
11684 ===aa===
11685 ====aaa====
11686 ==b==
11687 ===ba===
11688 ===bb===
11689 ====bba====
11690 ===bc===
11691 ==c==
11692 ===ca===
11693 !! result
11694 ===bb===
11695 ====bba====
11696 !! end
11697
11698 !! test
11699 Section extraction test (section 7)
11700 !! options
11701 section=7
11702 !! input
11703 start
11704 ==a==
11705 ===aa===
11706 ====aaa====
11707 ==b==
11708 ===ba===
11709 ===bb===
11710 ====bba====
11711 ===bc===
11712 ==c==
11713 ===ca===
11714 !! result
11715 ====bba====
11716 !! end
11717
11718 !! test
11719 Section extraction test (section 8)
11720 !! options
11721 section=8
11722 !! input
11723 start
11724 ==a==
11725 ===aa===
11726 ====aaa====
11727 ==b==
11728 ===ba===
11729 ===bb===
11730 ====bba====
11731 ===bc===
11732 ==c==
11733 ===ca===
11734 !! result
11735 ===bc===
11736 !! end
11737
11738 !! test
11739 Section extraction test (section 9)
11740 !! options
11741 section=9
11742 !! input
11743 start
11744 ==a==
11745 ===aa===
11746 ====aaa====
11747 ==b==
11748 ===ba===
11749 ===bb===
11750 ====bba====
11751 ===bc===
11752 ==c==
11753 ===ca===
11754 !! result
11755 ==c==
11756 ===ca===
11757 !! end
11758
11759 !! test
11760 Section extraction test (section 10)
11761 !! options
11762 section=10
11763 !! input
11764 start
11765 ==a==
11766 ===aa===
11767 ====aaa====
11768 ==b==
11769 ===ba===
11770 ===bb===
11771 ====bba====
11772 ===bc===
11773 ==c==
11774 ===ca===
11775 !! result
11776 ===ca===
11777 !! end
11778
11779 !! test
11780 Section extraction test (nonexistent section 11)
11781 !! options
11782 section=11
11783 !! input
11784 start
11785 ==a==
11786 ===aa===
11787 ====aaa====
11788 ==b==
11789 ===ba===
11790 ===bb===
11791 ====bba====
11792 ===bc===
11793 ==c==
11794 ===ca===
11795 !! result
11796 !! end
11797
11798 !! test
11799 Section extraction test with bogus heading (section 1)
11800 !! options
11801 section=1
11802 !! input
11803 ==a==
11804 ==bogus== not a legal section
11805 ==b==
11806 !! result
11807 ==a==
11808 ==bogus== not a legal section
11809 !! end
11810
11811 !! test
11812 Section extraction test with bogus heading (section 2)
11813 !! options
11814 section=2
11815 !! input
11816 ==a==
11817 ==bogus== not a legal section
11818 ==b==
11819 !! result
11820 ==b==
11821 !! end
11822
11823 !! test
11824 Section extraction test with comment after heading (section 1)
11825 !! options
11826 section=1
11827 !! input
11828 ==a==
11829 ==b== <!-- -->
11830 ==c==
11831 !! result
11832 ==a==
11833 !! end
11834
11835 !! test
11836 Section extraction test with comment after heading (section 2)
11837 !! options
11838 section=2
11839 !! input
11840 ==a==
11841 ==b== <!-- -->
11842 ==c==
11843 !! result
11844 ==b== <!-- -->
11845 !! end
11846
11847 !! test
11848 Section extraction test with bogus <nowiki> heading (section 1)
11849 !! options
11850 section=1
11851 !! input
11852 ==a==
11853 ==bogus== <nowiki>not a legal section</nowiki>
11854 ==b==
11855 !! result
11856 ==a==
11857 ==bogus== <nowiki>not a legal section</nowiki>
11858 !! end
11859
11860 !! test
11861 Section extraction test with bogus <nowiki> heading (section 2)
11862 !! options
11863 section=2
11864 !! input
11865 ==a==
11866 ==bogus== <nowiki>not a legal section</nowiki>
11867 ==b==
11868 !! result
11869 ==b==
11870 !! end
11871
11872
11873 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11874 # instead of respecting commented sections
11875 !! test
11876 Section extraction prefixed by comment (section 1)
11877 !! options
11878 section=1
11879 !! input
11880 <!-- -->==sec1==
11881 ==sec2==
11882 !!result
11883 ==sec2==
11884 !!end
11885
11886 !! test
11887 Section extraction prefixed by comment (section 2)
11888 !! options
11889 section=2
11890 !! input
11891 <!-- -->==sec1==
11892 ==sec2==
11893 !!result
11894
11895 !!end
11896
11897
11898 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11899 # instead of respecting HTML-style headings
11900 !! test
11901 Section extraction, mixed wiki and html (section 1)
11902 !! options
11903 section=1
11904 !! input
11905 <h2>unmarked</h2>
11906 unmarked
11907 ==1==
11908 one
11909 ==2==
11910 two
11911 !! result
11912 ==1==
11913 one
11914 !! end
11915
11916 !! test
11917 Section extraction, mixed wiki and html (section 2)
11918 !! options
11919 section=2
11920 !! input
11921 <h2>unmarked</h2>
11922 unmarked
11923 ==1==
11924 one
11925 ==2==
11926 two
11927 !! result
11928 ==2==
11929 two
11930 !! end
11931
11932
11933 # Formerly testing for bug 3342
11934 !! test
11935 Section extraction, heading surrounded by <noinclude>
11936 !! options
11937 section=1
11938 !! input
11939 <noinclude>==unmarked==</noinclude>
11940 ==marked==
11941 !! result
11942 ==marked==
11943 !!end
11944
11945 # Test behavior of bug 19910
11946 !! test
11947 Sectiion with all-equals
11948 !! options
11949 section=2
11950 !! input
11951 ===
11952 The line above must have a trailing space
11953 === <!--
11954 --> <!-- -->
11955 But just in case it doesn't...
11956 !! result
11957 === <!--
11958 --> <!-- -->
11959 But just in case it doesn't...
11960 !! end
11961
11962 !! test
11963 Section replacement test (section 0)
11964 !! options
11965 replace=0,"xxx"
11966 !! input
11967 start
11968 ==a==
11969 ===aa===
11970 ====aaa====
11971 ==b==
11972 ===ba===
11973 ===bb===
11974 ====bba====
11975 ===bc===
11976 ==c==
11977 ===ca===
11978 !! result
11979 xxx
11980
11981 ==a==
11982 ===aa===
11983 ====aaa====
11984 ==b==
11985 ===ba===
11986 ===bb===
11987 ====bba====
11988 ===bc===
11989 ==c==
11990 ===ca===
11991 !! end
11992
11993 !! test
11994 Section replacement test (section 1)
11995 !! options
11996 replace=1,"xxx"
11997 !! input
11998 start
11999 ==a==
12000 ===aa===
12001 ====aaa====
12002 ==b==
12003 ===ba===
12004 ===bb===
12005 ====bba====
12006 ===bc===
12007 ==c==
12008 ===ca===
12009 !! result
12010 start
12011 xxx
12012
12013 ==b==
12014 ===ba===
12015 ===bb===
12016 ====bba====
12017 ===bc===
12018 ==c==
12019 ===ca===
12020 !! end
12021
12022 !! test
12023 Section replacement test (section 2)
12024 !! options
12025 replace=2,"xxx"
12026 !! input
12027 start
12028 ==a==
12029 ===aa===
12030 ====aaa====
12031 ==b==
12032 ===ba===
12033 ===bb===
12034 ====bba====
12035 ===bc===
12036 ==c==
12037 ===ca===
12038 !! result
12039 start
12040 ==a==
12041 xxx
12042
12043 ==b==
12044 ===ba===
12045 ===bb===
12046 ====bba====
12047 ===bc===
12048 ==c==
12049 ===ca===
12050 !! end
12051
12052 !! test
12053 Section replacement test (section 3)
12054 !! options
12055 replace=3,"xxx"
12056 !! input
12057 start
12058 ==a==
12059 ===aa===
12060 ====aaa====
12061 ==b==
12062 ===ba===
12063 ===bb===
12064 ====bba====
12065 ===bc===
12066 ==c==
12067 ===ca===
12068 !! result
12069 start
12070 ==a==
12071 ===aa===
12072 xxx
12073
12074 ==b==
12075 ===ba===
12076 ===bb===
12077 ====bba====
12078 ===bc===
12079 ==c==
12080 ===ca===
12081 !! end
12082
12083 !! test
12084 Section replacement test (section 4)
12085 !! options
12086 replace=4,"xxx"
12087 !! input
12088 start
12089 ==a==
12090 ===aa===
12091 ====aaa====
12092 ==b==
12093 ===ba===
12094 ===bb===
12095 ====bba====
12096 ===bc===
12097 ==c==
12098 ===ca===
12099 !! result
12100 start
12101 ==a==
12102 ===aa===
12103 ====aaa====
12104 xxx
12105
12106 ==c==
12107 ===ca===
12108 !! end
12109
12110 !! test
12111 Section replacement test (section 5)
12112 !! options
12113 replace=5,"xxx"
12114 !! input
12115 start
12116 ==a==
12117 ===aa===
12118 ====aaa====
12119 ==b==
12120 ===ba===
12121 ===bb===
12122 ====bba====
12123 ===bc===
12124 ==c==
12125 ===ca===
12126 !! result
12127 start
12128 ==a==
12129 ===aa===
12130 ====aaa====
12131 ==b==
12132 xxx
12133
12134 ===bb===
12135 ====bba====
12136 ===bc===
12137 ==c==
12138 ===ca===
12139 !! end
12140
12141 !! test
12142 Section replacement test (section 6)
12143 !! options
12144 replace=6,"xxx"
12145 !! input
12146 start
12147 ==a==
12148 ===aa===
12149 ====aaa====
12150 ==b==
12151 ===ba===
12152 ===bb===
12153 ====bba====
12154 ===bc===
12155 ==c==
12156 ===ca===
12157 !! result
12158 start
12159 ==a==
12160 ===aa===
12161 ====aaa====
12162 ==b==
12163 ===ba===
12164 xxx
12165
12166 ===bc===
12167 ==c==
12168 ===ca===
12169 !! end
12170
12171 !! test
12172 Section replacement test (section 7)
12173 !! options
12174 replace=7,"xxx"
12175 !! input
12176 start
12177 ==a==
12178 ===aa===
12179 ====aaa====
12180 ==b==
12181 ===ba===
12182 ===bb===
12183 ====bba====
12184 ===bc===
12185 ==c==
12186 ===ca===
12187 !! result
12188 start
12189 ==a==
12190 ===aa===
12191 ====aaa====
12192 ==b==
12193 ===ba===
12194 ===bb===
12195 xxx
12196
12197 ===bc===
12198 ==c==
12199 ===ca===
12200 !! end
12201
12202 !! test
12203 Section replacement test (section 8)
12204 !! options
12205 replace=8,"xxx"
12206 !! input
12207 start
12208 ==a==
12209 ===aa===
12210 ====aaa====
12211 ==b==
12212 ===ba===
12213 ===bb===
12214 ====bba====
12215 ===bc===
12216 ==c==
12217 ===ca===
12218 !! result
12219 start
12220 ==a==
12221 ===aa===
12222 ====aaa====
12223 ==b==
12224 ===ba===
12225 ===bb===
12226 ====bba====
12227 xxx
12228
12229 ==c==
12230 ===ca===
12231 !!end
12232
12233 !! test
12234 Section replacement test (section 9)
12235 !! options
12236 replace=9,"xxx"
12237 !! input
12238 start
12239 ==a==
12240 ===aa===
12241 ====aaa====
12242 ==b==
12243 ===ba===
12244 ===bb===
12245 ====bba====
12246 ===bc===
12247 ==c==
12248 ===ca===
12249 !! result
12250 start
12251 ==a==
12252 ===aa===
12253 ====aaa====
12254 ==b==
12255 ===ba===
12256 ===bb===
12257 ====bba====
12258 ===bc===
12259 xxx
12260 !! end
12261
12262 !! test
12263 Section replacement test (section 10)
12264 !! options
12265 replace=10,"xxx"
12266 !! input
12267 start
12268 ==a==
12269 ===aa===
12270 ====aaa====
12271 ==b==
12272 ===ba===
12273 ===bb===
12274 ====bba====
12275 ===bc===
12276 ==c==
12277 ===ca===
12278 !! result
12279 start
12280 ==a==
12281 ===aa===
12282 ====aaa====
12283 ==b==
12284 ===ba===
12285 ===bb===
12286 ====bba====
12287 ===bc===
12288 ==c==
12289 xxx
12290 !! end
12291
12292 !! test
12293 Section replacement test with initial whitespace (bug 13728)
12294 !! options
12295 replace=2,"xxx"
12296 !! input
12297 Preformatted initial line
12298 ==a==
12299 ===a===
12300 !! result
12301 Preformatted initial line
12302 ==a==
12303 xxx
12304 !! end
12305
12306
12307 !! test
12308 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12309 !! options
12310 section=1
12311 !! input
12312 ==a==
12313 a
12314 !! result
12315 ==a==
12316 a
12317 !! end
12318
12319 !! test
12320 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12321 !! options
12322 section=1
12323 !! input
12324 ==a==
12325 a
12326 !! result
12327 ==a==
12328 a
12329 !! end
12330
12331
12332 !! test
12333 Section extraction, <pre> around bogus header (bug 10309)
12334 !! options
12335 noxml section=2
12336 !! input
12337 == Section One ==
12338 <pre>
12339 =======
12340 </pre>
12341
12342 == Section Two ==
12343 stuff
12344 !! result
12345 == Section Two ==
12346 stuff
12347 !! end
12348
12349 !! test
12350 Section replacement, <pre> around bogus header (bug 10309)
12351 !! options
12352 noxml replace=2,"xxx"
12353 !! input
12354 == Section One ==
12355 <pre>
12356 =======
12357 </pre>
12358
12359 == Section Two ==
12360 stuff
12361 !! result
12362 == Section One ==
12363 <pre>
12364 =======
12365 </pre>
12366
12367 xxx
12368 !! end
12369
12370
12371
12372 !! test
12373 Handling of &#x0A; in URLs
12374 !! input
12375 **irc://&#x0A;a
12376 !! result
12377 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12378 </li></ul>
12379 </li></ul>
12380
12381 !!end
12382
12383 !! test
12384 5 quotes, code coverage +1 line (php)
12385 !! options
12386 php
12387 !! input
12388 '''''
12389 !! result
12390 !! end
12391 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12392 !! test
12393 5 quotes, code coverage +1 line (parsoid)
12394 !! options
12395 parsoid
12396 !! input
12397 '''''
12398 !! result
12399 <p><i><b></b></i></p>
12400 !! end
12401
12402 !! test
12403 Special:Search page linking.
12404 !! input
12405 {{Special:search}}
12406 !! result
12407 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12408 </p>
12409 !! end
12410
12411 !! test
12412 Say the magic word
12413 !! options
12414 title=[[Parser test]]
12415 !! input
12416 * {{PAGENAME}}
12417 * {{PAGENAMEE}}
12418 * {{FULLPAGENAME}}
12419 * {{FULLPAGENAMEE}}
12420 * {{BASEPAGENAME}}
12421 * {{BASEPAGENAMEE}}
12422 * {{SUBPAGENAME}}
12423 * {{SUBPAGENAMEE}}
12424 * {{ROOTPAGENAME}}
12425 * {{ROOTPAGENAMEE}}
12426 * {{TALKPAGENAME}}
12427 * {{TALKPAGENAMEE}}
12428 * {{SUBJECTPAGENAME}}
12429 * {{SUBJECTPAGENAMEE}}
12430 * {{NAMESPACEE}}
12431 * {{NAMESPACE}}
12432 * {{NAMESPACENUMBER}}
12433 * {{TALKSPACE}}
12434 * {{TALKSPACEE}}
12435 * {{SUBJECTSPACE}}
12436 * {{SUBJECTSPACEE}}
12437 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12438 !! result
12439 <ul><li> Parser test
12440 </li><li> Parser_test
12441 </li><li> Parser test
12442 </li><li> Parser_test
12443 </li><li> Parser test
12444 </li><li> Parser_test
12445 </li><li> Parser test
12446 </li><li> Parser_test
12447 </li><li> Parser test
12448 </li><li> Parser_test
12449 </li><li> Talk:Parser test
12450 </li><li> Talk:Parser_test
12451 </li><li> Parser test
12452 </li><li> Parser_test
12453 </li><li>
12454 </li><li>
12455 </li><li> 0
12456 </li><li> Talk
12457 </li><li> Talk
12458 </li><li>
12459 </li><li>
12460 </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>
12461 </li></ul>
12462
12463 !! end
12464 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12465
12466 !! test
12467 Gallery
12468 !! input
12469 <gallery>
12470 image1.png |
12471 image2.gif|||||
12472
12473 image3|
12474 image4 |300px| centre
12475 image5.svg| http://///////
12476 [[x|xx]]]]
12477 * image6
12478 </gallery>
12479 !! result
12480 <ul class="gallery">
12481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12482 <div style="height: 150px;">Image1.png</div>
12483 <div class="gallerytext">
12484 </div>
12485 </div></li>
12486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12487 <div style="height: 150px;">Image2.gif</div>
12488 <div class="gallerytext">
12489 <p>||||
12490 </p>
12491 </div>
12492 </div></li>
12493 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12494 <div style="height: 150px;">Image3</div>
12495 <div class="gallerytext">
12496 </div>
12497 </div></li>
12498 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12499 <div style="height: 150px;">Image4</div>
12500 <div class="gallerytext">
12501 <p>300px| centre
12502 </p>
12503 </div>
12504 </div></li>
12505 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12506 <div style="height: 150px;">Image5.svg</div>
12507 <div class="gallerytext">
12508 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12509 </p>
12510 </div>
12511 </div></li>
12512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12513 <div style="height: 150px;">* image6</div>
12514 <div class="gallerytext">
12515 </div>
12516 </div></li>
12517 </ul>
12518
12519 !! end
12520
12521 !! test
12522 Gallery (with options)
12523 !! input
12524 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12525 File:Nonexistant.jpg|caption
12526 File:Nonexistant.jpg
12527 image:foobar.jpg|some '''caption''' [[Main Page]]
12528 image:foobar.jpg
12529 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12530 </gallery>
12531 !! result
12532 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12533 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12534 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12535 <div style="height: 70px;">Nonexistant.jpg</div>
12536 <div class="gallerytext">
12537 <p>caption
12538 </p>
12539 </div>
12540 </div></li>
12541 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12542 <div style="height: 70px;">Nonexistant.jpg</div>
12543 <div class="gallerytext">
12544 </div>
12545 </div></li>
12546 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12547 <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>
12548 <div class="gallerytext">
12549 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12550 </p>
12551 </div>
12552 </div></li>
12553 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12554 <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>
12555 <div class="gallerytext">
12556 </div>
12557 </div></li>
12558 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12559 <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>
12560 <div class="gallerytext">
12561 <p>Blabla|blabla.
12562 </p>
12563 </div>
12564 </div></li>
12565 </ul>
12566
12567 !! end
12568
12569 !! test
12570 Gallery with wikitext inside caption
12571 !! input
12572 <gallery>
12573 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12574 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12575 </gallery>
12576 !! result
12577 <ul class="gallery">
12578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12579 <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>
12580 <div class="gallerytext">
12581 <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>
12582 </p>
12583 </div>
12584 </div></li>
12585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12586 <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>
12587 <div class="gallerytext">
12588 <p>This is a test template
12589 </p>
12590 </div>
12591 </div></li>
12592 </ul>
12593
12594 !! end
12595
12596 !! test
12597 gallery (with showfilename option)
12598 !! input
12599 <gallery showfilename>
12600 File:Nonexistant.jpg|caption
12601 File:Nonexistant.jpg
12602 image:foobar.jpg|some '''caption''' [[Main Page]]
12603 File:Foobar.jpg
12604 </gallery>
12605 !! result
12606 <ul class="gallery">
12607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12608 <div style="height: 150px;">Nonexistant.jpg</div>
12609 <div class="gallerytext">
12610 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12611 caption
12612 </p>
12613 </div>
12614 </div></li>
12615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12616 <div style="height: 150px;">Nonexistant.jpg</div>
12617 <div class="gallerytext">
12618 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12619 </p>
12620 </div>
12621 </div></li>
12622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12623 <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>
12624 <div class="gallerytext">
12625 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12626 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12627 </p>
12628 </div>
12629 </div></li>
12630 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12631 <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>
12632 <div class="gallerytext">
12633 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12634 </p>
12635 </div>
12636 </div></li>
12637 </ul>
12638
12639 !! end
12640
12641 !! test
12642 Gallery (with namespace-less filenames)
12643 !! input
12644 <gallery>
12645 File:Nonexistant.jpg
12646 Nonexistant.jpg
12647 image:foobar.jpg
12648 foobar.jpg
12649 </gallery>
12650 !! result
12651 <ul class="gallery">
12652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12653 <div style="height: 150px;">Nonexistant.jpg</div>
12654 <div class="gallerytext">
12655 </div>
12656 </div></li>
12657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12658 <div style="height: 150px;">Nonexistant.jpg</div>
12659 <div class="gallerytext">
12660 </div>
12661 </div></li>
12662 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12663 <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>
12664 <div class="gallerytext">
12665 </div>
12666 </div></li>
12667 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12668 <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>
12669 <div class="gallerytext">
12670 </div>
12671 </div></li>
12672 </ul>
12673
12674 !! end
12675
12676 !! test
12677 HTML Hex character encoding (spells the word "JavaScript")
12678 !! input
12679 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12680 !! result
12681 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12682 </p>
12683 !! end
12684
12685 !! test
12686 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12687 !! input
12688 &#xsee;&#XSEE;
12689 !! result
12690 <p>&amp;#xsee;&amp;#XSEE;
12691 </p>
12692 !! end
12693
12694 !! test
12695 HTML Hex character encoding mixed case
12696 !! input
12697 &#xEE;&#Xee;
12698 !! result
12699 <p>&#xee;&#xee;
12700 </p>
12701 !! end
12702
12703 !! test
12704 __FORCETOC__ override
12705 !! input
12706 __NEWSECTIONLINK__
12707 __FORCETOC__
12708 !! result
12709 <p><br />
12710 </p>
12711 !! end
12712
12713 !! test
12714 ISBN code coverage
12715 !! input
12716 ISBN 978-0-1234-56&#x20;789
12717 !! result
12718 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12719 </p>
12720 !! end
12721
12722 !! test
12723 ISBN followed by 5 spaces
12724 !! input
12725 ISBN
12726 !! result
12727 <p>ISBN
12728 </p>
12729 !! end
12730
12731 !! test
12732 Double ISBN
12733 !! input
12734 ISBN ISBN 1234567890
12735 !! result
12736 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12737 </p>
12738 !! end
12739
12740 !! test
12741 Bug 22905: <abbr> followed by ISBN followed by </a>
12742 !! input
12743 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12744 !! result
12745 <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>
12746 </p>
12747 !! end
12748
12749 !! test
12750 Double RFC
12751 !! input
12752 RFC RFC 1234
12753 !! result
12754 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12755 </p>
12756 !! end
12757
12758 !! test
12759 Double RFC with a wiki link
12760 !! input
12761 RFC [[RFC 1234]]
12762 !! result
12763 <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>
12764 </p>
12765 !! end
12766
12767 !! test
12768 RFC code coverage
12769 !! input
12770 RFC 983&#x20;987
12771 !! result
12772 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12773 </p>
12774 !! end
12775
12776 !! test
12777 Centre-aligned image
12778 !! input
12779 [[Image:foobar.jpg|centre]]
12780 !! result
12781 <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>
12782
12783 !!end
12784
12785 !! test
12786 None-aligned image
12787 !! input
12788 [[Image:foobar.jpg|none]]
12789 !! result
12790 <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>
12791
12792 !!end
12793
12794 !! test
12795 Width + Height sized image (using px) (height is ignored)
12796 !! input
12797 [[Image:foobar.jpg|640x480px]]
12798 !! result
12799 <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>
12800 </p>
12801 !!end
12802
12803 !! test
12804 Width-sized image (using px, no following whitespace)
12805 !! input
12806 [[Image:foobar.jpg|640px]]
12807 !! result
12808 <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>
12809 </p>
12810 !!end
12811
12812 !! test
12813 Width-sized image (using px, with following whitespace - test regression from r39467)
12814 !! input
12815 [[Image:foobar.jpg|640px ]]
12816 !! result
12817 <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>
12818 </p>
12819 !!end
12820
12821 !! test
12822 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12823 !! input
12824 [[Image:foobar.jpg| 640px]]
12825 !! result
12826 <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>
12827 </p>
12828 !!end
12829
12830 !! test
12831 Another italics / bold test
12832 !! input
12833 ''' ''x'
12834 !! result
12835 <pre>'<i> </i>x'
12836 </pre>
12837 !!end
12838
12839 # Note the results may be incorrect, as parserTest output included this:
12840 # XML error: Mismatched tag at byte 6120:
12841 # ...<dd> </dt></dl> </dd...
12842 !! test
12843 dt/dd/dl test
12844 !! options
12845 disabled
12846 !! input
12847 :;;;::
12848 !! result
12849 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12850 </dd></dl>
12851 </dd></dl>
12852 </dt></dl>
12853 </dt></dl>
12854 </dt></dl>
12855 </dd></dl>
12856
12857 !!end
12858
12859
12860 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12861 !! test
12862 Images with the "|" character in the comment
12863 !! input
12864 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12865 !! result
12866 <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>
12867
12868 !!end
12869
12870 !! test
12871 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12872 !! input
12873 <html><script>alert(1);</script></html>
12874 !! result
12875 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12876 </p>
12877 !! end
12878
12879 !! test
12880 HTML with raw HTML ($wgRawHtml==true)
12881 !! options
12882 wgRawHtml=1
12883 !! input
12884 <html><script>alert(1);</script></html>
12885 !! result
12886 <p><script>alert(1);</script>
12887 </p>
12888 !! end
12889
12890 !! test
12891 Parents of subpages, one level up
12892 !! options
12893 subpage title=[[Subpage test/L1/L2/L3]]
12894 !! input
12895 [[../|L2]]
12896 !! result
12897 <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>
12898 </p>
12899 !! end
12900
12901
12902 !! test
12903 Parents of subpages, one level up, not named
12904 !! options
12905 subpage title=[[Subpage test/L1/L2/L3]]
12906 !! input
12907 [[../]]
12908 !! result
12909 <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>
12910 </p>
12911 !! end
12912
12913
12914
12915 !! test
12916 Parents of subpages, two levels up
12917 !! options
12918 subpage title=[[Subpage test/L1/L2/L3]]
12919 !! input
12920 [[../../|L1]]2
12921
12922 [[../../|L1]]l
12923 !! result
12924 <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
12925 </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>
12926 </p>
12927 !! end
12928
12929 !! test
12930 Parents of subpages, two levels up, without trailing slash or name.
12931 !! options
12932 subpage title=[[Subpage test/L1/L2/L3]]
12933 !! input
12934 [[../..]]
12935 !! result
12936 <p>[[../..]]
12937 </p>
12938 !! end
12939
12940 !! test
12941 Parents of subpages, two levels up, with lots of extra trailing slashes.
12942 !! options
12943 subpage title=[[Subpage test/L1/L2/L3]]
12944 !! input
12945 [[../../////]]
12946 !! result
12947 <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>
12948 </p>
12949 !! end
12950
12951 !! article
12952 Subpage test/L1/L2/L3Sibling
12953 !! text
12954 Sibling article
12955 !! endarticle
12956
12957 !! test
12958 Transclusion of a sibling page (one level up)
12959 !! options
12960 subpage title=[[Subpage test/L1/L2/L3]]
12961 !! input
12962 {{../L3Sibling}}
12963 !! result
12964 <p>Sibling article
12965 </p>
12966 !! end
12967
12968 !! test
12969 Transclusion of a child page
12970 !! options
12971 subpage title=[[Subpage test/L1/L2]]
12972 !! input
12973 {{/L3Sibling}}
12974 !! result
12975 <p>Sibling article
12976 </p>
12977 !! end
12978
12979 !! test
12980 Non-transclusion because of too many up levels
12981 !! options
12982 subpage title=[[Subpage test/L1/L2/L3]]
12983 !! input
12984 {{../../../../More than parent}}
12985 !! result
12986 <p>{{../../../../More than parent}}
12987 </p>
12988 !! end
12989
12990 !! test
12991 Definition list code coverage
12992 !! input
12993 ; title : def
12994 ; title : def
12995 ;title: def
12996 !! result
12997 <dl><dt> title &#160;</dt><dd> def
12998 </dd><dt> title&#160;</dt><dd> def
12999 </dd><dt>title</dt><dd> def
13000 </dd></dl>
13001
13002 !! end
13003
13004 !! test
13005 Don't fall for the self-closing div
13006 !! input
13007 <div>hello world</div/>
13008 !! result
13009 <div>hello world</div>
13010
13011 !! end
13012
13013 !! test
13014 MSGNW magic word
13015 !! input
13016 {{MSGNW:msg}}
13017 !! result
13018 <p>&#91;&#91;:Template:Msg&#93;&#93;
13019 </p>
13020 !! end
13021
13022 !! test
13023 RAW magic word
13024 !! input
13025 {{RAW:QUERTY}}
13026 !! result
13027 <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>
13028 </p>
13029 !! end
13030
13031 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13032 !! test
13033 Always escape literal '>' in output, not just after '<'
13034 !! input
13035 ><>
13036 !! result
13037 <p>&gt;&lt;&gt;
13038 </p>
13039 !! end
13040
13041 !! test
13042 Template caching
13043 !! input
13044 {{Test}}
13045 {{Test}}
13046 !! result
13047 <p>This is a test template
13048 This is a test template
13049 </p>
13050 !! end
13051
13052
13053 !! article
13054 MediaWiki:Fake
13055 !! text
13056 ==header==
13057 !! endarticle
13058
13059 !! test
13060 Inclusion of !userCanEdit() content
13061 !! input
13062 {{MediaWiki:Fake}}
13063 !! result
13064 <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>
13065
13066 !! end
13067
13068
13069 !! test
13070 Out-of-order TOC heading levels
13071 !! input
13072 ==2==
13073 ======6======
13074 ===3===
13075 =1=
13076 =====5=====
13077 ==2==
13078 !! result
13079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13080 <ul>
13081 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13082 <ul>
13083 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13084 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13085 </ul>
13086 </li>
13087 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13088 <ul>
13089 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13090 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13091 </ul>
13092 </li>
13093 </ul>
13094 </div>
13095 <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>
13096 <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>
13097 <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>
13098 <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>
13099 <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>
13100 <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>
13101
13102 !! end
13103
13104
13105 !! test
13106 ISBN with a dummy number
13107 !! input
13108 ISBN ---
13109 !! result
13110 <p>ISBN ---
13111 </p>
13112 !! end
13113
13114
13115 !! test
13116 ISBN with space-delimited number
13117 !! input
13118 ISBN 92 9017 032 8
13119 !! result
13120 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13121 </p>
13122 !! end
13123
13124
13125 !! test
13126 ISBN with multiple spaces, no number
13127 !! input
13128 ISBN foo
13129 !! result
13130 <p>ISBN foo
13131 </p>
13132 !! end
13133
13134
13135 !! test
13136 ISBN length
13137 !! input
13138 ISBN 123456789
13139
13140 ISBN 1234567890
13141
13142 ISBN 12345678901
13143 !! result
13144 <p>ISBN 123456789
13145 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13146 </p><p>ISBN 12345678901
13147 </p>
13148 !! end
13149
13150
13151 !! test
13152 ISBN with trailing year (bug 8110)
13153 !! input
13154 ISBN 1-234-56789-0 - 2006
13155
13156 ISBN 1 234 56789 0 - 2006
13157 !! result
13158 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13159 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13160 </p>
13161 !! end
13162
13163
13164 !! test
13165 anchorencode
13166 !! input
13167 {{anchorencode:foo bar©#%n}}
13168 !! result
13169 <p>foo_bar.C2.A9.23.25n
13170 </p>
13171 !! end
13172
13173 !! test
13174 anchorencode trims spaces
13175 !! input
13176 {{anchorencode: __pretty__please__}}
13177 !! result
13178 <p>pretty_please
13179 </p>
13180 !! end
13181
13182 !! test
13183 anchorencode deals with links
13184 !! input
13185 {{anchorencode: [[hello|world]] [[hi]]}}
13186 !! result
13187 <p>world_hi
13188 </p>
13189 !! end
13190
13191 !! test
13192 anchorencode deals with templates
13193 !! input
13194 {{anchorencode: {{Foo}} }}
13195 !! result
13196 <p>FOO
13197 </p>
13198 !! end
13199
13200 !! test
13201 anchorencode encodes like the TOC generator: (bug 18431)
13202 !! input
13203 === _ +:.3A%3A&&amp;]] ===
13204 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13205 __NOEDITSECTION__
13206 !! result
13207 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13208 <p>.2B:.3A.253A.26.26.5D.5D
13209 </p>
13210 !! end
13211
13212 !! test
13213 Bug 6200: blockquotes and paragraph formatting
13214 !! input
13215 <blockquote>
13216 foo
13217 </blockquote>
13218
13219 bar
13220
13221 baz
13222 !! result
13223 <blockquote>
13224 <p>foo
13225 </p>
13226 </blockquote>
13227 <p>bar
13228 </p>
13229 <pre>baz
13230 </pre>
13231 !! end
13232
13233 !! test
13234 Bug 8293: Use of center tag ruins paragraph formatting
13235 !! input
13236 <center>
13237 foo
13238 </center>
13239
13240 bar
13241
13242 baz
13243 !! result
13244 <center>
13245 <p>foo
13246 </p>
13247 </center>
13248 <p>bar
13249 </p>
13250 <pre>baz
13251 </pre>
13252 !! end
13253
13254 !!test
13255 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13256 !!options
13257 php
13258 !!input
13259 <span><s>x</span></s>
13260 !!result
13261 <p><span><s>x&lt;/span&gt;</s></span>
13262 </p>
13263 !!end
13264
13265 !!test
13266 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13267 !!options
13268 parsoid
13269 !!input
13270 <span><s>x</span></s>
13271 !!result
13272 <p><span><s>x</s></span><s></s>
13273 </p>
13274 !!end
13275
13276 ###
13277 ### Language variants related tests
13278 ###
13279 !! test
13280 Self-link in language variants
13281 !! options
13282 title=[[Dunav]] language=sr
13283 !! input
13284 Both [[Dunav]] and [[Дунав]] are names for this river.
13285 !! result
13286 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13287 </p>
13288 !!end
13289
13290 !! article
13291 Дуна
13292 !! text
13293 content
13294 !! endarticle
13295
13296 !! test
13297 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13298 !! options
13299 title=[[Duna]] language=sr
13300 !! input
13301 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13302 !! result
13303 <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.
13304 </p>
13305 !! end
13306
13307 !! test
13308 Link to pages in language variants
13309 !! options
13310 language=sr
13311 !! input
13312 Main Page can be written as [[Маин Паге]]
13313 !! result
13314 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13315 </p>
13316 !!end
13317
13318
13319 !! test
13320 Multiple links to pages in language variants
13321 !! options
13322 language=sr
13323 !! input
13324 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13325 !! result
13326 <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>.
13327 </p>
13328 !!end
13329
13330
13331 !! test
13332 Simple template in language variants
13333 !! options
13334 language=sr
13335 !! input
13336 {{тест}}
13337 !! result
13338 <p>This is a test template
13339 </p>
13340 !! end
13341
13342
13343 !! test
13344 Template with explicit namespace in language variants
13345 !! options
13346 language=sr
13347 !! input
13348 {{Template:тест}}
13349 !! result
13350 <p>This is a test template
13351 </p>
13352 !! end
13353
13354
13355 !! test
13356 Basic test for template parameter in language variants
13357 !! options
13358 language=sr
13359 !! input
13360 {{парамтест|param=foo}}
13361 !! result
13362 <p>This is a test template with parameter foo
13363 </p>
13364 !! end
13365
13366
13367 !! test
13368 Simple category in language variants
13369 !! options
13370 language=sr cat
13371 !! input
13372 [[Category:МедиаWики Усер'с Гуиде]]
13373 !! result
13374 <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>
13375 !! end
13376
13377
13378 !! article
13379 Category:分类
13380 !! text
13381 blah
13382 !! endarticle
13383
13384 !! article
13385 Category:分類
13386 !! text
13387 blah
13388 !! endarticle
13389
13390 !! test
13391 Don't convert blue categorylinks to another variant (bug 33210)
13392 !! options
13393 language=zh cat
13394 !! input
13395 [[A]][[Category:分类]]
13396 !! result
13397 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13398 !! end
13399
13400
13401 !! test
13402 Stripping -{}- tags (language variants)
13403 !! options
13404 language=sr
13405 !! input
13406 Latin proverb: -{Ne nuntium necare}-
13407 !! result
13408 <p>Latin proverb: Ne nuntium necare
13409 </p>
13410 !! end
13411
13412
13413 !! test
13414 Prevent conversion with -{}- tags (language variants)
13415 !! options
13416 language=sr variant=sr-ec
13417 !! input
13418 Latinski: -{Ne nuntium necare}-
13419 !! result
13420 <p>Латински: Ne nuntium necare
13421 </p>
13422 !! end
13423
13424
13425 !! test
13426 Prevent conversion of text with -{}- tags (language variants)
13427 !! options
13428 language=sr variant=sr-ec
13429 !! input
13430 Latinski: -{Ne nuntium necare}-
13431 !! result
13432 <p>Латински: Ne nuntium necare
13433 </p>
13434 !! end
13435
13436
13437 !! test
13438 Prevent conversion of links with -{}- tags (language variants)
13439 !! options
13440 language=sr variant=sr-ec
13441 !! input
13442 -{[[Main Page]]}-
13443 !! result
13444 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13445 </p>
13446 !! end
13447
13448
13449 !! test
13450 -{}- tags within headlines (within html for parserConvert())
13451 !! options
13452 language=sr variant=sr-ec
13453 !! input
13454 == -{Naslov}- ==
13455 !! result
13456 <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>
13457
13458 !! end
13459
13460
13461 !! test
13462 Explicit definition of language variant alternatives
13463 !! options
13464 language=zh variant=zh-tw
13465 !! input
13466 -{zh:China;zh-tw:Taiwan}-, not China
13467 !! result
13468 <p>Taiwan, not China
13469 </p>
13470 !! end
13471
13472
13473 !! test
13474 Conversion around HTML tags
13475 !! options
13476 language=sr variant=sr-ec
13477 !! input
13478 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13479 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13480 !! result
13481 <p>
13482 <span title="ЛаCтин">ски</span>
13483 </p>
13484 !! end
13485
13486
13487 !! test
13488 Explicit session-wise language variant mapping (A flag and - flag)
13489 !! options
13490 language=zh variant=zh-tw
13491 !! input
13492 Taiwan is not China.
13493 But -{A|zh:China;zh-tw:Taiwan}- is China,
13494 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13495 and -{China}- is China.
13496 !! result
13497 <p>Taiwan is not China.
13498 But Taiwan is Taiwan,
13499 (This should be stripped!)
13500 and China is China.
13501 </p>
13502 !! end
13503
13504 !! test
13505 Explicit session-wise language variant mapping (H flag for hide)
13506 !! options
13507 language=zh variant=zh-tw
13508 !! input
13509 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13510 Taiwan is China.
13511 !! result
13512 <p>(This should be stripped!)
13513 Taiwan is Taiwan.
13514 </p>
13515 !! end
13516
13517 !! test
13518 Adding explicit conversion rule for title (T flag)
13519 !! options
13520 language=zh variant=zh-tw showtitle
13521 !! input
13522 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13523 !! result
13524 Taiwan
13525 <p>Should be stripped!
13526 </p>
13527 !! end
13528
13529 !! test
13530 Testing that changing the language variant here in the tests actually works
13531 !! options
13532 language=zh variant=zh showtitle
13533 !! input
13534 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13535 !! result
13536 China
13537 <p>Should be stripped!
13538 </p>
13539 !! end
13540
13541 !! test
13542 Recursive conversion of alt and title attrs shouldn't clear converter state
13543 !! options
13544 language=zh variant=zh-cn showtitle
13545 !! input
13546 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13547 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13548 !! result
13549 China
13550 <p>
13551 Should be stripped<span title="Exclamation">!</span>
13552 </p>
13553 !! end
13554
13555 !! test
13556 Bug 24072: more test on conversion rule for title
13557 !! options
13558 language=zh variant=zh-tw showtitle
13559 !! input
13560 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13561 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13562 !! result
13563 Taiwan
13564 <p>This should be stripped!
13565 This won't take interferes with the title rule.
13566 </p>
13567 !! end
13568
13569 !! test
13570 Partly disable title conversion if variant == main language code
13571 !! options
13572 language=zh variant=zh title=[[ZH]] showtitle
13573 !! input
13574 -{T|zh-cn:CN;zh-tw:TW}-
13575 !! result
13576 ZH
13577 <p>
13578 </p>
13579 !! end
13580
13581 !! test
13582 Partly disable title conversion if variant == main language code, more
13583 !! options
13584 language=zh variant=zh title=[[ZH]] showtitle
13585 !! input
13586 -{T|TW}-
13587 !! result
13588 ZH
13589 <p>
13590 </p>
13591 !! end
13592
13593 !! test
13594 Raw output of variant escape tags (R flag)
13595 !! options
13596 language=zh variant=zh-tw
13597 !! input
13598 Raw: -{R|zh:China;zh-tw:Taiwan}-
13599 !! result
13600 <p>Raw: zh:China;zh-tw:Taiwan
13601 </p>
13602 !! end
13603
13604 !! test
13605 Nested using of manual convert syntax
13606 !! options
13607 language=zh variant=zh-hk
13608 !! input
13609 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13610 !! result
13611 <p>Nested: Hello Hong Kong!
13612 </p>
13613 !! end
13614
13615 !! test
13616 Proper conversion of text in external links
13617 !! options
13618 language=sr variant=sr-ec
13619 !! input
13620 http://www.google.com
13621 gopher://www.google.com
13622 [http://www.google.com http://www.google.com]
13623 [gopher://www.google.com gopher://www.google.com]
13624 [https://www.google.com irc://www.google.com]
13625 [ftp://www.google.com www.google.com/ftp://dir]
13626 [//www.google.com www.google.com]
13627 !! result
13628 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13629 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13630 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13631 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13632 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13633 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13634 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13635 </p>
13636 !! end
13637
13638 !! test
13639 Do not convert roman numbers to language variants
13640 !! options
13641 language=sr variant=sr-ec
13642 !! input
13643 Fridrih IV je car.
13644 !! result
13645 <p>Фридрих IV је цар.
13646 </p>
13647 !! end
13648
13649 !! test
13650 Unclosed language converter markup "-{"
13651 !! options
13652 language=sr
13653 !! input
13654 -{T|hello
13655 !! result
13656 <p>-{T|hello
13657 </p>
13658 !! end
13659
13660 !! test
13661 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13662 !! options
13663 language=sr
13664 !! input
13665 -{R|=&gt;}-
13666 !! result
13667 <p>=&gt;
13668 </p>
13669 !!end
13670
13671 !!article
13672 Template:Bullet
13673 !!text
13674 * Bar
13675 !!endarticle
13676
13677 !! test
13678 Bug 529: Uncovered bullet
13679 !! input
13680 * Foo {{bullet}}
13681 !! result
13682 <ul><li> Foo
13683 </li><li> Bar
13684 </li></ul>
13685
13686 !! end
13687
13688 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13689 # Templates in Wikipedia rely on this behavior, as tidy has always been
13690 # enabled there. These tests are normally run *without* tidy, so specify the
13691 # full output here.
13692 # To test realistic parsing behavior, apply a tidy-like transformation to both
13693 # the expected output and your parser's output.
13694 !! test
13695 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13696 !! input
13697 ******* Foo {{bullet}}
13698 !! result
13699 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13700 </li></ul>
13701 </li></ul>
13702 </li></ul>
13703 </li></ul>
13704 </li></ul>
13705 </li></ul>
13706 </li><li> Bar
13707 </li></ul>
13708
13709 !! end
13710
13711 !! test
13712 Bug 529: Uncovered table already at line-start
13713 !! input
13714 x
13715
13716 {{table}}
13717 y
13718 !! result
13719 <p>x
13720 </p>
13721 <table>
13722 <tr>
13723 <td> 1 </td>
13724 <td> 2
13725 </td></tr>
13726 <tr>
13727 <td> 3 </td>
13728 <td> 4
13729 </td></tr></table>
13730 <p>y
13731 </p>
13732 !! end
13733
13734 !! test
13735 Bug 529: Uncovered bullet in parser function result
13736 !! input
13737 * Foo {{lc:{{bullet}} }}
13738 !! result
13739 <ul><li> Foo
13740 </li><li> bar
13741 </li></ul>
13742
13743 !! end
13744
13745 !! test
13746 Bug 5678: Double-parsed template argument
13747 !! input
13748 {{lc:{{{1}}}|hello}}
13749 !! result
13750 <p>{{{1}}}
13751 </p>
13752 !! end
13753
13754 !! test
13755 Bug 5678: Double-parsed template invocation
13756 !! input
13757 {{lc:{{paramtest {{!}} param = hello }} }}
13758 !! result
13759 <p>{{paramtest | param = hello }}
13760 </p>
13761 !! end
13762
13763 !! test
13764 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13765 !! options
13766 language=cs
13767 title=[[Main Page]]
13768 !! input
13769 {{PRVNÍVELKÉ:ěščř}}
13770 {{prvnívelké:ěščř}}
13771 {{PRVNÍMALÉ:ěščř}}
13772 {{prvnímalé:ěščř}}
13773 {{MALÁ:ěščř}}
13774 {{malá:ěščř}}
13775 {{VELKÁ:ěščř}}
13776 {{velká:ěščř}}
13777 !! result
13778 <p>Ěščř
13779 Ěščř
13780 ěščř
13781 ěščř
13782 ěščř
13783 ěščř
13784 ĚŠČŘ
13785 ĚŠČŘ
13786 </p>
13787 !! end
13788
13789 !! test
13790 Morwen/13: Unclosed link followed by heading
13791 !! input
13792 [[link
13793 ==heading==
13794 !! result
13795 <p>[[link
13796 </p>
13797 <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>
13798
13799 !! end
13800
13801 !! test
13802 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13803 !! input
13804 {{foo|
13805 =heading=
13806 !! result
13807 <p>{{foo|
13808 </p>
13809 <h1><span class="mw-headline" id="heading">heading</span></h1>
13810
13811 !! end
13812
13813 !! test
13814 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13815 !! input
13816 {{foo|
13817 ==heading==
13818 !! result
13819 <p>{{foo|
13820 </p>
13821 <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>
13822
13823 !! end
13824
13825 !! test
13826 Tildes in comments
13827 !! options
13828 pst
13829 !! input
13830 <!-- ~~~~ -->
13831 !! result
13832 <!-- ~~~~ -->
13833 !! end
13834
13835 !! test
13836 Paragraphs inside divs (no extra line breaks)
13837 !! input
13838 <div>Line one
13839
13840 Line two</div>
13841 !! result
13842 <div>Line one
13843 Line two</div>
13844
13845 !! end
13846
13847 !! test
13848 Paragraphs inside divs (extra line break on open)
13849 !! input
13850 <div>
13851 Line one
13852
13853 Line two</div>
13854 !! result
13855 <div>
13856 <p>Line one
13857 </p>
13858 Line two</div>
13859
13860 !! end
13861
13862 !! test
13863 Paragraphs inside divs (extra line break on close)
13864 !! input
13865 <div>Line one
13866
13867 Line two
13868 </div>
13869 !! result
13870 <div>Line one
13871 <p>Line two
13872 </p>
13873 </div>
13874
13875 !! end
13876
13877 !! test
13878 Paragraphs inside divs (extra line break on open and close)
13879 !! input
13880 <div>
13881 Line one
13882
13883 Line two
13884 </div>
13885 !! result
13886 <div>
13887 <p>Line one
13888 </p><p>Line two
13889 </p>
13890 </div>
13891
13892 !! end
13893
13894 !! test
13895 Nesting tags, paragraphs on lines which begin with <div>
13896 !! options
13897 disabled
13898 !! input
13899 <div></div><strong>A
13900 B</strong>
13901 !! result
13902 <div></div>
13903 <p><strong>A
13904 B</strong>
13905 </p>
13906 !! end
13907
13908 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13909 !! test
13910 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13911 !! input
13912 <blockquote>Line one
13913
13914 Line two</blockquote>
13915 !! result
13916 <blockquote>Line one
13917 Line two</blockquote>
13918
13919 !! end
13920
13921 !! test
13922 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13923 !! input
13924 <blockquote>
13925 Line one
13926
13927 Line two</blockquote>
13928 !! result
13929 <blockquote>
13930 <p>Line one
13931 </p>
13932 Line two</blockquote>
13933
13934 !! end
13935
13936 !! test
13937 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13938 !! input
13939 <blockquote>Line one
13940
13941 Line two
13942 </blockquote>
13943 !! result
13944 <blockquote>Line one
13945 <p>Line two
13946 </p>
13947 </blockquote>
13948
13949 !! end
13950
13951 !! test
13952 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13953 !! input
13954 <blockquote>
13955 Line one
13956
13957 Line two
13958 </blockquote>
13959 !! result
13960 <blockquote>
13961 <p>Line one
13962 </p><p>Line two
13963 </p>
13964 </blockquote>
13965
13966 !! end
13967
13968 !! test
13969 Paragraphs inside blockquotes/divs (no extra line breaks)
13970 !! input
13971 <blockquote><div>Line one
13972
13973 Line two</div></blockquote>
13974 !! result
13975 <blockquote><div>Line one
13976 Line two</div></blockquote>
13977
13978 !! end
13979
13980 !! test
13981 Paragraphs inside blockquotes/divs (extra line break on open)
13982 !! input
13983 <blockquote><div>
13984 Line one
13985
13986 Line two</div></blockquote>
13987 !! result
13988 <blockquote><div>
13989 <p>Line one
13990 </p>
13991 Line two</div></blockquote>
13992
13993 !! end
13994
13995 !! test
13996 Paragraphs inside blockquotes/divs (extra line break on close)
13997 !! input
13998 <blockquote><div>Line one
13999
14000 Line two
14001 </div></blockquote>
14002 !! result
14003 <blockquote><div>Line one
14004 <p>Line two
14005 </p>
14006 </div></blockquote>
14007
14008 !! end
14009
14010 !! test
14011 Paragraphs inside blockquotes/divs (extra line break on open and close)
14012 !! input
14013 <blockquote><div>
14014 Line one
14015
14016 Line two
14017 </div></blockquote>
14018 !! result
14019 <blockquote><div>
14020 <p>Line one
14021 </p><p>Line two
14022 </p>
14023 </div></blockquote>
14024
14025 !! end
14026
14027 !! test
14028 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14029 !! options
14030 wgLinkHolderBatchSize=0
14031 !! input
14032 [[meatball:1]]
14033 [[meatball:2]]
14034 [[meatball:3]]
14035 !! result
14036 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14037 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14038 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14039 </p>
14040 !! end
14041
14042 !! test
14043 Free external link invading image caption
14044 !! input
14045 [[Image:Foobar.jpg|thumb|http://x|hello]]
14046 !! result
14047 <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>
14048
14049 !! end
14050
14051 !! test
14052 Bug 15196: localised external link numbers
14053 !! options
14054 language=fa
14055 !! input
14056 [http://en.wikipedia.org/]
14057 !! result
14058 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14059 </p>
14060 !! end
14061
14062 !! test
14063 Multibyte character in padleft
14064 !! input
14065 {{padleft:-Hello|7|Æ}}
14066 !! result
14067 <p>Æ-Hello
14068 </p>
14069 !! end
14070
14071 !! test
14072 Multibyte character in padright
14073 !! input
14074 {{padright:Hello-|7|Æ}}
14075 !! result
14076 <p>Hello-Æ
14077 </p>
14078 !! end
14079
14080 !!test
14081 formatdate parser function
14082 !!input
14083 {{#formatdate:2009-03-24}}
14084 !! result
14085 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14086 </p>
14087 !! end
14088
14089 !!test
14090 formatdate parser function, with default format
14091 !!input
14092 {{#formatdate:2009-03-24|mdy}}
14093 !! result
14094 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14095 </p>
14096 !! end
14097
14098 !! test
14099 Spacing of numbers in formatted dates
14100 !! input
14101 {{#formatdate:January 15}}
14102 !! result
14103 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14104 </p>
14105 !! end
14106
14107 !! test
14108 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
14109 !! options
14110 language=nl title=[[MediaWiki:Common.css]]
14111 !! input
14112 {{#formatdate:2009-03-24|dmy}}
14113 !! result
14114 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14115 </p>
14116 !! end
14117
14118 #
14119 #
14120 #
14121
14122 #
14123 # Edit comments
14124 #
14125
14126 !! test
14127 Edit comment with link
14128 !! options
14129 comment
14130 !! input
14131 I like the [[Main Page]] a lot
14132 !! result
14133 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14134 !!end
14135
14136 !! test
14137 Edit comment with link and link text
14138 !! options
14139 comment
14140 !! input
14141 I like the [[Main Page|best pages]] a lot
14142 !! result
14143 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14144 !!end
14145
14146 !! test
14147 Edit comment with link and link text with suffix
14148 !! options
14149 comment
14150 !! input
14151 I like the [[Main Page|best page]]s a lot
14152 !! result
14153 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14154 !!end
14155
14156 !! test
14157 Edit comment with section link (non-local, eg in history list)
14158 !! options
14159 comment title=[[Main Page]]
14160 !! input
14161 /* External links */ removed bogus entries
14162 !! result
14163 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14164 !!end
14165
14166 !! test
14167 Edit comment with section link and text before it (non-local, eg in history list)
14168 !! options
14169 comment title=[[Main Page]]
14170 !! input
14171 pre-comment text /* External links */ removed bogus entries
14172 !! result
14173 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>
14174 !!end
14175
14176 !! test
14177 Edit comment with section link (local, eg in diff view)
14178 !! options
14179 comment local title=[[Main Page]]
14180 !! input
14181 /* External links */ removed bogus entries
14182 !! result
14183 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14184 !!end
14185
14186 !! test
14187 Edit comment with subpage link (bug 14080)
14188 !! options
14189 comment
14190 subpage
14191 title=[[Subpage test]]
14192 !! input
14193 Poked at a [[/subpage]] here...
14194 !! result
14195 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14196 !!end
14197
14198 !! test
14199 Edit comment with subpage link and link text (bug 14080)
14200 !! options
14201 comment
14202 subpage
14203 title=[[Subpage test]]
14204 !! input
14205 Poked at a [[/subpage|neat little page]] here...
14206 !! result
14207 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14208 !!end
14209
14210 !! test
14211 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14212 !! options
14213 comment
14214 title=[[Subpage test]]
14215 !! input
14216 Poked at a [[/subpage]] here...
14217 !! result
14218 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...
14219 !!end
14220
14221 !! test
14222 Edit comment with bare anchor link (local, as on diff)
14223 !! options
14224 comment
14225 local
14226 title=[[Main Page]]
14227 !!input
14228 [[#section]]
14229 !! result
14230 <a href="#section">#section</a>
14231 !! end
14232
14233 !! test
14234 Edit comment with bare anchor link (non-local, as on history)
14235 !! options
14236 comment
14237 title=[[Main Page]]
14238 !!input
14239 [[#section]]
14240 !! result
14241 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14242 !! end
14243
14244 !! test
14245 Anchor starting with underscore
14246 !!input
14247 [[#_ref|One]]
14248 !! result
14249 <p><a href="#_ref">One</a>
14250 </p>
14251 !! end
14252
14253 !! test
14254 Id starting with underscore
14255 !!input
14256 <div id="_ref"></div>
14257 !! result
14258 <div id="_ref"></div>
14259
14260 !! end
14261
14262 !! test
14263 Space normalisation on autocomment (bug 22784)
14264 !! options
14265 comment
14266 title=[[Main Page]]
14267 !!input
14268 /* __hello__world__ */
14269 !! result
14270 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14271 !! end
14272
14273 !! test
14274 percent-encoding and + signs in comments (Bug 26410)
14275 !! options
14276 comment
14277 !!input
14278 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14279 !! result
14280 <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>
14281 !! end
14282
14283 !! test
14284 Bad images - basic functionality
14285 !! options
14286 disabled
14287 !! input
14288 [[File:Bad.jpg]]
14289 !! result
14290 !! end
14291
14292 !! test
14293 Bad images - bug 16039: text after bad image disappears
14294 !! options
14295 disabled
14296 !! input
14297 Foo bar
14298 [[File:Bad.jpg]]
14299 Bar foo
14300 !! result
14301 <p>Foo bar
14302 </p><p>Bar foo
14303 </p>
14304 !! end
14305
14306 !! test
14307 Verify that displaytitle works (bug #22501) no displaytitle
14308 !! options
14309 showtitle
14310 !! config
14311 wgAllowDisplayTitle=true
14312 wgRestrictDisplayTitle=false
14313 !! input
14314 this is not the the title
14315 !! result
14316 Parser test
14317 <p>this is not the the title
14318 </p>
14319 !! end
14320
14321 !! test
14322 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14323 !! options
14324 showtitle
14325 title=[[Screen]]
14326 !! config
14327 wgAllowDisplayTitle=true
14328 wgRestrictDisplayTitle=false
14329 !! input
14330 this is not the the title
14331 {{DISPLAYTITLE:whatever}}
14332 !! result
14333 whatever
14334 <p>this is not the the title
14335 </p>
14336 !! end
14337
14338 !! test
14339 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14340 !! options
14341 showtitle
14342 title=[[Screen]]
14343 !! config
14344 wgAllowDisplayTitle=true
14345 wgRestrictDisplayTitle=true
14346 !! input
14347 this is not the the title
14348 {{DISPLAYTITLE:whatever}}
14349 !! result
14350 Screen
14351 <p>this is not the the title
14352 </p>
14353 !! end
14354
14355 !! test
14356 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14357 !! options
14358 showtitle
14359 title=[[Screen]]
14360 !! config
14361 wgAllowDisplayTitle=true
14362 wgRestrictDisplayTitle=true
14363 !! input
14364 this is not the the title
14365 {{DISPLAYTITLE:screen}}
14366 !! result
14367 screen
14368 <p>this is not the the title
14369 </p>
14370 !! end
14371
14372 !! test
14373 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14374 !! options
14375 showtitle
14376 title=[[Screen]]
14377 !! config
14378 wgAllowDisplayTitle=false
14379 !! input
14380 this is not the the title
14381 {{DISPLAYTITLE:screen}}
14382 !! result
14383 Screen
14384 <p>this is not the the title
14385 <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>
14386 </p>
14387 !! end
14388
14389 !! test
14390 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14391 !! options
14392 showtitle
14393 title=[[Screen]]
14394 !! config
14395 wgAllowDisplayTitle=false
14396 !! input
14397 this is not the the title
14398 !! result
14399 Screen
14400 <p>this is not the the title
14401 </p>
14402 !! end
14403
14404 !! test
14405 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14406 !! options
14407 showtitle
14408 title=[[Screen]]
14409 !! config
14410 wgAllowDisplayTitle=true
14411 wgRestrictDisplayTitle=true
14412 !! input
14413 this is not the the title
14414 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14415 !! result
14416 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14417 <p>this is not the the title
14418 </p>
14419 !! end
14420
14421 !! test
14422 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14423 !! options
14424 showtitle
14425 title=[[Screen]]
14426 !! config
14427 wgAllowDisplayTitle=true
14428 wgRestrictDisplayTitle=true
14429 !! input
14430 this is not the the title
14431 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14432 !! result
14433 <span style="color: red;">s</span>creen
14434 <p>this is not the the title
14435 </p>
14436 !! end
14437
14438 !! test
14439 preload: check <noinclude> and <includeonly>
14440 !! options
14441 preload
14442 !! input
14443 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14444 !! result
14445 Hello kind world.
14446 !! end
14447
14448 !! test
14449 preload: check <onlyinclude>
14450 !! options
14451 preload
14452 !! input
14453 Goodbye <onlyinclude>Hello world</onlyinclude>
14454 !! result
14455 Hello world
14456 !! end
14457
14458 !! test
14459 preload: can pass tags through if we want to
14460 !! options
14461 preload
14462 !! input
14463 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14464 !! result
14465 <includeonly>Hello world</includeonly>
14466 !! end
14467
14468 !! test
14469 preload: check that it doesn't try to do tricks
14470 !! options
14471 preload
14472 !! input
14473 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14474 !! result
14475 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14476 !! end
14477
14478 !! test
14479 Play a bit with r67090 and bug 3158
14480 !! options
14481 disabled
14482 !! input
14483 <div style="width:50% !important">&nbsp;</div>
14484 <div style="width:50%&nbsp;!important">&nbsp;</div>
14485 <div style="width:50%&#160;!important">&nbsp;</div>
14486 <div style="border : solid;">&nbsp;</div>
14487 !! result
14488 <div style="width:50% !important">&nbsp;</div>
14489 <div style="width:50% !important">&nbsp;</div>
14490 <div style="width:50% !important">&nbsp;</div>
14491 <div style="border&#160;: solid;">&nbsp;</div>
14492
14493 !! end
14494
14495 !! test
14496 HTML5 data attributes
14497 !! input
14498 <span data-foo="bar">Baz</span>
14499 <p data-abc-def_hij="">Quuz</p>
14500 !! result
14501 <p><span data-foo="bar">Baz</span>
14502 </p>
14503 <p data-abc-def_hij="">Quuz</p>
14504
14505 !! end
14506
14507 !! test
14508 percent-encoding and + signs in internal links (Bug 26410)
14509 !! input
14510 [[User:+%]] [[Page+title%]]
14511 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14512 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14513 [[%33%45]] [[%33%45+]]
14514 !! result
14515 <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>
14516 <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>
14517 <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>
14518 <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>
14519 </p>
14520 !! end
14521
14522 !! test
14523 Special characters in embedded file links (bug 27679)
14524 !! input
14525 [[File:Contains & ampersand.jpg]]
14526 [[File:Does not exist.jpg|Title with & ampersand]]
14527 !! result
14528 <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>
14529 <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>
14530 </p>
14531 !! end
14532
14533
14534 !! test
14535 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14536 !! input
14537 Text&apos;s been normalized?
14538 !! result
14539 <p>Text&#39;s been normalized?
14540 </p>
14541 !! end
14542
14543 !! test
14544 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14545 !! input
14546 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14547 !! result
14548 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14549 </p>
14550 !! end
14551
14552 !! test
14553 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14554 !! input
14555 [http://www.example.org/ ideograms]
14556 !! result
14557 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14558 </p>
14559 !! end
14560
14561 !! test
14562 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14563 !! input
14564 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14565 !! result
14566 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14567 </p>
14568 !! end
14569
14570 !! article
14571 Mediawiki:loop1
14572 !! text
14573 {{Identical|A}}
14574 !! endarticle
14575
14576 !! article
14577 Mediawiki:loop2
14578 !! text
14579 {{Identical|B}}
14580 !! endarticle
14581
14582 !! article
14583 Template:Identical
14584 !! text
14585 {{int:loop1}}
14586 {{int:loop2}}
14587 !! endarticle
14588
14589 !! test
14590 Bug 31098 Template which includes system messages which includes the template
14591 !! input
14592 {{Identical}}
14593 !! result
14594 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14595 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14596 </p>
14597 !! end
14598
14599 !! test
14600 Bug31490 Turkish: ucfirst 'blah'
14601 !! options
14602 language=tr
14603 !! input
14604 {{ucfirst:blah}}
14605 !! result
14606 <p>Blah
14607 </p>
14608 !! end
14609
14610 !! test
14611 Bug31490 Turkish: ucfirst 'ix'
14612 !! options
14613 language=tr
14614 !! input
14615 {{ucfirst:ix}}
14616 !! result
14617 <p>İx
14618 </p>
14619 !! end
14620
14621 !! test
14622 Bug31490 Turkish: lcfirst 'BLAH'
14623 !! options
14624 language=tr
14625 !! input
14626 {{lcfirst:BLAH}}
14627 !! result
14628 <p>bLAH
14629 </p>
14630 !! end
14631
14632 !! test
14633 Bug31490 Turkish: ucfırst (with a dotless i)
14634 !! options
14635 language=tr
14636 !! input
14637 {{ucfırst:blah}}
14638 !! result
14639 <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>
14640 </p>
14641 !! end
14642
14643 !! test
14644 Bug31490 ucfırst (with a dotless i) with English language
14645 !! options
14646 language=en
14647 !! input
14648 {{ucfırst:blah}}
14649 !! result
14650 <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>
14651 </p>
14652 !! end
14653
14654 !! test
14655 Bug 26375: TOC with italics
14656 !! options
14657 title=[[Main Page]]
14658 !! input
14659 __TOC__
14660 == ''Lost'' episodes ==
14661 !! result
14662 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14663 <ul>
14664 <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>
14665 </ul>
14666 </div>
14667 <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>
14668
14669 !! end
14670
14671 !! test
14672 Bug 26375: TOC with bold
14673 !! options
14674 title=[[Main Page]]
14675 !! input
14676 __TOC__
14677 == '''should be bold''' then normal text ==
14678 !! result
14679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14680 <ul>
14681 <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>
14682 </ul>
14683 </div>
14684 <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>
14685
14686 !! end
14687
14688 !! test
14689 Bug 33845: Headings become cursive in TOC when they contain an image
14690 !! options
14691 title=[[Main Page]]
14692 !! input
14693 __TOC__
14694 == Image [[Image:foobar.jpg]] ==
14695 !! result
14696 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14697 <ul>
14698 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14699 </ul>
14700 </div>
14701 <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>
14702
14703 !! end
14704
14705 !! test
14706 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14707 !! options
14708 title=[[Main Page]]
14709 !! input
14710 __TOC__
14711 == <blockquote>Quote</blockquote> ==
14712 !! result
14713 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14714 <ul>
14715 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14716 </ul>
14717 </div>
14718 <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>
14719
14720 !! end
14721
14722 !! test
14723 Unclosed tags in TOC
14724 !! options
14725 title=[[Main Page]]
14726 !! input
14727 __TOC__
14728 == Proof: 2 < 3 ==
14729 <small>Hanc marginis exiguitas non caperet.</small>
14730 QED
14731 !! result
14732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14733 <ul>
14734 <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>
14735 </ul>
14736 </div>
14737 <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>
14738 <p><small>Hanc marginis exiguitas non caperet.</small>
14739 QED
14740 </p>
14741 !! end
14742
14743 !! test
14744 Multiple tags in TOC
14745 !! input
14746 __TOC__
14747 == <i>Foo</i> <b>Bar</b> ==
14748
14749 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14750 !! result
14751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14752 <ul>
14753 <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>
14754 <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>
14755 </ul>
14756 </div>
14757 <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>
14758 <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>
14759
14760 !! end
14761
14762 !! test
14763 Tags with parameters in TOC
14764 !! input
14765 __TOC__
14766 == <sup class="in-h2">Hello</sup> ==
14767
14768 == <sup class="a > b">Evilbye</sup> ==
14769 !! result
14770 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14771 <ul>
14772 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14773 <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>
14774 </ul>
14775 </div>
14776 <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>
14777 <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>
14778
14779 !! end
14780
14781 !! test
14782 span tags with directionality in TOC
14783 !! input
14784 __TOC__
14785 == <span dir="ltr">C++</span> ==
14786
14787 == <span dir="rtl">זבנג!</span> ==
14788
14789 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14790
14791 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14792
14793 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14794 !! result
14795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14796 <ul>
14797 <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>
14798 <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>
14799 <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>
14800 <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>
14801 <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>
14802 </ul>
14803 </div>
14804 <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>
14805 <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>
14806 <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>
14807 <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>
14808 <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>
14809
14810 !! end
14811
14812 !! article
14813 MediaWiki:Bug32057
14814 !! text
14815 == {{int:headline_sample}} ==
14816 !! endarticle
14817
14818 !! test
14819 Bug 32057: Title needed when expanding <h> nodes.
14820 !! options
14821 title=[[Main Page]]
14822 !! input
14823 {{int:Bug32057}}
14824 !! result
14825 <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>
14826
14827 !! end
14828
14829 !! test
14830 Strip marker in urlencode
14831 !! input
14832 {{urlencode:x<nowiki/>y}}
14833 {{urlencode:x<nowiki/>y|wiki}}
14834 {{urlencode:x<nowiki/>y|path}}
14835 !! result
14836 <p>xy
14837 xy
14838 xy
14839 </p>
14840 !! end
14841
14842 !! test
14843 Strip marker in lc
14844 !! input
14845 {{lc:x<nowiki/>y}}
14846 !! result
14847 <p>xy
14848 </p>
14849 !! end
14850
14851 !! test
14852 Strip marker in uc
14853 !! input
14854 {{uc:x<nowiki/>y}}
14855 !! result
14856 <p>XY
14857 </p>
14858 !! end
14859
14860 !! test
14861 Strip marker in formatNum
14862 !! input
14863 {{formatnum:1<nowiki/>2}}
14864 {{formatnum:1<nowiki/>2|R}}
14865 !! result
14866 <p>12
14867 12
14868 </p>
14869 !! end
14870
14871 !! test
14872 Check noCommafy in formatNum
14873 !! options
14874 language=be-tarask
14875 !! input
14876 {{formatnum:123456.78}}
14877 {{formatnum:123456.78|NOSEP}}
14878 !! result
14879 <p>123 456,78
14880 123456.78
14881 </p>
14882 !! end
14883
14884 !! test
14885 Strip marker in grammar
14886 !! options
14887 language=fi
14888 !! input
14889 {{grammar:elative|foo<nowiki/>bar}}
14890 !! result
14891 <p>foobarista
14892 </p>
14893 !! end
14894
14895 !! test
14896 Strip marker in padleft
14897 !! input
14898 {{padleft:|2|x<nowiki/>y}}
14899 !! result
14900 <p>xy
14901 </p>
14902 !! end
14903
14904 !! test
14905 Strip marker in padright
14906 !! input
14907 {{padright:|2|x<nowiki/>y}}
14908 !! result
14909 <p>xy
14910 </p>
14911 !! end
14912
14913 !! test
14914 Strip marker in anchorencode
14915 !! input
14916 {{anchorencode:x<nowiki/>y}}
14917 !! result
14918 <p>xy
14919 </p>
14920 !! end
14921
14922 !! test
14923 nowiki inside link inside heading (bug 18295)
14924 !! input
14925 ==[[foo|x<nowiki>y</nowiki>z]]==
14926 !! result
14927 <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>
14928
14929 !! end
14930
14931 !! test
14932 new support for bdi element (bug 31817)
14933 !! input
14934 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14935 !! result
14936 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14937
14938 !!end
14939
14940 !! test
14941 Ignore pipe between table row attributes
14942 !! input
14943 {|
14944 | quux
14945 |- id=foo | style='color: red'
14946 | bar
14947 |}
14948 !! result
14949 <table>
14950 <tr>
14951 <td> quux
14952 </td></tr>
14953 <tr id="foo" style="color: red">
14954 <td> bar
14955 </td></tr></table>
14956
14957 !! end
14958
14959 !!test
14960 Gallery override link with WikiLink (bug 34852)
14961 !! input
14962 <gallery>
14963 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14964 </gallery>
14965 !! result
14966 <ul class="gallery">
14967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14968 <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>
14969 <div class="gallerytext">
14970 <p>caption
14971 </p>
14972 </div>
14973 </div></li>
14974 </ul>
14975
14976 !! end
14977
14978 !!test
14979 Gallery override link with absolute external link (bug 34852)
14980 !! input
14981 <gallery>
14982 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14983 </gallery>
14984 !! result
14985 <ul class="gallery">
14986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14987 <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>
14988 <div class="gallerytext">
14989 <p>caption
14990 </p>
14991 </div>
14992 </div></li>
14993 </ul>
14994
14995 !! end
14996
14997 !!test
14998 Gallery override link with malicious javascript (bug 34852)
14999 !! input
15000 <gallery>
15001 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15002 </gallery>
15003 !! result
15004 <ul class="gallery">
15005 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15006 <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>
15007 <div class="gallerytext">
15008 <p>caption
15009 </p>
15010 </div>
15011 </div></li>
15012 </ul>
15013
15014 !! end
15015
15016 !!test
15017 Gallery with invalid title as link (bug 43964)
15018 !! input
15019 <gallery>
15020 File:foobar.jpg|link=<
15021 </gallery>
15022 !! result
15023 <ul class="gallery">
15024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15025 <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>
15026 <div class="gallerytext">
15027 </div>
15028 </div></li>
15029 </ul>
15030
15031 !! end
15032
15033 !!test
15034 Language parser function
15035 !! input
15036 {{#language:ar}}
15037 !! result
15038 <p>العربية
15039 </p>
15040 !! end
15041
15042 !!test
15043 Padleft and padright as substr
15044 !! input
15045 {{padleft:|3|abcde}}
15046 {{padright:|3|abcde}}
15047 !! result
15048 <p>abc
15049 abc
15050 </p>
15051 !! end
15052
15053 !!test
15054 Special parser function
15055 !! input
15056 {{#special:RandomPage}}
15057 {{#special:BaDtItLe}}
15058 {{#special:Foobar}}
15059 !! result
15060 <p>Special:Random
15061 Special:Badtitle
15062 Special:Foobar
15063 </p>
15064 !! end
15065
15066 !!test
15067 Bug 34939 - Case insensitive link parsing ([HttP://])
15068 !! input
15069 [HttP://MediaWiki.Org/]
15070 !! result
15071 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15072 </p>
15073 !! end
15074
15075 !!test
15076 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15077 !! input
15078 [HttP://MediaWiki.Org/ MediaWiki]
15079 !! result
15080 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15081 </p>
15082 !! end
15083
15084 !!test
15085 Bug 34939 - Case insensitive link parsing (HttP://)
15086 !! input
15087 HttP://MediaWiki.Org/
15088 !! result
15089 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15090 </p>
15091 !! end
15092
15093
15094 ###
15095 ### Parsoids-specific tests
15096 ### Parsoid-PHP parser incompatibilities
15097 ###
15098 !!test
15099 1. SOL-sensitive wikitext tokens as template-args
15100 !!options
15101 parsoid=wt2html,wt2wt
15102 !!input
15103 {{echo|*a}}
15104 {{echo|#a}}
15105 {{echo|:a}}
15106 !!result
15107 <span about="#mwt1" typeof="mw:Transclusion">
15108 </span><ul about="#mwt1"><li>a</li></ul>
15109 <span about="#mwt2" typeof="mw:Transclusion">
15110 </span><ol about="#mwt2"><li>a</li></ol>
15111 <span about="#mwt3" typeof="mw:Transclusion">
15112 </span><dl about="#mwt3"><dd>a</dd></dl>
15113 !!end
15114
15115 #### ----------------------------------------------------------------
15116 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15117 #### tags. Parsoid's output for these tags differs from that of the
15118 #### PHP parser.
15119 #### ----------------------------------------------------------------
15120
15121 !!test
15122 Ref: 1. ref-location should be replaced with an index span
15123 !!options
15124 parsoid
15125 !!input
15126 A <ref>foo</ref>
15127 B <ref name="x">foo</ref>
15128 C <ref name="y" />
15129 !!result
15130 <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>
15131 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>
15132 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>
15133 !!end
15134
15135 !!test
15136 Ref: 2. ref-tags with identical names should all get the same index
15137 !!options
15138 parsoid
15139 !!input
15140 A <ref name="x">foo</ref>
15141 B <ref name="x" />
15142 !!result
15143 <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>
15144 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>
15145 !!end
15146
15147 !!test
15148 Ref: 3. spaces in ref-names should be ignored
15149 !!options
15150 parsoid
15151 !!input
15152 A <ref name="x">foo</ref>
15153 B <ref name=" x " />
15154 C <ref name= x />
15155 !!result
15156 <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>
15157 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>
15158 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>
15159 !!end
15160
15161 !!test
15162 Ref: 4. 'constructor' should be accepted as a valid ref-name
15163 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15164 !!options
15165 parsoid
15166 !!input
15167 A <ref name="constructor">foo</ref>
15168 !!result
15169 <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>
15170 !!end
15171
15172 !!test
15173 Ref: 5. body should accept generic wikitext
15174 !!options
15175 parsoid
15176 !!input
15177 A <ref>
15178 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15179 </ref>
15180
15181 <references />
15182 !!result
15183 <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>
15184
15185 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15186 <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>
15187 </li></ol>
15188 !!end
15189
15190 !!test
15191 Ref: 6. indent-pres should not be output in ref-body
15192 !!options
15193 parsoid
15194 !!input
15195 A <ref>
15196 foo
15197 bar
15198 baz
15199 </ref>
15200
15201 <references />
15202 !!result
15203 <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>
15204
15205 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15206 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15207 bar
15208 baz
15209 </li></ol>
15210 !!end
15211
15212 !!test
15213 Ref: 6. No p-wrapping in ref-body
15214 !!options
15215 parsoid
15216 !!input
15217 A <ref>
15218 foo
15219
15220 bar
15221
15222
15223 baz
15224
15225
15226
15227 booz
15228 </ref>
15229
15230 <references />
15231 !!result
15232 <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>
15233
15234 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15235 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15236
15237 bar
15238
15239
15240 baz
15241
15242
15243
15244 booz
15245 </li></ol>
15246 !!end
15247
15248 !!test
15249 Ref: 8. transclusion wikitext has lower precedence
15250 !!options
15251 parsoid
15252 !!input
15253 A <ref> foo {{echo|</ref> B C}}
15254
15255 <references />
15256 !!result
15257 <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>
15258
15259 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15260 <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>
15261 !!end
15262
15263 !!test
15264 Ref: 9. unclosed comments should not leak out of ref-body
15265 !!options
15266 parsoid
15267 !!input
15268 A <ref> foo <!--</ref> B C
15269
15270 <references />
15271 !!result
15272 <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>
15273
15274 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15275 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15276 !!end
15277
15278 !!test
15279 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15280 !!options
15281 parsoid
15282 !!input
15283 A <ref> <b> foo </ref> B C
15284
15285 <references />
15286 !!result
15287 <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>
15288
15289 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15290 <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>
15291 !!end
15292
15293 !!test
15294 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15295 !!options
15296 parsoid
15297 !!input
15298 A <ref>foo</ref> B
15299 C <ref>bar</ref> D
15300 !!result
15301 <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
15302 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>
15303 !!end
15304
15305 !!test
15306 Ref: 12. ref-tags act as trailing newline migration barrier
15307 !!options
15308 parsoid
15309 !!input
15310 <!--the newline at the end of this line moves out of the p-tag-->a
15311
15312 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15313 <ref />
15314
15315 c
15316 !!result
15317 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15318
15319
15320 <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>
15321 <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>
15322
15323
15324 <p>c</p>
15325 !!end
15326
15327 !!test
15328 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15329 !!options
15330 parsoid
15331 !!input
15332 <ref>foo</ref> A
15333 <ref>bar
15334 </ref> B
15335 !!result
15336 <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
15337 <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>
15338 !!end
15339
15340 !!test
15341 Ref: 14. A nested ref-tag should be emitted as plain text
15342 !!options
15343 parsoid
15344 !!input
15345 <ref>foo <ref>bar</ref> baz</ref>
15346
15347 <references />
15348 !!result
15349 <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>
15350
15351 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15352 <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>
15353 !!end
15354
15355 !!test
15356 Ref: 15. ref-tags with identical names should get identical indexes
15357 !!options
15358 parsoid
15359 !!input
15360 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15361 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15362
15363 <references />
15364 !!result
15365 <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>
15366 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>
15367
15368 <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>
15369 !!end
15370
15371 !!test
15372 References: 1. references tag without any refs should be handled properly
15373 !!options
15374 parsoid
15375 !!input
15376 <references />
15377 !!result
15378 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15379 !!end
15380
15381 !!test
15382 References: 2. references tag with group only outputs references from that group
15383 !!options
15384 parsoid
15385 !!input
15386 A <ref group="a">foo</ref>
15387 B <ref group="b">bar</ref>
15388
15389 <references group='a' />
15390 !!result
15391 <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>
15392 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>
15393
15394 <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>
15395 !!end
15396
15397 !!test
15398 References: 3. ref list should be cleared after processing references
15399 !!options
15400 parsoid
15401 !!input
15402 A <ref>foo</ref>
15403
15404 <references />
15405
15406 B <ref>bar</ref>
15407
15408 <references />
15409 !!result
15410 <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>
15411
15412 <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>
15413
15414 <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>
15415
15416 <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>
15417 !!end
15418
15419 !!test
15420 References: 4. only referenced group should be cleared after processing references
15421 !!options
15422 parsoid
15423 !!input
15424 A <ref group="a">afoo</ref>
15425 B <ref>bfoo</ref>
15426
15427 <references group="a"/>
15428
15429 C <ref>cfoo</ref>
15430
15431 <references />
15432 !!result
15433 <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>
15434 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>
15435
15436 <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>
15437
15438 <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>
15439
15440 <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>
15441 !!end
15442
15443 !!test
15444 References: 5. ref tags in references should be processed while ignoring all other content
15445 !!options
15446 parsoid
15447 !!input
15448 A <ref name="a" />
15449 B <ref name="b">bar</ref>
15450
15451 <references>
15452 <ref name="a">foo</ref>
15453 This should just get lost.
15454 </references>
15455 !!result
15456 <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>
15457 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>
15458
15459 <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>
15460 !!end
15461
15462 !!test
15463 References: 6. <references /> from a transclusion
15464 !!options
15465 parsoid
15466 !!input
15467 {{echo|<references />}}
15468 !!result
15469 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15470 !!end
15471
15472 !! test
15473 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15474 !! options
15475 parsoid
15476 !! input
15477 A <ref>foo bar for a</ref>
15478 B <ref name="b" />
15479
15480 <references />
15481
15482 <references>
15483 <ref name="b">foo</ref>
15484 </references>
15485 !! result
15486 <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>
15487 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>
15488
15489 <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>
15490
15491 <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>
15492
15493 !! end
15494
15495 #### ----------------------------------------------------------------
15496 #### The following section of tests are primarily to test
15497 #### wikitext escaping capabilities of Parsoid. Given that
15498 #### escaping can be done any number of ways, the wikitext (input)
15499 #### is always adjusted to reflect how Parsoid adds nowiki
15500 #### escape tags.
15501 ####
15502 #### We are marking several tests as parsoid-only since the
15503 #### HTML in the result section is different from what the
15504 #### PHP parser generates for it.
15505 #### ----------------------------------------------------------------
15506
15507
15508 #### --------------- Headings ---------------
15509 #### 0. Unnested
15510 #### 1. Nested inside html <h1>=foo=</h1>
15511 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15512 #### 3. Nested inside html with wikitext split by html tags
15513 #### 4. No escape needed
15514 #### 5. Empty headings <h1></h1>
15515 #### 6. Heading chars in SOL context
15516 #### ----------------------------------------
15517 !! test
15518 Headings: 0. Unnested
15519 !! options
15520 parsoid
15521 !! input
15522 <nowiki>=foo=</nowiki>
15523
15524 <nowiki> =foo= </nowiki>
15525 <!--cmt-->
15526 <nowiki>=foo=</nowiki>
15527
15528 =foo''a''<nowiki>=</nowiki>
15529 !! result
15530 <p><span typeof="mw:Nowiki">=foo=</span></p>
15531
15532 <p><span typeof="mw:Nowiki"> =foo= </span>
15533 <!--cmt-->
15534 <span typeof="mw:Nowiki">=foo=</span></p>
15535
15536 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15537 !!end
15538
15539 !! test
15540 Headings: 1. Nested inside html
15541 !! options
15542 parsoid
15543 !! input
15544 =<nowiki>=foo=</nowiki>=
15545
15546 ==<nowiki>=foo=</nowiki>==
15547
15548 ===<nowiki>=foo=</nowiki>===
15549
15550 ====<nowiki>=foo=</nowiki>====
15551
15552 =====<nowiki>=foo=</nowiki>=====
15553
15554 ======<nowiki>=foo=</nowiki>======
15555 !! result
15556 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15557 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15558 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15559 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15560 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15561 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15562 !!end
15563
15564 !! test
15565 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15566 !! options
15567 parsoid
15568 !! input
15569 =foo=
15570 <nowiki>*</nowiki>bar
15571
15572 =foo=
15573 =bar
15574
15575 =foo=
15576 <nowiki>=bar=</nowiki>
15577 !! result
15578 <h1>foo</h1>*bar
15579 <h1>foo</h1>=bar
15580 <h1>foo</h1>=bar=
15581 !!end
15582
15583 !! test
15584 Headings: 3. Nested inside html with wikitext split by html tags
15585 !! options
15586 parsoid
15587 !! input
15588 =='''bold'''<nowiki>foo=</nowiki>=
15589 !! result
15590 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15591 !!end
15592
15593 !! test
15594 Headings: 4a. No escaping needed (testing just h1 and h2)
15595 !! options
15596 parsoid
15597 !! input
15598 ==foo=
15599
15600 =foo==
15601
15602 = =foo= =
15603
15604 ==foo= bar=
15605
15606 ===foo==
15607
15608 ==foo===
15609
15610 =''=''foo==
15611
15612 =<nowiki>=</nowiki>=
15613 !! result
15614 <h1>=foo</h1>
15615 <h1>foo=</h1>
15616 <h1> =foo= </h1>
15617 <h1>=foo= bar</h1>
15618 <h2>=foo</h2>
15619 <h2>foo=</h2>
15620 <h1><i>=</i>foo=</h1>
15621 <h1><span typeof="mw:Nowiki">=</span></h1>
15622 !!end
15623
15624 !! test
15625 Headings: 4b. No escaping needed (inside p-tags)
15626 !! options
15627 parsoid
15628 !! input
15629 ===
15630 =foo= x
15631 =foo= <s></s>
15632 !! result
15633 <p>===
15634 =foo= x
15635 =foo= <s></s>
15636 </p>
15637 !!end
15638
15639 !! test
15640 Headings: 5. Empty headings
15641 !! options
15642 parsoid
15643 !! input
15644 =<nowiki/>=
15645
15646 ==<nowiki/>==
15647
15648 ===<nowiki/>===
15649
15650 ====<nowiki/>====
15651
15652 =====<nowiki/>=====
15653
15654 ======<nowiki/>======
15655 !! result
15656 <h1></h1>
15657 <h2></h2>
15658 <h3></h3>
15659 <h4></h4>
15660 <h5></h5>
15661 <h6></h6>
15662 !!end
15663
15664 !! test
15665 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15666 !! options
15667 parsoid
15668 !! input
15669 <nowiki>=a=</nowiki>
15670
15671 <nowiki>=a=</nowiki>
15672
15673 <nowiki>=a=</nowiki>
15674
15675 <nowiki>=a=</nowiki>
15676 !! result
15677 <p>=a=</p>
15678 <p>=a= </p>
15679 <p>=a= </p>
15680 <p>=a= </p>
15681 !!end
15682
15683 !! test
15684 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15685 !! options
15686 parsoid
15687 !! input
15688 <nowiki>=a=
15689 b</nowiki>
15690
15691 <nowiki>=a=
15692 b</nowiki>
15693
15694 <nowiki>=a=
15695 b</nowiki>
15696
15697 <nowiki>=a=
15698 b</nowiki>
15699 !! result
15700 <p>=a=
15701 b</p>
15702 <p>=a=
15703 b</p>
15704 <p>=a=
15705 b</p>
15706 <p>=a=
15707 b</p>
15708 </p>
15709 !!end
15710
15711 !! test
15712 Headings: 6c. Heading chars in SOL context (leading newline break)
15713 !! options
15714 parsoid
15715 !! input
15716 a
15717 <nowiki>=b=</nowiki>
15718 !! result
15719 <p>a
15720 =b=</p>
15721 !!end
15722
15723 !! test
15724 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15725 !! options
15726 parsoid
15727 !! input
15728 <!--c0--><nowiki>=a=</nowiki>
15729 <!--c1-->
15730 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15731 !! result
15732 <p><!--c0-->=a=</p>
15733 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15734 !!end
15735
15736 !! test
15737 Headings: 6d. Heading chars in SOL context (No escaping needed)
15738 !! options
15739 parsoid=html2wt
15740 !! input
15741 =a=<div>b</div>
15742 !! result
15743 =a=<div>b</div>
15744 !!end
15745
15746 #### --------------- Lists ---------------
15747 #### 0. Outside nests (*foo, etc.)
15748 #### 1. Nested inside html <ul><li>*foo</li></ul>
15749 #### 2. Inside definition lists
15750 #### 3. Only bullets at start should be escaped
15751 #### 4. No escapes needed
15752 #### 5. No unnecessary escapes
15753 #### 6. Escape bullets in SOL position
15754 #### 7. Escape bullets in a multi-line context
15755 #### ----------------------------------------
15756
15757 !! test
15758 Lists: 0. Outside nests
15759 !! input
15760 <nowiki>*</nowiki>foo
15761
15762 <nowiki>#</nowiki>foo
15763 !! result
15764 <p>*foo
15765 </p><p>#foo
15766 </p>
15767 !!end
15768
15769 !! test
15770 Lists: 1. Nested inside html
15771 !! input
15772 *<nowiki>*foo</nowiki>
15773
15774 *<nowiki>#foo</nowiki>
15775
15776 *<nowiki>:foo</nowiki>
15777
15778 *<nowiki>;foo</nowiki>
15779
15780 #<nowiki>*foo</nowiki>
15781
15782 #<nowiki>#foo</nowiki>
15783
15784 #<nowiki>:foo</nowiki>
15785
15786 #<nowiki>;foo</nowiki>
15787 !! result
15788 <ul><li>*foo
15789 </li></ul>
15790 <ul><li>#foo
15791 </li></ul>
15792 <ul><li>:foo
15793 </li></ul>
15794 <ul><li>;foo
15795 </li></ul>
15796 <ol><li>*foo
15797 </li></ol>
15798 <ol><li>#foo
15799 </li></ol>
15800 <ol><li>:foo
15801 </li></ol>
15802 <ol><li>;foo
15803 </li></ol>
15804
15805 !!end
15806
15807 !! test
15808 Lists: 2. Inside definition lists
15809 !! input
15810 ;<nowiki>;foo</nowiki>
15811
15812 ;<nowiki>:foo</nowiki>
15813
15814 ;<nowiki>:foo</nowiki>
15815 :bar
15816
15817 :<nowiki>:foo</nowiki>
15818 !! result
15819 <dl><dt>;foo
15820 </dt></dl>
15821 <dl><dt>:foo
15822 </dt></dl>
15823 <dl><dt>:foo
15824 </dt><dd>bar
15825 </dd></dl>
15826 <dl><dd>:foo
15827 </dd></dl>
15828
15829 !!end
15830
15831 !! test
15832 Lists: 3. Only bullets at start of text should be escaped
15833 !! input
15834 *<nowiki>*foo*bar</nowiki>
15835
15836 *<nowiki>*foo</nowiki>''it''*bar
15837 !! result
15838 <ul><li>*foo*bar
15839 </li></ul>
15840 <ul><li>*foo<i>it</i>*bar
15841 </li></ul>
15842
15843 !!end
15844
15845 !! test
15846 Lists: 4. No escapes needed
15847 !! options
15848 parsoid
15849 !! input
15850 *foo*bar
15851
15852 *''foo''*bar
15853
15854 *[[Foo]]: bar
15855 !! result
15856 <ul><li>foo*bar
15857 </li></ul>
15858 <ul><li><i>foo</i>*bar
15859 </li></ul>
15860 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15861 </li></ul>
15862 !!end
15863
15864 !! test
15865 Lists: 5. No unnecessary escapes
15866 !! input
15867 * bar <span><nowiki>[[foo]]</nowiki></span>
15868
15869 *=bar <span><nowiki>[[foo]]</nowiki></span>
15870
15871 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15872
15873 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15874
15875 *=bar <span>foo]]</span>=
15876
15877 * <s></s>: a
15878 !! result
15879 <ul><li> bar <span>[[foo]]</span>
15880 </li></ul>
15881 <ul><li>=bar <span>[[foo]]</span>
15882 </li></ul>
15883 <ul><li>[[bar <span>[[foo]]</span>
15884 </li></ul>
15885 <ul><li>]]bar <span>[[foo]]</span>
15886 </li></ul>
15887 <ul><li>=bar <span>foo]]</span>=
15888 </li></ul>
15889 <ul><li> <s></s>: a
15890 </li></ul>
15891
15892 !!end
15893
15894 !! test
15895 Lists: 6. Escape bullets in SOL position
15896 !! options
15897 parsoid
15898 !! input
15899 <!--cmt--><nowiki>*foo</nowiki>
15900 !! result
15901 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15902 !!end
15903
15904 !! test
15905 Lists: 7. Escape bullets in a multi-line context
15906 !! input
15907 a
15908 <nowiki>*</nowiki>b
15909 !! result
15910 <p>a
15911 *b
15912 </p>
15913 !!end
15914
15915 #### --------------- HRs ---------------
15916 #### 1. Single line
15917 #### -----------------------------------
15918
15919 !! test
15920 HRs: 1. Single line
15921 !! options
15922 parsoid
15923 !! input
15924 ----<nowiki>----</nowiki>
15925 ----=foo=
15926 ----*foo
15927 !! result
15928 <hr><span typeof="mw:Nowiki">----</span>
15929 <hr>=foo=
15930 <hr>*foo
15931 !! end
15932
15933 #### --------------- Tables ---------------
15934 #### 1a. Simple example
15935 #### 1b. No escaping needed (!foo)
15936 #### 1c. No escaping needed (|foo)
15937 #### 1d. No escaping needed (|}foo)
15938 ####
15939 #### 2a. Nested in td (<td>foo|bar</td>)
15940 #### 2b. Nested in td (<td>foo||bar</td>)
15941 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15942 ####
15943 #### 3a. Nested in th (<th>foo!bar</th>)
15944 #### 3b. Nested in th (<th>foo!!bar</th>)
15945 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15946 ####
15947 #### 4a. Escape -
15948 #### 4b. Escape +
15949 #### 4c. No escaping needed
15950 #### --------------------------------------
15951
15952 !! test
15953 Tables: 1a. Simple example
15954 !! input
15955 <nowiki>{|
15956 |}</nowiki>
15957 !! result
15958 <p>{|
15959 |}
15960 </p>
15961 !! end
15962
15963 !! test
15964 Tables: 1b. No escaping needed
15965 !! input
15966 !foo
15967 !! result
15968 <p>!foo
15969 </p>
15970 !! end
15971
15972 !! test
15973 Tables: 1c. No escaping needed
15974 !! input
15975 |foo
15976 !! result
15977 <p>|foo
15978 </p>
15979 !! end
15980
15981 !! test
15982 Tables: 1d. No escaping needed
15983 !! input
15984 |}foo
15985 !! result
15986 <p>|}foo
15987 </p>
15988 !! end
15989
15990 !! test
15991 Tables: 2a. Nested in td
15992 !! options
15993 parsoid
15994 !! input
15995 {|
15996 |<nowiki>foo|bar</nowiki>
15997 |}
15998 !! result
15999 <table><tbody><tr>
16000 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16001 !! end
16002
16003 !! test
16004 Tables: 2b. Nested in td
16005 !! options
16006 parsoid
16007 !! input
16008 {|
16009 |<nowiki>foo||bar</nowiki>
16010 |''it''<nowiki>foo||bar</nowiki>
16011 |}
16012 !! result
16013 <table><tbody><tr>
16014 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16015 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16016 !! end
16017
16018 !! test
16019 Tables: 2c. Nested in td -- no escaping needed
16020 !! options
16021 parsoid
16022 !! input
16023 {|
16024 |foo!!bar
16025 |}
16026 !! result
16027 <table><tbody><tr><td>foo!!bar
16028 </td></tr></tbody></table>
16029
16030 !! end
16031
16032 !! test
16033 Tables: 3a. Nested in th
16034 !! options
16035 parsoid
16036 !! input
16037 {|
16038 !foo!bar
16039 |}
16040 !! result
16041 <table><tbody><tr><th>foo!bar
16042 </th></tr></tbody></table>
16043
16044 !! end
16045
16046 !! test
16047 Tables: 3b. Nested in th
16048 !! options
16049 parsoid
16050 !! input
16051 {|
16052 !<nowiki>foo!!bar</nowiki>
16053 |}
16054 !! result
16055 <table>
16056 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16057 </tbody></table>
16058 !! end
16059
16060 !! test
16061 Tables: 3c. Nested in th -- no escaping needed
16062 !! options
16063 parsoid
16064 !! input
16065 {|
16066 !<nowiki>foo||bar</nowiki>
16067 |}
16068 !! result
16069 <table><tbody><tr>
16070 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16071 !! end
16072
16073 !! test
16074 Tables: 4a. Escape -
16075 !! options
16076 parsoid
16077 !! input
16078 {|
16079 |-
16080 !-bar
16081 |-
16082 |<nowiki>-bar</nowiki>
16083 |}
16084 !! result
16085 <table><tbody>
16086 <tr><th>-bar</th></tr>
16087 <tr>
16088 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16089 !! end
16090
16091 !! test
16092 Tables: 4b. Escape +
16093 !! options
16094 parsoid
16095 !! input
16096 {|
16097 |-
16098 !+bar
16099 |-
16100 |<nowiki>+bar</nowiki>
16101 |}
16102 !! result
16103 <table><tbody>
16104 <tr><th>+bar</th></tr>
16105 <tr>
16106 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16107 !! end
16108
16109 !! test
16110 Tables: 4c. No escaping needed
16111 !! options
16112 parsoid
16113 !! input
16114 {|
16115 |-
16116 |foo-bar
16117 |foo+bar
16118 |-
16119 |''foo''-bar
16120 |''foo''+bar
16121 |-
16122 |foo
16123 bar|baz
16124 +bar
16125 -bar
16126 |}
16127 !! result
16128 <table><tbody>
16129 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16130 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16131 <tr><td>foo
16132 <p>bar|baz
16133 +bar
16134 -bar</p></td></tr>
16135 </tbody></table>
16136 !! end
16137
16138 ### SSS FIXME: Disabled right now because accurate html2wt
16139 ### on this snippet requires data-parsoid flags that we've
16140 ### stripped out of these tests. We should scheme how we
16141 ### we want to handle these kind of tests that require
16142 ### data-parsoid flags for accurate html2wt serialization
16143
16144 !! test
16145 Tables: 4d. No escaping needed
16146 !! options
16147 disabled
16148 !! input
16149 {|
16150 ||+1
16151 ||-2
16152 |}
16153 !! result
16154 <table>
16155 <tr>
16156 <td>+1
16157 </td>
16158 <td>-2
16159 </td></tr></table>
16160
16161 !! end
16162
16163 #### --------------- Links ----------------
16164 #### 1. Quote marks in link text
16165 #### 2. Wikilinks: Escapes needed
16166 #### 3. Wikilinks: No escapes needed
16167 #### 4. Extlinks: Escapes needed
16168 #### 5. Extlinks: No escapes needed
16169 #### --------------------------------------
16170 !! test
16171 Links 1. Quote marks in link text
16172 !! options
16173 parsoid
16174 !! input
16175 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16176 !! result
16177 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16178 !! end
16179
16180 !! test
16181 Links 2. WikiLinks: Escapes needed
16182 !! options
16183 parsoid
16184 !! input
16185 [[Foo|<nowiki>[Foobar]</nowiki>]]
16186 [[Foo|<nowiki>Foobar]</nowiki>]]
16187 [[Foo|x [Foobar] x]]
16188 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16189 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16190 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16191 [[Foo|<nowiki>|Bar</nowiki>]]
16192 [[Foo|<nowiki>]]bar</nowiki>]]
16193 [[Foo|<nowiki>[[bar</nowiki>]]
16194 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16195 !! result
16196 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16197 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16198 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16199 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16200 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16201 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16202 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16203 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16204 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16205 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16206 !! end
16207
16208 !! test
16209 Links 3. WikiLinks: No escapes needed
16210 !! options
16211 parsoid
16212 !! input
16213 [[Foo|[Foobar]]
16214 [[Foo|foo|bar]]
16215 !! result
16216 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16217 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16218 !! end
16219
16220 !! test
16221 Links 4. ExtLinks: Escapes needed
16222 !! options
16223 parsoid
16224 !! input
16225 [http://google.com <nowiki>[google]</nowiki>]
16226 [http://google.com <nowiki>google]</nowiki>]
16227 !! result
16228 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16229 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16230 !! end
16231
16232 !! test
16233 Links 5. ExtLinks: No escapes needed
16234 !! options
16235 parsoid
16236 !! input
16237 [http://google.com [google]
16238 !! result
16239 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16240 !! end
16241
16242 #### --------------- Quotes ---------------
16243 #### 1. Quotes inside <b> and <i>
16244 #### 2. Link fragments separated by <i> and <b> tags
16245 #### 3. Link fragments inside <i> and <b>
16246 #### 4. No escaping needed
16247 #### --------------------------------------
16248 !! test
16249 1. Quotes inside <b> and <i>
16250 !! options
16251 parsoid=html2wt,wt2wt
16252 !! input
16253 ''<nowiki>'foo'</nowiki>''
16254 ''<nowiki>''foo''</nowiki>''
16255 ''<nowiki>'''foo'''</nowiki>''
16256 ''foo''<nowiki/>'s
16257 '''<nowiki>'foo'</nowiki>'''
16258 '''<nowiki>''foo''</nowiki>'''
16259 '''<nowiki>'''foo'''</nowiki>'''
16260 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16261 '''foo'''<nowiki/>'s
16262 '''foo''
16263 ''foo''<nowiki/>'
16264 '<nowiki/>''foo''<nowiki/>'
16265 ''''foo'''
16266 '''foo'''<nowiki/>'
16267 '<nowiki/>'''foo'''<nowiki/>'
16268 !! result
16269 <p><i>'foo'</i>
16270 <i>''foo''</i>
16271 <i>'''foo'''</i>
16272 <i>foo</i>'s
16273 <b>'foo'</b>
16274 <b>''foo''</b>
16275 <b>'''foo'''</b>
16276 <b>foo'<i>bar'</i>baz</b>
16277 <b>foo</b>'s
16278 '<i>foo</i>
16279 <i>foo</i>'
16280 '<i>foo</i>'
16281 '<b>foo</b>
16282 <b>foo</b>'
16283 '<b>foo</b>'</p>
16284 !! end
16285
16286 !! test
16287 2. Link fragments separated by <i> and <b> tags
16288 !! input
16289 [[''foo''<nowiki>hello]]</nowiki>
16290
16291 [['''foo'''<nowiki>hello]]</nowiki>
16292 !! result
16293 <p>[[<i>foo</i>hello]]
16294 </p><p>[[<b>foo</b>hello]]
16295 </p>
16296 !! end
16297
16298 !! test
16299 3. Link fragments inside <i> and <b>
16300 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16301 this is one of the shortcomings of this format)
16302 !! input
16303 ''[[foo''<nowiki>]]</nowiki>
16304
16305 '''[[foo'''<nowiki>]]</nowiki>
16306 !! result
16307 <p><i>[[foo</i>]]
16308 </p><p><b>[[foo</b>]]
16309 </p>
16310 !! end
16311
16312 !! test
16313 4. No escaping needed
16314 !! input
16315 '<span>''bar''</span>'
16316 '<span>'''bar'''</span>'
16317 !! result
16318 <p>'<span><i>bar</i></span>'
16319 '<span><b>bar</b></span>'
16320 </p>
16321 !! end
16322
16323 #### ----------- Paragraphs ---------------
16324 #### 1. No unnecessary escapes
16325 #### --------------------------------------
16326
16327 !! test
16328 1. No unnecessary escapes
16329 !! input
16330 bar <span><nowiki>[[foo]]</nowiki></span>
16331
16332 =bar <span><nowiki>[[foo]]</nowiki></span>
16333
16334 [[bar <span><nowiki>[[foo]]</nowiki></span>
16335
16336 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16337
16338 =bar <span>foo]]</span><nowiki>=</nowiki>
16339 !! result
16340 <p>bar <span>[[foo]]</span>
16341 </p><p>=bar <span>[[foo]]</span>
16342 </p><p>[[bar <span>[[foo]]</span>
16343 </p><p>]]bar <span>[[foo]]</span>
16344 </p><p>=bar <span>foo]]</span>=
16345 </p>
16346 !!end
16347
16348 #### ----------------------- PRE --------------------------
16349 #### 1. Leading whitespace in SOL context should be escaped
16350 #### ------------------------------------------------------
16351 !! test
16352 1. Leading whitespace in SOL context should be escaped
16353 !! options
16354 parsoid
16355 !! input
16356 <nowiki> </nowiki>a
16357
16358 <nowiki> </nowiki> a
16359
16360 <nowiki> </nowiki>a(tab)
16361
16362 <nowiki> </nowiki> a
16363 <!--cmt-->
16364 <nowiki> </nowiki> a
16365
16366 a
16367 <nowiki> </nowiki>b
16368
16369 a
16370 <nowiki> </nowiki>b
16371
16372 a
16373 <nowiki> </nowiki> b
16374 !! result
16375 <p> a</p>
16376 <p> a</p>
16377 <p> a(tab)</p>
16378 <p> a</p>
16379 <p><!--cmt--> a</p>
16380 <p>a
16381 b</p>
16382 <p>a
16383 b</p>
16384 <p>a
16385 b</p>
16386 !! end
16387
16388 #### --------------- HTML tags ---------------
16389 #### 1. a tags
16390 #### 2. other tags
16391 #### 3. multi-line html tag
16392 #### -----------------------------------------
16393 !! test
16394 1. a tags
16395 !! options
16396 parsoid
16397 !! input
16398 <a href="http://google.com">google</a>
16399 !! result
16400 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16401 !! end
16402
16403 !! test
16404 2. other tags
16405 !! input
16406 <nowiki><div>foo</div>
16407 <div style="color:red">foo</div></nowiki>
16408 !! result
16409 <p>&lt;div&gt;foo&lt;/div&gt;
16410 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16411 </p>
16412 !! end
16413
16414 !! test
16415 3. multi-line html tag
16416 !! input
16417 <nowiki><div
16418 >foo</div
16419 ></nowiki>
16420 !! result
16421 <p>&lt;div
16422 &gt;foo&lt;/div
16423 &gt;
16424 </p>
16425 !! end
16426
16427 !! test
16428 4. extension tags
16429 !! input
16430 <nowiki><ref>foo</ref></nowiki>
16431 !! result
16432 <p>&lt;ref&gt;foo&lt;/ref&gt;
16433 </p>
16434 !! end
16435
16436 #### --------------- Others ---------------
16437 !! test
16438 Escaping nowikis
16439 !! input
16440 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16441 !! result
16442 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16443 </p>
16444 !! end
16445
16446 ## The quote-char in the input is necessary for triggering the bug
16447 !! test
16448 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16449 !! options
16450 parsoid=wt2wt,html2wt
16451 !! input
16452 foo's bar :
16453 !! result
16454 <p>foo's bar :</p>
16455 !! end
16456
16457 !! test
16458
16459 Tag-like HTML structures are passed through as text
16460 !! input
16461 <x y>
16462
16463 <x.y>
16464
16465 <x-y>
16466
16467 1>2
16468
16469 x<y
16470
16471 a>b
16472
16473 1<d e>f
16474 !! result
16475 <p>&lt;x y&gt;
16476 </p><p>&lt;x.y&gt;
16477 </p><p>&lt;x-y&gt;
16478 </p><p>1&gt;2
16479 </p><p>x&lt;y
16480 </p><p>a&gt;b
16481 </p><p>1&lt;d e&gt;f
16482 </p>
16483 !! end
16484
16485
16486 # This was a bug in the PHP parser (see bug 17663 and its dups,
16487 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16488 !! test
16489 Tag names followed by punctuation should not be recognized as tags
16490 !! input
16491 <s.ome> text
16492 !! result
16493 <p>&lt;s.ome&gt; text
16494 </p>
16495 !! end
16496
16497 !! test
16498 HTML tag with necessary entities in attributes
16499 !! input
16500 <span title="&amp;amp;">foo</span>
16501 !! result
16502 <p><span title="&amp;amp;">foo</span>
16503 </p>
16504 !! end
16505
16506 !! test
16507 HTML tag with 'unnecessary' entity encoding in attributes
16508 !! input
16509 <span title="&amp;">foo</span>
16510 !! result
16511 <p><span title="&amp;">foo</span>
16512 </p>
16513 !! end
16514
16515 !! test
16516 HTML tag with broken attribute value quoting
16517 !! input
16518 <span title="Hello world>Foo</span>
16519 !! result
16520 <p><span>Foo</span>
16521 </p>
16522 !! end
16523
16524 !! test
16525 Parsoid-only: HTML tag with broken attribute value quoting
16526 !! options
16527 parsoid
16528 !! input
16529 <span title="Hello world>Foo</span>
16530 !! result
16531 <p><span title="Hello world">Foo</span>
16532 </p>
16533 !! end
16534
16535 !! test
16536 Table with broken attribute value quoting
16537 !! input
16538 {|
16539 | title="Hello world|Foo
16540 |}
16541 !! result
16542 <table>
16543 <tr>
16544 <td>Foo
16545 </td></tr></table>
16546
16547 !! end
16548
16549 !! test
16550 Table with broken attribute value quoting on consecutive lines
16551 !! input
16552 {|
16553 | title="Hello world|Foo
16554 | style="color:red|Bar
16555 |}
16556 !! result
16557 <table>
16558 <tr>
16559 <td>Foo
16560 </td>
16561 <td>Bar
16562 </td></tr></table>
16563
16564 !! end
16565
16566 !! test
16567 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16568 !! options
16569 parsoid
16570 !! input
16571 {|
16572 | title="Hello world|Foo
16573 | style="color:red|Bar
16574 |}
16575 !! result
16576 <table><tbody>
16577 <tr>
16578 <td title="Hello world">Foo
16579 </td><td style="color: red">Bar
16580 </td></tr></tbody></table>
16581
16582 !! end
16583
16584 !! test
16585 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16586 !! options
16587 parsoid
16588 !! input
16589 {{}}
16590 !! result
16591 {{}}
16592 !! end
16593
16594 !! test
16595 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16596 !! options
16597 parsoid
16598 !! input
16599 }}{{
16600 !! result
16601 }}{{
16602 !! end
16603
16604 !!test
16605 Accept empty td cell attribute
16606 !!input
16607 {|
16608 | align="center" | foo || |
16609 |}
16610 !!result
16611 <table>
16612 <tr>
16613 <td align="center"> foo </td>
16614 <td>
16615 </td></tr></table>
16616
16617 !!end
16618
16619 !!test
16620 Non-empty attributes in th-cells
16621 !!input
16622 {|
16623 ! Foo !! style="color: red" | Bar
16624 |}
16625 !!result
16626 <table>
16627 <tr>
16628 <th> Foo </th>
16629 <th style="color: red"> Bar
16630 </th></tr></table>
16631
16632 !!end
16633
16634 !!test
16635 Accept empty attributes in th-cells
16636 !!input
16637 {|
16638 !| foo !!| bar
16639 |}
16640 !!result
16641 <table>
16642 <tr>
16643 <th> foo </th>
16644 <th> bar
16645 </th></tr></table>
16646
16647 !!end
16648
16649 !!test
16650 Empty table rows go away
16651 !!input
16652 {|
16653 | Hello
16654 | there
16655 |- class="foo"
16656 |-
16657 |}
16658 !! result
16659 <table>
16660 <tr>
16661 <td> Hello
16662 </td>
16663 <td> there
16664 </td></tr>
16665
16666 </table>
16667
16668 !! end
16669
16670 ###
16671 ### Parsoid-centric tests for testing RTing of inter-element separators
16672 ### Edge cases not tested by existing parser tests and specific to
16673 ### Parsoid-specific serialization strategies.
16674 ###
16675
16676 !!test
16677 RT-ed inter-element separators should be valid separators
16678 !!input
16679 {|
16680 |- [[foo]]
16681 |}
16682 !!result
16683 <table>
16684
16685 </table>
16686
16687 !!end
16688
16689 !!test
16690 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16691 (Parsoid-only since PHP parser relies on Tidy for correct output)
16692 !!options
16693 parsoid
16694 !!input
16695 {|
16696 |<small>foo
16697 bar
16698 |}
16699
16700 {|
16701 |<small>foo<small>
16702 |}
16703 !!result
16704 !!end
16705
16706 !!test
16707 Empty TD followed by TD with tpl-generated attribute
16708 !!input
16709 {|
16710 |-
16711 |
16712 |{{echo|style='color:red'}}|foo
16713 |}
16714 !!result
16715 <table>
16716
16717 <tr>
16718 <td>
16719 </td>
16720 <td>foo
16721 </td></tr></table>
16722
16723 !!end
16724
16725 !!test
16726 Indented table with an empty td
16727 !!input
16728 {|
16729 |-
16730 |
16731 |foo
16732 |}
16733 !!result
16734 <table>
16735
16736 <tr>
16737 <td>
16738 </td>
16739 <td>foo
16740 </td></tr></table>
16741
16742 !!end
16743
16744 !!test
16745 Empty TR followed by a template-generated TR
16746 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16747 !!options
16748 parsoid=wt2html,wt2wt
16749 !!input
16750 {|
16751 |-
16752 {{echo|<tr><td>foo</td></tr>}}
16753 |}
16754 !!result
16755 <table>
16756 <tbody>
16757 <tr></tr>
16758 <tr typeof="mw:Transclusion">
16759 <td>foo</td></tr></tbody></table>
16760 !!end
16761
16762 ## PHP and parsoid output differ for this, and since this is primarily
16763 ## for testing Parsoid's serializer, marking this Parsoid only
16764 !!test
16765 Empty TR followed by mixed-ws-comment line should RT correctly
16766 !!options
16767 parsoid
16768 !!input
16769 {|
16770 |-
16771 <!--c-->
16772 |-
16773 <!--c--> <!--d-->
16774 |}
16775 !!result
16776 <table>
16777 <tbody>
16778 <tr>
16779 <td> <!--c--></td></tr>
16780 <tr>
16781 <td><!--c--> <!--d--></td></tr>
16782 </tbody></table>
16783
16784 !!end
16785
16786 !!test
16787 Multi-line image caption generated by templates with/without trailing newlines
16788 !!options
16789 parsoid
16790 !!input
16791 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16792 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16793 !!result
16794 <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>
16795 <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>
16796
16797 !!end
16798
16799 ## PHP emits broken html for this, and since this is primarily
16800 ## a Parsoid serializer test, marking this Parsoid only
16801 !!test
16802 Improperly nested inline or quotes tags with whitespace in between
16803 !!options
16804 parsoid
16805 !!input
16806 <span> <s>x</span> </s>
16807 ''' ''x''' ''
16808 !!result
16809 <p><span> <s>x</s></span><s> </s>
16810 <b> <i>x</i></b><i> </i>
16811 </p>
16812 !!end
16813
16814 !!test
16815 Encapsulate protected attributes from wt
16816 !!options
16817 parsoid
16818 !!input
16819 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16820 !!result
16821 <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>
16822 </body>
16823 !!end
16824
16825 # -----------------------------------------------------------------
16826 # The following section of tests are primarily to spec requirements
16827 # around serialization of new/edited content.
16828 #
16829 # All these tests are marked Parsoid html2wt and html2html only
16830 # ----------------------------------------------------------------
16831
16832 !! test
16833 Image: Modifying size of an image
16834 !! options
16835 parsoid=html2wt
16836 !! input
16837 [[Image:Wiki.png|230x230px]]
16838 !! result
16839 <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>
16840 !!end
16841
16842 !! test
16843 Image: New block level image should have \n before and after
16844 !! options
16845 parsoid=html2wt
16846 !! input
16847 123
16848 [[File:Wiki.png|right|thumb|150x150px]]
16849 456
16850 !! result
16851 <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>
16852 !!end
16853
16854 !! test
16855 Lists: Add space after bullets
16856 !! options
16857 parsoid=html2wt
16858 !! input
16859
16860 * foo
16861 * bar
16862 * <span> baz</span>
16863 !! result
16864 <ul>
16865 <li>foo</li>
16866 <li> bar</li>
16867 <li><span> baz</span></li>
16868 </ul>
16869 !! end
16870
16871 !! test
16872 Parsoid: Serialize positional parameters with = in them as named parameter
16873 !! options
16874 parsoid=html2wt
16875 !! input
16876 {{echo|1 = f=oo}}
16877 !! result
16878 <p about="#mwt1" typeof="mw:Transclusion"
16879 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16880 >foo</p>
16881 !! end
16882
16883 # -----------------------------------------------------------------
16884 # End of section for Parsoid-only html2wt tests for serialization
16885 # of new content
16886 # -----------------------------------------------------------------
16887
16888 TODO:
16889 more images
16890 more tables
16891 character entities
16892 and much more
16893 Try for 100% code coverage