Merge "Accessibility: Don't arbitrarily override role"
[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, still stripped-->
194 b
195 ----
196 a
197 <!--foo--> <!----> <!-- bar -->
198 b
199 ----
200 a
201 <!--foo-->
202
203 b
204 ----
205 a
206
207 <!--foo-->
208 b
209 ----
210 a
211 <!--foo-->
212
213
214 b
215 ----
216 a
217
218
219 <!--foo-->
220 b
221 ----
222 !! result
223 <hr />
224 <p>a
225 b
226 </p>
227 <hr />
228 <p>a
229 b
230 </p>
231 <hr />
232 <p>a
233 b
234 </p>
235 <hr />
236 <p>a
237 </p><p>b
238 </p>
239 <hr />
240 <p>a
241 </p><p>b
242 </p>
243 <hr />
244 <p>a
245 </p><p><br />
246 b
247 </p>
248 <hr />
249 <p>a
250 </p><p><br />
251 b
252 </p>
253 <hr />
254
255 !! end
256
257 !! test
258 Paragraphs with newline spacing with non-empty white-space lines in between
259 !! input
260 ----
261 a
262
263 b
264 ----
265 a
266
267
268 b
269 ----
270 !! result
271 <hr />
272 <p>a
273 </p><p>b
274 </p>
275 <hr />
276 <p>a
277 </p><p><br />
278 b
279 </p>
280 <hr />
281
282 !! end
283
284 !! test
285 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
286 !! input
287 ----
288 a
289 <!--foo-->
290 b
291 ----
292 a
293 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
294 b
295 ----
296 a
297
298 <!--foo-->
299 <!--bar-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306
307 b
308 ----
309 !! result
310 <hr />
311 <p>a
312 b
313 </p>
314 <hr />
315 <p>a
316 b
317 </p>
318 <hr />
319 <p>a
320 </p><p>b
321 </p>
322 <hr />
323 <p>a
324 </p><p><br />
325 b
326 </p>
327 <hr />
328
329 !! end
330
331 !! test
332 Extra newlines: More paragraphs with indented comment
333 !! input
334 a
335
336 <!--boo-->
337
338 b
339 !!result
340 <p>a
341 </p><p><br />
342 b
343 </p>
344 !!end
345
346 !! test
347 Extra newlines followed by heading
348 !! input
349 a
350
351
352
353 =b=
354 [[a]]
355
356
357 =b=
358 !! result
359 <p>a
360 </p><p><br />
361 </p>
362 <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>
363 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
364 </p><p><br />
365 </p>
366 <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>
367
368 !! end
369
370 !! test
371 Extra newlines between heading and content are swallowed
372 !! input
373 =b=
374
375
376
377 [[a]]
378 !! result
379 <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>
380 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
381 </p>
382 !! end
383
384 !! test
385 Parsing an URL
386 !! input
387 http://fr.wikipedia.org/wiki/🍺
388 <!-- EasterEgg we love beer, better be able be able to link to it -->
389 !! result
390 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
391 </p>
392 !! end
393
394 !! test
395 Simple list
396 !! input
397 * Item 1
398 * Item 2
399 !! result
400 <ul><li> Item 1
401 </li><li> Item 2
402 </li></ul>
403
404 !! end
405
406 !! test
407 Italics and bold
408 !! input
409 * plain
410 * plain''italic''plain
411 * plain''italic''plain''italic''plain
412 * plain'''bold'''plain
413 * plain'''bold'''plain'''bold'''plain
414 * plain''italic''plain'''bold'''plain
415 * plain'''bold'''plain''italic''plain
416 * plain''italic'''bold-italic'''italic''plain
417 * plain'''bold''bold-italic''bold'''plain
418 * plain'''''bold-italic'''italic''plain
419 * plain'''''bold-italic''bold'''plain
420 * plain''italic'''bold-italic'''''plain
421 * plain'''bold''bold-italic'''''plain
422 * plain l'''italic''plain
423 * plain l''''bold''' plain
424 !! result
425 <ul><li> plain
426 </li><li> plain<i>italic</i>plain
427 </li><li> plain<i>italic</i>plain<i>italic</i>plain
428 </li><li> plain<b>bold</b>plain
429 </li><li> plain<b>bold</b>plain<b>bold</b>plain
430 </li><li> plain<i>italic</i>plain<b>bold</b>plain
431 </li><li> plain<b>bold</b>plain<i>italic</i>plain
432 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
433 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
434 </li><li> plain<i><b>bold-italic</b>italic</i>plain
435 </li><li> plain<b><i>bold-italic</i>bold</b>plain
436 </li><li> plain<i>italic<b>bold-italic</b></i>plain
437 </li><li> plain<b>bold<i>bold-italic</i></b>plain
438 </li><li> plain l'<i>italic</i>plain
439 </li><li> plain l'<b>bold</b> plain
440 </li></ul>
441
442 !! end
443
444 # this example taken from the simple/Moon article
445 !! test
446 Italics and possessives
447 !! input
448 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
449 !! result
450 <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
451 </p>
452 !! end
453
454 ###
455 ### 2-quote opening sequence tests
456 ###
457 !! test
458 Italics and bold: 2-quote opening sequence: (2,2)
459 !! input
460 ''foo''
461 !! result
462 <p><i>foo</i>
463 </p>
464 !!end
465
466
467 !! test
468 Italics and bold: 2-quote opening sequence: (2,3)
469 !! input
470 ''foo'''
471 !! result
472 <p><i>foo'</i>
473 </p>
474 !!end
475
476
477 !! test
478 Italics and bold: 2-quote opening sequence: (2,4)
479 !! input
480 ''foo''''
481 !! result
482 <p><i>foo''</i>
483 </p>
484 !!end
485
486
487 !! test
488 Italics and bold: 2-quote opening sequence: (2,5) (php)
489 !! options
490 php
491 !! input
492 ''foo'''''
493 !! result
494 <p><i>foo</i>
495 </p>
496 !!end
497 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
498 !! test
499 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
500 !! options
501 parsoid
502 !! input
503 ''foo'''''
504 !! result
505 <p><i>foo</i><b></b>
506 </p>
507 !!end
508
509
510 ###
511 ### 3-quote opening sequence tests
512 ###
513
514 !! test
515 Italics and bold: 3-quote opening sequence: (3,2)
516 !! input
517 '''foo''
518 !! result
519 <p>'<i>foo</i>
520 </p>
521 !!end
522
523
524 !! test
525 Italics and bold: 3-quote opening sequence: (3,3)
526 !! input
527 '''foo'''
528 !! result
529 <p><b>foo</b>
530 </p>
531 !!end
532
533
534 !! test
535 Italics and bold: 3-quote opening sequence: (3,4)
536 !! input
537 '''foo''''
538 !! result
539 <p><b>foo'</b>
540 </p>
541 !!end
542
543
544 !! test
545 Italics and bold: 3-quote opening sequence: (3,5) (php)
546 !! options
547 php
548 !! input
549 '''foo'''''
550 !! result
551 <p><b>foo</b>
552 </p>
553 !!end
554 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
555 !! test
556 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
557 !! options
558 parsoid
559 !! input
560 '''foo'''''
561 !! result
562 <p><b>foo<i></i></b>
563 </p>
564 !!end
565
566
567 ###
568 ### 4-quote opening sequence tests
569 ###
570
571 !! test
572 Italics and bold: 4-quote opening sequence: (4,2)
573 !! input
574 ''''foo''
575 !! result
576 <p>''<i>foo</i>
577 </p>
578 !!end
579
580
581 !! test
582 Italics and bold: 4-quote opening sequence: (4,3)
583 !! input
584 ''''foo'''
585 !! result
586 <p>'<b>foo</b>
587 </p>
588 !!end
589
590
591 !! test
592 Italics and bold: 4-quote opening sequence: (4,4)
593 !! input
594 ''''foo''''
595 !! result
596 <p>'<b>foo'</b>
597 </p>
598 !!end
599
600
601 !! test
602 Italics and bold: 4-quote opening sequence: (4,5) (php)
603 !! options
604 php
605 !! input
606 ''''foo'''''
607 !! result
608 <p>'<b>foo</b>
609 </p>
610 !!end
611 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
612 !! test
613 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
614 !! options
615 parsoid
616 !! input
617 ''''foo'''''
618 !! result
619 <p>'<b>foo<i></i></b>
620 </p>
621 !!end
622
623
624 ###
625 ### 5-quote opening sequence tests
626 ###
627
628 !! test
629 Italics and bold: 5-quote opening sequence: (5,2) (php)
630 !! options
631 php
632 !! input
633 '''''foo''
634 !! result
635 <p><b><i>foo</i></b>
636 </p>
637 !!end
638 # Parsoid reverses the nesting order, compared to the PHP parser
639 !! test
640 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
641 !! options
642 parsoid
643 !! input
644 '''''foo''
645 !! result
646 <p><i><b>foo</b></i>
647 </p>
648 !!end
649
650
651 !! test
652 Italics and bold: 5-quote opening sequence: (5,3)
653 !! input
654 '''''foo'''
655 !! result
656 <p><i><b>foo</b></i>
657 </p>
658 !!end
659
660
661 !! test
662 Italics and bold: 5-quote opening sequence: (5,4)
663 !! input
664 '''''foo''''
665 !! result
666 <p><i><b>foo'</b></i>
667 </p>
668 !!end
669
670
671 !! test
672 Italics and bold: 5-quote opening sequence: (5,5)
673 !! input
674 '''''foo'''''
675 !! result
676 <p><i><b>foo</b></i>
677 </p>
678 !!end
679
680 ###
681 ### multiple quote sequences in a line
682 ###
683 !! test
684 Italics and bold: multiple quote sequences: (2,4,2)
685 !! input
686 ''foo''''bar''
687 !! result
688 <p><i>foo'<b>bar</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: multiple quote sequences: (2,4,3)
695 !! input
696 ''foo''''bar'''
697 !! result
698 <p><i>foo'<b>bar</b></i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: multiple quote sequences: (2,4,4)
705 !! input
706 ''foo''''bar''''
707 !! result
708 <p><i>foo'<b>bar'</b></i>
709 </p>
710 !!end
711
712
713 !! test
714 Italics and bold: multiple quote sequences: (3,4,2) (php)
715 !! options
716 php
717 !! input
718 '''foo''''bar''
719 !! result
720 <p><b>foo'</b>bar
721 </p>
722 !!end
723 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
724 !! test
725 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
726 !! options
727 parsoid
728 !! input
729 '''foo''''bar''
730 !! result
731 <p><b>foo'</b>bar<i></i>
732 </p>
733 !!end
734
735
736 !! test
737 Italics and bold: multiple quote sequences: (3,4,3) (php)
738 !! options
739 php
740 !! input
741 '''foo''''bar'''
742 !! result
743 <p><b>foo'</b>bar
744 </p>
745 !!end
746 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
747 !! test
748 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
749 !! options
750 parsoid
751 !! input
752 '''foo''''bar'''
753 !! result
754 <p><b>foo'</b>bar<b></b>
755 </p>
756 !!end
757
758 ###
759 ### other quote tests
760 ###
761 !! test
762 Italics and bold: other quote tests: (2,3,5)
763 !! input
764 ''this is about '''foo's family'''''
765 !! result
766 <p><i>this is about <b>foo's family</b></i>
767 </p>
768 !!end
769
770
771 !! test
772 Italics and bold: other quote tests: (2,(3,3),2)
773 !! input
774 ''this is about '''foo's''' family''
775 !! result
776 <p><i>this is about <b>foo's</b> family</i>
777 </p>
778 !!end
779
780
781 !! test
782 Italics and bold: other quote tests: (3,2,3,2)
783 !! input
784 '''this is about ''foo'''s family''
785 !! result
786 <p><b>this is about <i>foo</i></b><i>s family</i>
787 </p>
788 !!end
789
790
791 # The Parsoid team believes the PHP parser's output on this test is wrong.
792 # It only checks for convert-to-bold-on-single-character-word when the word
793 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
794 # This means that the bold token in position 2 (0-indexed) gets converted by
795 # parsoid, but doesn't get changed by the PHP parser.
796 !! test
797 Italics and bold: other quote tests: (3,2,3,3) (php)
798 !! options
799 php
800 !! input
801 '''this is about ''foo'''s family'''
802 !! result
803 <p>'<i>this is about </i>foo<b>s family</b>
804 </p>
805 !!end
806 # This is the output the Parsoid team believes to be correct.
807 !! test
808 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
809 !! options
810 parsoid
811 !! input
812 '''this is about ''foo'''s family'''
813 !! result
814 <p><b>this is about <i>foo'</i>s family</b>
815 </p>
816 !!end
817
818
819 !! test
820 Italics and bold: other quote tests: (3,(2,2),3)
821 !! input
822 '''this is about ''foo's'' family'''
823 !! result
824 <p><b>this is about <i>foo's</i> family</b>
825 </p>
826 !!end
827
828
829 !! test
830 Italicized possessive
831 !! input
832 The ''[[Main Page]]'''s talk page.
833 !! result
834 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
835 </p>
836 !! end
837
838 !! test
839 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
840 (Requires tidy for PHP parser output to be fixed up)
841 !! options
842 parsoid=wt2html,wt2wt
843 !! input
844 {|
845 !''a!!''b
846 |''a||''b
847 |}
848 !! result
849 <table>
850 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
851 <td><i>a</i></td><td><i>b</i></td></tr>
852 </tbody></table>
853 !! end
854
855 ###
856 ### Non-html5 tags
857 ###
858
859 !! test
860 Non-html5 tags should be accepted
861 !! input
862 <center>''foo''</center>
863 <big>''foo''</big>
864 <font>''foo''</font>
865 <strike>''foo''</strike>
866 <tt>''foo''</tt>
867 !! result
868 <center><i>foo</i></center>
869 <p><big><i>foo</i></big>
870 <font><i>foo</i></font>
871 <strike><i>foo</i></strike>
872 <tt><i>foo</i></tt>
873 </p>
874 !! end
875
876 !! test
877 <wbr> is valid wikitext (bug 52468)
878 !! input
879 <wbr>
880 !! result
881 <p><wbr />
882 </p>
883 !! end
884
885 # <strike> is HTML4, <s> is HTML4/5.
886 !! test
887 <s> or <strike> for strikethrough
888 !! input
889 <strike>strike</strike>
890
891 <s>s</s>
892 !! result
893 <p><strike>strike</strike>
894 </p><p><s>s</s>
895 </p>
896 !! end
897
898 !! test
899 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
900 !! input
901 <b→> doesn't work! </b>
902
903 <bä> doesn't work! </b>
904
905 <boo> works fine </b>
906
907 <s.foo>foo</s>
908
909 <s.foo>s.foo</s.foo>
910
911 <sub-ID#1>
912 !! result
913 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
914 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
915 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
916 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
917 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
918 </p><p>&lt;sub-ID#1&gt;
919 </p>
920 !! end
921
922 ###
923 ### Special characters
924 ###
925
926 !! test
927 Bare pipe character (bug 52363)
928 !! input
929 |
930 !! result
931 <p>|
932 </p>
933 !! end
934
935 !! test
936 Bare pipe character from a template (bug 52363)
937 !! input
938 {{pipe}}
939 !! result
940 <p>|
941 </p>
942 !! end
943
944 ###
945 ### <nowiki> test cases
946 ###
947
948 !! test
949 <nowiki> unordered list
950 !! input
951 <nowiki>* This is not an unordered list item.</nowiki>
952 !! result
953 <p>* This is not an unordered list item.
954 </p>
955 !! end
956
957 !! test
958 <nowiki> spacing
959 !! input
960 <nowiki>Lorem ipsum dolor
961
962 sed abit.
963 sed nullum.
964
965 :and a colon
966 </nowiki>
967 !! result
968 <p>Lorem ipsum dolor
969
970 sed abit.
971 sed nullum.
972
973 :and a colon
974
975 </p>
976 !! end
977
978 !! test
979 nowiki 3
980 !! input
981 :There is not nowiki.
982 :There is <nowiki>nowiki</nowiki>.
983
984 #There is not nowiki.
985 #There is <nowiki>nowiki</nowiki>.
986
987 *There is not nowiki.
988 *There is <nowiki>nowiki</nowiki>.
989 !! result
990 <dl><dd>There is not nowiki.
991 </dd><dd>There is nowiki.
992 </dd></dl>
993 <ol><li>There is not nowiki.
994 </li><li>There is nowiki.
995 </li></ol>
996 <ul><li>There is not nowiki.
997 </li><li>There is nowiki.
998 </li></ul>
999
1000 !! end
1001
1002 !! test
1003 Entities inside <nowiki>
1004 !! input
1005 <nowiki>&lt;</nowiki>
1006 !! result
1007 <p>&lt;
1008 </p>
1009 !! end
1010
1011 !! test
1012 Entities inside template parameters
1013 !! options
1014 parsoid
1015 !! input
1016 {{echo|&ndash;}}
1017 !! result
1018 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
1019 </p>
1020 !! end
1021
1022 ###
1023 ### Comments
1024 ###
1025 !! test
1026 Comments and Indent-Pre
1027 !! input
1028 <!-- comment 1 --> asdf
1029
1030 <!-- comment 1 --> asdf
1031 <!-- comment 2 -->
1032
1033 <!-- comment 1 --> asdf
1034 <!-- comment 2 -->xyz
1035
1036 <!-- comment 1 --> asdf
1037 <!-- comment 2 --> xyz
1038 !! result
1039 <pre>asdf
1040 </pre>
1041 <pre>asdf
1042 </pre>
1043 <pre>asdf
1044 </pre>
1045 <p>xyz
1046 </p>
1047 <pre>asdf
1048 xyz
1049 </pre>
1050 !! end
1051
1052 !! test
1053 Comment test 2a
1054 !! input
1055 asdf
1056 <!-- comment 1 -->
1057 jkl
1058 !! result
1059 <p>asdf
1060 jkl
1061 </p>
1062 !! end
1063
1064 !! test
1065 Comment test 2b
1066 !! input
1067 asdf
1068 <!-- comment 1 -->
1069
1070 jkl
1071 !! result
1072 <p>asdf
1073 </p><p>jkl
1074 </p>
1075 !! end
1076
1077 !! test
1078 Comment test 3
1079 !! input
1080 asdf
1081 <!-- comment 1 -->
1082 <!-- comment 2 -->
1083 jkl
1084 !! result
1085 <p>asdf
1086 jkl
1087 </p>
1088 !! end
1089
1090 !! test
1091 Comment test 4
1092 !! input
1093 asdf<!-- comment 1 -->jkl
1094 !! result
1095 <p>asdfjkl
1096 </p>
1097 !! end
1098
1099 !! test
1100 Comment spacing
1101 !! input
1102 a
1103 <!-- foo --> b <!-- bar -->
1104 c
1105 !! result
1106 <p>a
1107 </p>
1108 <pre> b
1109 </pre>
1110 <p>c
1111 </p>
1112 !! end
1113
1114 !! test
1115 Comment whitespace
1116 !! input
1117 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1118 !! result
1119
1120 !! end
1121
1122 !! test
1123 Comment semantics and delimiters
1124 !! input
1125 <!-- --><!----><!-----><!------>
1126 !! result
1127
1128 !! end
1129
1130 !! test
1131 Comment semantics and delimiters, redux
1132 !! input
1133 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1134 -- foo -- funky huh? ... -->
1135 !! result
1136
1137 !! end
1138
1139 !! test
1140 Comment semantics and delimiters: directors cut
1141 !! input
1142 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1143 everything starting with < followed by !-- until the first -- and > we see,
1144 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1145 -->-->
1146 !! result
1147 <p>--&gt;
1148 </p>
1149 !! end
1150
1151 !! test
1152 Comment semantics: nesting
1153 !! input
1154 <!--<!-- no, we're not going to do anything fancy here -->-->
1155 !! result
1156 <p>--&gt;
1157 </p>
1158 !! end
1159
1160 !! test
1161 Comment semantics: unclosed comment at end
1162 !! input
1163 <!--This comment will run out to the end of the document
1164 !! result
1165
1166 !! end
1167
1168 !! test
1169 Comment in template title
1170 !! input
1171 {{f<!---->oo}}
1172 !! result
1173 <p>FOO
1174 </p>
1175 !! end
1176
1177 !! test
1178 Comment on its own line post-expand
1179 !! input
1180 a
1181 {{blank}}<!---->
1182 b
1183 !! result
1184 <p>a
1185 </p><p>b
1186 </p>
1187 !! end
1188
1189 !! test
1190 Comment on its own line post-expand with non-significant whitespace
1191 !! input
1192 a
1193 {{blank}} <!---->
1194 b
1195 !! result
1196 <p>a
1197 </p><p>b
1198 </p>
1199 !! end
1200
1201 ###
1202 ### paragraph wrapping tests
1203 ###
1204 !! test
1205 No block tags
1206 !! input
1207 a
1208
1209 b
1210 !! result
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215 !! test
1216 Block tag on one line
1217 !! input
1218 a <div>foo</div>
1219
1220 b
1221 !! result
1222 a <div>foo</div>
1223 <p>b
1224 </p>
1225 !! end
1226
1227 !! test
1228 Block tag on both lines
1229 !! input
1230 a <div>foo</div>
1231
1232 b <div>foo</div>
1233 !! result
1234 a <div>foo</div>
1235 b <div>foo</div>
1236
1237 !! end
1238
1239 !! test
1240 Multiple lines without block tags
1241 !! input
1242 <div>foo</div> a
1243 b
1244 c
1245 d<!--foo--> e
1246 x <div>foo</div> z
1247 !! result
1248 <div>foo</div> a
1249 <p>b
1250 c
1251 d e
1252 </p>
1253 x <div>foo</div> z
1254
1255 !! end
1256
1257 !! test
1258 Empty lines between lines with block tags
1259 !! input
1260 <div></div>
1261
1262
1263 <div></div>a
1264
1265 b
1266 <div>a</div>b
1267
1268 <div>b</div>d
1269
1270
1271 <div>e</div>
1272 !! result
1273 <div></div>
1274 <p><br />
1275 </p>
1276 <div></div>a
1277 <p>b
1278 </p>
1279 <div>a</div>b
1280 <div>b</div>d
1281 <p><br />
1282 </p>
1283 <div>e</div>
1284
1285 !! end
1286
1287 ###
1288 ### Preformatted text
1289 ###
1290 !! test
1291 Preformatted text
1292 !! input
1293 This is some
1294 Preformatted text
1295 With ''italic''
1296 And '''bold'''
1297 And a [[Main Page|link]]
1298 !! result
1299 <pre>This is some
1300 Preformatted text
1301 With <i>italic</i>
1302 And <b>bold</b>
1303 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1304 </pre>
1305 !! end
1306
1307 !! test
1308 Ident preformatting with inline content
1309 !! input
1310 a
1311 ''b''
1312 !! result
1313 <pre>a
1314 <i>b</i>
1315 </pre>
1316 !! end
1317
1318 !! test
1319 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1320 !! input
1321 <pre><nowiki>
1322 <b>
1323 <cite>
1324 <em>
1325 </nowiki></pre>
1326 !! result
1327 <pre>
1328 &lt;b&gt;
1329 &lt;cite&gt;
1330 &lt;em&gt;
1331 </pre>
1332
1333 !! end
1334
1335 !! test
1336 Regression with preformatted in <center>
1337 !! input
1338 <center>
1339 Blah
1340 </center>
1341 !! result
1342 <center>
1343 <pre>Blah
1344 </pre>
1345 </center>
1346
1347 !! end
1348
1349 !! test
1350 Bug 6200: Preformatted in <blockquote>
1351 !! input
1352 <blockquote>
1353 Blah
1354 </blockquote>
1355 !! result
1356 <blockquote>
1357 <pre>Blah
1358 </pre>
1359 </blockquote>
1360
1361 !! end
1362
1363 !! test
1364 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1365 !! input
1366 <blockquote>
1367 Foo
1368
1369 Bar
1370 </blockquote>
1371 !! result
1372 <blockquote>
1373 <p>Foo
1374 </p><p>Bar
1375 </p>
1376 </blockquote>
1377
1378 !! end
1379
1380 !! test
1381 Bug 15491: <ins>/<del> in blockquote
1382 !! input
1383 <blockquote>
1384 Foo <del>bar</del> <ins>baz</ins> quux
1385 </blockquote>
1386 !! result
1387 <blockquote>
1388 <p>Foo <del>bar</del> <ins>baz</ins> quux
1389 </p>
1390 </blockquote>
1391
1392 !! end
1393
1394 # Note that the p-wrapping is newline sensitive, which could be
1395 # considered a bug: tidy will wrap only the 'Foo' in the example
1396 # below in a <p> tag. (see comment 23-25 of bug #6200)
1397 !! test
1398 Bug 15491: <ins>/<del> in blockquote (2)
1399 !! input
1400 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1401 </blockquote>
1402 !! result
1403 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1404 </blockquote>
1405
1406 !! end
1407
1408 !! test
1409 <pre> with attributes (bug 3202)
1410 !! input
1411 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1412 !! result
1413 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1414
1415 !! end
1416
1417 !! test
1418 <pre> with width attribute (bug 3202)
1419 !! input
1420 <pre width="8">Narrow screen goodies</pre>
1421 !! result
1422 <pre width="8">Narrow screen goodies</pre>
1423
1424 !! end
1425
1426 !! test
1427 <pre> with forbidden attribute (bug 3202)
1428 !! input
1429 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1430 !! result
1431 <pre width="8">Narrow screen goodies</pre>
1432
1433 !! end
1434
1435 !! test
1436 Entities inside <pre>
1437 !! input
1438 <pre>&lt;</pre>
1439 !! result
1440 <pre>&lt;</pre>
1441
1442 !! end
1443
1444 !! test
1445 <pre> with forbidden attribute values (bug 3202)
1446 !! input
1447 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1448 !! result
1449 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1450
1451 !! end
1452
1453 !! test
1454 <nowiki> inside <pre> (bug 13238)
1455 !! input
1456 <pre>
1457 <nowiki>
1458 </pre>
1459 <pre>
1460 <nowiki></nowiki>
1461 </pre>
1462 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1463 !! result
1464 <pre>
1465 &lt;nowiki&gt;
1466 </pre>
1467 <pre>
1468
1469 </pre>
1470 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1471
1472 !! end
1473
1474 !! test
1475 <nowiki> and <pre> preference (first one wins)
1476 !! input
1477 <pre>
1478 <nowiki>
1479 </pre>
1480 </nowiki>
1481 </pre>
1482
1483 <nowiki>
1484 <pre>
1485 <nowiki>
1486 </pre>
1487 </nowiki>
1488 </pre>
1489
1490 !! result
1491 <pre>
1492 &lt;nowiki&gt;
1493 </pre>
1494 <p>&lt;/nowiki&gt;
1495 &lt;/pre&gt;
1496 </p><p>
1497 &lt;pre&gt;
1498 &lt;nowiki&gt;
1499 &lt;/pre&gt;
1500
1501 &lt;/pre&gt;
1502 </p>
1503 !! end
1504
1505 !! test
1506 </pre> inside nowiki
1507 !! input
1508 <nowiki></pre></nowiki>
1509 !! result
1510 <p>&lt;/pre&gt;
1511 </p>
1512 !! end
1513
1514 !!test
1515 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1516 !!input
1517 {{echo|}}
1518 !!result
1519
1520 !!end
1521
1522 !!test
1523 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1524 !!input
1525 {{echo|
1526 foo}}
1527 !!result
1528 <p>foo
1529 </p>
1530 !!end
1531
1532 !! test
1533 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1534 !! input
1535 {{echo|a
1536 b}}
1537 !!result
1538 <pre>a
1539 </pre>
1540 <p>b
1541 </p>
1542 !!end
1543
1544 !! test
1545 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1546 !! input
1547 {{echo|a
1548 b
1549 c
1550 d
1551 e
1552 }}
1553 !!result
1554 <pre>a
1555 </pre>
1556 <p>b
1557 c
1558 </p>
1559 <pre>d
1560 </pre>
1561 <p>e
1562 </p>
1563 !!end
1564
1565 !!test
1566 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1567 !!input
1568 {{echo| foo}}
1569
1570 {{echo| foo}}{{echo| bar}}
1571
1572 {{echo| foo}}
1573 {{echo| bar}}
1574
1575 {{echo|<!--cmt--> foo}}
1576
1577 <!--cmt-->{{echo| foo}}
1578
1579 {{echo|{{echo| }}bar}}
1580 !!result
1581 <pre>foo
1582 </pre>
1583 <pre>foo bar
1584 </pre>
1585 <pre>foo
1586 bar
1587 </pre>
1588 <pre>foo
1589 </pre>
1590 <pre>foo
1591 </pre>
1592 <pre>bar
1593 </pre>
1594 !!end
1595
1596 !! test
1597 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1598 !! input
1599 {{echo| }}a
1600
1601 {{echo|
1602 }}a
1603
1604 {{echo|
1605 b}}
1606
1607 {{echo|a
1608 }}b
1609
1610 {{echo|a
1611 }} b
1612 !!result
1613 <pre>a
1614 </pre>
1615 <p><br />
1616 </p>
1617 <pre>a
1618 </pre>
1619 <p><br />
1620 </p>
1621 <pre>b
1622 </pre>
1623 <p>a
1624 </p>
1625 <pre>b
1626 </pre>
1627 <p>a
1628 </p>
1629 <pre>b
1630 </pre>
1631 !!end
1632
1633 !! test
1634 Templates: Single-line variant of parameter whitespace stripping test
1635 !! input
1636 {{echo| a}}
1637
1638 {{echo|1= a}}
1639
1640 {{echo|{{echo| a}}}}
1641
1642 {{echo|1={{echo| a}}}}
1643 !! result
1644 <pre>a
1645 </pre>
1646 <p>a
1647 </p>
1648 <pre>a
1649 </pre>
1650 <p>a
1651 </p>
1652 !! end
1653
1654 !! test
1655 Templates: Strip whitespace from named parameters, but not positional ones
1656 !! input
1657 {{echo|
1658 foo}}
1659
1660 {{echo|
1661 * foo}}
1662
1663 {{echo| 1 =
1664 foo}}
1665
1666 {{echo| 1 =
1667 * foo}}
1668 !! result
1669 <pre>foo
1670 </pre>
1671 <p><br />
1672 </p>
1673 <ul><li> foo
1674 </li></ul>
1675 <p>foo
1676 </p>
1677 <ul><li> foo
1678 </li></ul>
1679
1680 !! end
1681
1682 !! test
1683 Templates: Dont strip whitespace from whitespace/comment-only arguments
1684 !! input
1685 {{echo| }}
1686 {{echo|<!--cmt-->}}
1687 {{echo| <!--cmt--> }}
1688 !! result
1689 <p><br />
1690 </p>
1691 !! end
1692
1693 !! test
1694 Templates: Parsoid parameter escaping test 1
1695 !! options
1696 parsoid
1697 !! input
1698 {{echo|[foo]|{{echo|[bar]}}}}
1699 !! result
1700 <p about="#mwt1" typeof="mw:Transclusion"
1701 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>
1702 !! end
1703
1704 !! test
1705 Parsoid: Pipes in external links in template parameter
1706 !! options
1707 parsoid
1708 !! input
1709 {{echo|[{{echo|http://example.com}} link]}}
1710 !! result
1711 <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>
1712 !! end
1713
1714 !! test
1715 Parsoid: pipe in transclusion parameter
1716 !! options
1717 parsoid
1718 !! input
1719 {{echo|http://foo.com/a&#124;b}}
1720 !! result
1721 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1722 typeof="mw:Transclusion"
1723 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>
1724 !! end
1725
1726 !! test
1727 Parsoid: Pipe in external link target and content in template parameter
1728 !! options
1729 parsoid=html2wt,wt2wt
1730 !! input
1731 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1732 !! result
1733 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1734 typeof="mw:Transclusion"
1735 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1736 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1737 !! end
1738
1739 !! test
1740 Templates: Dont escape already nowiki-escaped text in template parameters
1741 !! options
1742 parsoid=html2wt,wt2wt
1743 !! input
1744 {{echo|foo<nowiki>|</nowiki>bar}}
1745 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1746 {{echo|<nowiki></nowiki>}}
1747 !! result
1748 <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>
1749 <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>
1750 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1751 </p>
1752 !! end
1753
1754 ###
1755 ### Parsoid-centric tests for testing RT edge cases for pre
1756 ###
1757
1758 !!test
1759 1a. Indent-Pre and Comments
1760 !!input
1761 a
1762 <!--a-->
1763 c
1764 !!result
1765 <pre>a
1766 </pre>
1767 <p>c
1768 </p>
1769 !!end
1770
1771 !!test
1772 1b. Indent-Pre and Comments
1773 !!input
1774 a
1775 <!--a-->
1776 c
1777 !!result
1778 <pre>a
1779 </pre>
1780 <p>c
1781 </p>
1782 !!end
1783
1784 !!test
1785 1c. Indent-Pre and Comments
1786 !!input
1787 <!--a--> a
1788
1789 <!--a--> a
1790 !!result
1791 <pre> a
1792 </pre>
1793 <pre> a
1794 </pre>
1795 !!end
1796
1797 !!test
1798 2a. Indent-Pre and tables
1799 !!input
1800 {|
1801 |-
1802 !h1!!h2
1803 |foo||bar
1804 |}
1805 !!result
1806 <table>
1807
1808 <tr>
1809 <th>h1</th>
1810 <th>h2
1811 </th>
1812 <td>foo</td>
1813 <td>bar
1814 </td></tr></table>
1815
1816 !!end
1817
1818 !!test
1819 2b. Indent-Pre and tables
1820 !!input
1821 {|
1822 |-
1823 |foo
1824 |}
1825 !!result
1826 <table>
1827
1828 <tr>
1829 <td>foo
1830 </td></tr></table>
1831
1832 !!end
1833
1834 !!test
1835 2c. Indent-Pre and tables (bug 42252)
1836 !!input
1837 {|
1838 |+ foo
1839 ! | bar
1840 |}
1841 !!result
1842 <table>
1843 <caption> foo
1844 </caption>
1845 <tr>
1846 <th> bar
1847 </th></tr></table>
1848
1849 !!end
1850
1851 !!test
1852 3a. Indent-Pre and block tags (single-line html)
1853 !!input
1854 <p> foo </p>
1855 <div> foo </div>
1856 <span> foo </span>
1857 !!result
1858 <p> foo </p>
1859 <div> foo </div>
1860 <pre><span> foo </span>
1861 </pre>
1862 !!end
1863
1864 !!test
1865 3b. Indent-Pre and block tags (pre-content on separate line)
1866 !!input
1867 <p>
1868 foo
1869 </p>
1870
1871 <div>
1872 foo
1873 </div>
1874
1875 <center>
1876 foo
1877 </center>
1878
1879 <blockquote>
1880 foo
1881 </blockquote>
1882
1883 <table><tr><td>
1884 foo
1885 </td></tr></table>
1886
1887 <ul><li>
1888 foo
1889 </li></ul>
1890
1891 !!result
1892 <p>
1893 foo
1894 </p>
1895 <div>
1896 <pre>foo
1897 </pre>
1898 </div>
1899 <center>
1900 <pre>foo
1901 </pre>
1902 </center>
1903 <blockquote>
1904 <pre>foo
1905 </pre>
1906 </blockquote>
1907 <table><tr><td>
1908 <pre>foo
1909 </pre>
1910 </td></tr></table>
1911 <ul><li>
1912 foo
1913 </li></ul>
1914
1915 !!end
1916
1917 !!test
1918 4. Multiple spaces at start-of-line
1919 !!input
1920 <p> foo </p>
1921 foo
1922 {|
1923 |foo
1924 |}
1925 !!result
1926 <p> foo </p>
1927 <pre> foo
1928 </pre>
1929 <table>
1930 <tr>
1931 <td>foo
1932 </td></tr></table>
1933
1934 !!end
1935
1936 !! test
1937 5. White-space in indent-pre
1938 NOTE: the white-space char on 2nd line is significant
1939 !! input
1940 a<br/>
1941
1942 b
1943 !! result
1944 <pre>a<br />
1945
1946 b
1947 </pre>
1948 !! end
1949
1950 ###
1951 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1952 ###
1953
1954 !!test
1955 HTML-pre: 1. embedded newlines
1956 !!input
1957 <pre>foo</pre>
1958
1959 <pre>
1960 foo
1961 </pre>
1962
1963 <pre>
1964
1965 foo
1966 </pre>
1967
1968 <pre>
1969
1970
1971 foo
1972 </pre>
1973 !!result
1974 <pre>foo</pre>
1975 <pre>
1976 foo
1977 </pre>
1978 <pre>
1979
1980 foo
1981 </pre>
1982 <pre>
1983
1984
1985 foo
1986 </pre>
1987
1988 !!end
1989
1990 !!test
1991 HTML-pre: 2: indented text
1992 !!input
1993 <pre>
1994 foo
1995 </pre>
1996 !!result
1997 <pre>
1998 foo
1999 </pre>
2000
2001 !!end
2002
2003 !!test
2004 HTML-pre: 3: other wikitext
2005 !!input
2006 <pre>
2007 * foo
2008 # bar
2009 = no-h =
2010 '' no-italic ''
2011 [[ NoLink ]]
2012 </pre>
2013 !!result
2014 <pre>
2015 * foo
2016 # bar
2017 = no-h =
2018 '' no-italic ''
2019 [[ NoLink ]]
2020 </pre>
2021
2022 !!end
2023
2024 ###
2025 ### Definition lists
2026 ###
2027 !! test
2028 Simple definition
2029 !! input
2030 ; name : Definition
2031 !! result
2032 <dl><dt> name&#160;</dt><dd> Definition
2033 </dd></dl>
2034
2035 !! end
2036
2037 !! test
2038 Definition list for indentation only
2039 !! input
2040 : Indented text
2041 !! result
2042 <dl><dd> Indented text
2043 </dd></dl>
2044
2045 !! end
2046
2047 !! test
2048 Definition list with no space
2049 !! input
2050 ;name:Definition
2051 !! result
2052 <dl><dt>name</dt><dd>Definition
2053 </dd></dl>
2054
2055 !!end
2056
2057 !! test
2058 Definition list with URL link
2059 !! input
2060 ; http://example.com/ : definition
2061 !! result
2062 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2063 </dd></dl>
2064
2065 !! end
2066
2067 !! test
2068 Definition list with bracketed URL link
2069 !! input
2070 ;[http://www.example.com/ Example]:Something about it
2071 !! result
2072 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2073 </dd></dl>
2074
2075 !! end
2076
2077 !! test
2078 Definition list with wikilink containing colon
2079 !! input
2080 ; [[Help:FAQ]]: The least-read page on Wikipedia
2081 !! result
2082 <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
2083 </dd></dl>
2084
2085 !! end
2086
2087 # At Brion's and JeLuF's insistence... :)
2088 !! test
2089 Definition list with news link containing colon
2090 !! input
2091 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2092 !! result
2093 <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!
2094 </dd></dl>
2095
2096 !! end
2097
2098 !! test
2099 Malformed definition list with colon
2100 !! input
2101 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2102 !! result
2103 <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
2104 </dt></dl>
2105
2106 !! end
2107
2108 !! test
2109 Definition lists: colon in external link text
2110 !! input
2111 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2112 !! result
2113 <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
2114 </dd></dl>
2115
2116 !! end
2117
2118 !! test
2119 Definition lists: colon in HTML attribute
2120 !! input
2121 ;<b style="display: inline">bold</b>
2122 !! result
2123 <dl><dt><b style="display: inline">bold</b>
2124 </dt></dl>
2125
2126 !! end
2127
2128 !! test
2129 Definition lists: self-closed tag
2130 !! input
2131 ;one<br/>two : two-line fun
2132 !! result
2133 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2134 </dd></dl>
2135
2136 !! end
2137
2138 !! test
2139 Bug 11748: Literal closing tags
2140 !! input
2141 <dl>
2142 <dt>test 1</dt>
2143 <dd>test test test test test</dd>
2144 <dt>test 2</dt>
2145 <dd>test test test test test</dd>
2146 </dl>
2147 !! result
2148 <dl>
2149 <dt>test 1</dt>
2150 <dd>test test test test test</dd>
2151 <dt>test 2</dt>
2152 <dd>test test test test test</dd>
2153 </dl>
2154
2155 !! end
2156
2157 !! test
2158 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2159 !! input
2160 <ul><li>
2161 ; term : description
2162 * unordered
2163 </li>
2164 </ul>
2165 !! result
2166 <ul><li>
2167 <dl><dt> term&#160;</dt><dd> description
2168 </dd></dl>
2169 <ul><li> unordered
2170 </li></ul>
2171 </li>
2172 </ul>
2173
2174 !! end
2175
2176 !! test
2177
2178 Definition list with empty definition and following paragraph
2179 !! input
2180 ; term:
2181 Paragraph text
2182 !! result
2183 <dl><dt> term</dt><dd>
2184 </dd></dl>
2185 <p>Paragraph text
2186 </p>
2187 !! end
2188
2189 !! test
2190 Nested definition lists using html syntax
2191 !! input
2192 <dl><dd>
2193 <dl>
2194 <dd>Foo</dd>
2195 </dl>
2196 </dd></dl>
2197 !! result
2198 <dl><dd>
2199 <dl>
2200 <dd>Foo</dd>
2201 </dl>
2202 </dd></dl>
2203
2204 !! end
2205
2206 !! test
2207 Definition Lists: No nesting: Multiple dd's
2208 !! input
2209 ;x
2210 :a
2211 :b
2212 !! result
2213 <dl><dt>x
2214 </dt><dd>a
2215 </dd><dd>b
2216 </dd></dl>
2217
2218 !! end
2219
2220 !! test
2221 Definition Lists: Indentation: Regular
2222 !! input
2223 :i1
2224 ::i2
2225 :::i3
2226 !! result
2227 <dl><dd>i1
2228 <dl><dd>i2
2229 <dl><dd>i3
2230 </dd></dl>
2231 </dd></dl>
2232 </dd></dl>
2233
2234 !! end
2235
2236 !! test
2237 Definition Lists: Indentation: Missing 1st level
2238 !! input
2239 ::i2
2240 :::i3
2241 !! result
2242 <dl><dd><dl><dd>i2
2243 <dl><dd>i3
2244 </dd></dl>
2245 </dd></dl>
2246 </dd></dl>
2247
2248 !! end
2249
2250 !! test
2251 Definition Lists: Indentation: Multi-level indent
2252 !! input
2253 :::i3
2254 !! result
2255 <dl><dd><dl><dd><dl><dd>i3
2256 </dd></dl>
2257 </dd></dl>
2258 </dd></dl>
2259
2260 !! end
2261
2262 !! test
2263 Definition Lists: Hacky use to indent tables
2264 !! input
2265 ::{|
2266 |foo
2267 |bar
2268 |}
2269 this text
2270 should be left alone
2271 !! result
2272 <dl><dd><dl><dd><table>
2273 <tr>
2274 <td>foo
2275 </td>
2276 <td>bar
2277 </td></tr></table></dd></dl></dd></dl>
2278 <p>this text
2279 should be left alone
2280 </p>
2281 !! end
2282 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2283 ## as an empty dt item. It also ignores all but the last ";" when followed
2284 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2285 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2286 ## ";"s.
2287 ##
2288 ## Ex: ";;t2 ::d2" is transformed into:
2289 ##
2290 ## <dl>
2291 ## <dt>t2 </dt>
2292 ## <dd>
2293 ## <dl>
2294 ## <dt></dt>
2295 ## <dd>d2</dd>
2296 ## </dl>
2297 ## </dd>
2298 ## </dl>
2299 ##
2300 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2301 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2302 ##
2303 ## <dl>
2304 ## <dt>
2305 ## <dl>
2306 ## <dt>t2 </dt>
2307 ## <dd>:d2</dd>
2308 ## </dl>
2309 ## </dt>
2310 ## </dl>
2311 ##
2312 ## All Parsoid only definition list tests have this difference.
2313 ##
2314 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2315 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2316
2317 !! test
2318 Table / list interaction: indented table with lists in table contents
2319 !! input
2320 :{|
2321 |-
2322 | a
2323 * b
2324 |-
2325 | c
2326 * d
2327 |}
2328 !! result
2329 <dl><dd><table>
2330
2331 <tr>
2332 <td> a
2333 <ul><li> b
2334 </li></ul>
2335 </td></tr>
2336 <tr>
2337 <td> c
2338 <ul><li> d
2339 </li></ul>
2340 </td></tr></table></dd></dl>
2341
2342 !! end
2343
2344 !!test
2345 Table / list interaction: lists nested in tables nested in indented lists
2346 !!input
2347 :{|
2348 |
2349 :a
2350 :b
2351 |
2352 *c
2353 *d
2354 |}
2355
2356 *e
2357 *f
2358 !!result
2359 <dl><dd><table>
2360 <tr>
2361 <td>
2362 <dl><dd>a
2363 </dd><dd>b
2364 </dd></dl>
2365 </td>
2366 <td>
2367 <ul><li>c
2368 </li><li>d
2369 </li></ul>
2370 </td></tr></table></dd></dl>
2371 <ul><li>e
2372 </li><li>f
2373 </li></ul>
2374
2375 !!end
2376
2377 !! test
2378 Definition Lists: Nesting: Multi-level (Parsoid only)
2379 !! options
2380 parsoid
2381 !! input
2382 ;t1 :d1
2383 ;;t2 ::d2
2384 ;;;t3 :::d3
2385 !! result
2386 <dl>
2387 <dt>t1 </dt>
2388 <dd>d1</dd>
2389 <dt>
2390 <dl>
2391 <dt>t2 </dt>
2392 <dd>:d2</dd>
2393 <dt>
2394 <dl>
2395 <dt>t3 </dt>
2396 <dd>::d3</dd>
2397 </dl>
2398 </dt>
2399 </dl>
2400 </dt>
2401 </dl>
2402
2403
2404 !! end
2405
2406
2407 !! test
2408 Definition Lists: Nesting: Test 2 (Parsoid only)
2409 !! options
2410 parsoid
2411 !! input
2412 ;t1
2413 ::d2
2414 !! result
2415 <dl>
2416 <dt>t1</dt>
2417 <dd>
2418 <dl>
2419 <dd>d2</dd>
2420 </dl>
2421 </dd>
2422 </dl>
2423
2424 !! end
2425
2426
2427 !! test
2428 Definition Lists: Nesting: Test 3 (Parsoid only)
2429 !! options
2430 parsoid
2431 !! input
2432 :;t1
2433 ::::d2
2434 !! result
2435 <dl>
2436 <dd>
2437 <dl>
2438 <dt>t1</dt>
2439 <dd>
2440 <dl>
2441 <dd>
2442 <dl>
2443 <dd>d2</dd>
2444 </dl>
2445 </dd>
2446 </dl>
2447 </dd>
2448 </dl>
2449 </dd>
2450 </dl>
2451
2452 !! end
2453
2454
2455 !! test
2456 Definition Lists: Nesting: Test 4
2457 !! input
2458 ::;t3
2459 :::d3
2460 !! result
2461 <dl><dd><dl><dd><dl><dt>t3
2462 </dt><dd>d3
2463 </dd></dl>
2464 </dd></dl>
2465 </dd></dl>
2466
2467 !! end
2468
2469
2470 ## The Parsoid team believes the following three test exposes a
2471 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2472 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2473 !! test
2474 Definition Lists: Mixed Lists: Test 1 (php)
2475 !! options
2476 php
2477 !! input
2478 :;* foo
2479 ::* bar
2480 :; baz
2481 !! result
2482 <dl><dd><dl><dt><ul><li> foo
2483 </li><li> bar
2484 </li></ul>
2485 </dt></dl>
2486 <dl><dt> baz
2487 </dt></dl>
2488 </dd></dl>
2489
2490 !! end
2491 !! test
2492 Definition Lists: Mixed Lists: Test 1 (parsoid)
2493 !! options
2494 parsoid
2495 !! input
2496 :;* foo
2497 ::* bar
2498 :; baz
2499 !! result
2500 <dl><dd><dl><dt><ul><li> foo
2501 </li></ul></dt><dd><ul><li> bar
2502 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2503 !! end
2504
2505 !! test
2506 Definition Lists: Mixed Lists: Test 2
2507 !! input
2508 *: d1
2509 *: d2
2510 !! result
2511 <ul><li><dl><dd> d1
2512 </dd><dd> d2
2513 </dd></dl>
2514 </li></ul>
2515
2516 !! end
2517
2518
2519 !! test
2520 Definition Lists: Mixed Lists: Test 3
2521 !! input
2522 *::: d1
2523 *::: d2
2524 !! result
2525 <ul><li><dl><dd><dl><dd><dl><dd> d1
2526 </dd><dd> d2
2527 </dd></dl>
2528 </dd></dl>
2529 </dd></dl>
2530 </li></ul>
2531
2532 !! end
2533
2534
2535 !! test
2536 Definition Lists: Mixed Lists: Test 4
2537 !! input
2538 *;d1 :d2
2539 *;d3 :d4
2540 !! result
2541 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2542 </dd><dt>d3&#160;</dt><dd>d4
2543 </dd></dl>
2544 </li></ul>
2545
2546 !! end
2547
2548
2549 !! test
2550 Definition Lists: Mixed Lists: Test 5
2551 !! input
2552 *:d1
2553 *:: d2
2554 !! result
2555 <ul><li><dl><dd>d1
2556 <dl><dd> d2
2557 </dd></dl>
2558 </dd></dl>
2559 </li></ul>
2560
2561 !! end
2562
2563
2564 !! test
2565 Definition Lists: Mixed Lists: Test 6
2566 !! input
2567 #*:d1
2568 #*::: d3
2569 !! result
2570 <ol><li><ul><li><dl><dd>d1
2571 <dl><dd><dl><dd> d3
2572 </dd></dl>
2573 </dd></dl>
2574 </dd></dl>
2575 </li></ul>
2576 </li></ol>
2577
2578 !! end
2579
2580
2581 !! test
2582 Definition Lists: Mixed Lists: Test 7
2583 !! input
2584 :* d1
2585 :* d2
2586 !! result
2587 <dl><dd><ul><li> d1
2588 </li><li> d2
2589 </li></ul>
2590 </dd></dl>
2591
2592 !! end
2593
2594
2595 !! test
2596 Definition Lists: Mixed Lists: Test 8
2597 !! input
2598 :* d1
2599 ::* d2
2600 !! result
2601 <dl><dd><ul><li> d1
2602 </li></ul>
2603 <dl><dd><ul><li> d2
2604 </li></ul>
2605 </dd></dl>
2606 </dd></dl>
2607
2608 !! end
2609
2610
2611 !! test
2612 Definition Lists: Mixed Lists: Test 9
2613 !! input
2614 *;foo :bar
2615 !! result
2616 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2617 </dd></dl>
2618 </li></ul>
2619
2620 !! end
2621
2622
2623 !! test
2624 Definition Lists: Mixed Lists: Test 10
2625 !! input
2626 *#;foo :bar
2627 !! result
2628 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2629 </dd></dl>
2630 </li></ol>
2631 </li></ul>
2632
2633 !! end
2634
2635 # The Parsoid team disagrees with the PHP parser's seemingly-random
2636 # rules regarding dd/dt on the next two tests. Parsoid is more
2637 # consistent, and recognizes the shared nesting and keeps the
2638 # still-open tags around until the nesting is complete.
2639
2640 !! test
2641 Definition Lists: Mixed Lists: Test 11 (php)
2642 !! options
2643 php
2644 !! input
2645 *#*#;*;;foo :bar
2646 *#*#;boo :baz
2647 !! result
2648 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2649 </dt></dl>
2650 </dd></dl>
2651 </li></ul>
2652 </dd></dl>
2653 <dl><dt>boo&#160;</dt><dd>baz
2654 </dd></dl>
2655 </li></ol>
2656 </li></ul>
2657 </li></ol>
2658 </li></ul>
2659
2660 !! end
2661 !! test
2662 Definition Lists: Mixed Lists: Test 11 (parsoid)
2663 !! options
2664 parsoid
2665 !! input
2666 *#*#;*;;foo :bar
2667 *#*#;boo :baz
2668 !! result
2669 <ul>
2670 <li>
2671 <ol>
2672 <li>
2673 <ul>
2674 <li>
2675 <ol>
2676 <li>
2677 <dl>
2678 <dt>
2679 <ul>
2680 <li>
2681 <dl>
2682 <dt>
2683 <dl>
2684 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2685 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2686 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2687 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2688 !! end
2689
2690
2691 !! test
2692 Definition Lists: Weird Ones: Test 1 (php)
2693 !! options
2694 php
2695 !! input
2696 *#;*::;; foo : bar (who uses this?)
2697 !! result
2698 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2699 </dt></dl>
2700 </dd></dl>
2701 </dd></dl>
2702 </dd></dl>
2703 </li></ul>
2704 </dd></dl>
2705 </li></ol>
2706 </li></ul>
2707
2708 !! end
2709 !! test
2710 Definition Lists: Weird Ones: Test 1 (parsoid)
2711 !! options
2712 parsoid
2713 !! input
2714 *#;*::;; foo : bar (who uses this?)
2715 !! result
2716 <ul>
2717 <li>
2718 <ol>
2719 <li>
2720 <dl>
2721 <dt>
2722 <ul>
2723 <li>
2724 <dl>
2725 <dd>
2726 <dl>
2727 <dd>
2728 <dl>
2729 <dt>
2730 <dl>
2731 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2732 <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>
2733 !! end
2734
2735 ###
2736 ### External links
2737 ###
2738 !! test
2739 External links: non-bracketed
2740 !! input
2741 Non-bracketed: http://example.com
2742 !! result
2743 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2744 </p>
2745 !! end
2746
2747 !! test
2748 External links: numbered
2749 !! input
2750 Numbered: [http://example.com]
2751 Numbered: [http://example.net]
2752 Numbered: [http://example.com]
2753 !! result
2754 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2755 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2756 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2757 </p>
2758 !!end
2759
2760 !! test
2761 External links: specified text
2762 !! input
2763 Specified text: [http://example.com link]
2764 !! result
2765 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2766 </p>
2767 !!end
2768
2769 !! test
2770 External links: trail
2771 !! input
2772 Linktrails should not work for external links: [http://example.com link]s
2773 !! result
2774 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2775 </p>
2776 !! end
2777
2778 !! test
2779 External links: dollar sign in URL
2780 !! input
2781 http://example.com/1$2345
2782 !! result
2783 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2784 </p>
2785 !! end
2786
2787 !! test
2788 External links: dollar sign in URL (named)
2789 !! input
2790 [http://example.com/1$2345]
2791 !! result
2792 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2793 </p>
2794 !!end
2795
2796 !! test
2797 External links: open square bracket forbidden in URL (bug 4377)
2798 !! input
2799 http://example.com/1[2345
2800 !! result
2801 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2802 </p>
2803 !! end
2804
2805 !! test
2806 External links: open square bracket forbidden in URL (named) (bug 4377)
2807 !! input
2808 [http://example.com/1[2345]
2809 !! result
2810 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2811 </p>
2812 !!end
2813
2814 !! test
2815 External links: nowiki in URL link text (bug 6230)
2816 !!input
2817 [http://example.com/ <nowiki>''example site''</nowiki>]
2818 !! result
2819 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2820 </p>
2821 !! end
2822
2823 !! test
2824 External links: newline forbidden in text (bug 6230 regression check)
2825 !! input
2826 [http://example.com/ first
2827 second]
2828 !! result
2829 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2830 second]
2831 </p>
2832 !!end
2833
2834 !! test
2835 External links: Pipe char between url and text
2836 !! input
2837 [http://example.com | link]
2838 !! result
2839 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2840 </p>
2841 !!end
2842
2843 !! test
2844 External links: protocol-relative URL in brackets
2845 !! input
2846 [//example.com/ Test]
2847 !! result
2848 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2849 </p>
2850 !! end
2851
2852 !! test
2853 External links: protocol-relative URL in brackets without text
2854 !! input
2855 [//example.com]
2856 !! result
2857 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2858 </p>
2859 !! end
2860
2861 !! test
2862 External links: protocol-relative URL in free text is left alone
2863 !! input
2864 //example.com/Foo
2865 !! result
2866 <p>//example.com/Foo
2867 </p>
2868 !!end
2869
2870 !! test
2871 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2872 !! input
2873 foo//example.com/Foo
2874 !! result
2875 <p>foo//example.com/Foo
2876 </p>
2877 !! end
2878
2879 !! test
2880 External image
2881 !! input
2882 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2883 !! result
2884 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2885 </p>
2886 !! end
2887
2888 !! test
2889 External image from https
2890 !! input
2891 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2892 !! result
2893 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2894 </p>
2895 !! end
2896
2897 !! test
2898 External image (when not allowed)
2899 !! options
2900 wgAllowExternalImages=0
2901 !! input
2902 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2903 !! result
2904 <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>
2905 </p>
2906 !! end
2907
2908 !! test
2909 Link to non-http image, no img tag
2910 !! input
2911 Link to non-http image, no img tag: ftp://example.com/test.jpg
2912 !! result
2913 <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>
2914 </p>
2915 !! end
2916
2917 !! test
2918 External links: terminating separator
2919 !! input
2920 Terminating separator: http://example.com/thing,
2921 !! result
2922 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2923 </p>
2924 !! end
2925
2926 !! test
2927 External links: intervening separator
2928 !! input
2929 Intervening separator: http://example.com/1,2,3
2930 !! result
2931 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2932 </p>
2933 !! end
2934
2935 !! test
2936 External links: old bug with URL in query
2937 !! input
2938 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2939 !! result
2940 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2941 </p>
2942 !! end
2943
2944 !! test
2945 External links: old URL-in-URL bug, mixed protocols
2946 !! input
2947 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2948 !! result
2949 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2950 </p>
2951 !!end
2952
2953 !! test
2954 External links: URL in text
2955 !! input
2956 URL in text: [http://example.com http://example.com]
2957 !! result
2958 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2959 </p>
2960 !! end
2961
2962 !! test
2963 External links: Clickable images
2964 !! input
2965 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2966 !! result
2967 <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>
2968 </p>
2969 !!end
2970
2971 !! test
2972 External links: raw ampersand
2973 !! input
2974 Old &amp; use: http://x&y
2975 !! result
2976 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2977 </p>
2978 !! end
2979
2980 !! test
2981 External links: encoded ampersand
2982 !! input
2983 Old &amp; use: http://x&amp;y
2984 !! result
2985 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2986 </p>
2987 !! end
2988
2989 !! test
2990 External links: encoded equals (bug 6102)
2991 !! input
2992 http://example.com/?foo&#61;bar
2993 !! result
2994 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2995 </p>
2996 !! end
2997
2998 !! test
2999 External links: [raw ampersand]
3000 !! input
3001 Old &amp; use: [http://x&y]
3002 !! result
3003 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3004 </p>
3005 !! end
3006
3007 !! test
3008 External links: [encoded ampersand]
3009 !! input
3010 Old &amp; use: [http://x&amp;y]
3011 !! result
3012 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3013 </p>
3014 !! end
3015
3016 !! test
3017 External links: [encoded equals] (bug 6102)
3018 !! input
3019 [http://example.com/?foo&#61;bar]
3020 !! result
3021 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3022 </p>
3023 !! end
3024
3025 !! test
3026 External links: [IDN ignored character reference in hostname; strip it right off]
3027 !! input
3028 [http://e&zwnj;xample.com/]
3029 !! result
3030 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3031 </p>
3032 !! end
3033
3034 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3035 # Where an external link could easily circumvent the sanitization of the text of
3036 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3037 # test demands a higher standard. That's a bit strange.
3038 #
3039 # Example:
3040 #
3041 # http://e‌xample.com -> [http://example.com|http://example.com]
3042 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3043 #
3044 # The first example is sanitized, but the second is not. Any security benefits
3045 # from this production are trivial to circumvent. Either remove this test and
3046 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3047 # the test accordingly.
3048 #
3049 # All our love,
3050 # The Parsoid team.
3051 !! test
3052 External links: IDN ignored character reference in hostname; strip it right off
3053 !! input
3054 http://e&zwnj;xample.com/
3055 !! result
3056 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3057 </p>
3058 !! end
3059
3060 !! test
3061 External links: www.jpeg.org (bug 554)
3062 !! input
3063 http://www.jpeg.org
3064 !!result
3065 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3066 </p>
3067 !! end
3068
3069 !! test
3070 External links: URL within URL (original bug 2)
3071 !! input
3072 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3073 !! result
3074 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3075 </p>
3076 !! end
3077
3078 !! test
3079 BUG 361: URL inside bracketed URL
3080 !! input
3081 [http://www.example.com/foo http://www.example.com/bar]
3082 !! result
3083 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3084 </p>
3085 !! end
3086
3087 !! test
3088 BUG 361: URL within URL, not bracketed
3089 !! input
3090 http://www.example.com/foo?=http://www.example.com/bar
3091 !! result
3092 <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>
3093 </p>
3094 !! end
3095
3096 !! test
3097 BUG 289: ">"-token in URL-tail
3098 !! input
3099 http://www.example.com/<hello>
3100 !! result
3101 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3102 </p>
3103 !!end
3104
3105 !! test
3106 BUG 289: literal ">"-token in URL-tail
3107 !! input
3108 http://www.example.com/<b>html</b>
3109 !! result
3110 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3111 </p>
3112 !!end
3113
3114 !! test
3115 BUG 289: ">"-token in bracketed URL
3116 !! input
3117 [http://www.example.com/<hello> stuff]
3118 !! result
3119 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3120 </p>
3121 !!end
3122
3123 !! test
3124 BUG 289: literal ">"-token in bracketed URL
3125 !! input
3126 [http://www.example.com/<b>html</b> stuff]
3127 !! result
3128 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3129 </p>
3130 !!end
3131
3132 !! test
3133 BUG 289: literal double quote at end of URL
3134 !! input
3135 http://www.example.com/"hello"
3136 !! result
3137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3138 </p>
3139 !!end
3140
3141 !! test
3142 BUG 289: literal double quote in bracketed URL
3143 !! input
3144 [http://www.example.com/"hello" stuff]
3145 !! result
3146 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3147 </p>
3148 !!end
3149
3150 !! test
3151 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3152 !! input
3153 [http://www.example.com test]
3154 !! result
3155 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3156 </p>
3157 !! end
3158
3159 !! test
3160 External links: link text with spaces
3161 !! input
3162 [http://www.example.com a b c]
3163 [http://www.example.com ''a'' ''b'']
3164 !! result
3165 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3166 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3167 </p>
3168 !! end
3169
3170 !! test
3171 External links: wiki links within external link (Bug 3695)
3172 !! input
3173 [http://example.com [[wikilink]] embedded in ext link]
3174 !! result
3175 <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>
3176 </p>
3177 !! end
3178
3179 !! test
3180 BUG 787: Links with one slash after the url protocol are invalid
3181 !! input
3182 http:/example.com
3183
3184 [http:/example.com title]
3185 !! result
3186 <p>http:/example.com
3187 </p><p>[http:/example.com title]
3188 </p>
3189 !! end
3190
3191 !! test
3192 Bracketed external links with template-generated invalid target
3193 !! input
3194 [{{echo|http:/example.com}} title]
3195 !! result
3196 <p>[http:/example.com title]
3197 </p>
3198 !! end
3199
3200 !! test
3201 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3202 !! input
3203 ''[http://example.com text'']
3204 [http://example.com '''text]'''
3205 ''Something [http://example.com in italic'']
3206 ''Something [http://example.com mixed''''', even bold]'''
3207 '''''Now [http://example.com both''''']
3208 !! result
3209 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3210 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3211 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3212 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3213 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3214 </p>
3215 !! end
3216
3217
3218 !! test
3219 Bug 4781: %26 in URL
3220 !! input
3221 http://www.example.com/?title=AT%26T
3222 !! result
3223 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3224 </p>
3225 !! end
3226
3227 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3228 # % is actually legal in HTML5. Any change in output would need testing though.
3229 !! test
3230 Bug 4781, 5267: %25 in URL
3231 !! input
3232 http://www.example.com/?title=100%25_Bran
3233 !! result
3234 <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>
3235 </p>
3236 !! end
3237
3238 !! test
3239 Bug 4781, 5267: %28, %29 in URL
3240 !! input
3241 http://www.example.com/?title=Ben-Hur_%281959_film%29
3242 !! result
3243 <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>
3244 </p>
3245 !! end
3246
3247
3248 !! test
3249 Bug 4781: %26 in autonumber URL
3250 !! input
3251 [http://www.example.com/?title=AT%26T]
3252 !! result
3253 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3254 </p>
3255 !! end
3256
3257 !! test
3258 Bug 4781, 5267: %26 in autonumber URL
3259 !! input
3260 [http://www.example.com/?title=100%25_Bran]
3261 !! result
3262 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3263 </p>
3264 !! end
3265
3266 !! test
3267 Bug 4781, 5267: %28, %29 in autonumber URL
3268 !! input
3269 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3270 !! result
3271 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3272 </p>
3273 !! end
3274
3275
3276 !! test
3277 Bug 4781: %26 in bracketed URL
3278 !! input
3279 [http://www.example.com/?title=AT%26T link]
3280 !! result
3281 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3282 </p>
3283 !! end
3284
3285 !! test
3286 Bug 4781, 5267: %26 in bracketed URL
3287 !! input
3288 [http://www.example.com/?title=100%25_Bran link]
3289 !! result
3290 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 Bug 4781, 5267: %28, %29 in bracketed URL
3296 !! input
3297 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3298 !! result
3299 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3305 !! input
3306 Some [http://example.com/ pretty ''italics'' and stuff]!
3307 !! result
3308 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3309 </p>
3310 !! end
3311
3312 !! test
3313 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3314 !! input
3315 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3316 !! result
3317 <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>
3318 </p>
3319 !! end
3320
3321 !! test
3322 External link containing double-single-quotes with no space separating the url from text in italics
3323 !! input
3324 [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]].]
3325 !! result
3326 <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>
3327 </p>
3328 !! end
3329
3330 !! test
3331 External link with comments in link text
3332 !! input
3333 [http://www.google.com Google <!-- comment -->]
3334 !! result
3335 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3336 </p>
3337 !! end
3338
3339 !! test
3340 URL-encoding in URL functions (single parameter)
3341 !! input
3342 {{localurl:Some page|amp=&}}
3343 !! result
3344 <p>/index.php?title=Some_page&amp;amp=&amp;
3345 </p>
3346 !! end
3347
3348 !! test
3349 URL-encoding in URL functions (multiple parameters)
3350 !! input
3351 {{localurl:Some page|q=?&amp=&}}
3352 !! result
3353 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3354 </p>
3355 !! end
3356
3357 !! test
3358 Brackets in urls
3359 !! input
3360 http://example.com/index.php?foozoid%5B%5D=bar
3361
3362 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3363 !! result
3364 <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>
3365 </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>
3366 </p>
3367 !! end
3368
3369 !! test
3370 IPv6 urls (bug 21261)
3371 !! options
3372 disabled
3373 !! input
3374 http://[2404:130:0:1000::187:2]/index.php
3375 !! result
3376 <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>
3377 </p>
3378 !! end
3379
3380 !! test
3381 Non-extlinks in brackets
3382 !! input
3383 [foo]
3384 [foo bar]
3385 [foo ''bar'']
3386 [fool's] errand
3387 [fool's errand]
3388 [{{echo|foo}}]
3389 [{{echo|foo}} bar]
3390 [{{echo|foo}} ''bar'']
3391 [{{echo|foo}}l's] errand
3392 [{{echo|foo}}l's errand]
3393 [url={{echo|foo}}]
3394 [url=http://example.com]
3395 !! result
3396 <p>[foo]
3397 [foo bar]
3398 [foo <i>bar</i>]
3399 [fool's] errand
3400 [fool's errand]
3401 [foo]
3402 [foo bar]
3403 [foo <i>bar</i>]
3404 [fool's] errand
3405 [fool's errand]
3406 [url=foo]
3407 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3408 </p>
3409 !! end
3410
3411 !! test
3412 Parsoid: Percent encoding in external links
3413 !! options
3414 parsoid
3415 !! input
3416 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3417 !! result
3418 <p><a rel="mw:ExtLink"
3419 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3420 !! end
3421
3422 !! test
3423 Parsoid: use url link syntax for links where the content is equal the link
3424 target
3425 !! options
3426 parsoid
3427 !! input
3428 http://example.com
3429 !! result
3430 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3431 !! end
3432
3433 ###
3434 ### Quotes
3435 ###
3436
3437 !! test
3438 Quotes
3439 !! input
3440 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3441
3442 Normal text. '''''Bold italic text.''''' Normal text.
3443 !!result
3444 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3445 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3446 </p>
3447 !! end
3448
3449
3450 !! test
3451 Unclosed and unmatched quotes (php)
3452 !! options
3453 php
3454 !! input
3455 '''''Bold italic text '''with bold deactivated''' in between.'''''
3456
3457 '''''Bold italic text ''with italic deactivated'' in between.'''''
3458
3459 '''Bold text..
3460
3461 ..spanning two paragraphs (should not work).'''
3462
3463 '''Bold tag left open
3464
3465 ''Italic tag left open
3466
3467 Normal text.
3468
3469 <!-- Unmatching number of opening, closing tags: -->
3470 '''This year''''s election ''should'' beat '''last year''''s.
3471
3472 ''Tom'''s car is bigger than ''Susan'''s.
3473
3474 Plain ''italic'''s plain
3475 !! result
3476 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3477 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3478 </p><p><b>Bold text..</b>
3479 </p><p>..spanning two paragraphs (should not work).
3480 </p><p><b>Bold tag left open</b>
3481 </p><p><i>Italic tag left open</i>
3482 </p><p>Normal text.
3483 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3484 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3485 </p><p>Plain <i>italic'</i>s plain
3486 </p>
3487 !! end
3488 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3489 # parser strips. The wikitext contains just the first half of the bold
3490 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3491 # differently than the PHP parser.)
3492 !! test
3493 Unclosed and unmatched quotes (parsoid)
3494 !! options
3495 parsoid
3496 !! input
3497 '''''Bold italic text '''with bold deactivated''' in between.'''''
3498
3499 '''''Bold italic text ''with italic deactivated'' in between.'''''
3500
3501 '''Bold text..
3502
3503 ..spanning two paragraphs (should not work).'''
3504
3505 '''Bold tag left open
3506
3507 ''Italic tag left open
3508
3509 Normal text.
3510
3511 <!-- Unmatching number of opening, closing tags: -->
3512 '''This year''''s election ''should'' beat '''last year''''s.
3513
3514 ''Tom'''s car is bigger than ''Susan'''s.
3515
3516 Plain ''italic'''s plain
3517 !! result
3518 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3519 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3520 </p><p><b>Bold text..</b>
3521 </p><p>..spanning two paragraphs (should not work).<b></b>
3522 </p><p><b>Bold tag left open</b>
3523 </p><p><i>Italic tag left open</i>
3524 </p><p>Normal text.
3525 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3526 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3527 </p><p>Plain <i>italic'</i>s plain
3528 </p>
3529 !! end
3530
3531 ###
3532 ### Tables
3533 ###
3534 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3535 ###
3536
3537 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3538 # is the bare minimum required by the spec, see:
3539 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3540 !! test
3541 A table with no data. (php)
3542 !! options
3543 php
3544 !! input
3545 {||}
3546 !! result
3547 !! end
3548 # Parsoid team replies: empty table tags are legal in HTML5
3549 !! test
3550 A table with no data. (parsoid)
3551 !! options
3552 parsoid
3553 !! input
3554 {||}
3555 !! result
3556 <table></table>
3557 !! end
3558
3559 # A table with nothing but a caption is invalid XHTML, we might want to render
3560 # this as <p>caption</p>
3561 !! test
3562 A table with nothing but a caption (php)
3563 !! options
3564 php
3565 !! input
3566 {|
3567 |+ caption
3568 |}
3569 !! result
3570 <table>
3571 <caption> caption
3572 </caption><tr><td></td></tr></table>
3573
3574 !! end
3575 # Parsoid team replies: table with only a caption is legal in HTML5
3576 !! test
3577 A table with nothing but a caption (parsoid)
3578 !! options
3579 parsoid
3580 !! input
3581 {|
3582 |+ caption
3583 |}
3584 !! result
3585 <table><caption> caption</caption></table>
3586 !! end
3587
3588 !! test
3589 A table with caption with default-spaced attributes and a table row
3590 !! input
3591 {|
3592 |+ style="color: red;" | caption1
3593 |-
3594 | foo
3595 |}
3596 !! result
3597 <table>
3598 <caption style="color: red;"> caption1
3599 </caption>
3600 <tr>
3601 <td> foo
3602 </td></tr></table>
3603
3604 !! end
3605
3606 !! test
3607 A table with captions with non-default spaced attributes and a table row
3608 !! input
3609 {|
3610 |+style="color: red;"|caption2
3611 |+ style="color: red;"| caption3
3612 |-
3613 | foo
3614 |}
3615 !! result
3616 <table>
3617 <caption style="color: red;">caption2
3618 </caption>
3619 <caption style="color: red;"> caption3
3620 </caption>
3621 <tr>
3622 <td> foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table td-cell syntax variations
3629 !! input
3630 {|
3631 | foo bar foo | baz
3632 | foo bar foo || baz
3633 | style='color:red;' | baz
3634 | style='color:red;' || baz
3635 |}
3636 !! result
3637 <table>
3638 <tr>
3639 <td> baz
3640 </td>
3641 <td> foo bar foo </td>
3642 <td> baz
3643 </td>
3644 <td style="color:red;"> baz
3645 </td>
3646 <td> style='color:red;' </td>
3647 <td> baz
3648 </td></tr></table>
3649
3650 !! end
3651
3652 !! test
3653 Simple table
3654 !! input
3655 {|
3656 | 1 || 2
3657 |-
3658 | 3 || 4
3659 |}
3660 !! result
3661 <table>
3662 <tr>
3663 <td> 1 </td>
3664 <td> 2
3665 </td></tr>
3666 <tr>
3667 <td> 3 </td>
3668 <td> 4
3669 </td></tr></table>
3670
3671 !! end
3672
3673 !! test
3674 Simple table but with multiple dashes for row wikitext
3675 !! input
3676 {|
3677 | foo
3678 |-----
3679 | bar
3680 |}
3681 !! result
3682 <table>
3683 <tr>
3684 <td> foo
3685 </td></tr>
3686 <tr>
3687 <td> bar
3688 </td></tr></table>
3689
3690 !! end
3691 !! test
3692 Multiplication table
3693 !! input
3694 {| border="1" cellpadding="2"
3695 |+Multiplication table
3696 |-
3697 ! &times; !! 1 !! 2 !! 3
3698 |-
3699 ! 1
3700 | 1 || 2 || 3
3701 |-
3702 ! 2
3703 | 2 || 4 || 6
3704 |-
3705 ! 3
3706 | 3 || 6 || 9
3707 |-
3708 ! 4
3709 | 4 || 8 || 12
3710 |-
3711 ! 5
3712 | 5 || 10 || 15
3713 |}
3714 !! result
3715 <table border="1" cellpadding="2">
3716 <caption>Multiplication table
3717 </caption>
3718 <tr>
3719 <th> &#215; </th>
3720 <th> 1 </th>
3721 <th> 2 </th>
3722 <th> 3
3723 </th></tr>
3724 <tr>
3725 <th> 1
3726 </th>
3727 <td> 1 </td>
3728 <td> 2 </td>
3729 <td> 3
3730 </td></tr>
3731 <tr>
3732 <th> 2
3733 </th>
3734 <td> 2 </td>
3735 <td> 4 </td>
3736 <td> 6
3737 </td></tr>
3738 <tr>
3739 <th> 3
3740 </th>
3741 <td> 3 </td>
3742 <td> 6 </td>
3743 <td> 9
3744 </td></tr>
3745 <tr>
3746 <th> 4
3747 </th>
3748 <td> 4 </td>
3749 <td> 8 </td>
3750 <td> 12
3751 </td></tr>
3752 <tr>
3753 <th> 5
3754 </th>
3755 <td> 5 </td>
3756 <td> 10 </td>
3757 <td> 15
3758 </td></tr></table>
3759
3760 !! end
3761
3762 !! test
3763 Accept "||" in table headings
3764 !! input
3765 {|
3766 !h1 || h2
3767 |}
3768 !! result
3769 <table>
3770 <tr>
3771 <th>h1 </th>
3772 <th> h2
3773 </th></tr></table>
3774
3775 !! end
3776
3777 !! test
3778 Accept "||" in indented table headings
3779 !! input
3780 :{|
3781 !h1 || h2
3782 |}
3783 !! result
3784 <dl><dd><table>
3785 <tr>
3786 <th>h1 </th>
3787 <th> h2
3788 </th></tr></table></dd></dl>
3789
3790 !! end
3791
3792 !! test
3793 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3794 !! input
3795 {|
3796 !| h1
3797 || a
3798 |}
3799 !! result
3800 <table>
3801 <tr>
3802 <th> h1
3803 </th>
3804 <td> a
3805 </td></tr></table>
3806
3807 !! end
3808
3809 !!test
3810 Accept "| !" at start of line in tables (ignore !-attribute)
3811 !!input
3812 {|
3813 |-
3814 | !style="color:red" | bar
3815 |}
3816 !!result
3817 <table>
3818
3819 <tr>
3820 <td> bar
3821 </td></tr></table>
3822
3823 !!end
3824
3825 !!test
3826 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 +/-
3827 !!input
3828 {|
3829 |-
3830 |style='color:red;'|+1
3831 |style='color:blue;'|-1
3832 |-
3833 | 1 || 2 || 3
3834 | 1 ||+2 ||-3
3835 |-
3836 | +1
3837 | -1
3838 |}
3839 !!result
3840 <table>
3841
3842 <tr>
3843 <td style="color:red;">+1
3844 </td>
3845 <td style="color:blue;">-1
3846 </td></tr>
3847 <tr>
3848 <td> 1 </td>
3849 <td> 2 </td>
3850 <td> 3
3851 </td>
3852 <td> 1 </td>
3853 <td>+2 </td>
3854 <td>-3
3855 </td></tr>
3856 <tr>
3857 <td> +1
3858 </td>
3859 <td> -1
3860 </td></tr></table>
3861
3862 !!end
3863
3864 !! test
3865 Table rowspan
3866 !! input
3867 {| border=1
3868 | Cell 1, row 1
3869 |rowspan=2| Cell 2, row 1 (and 2)
3870 | Cell 3, row 1
3871 |-
3872 | Cell 1, row 2
3873 | Cell 3, row 2
3874 |}
3875 !! result
3876 <table border="1">
3877 <tr>
3878 <td> Cell 1, row 1
3879 </td>
3880 <td rowspan="2"> Cell 2, row 1 (and 2)
3881 </td>
3882 <td> Cell 3, row 1
3883 </td></tr>
3884 <tr>
3885 <td> Cell 1, row 2
3886 </td>
3887 <td> Cell 3, row 2
3888 </td></tr></table>
3889
3890 !! end
3891
3892 !! test
3893 Nested table
3894 !! input
3895 {| border=1
3896 | &alpha;
3897 |
3898 {| bgcolor=#ABCDEF border=2
3899 |nested
3900 |-
3901 |table
3902 |}
3903 |the original table again
3904 |}
3905 !! result
3906 <table border="1">
3907 <tr>
3908 <td> &#945;
3909 </td>
3910 <td>
3911 <table bgcolor="#ABCDEF" border="2">
3912 <tr>
3913 <td>nested
3914 </td></tr>
3915 <tr>
3916 <td>table
3917 </td></tr></table>
3918 </td>
3919 <td>the original table again
3920 </td></tr></table>
3921
3922 !! end
3923
3924 !! test
3925 Invalid attributes in table cell (bug 1830)
3926 !! input
3927 {|
3928 |Cell:|broken
3929 |}
3930 !! result
3931 <table>
3932 <tr>
3933 <td>broken
3934 </td></tr></table>
3935
3936 !! end
3937
3938
3939 !! test
3940 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3941 !! input
3942 {|
3943 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3944 !! result
3945 <table>
3946 <tr>
3947 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3948 <td>]" onmouseover="alert(document.cookie)"&gt;test
3949 </td>
3950 </tr>
3951 </table>
3952
3953 !! end
3954
3955
3956 !! test
3957 Indented table markup mixed with indented pre content (proposed in bug 6200)
3958 !! input
3959 <table>
3960 <tr>
3961 <td>
3962 Text that should be rendered preformatted
3963 </td>
3964 </tr>
3965 </table>
3966 !! result
3967 <table>
3968 <tr>
3969 <td>
3970 <pre>Text that should be rendered preformatted
3971 </pre>
3972 </td>
3973 </tr>
3974 </table>
3975
3976 !! end
3977
3978 !! test
3979 Template-generated table cell attributes and cell content
3980 !! input
3981 {|
3982 |{{table_attribs}}
3983 |}
3984 !! result
3985 <table>
3986 <tr>
3987 <td style="color: red"> Foo
3988 </td></tr></table>
3989
3990 !! end
3991
3992 !! test
3993 Template-generated table cell attributes and cell content (2)
3994 !! input
3995 {|
3996 |align=center {{table_attribs}}
3997 |}
3998 !! result
3999 <table>
4000 <tr>
4001 <td align="center" style="color: red"> Foo
4002 </td></tr></table>
4003
4004 !! end
4005
4006 !! test
4007 Template-generated table cell attributes and cell content (3)
4008 !! input
4009 {|
4010 |align=center {{table_cells}}
4011 |}
4012 !! result
4013 <table>
4014 <tr>
4015 <td align="center" style="color: red"> Foo </td>
4016 <td> Bar </td>
4017 <td> Baz
4018 </td></tr></table>
4019
4020 !! end
4021
4022 !! test
4023 Table with row followed by newlines and table heading
4024 !! input
4025 {|
4026 |-
4027
4028 ! foo
4029 |}
4030 !! result
4031 <table>
4032
4033
4034 <tr>
4035 <th> foo
4036 </th></tr></table>
4037
4038 !! end
4039
4040 !! test
4041 Table with empty line following the start tag
4042 !! input
4043 {|
4044
4045 |-
4046 | foo
4047 |}
4048 !! result
4049 <table>
4050
4051
4052 <tr>
4053 <td> foo
4054 </td></tr></table>
4055
4056 !! end
4057
4058 # FIXME: Preserve the attribute properly (with an empty string as value) in
4059 # the PHP parser. Parsoid implements the behavior below.
4060 !! test
4061 Table attributes with empty value
4062 !! options
4063 parsoid
4064 !! input
4065 {|
4066 | style=| hello
4067 |}
4068 !! result
4069 <table>
4070 <tbody>
4071 <tr>
4072 <td style=""> hello
4073 </td></tr></tbody></table>
4074
4075 !! end
4076
4077 !! test
4078 Wikitext table with a lot of comments
4079 !! input
4080 {|
4081 <!-- c0 -->
4082 | foo
4083 <!-- c1 -->
4084 |- <!-- c2 -->
4085 <!-- c3 -->
4086 |<!-- c4 -->
4087 <!-- c5 -->
4088 |}
4089 !! result
4090 <table>
4091 <tr>
4092 <td> foo
4093 </td></tr>
4094 <tr>
4095 <td>
4096 </td></tr></table>
4097
4098 !! end
4099
4100 !! test
4101 Wikitext table with double-line table cell
4102 !! input
4103 {|
4104 |a
4105 b
4106 |}
4107 !! result
4108 <table>
4109 <tr>
4110 <td>a
4111 <p>b
4112 </p>
4113 </td></tr></table>
4114
4115 !! end
4116
4117 !! test
4118 Table cell with a single comment
4119 !! input
4120 {|
4121 | <!-- c1 -->
4122 | a
4123 |}
4124 !! result
4125 <table>
4126 <tr>
4127 <td>
4128 </td>
4129 <td> a
4130 </td></tr></table>
4131
4132 !! end
4133
4134 # The expected HTML structure in this test is debatable. The PHP parser does
4135 # not parse this kind of table at all. The main focus for Parsoid is on
4136 # round-tripping, so this output is ok for now. TODO: revisit!
4137 !! test
4138 Wikitext table with html-syntax row (Parsoid)
4139 !! options
4140 parsoid
4141 !! input
4142 {|
4143 |-
4144 <td>foo</td>
4145 |}
4146 !! result
4147 <table>
4148 <tbody>
4149 <tr>
4150 <td>foo</td></tr></tbody></table>
4151 !! end
4152
4153 !! test
4154 Implicit <td> after a |-
4155 (PHP parser relies on Tidy to add the missing <td> tags)
4156 !! options
4157 parsoid=wt2html,wt2wt
4158 !! input
4159 {|
4160 |-
4161 a
4162 |}
4163 !! result
4164 <table>
4165 <tr><td>a</td></tr>
4166 </table>
4167 !! end
4168
4169 !! test
4170 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4171 (PHP parser relies on Tidy to add the missing <td> tags)
4172 !! options
4173 parsoid=wt2html,wt2wt
4174 !! input
4175 {|
4176 |-
4177 |
4178 a
4179 |-
4180 b
4181 |}
4182 !! result
4183 <table>
4184 <tbody>
4185 <tr><td><pre>a</pre></td></tr>
4186 <tr><td> b</td></tr>
4187 </tbody>
4188 </table>
4189 !! end
4190
4191 !! test
4192 Lists should be recognized in an implicit <td> context
4193 (PHP parser relies on Tidy to add the missing <td> tags)
4194 !! options
4195 parsoid=wt2html,wt2wt
4196 !! input
4197 {|
4198 |-
4199 *a
4200 |}
4201 !! result
4202 <table>
4203 <tr>
4204 <td><ul><li>a</li></ul></td>
4205 </tr>
4206 </table>
4207 !! end
4208
4209 ###
4210 ### Internal links
4211 ###
4212 !! test
4213 Plain link, capitalized
4214 !! input
4215 [[Main Page]]
4216 !! result
4217 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4218 </p>
4219 !! end
4220
4221 !! test
4222 Plain link, uncapitalized
4223 !! input
4224 [[main Page]]
4225 !! result
4226 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4227 </p>
4228 !! end
4229
4230 !! test
4231 Piped link
4232 !! input
4233 [[Main Page|The Main Page]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4236 </p>
4237 !! end
4238
4239 !! test
4240 Piped link with comment in link text
4241 !! input
4242 [[Main Page|The Main<!--front--> Page]]
4243 !! result
4244 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4245 </p>
4246 !! end
4247
4248 !! test
4249 Broken link
4250 !! input
4251 [[Zigzagzogzagzig]]
4252 !! result
4253 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4254 </p>
4255 !! end
4256
4257 !! test
4258 Broken link with fragment
4259 !! input
4260 [[Zigzagzogzagzig#zug]]
4261 !! result
4262 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4263 </p>
4264 !! end
4265
4266 !! test
4267 Special page link with fragment
4268 !! input
4269 [[Special:Version#anchor]]
4270 !! result
4271 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4272 </p>
4273 !! end
4274
4275 !! test
4276 Nonexistent special page link with fragment
4277 !! input
4278 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4279 !! result
4280 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4281 </p>
4282 !! end
4283
4284 !! test
4285 Link with prefix
4286 !! input
4287 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4288 !! result
4289 <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>
4290 </p>
4291 !! end
4292
4293 !! test
4294 Link with suffix
4295 !! input
4296 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4297 !! result
4298 <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>!!!
4299 </p>
4300 !! end
4301
4302 !! article
4303 prefixed article
4304 !! text
4305 Some text
4306 !! endarticle
4307
4308 !! test
4309 Bug 43661: Piped links with identical prefixes
4310 !! input
4311 [[prefixed article|prefixed articles with spaces]]
4312
4313 [[prefixed article|prefixed articlesaoeu]]
4314
4315 [[Main Page|Main Page test]]
4316 !! result
4317 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4318 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4319 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4320 </p>
4321 !! end
4322
4323
4324 !! test
4325 Link with HTML entity in suffix / tail
4326 !! input
4327 [[Main Page]]&quot;, [[Main Page]]&#97;
4328 !! result
4329 <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;
4330 </p>
4331 !! end
4332
4333 !! test
4334 Link with 3 brackets
4335 !! input
4336 [[[main page]]]
4337 !! result
4338 <p>[[[main page]]]
4339 </p>
4340 !! end
4341
4342 !! test
4343 Piped link with 3 brackets
4344 !! input
4345 [[[main page|the main page]]]
4346 !! result
4347 <p>[[[main page|the main page]]]
4348 </p>
4349 !! end
4350
4351 !! test
4352 Link with multiple pipes
4353 !! input
4354 [[Main Page|The|Main|Page]]
4355 !! result
4356 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4357 </p>
4358 !! end
4359
4360 !! test
4361 Link to namespaces
4362 !! input
4363 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4364 !! result
4365 <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>
4366 </p>
4367 !! end
4368
4369 !! test
4370 Piped link to namespace
4371 !! input
4372 [[Meta:Disclaimers|The disclaimers]]
4373 !! result
4374 <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>
4375 </p>
4376 !! end
4377
4378 !! test
4379 Link containing }
4380 !! input
4381 [[Usually caused by a typo (oops}]]
4382 !! result
4383 <p>[[Usually caused by a typo (oops}]]
4384 </p>
4385 !! end
4386
4387 !! test
4388 Link containing % (not as a hex sequence)
4389 !! input
4390 [[7% Solution]]
4391 !! result
4392 <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>
4393 </p>
4394 !! end
4395
4396 !! test
4397 Link containing % as a single hex sequence interpreted to char
4398 !! input
4399 [[7%25 Solution]]
4400 !! result
4401 <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>
4402 </p>
4403 !!end
4404
4405 !! test
4406 Link containing % as a double hex sequence interpreted to hex sequence
4407 !! input
4408 [[7%2525 Solution]]
4409 !! result
4410 <p>[[7%2525 Solution]]
4411 </p>
4412 !!end
4413
4414 !! test
4415 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4416 Example for such a section: == < ==
4417 !! input
4418 [[%23%3c]][[%23%3e]]
4419 !! result
4420 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4421 </p>
4422 !! end
4423
4424 !! test
4425 Link containing "<#" and ">#" as a hex sequences
4426 !! input
4427 [[%3c%23]][[%3e%23]]
4428 !! result
4429 <p>[[%3c%23]][[%3e%23]]
4430 </p>
4431 !! end
4432
4433 !! test
4434 Link containing an equals sign
4435 !! input
4436 [[Special:BookSources/isbn=4-00-026157-6]]
4437 !! result
4438 <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>
4439 </p>
4440 !! end
4441
4442 !! article
4443 Foo~bar
4444 !! text
4445 Just a test of an article title containing a tilde.
4446 !! endarticle
4447
4448 # note that links containing signatures, like [[Foo~~~~]], are
4449 # massaged by the pre-save transform (PST) and so the tildes are never
4450 # seen by the parser.
4451 !! test
4452 Link containing a tilde
4453 !! input
4454 [[Foo~bar]]
4455 !! result
4456 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4457 </p>
4458 !! end
4459
4460 !! test
4461 Link containing double-single-quotes '' (bug 4598)
4462 !! input
4463 [[Lista d''e paise d''o munno]]
4464 !! result
4465 <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>
4466 </p>
4467 !! end
4468
4469 !! test
4470 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4471 !! input
4472 Some [[Link|pretty ''italics'' and stuff]]!
4473 !! result
4474 <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>!
4475 </p>
4476 !! end
4477
4478 !! test
4479 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4480 !! input
4481 ''Some [[Link|pretty ''italics'' and stuff]]!
4482 !! result
4483 <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>
4484 </p>
4485 !! end
4486
4487 !! test
4488 Link with double quotes in title part (literal) and alternate part (interpreted)
4489 !! input
4490 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4491
4492 [[''Pentecoste'']]
4493
4494 [[''Pentecoste''|Pentecoste]]
4495
4496 [[''Pentecoste''|''Pentecoste'']]
4497 !! result
4498 <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>
4499 </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>
4500 </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>
4501 </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>
4502 </p>
4503 !! end
4504
4505 !! test
4506 Broken image links with HTML captions (bug 39700)
4507 !! input
4508 [[File:Nonexistent|<script></script>]]
4509 [[File:Nonexistent|100px|<script></script>]]
4510 [[File:Nonexistent|&lt;]]
4511 [[File:Nonexistent|a<i>b</i>c]]
4512 !! result
4513 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4514 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4515 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4516 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4517 </p>
4518 !! end
4519
4520 !! test
4521 Plain link to URL
4522 !! input
4523 [[http://www.example.com]]
4524 !! result
4525 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4526 </p>
4527 !! end
4528
4529 !! test
4530 Plain link to URL with link text
4531 !! input
4532 [[http://www.example.com Link text]]
4533 !! result
4534 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4535 </p>
4536 !! end
4537
4538 !! test
4539 Plain link to protocol-relative URL
4540 !! input
4541 [[//www.example.com]]
4542 !! result
4543 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4544 </p>
4545 !! end
4546
4547 !! test
4548 Plain link to protocol-relative URL with link text
4549 !! input
4550 [[//www.example.com Link text]]
4551 !! result
4552 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4553 </p>
4554 !! end
4555
4556 !! test
4557 Plain link to page with question mark in title
4558 !! input
4559 [[A?b]]
4560
4561 [[A?b|Baz]]
4562 !! result
4563 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4564 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4565 </p>
4566 !! end
4567
4568
4569 # I'm fairly sure the expected result here is wrong.
4570 # We want these to be URL links, not pseudo-pages with URLs for titles....
4571 # However the current output is also pretty screwy.
4572 #
4573 # ----
4574 # I'm changing it to match the current output--it arguably makes more
4575 # sense in the light of the test above. Old expected result was:
4576 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4577 #</p>
4578 # But I think this test is bordering on "garbage in, garbage out" anyway.
4579 # -- wtm
4580 !! test
4581 Piped link to URL
4582 !! input
4583 Piped link to URL: [[http://www.example.com|an example URL]]
4584 !! result
4585 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4586 </p>
4587 !! end
4588
4589 !! test
4590 BUG 2: [[page|http://url/]] should link to page, not http://url/
4591 !! input
4592 [[Main Page|http://url/]]
4593 !! result
4594 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4595 </p>
4596 !! end
4597
4598 !! test
4599 BUG 337: Escaped self-links should be bold
4600 !! options
4601 title=[[Bug462]]
4602 !! input
4603 [[Bu&#103;462]] [[Bug462]]
4604 !! result
4605 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4606 </p>
4607 !! end
4608
4609 !! test
4610 Self-link to section should not be bold
4611 !! options
4612 title=[[Main Page]]
4613 !! input
4614 [[Main Page#section]]
4615 !! result
4616 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4617 </p>
4618 !! end
4619
4620 !! article
4621 00
4622 !! text
4623 This is 00.
4624 !! endarticle
4625
4626 !!test
4627 Self-link to numeric title
4628 !!options
4629 title=[[0]]
4630 !!input
4631 [[0]]
4632 !!result
4633 <p><strong class="selflink">0</strong>
4634 </p>
4635 !!end
4636
4637 !!test
4638 Link to numeric-equivalent title
4639 !!options
4640 title=[[0]]
4641 !!input
4642 [[00]]
4643 !!result
4644 <p><a href="/wiki/00" title="00">00</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 <nowiki> inside a link
4650 !! input
4651 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4652 !! result
4653 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4654 </p>
4655 !! end
4656
4657 !! test
4658 Non-breaking spaces in title
4659 !! input
4660 [[&nbsp; Main &nbsp; Page &nbsp;]]
4661 !! result
4662 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4663 </p>
4664 !!end
4665
4666 !! test
4667 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4668 !! options
4669 language=ca
4670 !! input
4671 '''[[Main Page]]'''
4672 !! result
4673 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4674 </p>
4675 !! end
4676
4677 !! test
4678 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4679 !! options
4680 language=ca
4681 !! input
4682 ''[[Main Page]]''
4683 !! result
4684 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4685 </p>
4686 !! end
4687
4688 !! test
4689 Internal link with en linktrail: no apostrophes (bug 27473)
4690 !! options
4691 language=en
4692 !! input
4693 [[Something]]'nice
4694 !! result
4695 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4696 </p>
4697 !! end
4698
4699 !! test
4700 Internal link with ca linktrail with apostrophes (bug 27473)
4701 !! options
4702 language=ca
4703 !! input
4704 [[Something]]'nice
4705 !! result
4706 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4707 </p>
4708 !! end
4709
4710 !! test
4711 Internal link with kaa linktrail with apostrophes (bug 27473)
4712 !! options
4713 language=kaa
4714 !! input
4715 [[Something]]'nice
4716 !! result
4717 <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>
4718 </p>
4719 !! end
4720
4721 !! article
4722 Söfnuður
4723 !! text
4724 Test.
4725 !! endarticle
4726
4727 !! test
4728 Internal link with is link prefix
4729 !! options
4730 language=is
4731 !! input
4732 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4733 !! result
4734 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4735 </p>
4736 !! end
4737
4738 !! article
4739 Mótmælendatrú
4740 !! text
4741 Test.
4742 !! endarticle
4743
4744 !! test
4745 Internal link with is link trail and link prefix
4746 !! options
4747 language=is
4748 !! input
4749 [[mótmælendatrú|xxx]]ar
4750 [[mótmælendatrú]]ar
4751 mótmælenda[[söfnuður]]
4752 mótmælenda[[söfnuður|söfnuðir]]
4753 mótmælenda[[söfnuður|söfnuðir]]xxx
4754 !! result
4755 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4756 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4757 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4758 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4759 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4760 </p>
4761 !! end
4762
4763 !! test
4764 Parsoid link trail escaping
4765 !! options
4766 parsoid=html2wt,html2html
4767 !! input
4768 [[apple]]<nowiki/>s
4769 !! result
4770 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4771 !! end
4772
4773 !! test
4774 Parsoid link prefix escaping
4775 !! options
4776 language=is
4777 parsoid=html2wt,html2html
4778 !! input
4779 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4780 !! result
4781 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4782 !! end
4783
4784 !! test
4785 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4786 !! input
4787 [[Foo| bar]]
4788
4789 [[Foo| ''bar'']]
4790
4791 [http://wp.org foo]
4792
4793 [http://wp.org ''foo'']
4794 !! result
4795 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4796 </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>
4797 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4798 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4799 </p>
4800 !! end
4801
4802 ###
4803 ### Interwiki links (see maintenance/interwiki.sql)
4804 ###
4805
4806 !! test
4807 Inline interwiki link
4808 !! input
4809 [[MeatBall:SoftSecurity]]
4810 !! result
4811 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4812 </p>
4813 !! end
4814
4815 !! test
4816 Inline interwiki link with empty title (bug 2372)
4817 !! input
4818 [[MeatBall:]]
4819 !! result
4820 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4821 </p>
4822 !! end
4823
4824 !! test
4825 Interwiki link encoding conversion (bug 1636)
4826 !! input
4827 *[[Wikipedia:ro:Olteni&#0355;a]]
4828 *[[Wikipedia:ro:Olteni&#355;a]]
4829 !! result
4830 <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>
4831 </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>
4832 </li></ul>
4833
4834 !! end
4835
4836 !! test
4837 Interwiki link with fragment (bug 2130)
4838 !! input
4839 [[MeatBall:SoftSecurity#foo]]
4840 !! result
4841 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4842 </p>
4843 !! end
4844
4845 !! test
4846 Interlanguage link
4847 !! input
4848 Blah blah blah
4849 [[zh:Chinese]]
4850 !!result
4851 <p>Blah blah blah
4852 </p>
4853 !! end
4854
4855 !! test
4856 Double interlanguage link
4857 !! input
4858 Blah blah blah
4859 [[es:Spanish]]
4860 [[zh:Chinese]]
4861 !!result
4862 <p>Blah blah blah
4863 </p>
4864 !! end
4865
4866 !! test
4867 Interlanguage link, with prefix links
4868 !! options
4869 language=ln
4870 !! input
4871 Blah blah blah
4872 [[zh:Chinese]]
4873 !!result
4874 <p>Blah blah blah
4875 </p>
4876 !! end
4877
4878 !! test
4879 Double interlanguage link, with prefix links (bug 8897)
4880 !! options
4881 language=ln
4882 !! input
4883 Blah blah blah
4884 [[es:Spanish]]
4885 [[zh:Chinese]]
4886 !!result
4887 <p>Blah blah blah
4888 </p>
4889 !! end
4890
4891 !! test
4892 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4893 !! options
4894 language=ln
4895 !! input
4896 [[WW&nbsp;II]]
4897 !!result
4898 <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>
4899 </p>
4900 !! end
4901
4902 !! test
4903 Parsoid: handle constructor well
4904 !! options
4905 parsoid
4906 !! input
4907 [[constructor]]
4908
4909 [[constructor:foo]]
4910 !! result
4911 <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>
4912
4913
4914 <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>
4915 !! end
4916
4917 ##
4918 ## Redirects, Parsoid-only
4919 ##
4920 !! test
4921 Simple redirect to page
4922 !! options
4923 parsoid
4924 !! input
4925 #REDIRECT [[Main Page]]
4926 !! result
4927 <link rel="mw:PageProp/redirect" href="./Main_Page">
4928 !! end
4929
4930 !! test
4931 Redirect to category
4932 !! options
4933 parsoid=wt2html
4934 !! input
4935 #REDIRECT [[Category:Foo]]
4936 !! result
4937 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4938 !! end
4939
4940 !! test
4941 Redirect to category page
4942 !! options
4943 parsoid=wt2html,html2html
4944 !! input
4945 #REDIRECT [[:Category:Foo]]
4946 !! result
4947 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4948 !! end
4949
4950 !! test
4951 Redirect to image page
4952 !! options
4953 parsoid
4954 !! input
4955 #REDIRECT [[File:Wiki.png]]
4956 !! result
4957 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4958 !! end
4959
4960 !! test
4961 Redirect to language
4962 !! options
4963 parsoid
4964 !! input
4965 #REDIRECT [[en:File:Wiki.png]]
4966 !! result
4967 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4968 !! end
4969
4970 !! test
4971 Redirect to interwiki
4972 !! options
4973 parsoid
4974 !! input
4975 #REDIRECT [[meatball:File:Wiki.png]]
4976 !! result
4977 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4978 !! end
4979
4980 ##
4981 ## XHTML tidiness
4982 ###
4983
4984 !! test
4985 <br> to <br />
4986 !! input
4987 1<br>2<br />3
4988 !! result
4989 <p>1<br />2<br />3
4990 </p>
4991 !! end
4992
4993 !! test
4994 Broken br tag sanitization
4995 !! options
4996 php
4997 !! input
4998 </br>
4999 !! result
5000 <p>&lt;/br&gt;
5001 </p>
5002 !! end
5003
5004 # TODO: Fix html2html mode (bug 51055)!
5005 !! test
5006 Parsoid: Broken br tag recognition
5007 !! options
5008 parsoid=wt2html
5009 !! input
5010 </br>
5011 !! result
5012 <p><br></p>
5013 !! end
5014
5015 !! test
5016 Incorrecly removing closing slashes from correctly formed XHTML
5017 !! input
5018 <br style="clear:both;" />
5019 !! result
5020 <p><br style="clear:both;" />
5021 </p>
5022 !! end
5023
5024 !! test
5025 Failing to transform badly formed HTML into correct XHTML
5026 !! input
5027 <br style="clear: left;">
5028 <br style="clear: right;">
5029 <br style="clear: both;">
5030 !! result
5031 <p><br style="clear: left;" />
5032 <br style="clear: right;" />
5033 <br style="clear: both;" />
5034 </p>
5035 !!end
5036
5037 !! test
5038 Handling html with a div self-closing tag
5039 !! input
5040 <div title />
5041 <div title/>
5042 <div title/ >
5043 <div title=bar />
5044 <div title=bar/>
5045 <div title=bar/ >
5046 !! result
5047 <p>&lt;div title /&gt;
5048 &lt;div title/&gt;
5049 </p>
5050 <div>
5051 <p>&lt;div title=bar /&gt;
5052 &lt;div title=bar/&gt;
5053 </p>
5054 <div title="bar/"></div>
5055 </div>
5056
5057 !! end
5058
5059 !! test
5060 Handling html with a br self-closing tag
5061 !! input
5062 <br title />
5063 <br title/>
5064 <br title/ >
5065 <br title=bar />
5066 <br title=bar/>
5067 <br title=bar/ >
5068 !! result
5069 <p><br title="title" />
5070 <br title="title" />
5071 <br />
5072 <br title="bar" />
5073 <br title="bar" />
5074 <br title="bar/" />
5075 </p>
5076 !! end
5077
5078 !! test
5079 Horizontal ruler (should it add that extra space?)
5080 !! input
5081 <hr>
5082 <hr >
5083 foo <hr
5084 > bar
5085 !! result
5086 <hr />
5087 <hr />
5088 foo <hr /> bar
5089
5090 !! end
5091
5092 !! test
5093 Horizontal ruler -- 4+ dashes render hr
5094 !! input
5095 ----
5096 !! result
5097 <hr />
5098
5099 !! end
5100
5101 !! test
5102 Horizontal ruler -- eats additional dashes on the same line
5103 !! input
5104 ---------
5105 !! result
5106 <hr />
5107
5108 !! end
5109
5110 !! test
5111 Horizontal ruler -- does not collapse dashes on consecutive lines
5112 !! input
5113 ----
5114 ----
5115 !! result
5116 <hr />
5117 <hr />
5118
5119 !! end
5120
5121 !! test
5122 Horizontal ruler -- <4 dashes render as plain text
5123 !! input
5124 ---
5125 !! result
5126 <p>---
5127 </p>
5128 !! end
5129
5130 !! test
5131 Horizontal ruler -- Supports content following dashes on same line
5132 !! input
5133 ---- Foo
5134 !! result
5135 <hr /> Foo
5136
5137 !! end
5138
5139 ###
5140 ### Block-level elements
5141 ###
5142 !! test
5143 Common list
5144 !! input
5145 *Common list
5146 * item 2
5147 *item 3
5148 !! result
5149 <ul><li>Common list
5150 </li><li> item 2
5151 </li><li>item 3
5152 </li></ul>
5153
5154 !! end
5155
5156 !! test
5157 Numbered list
5158 !! input
5159 #Numbered list
5160 #item 2
5161 # item 3
5162 !! result
5163 <ol><li>Numbered list
5164 </li><li>item 2
5165 </li><li> item 3
5166 </li></ol>
5167
5168 !! end
5169
5170 !! test
5171 Mixed list
5172 !! input
5173 *Mixed list
5174 *# with numbers
5175 ** and bullets
5176 *# and numbers
5177 *bullets again
5178 **bullet level 2
5179 ***bullet level 3
5180 ***#Number on level 4
5181 **bullet level 2
5182 **#Number on level 3
5183 **#Number on level 3
5184 *#number level 2
5185 *Level 1
5186 *** Level 3
5187 #** Level 3, but ordered
5188 !! result
5189 <ul><li>Mixed list
5190 <ol><li> with numbers
5191 </li></ol>
5192 <ul><li> and bullets
5193 </li></ul>
5194 <ol><li> and numbers
5195 </li></ol>
5196 </li><li>bullets again
5197 <ul><li>bullet level 2
5198 <ul><li>bullet level 3
5199 <ol><li>Number on level 4
5200 </li></ol>
5201 </li></ul>
5202 </li><li>bullet level 2
5203 <ol><li>Number on level 3
5204 </li><li>Number on level 3
5205 </li></ol>
5206 </li></ul>
5207 <ol><li>number level 2
5208 </li></ol>
5209 </li><li>Level 1
5210 <ul><li><ul><li> Level 3
5211 </li></ul>
5212 </li></ul>
5213 </li></ul>
5214 <ol><li><ul><li><ul><li> Level 3, but ordered
5215 </li></ul>
5216 </li></ul>
5217 </li></ol>
5218
5219 !! end
5220
5221 !! test
5222 Nested lists 1
5223 !! input
5224 *foo
5225 **bar
5226 !! result
5227 <ul><li>foo
5228 <ul><li>bar
5229 </li></ul>
5230 </li></ul>
5231
5232 !! end
5233
5234 !! test
5235 Nested lists 2
5236 !! input
5237 **foo
5238 *bar
5239 !! result
5240 <ul><li><ul><li>foo
5241 </li></ul>
5242 </li><li>bar
5243 </li></ul>
5244
5245 !! end
5246
5247 !! test
5248 Nested lists 3 (first element empty)
5249 !! input
5250 *
5251 **bar
5252 !! result
5253 <ul><li>
5254 <ul><li>bar
5255 </li></ul>
5256 </li></ul>
5257
5258 !! end
5259
5260 !! test
5261 Nested lists 4 (first element empty)
5262 !! input
5263 **
5264 *bar
5265 !! result
5266 <ul><li><ul><li>
5267 </li></ul>
5268 </li><li>bar
5269 </li></ul>
5270
5271 !! end
5272
5273 !! test
5274 Nested lists 5 (both elements empty)
5275 !! input
5276 **
5277 *
5278 !! result
5279 <ul><li><ul><li>
5280 </li></ul>
5281 </li><li>
5282 </li></ul>
5283
5284 !! end
5285
5286 !! test
5287 Nested lists 6 (both elements empty)
5288 !! input
5289 *
5290 **
5291 !! result
5292 <ul><li>
5293 <ul><li>
5294 </li></ul>
5295 </li></ul>
5296
5297 !! end
5298
5299 !! test
5300 Nested lists 7 (skip initial nesting levels)
5301 !! input
5302 *** foo
5303 !! result
5304 <ul><li><ul><li><ul><li> foo
5305 </li></ul>
5306 </li></ul>
5307 </li></ul>
5308
5309 !! end
5310
5311 !! test
5312 Nested lists 8 (multiple nesting transitions)
5313 !! input
5314 * foo
5315 *** bar
5316 ** baz
5317 * boo
5318 !! result
5319 <ul><li> foo
5320 <ul><li><ul><li> bar
5321 </li></ul>
5322 </li><li> baz
5323 </li></ul>
5324 </li><li> boo
5325 </li></ul>
5326
5327 !! end
5328
5329 !! test
5330 1. Lists with start-of-line-transparent tokens before bullets: Comments
5331 !! input
5332 *foo
5333 *<!--cmt-->bar
5334 <!--cmt-->*baz
5335 !! result
5336 <ul><li>foo
5337 </li><li>bar
5338 </li><li>baz
5339 </li></ul>
5340
5341 !! end
5342
5343 !! test
5344 2. Lists with start-of-line-transparent tokens before bullets: Template close
5345 !! input
5346 *foo {{echo|bar
5347 }}*baz
5348 !! result
5349 <ul><li>foo bar
5350 </li><li>baz
5351 </li></ul>
5352
5353 !! end
5354
5355 !! test
5356 List items are not parsed correctly following a <pre> block (bug 785)
5357 !! input
5358 * <pre>foo</pre>
5359 * <pre>bar</pre>
5360 * zar
5361 !! result
5362 <ul><li> <pre>foo</pre>
5363 </li><li> <pre>bar</pre>
5364 </li><li> zar
5365 </li></ul>
5366
5367 !! end
5368
5369 !! test
5370 List items from template
5371 !! input
5372
5373 {{inner list}}
5374 * item 2
5375
5376 * item 0
5377 {{inner list}}
5378 * item 2
5379
5380 * item 0
5381 * notSOL{{inner list}}
5382 * item 2
5383 !! result
5384 <ul><li> item 1
5385 </li><li> item 2
5386 </li></ul>
5387 <ul><li> item 0
5388 </li><li> item 1
5389 </li><li> item 2
5390 </li></ul>
5391 <ul><li> item 0
5392 </li><li> notSOL
5393 </li><li> item 1
5394 </li><li> item 2
5395 </li></ul>
5396
5397 !! end
5398
5399 !! test
5400 List interrupted by empty line or heading
5401 !! input
5402 * foo
5403
5404 ** bar
5405 == A heading ==
5406 * Another list item
5407 !! result
5408 <ul><li> foo
5409 </li></ul>
5410 <ul><li><ul><li> bar
5411 </li></ul>
5412 </li></ul>
5413 <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>
5414 <ul><li> Another list item
5415 </li></ul>
5416
5417 !!end
5418
5419 !!test
5420 Multiple list tags generated by templates
5421 !!input
5422 {{echo|<li>}}a
5423 {{echo|<li>}}b
5424 {{echo|<li>}}c
5425 !!result
5426 <li>a
5427 <li>b
5428 <li>c</li>
5429 </li>
5430 </li>
5431
5432 !!end
5433
5434 !!test
5435 Single-comment whitespace lines dont break lists, and so do multi-comment whitespace lines
5436 !!input
5437 *a
5438 <!--This line will NOT split the list-->
5439 *b
5440 <!--This line will NOT split the list either-->
5441 *c
5442 <!--foo--> <!----> <!--This line NOT split the list either-->
5443 *d
5444 !!result
5445 <ul><li>a
5446 </li><li>b
5447 </li><li>c
5448 </li><li>d
5449 </li></ul>
5450
5451 !!end
5452
5453 !!test
5454 Test the li-hack
5455 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5456 !!options
5457 parsoid=wt2html,wt2wt
5458 !!input
5459 * foo
5460 * <li>li-hack
5461 * {{echo|<li>templated li-hack}}
5462 * <!--foo--> <li> unsupported li-hack with preceding comments
5463
5464 <ul>
5465 <li><li>not a li-hack
5466 </li>
5467 </ul>
5468 !!result
5469 <ul><li> foo</li>
5470 <li>li-hack</li>
5471 <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>
5472 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5473
5474 <ul>
5475 <li></li><li>not a li-hack
5476 </li>
5477 </ul>
5478 !!end
5479
5480 !! test
5481 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5482 !! options
5483 parsoid
5484 !! input
5485 # foo
5486 ## bar
5487 * foo
5488 ** bar
5489 : foo
5490 :: bar
5491 !! result
5492 <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>
5493 !! end
5494
5495 # ------------------------------------------------------------------------
5496 # The next set of tests are about Parsoid's ability to handle badly nested
5497 # tags (parse, minimize scope of fixup, and roundtrip back)
5498 # ------------------------------------------------------------------------
5499
5500 !! test
5501 Unbalanced closing block tags break a list
5502 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5503 !! options
5504 parsoid
5505 !! input
5506 <div>
5507 *a</div><div>
5508 *b</div>
5509 !! result
5510 <div>
5511 <ul><li>a
5512 </li></ul></div><div>
5513 <ul><li>b
5514 </li></ul></div>
5515 !! end
5516
5517 !! test
5518 Unbalanced closing non-block tags don't break a list
5519 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5520 !! options
5521 parsoid
5522 !! input
5523 <span>
5524 *a</span><span>
5525 *b</span>
5526 !! result
5527 <p><span></span>
5528 </p>
5529 <ul><li>a<span></span>
5530 </li><li>b
5531 </li></ul>
5532 !! end
5533
5534 !! test
5535 Unclosed formatting tags that straddle lists are closed and reopened
5536 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5537 !! options
5538 parsoid
5539 !! input
5540 # <s> a
5541 # b </s>
5542 !! result
5543 <ol><li> <s> a </s>
5544 </li><li> <s> b </s>
5545 </li></ol>
5546 !! end
5547
5548 !!test
5549 List embedded in a non-block tag
5550 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5551 !! options
5552 parsoid
5553 !!input
5554 <small>
5555 * foo
5556 </small>
5557 !!result
5558 <p><small></small></p>
5559 <small>
5560 <ul>
5561 <li> foo</li>
5562 </ul>
5563 </small>
5564 <p><small></small></p>
5565 !!end
5566
5567 ###
5568 ### Magic Words
5569 ###
5570
5571 # Note that the current date is hard-coded as
5572 # 1970-01-01T00:02:03Z (a Thursday)
5573 # when running parser tests. The timezone is also fixed to GMT, so
5574 # local date will be identical to current date.
5575
5576 !! test
5577 Magic Word: {{CURRENTDAY}}
5578 !! input
5579 {{CURRENTDAY}}
5580 !! result
5581 <p>1
5582 </p>
5583 !! end
5584
5585 !! test
5586 Magic Word: {{CURRENTDAY2}}
5587 !! input
5588 {{CURRENTDAY2}}
5589 !! result
5590 <p>01
5591 </p>
5592 !! end
5593
5594 !! test
5595 Magic Word: {{CURRENTDAYNAME}}
5596 !! input
5597 {{CURRENTDAYNAME}}
5598 !! result
5599 <p>Thursday
5600 </p>
5601 !! end
5602
5603 !! test
5604 Magic Word: {{CURRENTDOW}}
5605 !! input
5606 {{CURRENTDOW}}
5607 !! result
5608 <p>4
5609 </p>
5610 !! end
5611
5612 !! test
5613 Magic Word: {{CURRENTMONTH}}
5614 !! input
5615 {{CURRENTMONTH}}
5616 !! result
5617 <p>01
5618 </p>
5619 !! end
5620
5621 !! test
5622 Magic Word: {{CURRENTMONTH1}}
5623 !! input
5624 {{CURRENTMONTH1}}
5625 !! result
5626 <p>1
5627 </p>
5628 !! end
5629
5630 !! test
5631 Magic Word: {{CURRENTMONTHABBREV}}
5632 !! input
5633 {{CURRENTMONTHABBREV}}
5634 !! result
5635 <p>Jan
5636 </p>
5637 !! end
5638
5639 !! test
5640 Magic Word: {{CURRENTMONTHNAME}}
5641 !! input
5642 {{CURRENTMONTHNAME}}
5643 !! result
5644 <p>January
5645 </p>
5646 !! end
5647
5648 !! test
5649 Magic Word: {{CURRENTMONTHNAMEGEN}}
5650 !! input
5651 {{CURRENTMONTHNAMEGEN}}
5652 !! result
5653 <p>January
5654 </p>
5655 !! end
5656
5657 !! test
5658 Magic Word: {{CURRENTTIME}}
5659 !! input
5660 {{CURRENTTIME}}
5661 !! result
5662 <p>00:02
5663 </p>
5664 !! end
5665
5666 !! test
5667 Magic Word: {{CURRENTHOUR}}
5668 !! input
5669 {{CURRENTHOUR}}
5670 !! result
5671 <p>00
5672 </p>
5673 !! end
5674
5675 !! test
5676 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5677 !! input
5678 {{CURRENTWEEK}}
5679 !! result
5680 <p>1
5681 </p>
5682 !! end
5683
5684 !! test
5685 Magic Word: {{CURRENTYEAR}}
5686 !! input
5687 {{CURRENTYEAR}}
5688 !! result
5689 <p>1970
5690 </p>
5691 !! end
5692
5693 !! test
5694 Magic Word: {{CURRENTTIMESTAMP}}
5695 !! input
5696 {{CURRENTTIMESTAMP}}
5697 !! result
5698 <p>19700101000203
5699 </p>
5700 !! end
5701
5702 !! test
5703 Magic Words LOCAL (UTC)
5704 !! input
5705 * {{LOCALMONTH}}
5706 * {{LOCALMONTH1}}
5707 * {{LOCALMONTHNAME}}
5708 * {{LOCALMONTHNAMEGEN}}
5709 * {{LOCALMONTHABBREV}}
5710 * {{LOCALDAY}}
5711 * {{LOCALDAY2}}
5712 * {{LOCALDAYNAME}}
5713 * {{LOCALYEAR}}
5714 * {{LOCALTIME}}
5715 * {{LOCALHOUR}}
5716 * {{LOCALWEEK}}
5717 * {{LOCALDOW}}
5718 * {{LOCALTIMESTAMP}}
5719 !! result
5720 <ul><li> 01
5721 </li><li> 1
5722 </li><li> January
5723 </li><li> January
5724 </li><li> Jan
5725 </li><li> 1
5726 </li><li> 01
5727 </li><li> Thursday
5728 </li><li> 1970
5729 </li><li> 00:02
5730 </li><li> 00
5731 </li><li> 1
5732 </li><li> 4
5733 </li><li> 19700101000203
5734 </li></ul>
5735
5736 !! end
5737
5738 !! test
5739 Magic Word: {{FULLPAGENAME}}
5740 !! options
5741 title=[[User:Ævar Arnfjörð Bjarmason]]
5742 !! input
5743 {{FULLPAGENAME}}
5744 !! result
5745 <p>User:Ævar Arnfjörð Bjarmason
5746 </p>
5747 !! end
5748
5749 !! test
5750 Magic Word: {{FULLPAGENAMEE}}
5751 !! options
5752 title=[[User:Ævar Arnfjörð Bjarmason]]
5753 !! input
5754 {{FULLPAGENAMEE}}
5755 !! result
5756 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5757 </p>
5758 !! end
5759
5760 !! test
5761 Magic Word: {{TALKSPACE}}
5762 !! options
5763 title=[[User:Ævar Arnfjörð Bjarmason]]
5764 !! input
5765 {{TALKSPACE}}
5766 !! result
5767 <p>User talk
5768 </p>
5769 !! end
5770
5771 !! test
5772 Magic Word: {{TALKSPACE}}, same namespace
5773 !! options
5774 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5775 !! input
5776 {{TALKSPACE}}
5777 !! result
5778 <p>User talk
5779 </p>
5780 !! end
5781
5782 !! test
5783 Magic Word: {{TALKSPACE}}, main namespace
5784 !! options
5785 title=[[Parser Test]]
5786 !! input
5787 {{TALKSPACE}}
5788 !! result
5789 <p>Talk
5790 </p>
5791 !! end
5792
5793 !! test
5794 Magic Word: {{TALKSPACEE}}
5795 !! options
5796 title=[[User:Ævar Arnfjörð Bjarmason]]
5797 !! input
5798 {{TALKSPACEE}}
5799 !! result
5800 <p>User_talk
5801 </p>
5802 !! end
5803
5804 !! test
5805 Magic Word: {{SUBJECTSPACE}}
5806 !! options
5807 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5808 !! input
5809 {{SUBJECTSPACE}}
5810 !! result
5811 <p>User
5812 </p>
5813 !! end
5814
5815 !! test
5816 Magic Word: {{SUBJECTSPACE}}, same namespace
5817 !! options
5818 title=[[User:Ævar Arnfjörð Bjarmason]]
5819 !! input
5820 {{SUBJECTSPACE}}
5821 !! result
5822 <p>User
5823 </p>
5824 !! end
5825
5826 !! test
5827 Magic Word: {{SUBJECTSPACE}}, main namespace
5828 !! options
5829 title=[[Parser Test]]
5830 !! input
5831 {{SUBJECTSPACE}}
5832 !! result
5833
5834 !! end
5835
5836 !! test
5837 Magic Word: {{SUBJECTSPACEE}}
5838 !! options
5839 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5840 !! input
5841 {{SUBJECTSPACEE}}
5842 !! result
5843 <p>User
5844 </p>
5845 !! end
5846
5847 !! test
5848 Magic Word: {{NAMESPACE}}
5849 !! options
5850 title=[[User:Ævar Arnfjörð Bjarmason]]
5851 !! input
5852 {{NAMESPACE}}
5853 !! result
5854 <p>User
5855 </p>
5856 !! end
5857
5858 !! test
5859 Magic Word: {{NAMESPACEE}}
5860 !! options
5861 title=[[User:Ævar Arnfjörð Bjarmason]]
5862 !! input
5863 {{NAMESPACEE}}
5864 !! result
5865 <p>User
5866 </p>
5867 !! end
5868
5869 !! test
5870 Magic Word: {{NAMESPACENUMBER}}
5871 !! options
5872 title=[[User:Ævar Arnfjörð Bjarmason]]
5873 !! input
5874 {{NAMESPACENUMBER}}
5875 !! result
5876 <p>2
5877 </p>
5878 !! end
5879
5880 !! test
5881 Magic Word: {{SUBPAGENAME}}
5882 !! options
5883 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5884 !! input
5885 {{SUBPAGENAME}}
5886 !! result
5887 <p>sub ö
5888 </p>
5889 !! end
5890
5891 !! test
5892 Magic Word: {{SUBPAGENAMEE}}
5893 !! options
5894 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
5895 !! input
5896 {{SUBPAGENAMEE}}
5897 !! result
5898 <p>sub_%C3%B6
5899 </p>
5900 !! end
5901
5902 !! test
5903 Magic Word: {{ROOTPAGENAME}}
5904 !! options
5905 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
5906 !! input
5907 {{ROOTPAGENAME}}
5908 !! result
5909 <p>Ævar Arnfjörð Bjarmason
5910 </p>
5911 !! end
5912
5913 !! test
5914 Magic Word: {{ROOTPAGENAMEE}}
5915 !! options
5916 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
5917 !! input
5918 {{ROOTPAGENAMEE}}
5919 !! result
5920 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5921 </p>
5922 !! end
5923
5924 !! test
5925 Magic Word: {{BASEPAGENAME}}
5926 !! options
5927 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
5928 !! input
5929 {{BASEPAGENAME}}
5930 !! result
5931 <p>Ævar Arnfjörð Bjarmason
5932 </p>
5933 !! end
5934
5935 !! test
5936 Magic Word: {{BASEPAGENAMEE}}
5937 !! options
5938 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
5939 !! input
5940 {{BASEPAGENAMEE}}
5941 !! result
5942 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5943 </p>
5944 !! end
5945
5946 !! test
5947 Magic Word: {{TALKPAGENAME}}
5948 !! options
5949 title=[[User:Ævar Arnfjörð Bjarmason]]
5950 !! input
5951 {{TALKPAGENAME}}
5952 !! result
5953 <p>User talk:Ævar Arnfjörð Bjarmason
5954 </p>
5955 !! end
5956
5957 !! test
5958 Magic Word: {{TALKPAGENAMEE}}
5959 !! options
5960 title=[[User:Ævar Arnfjörð Bjarmason]]
5961 !! input
5962 {{TALKPAGENAMEE}}
5963 !! result
5964 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5965 </p>
5966 !! end
5967
5968 !! test
5969 Magic Word: {{SUBJECTPAGENAME}}
5970 !! options
5971 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5972 !! input
5973 {{SUBJECTPAGENAME}}
5974 !! result
5975 <p>User:Ævar Arnfjörð Bjarmason
5976 </p>
5977 !! end
5978
5979 !! test
5980 Magic Word: {{SUBJECTPAGENAMEE}}
5981 !! options
5982 title=[[User talk:Ævar Arnfjörð Bjarmason]]
5983 !! input
5984 {{SUBJECTPAGENAMEE}}
5985 !! result
5986 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5987 </p>
5988 !! end
5989
5990 !! test
5991 Magic Word: {{NUMBEROFFILES}}
5992 !! input
5993 {{NUMBEROFFILES}}
5994 !! result
5995 <p>4
5996 </p>
5997 !! end
5998
5999 !! test
6000 Magic Word: {{PAGENAME}}
6001 !! options
6002 title=[[User:Ævar Arnfjörð Bjarmason]]
6003 !! input
6004 {{PAGENAME}}
6005 !! result
6006 <p>Ævar Arnfjörð Bjarmason
6007 </p>
6008 !! end
6009
6010 !! test
6011 Magic Word: {{PAGENAME}} with metacharacters
6012 !! options
6013 title=[['foo & bar = baz']]
6014 !! input
6015 ''{{PAGENAME}}''
6016 !! result
6017 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6018 </p>
6019 !! end
6020
6021 !! test
6022 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6023 !! options
6024 title=[[*RFC 1234 http://example.com/]]
6025 !! input
6026 {{PAGENAME}}
6027 !! result
6028 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6029 </p>
6030 !! end
6031
6032 !! test
6033 Magic Word: {{PAGENAMEE}}
6034 !! options
6035 title=[[User:Ævar Arnfjörð Bjarmason]]
6036 !! input
6037 {{PAGENAMEE}}
6038 !! result
6039 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6040 </p>
6041 !! end
6042
6043 !! test
6044 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6045 !! options
6046 title=[[*RFC 1234 http://example.com/]]
6047 !! input
6048 {{PAGENAMEE}}
6049 !! result
6050 <p>&#42;RFC_1234_http&#58;//example.com/
6051 </p>
6052 !! end
6053
6054 !! test
6055 Magic Word: {{REVISIONID}}
6056 !! input
6057 {{REVISIONID}}
6058 !! result
6059 <p>1337
6060 </p>
6061 !! end
6062
6063 !! test
6064 Magic Word: {{SCRIPTPATH}}
6065 !! input
6066 {{SCRIPTPATH}}
6067 !! result
6068 <p>/
6069 </p>
6070 !! end
6071
6072 !! test
6073 Magic Word: {{STYLEPATH}}
6074 !! input
6075 {{STYLEPATH}}
6076 !! result
6077 <p>/skins
6078 </p>
6079 !! end
6080
6081 !! test
6082 Magic Word: {{SERVER}}
6083 !! input
6084 {{SERVER}}
6085 !! result
6086 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6087 </p>
6088 !! end
6089
6090 !! test
6091 Magic Word: {{SERVERNAME}}
6092 !! input
6093 {{SERVERNAME}}
6094 !! result
6095 <p>example.org
6096 </p>
6097 !! end
6098
6099 !! test
6100 Magic Word: {{SITENAME}}
6101 !! input
6102 {{SITENAME}}
6103 !! result
6104 <p>MediaWiki
6105 </p>
6106 !! end
6107
6108 !! test
6109 Case-sensitive magic words, when cased differently, should just be template transclusions
6110 !! input
6111 {{CurrentMonth}}
6112 {{currentday}}
6113 {{cURreNTweEK}}
6114 {{currentHour}}
6115 !! result
6116 <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>
6117 <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>
6118 <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>
6119 <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>
6120 </p>
6121 !! end
6122
6123 !! test
6124 Case-insensitive magic words should still work with weird casing.
6125 !! input
6126 {{sErVeRNaMe}}
6127 {{LCFirst:AOEU}}
6128 {{ucFIRST:aoeu}}
6129 {{SERver}}
6130 !! result
6131 <p>example.org
6132 aOEU
6133 Aoeu
6134 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6135 </p>
6136 !! end
6137
6138 !! test
6139 Namespace 1 {{ns:1}}
6140 !! input
6141 {{ns:1}}
6142 !! result
6143 <p>Talk
6144 </p>
6145 !! end
6146
6147 !! test
6148 Namespace 1 {{ns:01}}
6149 !! input
6150 {{ns:01}}
6151 !! result
6152 <p>Talk
6153 </p>
6154 !! end
6155
6156 !! test
6157 Namespace 0 {{ns:0}} (bug 4783)
6158 !! input
6159 {{ns:0}}
6160 !! result
6161
6162 !! end
6163
6164 !! test
6165 Namespace 0 {{ns:00}} (bug 4783)
6166 !! input
6167 {{ns:00}}
6168 !! result
6169
6170 !! end
6171
6172 !! test
6173 Namespace -1 {{ns:-1}}
6174 !! input
6175 {{ns:-1}}
6176 !! result
6177 <p>Special
6178 </p>
6179 !! end
6180
6181 !! test
6182 Namespace User {{ns:User}}
6183 !! input
6184 {{ns:User}}
6185 !! result
6186 <p>User
6187 </p>
6188 !! end
6189
6190 !! test
6191 Namespace User talk {{ns:User_talk}}
6192 !! input
6193 {{ns:User_talk}}
6194 !! result
6195 <p>User talk
6196 </p>
6197 !! end
6198
6199 !! test
6200 Namespace User talk {{ns:uSeR tAlK}}
6201 !! input
6202 {{ns:uSeR tAlK}}
6203 !! result
6204 <p>User talk
6205 </p>
6206 !! end
6207
6208 !! test
6209 Namespace File {{ns:File}}
6210 !! input
6211 {{ns:File}}
6212 !! result
6213 <p>File
6214 </p>
6215 !! end
6216
6217 !! test
6218 Namespace File {{ns:Image}}
6219 !! input
6220 {{ns:Image}}
6221 !! result
6222 <p>File
6223 </p>
6224 !! end
6225
6226 !! test
6227 Namespace (lang=de) Benutzer {{ns:User}}
6228 !! options
6229 language=de
6230 !! input
6231 {{ns:User}}
6232 !! result
6233 <p>Benutzer
6234 </p>
6235 !! end
6236
6237 !! test
6238 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6239 !! options
6240 language=de
6241 !! input
6242 {{ns:3}}
6243 !! result
6244 <p>Benutzer Diskussion
6245 </p>
6246 !! end
6247
6248
6249 !! test
6250 Urlencode
6251 !! input
6252 {{urlencode:hi world?!}}
6253 {{urlencode:hi world?!|WIKI}}
6254 {{urlencode:hi world?!|PATH}}
6255 {{urlencode:hi world?!|QUERY}}
6256 !! result
6257 <p>hi+world%3F%21
6258 hi_world%3F!
6259 hi%20world%3F%21
6260 hi+world%3F%21
6261 </p>
6262 !! end
6263
6264 ###
6265 ### Magic links
6266 ###
6267 !! test
6268 Magic links: internal link to RFC (bug 479)
6269 !! input
6270 [[RFC 123]]
6271 !! result
6272 <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>
6273 </p>
6274 !! end
6275
6276 !! test
6277 Magic links: RFC (bug 479)
6278 !! input
6279 RFC 822
6280 !! result
6281 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6282 </p>
6283 !! end
6284
6285 !! test
6286 Magic links: ISBN (bug 1937)
6287 !! input
6288 ISBN 0-306-40615-2
6289 !! result
6290 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6291 </p>
6292 !! end
6293
6294 !! test
6295 Magic links: PMID incorrectly converts space to underscore
6296 !! input
6297 PMID 1234
6298 !! result
6299 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6300 </p>
6301 !! end
6302
6303 ###
6304 ### Templates
6305 ####
6306
6307 !! test
6308 Nonexistent template
6309 !! input
6310 {{thistemplatedoesnotexist}}
6311 !! result
6312 <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>
6313 </p>
6314 !! end
6315
6316 !! test
6317 Template with invalid target containing tags
6318 !! input
6319 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6320 !! result
6321 <p>{{a<b>b</b>|foo|a=b|a = b}}
6322 </p>
6323 !! end
6324
6325 !! test
6326 Template with invalid target containing unclosed tag
6327 !! input
6328 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6329 !! result
6330 <p>{{a<b>|foo|a=b|a = b}}</b>
6331 </p>
6332 !! end
6333
6334 !! article
6335 Template:test
6336 !! text
6337 This is a test template
6338 !! endarticle
6339
6340 !! test
6341 Simple template
6342 !! input
6343 {{test}}
6344 !! result
6345 <p>This is a test template
6346 </p>
6347 !! end
6348
6349 !! test
6350 Template with explicit namespace
6351 !! input
6352 {{Template:test}}
6353 !! result
6354 <p>This is a test template
6355 </p>
6356 !! end
6357
6358
6359 !! article
6360 Template:paramtest
6361 !! text
6362 This is a test template with parameter {{{param}}}
6363 !! endarticle
6364
6365 !! test
6366 Template parameter
6367 !! input
6368 {{paramtest|param=foo}}
6369 !! result
6370 <p>This is a test template with parameter foo
6371 </p>
6372 !! end
6373
6374 !! article
6375 Template:paramtestnum
6376 !! text
6377 [[{{{1}}}|{{{2}}}]]
6378 !! endarticle
6379
6380 !! test
6381 Template unnamed parameter
6382 !! input
6383 {{paramtestnum|Main Page|the main page}}
6384 !! result
6385 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6386 </p>
6387 !! end
6388
6389 !! article
6390 Template:templatesimple
6391 !! text
6392 (test)
6393 !! endarticle
6394
6395 !! article
6396 Template:templateredirect
6397 !! text
6398 #redirect [[Template:templatesimple]]
6399 !! endarticle
6400
6401 !! article
6402 Template:templateasargtestnum
6403 !! text
6404 {{{{{1}}}}}
6405 !! endarticle
6406
6407 !! article
6408 Template:templateasargtest
6409 !! text
6410 {{template{{{templ}}}}}
6411 !! endarticle
6412
6413 !! article
6414 Template:templateasargtest2
6415 !! text
6416 {{{{{templ}}}}}
6417 !! endarticle
6418
6419 !! test
6420 Template with template name as unnamed argument
6421 !! input
6422 {{templateasargtestnum|templatesimple}}
6423 !! result
6424 <p>(test)
6425 </p>
6426 !! end
6427
6428 !! test
6429 Template with template name as argument
6430 !! input
6431 {{templateasargtest|templ=simple}}
6432 !! result
6433 <p>(test)
6434 </p>
6435 !! end
6436
6437 !! test
6438 Template with template name as argument (2)
6439 !! input
6440 {{templateasargtest2|templ=templatesimple}}
6441 !! result
6442 <p>(test)
6443 </p>
6444 !! end
6445
6446 !! article
6447 Template:templateasargtestdefault
6448 !! text
6449 {{{{{templ|templatesimple}}}}}
6450 !! endarticle
6451
6452 !! article
6453 Template:templa
6454 !! text
6455 '''templ'''
6456 !! endarticle
6457
6458 !! test
6459 Template with default value
6460 !! input
6461 {{templateasargtestdefault}}
6462 !! result
6463 <p>(test)
6464 </p>
6465 !! end
6466
6467 !! test
6468 Template with default value (value set)
6469 !! input
6470 {{templateasargtestdefault|templ=templa}}
6471 !! result
6472 <p><b>templ</b>
6473 </p>
6474 !! end
6475
6476 !! test
6477 Template redirect
6478 !! input
6479 {{templateredirect}}
6480 !! result
6481 <p>(test)
6482 </p>
6483 !! end
6484
6485 !! test
6486 Template with argument in separate line
6487 !! input
6488 {{ templateasargtest |
6489 templ = simple }}
6490 !! result
6491 <p>(test)
6492 </p>
6493 !! end
6494
6495 !! test
6496 Template with complex template as argument
6497 !! input
6498 {{paramtest|
6499 param ={{ templateasargtest |
6500 templ = simple }}}}
6501 !! result
6502 <p>This is a test template with parameter (test)
6503 </p>
6504 !! end
6505
6506 !! test
6507 Template with thumb image (with link in description)
6508 !! input
6509 {{paramtest|
6510 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6511 !! result
6512 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>
6513
6514 !! end
6515
6516 !! article
6517 Template:complextemplate
6518 !! text
6519 {{{1}}} {{paramtest|
6520 param ={{{param}}}}}
6521 !! endarticle
6522
6523 !! test
6524 Template with complex arguments
6525 !! input
6526 {{complextemplate|
6527 param ={{ templateasargtest |
6528 templ = simple }}|[[Template:complextemplate|link]]}}
6529 !! result
6530 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6531 </p>
6532 !! end
6533
6534 !! test
6535 BUG 553: link with two variables in a piped link
6536 !! input
6537 {|
6538 |[[{{{1}}}|{{{2}}}]]
6539 |}
6540 !! result
6541 <table>
6542 <tr>
6543 <td>[[{{{1}}}|{{{2}}}]]
6544 </td></tr></table>
6545
6546 !! end
6547
6548 !! test
6549 Magic variable as template parameter
6550 !! input
6551 {{paramtest|param={{SITENAME}}}}
6552 !! result
6553 <p>This is a test template with parameter MediaWiki
6554 </p>
6555 !! end
6556
6557 !! article
6558 Template:linktest
6559 !! text
6560 [[{{{param}}}|link]]
6561 !! endarticle
6562
6563 !! test
6564 Template parameter as link source
6565 !! input
6566 {{linktest|param=Main Page}}
6567 !! result
6568 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6569 </p>
6570 !! end
6571
6572 !!test
6573 Template-generated attribute string (k='v')
6574 !!input
6575 <span {{attr_str|id|v1}}>bar</span>
6576 !!result
6577 <p><span id="v1">bar</span>
6578 </p>
6579 !!end
6580
6581 !!article
6582 Template:paramtest2
6583 !! text
6584 including another template, {{paramtest|param={{{arg}}}}}
6585 !! endarticle
6586
6587 !! test
6588 Template passing argument to another template
6589 !! input
6590 {{paramtest2|arg='hmm'}}
6591 !! result
6592 <p>including another template, This is a test template with parameter 'hmm'
6593 </p>
6594 !! end
6595
6596 !! article
6597 Template:Linktest2
6598 !! text
6599 Main Page
6600 !! endarticle
6601
6602 !! test
6603 Template as link source
6604 !! input
6605 [[{{linktest2}}]]
6606
6607 [[{{linktest2}}|Main Page]]
6608
6609 [[{{linktest2}}]]Page
6610 !! result
6611 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6612 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6613 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6614 </p>
6615 !! end
6616
6617
6618 !! article
6619 Template:loop1
6620 !! text
6621 {{loop2}}
6622 !! endarticle
6623
6624 !! article
6625 Template:loop2
6626 !! text
6627 {{loop1}}
6628 !! endarticle
6629
6630 !! test
6631 Template infinite loop
6632 !! input
6633 {{loop1}}
6634 !! result
6635 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6636 </p>
6637 !! end
6638
6639 !! test
6640 Template from main namespace
6641 !! input
6642 {{:Main Page}}
6643 !! result
6644 <p>blah blah
6645 </p>
6646 !! end
6647
6648 !! article
6649 Template:table
6650 !! text
6651 {|
6652 | 1 || 2
6653 |-
6654 | 3 || 4
6655 |}
6656 !! endarticle
6657
6658 !! test
6659 BUG 529: Template with table, not included at beginning of line
6660 !! input
6661 foo {{table}}
6662 !! result
6663 <p>foo
6664 </p>
6665 <table>
6666 <tr>
6667 <td> 1 </td>
6668 <td> 2
6669 </td></tr>
6670 <tr>
6671 <td> 3 </td>
6672 <td> 4
6673 </td></tr></table>
6674
6675 !! end
6676
6677 !! test
6678 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6679 !! input
6680 foo
6681 {{table}}
6682 !! result
6683 <p>foo
6684 </p>
6685 <table>
6686 <tr>
6687 <td> 1 </td>
6688 <td> 2
6689 </td></tr>
6690 <tr>
6691 <td> 3 </td>
6692 <td> 4
6693 </td></tr></table>
6694
6695 !! end
6696
6697 !! test
6698 BUG 41: Template parameters shown as broken links
6699 !! input
6700 {{{parameter}}}
6701 !! result
6702 <p>{{{parameter}}}
6703 </p>
6704 !! end
6705
6706 !! test
6707 Template with targets containing wikilinks
6708 !! input
6709 {{[[foo]]}}
6710
6711 {{[[{{echo|foo}}]]}}
6712
6713 {{{{echo|[[foo}}]]}}
6714 !! result
6715 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6716 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6717 </p><p>{{[[foo}}]]
6718 </p>
6719 !! end
6720
6721 !! article
6722 Template:MSGNW test
6723 !! text
6724 ''None'' of '''this''' should be
6725 * interpreted
6726 but rather passed unmodified
6727 {{test}}
6728 !! endarticle
6729
6730 # hmm, fix this or just deprecate msgnw and document its behavior?
6731 !! test
6732 msgnw keyword
6733 !! options
6734 disabled
6735 !! input
6736 {{msgnw:MSGNW test}}
6737 !! result
6738 <p>''None'' of '''this''' should be
6739 * interpreted
6740 but rather passed unmodified
6741 {{test}}
6742 </p>
6743 !! end
6744
6745 !! test
6746 int keyword
6747 !! input
6748 {{int:youhavenewmessages|lots of money|not!}}
6749 !! result
6750 <p>You have lots of money (not!).
6751 </p>
6752 !! end
6753
6754 !! article
6755 Template:Includes
6756 !! text
6757 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6758 !! endarticle
6759
6760 !! test
6761 <includeonly> and <noinclude> being included
6762 !! input
6763 {{Includes}}
6764 !! result
6765 <p>Foobar
6766 </p>
6767 !! end
6768
6769 !! article
6770 Template:Includes2
6771 !! text
6772 <onlyinclude>Foo</onlyinclude>bar
6773 !! endarticle
6774
6775 !! test
6776 <onlyinclude> being included
6777 !! input
6778 {{Includes2}}
6779 !! result
6780 <p>Foo
6781 </p>
6782 !! end
6783
6784
6785 !! article
6786 Template:Includes3
6787 !! text
6788 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6789 !! endarticle
6790
6791 !! test
6792 <onlyinclude> and <includeonly> being included
6793 !! input
6794 {{Includes3}}
6795 !! result
6796 <p>Foo
6797 </p>
6798 !! end
6799
6800 !! test
6801 <includeonly> and <noinclude> on a page
6802 !! input
6803 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6804 !! result
6805 <p>Foozar
6806 </p>
6807 !! end
6808
6809 !! test
6810 Un-closed <noinclude>
6811 !! input
6812 <noinclude>
6813 !! result
6814 !! end
6815
6816 !! test
6817 <onlyinclude> on a page
6818 !! input
6819 <onlyinclude>Foo</onlyinclude>bar
6820 !! result
6821 <p>Foobar
6822 </p>
6823 !! end
6824
6825 !! test
6826 Un-closed <onlyinclude>
6827 !! input
6828 <onlyinclude>
6829 !! result
6830 !! end
6831
6832 !!test
6833 Self-closed noinclude, includeonly, onlyinclude tags
6834 !!input
6835 <noinclude />
6836 <includeonly />
6837 <onlyinclude />
6838 !!result
6839 <p><br />
6840 </p>
6841 !!end
6842
6843 !!test
6844 Unbalanced includeonly and noinclude tags
6845 !!input
6846 {|
6847 |a</noinclude>
6848 |b</noinclude></noinclude>
6849 |c</noinclude></includeonly>
6850 |d</includeonly></includeonly>
6851 |}
6852 !!result
6853 <table>
6854 <tr>
6855 <td>a
6856 </td>
6857 <td>b
6858 </td>
6859 <td>c&lt;/includeonly&gt;
6860 </td>
6861 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6862 </td></tr></table>
6863
6864 !!end
6865
6866 !! article
6867 Template:Includeonly section
6868 !! text
6869 <includeonly>
6870 ==Includeonly section==
6871 </includeonly>
6872 ==Section T-1==
6873 !!endarticle
6874
6875 !! test
6876 Bug 6563: Edit link generation for section shown by <includeonly>
6877 !! input
6878 {{includeonly section}}
6879 !! result
6880 <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>
6881 <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>
6882
6883 !! end
6884
6885 # Uses same input as the contents of [[Template:Includeonly section]]
6886 !! test
6887 Bug 6563: Section extraction for section shown by <includeonly>
6888 !! options
6889 section=T-2
6890 !! input
6891 <includeonly>
6892 ==Includeonly section==
6893 </includeonly>
6894 ==Section T-2==
6895 !! result
6896 ==Section T-2==
6897 !! end
6898
6899 !! test
6900 Bug 6563: Edit link generation for section suppressed by <includeonly>
6901 !! input
6902 <includeonly>
6903 ==Includeonly section==
6904 </includeonly>
6905 ==Section 1==
6906 !! result
6907 <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>
6908
6909 !! end
6910
6911 !! test
6912 Bug 6563: Section extraction for section suppressed by <includeonly>
6913 !! options
6914 section=1
6915 !! input
6916 <includeonly>
6917 ==Includeonly section==
6918 </includeonly>
6919 ==Section 1==
6920 !! result
6921 ==Section 1==
6922 !! end
6923
6924 !! test
6925 Un-closed <includeonly>
6926 !! input
6927 <includeonly>
6928 !! result
6929 !! end
6930
6931 # TODO: test with DOM fragment reuse!
6932 !! test
6933 Parsoid: DOM fragment reuse
6934 !! options
6935 parsoid=wt2wt,wt2html
6936 !! input
6937 a{{echo|b<table></table>c}}d
6938
6939 a{{echo|b
6940 <table></table>
6941 c}}d
6942
6943 {{echo|a
6944
6945 <table></table>
6946
6947 b}}
6948 !! result
6949 a<span typeof="mw:Transclusion">b</span>
6950 <table></table><span>c</span>d
6951 <p typeof="mw:Transclusion">ab</p>
6952 <table></table>
6953 <p>cd</p>
6954 <p typeof="mw:Transclusion">a</p>
6955 <table></table>
6956 <p>b</p>
6957 !! end
6958
6959 ###
6960 ### <includeonly> and <noinclude> in attributes
6961 ###
6962 !!test
6963 0. includeonly around the entire attribute
6964 !!input
6965 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6966 !!result
6967 <p><span id="v2">bar</span>
6968 </p>
6969 !!end
6970
6971 !!test
6972 1. includeonly in html attr key
6973 !!input
6974 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6975 !!result
6976 <p><span id="foo">bar</span>
6977 </p>
6978 !!end
6979
6980 !!test
6981 2. includeonly in html attr value
6982 !!input
6983 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6984 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6985 !!result
6986 <p><span id="v1">bar</span>
6987 <span id="v1">bar</span>
6988 </p>
6989 !!end
6990
6991 !!test
6992 3. includeonly in part of an attr value
6993 !!input
6994 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6995 !!result
6996 <p><span style="color:red;">bar</span>
6997 </p>
6998 !!end
6999
7000 ###
7001 ### Testing parsing of templates where a template arg
7002 ### has the same name as the template itself.
7003 ###
7004
7005 !! article
7006 Template:quote
7007 !! text
7008 {{{quote|{{{1}}}}}}
7009 !! endarticle
7010
7011 !!test
7012 Templates: Template Name/Arg clash: 1. Use of positional param
7013 !!input
7014 {{quote|foo}}
7015 !!result
7016 <p>foo
7017 </p>
7018 !!end
7019
7020 !!test
7021 Templates: Template Name/Arg clash: 2. Use of named param
7022 !!input
7023 {{quote|quote=foo}}
7024 !!result
7025 <p>foo
7026 </p>
7027 !!end
7028
7029 !!test
7030 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7031 !!input
7032 {{quote|quote}}
7033 !!result
7034 <p>quote
7035 </p>
7036 !!end
7037
7038 ###
7039 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7040 ###
7041
7042 !!test
7043 Templates: 1. Simple use
7044 !!input
7045 {{echo|Foo}}
7046 !!result
7047 <p>Foo
7048 </p>
7049 !!end
7050
7051 !!test
7052 Templates: 2. Inside a block tag
7053 !!input
7054 <div>{{echo|Foo}}</div>
7055 !!result
7056 <div>Foo</div>
7057
7058 !!end
7059
7060 !!test
7061 Templates: P-wrapping: 1a. Templates on consecutive lines
7062 !!input
7063 {{echo|Foo}}
7064 {{echo|bar}}
7065 !!result
7066 <p>Foo
7067 bar
7068 </p>
7069 !!end
7070
7071 !!test
7072 Templates: P-wrapping: 1b. Templates on consecutive lines
7073 !!input
7074 Foo
7075
7076 {{echo|bar}}
7077 {{echo|baz}}
7078 !!result
7079 <p>Foo
7080 </p><p>bar
7081 baz
7082 </p>
7083 !!end
7084
7085 !!test
7086 Templates: P-wrapping: 1c. Templates on consecutive lines
7087 !!input
7088 {{echo|Foo}}
7089 {{echo|bar}} <div>baz</div>
7090 !!result
7091 <p>Foo
7092 </p>
7093 bar <div>baz</div>
7094
7095 !!end
7096
7097 !!test
7098 Templates: P-wrapping: 1d. Template preceded by comment-only line
7099 !!options
7100 parsoid=wt2html,wt2wt
7101 !!input
7102 <!-- foo -->
7103 {{echo|Bar}}
7104 !!result
7105 <!-- foo -->
7106 <p typeof="mw:Transclusion">Bar
7107 </p>
7108 !!end
7109
7110 !!test
7111 Templates: Inline Text: 1. Multiple tmeplate uses
7112 !!input
7113 {{echo|Foo}}bar{{echo|baz}}
7114 !!result
7115 <p>Foobarbaz
7116 </p>
7117 !!end
7118
7119 !!test
7120 Templates: Inline Text: 2. Back-to-back template uses
7121 !!input
7122 {{echo|Foo}}{{echo|bar}}
7123 !!result
7124 <p>Foobar
7125 </p>
7126 !!end
7127
7128 !!test
7129 Templates: Block Tags: 1. Multiple template uses
7130 !!input
7131 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7132 !!result
7133 <div>Foo</div><div>bar</div><div>baz</div>
7134
7135 !!end
7136
7137 !!test
7138 Templates: Block Tags: 2. Back-to-back template uses
7139 !!input
7140 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7141 !!result
7142 <div>Foo</div><div>bar</div>
7143
7144 !!end
7145
7146 !!test
7147 Templates: Links: 1. Simple example
7148 !!input
7149 {{echo|[[Foo|bar]]}}
7150 !!result
7151 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7152 </p>
7153 !!end
7154
7155 !!test
7156 Templates: Links: 2. Generation of link href
7157 !!input
7158 [[{{echo|Foo}}|bar]]
7159 !!result
7160 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7161 </p>
7162 !!end
7163
7164 !!test
7165 Templates: Links: 3. Generation of part of a link href
7166 !!input
7167 [[Fo{{echo|o}}|bar]]
7168
7169 [[Foo{{echo|bar}}]]
7170
7171 [[Foo{{echo|bar}}baz]]
7172
7173 [[Foo{{echo|bar}}|bar]]
7174
7175 [[:Foo{{echo|bar}}]]
7176
7177 [[:Foo{{echo|bar}}|bar]]
7178 !!result
7179 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7181 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7182 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7183 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7184 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7185 </p>
7186 !!end
7187
7188 !!test
7189 Templates: Links: 4. Multiple templates generating link href
7190 !!input
7191 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7192 !!result
7193 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7194 </p>
7195 !!end
7196
7197 !!test
7198 Templates: Links: 5. Generation of link text
7199 !!input
7200 [[Foo|{{echo|bar}}]]
7201 !!result
7202 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7203 </p>
7204 !!end
7205
7206 !!test
7207 Templates: Links: 5. Nested templates (only outermost template should be marked)
7208 !!input
7209 {{echo|[[{{echo|Foo}}|bar]]}}
7210 !!result
7211 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7212 </p>
7213 !!end
7214
7215 !!test
7216 Templates: HTML Tag: 1. Generation of HTML attr. key
7217 !!input
7218 <div {{echo|style}}="color:red;">foo</div>
7219 !!result
7220 <div style="color:red;">foo</div>
7221
7222 !!end
7223
7224 !!test
7225 Templates: HTML Tag: 2. Generation of HTML attr. value
7226 !!input
7227 <div style={{echo|'color:red;'}}>foo</div>
7228 !!result
7229 <div style="color:red;">foo</div>
7230
7231 !!end
7232
7233 !!test
7234 Templates: HTML Tag: 3. Generation of HTML attr key and value
7235 !!input
7236 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7237 !!result
7238 <div style="color:red;">foo</div>
7239
7240 !!end
7241
7242 !!test
7243 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7244 !!input
7245 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7246 !!result
7247 <div title="This is a long title with just one piece templated">foo</div>
7248
7249 !!end
7250
7251 !!test
7252 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7253 !!input
7254 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7255 !!result
7256 <div title="This is a long title with just one piece templated">foo</div>
7257
7258 !!end
7259
7260 !!test
7261 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7262 !!input
7263 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7264 !!result
7265 <div title="This is a long title with just one piece templated">foo</div>
7266
7267 !!end
7268
7269 !!test
7270 Templates: HTML Tag: 7. Generation of partial attribute key string
7271 !!input
7272 <div st{{echo|yle}}="color:red;">foo</div>
7273 !!result
7274 <div style="color:red;">foo</div>
7275
7276 !!end
7277
7278 !!test
7279 Templates: HTML Tables: 1. Generating start of a HTML table
7280 !!input
7281 {{echo|<table><tr><td>foo</td>}}</tr></table>
7282 !!result
7283 <table><tr><td>foo</td></tr></table>
7284
7285 !!end
7286
7287 !!test
7288 Templates: HTML Tables: 2a. Generating middle of a HTML table
7289 !!input
7290 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7291 !!result
7292 <table><tr><td>foo</td></tr></table>
7293
7294 !!end
7295
7296 !!test
7297 Templates: HTML Tables: 2b. Generating middle of a HTML table
7298 !!input
7299 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7300 !!result
7301 <table><tr><td>foo</td></tr></table>
7302
7303 !!end
7304
7305 !!test
7306 Templates: HTML Tables: 3. Generating end of a HTML table
7307 !!input
7308 <table><tr>{{echo|<td>foo</td></tr></table>}}
7309 !!result
7310 <table><tr><td>foo</td></tr></table>
7311
7312 !!end
7313
7314 !!test
7315 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7316 !!input
7317 {{echo|<table>}}<tr><td>foo</td></tr></table>
7318 !!result
7319 <table><tr><td>foo</td></tr></table>
7320
7321 !!end
7322
7323 !!test
7324 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7325 !!input
7326 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7327 !!result
7328 <table><tr><td>foo</td></tr></table>
7329
7330 !!end
7331
7332 !!test
7333 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7334 !!input
7335 <table><tr>{{echo|<td>}}foo</td></tr></table>
7336 !!result
7337 <table><tr><td>foo</td></tr></table>
7338
7339 !!end
7340
7341 !!test
7342 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7343 !!input
7344 <table><tr><td>foo{{echo|</td>}}</tr></table>
7345 !!result
7346 <table><tr><td>foo</td></tr></table>
7347
7348 !!end
7349
7350 !!test
7351 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7352 !!input
7353 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7354 !!result
7355 <table><tr><td>foo</td></tr></table>
7356
7357 !!end
7358
7359 !!test
7360 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7361 !!input
7362 <table><tr><td>foo</td></tr>{{echo|</table>}}
7363 !!result
7364 <table><tr><td>foo</td></tr></table>
7365
7366 !!end
7367
7368 !!test
7369 Templates: HTML Tables: 5. Proper fostering of categories from inside
7370 !!options
7371 parsoid=wt2html,wt2wt
7372 !!input
7373 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7374 <!--Two categories (Bug 50330)-->
7375 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7376 !!result
7377 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7378 <!--Two categories (Bug 50330)-->
7379 <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>
7380 !!end
7381
7382 !!test
7383 Templates: Wiki Tables: 1a. Fostering of entire template content
7384 !!input
7385 {|
7386 {{echo|a}}
7387 |}
7388 !!result
7389 <table>
7390 a
7391 <tr><td></td></tr></table>
7392
7393 !!end
7394
7395 !!test
7396 Templates: Wiki Tables: 1b. Fostering of entire template content
7397 !!input
7398 {|
7399 {{echo|<div>}}
7400 foo
7401 {{echo|</div>}}
7402 |}
7403 !!result
7404 <table>
7405 <div>
7406 <p>foo
7407 </p>
7408 </div>
7409 <tr><td></td></tr></table>
7410
7411 !!end
7412
7413 !!test
7414 Templates: Wiki Tables: 2. Fostering of partial template content
7415 !!input
7416 {|
7417 {{echo|a
7418 <div>b</div>}}
7419 |}
7420 !!result
7421 <table>
7422 a
7423 <div>b</div>
7424 <tr><td></td></tr></table>
7425
7426 !!end
7427
7428 !!test
7429 Templates: Wiki Tables: 3. td-content via multiple templates
7430 !!input
7431 {|
7432 {{echo|{{pipe}}a}}{{echo|b}}
7433 |}
7434 !!result
7435 <table>
7436 <tr>
7437 <td>ab
7438 </td></tr></table>
7439
7440 !!end
7441
7442 !!test
7443 Templates: Wiki Tables: 4. Templated tags, no content
7444 !!input
7445 {{tbl-start}}
7446 {{tbl-end}}
7447 !!result
7448 <table>
7449 <tr><td></td></tr></table>
7450
7451 !!end
7452
7453 !!test
7454 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7455 !!input
7456 {{tbl-start}}
7457 |foo
7458 {{tbl-end}}
7459 !!result
7460 <table>
7461 <tr>
7462 <td>foo
7463 </td></tr></table>
7464
7465 !!end
7466
7467 !!test
7468 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7469 !!input
7470 {{tbl-start}}
7471 {{!}}foo
7472 {{tbl-end}}
7473 !!result
7474 <table>
7475 <tr>
7476 <td>foo
7477 </td></tr></table>
7478
7479 !!end
7480
7481 !!test
7482 Templates: Lists: Multi-line list-items via templates
7483 !!input
7484 *{{echo|a {{nonexistent|
7485 unused}}}}
7486 *{{echo|b {{nonexistent|
7487 unused}}}}
7488 !!result
7489 <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>
7490 </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>
7491 </li></ul>
7492
7493 !!end
7494
7495 !!test
7496 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7497 !!input
7498 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7499 !!result
7500 <p><i>ab</i>c<i>d</i>e
7501 </p>
7502 !!end
7503
7504 !!test
7505 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7506 (PHP parser generates misnested html)
7507 !! options
7508 parsoid=wt2html,wt2wt
7509 !!input
7510 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7511 !!result
7512 <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>
7513 !!end
7514
7515 !!test
7516 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7517 (PHP parser generates misnested html)
7518 !! options
7519 parsoid=wt2html,wt2wt
7520 !!input
7521 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7522 !!result
7523 <div typeof="mw:Transclusion"><i>a</i></div>
7524 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7525 <div typeof="mw:Transclusion">e</div>
7526 !!end
7527
7528 !!test
7529 Templates: Ugly nesting: 4. Divs opened/closed across templates
7530 !!input
7531 a<div>b{{echo|c</div>d}}e
7532 !!result
7533 a<div>bc</div>de
7534
7535 !!end
7536
7537 !!test
7538 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7539 (Parsoid-centric)
7540 !! options
7541 parsoid
7542 !!input
7543 {|
7544 |{{echo|foo</table>}}
7545 |bar
7546 |}
7547 !!result
7548 <table typeof="mw:Transclusion">
7549 <tbody>
7550 <tr>
7551 <td>foo</td></tr></tbody></table><span>bar</span>
7552 !!end
7553
7554 !!test
7555 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7556 (Parsoid-centric)
7557 !! options
7558 parsoid
7559 !!input
7560 <table>
7561 <tr>
7562 <td>
7563 <table>
7564 <tr>
7565 <td>1. {{echo|foo </table>}}</td>
7566 <td> bar </td>
7567 <td>2. {{echo|baz </table>}}</td>
7568 </tr>
7569 <tr>
7570 <td>abc</td>
7571 </tr>
7572 </table>
7573 </td>
7574 </tr>
7575 <tr>
7576 <td>xyz</td>
7577 </tr>
7578 </table>
7579 !!result
7580 <table about="#mwt1" typeof="mw:Transclusion">
7581 <tbody><tr >
7582 <td >
7583 <table >
7584 <tbody><tr >
7585 <td >1. foo </td></tr></tbody></table></td>
7586 <td > bar </td>
7587 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7588 </span><span about="#mwt1">
7589
7590 abc</span><span about="#mwt1">
7591 </span><span about="#mwt1">
7592 </span><span about="#mwt1">
7593 </span><span about="#mwt1">
7594 </span><span about="#mwt1">
7595
7596 xyz</span><span about="#mwt1">
7597 </span><span about="#mwt1">
7598 </span>
7599 !!end
7600
7601 !! test
7602 Templates: Ugly templates: 3. newline-only template parameter
7603 !! input
7604 foo {{echo|
7605 }}
7606 !! result
7607 <p>foo
7608 </p>
7609 !! end
7610
7611 # This looks like a bug: a single newline triggers p/br for some reason.
7612 !! test
7613 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7614 !! input
7615 {{echo|
7616 }}
7617 !! result
7618 <p><br />
7619 </p>
7620 !! end
7621
7622
7623 !!test
7624 Parser Functions: 1. Simple example
7625 !!input
7626 {{uc:foo}}
7627 !!result
7628 <p>FOO
7629 </p>
7630 !!end
7631
7632 !!test
7633 Parser Functions: 2. Nested use (only outermost should be marked up)
7634 !!input
7635 {{uc:{{lc:FOO}}}}
7636 !!result
7637 <p>FOO
7638 </p>
7639 !!end
7640
7641 ###
7642 ### Pre-save transform tests
7643 ###
7644 !! test
7645 pre-save transform: subst:
7646 !! options
7647 PST
7648 !! input
7649 {{subst:test}}
7650 !! result
7651 This is a test template
7652 !! end
7653
7654 !! test
7655 pre-save transform: normal template
7656 !! options
7657 PST
7658 !! input
7659 {{test}}
7660 !! result
7661 {{test}}
7662 !! end
7663
7664 !! test
7665 pre-save transform: nonexistent template
7666 !! options
7667 PST
7668 !! input
7669 {{thistemplatedoesnotexist}}
7670 !! result
7671 {{thistemplatedoesnotexist}}
7672 !! end
7673
7674
7675 !! test
7676 pre-save transform: subst magic variables
7677 !! options
7678 PST
7679 !! input
7680 {{subst:SITENAME}}
7681 !! result
7682 MediaWiki
7683 !! end
7684
7685 # This is bug 89, which I fixed. -- wtm
7686 !! test
7687 pre-save transform: subst: templates with parameters
7688 !! options
7689 pst
7690 !! input
7691 {{subst:paramtest|param="something else"}}
7692 !! result
7693 This is a test template with parameter "something else"
7694 !! end
7695
7696 !! article
7697 Template:nowikitest
7698 !! text
7699 <nowiki>'''not wiki'''</nowiki>
7700 !! endarticle
7701
7702 !! test
7703 pre-save transform: nowiki in subst (bug 1188)
7704 !! options
7705 pst
7706 !! input
7707 {{subst:nowikitest}}
7708 !! result
7709 <nowiki>'''not wiki'''</nowiki>
7710 !! end
7711
7712
7713 !! article
7714 Template:commenttest
7715 !! text
7716 This template has <!-- a comment --> in it.
7717 !! endarticle
7718
7719 !! test
7720 pre-save transform: comment in subst (bug 1936)
7721 !! options
7722 pst
7723 !! input
7724 {{subst:commenttest}}
7725 !! result
7726 This template has <!-- a comment --> in it.
7727 !! end
7728
7729 !! test
7730 pre-save transform: unclosed tag
7731 !! options
7732 pst noxml
7733 !! input
7734 <nowiki>'''not wiki'''
7735 !! result
7736 <nowiki>'''not wiki'''
7737 !! end
7738
7739 !! test
7740 pre-save transform: mixed tag case
7741 !! options
7742 pst noxml
7743 !! input
7744 <NOwiki>'''not wiki'''</noWIKI>
7745 !! result
7746 <NOwiki>'''not wiki'''</noWIKI>
7747 !! end
7748
7749 !! test
7750 pre-save transform: unclosed comment in <nowiki>
7751 !! options
7752 pst noxml
7753 !! input
7754 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7755 !! result
7756 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7757 !!end
7758
7759 # Leading @ in this template definition works around a limitation
7760 # in parsoid's parserTests which otherwise strips the <span> from the
7761 # result (confusing it for a template wrapper)
7762 !! article
7763 Template:dangerous
7764 !!text
7765 @<span onmouseover="alert('crap')">Oh no</span>
7766 !!endarticle
7767
7768 !!test
7769 (confirming safety of fix for subst bug 1936)
7770 !! input
7771 {{Template:dangerous}}
7772 !! result
7773 <p>@<span>Oh no</span>
7774 </p>
7775 !! end
7776
7777 !! test
7778 pre-save transform: comment containing gallery (bug 5024)
7779 !! options
7780 pst
7781 !! input
7782 <!-- <gallery>data</gallery> -->
7783 !!result
7784 <!-- <gallery>data</gallery> -->
7785 !!end
7786
7787 !! test
7788 pre-save transform: comment containing extension
7789 !! options
7790 pst
7791 !! input
7792 <!-- <tag>data</tag> -->
7793 !!result
7794 <!-- <tag>data</tag> -->
7795 !!end
7796
7797 !! test
7798 pre-save transform: comment containing nowiki
7799 !! options
7800 pst
7801 !! input
7802 <!-- <nowiki>data</nowiki> -->
7803 !!result
7804 <!-- <nowiki>data</nowiki> -->
7805 !!end
7806
7807 !! test
7808 pre-save transform: <noinclude> in subst (bug 3298)
7809 !! options
7810 pst
7811 !! input
7812 {{subst:Includes}}
7813 !! result
7814 Foobar
7815 !! end
7816
7817 !! test
7818 pre-save transform: <onlyinclude> in subst (bug 3298)
7819 !! options
7820 pst
7821 !! input
7822 {{subst:Includes2}}
7823 !! result
7824 Foo
7825 !! end
7826
7827 !! article
7828 Template:SubstTest
7829 !!text
7830 {{<includeonly>subst:</includeonly>Includes}}
7831 !! endarticle
7832
7833 !! article
7834 Template:SafeSubstTest
7835 !! text
7836 {{<includeonly>safesubst:</includeonly>Includes}}
7837 !! endarticle
7838
7839 !! test
7840 bug 22297: safesubst: works during PST
7841 !! options
7842 pst
7843 !! input
7844 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7845 !! result
7846 FoobarFoobar
7847 !! end
7848
7849 !! test
7850 bug 22297: safesubst: works during normal parse
7851 !! input
7852 {{SafeSubstTest}}
7853 !! result
7854 <p>Foobar
7855 </p>
7856 !! end
7857
7858 !! test:
7859 subst: does not work during normal parse
7860 !! input
7861 {{SubstTest}}
7862 !! result
7863 <p>{{subst:Includes}}
7864 </p>
7865 !! end
7866
7867 !! test
7868 pre-save transform: context links ("pipe trick")
7869 !! options
7870 pst
7871 !! input
7872 [[Article (context)|]]
7873 [[Bar:Article|]]
7874 [[:Bar:Article|]]
7875 [[Bar:Article (context)|]]
7876 [[:Bar:Article (context)|]]
7877 [[|Article]]
7878 [[|Article (context)]]
7879 [[Bar:X (Y) Z|]]
7880 [[:Bar:X (Y) Z|]]
7881 !! result
7882 [[Article (context)|Article]]
7883 [[Bar:Article|Article]]
7884 [[:Bar:Article|Article]]
7885 [[Bar:Article (context)|Article]]
7886 [[:Bar:Article (context)|Article]]
7887 [[Article]]
7888 [[Article (context)]]
7889 [[Bar:X (Y) Z|X (Y) Z]]
7890 [[:Bar:X (Y) Z|X (Y) Z]]
7891 !! end
7892
7893 !! test
7894 pre-save transform: context links ("pipe trick") with interwiki prefix
7895 !! options
7896 pst
7897 !! input
7898 [[interwiki:Article|]]
7899 [[:interwiki:Article|]]
7900 [[interwiki:Bar:Article|]]
7901 [[:interwiki:Bar:Article|]]
7902 !! result
7903 [[interwiki:Article|Article]]
7904 [[:interwiki:Article|Article]]
7905 [[interwiki:Bar:Article|Bar:Article]]
7906 [[:interwiki:Bar:Article|Bar:Article]]
7907 !! end
7908
7909 !! test
7910 pre-save transform: context links ("pipe trick") with parens in title
7911 !! options
7912 pst title=[[Somearticle (context)]]
7913 !! input
7914 [[|Article]]
7915 !! result
7916 [[Article (context)|Article]]
7917 !! end
7918
7919 !! test
7920 pre-save transform: context links ("pipe trick") with comma in title
7921 !! options
7922 pst title=[[Someplace, Somewhere]]
7923 !! input
7924 [[|Otherplace]]
7925 [[Otherplace, Elsewhere|]]
7926 [[Otherplace, Elsewhere, Anywhere|]]
7927 !! result
7928 [[Otherplace, Somewhere|Otherplace]]
7929 [[Otherplace, Elsewhere|Otherplace]]
7930 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7931 !! end
7932
7933 !! test
7934 pre-save transform: context links ("pipe trick") with parens and comma
7935 !! options
7936 pst title=[[Someplace (IGNORED), Somewhere]]
7937 !! input
7938 [[|Otherplace]]
7939 [[Otherplace (place), Elsewhere|]]
7940 !! result
7941 [[Otherplace, Somewhere|Otherplace]]
7942 [[Otherplace (place), Elsewhere|Otherplace]]
7943 !! end
7944
7945 !! test
7946 pre-save transform: context links ("pipe trick") with comma and parens
7947 !! options
7948 pst title=[[Who, me? (context)]]
7949 !! input
7950 [[|Yes, you.]]
7951 [[Me, Myself, and I (1937 song)|]]
7952 !! result
7953 [[Yes, you. (context)|Yes, you.]]
7954 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7955 !! end
7956
7957 !! test
7958 pre-save transform: context links ("pipe trick") with namespace
7959 !! options
7960 pst title=[[Ns:Somearticle]]
7961 !! input
7962 [[|Article]]
7963 !! result
7964 [[Ns:Article|Article]]
7965 !! end
7966
7967 !! test
7968 pre-save transform: context links ("pipe trick") with namespace and parens
7969 !! options
7970 pst title=[[Ns:Somearticle (context)]]
7971 !! input
7972 [[|Article]]
7973 !! result
7974 [[Ns:Article (context)|Article]]
7975 !! end
7976
7977 !! test
7978 pre-save transform: context links ("pipe trick") with namespace and comma
7979 !! options
7980 pst title=[[Ns:Somearticle, Context, Whatever]]
7981 !! input
7982 [[|Article]]
7983 !! result
7984 [[Ns:Article, Context, Whatever|Article]]
7985 !! end
7986
7987 !! test
7988 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7989 !! options
7990 pst title=[[Ns:Somearticle, Context (context)]]
7991 !! input
7992 [[|Article]]
7993 !! result
7994 [[Ns:Article (context)|Article]]
7995 !! end
7996
7997 !! test
7998 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7999 !! options
8000 pst title=[[Ns:Somearticle (IGNORED), Context]]
8001 !! input
8002 [[|Article]]
8003 !! result
8004 [[Ns:Article, Context|Article]]
8005 !! end
8006
8007 !! test
8008 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8009 !! options
8010 pst
8011 !! input
8012 [[Article(context)|]]
8013 [[Bar:Article(context)|]]
8014 [[:Bar:Article(context)|]]
8015 [[|Article(context)]]
8016 [[Bar:X(Y)Z|]]
8017 [[:Bar:X(Y)Z|]]
8018 !! result
8019 [[Article(context)|Article]]
8020 [[Bar:Article(context)|Article]]
8021 [[:Bar:Article(context)|Article]]
8022 [[Article(context)]]
8023 [[Bar:X(Y)Z|X(Y)Z]]
8024 [[:Bar:X(Y)Z|X(Y)Z]]
8025 !! end
8026
8027 !! test
8028 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8029 !! options
8030 pst
8031 !! input
8032 [[Article (context)|]]
8033 [[Bar:Article (context)|]]
8034 [[:Bar:Article (context)|]]
8035 [[|Article (context)]]
8036 [[Bar:X (Y) Z|]]
8037 [[:Bar:X (Y) Z|]]
8038 !! result
8039 [[Article (context)|Article]]
8040 [[Bar:Article (context)|Article]]
8041 [[:Bar:Article (context)|Article]]
8042 [[Article (context)]]
8043 [[Bar:X (Y) Z|X (Y) Z]]
8044 [[:Bar:X (Y) Z|X (Y) Z]]
8045 !! end
8046
8047 !! test
8048 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8049 !! options
8050 pst
8051 !! input
8052 [[Article(context)|]]
8053 [[Bar:Article(context)|]]
8054 [[:Bar:Article(context)|]]
8055 [[|Article(context)]]
8056 [[Bar:X(Y)Z|]]
8057 [[:Bar:X(Y)Z|]]
8058 !! result
8059 [[Article(context)|Article]]
8060 [[Bar:Article(context)|Article]]
8061 [[:Bar:Article(context)|Article]]
8062 [[Article(context)]]
8063 [[Bar:X(Y)Z|X(Y)Z]]
8064 [[:Bar:X(Y)Z|X(Y)Z]]
8065 !! end
8066
8067 !! test
8068 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8069 !! options
8070 pst
8071 !! input
8072 [[Article (context), context|]]
8073 [[Article (context),context|]]
8074 [[Bar:Article (context), context|]]
8075 [[Bar:Article (context),context|]]
8076 [[:Bar:Article (context), context|]]
8077 [[:Bar:Article (context),context|]]
8078 !! result
8079 [[Article (context), context|Article]]
8080 [[Article (context),context|Article]]
8081 [[Bar:Article (context), context|Article]]
8082 [[Bar:Article (context),context|Article]]
8083 [[:Bar:Article (context), context|Article]]
8084 [[:Bar:Article (context),context|Article]]
8085 !! end
8086
8087 !! test
8088 pre-save transform: trim trailing empty lines
8089 !! options
8090 pst
8091 !! input
8092 Empty lines are trimmed
8093
8094
8095
8096
8097 !! result
8098 Empty lines are trimmed
8099 !! end
8100
8101 !! test
8102 pre-save transform: Signature expansion
8103 !! options
8104 pst
8105 !! input
8106 * ~~~
8107 * <noinclude>~~~</noinclude>
8108 * <includeonly>~~~</includeonly>
8109 * <onlyinclude>~~~</onlyinclude>
8110 !! result
8111 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8112 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8113 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8114 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8115 !! end
8116
8117
8118 !! test
8119 pre-save transform: Signature expansion in nowiki tags (bug 93)
8120 !! options
8121 pst disabled
8122 !! input
8123 Shall not expand:
8124
8125 <nowiki>~~~~</nowiki>
8126
8127 <includeonly><nowiki>~~~~</nowiki></includeonly>
8128
8129 <noinclude><nowiki>~~~~</nowiki></noinclude>
8130
8131 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8132
8133 {{subst:Foo}} shall be converted to FOO
8134
8135 As well as inside noinclude/onlyinclude
8136 <noinclude>{{subst:Foo}}</noinclude>
8137 <onlyinclude>{{subst:Foo}}</onlyinclude>
8138
8139 But not inside includeonly
8140 <includeonly>{{subst:Foo}}</includeonly>
8141 !! result
8142 Shall not expand:
8143
8144 <nowiki>~~~~</nowiki>
8145
8146 <includeonly><nowiki>~~~~</nowiki></includeonly>
8147
8148 <noinclude><nowiki>~~~~</nowiki></noinclude>
8149
8150 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8151
8152 FOO shall be converted to FOO
8153
8154 As well as inside noinclude/onlyinclude
8155 <noinclude>FOO</noinclude>
8156 <onlyinclude>FOO</onlyinclude>
8157
8158 But not inside includeonly
8159 <includeonly>{{subst:Foo}}</includeonly>
8160 !! end
8161
8162 !! test
8163 Parsoid: Recognize nowiki with trailing space in tags
8164 !! options
8165 parsoid=wt2html
8166 !! input
8167 <nowiki ><div>[[foo]]</nowiki >
8168
8169 a<nowiki / >b
8170
8171 c<nowiki />d
8172
8173 e<nowiki/ >f
8174 !! result
8175 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8176 <p>ab</p>
8177 <p>cd</p>
8178 <p>ef</p>
8179 !! end
8180
8181 !! test
8182 Parsoid: Recognize nowiki with odd capitalization
8183 !! options
8184 parsoid=wt2html
8185 !! input
8186 <noWikI ><div>[[foo]]</Nowiki >
8187 !! result
8188 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8189 !! end
8190
8191
8192 !! test
8193 Parsoid: Escape nowiki with trailing space in tags
8194 !! options
8195 parsoid=html2wt
8196 !! input
8197 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8198
8199 a&lt;nowiki /&gt;b
8200
8201 c&lt;nowiki/ &gt;d
8202 !! result
8203 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8204 <p>a&lt;nowiki /&gt;b</p>
8205 <p>c&lt;nowiki/ &gt;d</p>
8206 !! end
8207
8208 !! test
8209 Parsoid: Escape weird noWikI capitalizations
8210 !! options
8211 parsoid=html2wt
8212 !! input
8213 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8214 !! result
8215 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8216 !! end
8217
8218 ###
8219 ### Message transform tests
8220 ###
8221 !! test
8222 message transform: magic variables
8223 !! options
8224 msg
8225 !! input
8226 {{SITENAME}}
8227 !! result
8228 MediaWiki
8229 !! end
8230
8231 !! test
8232 message transform: should not transform wiki markup
8233 !! options
8234 msg
8235 !! input
8236 ''test''
8237 !! result
8238 ''test''
8239 !! end
8240
8241 !! test
8242 message transform: <noinclude> in transcluded template (bug 4926)
8243 !! options
8244 msg
8245 !! input
8246 {{Includes}}
8247 !! result
8248 Foobar
8249 !! end
8250
8251 !! test
8252 message transform: <onlyinclude> in transcluded template (bug 4926)
8253 !! options
8254 msg
8255 !! input
8256 {{Includes2}}
8257 !! result
8258 Foo
8259 !! end
8260
8261 !! test
8262 {{#special:}} page name, known
8263 !! options
8264 msg
8265 !! input
8266 {{#special:Recentchanges}}
8267 !! result
8268 Special:RecentChanges
8269 !! end
8270
8271 !! test
8272 {{#special:}} page name with subpage, known
8273 !! options
8274 msg
8275 !! input
8276 {{#special:Recentchanges/param}}
8277 !! result
8278 Special:RecentChanges/param
8279 !! end
8280
8281 !! test
8282 {{#special:}} page name, unknown
8283 !! options
8284 msg
8285 !! input
8286 {{#special:foobar nonexistent}}
8287 !! result
8288 Special:Foobar nonexistent
8289 !! end
8290
8291 !! test
8292 {{#speciale:}} page name, known
8293 !! options
8294 msg
8295 !! input
8296 {{#speciale:Recentchanges}}
8297 !! result
8298 Special:RecentChanges
8299 !! end
8300
8301 !! test
8302 {{#speciale:}} page name with subpage, known
8303 !! options
8304 msg
8305 !! input
8306 {{#speciale:Recentchanges/param}}
8307 !! result
8308 Special:RecentChanges/param
8309 !! end
8310
8311 !! test
8312 {{#speciale:}} page name, unknown
8313 !! options
8314 msg
8315 !! input
8316 {{#speciale:foobar nonexistent}}
8317 !! result
8318 Special:Foobar_nonexistent
8319 !! end
8320
8321 ###
8322 ### Images
8323 ###
8324 !! test
8325 Simple image
8326 !! input
8327 [[Image:foobar.jpg]]
8328 !! result
8329 <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>
8330 </p>
8331 !! end
8332
8333 !! test
8334 Right-aligned image
8335 !! input
8336 [[Image:foobar.jpg|right]]
8337 !! result
8338 <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>
8339
8340 !! end
8341
8342 !! test
8343 Simple image (using File: namespace, now canonical)
8344 !! input
8345 [[File:foobar.jpg]]
8346 !! result
8347 <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>
8348 </p>
8349 !! end
8350
8351 !! test
8352 Image with caption
8353 !! input
8354 [[Image:foobar.jpg|right|Caption text]]
8355 !! result
8356 <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>
8357
8358 !! end
8359
8360 !! test
8361 Image with empty attribute
8362 !! input
8363 [[Image:foobar.jpg|right||Caption text]]
8364 !! result
8365 <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>
8366
8367 !! end
8368
8369 !! test
8370 Image with attributes from template.
8371 !! input
8372 [[Image:foobar.jpg|{{image_attribs}}]]
8373 !! result
8374 <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>
8375
8376 !! end
8377
8378 !! test
8379 Image with link tails
8380 !! input
8381 123[[Image:foobar.jpg]]456
8382 123[[Image:foobar.jpg|right]]456
8383 123[[Image:foobar.jpg|thumb]]456
8384 !! result
8385 <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
8386 </p>
8387 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
8388 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
8389
8390 !! end
8391
8392 !! test
8393 Image with multiple captions -- only last one is accepted
8394 !! input
8395 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8396 !! result
8397 <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>
8398
8399 !! end
8400
8401 !! test
8402 Image with width attribute at different positions
8403 !! input
8404 [[Image:foobar.jpg|200px|right|Caption]]
8405 [[Image:foobar.jpg|right|200px|Caption]]
8406 [[Image:foobar.jpg|right|Caption|200px]]
8407 !! result
8408 <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>
8409 <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>
8410 <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>
8411
8412 !! end
8413
8414 !! test
8415 Image with link parameter, wiki target
8416 !! input
8417 [[Image:foobar.jpg|link=Target page]]
8418 !! result
8419 <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>
8420 </p>
8421 !! end
8422
8423 !! test
8424 Image with link parameter, URL target
8425 !! input
8426 [[Image:foobar.jpg|link=http://example.com/]]
8427 !! result
8428 <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>
8429 </p>
8430 !! end
8431
8432 !! test
8433 Image with link parameter, wgExternalLinkTarget
8434 !! input
8435 [[Image:foobar.jpg|link=http://example.com/]]
8436 !! config
8437 wgExternalLinkTarget='foobar'
8438 !! result
8439 <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>
8440 </p>
8441 !! end
8442
8443 !! test
8444 Image with link parameter, wgNoFollowLinks set to false
8445 !! input
8446 [[Image:foobar.jpg|link=http://example.com/]]
8447 !! config
8448 wgNoFollowLinks=false
8449 !! result
8450 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8451 </p>
8452 !! end
8453
8454 !! test
8455 Image with link parameter, wgNoFollowDomainExceptions
8456 !! input
8457 [[Image:foobar.jpg|link=http://example.com/]]
8458 !! config
8459 wgNoFollowDomainExceptions='example.com'
8460 !! result
8461 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8462 </p>
8463 !! end
8464
8465 !! test
8466 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8467 !! input
8468 [[Image:foobar.jpg|link=http://example.com/|Title]]
8469 !! config
8470 wgExternalLinkTarget='foobar'
8471 !! result
8472 <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>
8473 </p>
8474 !! end
8475
8476 !! test
8477 Image with empty link parameter
8478 !! input
8479 [[Image:foobar.jpg|link=]]
8480 !! result
8481 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8482 </p>
8483 !! end
8484
8485 !! test
8486 Image with link parameter (wiki target) and unnamed parameter
8487 !! input
8488 [[Image:foobar.jpg|link=Target page|Title]]
8489 !! result
8490 <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>
8491 </p>
8492 !! end
8493
8494 !! test
8495 Image with link parameter (URL target) and unnamed parameter
8496 !! input
8497 [[Image:foobar.jpg|link=http://example.com/|Title]]
8498 !! result
8499 <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>
8500 </p>
8501 !! end
8502
8503 !! test
8504 Thumbnail image with link parameter
8505 !! options
8506 php
8507 !! input
8508 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8509 !! result
8510 <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>
8511
8512 !! end
8513
8514 !! test
8515 Manually-specified thumbnail image
8516 !! options
8517 php
8518 !! input
8519 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8520 !! result
8521 <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>
8522
8523 !! end
8524
8525 !! test
8526 Manually-specified thumbnail image with explicit link to wiki page
8527 !! options
8528 php
8529 !! input
8530 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8531 !! result
8532 <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>
8533
8534 !! end
8535
8536 !! test
8537 Manually-specified thumbnail image with explicit link to url
8538 !! options
8539 php
8540 !! input
8541 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8542 !! result
8543 <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>
8544
8545 !! end
8546
8547 !! test
8548 Manually-specified thumbnail image with explicit no link
8549 !! options
8550 php
8551 !! input
8552 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8553 !! result
8554 <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>
8555
8556 !! end
8557
8558 !! test
8559 Manually-specified thumbnail image with explicit link and alt text
8560 !! options
8561 php
8562 !! input
8563 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8564 !! result
8565 <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>
8566
8567 !! end
8568
8569 !! test
8570 Image with frame and link
8571 !! input
8572 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8573 !! result
8574 <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>
8575
8576 !! end
8577
8578 !! test
8579 Image with frame and link and explicit alt
8580 !! input
8581 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8582 !! result
8583 <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>
8584
8585 !! end
8586
8587 !! test
8588 Image with wiki markup in implicit alt
8589 !! input
8590 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8591 !! result
8592 <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>
8593 </p>
8594 !! end
8595
8596 !! test
8597 Image with wiki markup in explicit alt
8598 !! input
8599 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8600 !! result
8601 <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>
8602 </p>
8603 !! end
8604
8605 !! test
8606 Link to image page- image page normally doesn't exists, hence edit link
8607 Add test with existing image page
8608 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8609 !! input
8610 [[:Image:test]]
8611 !! result
8612 <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>
8613 </p>
8614 !! end
8615
8616 !! test
8617 bug 18784 Link to non-existent image page with caption should use caption as link text
8618 !! input
8619 [[:Image:test|caption]]
8620 !! result
8621 <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>
8622 </p>
8623 !! end
8624
8625 !! test
8626 Frameless image caption with a free URL
8627 !! input
8628 [[Image:foobar.jpg|http://example.com]]
8629 !! result
8630 <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>
8631 </p>
8632 !! end
8633
8634 !! test
8635 Thumbnail image caption with a free URL
8636 !! input
8637 [[Image:foobar.jpg|thumb|http://example.com]]
8638 !! result
8639 <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>
8640
8641 !! end
8642
8643 !! test
8644 Thumbnail image caption with a free URL and explicit alt
8645 !! input
8646 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8647 !! result
8648 <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>
8649
8650 !! end
8651
8652 !! test
8653 SVG thumbnails with no language set
8654 !! options
8655 !! input
8656 [[File:Foobar.svg|thumb|width=200]]
8657 !! result
8658 <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>
8659
8660 !! end
8661
8662 !! test
8663 SVG thumbnails with language de
8664 !! options
8665 !! input
8666 [[File:Foobar.svg|thumb|width=200|lang=de]]
8667 !! result
8668 <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>
8669
8670 !! end
8671
8672 !! test
8673 SVG thumbnails with invalid language code
8674 !! options
8675 !! input
8676 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8677 !! result
8678 <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>
8679
8680 !! end
8681
8682 !! test
8683 BUG 1887: A ISBN with a thumbnail
8684 !! input
8685 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8686 !! result
8687 <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>
8688
8689 !! end
8690
8691 !! test
8692 BUG 1887: A RFC with a thumbnail
8693 !! input
8694 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8695 !! result
8696 <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>
8697
8698 !! end
8699
8700 !! test
8701 BUG 1887: A mailto link with a thumbnail
8702 !! input
8703 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8704 !! result
8705 <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>
8706
8707 !! end
8708
8709 # Pending resolution to bug 368
8710 !! test
8711 BUG 648: Frameless image caption with a link
8712 !! input
8713 [[Image:foobar.jpg|text with a [[link]] in it]]
8714 !! result
8715 <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>
8716 </p>
8717 !! end
8718
8719 !! test
8720 BUG 648: Frameless image caption with a link (suffix)
8721 !! input
8722 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8723 !! result
8724 <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>
8725 </p>
8726 !! end
8727
8728 !! test
8729 BUG 648: Frameless image caption with an interwiki link
8730 !! input
8731 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8732 !! result
8733 <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>
8734 </p>
8735 !! end
8736
8737 !! test
8738 BUG 648: Frameless image caption with a piped interwiki link
8739 !! input
8740 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8741 !! result
8742 <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>
8743 </p>
8744 !! end
8745
8746 !! test
8747 Escape HTML special chars in image alt text
8748 !! input
8749 [[Image:foobar.jpg|& < > "]]
8750 !! result
8751 <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>
8752 </p>
8753 !! end
8754
8755 !! test
8756 BUG 499: Alt text should have &#1234;, not &amp;1234;
8757 !! input
8758 [[Image:foobar.jpg|&#9792;]]
8759 !! result
8760 <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>
8761 </p>
8762 !! end
8763
8764 !! test
8765 Broken image caption with link
8766 !! input
8767 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8768 !! result
8769 <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.
8770 </p>
8771 !! end
8772
8773 !! test
8774 Image caption containing another image
8775 !! input
8776 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8777 !! result
8778 <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>
8779
8780 !! end
8781
8782 !! test
8783 Image caption containing a newline
8784 !! input
8785 [[Image:Foobar.jpg|This
8786 *is some text]]
8787 !! result
8788 <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>
8789 </p>
8790 !!end
8791
8792 !!test
8793 Parsoid: Image caption containing leading space
8794 (The leading space should not trigger nowiki escaping in wt2wt mode)
8795 !! input
8796 [[Image:Foobar.jpg|thumb| bar]]
8797 !! result
8798 <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>
8799
8800 !!end
8801
8802 !! test
8803 Bug 3090: External links other than http: in image captions
8804 !! input
8805 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8806 !! result
8807 <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>
8808
8809 !! end
8810
8811 !! test
8812 Custom class
8813 !! input
8814 [[Image:foobar.jpg|a|class=b]]
8815 !! result
8816 <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>
8817 </p>
8818 !! end
8819
8820 !! test
8821 Localized image handling (1).
8822 !! options
8823 language=es
8824 !! input
8825 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8826 !! result
8827 <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>
8828
8829 !! end
8830
8831 !! test
8832 Localized image handling (2).
8833 !! options
8834 language=es
8835 !! input
8836 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8837 !! result
8838 <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>
8839
8840 !! end
8841
8842 !! test
8843 "border", "frameless" and "class" attributes on an image.
8844 !! input
8845 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8846 !! result
8847 <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>
8848 </p>
8849 !! end
8850
8851 !! article
8852 File:Barfoo.jpg
8853 !! text
8854 #REDIRECT [[File:Barfoo.jpg]]
8855 !! endarticle
8856
8857 !! test
8858 Redirected image
8859 !! input
8860 [[Image:Barfoo.jpg]]
8861 !! result
8862 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8863 </p>
8864 !! end
8865
8866 !! test
8867 Missing image with uploads disabled
8868 !! options
8869 wgEnableUploads=0
8870 !! input
8871 [[Image:Foobaz.jpg]]
8872 !! result
8873 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8874 </p>
8875 !! end
8876
8877 # Parsoid-specific testing for images
8878 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8879 # Currently imperfect due to a flaw in the Parsoid testrunner
8880 # Work in progress
8881
8882 !! test
8883 Parsoid-specific image handling - simple image
8884 !! options
8885 parsoid
8886 !! input
8887 [[Image:Foobar.jpg]]
8888 !! result
8889 <p>
8890 <span class="mw-default-size" typeof="mw:Image">
8891 <a href="File:Foobar.jpg">
8892 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8893 </a>
8894 </span>
8895 </p>
8896 !! end
8897
8898 !! test
8899 Parsoid-specific image handling - simple image without link
8900 !! options
8901 parsoid
8902 !! input
8903 [[Image:Foobar.jpg|link=]]
8904 !! result
8905 <p>
8906 <span class="mw-default-size" typeof="mw:Image">
8907 <span>
8908 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8909 </span>
8910 </span>
8911 </p>
8912 !! end
8913
8914 !! test
8915 Parsoid-specific image handling - simple image with specific link
8916 !! options
8917 parsoid
8918 !! input
8919 [[Image:Foobar.jpg|link=Main Page]]
8920 !! result
8921 <p>
8922 <span class="mw-default-size" typeof="mw:Image">
8923 <a href="Main_Page">
8924 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8925 </a>
8926 </span>
8927 </p>
8928 !! end
8929
8930 !! test
8931 Parsoid-specific image handling - simple image with size and middle alignment
8932 !! options
8933 parsoid
8934 !! input
8935 [[Image:Foobar.jpg|50px|middle]]
8936 !! result
8937 <p>
8938 <span class="mw-valign-middle" typeof="mw:Image">
8939 <a href="File:Foobar.jpg">
8940 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8941 </a>
8942 </span>
8943 </p>
8944 !! end
8945
8946 !! test
8947 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8948 !! options
8949 parsoid
8950 !! input
8951 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8952 !! result
8953 <p>
8954 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8955 <a href="File:Foobar.jpg">
8956 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8957 </a>
8958 </span>
8959 </p>
8960 !! end
8961
8962 !! test
8963 Parsoid-specific image handling - simple image with border and size spec
8964 !! options
8965 parsoid
8966 !! input
8967 [[Image:Foobar.jpg|50px|border|caption]]
8968 !! result
8969 <p>
8970 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8971 <a href="File:Foobar.jpg">
8972 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8973 </a>
8974 </span>
8975 </p>
8976 !! end
8977
8978 !! test
8979 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8980 !! options
8981 parsoid
8982 !! input
8983 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8984 !! result
8985 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8986 <a href="File:Foobar.jpg">
8987 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8988 </a>
8989 <figcaption>caption content</figcaption>
8990 </figure>
8991 !! end
8992
8993 !! test
8994 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8995 !! options
8996 parsoid
8997 !! input
8998 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8999 !! result
9000 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9001 <a href="File:Foobar.jpg">
9002 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9003 </a>
9004 <figcaption>caption</figcaption>
9005 </figure>
9006 !! end
9007
9008 !! test
9009 Parsoid-specific image handling - framed image with specific size and caption
9010 !! options
9011 parsoid
9012 !! input
9013 [[Image:Foobar.jpg|500x50px|frame|caption]]
9014 !! result
9015 <figure typeof="mw:Image/Frame">
9016 <a href="File:Foobar.jpg">
9017 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9018 </a>
9019 <figcaption>caption</figcaption>
9020 </figure>
9021 !! end
9022
9023 !! test
9024 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9025 !! options
9026 parsoid
9027 !! input
9028 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9029 !! result
9030 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9031 <a href="File:Foobar.jpg">
9032 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9033 </a>
9034 <figcaption>caption</figcaption>
9035 </figure>
9036 !! end
9037
9038 !! test
9039 Parsoid-specific image handling - frameless image with specific size, border, and caption
9040 !! options
9041 parsoid
9042 !! input
9043 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9044 !! result
9045 <p>
9046 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9047 <a href="File:Foobar.jpg">
9048 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9049 </a>
9050 </p>
9051 !! end
9052
9053 #!! test
9054 #Parsoid-specific image handling - simple image with a formatted caption
9055 #!! options
9056 #parsoid
9057 #!! input
9058 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9059 #!! result
9060 #<p>
9061 #<span typeof="mw:Image">
9062 #<a class="mw-default-size" href="Image:Foobar.jpg">
9063 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
9064 #</a>
9065 #<span>abc</span>
9066 #</span>
9067 #</p>
9068
9069
9070 ###
9071 ### Subpages
9072 ###
9073 !! article
9074 Subpage test/subpage
9075 !! text
9076 foo
9077 !! endarticle
9078
9079 !! test
9080 Subpage link
9081 !! options
9082 subpage title=[[Subpage test]]
9083 !! input
9084 [[/subpage]]
9085 !! result
9086 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9087 </p>
9088 !! end
9089
9090 !! test
9091 Subpage noslash link
9092 !! options
9093 subpage title=[[Subpage test]]
9094 !!input
9095 [[/subpage/]]
9096 !! result
9097 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9098 </p>
9099 !! end
9100
9101 # TODO: make this PHP-parser compatible!
9102 !! test
9103 Relative subpage noslash link
9104 !! options
9105 parsoid=wt2wt,wt2html,html2html
9106 subpage title=[[Subpage test/1/2/3/4]]
9107 !!input
9108 [[../../subpage/]]
9109
9110 [[../../subpage]]
9111 !! result
9112 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9113 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9114 !! end
9115
9116 # TODO: make this PHP-parser compatible!
9117 !! test
9118 Parsoid: dot-slash prefixed wikilinks
9119 !! options
9120 parsoid=wt2wt,wt2html,html2html
9121 !!input
9122 [[./foo]]
9123
9124 [[././bar]]
9125
9126 [[././baz/]]
9127 !! result
9128 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9129 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9130 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9131 !! end
9132
9133 !! test
9134 Disabled subpages
9135 !! input
9136 [[/subpage]]
9137 !! result
9138 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9139 </p>
9140 !! end
9141
9142 !! test
9143 BUG 561: {{/Subpage}}
9144 !! options
9145 subpage title=[[Page]]
9146 !! input
9147 {{/Subpage}}
9148 !! result
9149 <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>
9150 </p>
9151 !! end
9152
9153 ###
9154 ### Categories
9155 ###
9156 !! article
9157 Category:MediaWiki User's Guide
9158 !! text
9159 blah
9160 !! endarticle
9161
9162 !! test
9163 Link to category
9164 !! input
9165 [[:Category:MediaWiki User's Guide]]
9166 !! result
9167 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9168 </p>
9169 !! end
9170
9171 !! test
9172 Simple category
9173 !! options
9174 cat
9175 !! input
9176 [[Category:MediaWiki User's Guide]]
9177 !! result
9178 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9179 !! end
9180
9181 !! test
9182 PAGESINCATEGORY invalid title fatal (r33546 fix)
9183 !! input
9184 {{PAGESINCATEGORY:<bogus>}}
9185 !! result
9186 <p>0
9187 </p>
9188 !! end
9189
9190 !! test
9191 Category with different sort key
9192 !! options
9193 cat
9194 !! input
9195 [[Category:MediaWiki User's Guide|Foo]]
9196 !! result
9197 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9198 !! end
9199
9200 !! test
9201 Category with identical sort key
9202 !! options
9203 cat
9204 !! input
9205 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9206 !! result
9207 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9208 !! end
9209
9210 !! test
9211 Category with empty sort key
9212 !! options
9213 cat
9214 pst
9215 !! input
9216 [[Category:MediaWiki User's Guide|]]
9217 !! result
9218 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9219 !! end
9220
9221 !! test
9222 Category with empty sort key and parentheses
9223 !! options
9224 cat
9225 pst
9226 !! input
9227 [[Category:Foo (bar)|]]
9228 !! result
9229 [[Category:Foo (bar)|Foo]]
9230 !! end
9231
9232 !! test
9233 Category with link tail
9234 !! options
9235 cat
9236 pst
9237 !! input
9238 123[[Category:Foo]]456
9239 !! result
9240 123[[Category:Foo]]456
9241 !! end
9242
9243 !! test
9244 Category with template
9245 !! options
9246 cat
9247 pst
9248 !! input
9249 [[Category:{{echo|Foo}}]]
9250 !! result
9251 [[Category:{{echo|Foo}}]]
9252 !! end
9253
9254 !! test
9255 Category with template in sort key
9256 !! options
9257 cat
9258 pst
9259 !! input
9260 [[Category:Foo|{{echo|Bar}}]]
9261 !! result
9262 [[Category:Foo|{{echo|Bar}}]]
9263 !! end
9264
9265 !! test
9266 Category with template in sort key and title
9267 !! options
9268 cat
9269 pst
9270 !! input
9271 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9272 !! result
9273 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9274 !! end
9275
9276 !! test
9277 Category / paragraph interactions
9278 !! input
9279 Foo [[Category:Baz]] Bar
9280
9281 Foo [[Category:Baz]]
9282 Bar
9283
9284 Foo
9285 [[Category:Baz]]
9286 Bar
9287
9288 Foo
9289 [[Category:Baz]] Bar
9290
9291 Foo
9292 [[Category:Baz]]
9293 [[Category:Baz]]
9294 [[Category:Baz]]
9295 Bar
9296
9297 [[Category:Baz]]
9298 [[Category:Baz]]
9299 [[Category:Baz]]
9300
9301 [[Category:Baz]]
9302 {{echo|[[Category:Baz]]}}
9303 [[Category:Baz]]
9304 !! result
9305 <p>Foo Bar
9306 </p><p>Foo
9307 Bar
9308 </p><p>Foo
9309 Bar
9310 </p><p>Foo Bar
9311 </p><p>Foo
9312 Bar
9313 </p>
9314 !! end
9315
9316 !! test
9317 Parsoid: Serialize link to category page with colon escape
9318 !! options
9319 parsoid
9320 !! input
9321
9322 [[:Category:Foo]]
9323 [[:Category:Foo|Bar]]
9324 !! result
9325 <p>
9326 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9327 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9328 </p>
9329 !! end
9330
9331 !! test
9332 Parsoid: Link prefix/suffixes aren't applied to category links
9333 !! options
9334 parsoid=wt2html,wt2wt,html2html
9335 language=is
9336 !! input
9337 x[[Category:Foo]]y
9338 !! result
9339 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9340 !! end
9341
9342 !! test
9343 Parsoid: Serialize link to file page with colon escape
9344 !! options
9345 parsoid
9346 !! input
9347
9348 [[:File:Foo.png]]
9349 [[:File:Foo.png|Bar]]
9350 !! result
9351 <p>
9352 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9353 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9354 </p>
9355 !! end
9356
9357 !! test
9358 Parsoid: Serialize a genuine category link without colon escape
9359 !! options
9360 parsoid
9361 !! input
9362 [[Category:Foo]]
9363 [[Category:Foo|Bar]]
9364 !! result
9365 <link rel="mw:WikiLink/Category" href="Category:Foo">
9366 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9367 !! end
9368
9369 ###
9370 ### Inter-language links
9371 ###
9372 !! test
9373 Inter-language links
9374 !! options
9375 ill
9376 !! input
9377 [[es:Alimento]]
9378 [[fr:Nourriture]]
9379 [[zh:&#39135;&#21697;]]
9380 !! result
9381 es:Alimento fr:Nourriture zh:食品
9382 !! end
9383
9384 !! test
9385 Duplicate interlanguage links (bug 24502)
9386 !! options
9387 ill
9388 !! input
9389 [[es:1]]
9390 [[es:2]]
9391 [[fr:1]]
9392 [[fr:2]]
9393 !! result
9394 es:1 fr:1
9395 !! end
9396
9397 ###
9398 ### Sections
9399 ###
9400 !! test
9401 Basic section headings
9402 !! input
9403 == Headline 1 ==
9404 Some text
9405
9406 ==Headline 2==
9407 More
9408 ===Smaller headline===
9409 Blah blah
9410 !! result
9411 <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>
9412 <p>Some text
9413 </p>
9414 <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>
9415 <p>More
9416 </p>
9417 <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>
9418 <p>Blah blah
9419 </p>
9420 !! end
9421
9422 !! test
9423 Section headings with TOC
9424 !! input
9425 == Headline 1 ==
9426 === Subheadline 1 ===
9427 ===== Skipping a level =====
9428 ====== Skipping a level ======
9429
9430 == Headline 2 ==
9431 Some text
9432 ===Another headline===
9433 !! result
9434 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9435 <ul>
9436 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9437 <ul>
9438 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9439 <ul>
9440 <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>
9441 <ul>
9442 <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>
9443 </ul>
9444 </li>
9445 </ul>
9446 </li>
9447 </ul>
9448 </li>
9449 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9450 <ul>
9451 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9452 </ul>
9453 </li>
9454 </ul>
9455 </div>
9456 <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>
9457 <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>
9458 <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>
9459 <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>
9460 <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>
9461 <p>Some text
9462 </p>
9463 <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>
9464
9465 !! end
9466
9467 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9468 !! test
9469 Handling of sections up to level 6 and beyond
9470 !! input
9471 = Level 1 Heading=
9472 == Level 2 Heading==
9473 === Level 3 Heading===
9474 ==== Level 4 Heading====
9475 ===== Level 5 Heading=====
9476 ====== Level 6 Heading======
9477 ======= Level 7 Heading=======
9478 ======== Level 8 Heading========
9479 ========= Level 9 Heading=========
9480 ========== Level 10 Heading==========
9481 !! result
9482 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9483 <ul>
9484 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9485 <ul>
9486 <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>
9487 <ul>
9488 <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>
9489 <ul>
9490 <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>
9491 <ul>
9492 <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>
9493 <ul>
9494 <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>
9495 <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>
9496 <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>
9497 <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>
9498 <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>
9499 </ul>
9500 </li>
9501 </ul>
9502 </li>
9503 </ul>
9504 </li>
9505 </ul>
9506 </li>
9507 </ul>
9508 </li>
9509 </ul>
9510 </div>
9511 <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>
9512 <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>
9513 <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>
9514 <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>
9515 <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>
9516 <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>
9517 <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>
9518 <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>
9519 <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>
9520 <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>
9521
9522 !! end
9523
9524 !! test
9525 TOC regression (bug 9764)
9526 !! input
9527 == title 1 ==
9528 === title 1.1 ===
9529 ==== title 1.1.1 ====
9530 === title 1.2 ===
9531 == title 2 ==
9532 === title 2.1 ===
9533 !! result
9534 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9535 <ul>
9536 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9537 <ul>
9538 <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>
9539 <ul>
9540 <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>
9541 </ul>
9542 </li>
9543 <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>
9544 </ul>
9545 </li>
9546 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9547 <ul>
9548 <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>
9549 </ul>
9550 </li>
9551 </ul>
9552 </div>
9553 <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>
9554 <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>
9555 <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>
9556 <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>
9557 <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>
9558 <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>
9559
9560 !! end
9561
9562 !! test
9563 TOC with wgMaxTocLevel=3 (bug 6204)
9564 !! options
9565 wgMaxTocLevel=3
9566 !! input
9567 == title 1 ==
9568 === title 1.1 ===
9569 ==== title 1.1.1 ====
9570 === title 1.2 ===
9571 == title 2 ==
9572 === title 2.1 ===
9573 !! result
9574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9575 <ul>
9576 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9577 <ul>
9578 <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>
9579 <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>
9580 </ul>
9581 </li>
9582 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9583 <ul>
9584 <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>
9585 </ul>
9586 </li>
9587 </ul>
9588 </div>
9589 <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>
9590 <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>
9591 <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>
9592 <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>
9593 <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>
9594 <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>
9595
9596 !! end
9597
9598 !! test
9599 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9600 !! options
9601 wgMaxTocLevel=3
9602 !! input
9603 ==Section 1==
9604 ===Section 1.1===
9605 ====Section 1.1.1====
9606 ====Section 1.1.1.1====
9607 ==Section 2==
9608 !! result
9609 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9610 <ul>
9611 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9612 <ul>
9613 <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>
9614 </ul>
9615 </li>
9616 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9617 </ul>
9618 </div>
9619 <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>
9620 <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>
9621 <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>
9622 <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>
9623 <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>
9624
9625 !! end
9626
9627
9628 !! test
9629 Resolving duplicate section names
9630 !! input
9631 == Foo bar ==
9632 == Foo bar ==
9633 !! result
9634 <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>
9635 <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>
9636
9637 !! end
9638
9639 !! test
9640 Resolving duplicate section names with differing case (bug 10721)
9641 !! input
9642 == Foo bar ==
9643 == Foo Bar ==
9644 !! result
9645 <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>
9646 <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>
9647
9648 !! end
9649
9650 !! article
9651 Template:sections
9652 !! text
9653 ===Section 1===
9654 ==Section 2==
9655 !! endarticle
9656
9657 !! test
9658 Template with sections, __NOTOC__
9659 !! input
9660 __NOTOC__
9661 ==Section 0==
9662 {{sections}}
9663 ==Section 4==
9664 !! result
9665 <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>
9666 <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>
9667 <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>
9668 <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>
9669
9670 !! end
9671
9672 !! test
9673 __NOEDITSECTION__ keyword
9674 !! input
9675 __NOEDITSECTION__
9676 ==Section 1==
9677 ==Section 2==
9678 !! result
9679 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9680 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9681
9682 !! end
9683
9684 !! test
9685 Link inside a section heading
9686 !! input
9687 ==Section with a [[Main Page|link]] in it==
9688 !! result
9689 <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>
9690
9691 !! end
9692
9693 !! test
9694 TOC regression (bug 12077)
9695 !! input
9696 __TOC__
9697 == title 1 ==
9698 === title 1.1 ===
9699 == title 2 ==
9700 !! result
9701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9702 <ul>
9703 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9704 <ul>
9705 <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>
9706 </ul>
9707 </li>
9708 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9709 </ul>
9710 </div>
9711 <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>
9712 <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>
9713 <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>
9714
9715 !! end
9716
9717 !! test
9718 BUG 1219 URL next to image (good)
9719 !! input
9720 http://example.com [[Image:foobar.jpg]]
9721 !! result
9722 <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>
9723 </p>
9724 !!end
9725
9726 !! test
9727 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9728 !! input
9729 ===
9730 The line above must have a trailing space!
9731 === <!--
9732 --> <!-- -->
9733 But just in case it doesn't...
9734 !! result
9735 <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>
9736 <p>The line above must have a trailing space!
9737 </p>
9738 <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>
9739 <p>But just in case it doesn't...
9740 </p>
9741 !! end
9742
9743 !! test
9744 Header with special characters (bug 25462)
9745 !! input
9746 The tooltips shall not show entities to the user (ie. be double escaped)
9747
9748 == text > text ==
9749 section 1
9750
9751 == text < text ==
9752 section 2
9753
9754 == text & text ==
9755 section 3
9756
9757 == text ' text ==
9758 section 4
9759
9760 == text " text ==
9761 section 5
9762 !! result
9763 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9764 </p>
9765 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9766 <ul>
9767 <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>
9768 <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>
9769 <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>
9770 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9771 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9772 </ul>
9773 </div>
9774 <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>
9775 <p>section 1
9776 </p>
9777 <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>
9778 <p>section 2
9779 </p>
9780 <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>
9781 <p>section 3
9782 </p>
9783 <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>
9784 <p>section 4
9785 </p>
9786 <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>
9787 <p>section 5
9788 </p>
9789 !! end
9790
9791 !! test
9792 Headers with excess '=' characters
9793 (Are similar tests necessary beyond the 1st level?)
9794 !! input
9795 =foo==
9796 ==foo=
9797 =''italic'' heading==
9798 ==''italic'' heading=
9799 !! result
9800 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9801 <ul>
9802 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9803 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9804 <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>
9805 <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>
9806 </ul>
9807 </div>
9808 <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>
9809 <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>
9810 <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>
9811 <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>
9812
9813 !! end
9814
9815 !! test
9816 HTML headers vs TOC (bug 23393)
9817 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9818 !! input
9819 <h1>Header 1</h1>
9820 == Header 1.1 ==
9821 == Header 1.2 ==
9822
9823 <h1>Header 2
9824 </h1>
9825 == Header 2.1 ==
9826 == Header 2.2 ==
9827 __NOEDITSECTION__
9828 !! result
9829 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9830 <ul>
9831 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9832 <ul>
9833 <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>
9834 <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>
9835 </ul>
9836 </li>
9837 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9838 <ul>
9839 <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>
9840 <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>
9841 </ul>
9842 </li>
9843 </ul>
9844 </div>
9845 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9846 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9847 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9848 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9849 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9850 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9851
9852 !! end
9853
9854 !! test
9855 BUG 1219 URL next to image (broken)
9856 !! input
9857 http://example.com[[Image:foobar.jpg]]
9858 !! result
9859 <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>
9860 </p>
9861 !!end
9862
9863 !! test
9864 Bug 1186 news: in the middle of text
9865 !! input
9866 http://en.wikinews.org/wiki/Wikinews:Workplace
9867 !! result
9868 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9869 </p>
9870 !!end
9871
9872
9873 !! test
9874 Namespaced link must have a title
9875 !! input
9876 [[Project:]]
9877 !! result
9878 <p>[[Project:]]
9879 </p>
9880 !!end
9881
9882 !! test
9883 Namespaced link must have a title (bad fragment version)
9884 !! input
9885 [[Project:#fragment]]
9886 !! result
9887 <p>[[Project:#fragment]]
9888 </p>
9889 !!end
9890
9891
9892 ###
9893 ### HTML tags and HTML attributes
9894 ###
9895
9896 !! test
9897 div with no attributes
9898 !! input
9899 <div>HTML rocks</div>
9900 !! result
9901 <div>HTML rocks</div>
9902
9903 !! end
9904
9905 !! test
9906 div with double-quoted attribute
9907 !! input
9908 <div id="rock">HTML rocks</div>
9909 !! result
9910 <div id="rock">HTML rocks</div>
9911
9912 !! end
9913
9914 !! test
9915 div with single-quoted attribute
9916 !! input
9917 <div id='rock'>HTML rocks</div>
9918 !! result
9919 <div id="rock">HTML rocks</div>
9920
9921 !! end
9922
9923 !! test
9924 div with unquoted attribute
9925 !! input
9926 <div id=rock>HTML rocks</div>
9927 !! result
9928 <div id="rock">HTML rocks</div>
9929
9930 !! end
9931
9932 !! test
9933 div with illegal double attributes
9934 !! input
9935 <div id="a" id="b">HTML rocks</div>
9936 !! result
9937 <div id="b">HTML rocks</div>
9938
9939 !!end
9940
9941 # FIXME: produce empty string instead of "class" in the PHP parser, following
9942 # the HTML5 spec.
9943 !! test
9944 div with empty attribute value, space before equals
9945 !! options
9946 parsoid
9947 !! input
9948 <div class =>HTML rocks</div>
9949 !! result
9950 <div class="">HTML rocks</div>
9951
9952 !! end
9953
9954 # The PHP parser escapes the opening brace to &#123; for some reason, so
9955 # disabled this test for it.
9956 !! test
9957 div with braces in attribute value
9958 !! options
9959 parsoid
9960 !! input
9961 <div title="{}">Foo</div>
9962 !! result
9963 <div title="{}">Foo</div>
9964 !! end
9965
9966 # This it very inconsistent in the PHP parser: it returns
9967 # class="class" if there is a space between the name and the equal sign (see
9968 # 'div with empty attribute value, space before equals'), but strips the
9969 # attribute completely if the space is missing. We hope that not much content
9970 # depends on this, so are implementing the behavior below in Parsoid for
9971 # consistencies' sake. Disabled for the PHP parser.
9972 # FIXME: fix this behavior in the PHP parser?
9973 !! test
9974 div with empty attribute value, no space before equals
9975 !! options
9976 parsoid
9977 !! input
9978 <div class=>HTML rocks</div>
9979 !! result
9980 <div class="">HTML rocks</div>
9981
9982 !! end
9983
9984 !! test
9985 HTML multiple attributes correction
9986 !! input
9987 <p class="error" class="awesome">Awesome!</p>
9988 !! result
9989 <p class="awesome">Awesome!</p>
9990
9991 !!end
9992
9993 !! test
9994 Table multiple attributes correction
9995 !! input
9996 {|
9997 !+ class="error" class="awesome"| status
9998 |}
9999 !! result
10000 <table>
10001 <tr>
10002 <th class="awesome"> status
10003 </th></tr></table>
10004
10005 !!end
10006
10007 !! test
10008 DIV IN UPPERCASE
10009 !! input
10010 <DIV ID="x">HTML ROCKS</DIV>
10011 !! result
10012 <div id="x">HTML ROCKS</div>
10013
10014 !!end
10015
10016 !! test
10017 Non-ASCII pseudo-tags are rendered as text
10018 !! input
10019 <khyô>
10020 !! result
10021 <p>&lt;khyô&gt;
10022 </p>
10023 !! end
10024
10025 !! test
10026 Pseudo-tag with URL 'name' renders as url link
10027 !! input
10028 <http://example.com/>
10029 !! result
10030 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10031 </p>
10032 !! end
10033
10034 !! test
10035 text with amp in the middle of nowhere
10036 !! input
10037 Remember AT&T?
10038 !!result
10039 <p>Remember AT&amp;T?
10040 </p>
10041 !! end
10042
10043 !! test
10044 text with character entity: eacute
10045 !! input
10046 I always thought &eacute; was a cute letter.
10047 !! result
10048 <p>I always thought &#233; was a cute letter.
10049 </p>
10050 !! end
10051
10052 !! test
10053 text with entity-escaped character entity-like string: eacute
10054 !! input
10055 I always thought &amp;eacute; was a cute letter.
10056 !! result
10057 <p>I always thought &amp;eacute; was a cute letter.
10058 </p>
10059 !! end
10060
10061 !! test
10062 text with undefined character entity: xacute
10063 !! input
10064 I always thought &xacute; was a cute letter.
10065 !! result
10066 <p>I always thought &amp;xacute; was a cute letter.
10067 </p>
10068 !! end
10069
10070
10071 ###
10072 ### Nesting tests (see bug 41545, 50604, 51081)
10073 ###
10074
10075 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10076 # Note that html2wt is considerably more difficult if we use <b> in
10077 # the test case, instead of <big>
10078 !! test
10079 Ensure that HTML adoption agency algorithm is properly implemented.
10080 !! input
10081 <big>X<big>Y</big>Z</big>
10082 !! result
10083 <p><big>X<big>Y</big>Z</big>
10084 </p>
10085 !! end
10086
10087 # This was bug 41545 in the PHP parser.
10088 !! test
10089 Nesting of <kbd>
10090 !! input
10091 <kbd>X<kbd>Y</kbd>Z</kbd>
10092 !! result
10093 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10094 </p>
10095 !! end
10096
10097 # The following cases were bug 51081 in the PHP parser.
10098 # Note that there are some other nestable tags (b, i, etc) which are
10099 # not covered; see bug 51081 for discussion.
10100 !! test
10101 Nesting of <em>
10102 !! input
10103 <em>X<em>Y</em>Z</em>
10104 !! result
10105 <p><em>X<em>Y</em>Z</em>
10106 </p>
10107 !! end
10108
10109 !! test
10110 Nesting of <strong>
10111 !! input
10112 <strong>X<strong>Y</strong>Z</strong>
10113 !! result
10114 <p><strong>X<strong>Y</strong>Z</strong>
10115 </p>
10116 !! end
10117
10118 !! test
10119 Nesting of <q>
10120 !! input
10121 <q>X<q>Y</q>Z</q>
10122 !! result
10123 <p><q>X<q>Y</q>Z</q>
10124 </p>
10125 !! end
10126
10127 !! test
10128 Nesting of <ruby>
10129 !! input
10130 <ruby>X<ruby>Y</ruby>Z</ruby>
10131 !! result
10132 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10133 </p>
10134 !! end
10135
10136 !! test
10137 Nesting of <bdo>
10138 !! input
10139 <bdo>X<bdo>Y</bdo>Z</bdo>
10140 !! result
10141 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10142 </p>
10143 !! end
10144
10145
10146 ###
10147 ### Media links
10148 ###
10149
10150 !! test
10151 Media link
10152 !! input
10153 [[Media:Foobar.jpg]]
10154 !! result
10155 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10156 </p>
10157 !! end
10158
10159 !! test
10160 Media link with text
10161 !! input
10162 [[Media:Foobar.jpg|A neat file to look at]]
10163 !! result
10164 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10165 </p>
10166 !! end
10167
10168 # FIXME: this is still bad HTML tag nesting
10169 !! test
10170 Media link with nasty text
10171 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10172 !! input
10173 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10174 !! result
10175 <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>
10176
10177 !! end
10178
10179 !! test
10180 Media link to nonexistent file (bug 1702)
10181 !! input
10182 [[Media:No such.jpg]]
10183 !! result
10184 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10185 </p>
10186 !! end
10187
10188 !! test
10189 Image link to nonexistent file (bug 1850 - good)
10190 !! input
10191 [[Image:No such.jpg]]
10192 !! result
10193 <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>
10194 </p>
10195 !! end
10196
10197 !! test
10198 :Image link to nonexistent file (bug 1850 - bad)
10199 !! input
10200 [[:Image:No such.jpg]]
10201 !! result
10202 <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>
10203 </p>
10204 !! end
10205
10206
10207
10208 !! test
10209 Character reference normalization in link text (bug 1938)
10210 !! input
10211 [[Main Page|this&that]]
10212 !! result
10213 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10214 </p>
10215 !!end
10216
10217 !! article
10218 אַ
10219 !! text
10220 Test for unicode normalization
10221
10222 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10223 !! endarticle
10224
10225 !! test
10226 (bug 19451) Links should refer to the normalized form.
10227 !! input
10228 [[&#xFB2E;]]
10229 [[&#x5d0;&#x5b7;]]
10230 [[&#x5d0;ַ]]
10231 [[א&#x5b7;]]
10232 [[אַ]]
10233 !! result
10234 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10235 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10236 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10237 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10238 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10239 </p>
10240 !! end
10241
10242 !! test
10243 Empty attribute crash test (bug 2067)
10244 !! input
10245 <font color="">foo</font>
10246 !! result
10247 <p><font color="">foo</font>
10248 </p>
10249 !! end
10250
10251 !! test
10252 Empty attribute crash test single-quotes (bug 2067)
10253 !! input
10254 <font color=''>foo</font>
10255 !! result
10256 <p><font color="">foo</font>
10257 </p>
10258 !! end
10259
10260 !! test
10261 Attribute test: equals, then nothing
10262 !! input
10263 <font color=>foo</font>
10264 !! result
10265 <p><font>foo</font>
10266 </p>
10267 !! end
10268
10269 !! test
10270 Attribute test: unquoted value
10271 !! input
10272 <font color=x>foo</font>
10273 !! result
10274 <p><font color="x">foo</font>
10275 </p>
10276 !! end
10277
10278 !! test
10279 Attribute test: unquoted but illegal value (hash)
10280 !! input
10281 <font color=#x>foo</font>
10282 !! result
10283 <p><font color="#x">foo</font>
10284 </p>
10285 !! end
10286
10287 !! test
10288 Attribute test: no value
10289 !! input
10290 <font color>foo</font>
10291 !! result
10292 <p><font color="color">foo</font>
10293 </p>
10294 !! end
10295
10296 !! test
10297 Bug 2095: link with three closing brackets
10298 !! input
10299 [[Main Page]]]
10300 !! result
10301 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10302 </p>
10303 !! end
10304
10305 !! test
10306 Bug 2095: link with pipe and three closing brackets
10307 !! input
10308 [[Main Page|link]]]
10309 !! result
10310 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10311 </p>
10312 !! end
10313
10314 !! test
10315 Bug 2095: link with pipe and three closing brackets, version 2
10316 !! input
10317 [[Main Page|[http://example.com/]]]
10318 !! result
10319 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10320 </p>
10321 !! end
10322
10323
10324 ###
10325 ### Safety
10326 ###
10327
10328 !! article
10329 Template:Dangerous attribute
10330 !! text
10331 " onmouseover="alert(document.cookie)
10332 !! endarticle
10333
10334 !! article
10335 Template:Dangerous style attribute
10336 !! text
10337 border-size: expression(alert(document.cookie))
10338 !! endarticle
10339
10340 !! article
10341 Template:Div style
10342 !! text
10343 <div style="float: right; {{{1}}}">Magic div</div>
10344 !! endarticle
10345
10346 !! test
10347 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10348 !! input
10349 <div title="{{test}}"></div>
10350 !! result
10351 <div title="This is a test template"></div>
10352
10353 !! end
10354
10355 !! test
10356 Bug 2304: HTML attribute safety (dangerous template; 2309)
10357 !! input
10358 <div title="{{dangerous attribute}}"></div>
10359 !! result
10360 <div title=""></div>
10361
10362 !! end
10363
10364 !! test
10365 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10366 !! input
10367 <div style="{{dangerous style attribute}}"></div>
10368 !! result
10369 <div style="/* insecure input */"></div>
10370
10371 !! end
10372
10373 !! test
10374 Bug 2304: HTML attribute safety (safe parameter; 2309)
10375 !! input
10376 {{div style|width: 200px}}
10377 !! result
10378 <div style="float: right; width: 200px">Magic div</div>
10379
10380 !! end
10381
10382 !! test
10383 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10384 !! input
10385 {{div style|width: expression(alert(document.cookie))}}
10386 !! result
10387 <div style="/* insecure input */">Magic div</div>
10388
10389 !! end
10390
10391 !! test
10392 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10393 !! input
10394 {{div style|"><script>alert(document.cookie)</script>}}
10395 !! result
10396 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10397
10398 !! end
10399
10400 !! test
10401 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10402 !! input
10403 {{div style|" ><script>alert(document.cookie)</script>}}
10404 !! result
10405 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10406
10407 !! end
10408
10409 !! test
10410 Bug 2304: HTML attribute safety (link)
10411 !! input
10412 <div title="[[Main Page]]"></div>
10413 !! result
10414 <div title="&#91;&#91;Main Page]]"></div>
10415
10416 !! end
10417
10418 !! test
10419 Bug 2304: HTML attribute safety (italics)
10420 !! input
10421 <div title="''foobar''"></div>
10422 !! result
10423 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10424
10425 !! end
10426
10427 !! test
10428 Bug 2304: HTML attribute safety (bold)
10429 !! input
10430 <div title="'''foobar'''"></div>
10431 !! result
10432 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10433
10434 !! end
10435
10436
10437 !! test
10438 Bug 2304: HTML attribute safety (ISBN)
10439 !! input
10440 <div title="ISBN 1234567890"></div>
10441 !! result
10442 <div title="&#73;SBN 1234567890"></div>
10443
10444 !! end
10445
10446 !! test
10447 Bug 2304: HTML attribute safety (RFC)
10448 !! input
10449 <div title="RFC 1234"></div>
10450 !! result
10451 <div title="&#82;FC 1234"></div>
10452
10453 !! end
10454
10455 !! test
10456 Bug 2304: HTML attribute safety (PMID)
10457 !! input
10458 <div title="PMID 1234567890"></div>
10459 !! result
10460 <div title="&#80;MID 1234567890"></div>
10461
10462 !! end
10463
10464 !! test
10465 Bug 2304: HTML attribute safety (web link)
10466 !! input
10467 <div title="http://example.com/"></div>
10468 !! result
10469 <div title="http&#58;//example.com/"></div>
10470
10471 !! end
10472
10473 !! test
10474 Bug 2304: HTML attribute safety (named web link)
10475 !! input
10476 <div title="[http://example.com/ link]"></div>
10477 !! result
10478 <div title="&#91;http&#58;//example.com/ link]"></div>
10479
10480 !! end
10481
10482 !! test
10483 Bug 3244: HTML attribute safety (extension; safe)
10484 !! input
10485 <div style="<nowiki>background:blue</nowiki>"></div>
10486 !! result
10487 <div style="background:blue"></div>
10488
10489 !! end
10490
10491 !! test
10492 Bug 3244: HTML attribute safety (extension; unsafe)
10493 !! input
10494 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10495 !! result
10496 <div style="/* insecure input */"></div>
10497
10498 !! end
10499
10500 # More MSIE fun discovered by Tom Gilder
10501
10502 !! test
10503 MSIE CSS safety test: spurious slash
10504 !! input
10505 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10506 !! result
10507 <div style="/* insecure input */">evil</div>
10508
10509 !! end
10510
10511 !! test
10512 MSIE CSS safety test: hex code
10513 !! input
10514 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10515 !! result
10516 <div style="/* insecure input */">evil</div>
10517
10518 !! end
10519
10520 !! test
10521 MSIE CSS safety test: comment in url
10522 !! input
10523 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10524 !! result
10525 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10526
10527 !! end
10528
10529 !! test
10530 MSIE CSS safety test: comment in expression
10531 !! input
10532 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10533 !! result
10534 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10535
10536 !! end
10537
10538
10539 !! test
10540 Table attribute legitimate extension
10541 !! input
10542 {|
10543 !+ style="<nowiki>color:blue</nowiki>"| status
10544 |}
10545 !! result
10546 <table>
10547 <tr>
10548 <th style="color:blue"> status
10549 </th></tr></table>
10550
10551 !!end
10552
10553 !! test
10554 Table attribute safety
10555 !! input
10556 {|
10557 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10558 |}
10559 !! result
10560 <table>
10561 <tr>
10562 <th style="/* insecure input */"> status
10563 </th></tr></table>
10564
10565 !! end
10566
10567 !! test
10568 CSS line continuation 1
10569 !! input
10570 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10571 !! result
10572 <div style="/* insecure input */"></div>
10573
10574 !! end
10575
10576 !! test
10577 CSS line continuation 2
10578 !! input
10579 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10580 !! result
10581 <div style="/* insecure input */"></div>
10582
10583 !! end
10584
10585 !! article
10586 Template:Identity
10587 !! text
10588 {{{1}}}
10589 !! endarticle
10590
10591 !! test
10592 Expansion of multi-line templates in attribute values (bug 6255)
10593 !! input
10594 <div style="background: {{identity|#00FF00}}">-</div>
10595 !! result
10596 <div style="background: #00FF00">-</div>
10597
10598 !! end
10599
10600
10601 !! test
10602 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10603 !! input
10604 <div style="background:
10605 #00FF00">-</div>
10606 !! result
10607 <div style="background: #00FF00">-</div>
10608
10609 !! end
10610
10611 !! test
10612 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10613 !! input
10614 <div style="background: &#10;#00FF00">-</div>
10615 !! result
10616 <div style="background: &#10;#00FF00">-</div>
10617
10618 !! end
10619
10620 ###
10621 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
10622 ###
10623 !! test
10624 Parser hook: empty input
10625 !! input
10626 <tag></tag>
10627 !! result
10628 <pre>
10629 ''
10630 array (
10631 )
10632 </pre>
10633
10634 !! end
10635
10636 !! test
10637 Parser hook: empty input using terminated empty elements
10638 !! input
10639 <tag/>
10640 !! result
10641 <pre>
10642 NULL
10643 array (
10644 )
10645 </pre>
10646
10647 !! end
10648
10649 !! test
10650 Parser hook: empty input using terminated empty elements (space before)
10651 !! input
10652 <tag />
10653 !! result
10654 <pre>
10655 NULL
10656 array (
10657 )
10658 </pre>
10659
10660 !! end
10661
10662 !! test
10663 Parser hook: basic input
10664 !! input
10665 <tag>input</tag>
10666 !! result
10667 <pre>
10668 'input'
10669 array (
10670 )
10671 </pre>
10672
10673 !! end
10674
10675
10676 !! test
10677 Parser hook: case insensitive
10678 !! input
10679 <TAG>input</TAG>
10680 !! result
10681 <pre>
10682 'input'
10683 array (
10684 )
10685 </pre>
10686
10687 !! end
10688
10689
10690 !! test
10691 Parser hook: case insensitive, redux
10692 !! input
10693 <TaG>input</TAg>
10694 !! result
10695 <pre>
10696 'input'
10697 array (
10698 )
10699 </pre>
10700
10701 !! end
10702
10703 !! test
10704 Parser hook: nested tags
10705 !! options
10706 noxml
10707 !! input
10708 <tag><tag></tag></tag>
10709 !! result
10710 <pre>
10711 '<tag>'
10712 array (
10713 )
10714 </pre>&lt;/tag&gt;
10715
10716 !! end
10717
10718 !! test
10719 Parser hook: basic arguments
10720 !! input
10721 <tag width=200 height = "100" depth = '50' square></tag>
10722 !! result
10723 <pre>
10724 ''
10725 array (
10726 'width' => '200',
10727 'height' => '100',
10728 'depth' => '50',
10729 'square' => 'square',
10730 )
10731 </pre>
10732
10733 !! end
10734
10735 !! test
10736 Parser hook: argument containing a forward slash (bug 5344)
10737 !! input
10738 <tag filename='/tmp/bla'></tag>
10739 !! result
10740 <pre>
10741 ''
10742 array (
10743 'filename' => '/tmp/bla',
10744 )
10745 </pre>
10746
10747 !! end
10748
10749 !! test
10750 Parser hook: empty input using terminated empty elements (bug 2374)
10751 !! input
10752 <tag foo=bar/>text
10753 !! result
10754 <pre>
10755 NULL
10756 array (
10757 'foo' => 'bar',
10758 )
10759 </pre>text
10760
10761 !! end
10762
10763 # </tag> should be output literally since there is no matching tag that begins it
10764 !! test
10765 Parser hook: basic arguments using terminated empty elements (bug 2374)
10766 !! input
10767 <tag width=200 height = "100" depth = '50' square/>
10768 other stuff
10769 </tag>
10770 !! result
10771 <pre>
10772 NULL
10773 array (
10774 'width' => '200',
10775 'height' => '100',
10776 'depth' => '50',
10777 'square' => 'square',
10778 )
10779 </pre>
10780 <p>other stuff
10781 &lt;/tag&gt;
10782 </p>
10783 !! end
10784
10785 ###
10786 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
10787 ###
10788
10789 !! test
10790 Parser hook: static parser hook not inside a comment
10791 !! input
10792 <statictag>hello, world</statictag>
10793 <statictag action=flush/>
10794 !! result
10795 <p>hello, world
10796 </p>
10797 !! end
10798
10799
10800 !! test
10801 Parser hook: static parser hook inside a comment
10802 !! input
10803 <!-- <statictag>hello, world</statictag> -->
10804 <statictag action=flush/>
10805 !! result
10806 <p><br />
10807 </p>
10808 !! end
10809
10810 # Nested template calls; this case was broken by Parser.php rev 1.506,
10811 # since reverted.
10812
10813 !! article
10814 Template:One-parameter
10815 !! text
10816 (My parameter is: {{{1}}})
10817 !! endarticle
10818
10819 !! article
10820 Template:Map-one-parameter
10821 !! text
10822 {{{{{1}}}|{{{2}}}}}
10823 !! endarticle
10824
10825 !! test
10826 Nested template calls
10827 !! input
10828 {{Map-one-parameter|One-parameter|param}}
10829 !! result
10830 <p>(My parameter is: param)
10831 </p>
10832 !! end
10833
10834
10835 ###
10836 ### Sanitizer
10837 ###
10838 !! test
10839 Sanitizer: Closing of open tags
10840 !! input
10841 <s></s><table></table>
10842 !! result
10843 <s></s><table></table>
10844
10845 !! end
10846
10847 !! test
10848 Sanitizer: Closing of open but not closed tags
10849 !! input
10850 <s>foo
10851 !! result
10852 <p><s>foo</s>
10853 </p>
10854 !! end
10855
10856 !! test
10857 Sanitizer: Closing of closed but not open tags
10858 !! input
10859 </s>
10860 !! result
10861 <p>&lt;/s&gt;
10862 </p>
10863 !! end
10864
10865 !! test
10866 Sanitizer: Closing of closed but not open table tags
10867 !! input
10868 Table not started</td></tr></table>
10869 !! result
10870 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10871 </p>
10872 !! end
10873
10874 !! test
10875 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10876 !! input
10877 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10878 !! result
10879 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10880 </p>
10881 !! end
10882
10883 !! test
10884 Sanitizer: Validating the contents of the id attribute (bug 4515)
10885 !! options
10886 disabled
10887 !! input
10888 <br id=9 />
10889 !! result
10890 Something, but definitely not <br id="9" />...
10891 !! end
10892
10893 !! test
10894 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10895 !! options
10896 disabled
10897 !! input
10898 <br id="foo" /><br id="foo" />
10899 !! result
10900 Something need to be done. foo-2 ?
10901 !! end
10902
10903 !! test
10904 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10905 !! input
10906 <div itemscope>
10907 <meta itemprop="hello" content="world">
10908 <meta http-equiv="refresh" content="5">
10909 <meta itemprop="hello" http-equiv="refresh" content="5">
10910 <link itemprop="hello" href="{{SERVER}}">
10911 <link rel="stylesheet" href="{{SERVER}}">
10912 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10913 </div>
10914 !! result
10915 <div itemscope="itemscope">
10916 <p> <meta itemprop="hello" content="world" />
10917 &lt;meta http-equiv="refresh" content="5"&gt;
10918 <meta itemprop="hello" content="5" />
10919 </p>
10920 <link itemprop="hello" href="http&#58;//example.org" />
10921 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10922 <link itemprop="hello" href="http&#58;//example.org" />
10923 </div>
10924
10925 !! end
10926
10927 !! test
10928 Language converter: output gets cut off unexpectedly (bug 5757)
10929 !! options
10930 language=zh
10931 !! input
10932 this bit is safe: }-
10933
10934 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10935
10936 then we get cut off here: }-
10937
10938 all additional text is vanished
10939 !! result
10940 <p>this bit is safe: }-
10941 </p><p>but if we add a conversion instance: xxx
10942 </p><p>then we get cut off here: }-
10943 </p><p>all additional text is vanished
10944 </p>
10945 !! end
10946
10947 !! test
10948 Self closed html pairs (bug 5487)
10949 !! options
10950 !! input
10951 <center><font id="bug" />Centered text</center>
10952 <div><font id="bug2" />In div text</div>
10953 !! result
10954 <center>&lt;font id="bug" /&gt;Centered text</center>
10955 <div>&lt;font id="bug2" /&gt;In div text</div>
10956
10957 !! end
10958
10959 #
10960 #
10961 #
10962
10963 !! test
10964 Punctuation: nbsp before exclamation
10965 !! input
10966 C'est grave !
10967 !! result
10968 <p>C'est grave&#160;!
10969 </p>
10970 !! end
10971
10972 !! test
10973 Punctuation: CSS !important (bug 11874)
10974 !! input
10975 <div style="width:50% !important">important</div>
10976 !! result
10977 <div style="width:50% !important">important</div>
10978
10979 !!end
10980
10981 !! test
10982 Punctuation: CSS ! important (bug 11874; with space after)
10983 !! input
10984 <div style="width:50% ! important">important</div>
10985 !! result
10986 <div style="width:50% ! important">important</div>
10987
10988 !!end
10989
10990
10991 !! test
10992 HTML bullet list, closed tags (bug 5497)
10993 !! input
10994 <ul>
10995 <li>One</li>
10996 <li>Two</li>
10997 </ul>
10998 !! result
10999 <ul>
11000 <li>One</li>
11001 <li>Two</li>
11002 </ul>
11003
11004 !! end
11005
11006 !! test
11007 HTML bullet list, unclosed tags (bug 5497)
11008 !! options
11009 disabled
11010 !! input
11011 <ul>
11012 <li>One
11013 <li>Two
11014 </ul>
11015 !! result
11016 <ul>
11017 <li>One
11018 </li><li>Two
11019 </li></ul>
11020
11021 !! end
11022
11023 !! test
11024 HTML ordered list, closed tags (bug 5497)
11025 !! input
11026 <ol>
11027 <li>One</li>
11028 <li>Two</li>
11029 </ol>
11030 !! result
11031 <ol>
11032 <li>One</li>
11033 <li>Two</li>
11034 </ol>
11035
11036 !! end
11037
11038 !! test
11039 HTML ordered list, unclosed tags (bug 5497)
11040 !! options
11041 disabled
11042 !! input
11043 <ol>
11044 <li>One
11045 <li>Two
11046 </ol>
11047 !! result
11048 <ol>
11049 <li>One
11050 </li><li>Two
11051 </li></ol>
11052
11053 !! end
11054
11055 !! test
11056 HTML nested bullet list, closed tags (bug 5497)
11057 !! input
11058 <ul>
11059 <li>One</li>
11060 <li>Two:
11061 <ul>
11062 <li>Sub-one</li>
11063 <li>Sub-two</li>
11064 </ul>
11065 </li>
11066 </ul>
11067 !! result
11068 <ul>
11069 <li>One</li>
11070 <li>Two:
11071 <ul>
11072 <li>Sub-one</li>
11073 <li>Sub-two</li>
11074 </ul>
11075 </li>
11076 </ul>
11077
11078 !! end
11079
11080 !! test
11081 HTML nested bullet list, open tags (bug 5497)
11082 !! options
11083 disabled
11084 !! input
11085 <ul>
11086 <li>One
11087 <li>Two:
11088 <ul>
11089 <li>Sub-one
11090 <li>Sub-two
11091 </ul>
11092 </ul>
11093 !! result
11094 <ul>
11095 <li>One
11096 </li><li>Two:
11097 <ul>
11098 <li>Sub-one
11099 </li><li>Sub-two
11100 </li></ul>
11101 </li></ul>
11102
11103 !! end
11104
11105 !! test
11106 HTML nested ordered list, closed tags (bug 5497)
11107 !! input
11108 <ol>
11109 <li>One</li>
11110 <li>Two:
11111 <ol>
11112 <li>Sub-one</li>
11113 <li>Sub-two</li>
11114 </ol>
11115 </li>
11116 </ol>
11117 !! result
11118 <ol>
11119 <li>One</li>
11120 <li>Two:
11121 <ol>
11122 <li>Sub-one</li>
11123 <li>Sub-two</li>
11124 </ol>
11125 </li>
11126 </ol>
11127
11128 !! end
11129
11130 !! test
11131 HTML nested ordered list, open tags (bug 5497)
11132 !! options
11133 disabled
11134 !! input
11135 <ol>
11136 <li>One
11137 <li>Two:
11138 <ol>
11139 <li>Sub-one
11140 <li>Sub-two
11141 </ol>
11142 </ol>
11143 !! result
11144 <ol>
11145 <li>One
11146 </li><li>Two:
11147 <ol>
11148 <li>Sub-one
11149 </li><li>Sub-two
11150 </li></ol>
11151 </li></ol>
11152
11153 !! end
11154
11155 !! test
11156 HTML ordered list item with parameters oddity
11157 !! input
11158 <ol><li id="fragment">One</li></ol>
11159 !! result
11160 <ol><li id="fragment">One</li></ol>
11161
11162 !! end
11163
11164 !!test
11165 bug 5918: autonumbering
11166 !! input
11167 [http://first/] [http://second] [ftp://ftp]
11168
11169 ftp://inlineftp
11170
11171 [mailto:enclosed@mail.tld With target]
11172
11173 [mailto:enclosed@mail.tld]
11174
11175 mailto:inline@mail.tld
11176 !! result
11177 <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>
11178 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11179 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11180 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11181 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11182 </p>
11183 !! end
11184
11185
11186 #
11187 # Security and HTML correctness
11188 # From Nick Jenkins' fuzz testing
11189 #
11190
11191 !! test
11192 Fuzz testing: Parser13
11193 !! input
11194 {|
11195 | http://a|
11196 !! result
11197 <table>
11198 <tr>
11199 <td>
11200 </td>
11201 </tr>
11202 </table>
11203
11204 !! end
11205
11206 !! test
11207 Fuzz testing: Parser14
11208 !! input
11209 == onmouseover= ==
11210 http://__TOC__
11211 !! result
11212 <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>
11213 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11214 <ul>
11215 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11216 </ul>
11217 </div>
11218
11219 !! end
11220
11221 !! test
11222 Fuzz testing: Parser14-table
11223 !! input
11224 ==a==
11225 {| STYLE=__TOC__
11226 !! result
11227 <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>
11228 <table style="&#95;_TOC&#95;_">
11229 <tr><td></td></tr>
11230 </table>
11231
11232 !! end
11233
11234 # Known to produce bogus xml (extra </td>)
11235 !! test
11236 Fuzz testing: Parser16
11237 !! options
11238 noxml
11239 !! input
11240 {|
11241 !https://||||||
11242 !! result
11243 <table>
11244 <tr>
11245 <th>https://</th>
11246 <th></th>
11247 <th></th>
11248 <th>
11249 </td>
11250 </tr>
11251 </table>
11252
11253 !! end
11254
11255 !! test
11256 Fuzz testing: Parser21
11257 !! input
11258 {|
11259 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11260 |
11261 !! result
11262 <table>
11263 <tr>
11264 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11265 </th>
11266 <td>
11267 </td>
11268 </tr>
11269 </table>
11270
11271 !! end
11272
11273 !! test
11274 Fuzz testing: Parser22
11275 !! input
11276 http://===r:::https://b
11277
11278 {|
11279 !!result
11280 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11281 </p>
11282 <table>
11283 <tr><td></td></tr>
11284 </table>
11285
11286 !! end
11287
11288 # Known to produce bad XML for now
11289 !! test
11290 Fuzz testing: Parser24
11291 !! options
11292 noxml
11293 !! input
11294 {|
11295 {{{|
11296 <u CLASS=
11297 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11298 <br style="onmouseover='alert(document.cookie);' " />
11299
11300 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11301 |
11302 !! result
11303 <table>
11304 {{{|
11305 <u class="&#124;">}}}} &gt;
11306 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11307
11308 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11309 <tr>
11310 <td></u>
11311 </td>
11312 </tr>
11313 </table>
11314
11315 !! end
11316
11317 # Note: the current result listed for this is not what the original one was,
11318 # but the original bug was JavaScript injection, which is fixed in any case.
11319 # It's not clear that the original result listed was any more correct than the
11320 # current one. Original result:
11321 # <p>{{{|
11322 # </p>
11323 # <li class="&#124;&#124;">
11324 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11325 !!test
11326 Fuzz testing: Parser25 (bug 6055)
11327 !! input
11328 {{{
11329 |
11330 <LI CLASS=||
11331 >
11332 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11333 !! result
11334 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11335 </p>
11336 !! end
11337
11338 !!test
11339 Fuzz testing: URL adjacent extension (with space, clean)
11340 !! options
11341 !! input
11342 http://example.com <nowiki>junk</nowiki>
11343 !! result
11344 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11345 </p>
11346 !!end
11347
11348 !!test
11349 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11350 !! options
11351 !! input
11352 http://example.com<nowiki>junk</nowiki>
11353 !! result
11354 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11355 </p>
11356 !!end
11357
11358 !!test
11359 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11360 !! options
11361 !! input
11362 http://example.com<pre>junk</pre>
11363 !! result
11364 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11365
11366 !!end
11367
11368 !!test
11369 Fuzz testing: image with bogus manual thumbnail
11370 !!input
11371 [[Image:foobar.jpg|thumbnail= ]]
11372 !!result
11373 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
11374
11375 !!end
11376
11377 !! test
11378 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11379 !! input
11380 <pre dir="&#10;"></pre>
11381 !! result
11382 <pre dir="&#10;"></pre>
11383
11384 !! end
11385
11386 !! test
11387 Parsing optional HTML elements (Bug 6171)
11388 !! options
11389 !! input
11390 <table>
11391 <tr>
11392 <td> Some tabular data</td>
11393 <td> More tabular data ...
11394 <td> And yet som tabular data</td>
11395 </tr>
11396 </table>
11397 !! result
11398 <table>
11399 <tr>
11400 <td> Some tabular data</td>
11401 <td> More tabular data ...
11402 </td><td> And yet som tabular data</td>
11403 </tr>
11404 </table>
11405
11406 !! end
11407
11408 !! test
11409 Correct handling of <td>, <tr> (Bug 6171)
11410 !! options
11411 !! input
11412 <table>
11413 <tr>
11414 <td> Some tabular data</td>
11415 <td> More tabular data ...</td>
11416 <td> And yet som tabular data</td>
11417 </tr>
11418 </table>
11419 !! result
11420 <table>
11421 <tr>
11422 <td> Some tabular data</td>
11423 <td> More tabular data ...</td>
11424 <td> And yet som tabular data</td>
11425 </tr>
11426 </table>
11427
11428 !! end
11429
11430
11431 !! test
11432 Parsing crashing regression (fr:JavaScript)
11433 !! input
11434 </body></x>
11435 !! result
11436 <p>&lt;/body&gt;&lt;/x&gt;
11437 </p>
11438 !! end
11439
11440 !! test
11441 Inline wiki vs wiki block nesting
11442 !! input
11443 '''Bold paragraph
11444
11445 New wiki paragraph
11446 !! result
11447 <p><b>Bold paragraph</b>
11448 </p><p>New wiki paragraph
11449 </p>
11450 !! end
11451
11452 !! test
11453 Inline HTML vs wiki block nesting
11454 !! options
11455 disabled
11456 !! input
11457 <b>Bold paragraph
11458
11459 New wiki paragraph
11460 !! result
11461 <p><b>Bold paragraph</b>
11462 </p><p>New wiki paragraph
11463 </p>
11464 !! end
11465
11466 # Original result was this:
11467 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11468 # </p>
11469 # While that might be marginally more intuitive, maybe, the six-apostrophe
11470 # construct is clearly pathological and the result stated here (which is what
11471 # the parser actually does) is about as reasonable as anything.
11472 !!test
11473 Mixing markup for italics and bold
11474 !! options
11475 !! input
11476 '''bold''''''bold''bolditalics'''''
11477 !! result
11478 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11479 </p>
11480 !! end
11481
11482
11483 !! article
11484 Xyzzyx
11485 !! text
11486 Article for special page transclusion test
11487 !! endarticle
11488
11489 !! test
11490 Special page transclusion
11491 !! options
11492 !! input
11493 {{Special:Prefixindex/Xyzzyx}}
11494 !! result
11495 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11496
11497 !! end
11498
11499 !! test
11500 Special page transclusion twice (bug 5021)
11501 !! options
11502 !! input
11503 {{Special:Prefixindex/Xyzzyx}}
11504 {{Special:Prefixindex/Xyzzyx}}
11505 !! result
11506 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11507 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11508
11509 !! end
11510
11511 !! test
11512 Transclusion of default MediaWiki message
11513 !! input
11514 {{MediaWiki:Mainpage}}
11515 !!result
11516 <p>Main Page
11517 </p>
11518 !! end
11519
11520 !! test
11521 Transclusion of nonexistent MediaWiki message
11522 !! input
11523 {{MediaWiki:Mainpagexxx}}
11524 !!result
11525 <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>
11526 </p>
11527 !! end
11528
11529 !! test
11530 Transclusion of MediaWiki message with underscore
11531 !! input
11532 {{MediaWiki:history_short}}
11533 !! result
11534 <p>History
11535 </p>
11536 !! end
11537
11538 !! test
11539 Transclusion of MediaWiki message with space
11540 !! input
11541 {{MediaWiki:history short}}
11542 !! result
11543 <p>History
11544 </p>
11545 !! end
11546
11547 !! test
11548 Invalid header with following text
11549 !! input
11550 = x = y
11551 !! result
11552 <p>= x = y
11553 </p>
11554 !! end
11555
11556
11557 !! test
11558 Section extraction test (section 0)
11559 !! options
11560 section=0
11561 !! input
11562 start
11563 ==a==
11564 ===aa===
11565 ====aaa====
11566 ==b==
11567 ===ba===
11568 ===bb===
11569 ====bba====
11570 ===bc===
11571 ==c==
11572 ===ca===
11573 !! result
11574 start
11575 !! end
11576
11577 !! test
11578 Section extraction test (section 1)
11579 !! options
11580 section=1
11581 !! input
11582 start
11583 ==a==
11584 ===aa===
11585 ====aaa====
11586 ==b==
11587 ===ba===
11588 ===bb===
11589 ====bba====
11590 ===bc===
11591 ==c==
11592 ===ca===
11593 !! result
11594 ==a==
11595 ===aa===
11596 ====aaa====
11597 !! end
11598
11599 !! test
11600 Section extraction test (section 2)
11601 !! options
11602 section=2
11603 !! input
11604 start
11605 ==a==
11606 ===aa===
11607 ====aaa====
11608 ==b==
11609 ===ba===
11610 ===bb===
11611 ====bba====
11612 ===bc===
11613 ==c==
11614 ===ca===
11615 !! result
11616 ===aa===
11617 ====aaa====
11618 !! end
11619
11620 !! test
11621 Section extraction test (section 3)
11622 !! options
11623 section=3
11624 !! input
11625 start
11626 ==a==
11627 ===aa===
11628 ====aaa====
11629 ==b==
11630 ===ba===
11631 ===bb===
11632 ====bba====
11633 ===bc===
11634 ==c==
11635 ===ca===
11636 !! result
11637 ====aaa====
11638 !! end
11639
11640 !! test
11641 Section extraction test (section 4)
11642 !! options
11643 section=4
11644 !! input
11645 start
11646 ==a==
11647 ===aa===
11648 ====aaa====
11649 ==b==
11650 ===ba===
11651 ===bb===
11652 ====bba====
11653 ===bc===
11654 ==c==
11655 ===ca===
11656 !! result
11657 ==b==
11658 ===ba===
11659 ===bb===
11660 ====bba====
11661 ===bc===
11662 !! end
11663
11664 !! test
11665 Section extraction test (section 5)
11666 !! options
11667 section=5
11668 !! input
11669 start
11670 ==a==
11671 ===aa===
11672 ====aaa====
11673 ==b==
11674 ===ba===
11675 ===bb===
11676 ====bba====
11677 ===bc===
11678 ==c==
11679 ===ca===
11680 !! result
11681 ===ba===
11682 !! end
11683
11684 !! test
11685 Section extraction test (section 6)
11686 !! options
11687 section=6
11688 !! input
11689 start
11690 ==a==
11691 ===aa===
11692 ====aaa====
11693 ==b==
11694 ===ba===
11695 ===bb===
11696 ====bba====
11697 ===bc===
11698 ==c==
11699 ===ca===
11700 !! result
11701 ===bb===
11702 ====bba====
11703 !! end
11704
11705 !! test
11706 Section extraction test (section 7)
11707 !! options
11708 section=7
11709 !! input
11710 start
11711 ==a==
11712 ===aa===
11713 ====aaa====
11714 ==b==
11715 ===ba===
11716 ===bb===
11717 ====bba====
11718 ===bc===
11719 ==c==
11720 ===ca===
11721 !! result
11722 ====bba====
11723 !! end
11724
11725 !! test
11726 Section extraction test (section 8)
11727 !! options
11728 section=8
11729 !! input
11730 start
11731 ==a==
11732 ===aa===
11733 ====aaa====
11734 ==b==
11735 ===ba===
11736 ===bb===
11737 ====bba====
11738 ===bc===
11739 ==c==
11740 ===ca===
11741 !! result
11742 ===bc===
11743 !! end
11744
11745 !! test
11746 Section extraction test (section 9)
11747 !! options
11748 section=9
11749 !! input
11750 start
11751 ==a==
11752 ===aa===
11753 ====aaa====
11754 ==b==
11755 ===ba===
11756 ===bb===
11757 ====bba====
11758 ===bc===
11759 ==c==
11760 ===ca===
11761 !! result
11762 ==c==
11763 ===ca===
11764 !! end
11765
11766 !! test
11767 Section extraction test (section 10)
11768 !! options
11769 section=10
11770 !! input
11771 start
11772 ==a==
11773 ===aa===
11774 ====aaa====
11775 ==b==
11776 ===ba===
11777 ===bb===
11778 ====bba====
11779 ===bc===
11780 ==c==
11781 ===ca===
11782 !! result
11783 ===ca===
11784 !! end
11785
11786 !! test
11787 Section extraction test (nonexistent section 11)
11788 !! options
11789 section=11
11790 !! input
11791 start
11792 ==a==
11793 ===aa===
11794 ====aaa====
11795 ==b==
11796 ===ba===
11797 ===bb===
11798 ====bba====
11799 ===bc===
11800 ==c==
11801 ===ca===
11802 !! result
11803 !! end
11804
11805 !! test
11806 Section extraction test with bogus heading (section 1)
11807 !! options
11808 section=1
11809 !! input
11810 ==a==
11811 ==bogus== not a legal section
11812 ==b==
11813 !! result
11814 ==a==
11815 ==bogus== not a legal section
11816 !! end
11817
11818 !! test
11819 Section extraction test with bogus heading (section 2)
11820 !! options
11821 section=2
11822 !! input
11823 ==a==
11824 ==bogus== not a legal section
11825 ==b==
11826 !! result
11827 ==b==
11828 !! end
11829
11830 !! test
11831 Section extraction test with comment after heading (section 1)
11832 !! options
11833 section=1
11834 !! input
11835 ==a==
11836 ==b== <!-- -->
11837 ==c==
11838 !! result
11839 ==a==
11840 !! end
11841
11842 !! test
11843 Section extraction test with comment after heading (section 2)
11844 !! options
11845 section=2
11846 !! input
11847 ==a==
11848 ==b== <!-- -->
11849 ==c==
11850 !! result
11851 ==b== <!-- -->
11852 !! end
11853
11854 !! test
11855 Section extraction test with bogus <nowiki> heading (section 1)
11856 !! options
11857 section=1
11858 !! input
11859 ==a==
11860 ==bogus== <nowiki>not a legal section</nowiki>
11861 ==b==
11862 !! result
11863 ==a==
11864 ==bogus== <nowiki>not a legal section</nowiki>
11865 !! end
11866
11867 !! test
11868 Section extraction test with bogus <nowiki> heading (section 2)
11869 !! options
11870 section=2
11871 !! input
11872 ==a==
11873 ==bogus== <nowiki>not a legal section</nowiki>
11874 ==b==
11875 !! result
11876 ==b==
11877 !! end
11878
11879
11880 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11881 # instead of respecting commented sections
11882 !! test
11883 Section extraction prefixed by comment (section 1)
11884 !! options
11885 section=1
11886 !! input
11887 <!-- -->==sec1==
11888 ==sec2==
11889 !!result
11890 ==sec2==
11891 !!end
11892
11893 !! test
11894 Section extraction prefixed by comment (section 2)
11895 !! options
11896 section=2
11897 !! input
11898 <!-- -->==sec1==
11899 ==sec2==
11900 !!result
11901
11902 !!end
11903
11904
11905 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11906 # instead of respecting HTML-style headings
11907 !! test
11908 Section extraction, mixed wiki and html (section 1)
11909 !! options
11910 section=1
11911 !! input
11912 <h2>unmarked</h2>
11913 unmarked
11914 ==1==
11915 one
11916 ==2==
11917 two
11918 !! result
11919 ==1==
11920 one
11921 !! end
11922
11923 !! test
11924 Section extraction, mixed wiki and html (section 2)
11925 !! options
11926 section=2
11927 !! input
11928 <h2>unmarked</h2>
11929 unmarked
11930 ==1==
11931 one
11932 ==2==
11933 two
11934 !! result
11935 ==2==
11936 two
11937 !! end
11938
11939
11940 # Formerly testing for bug 3342
11941 !! test
11942 Section extraction, heading surrounded by <noinclude>
11943 !! options
11944 section=1
11945 !! input
11946 <noinclude>==unmarked==</noinclude>
11947 ==marked==
11948 !! result
11949 ==marked==
11950 !!end
11951
11952 # Test behavior of bug 19910
11953 !! test
11954 Sectiion with all-equals
11955 !! options
11956 section=2
11957 !! input
11958 ===
11959 The line above must have a trailing space
11960 === <!--
11961 --> <!-- -->
11962 But just in case it doesn't...
11963 !! result
11964 === <!--
11965 --> <!-- -->
11966 But just in case it doesn't...
11967 !! end
11968
11969 !! test
11970 Section replacement test (section 0)
11971 !! options
11972 replace=0,"xxx"
11973 !! input
11974 start
11975 ==a==
11976 ===aa===
11977 ====aaa====
11978 ==b==
11979 ===ba===
11980 ===bb===
11981 ====bba====
11982 ===bc===
11983 ==c==
11984 ===ca===
11985 !! result
11986 xxx
11987
11988 ==a==
11989 ===aa===
11990 ====aaa====
11991 ==b==
11992 ===ba===
11993 ===bb===
11994 ====bba====
11995 ===bc===
11996 ==c==
11997 ===ca===
11998 !! end
11999
12000 !! test
12001 Section replacement test (section 1)
12002 !! options
12003 replace=1,"xxx"
12004 !! input
12005 start
12006 ==a==
12007 ===aa===
12008 ====aaa====
12009 ==b==
12010 ===ba===
12011 ===bb===
12012 ====bba====
12013 ===bc===
12014 ==c==
12015 ===ca===
12016 !! result
12017 start
12018 xxx
12019
12020 ==b==
12021 ===ba===
12022 ===bb===
12023 ====bba====
12024 ===bc===
12025 ==c==
12026 ===ca===
12027 !! end
12028
12029 !! test
12030 Section replacement test (section 2)
12031 !! options
12032 replace=2,"xxx"
12033 !! input
12034 start
12035 ==a==
12036 ===aa===
12037 ====aaa====
12038 ==b==
12039 ===ba===
12040 ===bb===
12041 ====bba====
12042 ===bc===
12043 ==c==
12044 ===ca===
12045 !! result
12046 start
12047 ==a==
12048 xxx
12049
12050 ==b==
12051 ===ba===
12052 ===bb===
12053 ====bba====
12054 ===bc===
12055 ==c==
12056 ===ca===
12057 !! end
12058
12059 !! test
12060 Section replacement test (section 3)
12061 !! options
12062 replace=3,"xxx"
12063 !! input
12064 start
12065 ==a==
12066 ===aa===
12067 ====aaa====
12068 ==b==
12069 ===ba===
12070 ===bb===
12071 ====bba====
12072 ===bc===
12073 ==c==
12074 ===ca===
12075 !! result
12076 start
12077 ==a==
12078 ===aa===
12079 xxx
12080
12081 ==b==
12082 ===ba===
12083 ===bb===
12084 ====bba====
12085 ===bc===
12086 ==c==
12087 ===ca===
12088 !! end
12089
12090 !! test
12091 Section replacement test (section 4)
12092 !! options
12093 replace=4,"xxx"
12094 !! input
12095 start
12096 ==a==
12097 ===aa===
12098 ====aaa====
12099 ==b==
12100 ===ba===
12101 ===bb===
12102 ====bba====
12103 ===bc===
12104 ==c==
12105 ===ca===
12106 !! result
12107 start
12108 ==a==
12109 ===aa===
12110 ====aaa====
12111 xxx
12112
12113 ==c==
12114 ===ca===
12115 !! end
12116
12117 !! test
12118 Section replacement test (section 5)
12119 !! options
12120 replace=5,"xxx"
12121 !! input
12122 start
12123 ==a==
12124 ===aa===
12125 ====aaa====
12126 ==b==
12127 ===ba===
12128 ===bb===
12129 ====bba====
12130 ===bc===
12131 ==c==
12132 ===ca===
12133 !! result
12134 start
12135 ==a==
12136 ===aa===
12137 ====aaa====
12138 ==b==
12139 xxx
12140
12141 ===bb===
12142 ====bba====
12143 ===bc===
12144 ==c==
12145 ===ca===
12146 !! end
12147
12148 !! test
12149 Section replacement test (section 6)
12150 !! options
12151 replace=6,"xxx"
12152 !! input
12153 start
12154 ==a==
12155 ===aa===
12156 ====aaa====
12157 ==b==
12158 ===ba===
12159 ===bb===
12160 ====bba====
12161 ===bc===
12162 ==c==
12163 ===ca===
12164 !! result
12165 start
12166 ==a==
12167 ===aa===
12168 ====aaa====
12169 ==b==
12170 ===ba===
12171 xxx
12172
12173 ===bc===
12174 ==c==
12175 ===ca===
12176 !! end
12177
12178 !! test
12179 Section replacement test (section 7)
12180 !! options
12181 replace=7,"xxx"
12182 !! input
12183 start
12184 ==a==
12185 ===aa===
12186 ====aaa====
12187 ==b==
12188 ===ba===
12189 ===bb===
12190 ====bba====
12191 ===bc===
12192 ==c==
12193 ===ca===
12194 !! result
12195 start
12196 ==a==
12197 ===aa===
12198 ====aaa====
12199 ==b==
12200 ===ba===
12201 ===bb===
12202 xxx
12203
12204 ===bc===
12205 ==c==
12206 ===ca===
12207 !! end
12208
12209 !! test
12210 Section replacement test (section 8)
12211 !! options
12212 replace=8,"xxx"
12213 !! input
12214 start
12215 ==a==
12216 ===aa===
12217 ====aaa====
12218 ==b==
12219 ===ba===
12220 ===bb===
12221 ====bba====
12222 ===bc===
12223 ==c==
12224 ===ca===
12225 !! result
12226 start
12227 ==a==
12228 ===aa===
12229 ====aaa====
12230 ==b==
12231 ===ba===
12232 ===bb===
12233 ====bba====
12234 xxx
12235
12236 ==c==
12237 ===ca===
12238 !!end
12239
12240 !! test
12241 Section replacement test (section 9)
12242 !! options
12243 replace=9,"xxx"
12244 !! input
12245 start
12246 ==a==
12247 ===aa===
12248 ====aaa====
12249 ==b==
12250 ===ba===
12251 ===bb===
12252 ====bba====
12253 ===bc===
12254 ==c==
12255 ===ca===
12256 !! result
12257 start
12258 ==a==
12259 ===aa===
12260 ====aaa====
12261 ==b==
12262 ===ba===
12263 ===bb===
12264 ====bba====
12265 ===bc===
12266 xxx
12267 !! end
12268
12269 !! test
12270 Section replacement test (section 10)
12271 !! options
12272 replace=10,"xxx"
12273 !! input
12274 start
12275 ==a==
12276 ===aa===
12277 ====aaa====
12278 ==b==
12279 ===ba===
12280 ===bb===
12281 ====bba====
12282 ===bc===
12283 ==c==
12284 ===ca===
12285 !! result
12286 start
12287 ==a==
12288 ===aa===
12289 ====aaa====
12290 ==b==
12291 ===ba===
12292 ===bb===
12293 ====bba====
12294 ===bc===
12295 ==c==
12296 xxx
12297 !! end
12298
12299 !! test
12300 Section replacement test with initial whitespace (bug 13728)
12301 !! options
12302 replace=2,"xxx"
12303 !! input
12304 Preformatted initial line
12305 ==a==
12306 ===a===
12307 !! result
12308 Preformatted initial line
12309 ==a==
12310 xxx
12311 !! end
12312
12313
12314 !! test
12315 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12316 !! options
12317 section=1
12318 !! input
12319 ==a==
12320 a
12321 !! result
12322 ==a==
12323 a
12324 !! end
12325
12326 !! test
12327 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12328 !! options
12329 section=1
12330 !! input
12331 ==a==
12332 a
12333 !! result
12334 ==a==
12335 a
12336 !! end
12337
12338
12339 !! test
12340 Section extraction, <pre> around bogus header (bug 10309)
12341 !! options
12342 noxml section=2
12343 !! input
12344 == Section One ==
12345 <pre>
12346 =======
12347 </pre>
12348
12349 == Section Two ==
12350 stuff
12351 !! result
12352 == Section Two ==
12353 stuff
12354 !! end
12355
12356 !! test
12357 Section replacement, <pre> around bogus header (bug 10309)
12358 !! options
12359 noxml replace=2,"xxx"
12360 !! input
12361 == Section One ==
12362 <pre>
12363 =======
12364 </pre>
12365
12366 == Section Two ==
12367 stuff
12368 !! result
12369 == Section One ==
12370 <pre>
12371 =======
12372 </pre>
12373
12374 xxx
12375 !! end
12376
12377
12378
12379 !! test
12380 Handling of &#x0A; in URLs
12381 !! input
12382 **irc://&#x0A;a
12383 !! result
12384 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12385 </li></ul>
12386 </li></ul>
12387
12388 !!end
12389
12390 !! test
12391 5 quotes, code coverage +1 line (php)
12392 !! options
12393 php
12394 !! input
12395 '''''
12396 !! result
12397 !! end
12398 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12399 !! test
12400 5 quotes, code coverage +1 line (parsoid)
12401 !! options
12402 parsoid
12403 !! input
12404 '''''
12405 !! result
12406 <p><i><b></b></i></p>
12407 !! end
12408
12409 !! test
12410 Special:Search page linking.
12411 !! input
12412 {{Special:search}}
12413 !! result
12414 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12415 </p>
12416 !! end
12417
12418 !! test
12419 Say the magic word
12420 !! options
12421 title=[[Parser test]]
12422 !! input
12423 * {{PAGENAME}}
12424 * {{PAGENAMEE}}
12425 * {{FULLPAGENAME}}
12426 * {{FULLPAGENAMEE}}
12427 * {{BASEPAGENAME}}
12428 * {{BASEPAGENAMEE}}
12429 * {{SUBPAGENAME}}
12430 * {{SUBPAGENAMEE}}
12431 * {{ROOTPAGENAME}}
12432 * {{ROOTPAGENAMEE}}
12433 * {{TALKPAGENAME}}
12434 * {{TALKPAGENAMEE}}
12435 * {{SUBJECTPAGENAME}}
12436 * {{SUBJECTPAGENAMEE}}
12437 * {{NAMESPACEE}}
12438 * {{NAMESPACE}}
12439 * {{NAMESPACENUMBER}}
12440 * {{TALKSPACE}}
12441 * {{TALKSPACEE}}
12442 * {{SUBJECTSPACE}}
12443 * {{SUBJECTSPACEE}}
12444 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12445 !! result
12446 <ul><li> Parser test
12447 </li><li> Parser_test
12448 </li><li> Parser test
12449 </li><li> Parser_test
12450 </li><li> Parser test
12451 </li><li> Parser_test
12452 </li><li> Parser test
12453 </li><li> Parser_test
12454 </li><li> Parser test
12455 </li><li> Parser_test
12456 </li><li> Talk:Parser test
12457 </li><li> Talk:Parser_test
12458 </li><li> Parser test
12459 </li><li> Parser_test
12460 </li><li>
12461 </li><li>
12462 </li><li> 0
12463 </li><li> Talk
12464 </li><li> Talk
12465 </li><li>
12466 </li><li>
12467 </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>
12468 </li></ul>
12469
12470 !! end
12471 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12472
12473 !! test
12474 Gallery
12475 !! input
12476 <gallery>
12477 image1.png |
12478 image2.gif|||||
12479
12480 image3|
12481 image4 |300px| centre
12482 image5.svg| http://///////
12483 [[x|xx]]]]
12484 * image6
12485 </gallery>
12486 !! result
12487 <ul class="gallery">
12488 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12489 <div style="height: 150px;">Image1.png</div>
12490 <div class="gallerytext">
12491 </div>
12492 </div></li>
12493 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12494 <div style="height: 150px;">Image2.gif</div>
12495 <div class="gallerytext">
12496 <p>||||
12497 </p>
12498 </div>
12499 </div></li>
12500 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12501 <div style="height: 150px;">Image3</div>
12502 <div class="gallerytext">
12503 </div>
12504 </div></li>
12505 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12506 <div style="height: 150px;">Image4</div>
12507 <div class="gallerytext">
12508 <p>300px| centre
12509 </p>
12510 </div>
12511 </div></li>
12512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12513 <div style="height: 150px;">Image5.svg</div>
12514 <div class="gallerytext">
12515 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12516 </p>
12517 </div>
12518 </div></li>
12519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12520 <div style="height: 150px;">* image6</div>
12521 <div class="gallerytext">
12522 </div>
12523 </div></li>
12524 </ul>
12525
12526 !! end
12527
12528 !! test
12529 Gallery (with options)
12530 !! input
12531 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12532 File:Nonexistant.jpg|caption
12533 File:Nonexistant.jpg
12534 image:foobar.jpg|some '''caption''' [[Main Page]]
12535 image:foobar.jpg
12536 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12537 </gallery>
12538 !! result
12539 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12540 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></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 <p>caption
12545 </p>
12546 </div>
12547 </div></li>
12548 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12549 <div style="height: 70px;">Nonexistant.jpg</div>
12550 <div class="gallerytext">
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="" 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 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12557 </p>
12558 </div>
12559 </div></li>
12560 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12561 <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>
12562 <div class="gallerytext">
12563 </div>
12564 </div></li>
12565 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12566 <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>
12567 <div class="gallerytext">
12568 <p>Blabla|blabla.
12569 </p>
12570 </div>
12571 </div></li>
12572 </ul>
12573
12574 !! end
12575
12576 !! test
12577 Gallery with wikitext inside caption
12578 !! input
12579 <gallery>
12580 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12581 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12582 </gallery>
12583 !! result
12584 <ul class="gallery">
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><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>
12589 </p>
12590 </div>
12591 </div></li>
12592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12593 <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>
12594 <div class="gallerytext">
12595 <p>This is a test template
12596 </p>
12597 </div>
12598 </div></li>
12599 </ul>
12600
12601 !! end
12602
12603 !! test
12604 gallery (with showfilename option)
12605 !! input
12606 <gallery showfilename>
12607 File:Nonexistant.jpg|caption
12608 File:Nonexistant.jpg
12609 image:foobar.jpg|some '''caption''' [[Main Page]]
12610 File:Foobar.jpg
12611 </gallery>
12612 !! result
12613 <ul class="gallery">
12614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12615 <div style="height: 150px;">Nonexistant.jpg</div>
12616 <div class="gallerytext">
12617 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12618 caption
12619 </p>
12620 </div>
12621 </div></li>
12622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12623 <div style="height: 150px;">Nonexistant.jpg</div>
12624 <div class="gallerytext">
12625 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12626 </p>
12627 </div>
12628 </div></li>
12629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12630 <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>
12631 <div class="gallerytext">
12632 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12633 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12634 </p>
12635 </div>
12636 </div></li>
12637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12638 <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>
12639 <div class="gallerytext">
12640 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12641 </p>
12642 </div>
12643 </div></li>
12644 </ul>
12645
12646 !! end
12647
12648 !! test
12649 Gallery (with namespace-less filenames)
12650 !! input
12651 <gallery>
12652 File:Nonexistant.jpg
12653 Nonexistant.jpg
12654 image:foobar.jpg
12655 foobar.jpg
12656 </gallery>
12657 !! result
12658 <ul class="gallery">
12659 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12660 <div style="height: 150px;">Nonexistant.jpg</div>
12661 <div class="gallerytext">
12662 </div>
12663 </div></li>
12664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12665 <div style="height: 150px;">Nonexistant.jpg</div>
12666 <div class="gallerytext">
12667 </div>
12668 </div></li>
12669 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12670 <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>
12671 <div class="gallerytext">
12672 </div>
12673 </div></li>
12674 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12675 <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>
12676 <div class="gallerytext">
12677 </div>
12678 </div></li>
12679 </ul>
12680
12681 !! end
12682
12683 !! test
12684 HTML Hex character encoding (spells the word "JavaScript")
12685 !! input
12686 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12687 !! result
12688 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12689 </p>
12690 !! end
12691
12692 !! test
12693 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12694 !! input
12695 &#xsee;&#XSEE;
12696 !! result
12697 <p>&amp;#xsee;&amp;#XSEE;
12698 </p>
12699 !! end
12700
12701 !! test
12702 HTML Hex character encoding mixed case
12703 !! input
12704 &#xEE;&#Xee;
12705 !! result
12706 <p>&#xee;&#xee;
12707 </p>
12708 !! end
12709
12710 !! test
12711 __FORCETOC__ override
12712 !! input
12713 __NEWSECTIONLINK__
12714 __FORCETOC__
12715 !! result
12716 <p><br />
12717 </p>
12718 !! end
12719
12720 !! test
12721 ISBN code coverage
12722 !! input
12723 ISBN 978-0-1234-56&#x20;789
12724 !! result
12725 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12726 </p>
12727 !! end
12728
12729 !! test
12730 ISBN followed by 5 spaces
12731 !! input
12732 ISBN
12733 !! result
12734 <p>ISBN
12735 </p>
12736 !! end
12737
12738 !! test
12739 Double ISBN
12740 !! input
12741 ISBN ISBN 1234567890
12742 !! result
12743 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12744 </p>
12745 !! end
12746
12747 !! test
12748 Bug 22905: <abbr> followed by ISBN followed by </a>
12749 !! input
12750 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12751 !! result
12752 <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>
12753 </p>
12754 !! end
12755
12756 !! test
12757 Double RFC
12758 !! input
12759 RFC RFC 1234
12760 !! result
12761 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12762 </p>
12763 !! end
12764
12765 !! test
12766 Double RFC with a wiki link
12767 !! input
12768 RFC [[RFC 1234]]
12769 !! result
12770 <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>
12771 </p>
12772 !! end
12773
12774 !! test
12775 RFC code coverage
12776 !! input
12777 RFC 983&#x20;987
12778 !! result
12779 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12780 </p>
12781 !! end
12782
12783 !! test
12784 Centre-aligned image
12785 !! input
12786 [[Image:foobar.jpg|centre]]
12787 !! result
12788 <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>
12789
12790 !!end
12791
12792 !! test
12793 None-aligned image
12794 !! input
12795 [[Image:foobar.jpg|none]]
12796 !! result
12797 <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>
12798
12799 !!end
12800
12801 !! test
12802 Width + Height sized image (using px) (height is ignored)
12803 !! input
12804 [[Image:foobar.jpg|640x480px]]
12805 !! result
12806 <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>
12807 </p>
12808 !!end
12809
12810 !! test
12811 Width-sized image (using px, no following whitespace)
12812 !! input
12813 [[Image:foobar.jpg|640px]]
12814 !! result
12815 <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>
12816 </p>
12817 !!end
12818
12819 !! test
12820 Width-sized image (using px, with following whitespace - test regression from r39467)
12821 !! input
12822 [[Image:foobar.jpg|640px ]]
12823 !! result
12824 <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>
12825 </p>
12826 !!end
12827
12828 !! test
12829 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12830 !! input
12831 [[Image:foobar.jpg| 640px]]
12832 !! result
12833 <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>
12834 </p>
12835 !!end
12836
12837 !! test
12838 Another italics / bold test
12839 !! input
12840 ''' ''x'
12841 !! result
12842 <pre>'<i> </i>x'
12843 </pre>
12844 !!end
12845
12846 # Note the results may be incorrect, as parserTest output included this:
12847 # XML error: Mismatched tag at byte 6120:
12848 # ...<dd> </dt></dl> </dd...
12849 !! test
12850 dt/dd/dl test
12851 !! options
12852 disabled
12853 !! input
12854 :;;;::
12855 !! result
12856 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12857 </dd></dl>
12858 </dd></dl>
12859 </dt></dl>
12860 </dt></dl>
12861 </dt></dl>
12862 </dd></dl>
12863
12864 !!end
12865
12866
12867 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12868 !! test
12869 Images with the "|" character in the comment
12870 !! input
12871 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12872 !! result
12873 <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>
12874
12875 !!end
12876
12877 !! test
12878 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12879 !! input
12880 <html><script>alert(1);</script></html>
12881 !! result
12882 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12883 </p>
12884 !! end
12885
12886 !! test
12887 HTML with raw HTML ($wgRawHtml==true)
12888 !! options
12889 wgRawHtml=1
12890 !! input
12891 <html><script>alert(1);</script></html>
12892 !! result
12893 <p><script>alert(1);</script>
12894 </p>
12895 !! end
12896
12897 !! test
12898 Parents of subpages, one level up
12899 !! options
12900 subpage title=[[Subpage test/L1/L2/L3]]
12901 !! input
12902 [[../|L2]]
12903 !! result
12904 <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>
12905 </p>
12906 !! end
12907
12908
12909 !! test
12910 Parents of subpages, one level up, not named
12911 !! options
12912 subpage title=[[Subpage test/L1/L2/L3]]
12913 !! input
12914 [[../]]
12915 !! result
12916 <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>
12917 </p>
12918 !! end
12919
12920
12921
12922 !! test
12923 Parents of subpages, two levels up
12924 !! options
12925 subpage title=[[Subpage test/L1/L2/L3]]
12926 !! input
12927 [[../../|L1]]2
12928
12929 [[../../|L1]]l
12930 !! result
12931 <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
12932 </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>
12933 </p>
12934 !! end
12935
12936 !! test
12937 Parents of subpages, two levels up, without trailing slash or name.
12938 !! options
12939 subpage title=[[Subpage test/L1/L2/L3]]
12940 !! input
12941 [[../..]]
12942 !! result
12943 <p>[[../..]]
12944 </p>
12945 !! end
12946
12947 !! test
12948 Parents of subpages, two levels up, with lots of extra trailing slashes.
12949 !! options
12950 subpage title=[[Subpage test/L1/L2/L3]]
12951 !! input
12952 [[../../////]]
12953 !! result
12954 <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>
12955 </p>
12956 !! end
12957
12958 !! article
12959 Subpage test/L1/L2/L3Sibling
12960 !! text
12961 Sibling article
12962 !! endarticle
12963
12964 !! test
12965 Transclusion of a sibling page (one level up)
12966 !! options
12967 subpage title=[[Subpage test/L1/L2/L3]]
12968 !! input
12969 {{../L3Sibling}}
12970 !! result
12971 <p>Sibling article
12972 </p>
12973 !! end
12974
12975 !! test
12976 Transclusion of a child page
12977 !! options
12978 subpage title=[[Subpage test/L1/L2]]
12979 !! input
12980 {{/L3Sibling}}
12981 !! result
12982 <p>Sibling article
12983 </p>
12984 !! end
12985
12986 !! test
12987 Non-transclusion because of too many up levels
12988 !! options
12989 subpage title=[[Subpage test/L1/L2/L3]]
12990 !! input
12991 {{../../../../More than parent}}
12992 !! result
12993 <p>{{../../../../More than parent}}
12994 </p>
12995 !! end
12996
12997 !! test
12998 Definition list code coverage
12999 !! input
13000 ; title : def
13001 ; title : def
13002 ;title: def
13003 !! result
13004 <dl><dt> title &#160;</dt><dd> def
13005 </dd><dt> title&#160;</dt><dd> def
13006 </dd><dt>title</dt><dd> def
13007 </dd></dl>
13008
13009 !! end
13010
13011 !! test
13012 Don't fall for the self-closing div
13013 !! input
13014 <div>hello world</div/>
13015 !! result
13016 <div>hello world</div>
13017
13018 !! end
13019
13020 !! test
13021 MSGNW magic word
13022 !! input
13023 {{MSGNW:msg}}
13024 !! result
13025 <p>&#91;&#91;:Template:Msg&#93;&#93;
13026 </p>
13027 !! end
13028
13029 !! test
13030 RAW magic word
13031 !! input
13032 {{RAW:QUERTY}}
13033 !! result
13034 <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>
13035 </p>
13036 !! end
13037
13038 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13039 !! test
13040 Always escape literal '>' in output, not just after '<'
13041 !! input
13042 ><>
13043 !! result
13044 <p>&gt;&lt;&gt;
13045 </p>
13046 !! end
13047
13048 !! test
13049 Template caching
13050 !! input
13051 {{Test}}
13052 {{Test}}
13053 !! result
13054 <p>This is a test template
13055 This is a test template
13056 </p>
13057 !! end
13058
13059
13060 !! article
13061 MediaWiki:Fake
13062 !! text
13063 ==header==
13064 !! endarticle
13065
13066 !! test
13067 Inclusion of !userCanEdit() content
13068 !! input
13069 {{MediaWiki:Fake}}
13070 !! result
13071 <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>
13072
13073 !! end
13074
13075
13076 !! test
13077 Out-of-order TOC heading levels
13078 !! input
13079 ==2==
13080 ======6======
13081 ===3===
13082 =1=
13083 =====5=====
13084 ==2==
13085 !! result
13086 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13087 <ul>
13088 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13089 <ul>
13090 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13091 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13092 </ul>
13093 </li>
13094 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13095 <ul>
13096 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13097 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13098 </ul>
13099 </li>
13100 </ul>
13101 </div>
13102 <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>
13103 <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>
13104 <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>
13105 <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>
13106 <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>
13107 <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>
13108
13109 !! end
13110
13111
13112 !! test
13113 ISBN with a dummy number
13114 !! input
13115 ISBN ---
13116 !! result
13117 <p>ISBN ---
13118 </p>
13119 !! end
13120
13121
13122 !! test
13123 ISBN with space-delimited number
13124 !! input
13125 ISBN 92 9017 032 8
13126 !! result
13127 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13128 </p>
13129 !! end
13130
13131
13132 !! test
13133 ISBN with multiple spaces, no number
13134 !! input
13135 ISBN foo
13136 !! result
13137 <p>ISBN foo
13138 </p>
13139 !! end
13140
13141
13142 !! test
13143 ISBN length
13144 !! input
13145 ISBN 123456789
13146
13147 ISBN 1234567890
13148
13149 ISBN 12345678901
13150 !! result
13151 <p>ISBN 123456789
13152 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13153 </p><p>ISBN 12345678901
13154 </p>
13155 !! end
13156
13157
13158 !! test
13159 ISBN with trailing year (bug 8110)
13160 !! input
13161 ISBN 1-234-56789-0 - 2006
13162
13163 ISBN 1 234 56789 0 - 2006
13164 !! result
13165 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13166 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13167 </p>
13168 !! end
13169
13170
13171 !! test
13172 anchorencode
13173 !! input
13174 {{anchorencode:foo bar©#%n}}
13175 !! result
13176 <p>foo_bar.C2.A9.23.25n
13177 </p>
13178 !! end
13179
13180 !! test
13181 anchorencode trims spaces
13182 !! input
13183 {{anchorencode: __pretty__please__}}
13184 !! result
13185 <p>pretty_please
13186 </p>
13187 !! end
13188
13189 !! test
13190 anchorencode deals with links
13191 !! input
13192 {{anchorencode: [[hello|world]] [[hi]]}}
13193 !! result
13194 <p>world_hi
13195 </p>
13196 !! end
13197
13198 !! test
13199 anchorencode deals with templates
13200 !! input
13201 {{anchorencode: {{Foo}} }}
13202 !! result
13203 <p>FOO
13204 </p>
13205 !! end
13206
13207 !! test
13208 anchorencode encodes like the TOC generator: (bug 18431)
13209 !! input
13210 === _ +:.3A%3A&&amp;]] ===
13211 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13212 __NOEDITSECTION__
13213 !! result
13214 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13215 <p>.2B:.3A.253A.26.26.5D.5D
13216 </p>
13217 !! end
13218
13219 !! test
13220 Bug 6200: blockquotes and paragraph formatting
13221 !! input
13222 <blockquote>
13223 foo
13224 </blockquote>
13225
13226 bar
13227
13228 baz
13229 !! result
13230 <blockquote>
13231 <p>foo
13232 </p>
13233 </blockquote>
13234 <p>bar
13235 </p>
13236 <pre>baz
13237 </pre>
13238 !! end
13239
13240 !! test
13241 Bug 8293: Use of center tag ruins paragraph formatting
13242 !! input
13243 <center>
13244 foo
13245 </center>
13246
13247 bar
13248
13249 baz
13250 !! result
13251 <center>
13252 <p>foo
13253 </p>
13254 </center>
13255 <p>bar
13256 </p>
13257 <pre>baz
13258 </pre>
13259 !! end
13260
13261 !!test
13262 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13263 !!options
13264 php
13265 !!input
13266 <span><s>x</span></s>
13267 !!result
13268 <p><span><s>x&lt;/span&gt;</s></span>
13269 </p>
13270 !!end
13271
13272 !!test
13273 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13274 !!options
13275 parsoid
13276 !!input
13277 <span><s>x</span></s>
13278 !!result
13279 <p><span><s>x</s></span><s></s>
13280 </p>
13281 !!end
13282
13283 ###
13284 ### Language variants related tests
13285 ###
13286 !! test
13287 Self-link in language variants
13288 !! options
13289 title=[[Dunav]] language=sr
13290 !! input
13291 Both [[Dunav]] and [[Дунав]] are names for this river.
13292 !! result
13293 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13294 </p>
13295 !!end
13296
13297 !! article
13298 Дуна
13299 !! text
13300 content
13301 !! endarticle
13302
13303 !! test
13304 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13305 !! options
13306 title=[[Duna]] language=sr
13307 !! input
13308 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13309 !! result
13310 <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.
13311 </p>
13312 !! end
13313
13314 !! test
13315 Link to pages in language variants
13316 !! options
13317 language=sr
13318 !! input
13319 Main Page can be written as [[Маин Паге]]
13320 !! result
13321 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13322 </p>
13323 !!end
13324
13325
13326 !! test
13327 Multiple links to pages in language variants
13328 !! options
13329 language=sr
13330 !! input
13331 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13332 !! result
13333 <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>.
13334 </p>
13335 !!end
13336
13337
13338 !! test
13339 Simple template in language variants
13340 !! options
13341 language=sr
13342 !! input
13343 {{тест}}
13344 !! result
13345 <p>This is a test template
13346 </p>
13347 !! end
13348
13349
13350 !! test
13351 Template with explicit namespace in language variants
13352 !! options
13353 language=sr
13354 !! input
13355 {{Template:тест}}
13356 !! result
13357 <p>This is a test template
13358 </p>
13359 !! end
13360
13361
13362 !! test
13363 Basic test for template parameter in language variants
13364 !! options
13365 language=sr
13366 !! input
13367 {{парамтест|param=foo}}
13368 !! result
13369 <p>This is a test template with parameter foo
13370 </p>
13371 !! end
13372
13373
13374 !! test
13375 Simple category in language variants
13376 !! options
13377 language=sr cat
13378 !! input
13379 [[Category:МедиаWики Усер'с Гуиде]]
13380 !! result
13381 <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>
13382 !! end
13383
13384
13385 !! article
13386 Category:分类
13387 !! text
13388 blah
13389 !! endarticle
13390
13391 !! article
13392 Category:分類
13393 !! text
13394 blah
13395 !! endarticle
13396
13397 !! test
13398 Don't convert blue categorylinks to another variant (bug 33210)
13399 !! options
13400 language=zh cat
13401 !! input
13402 [[A]][[Category:分类]]
13403 !! result
13404 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13405 !! end
13406
13407
13408 !! test
13409 Stripping -{}- tags (language variants)
13410 !! options
13411 language=sr
13412 !! input
13413 Latin proverb: -{Ne nuntium necare}-
13414 !! result
13415 <p>Latin proverb: Ne nuntium necare
13416 </p>
13417 !! end
13418
13419
13420 !! test
13421 Prevent conversion with -{}- tags (language variants)
13422 !! options
13423 language=sr variant=sr-ec
13424 !! input
13425 Latinski: -{Ne nuntium necare}-
13426 !! result
13427 <p>Латински: Ne nuntium necare
13428 </p>
13429 !! end
13430
13431
13432 !! test
13433 Prevent conversion of text with -{}- tags (language variants)
13434 !! options
13435 language=sr variant=sr-ec
13436 !! input
13437 Latinski: -{Ne nuntium necare}-
13438 !! result
13439 <p>Латински: Ne nuntium necare
13440 </p>
13441 !! end
13442
13443
13444 !! test
13445 Prevent conversion of links with -{}- tags (language variants)
13446 !! options
13447 language=sr variant=sr-ec
13448 !! input
13449 -{[[Main Page]]}-
13450 !! result
13451 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13452 </p>
13453 !! end
13454
13455
13456 !! test
13457 -{}- tags within headlines (within html for parserConvert())
13458 !! options
13459 language=sr variant=sr-ec
13460 !! input
13461 == -{Naslov}- ==
13462 !! result
13463 <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>
13464
13465 !! end
13466
13467
13468 !! test
13469 Explicit definition of language variant alternatives
13470 !! options
13471 language=zh variant=zh-tw
13472 !! input
13473 -{zh:China;zh-tw:Taiwan}-, not China
13474 !! result
13475 <p>Taiwan, not China
13476 </p>
13477 !! end
13478
13479
13480 !! test
13481 Conversion around HTML tags
13482 !! options
13483 language=sr variant=sr-ec
13484 !! input
13485 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13486 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13487 !! result
13488 <p>
13489 <span title="ЛаCтин">ски</span>
13490 </p>
13491 !! end
13492
13493
13494 !! test
13495 Explicit session-wise language variant mapping (A flag and - flag)
13496 !! options
13497 language=zh variant=zh-tw
13498 !! input
13499 Taiwan is not China.
13500 But -{A|zh:China;zh-tw:Taiwan}- is China,
13501 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13502 and -{China}- is China.
13503 !! result
13504 <p>Taiwan is not China.
13505 But Taiwan is Taiwan,
13506 (This should be stripped!)
13507 and China is China.
13508 </p>
13509 !! end
13510
13511 !! test
13512 Explicit session-wise language variant mapping (H flag for hide)
13513 !! options
13514 language=zh variant=zh-tw
13515 !! input
13516 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13517 Taiwan is China.
13518 !! result
13519 <p>(This should be stripped!)
13520 Taiwan is Taiwan.
13521 </p>
13522 !! end
13523
13524 !! test
13525 Adding explicit conversion rule for title (T flag)
13526 !! options
13527 language=zh variant=zh-tw showtitle
13528 !! input
13529 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13530 !! result
13531 Taiwan
13532 <p>Should be stripped!
13533 </p>
13534 !! end
13535
13536 !! test
13537 Testing that changing the language variant here in the tests actually works
13538 !! options
13539 language=zh variant=zh showtitle
13540 !! input
13541 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13542 !! result
13543 China
13544 <p>Should be stripped!
13545 </p>
13546 !! end
13547
13548 !! test
13549 Recursive conversion of alt and title attrs shouldn't clear converter state
13550 !! options
13551 language=zh variant=zh-cn showtitle
13552 !! input
13553 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13554 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13555 !! result
13556 China
13557 <p>
13558 Should be stripped<span title="Exclamation">!</span>
13559 </p>
13560 !! end
13561
13562 !! test
13563 Bug 24072: more test on conversion rule for title
13564 !! options
13565 language=zh variant=zh-tw showtitle
13566 !! input
13567 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13568 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13569 !! result
13570 Taiwan
13571 <p>This should be stripped!
13572 This won't take interferes with the title rule.
13573 </p>
13574 !! end
13575
13576 !! test
13577 Partly disable title conversion if variant == main language code
13578 !! options
13579 language=zh variant=zh title=[[ZH]] showtitle
13580 !! input
13581 -{T|zh-cn:CN;zh-tw:TW}-
13582 !! result
13583 ZH
13584 <p>
13585 </p>
13586 !! end
13587
13588 !! test
13589 Partly disable title conversion if variant == main language code, more
13590 !! options
13591 language=zh variant=zh title=[[ZH]] showtitle
13592 !! input
13593 -{T|TW}-
13594 !! result
13595 ZH
13596 <p>
13597 </p>
13598 !! end
13599
13600 !! test
13601 Raw output of variant escape tags (R flag)
13602 !! options
13603 language=zh variant=zh-tw
13604 !! input
13605 Raw: -{R|zh:China;zh-tw:Taiwan}-
13606 !! result
13607 <p>Raw: zh:China;zh-tw:Taiwan
13608 </p>
13609 !! end
13610
13611 !! test
13612 Nested using of manual convert syntax
13613 !! options
13614 language=zh variant=zh-hk
13615 !! input
13616 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13617 !! result
13618 <p>Nested: Hello Hong Kong!
13619 </p>
13620 !! end
13621
13622 !! test
13623 Proper conversion of text in external links
13624 !! options
13625 language=sr variant=sr-ec
13626 !! input
13627 http://www.google.com
13628 gopher://www.google.com
13629 [http://www.google.com http://www.google.com]
13630 [gopher://www.google.com gopher://www.google.com]
13631 [https://www.google.com irc://www.google.com]
13632 [ftp://www.google.com www.google.com/ftp://dir]
13633 [//www.google.com www.google.com]
13634 !! result
13635 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13636 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13637 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13638 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13639 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13640 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13641 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13642 </p>
13643 !! end
13644
13645 !! test
13646 Do not convert roman numbers to language variants
13647 !! options
13648 language=sr variant=sr-ec
13649 !! input
13650 Fridrih IV je car.
13651 !! result
13652 <p>Фридрих IV је цар.
13653 </p>
13654 !! end
13655
13656 !! test
13657 Unclosed language converter markup "-{"
13658 !! options
13659 language=sr
13660 !! input
13661 -{T|hello
13662 !! result
13663 <p>-{T|hello
13664 </p>
13665 !! end
13666
13667 !! test
13668 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13669 !! options
13670 language=sr
13671 !! input
13672 -{R|=&gt;}-
13673 !! result
13674 <p>=&gt;
13675 </p>
13676 !!end
13677
13678 !!article
13679 Template:Bullet
13680 !!text
13681 * Bar
13682 !!endarticle
13683
13684 !! test
13685 Bug 529: Uncovered bullet
13686 !! input
13687 * Foo {{bullet}}
13688 !! result
13689 <ul><li> Foo
13690 </li><li> Bar
13691 </li></ul>
13692
13693 !! end
13694
13695 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13696 # Templates in Wikipedia rely on this behavior, as tidy has always been
13697 # enabled there. These tests are normally run *without* tidy, so specify the
13698 # full output here.
13699 # To test realistic parsing behavior, apply a tidy-like transformation to both
13700 # the expected output and your parser's output.
13701 !! test
13702 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13703 !! input
13704 ******* Foo {{bullet}}
13705 !! result
13706 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
13707 </li></ul>
13708 </li></ul>
13709 </li></ul>
13710 </li></ul>
13711 </li></ul>
13712 </li></ul>
13713 </li><li> Bar
13714 </li></ul>
13715
13716 !! end
13717
13718 !! test
13719 Bug 529: Uncovered table already at line-start
13720 !! input
13721 x
13722
13723 {{table}}
13724 y
13725 !! result
13726 <p>x
13727 </p>
13728 <table>
13729 <tr>
13730 <td> 1 </td>
13731 <td> 2
13732 </td></tr>
13733 <tr>
13734 <td> 3 </td>
13735 <td> 4
13736 </td></tr></table>
13737 <p>y
13738 </p>
13739 !! end
13740
13741 !! test
13742 Bug 529: Uncovered bullet in parser function result
13743 !! input
13744 * Foo {{lc:{{bullet}} }}
13745 !! result
13746 <ul><li> Foo
13747 </li><li> bar
13748 </li></ul>
13749
13750 !! end
13751
13752 !! test
13753 Bug 5678: Double-parsed template argument
13754 !! input
13755 {{lc:{{{1}}}|hello}}
13756 !! result
13757 <p>{{{1}}}
13758 </p>
13759 !! end
13760
13761 !! test
13762 Bug 5678: Double-parsed template invocation
13763 !! input
13764 {{lc:{{paramtest {{!}} param = hello }} }}
13765 !! result
13766 <p>{{paramtest | param = hello }}
13767 </p>
13768 !! end
13769
13770 !! test
13771 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13772 !! options
13773 language=cs
13774 title=[[Main Page]]
13775 !! input
13776 {{PRVNÍVELKÉ:ěščř}}
13777 {{prvnívelké:ěščř}}
13778 {{PRVNÍMALÉ:ěščř}}
13779 {{prvnímalé:ěščř}}
13780 {{MALÁ:ěščř}}
13781 {{malá:ěščř}}
13782 {{VELKÁ:ěščř}}
13783 {{velká:ěščř}}
13784 !! result
13785 <p>Ěščř
13786 Ěščř
13787 ěščř
13788 ěščř
13789 ěščř
13790 ěščř
13791 ĚŠČŘ
13792 ĚŠČŘ
13793 </p>
13794 !! end
13795
13796 !! test
13797 Morwen/13: Unclosed link followed by heading
13798 !! input
13799 [[link
13800 ==heading==
13801 !! result
13802 <p>[[link
13803 </p>
13804 <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>
13805
13806 !! end
13807
13808 !! test
13809 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13810 !! input
13811 {{foo|
13812 =heading=
13813 !! result
13814 <p>{{foo|
13815 </p>
13816 <h1><span class="mw-headline" id="heading">heading</span></h1>
13817
13818 !! end
13819
13820 !! test
13821 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13822 !! input
13823 {{foo|
13824 ==heading==
13825 !! result
13826 <p>{{foo|
13827 </p>
13828 <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>
13829
13830 !! end
13831
13832 !! test
13833 Tildes in comments
13834 !! options
13835 pst
13836 !! input
13837 <!-- ~~~~ -->
13838 !! result
13839 <!-- ~~~~ -->
13840 !! end
13841
13842 !! test
13843 Paragraphs inside divs (no extra line breaks)
13844 !! input
13845 <div>Line one
13846
13847 Line two</div>
13848 !! result
13849 <div>Line one
13850 Line two</div>
13851
13852 !! end
13853
13854 !! test
13855 Paragraphs inside divs (extra line break on open)
13856 !! input
13857 <div>
13858 Line one
13859
13860 Line two</div>
13861 !! result
13862 <div>
13863 <p>Line one
13864 </p>
13865 Line two</div>
13866
13867 !! end
13868
13869 !! test
13870 Paragraphs inside divs (extra line break on close)
13871 !! input
13872 <div>Line one
13873
13874 Line two
13875 </div>
13876 !! result
13877 <div>Line one
13878 <p>Line two
13879 </p>
13880 </div>
13881
13882 !! end
13883
13884 !! test
13885 Paragraphs inside divs (extra line break on open and close)
13886 !! input
13887 <div>
13888 Line one
13889
13890 Line two
13891 </div>
13892 !! result
13893 <div>
13894 <p>Line one
13895 </p><p>Line two
13896 </p>
13897 </div>
13898
13899 !! end
13900
13901 !! test
13902 Nesting tags, paragraphs on lines which begin with <div>
13903 !! options
13904 disabled
13905 !! input
13906 <div></div><strong>A
13907 B</strong>
13908 !! result
13909 <div></div>
13910 <p><strong>A
13911 B</strong>
13912 </p>
13913 !! end
13914
13915 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13916 !! test
13917 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13918 !! input
13919 <blockquote>Line one
13920
13921 Line two</blockquote>
13922 !! result
13923 <blockquote>Line one
13924 Line two</blockquote>
13925
13926 !! end
13927
13928 !! test
13929 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13930 !! input
13931 <blockquote>
13932 Line one
13933
13934 Line two</blockquote>
13935 !! result
13936 <blockquote>
13937 <p>Line one
13938 </p>
13939 Line two</blockquote>
13940
13941 !! end
13942
13943 !! test
13944 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13945 !! input
13946 <blockquote>Line one
13947
13948 Line two
13949 </blockquote>
13950 !! result
13951 <blockquote>Line one
13952 <p>Line two
13953 </p>
13954 </blockquote>
13955
13956 !! end
13957
13958 !! test
13959 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13960 !! input
13961 <blockquote>
13962 Line one
13963
13964 Line two
13965 </blockquote>
13966 !! result
13967 <blockquote>
13968 <p>Line one
13969 </p><p>Line two
13970 </p>
13971 </blockquote>
13972
13973 !! end
13974
13975 !! test
13976 Paragraphs inside blockquotes/divs (no extra line breaks)
13977 !! input
13978 <blockquote><div>Line one
13979
13980 Line two</div></blockquote>
13981 !! result
13982 <blockquote><div>Line one
13983 Line two</div></blockquote>
13984
13985 !! end
13986
13987 !! test
13988 Paragraphs inside blockquotes/divs (extra line break on open)
13989 !! input
13990 <blockquote><div>
13991 Line one
13992
13993 Line two</div></blockquote>
13994 !! result
13995 <blockquote><div>
13996 <p>Line one
13997 </p>
13998 Line two</div></blockquote>
13999
14000 !! end
14001
14002 !! test
14003 Paragraphs inside blockquotes/divs (extra line break on close)
14004 !! input
14005 <blockquote><div>Line one
14006
14007 Line two
14008 </div></blockquote>
14009 !! result
14010 <blockquote><div>Line one
14011 <p>Line two
14012 </p>
14013 </div></blockquote>
14014
14015 !! end
14016
14017 !! test
14018 Paragraphs inside blockquotes/divs (extra line break on open and close)
14019 !! input
14020 <blockquote><div>
14021 Line one
14022
14023 Line two
14024 </div></blockquote>
14025 !! result
14026 <blockquote><div>
14027 <p>Line one
14028 </p><p>Line two
14029 </p>
14030 </div></blockquote>
14031
14032 !! end
14033
14034 !! test
14035 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14036 !! options
14037 wgLinkHolderBatchSize=0
14038 !! input
14039 [[meatball:1]]
14040 [[meatball:2]]
14041 [[meatball:3]]
14042 !! result
14043 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14044 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14045 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14046 </p>
14047 !! end
14048
14049 !! test
14050 Free external link invading image caption
14051 !! input
14052 [[Image:Foobar.jpg|thumb|http://x|hello]]
14053 !! result
14054 <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>
14055
14056 !! end
14057
14058 !! test
14059 Bug 15196: localised external link numbers
14060 !! options
14061 language=fa
14062 !! input
14063 [http://en.wikipedia.org/]
14064 !! result
14065 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14066 </p>
14067 !! end
14068
14069 !! test
14070 Multibyte character in padleft
14071 !! input
14072 {{padleft:-Hello|7|Æ}}
14073 !! result
14074 <p>Æ-Hello
14075 </p>
14076 !! end
14077
14078 !! test
14079 Multibyte character in padright
14080 !! input
14081 {{padright:Hello-|7|Æ}}
14082 !! result
14083 <p>Hello-Æ
14084 </p>
14085 !! end
14086
14087 !!test
14088 formatdate parser function
14089 !!input
14090 {{#formatdate:2009-03-24}}
14091 !! result
14092 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14093 </p>
14094 !! end
14095
14096 !!test
14097 formatdate parser function, with default format
14098 !!input
14099 {{#formatdate:2009-03-24|mdy}}
14100 !! result
14101 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14102 </p>
14103 !! end
14104
14105 !! test
14106 Spacing of numbers in formatted dates
14107 !! input
14108 {{#formatdate:January 15}}
14109 !! result
14110 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14111 </p>
14112 !! end
14113
14114 !! test
14115 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
14116 !! options
14117 language=nl title=[[MediaWiki:Common.css]]
14118 !! input
14119 {{#formatdate:2009-03-24|dmy}}
14120 !! result
14121 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14122 </p>
14123 !! end
14124
14125 #
14126 #
14127 #
14128
14129 #
14130 # Edit comments
14131 #
14132
14133 !! test
14134 Edit comment with link
14135 !! options
14136 comment
14137 !! input
14138 I like the [[Main Page]] a lot
14139 !! result
14140 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14141 !!end
14142
14143 !! test
14144 Edit comment with link and link text
14145 !! options
14146 comment
14147 !! input
14148 I like the [[Main Page|best pages]] a lot
14149 !! result
14150 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14151 !!end
14152
14153 !! test
14154 Edit comment with link and link text with suffix
14155 !! options
14156 comment
14157 !! input
14158 I like the [[Main Page|best page]]s a lot
14159 !! result
14160 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14161 !!end
14162
14163 !! test
14164 Edit comment with section link (non-local, eg in history list)
14165 !! options
14166 comment title=[[Main Page]]
14167 !! input
14168 /* External links */ removed bogus entries
14169 !! result
14170 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14171 !!end
14172
14173 !! test
14174 Edit comment with section link and text before it (non-local, eg in history list)
14175 !! options
14176 comment title=[[Main Page]]
14177 !! input
14178 pre-comment text /* External links */ removed bogus entries
14179 !! result
14180 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>
14181 !!end
14182
14183 !! test
14184 Edit comment with section link (local, eg in diff view)
14185 !! options
14186 comment local title=[[Main Page]]
14187 !! input
14188 /* External links */ removed bogus entries
14189 !! result
14190 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14191 !!end
14192
14193 !! test
14194 Edit comment with subpage link (bug 14080)
14195 !! options
14196 comment
14197 subpage
14198 title=[[Subpage test]]
14199 !! input
14200 Poked at a [[/subpage]] here...
14201 !! result
14202 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14203 !!end
14204
14205 !! test
14206 Edit comment with subpage link and link text (bug 14080)
14207 !! options
14208 comment
14209 subpage
14210 title=[[Subpage test]]
14211 !! input
14212 Poked at a [[/subpage|neat little page]] here...
14213 !! result
14214 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14215 !!end
14216
14217 !! test
14218 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14219 !! options
14220 comment
14221 title=[[Subpage test]]
14222 !! input
14223 Poked at a [[/subpage]] here...
14224 !! result
14225 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...
14226 !!end
14227
14228 !! test
14229 Edit comment with bare anchor link (local, as on diff)
14230 !! options
14231 comment
14232 local
14233 title=[[Main Page]]
14234 !!input
14235 [[#section]]
14236 !! result
14237 <a href="#section">#section</a>
14238 !! end
14239
14240 !! test
14241 Edit comment with bare anchor link (non-local, as on history)
14242 !! options
14243 comment
14244 title=[[Main Page]]
14245 !!input
14246 [[#section]]
14247 !! result
14248 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14249 !! end
14250
14251 !! test
14252 Anchor starting with underscore
14253 !!input
14254 [[#_ref|One]]
14255 !! result
14256 <p><a href="#_ref">One</a>
14257 </p>
14258 !! end
14259
14260 !! test
14261 Id starting with underscore
14262 !!input
14263 <div id="_ref"></div>
14264 !! result
14265 <div id="_ref"></div>
14266
14267 !! end
14268
14269 !! test
14270 Space normalisation on autocomment (bug 22784)
14271 !! options
14272 comment
14273 title=[[Main Page]]
14274 !!input
14275 /* __hello__world__ */
14276 !! result
14277 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14278 !! end
14279
14280 !! test
14281 percent-encoding and + signs in comments (Bug 26410)
14282 !! options
14283 comment
14284 !!input
14285 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14286 !! result
14287 <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>
14288 !! end
14289
14290 !! test
14291 Bad images - basic functionality
14292 !! options
14293 disabled
14294 !! input
14295 [[File:Bad.jpg]]
14296 !! result
14297 !! end
14298
14299 !! test
14300 Bad images - bug 16039: text after bad image disappears
14301 !! options
14302 disabled
14303 !! input
14304 Foo bar
14305 [[File:Bad.jpg]]
14306 Bar foo
14307 !! result
14308 <p>Foo bar
14309 </p><p>Bar foo
14310 </p>
14311 !! end
14312
14313 !! test
14314 Verify that displaytitle works (bug #22501) no displaytitle
14315 !! options
14316 showtitle
14317 !! config
14318 wgAllowDisplayTitle=true
14319 wgRestrictDisplayTitle=false
14320 !! input
14321 this is not the the title
14322 !! result
14323 Parser test
14324 <p>this is not the the title
14325 </p>
14326 !! end
14327
14328 !! test
14329 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14330 !! options
14331 showtitle
14332 title=[[Screen]]
14333 !! config
14334 wgAllowDisplayTitle=true
14335 wgRestrictDisplayTitle=false
14336 !! input
14337 this is not the the title
14338 {{DISPLAYTITLE:whatever}}
14339 !! result
14340 whatever
14341 <p>this is not the the title
14342 </p>
14343 !! end
14344
14345 !! test
14346 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14347 !! options
14348 showtitle
14349 title=[[Screen]]
14350 !! config
14351 wgAllowDisplayTitle=true
14352 wgRestrictDisplayTitle=true
14353 !! input
14354 this is not the the title
14355 {{DISPLAYTITLE:whatever}}
14356 !! result
14357 Screen
14358 <p>this is not the the title
14359 </p>
14360 !! end
14361
14362 !! test
14363 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14364 !! options
14365 showtitle
14366 title=[[Screen]]
14367 !! config
14368 wgAllowDisplayTitle=true
14369 wgRestrictDisplayTitle=true
14370 !! input
14371 this is not the the title
14372 {{DISPLAYTITLE:screen}}
14373 !! result
14374 screen
14375 <p>this is not the the title
14376 </p>
14377 !! end
14378
14379 !! test
14380 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14381 !! options
14382 showtitle
14383 title=[[Screen]]
14384 !! config
14385 wgAllowDisplayTitle=false
14386 !! input
14387 this is not the the title
14388 {{DISPLAYTITLE:screen}}
14389 !! result
14390 Screen
14391 <p>this is not the the title
14392 <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>
14393 </p>
14394 !! end
14395
14396 !! test
14397 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14398 !! options
14399 showtitle
14400 title=[[Screen]]
14401 !! config
14402 wgAllowDisplayTitle=false
14403 !! input
14404 this is not the the title
14405 !! result
14406 Screen
14407 <p>this is not the the title
14408 </p>
14409 !! end
14410
14411 !! test
14412 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14413 !! options
14414 showtitle
14415 title=[[Screen]]
14416 !! config
14417 wgAllowDisplayTitle=true
14418 wgRestrictDisplayTitle=true
14419 !! input
14420 this is not the the title
14421 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14422 !! result
14423 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14424 <p>this is not the the title
14425 </p>
14426 !! end
14427
14428 !! test
14429 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14430 !! options
14431 showtitle
14432 title=[[Screen]]
14433 !! config
14434 wgAllowDisplayTitle=true
14435 wgRestrictDisplayTitle=true
14436 !! input
14437 this is not the the title
14438 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14439 !! result
14440 <span style="color: red;">s</span>creen
14441 <p>this is not the the title
14442 </p>
14443 !! end
14444
14445 !! test
14446 preload: check <noinclude> and <includeonly>
14447 !! options
14448 preload
14449 !! input
14450 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14451 !! result
14452 Hello kind world.
14453 !! end
14454
14455 !! test
14456 preload: check <onlyinclude>
14457 !! options
14458 preload
14459 !! input
14460 Goodbye <onlyinclude>Hello world</onlyinclude>
14461 !! result
14462 Hello world
14463 !! end
14464
14465 !! test
14466 preload: can pass tags through if we want to
14467 !! options
14468 preload
14469 !! input
14470 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14471 !! result
14472 <includeonly>Hello world</includeonly>
14473 !! end
14474
14475 !! test
14476 preload: check that it doesn't try to do tricks
14477 !! options
14478 preload
14479 !! input
14480 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14481 !! result
14482 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14483 !! end
14484
14485 !! test
14486 Play a bit with r67090 and bug 3158
14487 !! options
14488 disabled
14489 !! input
14490 <div style="width:50% !important">&nbsp;</div>
14491 <div style="width:50%&nbsp;!important">&nbsp;</div>
14492 <div style="width:50%&#160;!important">&nbsp;</div>
14493 <div style="border : solid;">&nbsp;</div>
14494 !! result
14495 <div style="width:50% !important">&nbsp;</div>
14496 <div style="width:50% !important">&nbsp;</div>
14497 <div style="width:50% !important">&nbsp;</div>
14498 <div style="border&#160;: solid;">&nbsp;</div>
14499
14500 !! end
14501
14502 !! test
14503 HTML5 data attributes
14504 !! input
14505 <span data-foo="bar">Baz</span>
14506 <p data-abc-def_hij="">Quuz</p>
14507 !! result
14508 <p><span data-foo="bar">Baz</span>
14509 </p>
14510 <p data-abc-def_hij="">Quuz</p>
14511
14512 !! end
14513
14514 !! test
14515 percent-encoding and + signs in internal links (Bug 26410)
14516 !! input
14517 [[User:+%]] [[Page+title%]]
14518 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14519 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14520 [[%33%45]] [[%33%45+]]
14521 !! result
14522 <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>
14523 <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>
14524 <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>
14525 <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>
14526 </p>
14527 !! end
14528
14529 !! test
14530 Special characters in embedded file links (bug 27679)
14531 !! input
14532 [[File:Contains & ampersand.jpg]]
14533 [[File:Does not exist.jpg|Title with & ampersand]]
14534 !! result
14535 <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>
14536 <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>
14537 </p>
14538 !! end
14539
14540
14541 !! test
14542 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14543 !! input
14544 Text&apos;s been normalized?
14545 !! result
14546 <p>Text&#39;s been normalized?
14547 </p>
14548 !! end
14549
14550 !! test
14551 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14552 !! input
14553 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14554 !! result
14555 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14556 </p>
14557 !! end
14558
14559 !! test
14560 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14561 !! input
14562 [http://www.example.org/ ideograms]
14563 !! result
14564 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14565 </p>
14566 !! end
14567
14568 !! test
14569 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14570 !! input
14571 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14572 !! result
14573 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14574 </p>
14575 !! end
14576
14577 !! article
14578 Mediawiki:loop1
14579 !! text
14580 {{Identical|A}}
14581 !! endarticle
14582
14583 !! article
14584 Mediawiki:loop2
14585 !! text
14586 {{Identical|B}}
14587 !! endarticle
14588
14589 !! article
14590 Template:Identical
14591 !! text
14592 {{int:loop1}}
14593 {{int:loop2}}
14594 !! endarticle
14595
14596 !! test
14597 Bug 31098 Template which includes system messages which includes the template
14598 !! input
14599 {{Identical}}
14600 !! result
14601 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14602 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14603 </p>
14604 !! end
14605
14606 !! test
14607 Bug31490 Turkish: ucfirst 'blah'
14608 !! options
14609 language=tr
14610 !! input
14611 {{ucfirst:blah}}
14612 !! result
14613 <p>Blah
14614 </p>
14615 !! end
14616
14617 !! test
14618 Bug31490 Turkish: ucfirst 'ix'
14619 !! options
14620 language=tr
14621 !! input
14622 {{ucfirst:ix}}
14623 !! result
14624 <p>İx
14625 </p>
14626 !! end
14627
14628 !! test
14629 Bug31490 Turkish: lcfirst 'BLAH'
14630 !! options
14631 language=tr
14632 !! input
14633 {{lcfirst:BLAH}}
14634 !! result
14635 <p>bLAH
14636 </p>
14637 !! end
14638
14639 !! test
14640 Bug31490 Turkish: ucfırst (with a dotless i)
14641 !! options
14642 language=tr
14643 !! input
14644 {{ucfırst:blah}}
14645 !! result
14646 <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>
14647 </p>
14648 !! end
14649
14650 !! test
14651 Bug31490 ucfırst (with a dotless i) with English language
14652 !! options
14653 language=en
14654 !! input
14655 {{ucfırst:blah}}
14656 !! result
14657 <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>
14658 </p>
14659 !! end
14660
14661 !! test
14662 Bug 26375: TOC with italics
14663 !! options
14664 title=[[Main Page]]
14665 !! input
14666 __TOC__
14667 == ''Lost'' episodes ==
14668 !! result
14669 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14670 <ul>
14671 <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>
14672 </ul>
14673 </div>
14674 <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>
14675
14676 !! end
14677
14678 !! test
14679 Bug 26375: TOC with bold
14680 !! options
14681 title=[[Main Page]]
14682 !! input
14683 __TOC__
14684 == '''should be bold''' then normal text ==
14685 !! result
14686 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14687 <ul>
14688 <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>
14689 </ul>
14690 </div>
14691 <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>
14692
14693 !! end
14694
14695 !! test
14696 Bug 33845: Headings become cursive in TOC when they contain an image
14697 !! options
14698 title=[[Main Page]]
14699 !! input
14700 __TOC__
14701 == Image [[Image:foobar.jpg]] ==
14702 !! result
14703 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14704 <ul>
14705 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14706 </ul>
14707 </div>
14708 <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>
14709
14710 !! end
14711
14712 !! test
14713 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14714 !! options
14715 title=[[Main Page]]
14716 !! input
14717 __TOC__
14718 == <blockquote>Quote</blockquote> ==
14719 !! result
14720 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14721 <ul>
14722 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14723 </ul>
14724 </div>
14725 <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>
14726
14727 !! end
14728
14729 !! test
14730 Unclosed tags in TOC
14731 !! options
14732 title=[[Main Page]]
14733 !! input
14734 __TOC__
14735 == Proof: 2 < 3 ==
14736 <small>Hanc marginis exiguitas non caperet.</small>
14737 QED
14738 !! result
14739 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14740 <ul>
14741 <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>
14742 </ul>
14743 </div>
14744 <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>
14745 <p><small>Hanc marginis exiguitas non caperet.</small>
14746 QED
14747 </p>
14748 !! end
14749
14750 !! test
14751 Multiple tags in TOC
14752 !! input
14753 __TOC__
14754 == <i>Foo</i> <b>Bar</b> ==
14755
14756 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14757 !! result
14758 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14759 <ul>
14760 <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>
14761 <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>
14762 </ul>
14763 </div>
14764 <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>
14765 <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>
14766
14767 !! end
14768
14769 !! test
14770 Tags with parameters in TOC
14771 !! input
14772 __TOC__
14773 == <sup class="in-h2">Hello</sup> ==
14774
14775 == <sup class="a > b">Evilbye</sup> ==
14776 !! result
14777 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14778 <ul>
14779 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14780 <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>
14781 </ul>
14782 </div>
14783 <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>
14784 <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>
14785
14786 !! end
14787
14788 !! test
14789 span tags with directionality in TOC
14790 !! input
14791 __TOC__
14792 == <span dir="ltr">C++</span> ==
14793
14794 == <span dir="rtl">זבנג!</span> ==
14795
14796 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14797
14798 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14799
14800 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14801 !! result
14802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14803 <ul>
14804 <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>
14805 <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>
14806 <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>
14807 <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>
14808 <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>
14809 </ul>
14810 </div>
14811 <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>
14812 <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>
14813 <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>
14814 <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>
14815 <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>
14816
14817 !! end
14818
14819 !! article
14820 MediaWiki:Bug32057
14821 !! text
14822 == {{int:headline_sample}} ==
14823 !! endarticle
14824
14825 !! test
14826 Bug 32057: Title needed when expanding <h> nodes.
14827 !! options
14828 title=[[Main Page]]
14829 !! input
14830 {{int:Bug32057}}
14831 !! result
14832 <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>
14833
14834 !! end
14835
14836 !! test
14837 Strip marker in urlencode
14838 !! input
14839 {{urlencode:x<nowiki/>y}}
14840 {{urlencode:x<nowiki/>y|wiki}}
14841 {{urlencode:x<nowiki/>y|path}}
14842 !! result
14843 <p>xy
14844 xy
14845 xy
14846 </p>
14847 !! end
14848
14849 !! test
14850 Strip marker in lc
14851 !! input
14852 {{lc:x<nowiki/>y}}
14853 !! result
14854 <p>xy
14855 </p>
14856 !! end
14857
14858 !! test
14859 Strip marker in uc
14860 !! input
14861 {{uc:x<nowiki/>y}}
14862 !! result
14863 <p>XY
14864 </p>
14865 !! end
14866
14867 !! test
14868 Strip marker in formatNum
14869 !! input
14870 {{formatnum:1<nowiki/>2}}
14871 {{formatnum:1<nowiki/>2|R}}
14872 !! result
14873 <p>12
14874 12
14875 </p>
14876 !! end
14877
14878 !! test
14879 Check noCommafy in formatNum
14880 !! options
14881 language=be-tarask
14882 !! input
14883 {{formatnum:123456.78}}
14884 {{formatnum:123456.78|NOSEP}}
14885 !! result
14886 <p>123 456,78
14887 123456.78
14888 </p>
14889 !! end
14890
14891 !! test
14892 Strip marker in grammar
14893 !! options
14894 language=fi
14895 !! input
14896 {{grammar:elative|foo<nowiki/>bar}}
14897 !! result
14898 <p>foobarista
14899 </p>
14900 !! end
14901
14902 !! test
14903 Strip marker in padleft
14904 !! input
14905 {{padleft:|2|x<nowiki/>y}}
14906 !! result
14907 <p>xy
14908 </p>
14909 !! end
14910
14911 !! test
14912 Strip marker in padright
14913 !! input
14914 {{padright:|2|x<nowiki/>y}}
14915 !! result
14916 <p>xy
14917 </p>
14918 !! end
14919
14920 !! test
14921 Strip marker in anchorencode
14922 !! input
14923 {{anchorencode:x<nowiki/>y}}
14924 !! result
14925 <p>xy
14926 </p>
14927 !! end
14928
14929 !! test
14930 nowiki inside link inside heading (bug 18295)
14931 !! input
14932 ==[[foo|x<nowiki>y</nowiki>z]]==
14933 !! result
14934 <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>
14935
14936 !! end
14937
14938 !! test
14939 new support for bdi element (bug 31817)
14940 !! input
14941 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14942 !! result
14943 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14944
14945 !!end
14946
14947 !! test
14948 Ignore pipe between table row attributes
14949 !! input
14950 {|
14951 | quux
14952 |- id=foo | style='color: red'
14953 | bar
14954 |}
14955 !! result
14956 <table>
14957 <tr>
14958 <td> quux
14959 </td></tr>
14960 <tr id="foo" style="color: red">
14961 <td> bar
14962 </td></tr></table>
14963
14964 !! end
14965
14966 !!test
14967 Gallery override link with WikiLink (bug 34852)
14968 !! input
14969 <gallery>
14970 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14971 </gallery>
14972 !! result
14973 <ul class="gallery">
14974 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14975 <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>
14976 <div class="gallerytext">
14977 <p>caption
14978 </p>
14979 </div>
14980 </div></li>
14981 </ul>
14982
14983 !! end
14984
14985 !!test
14986 Gallery override link with absolute external link (bug 34852)
14987 !! input
14988 <gallery>
14989 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14990 </gallery>
14991 !! result
14992 <ul class="gallery">
14993 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14994 <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>
14995 <div class="gallerytext">
14996 <p>caption
14997 </p>
14998 </div>
14999 </div></li>
15000 </ul>
15001
15002 !! end
15003
15004 !!test
15005 Gallery override link with malicious javascript (bug 34852)
15006 !! input
15007 <gallery>
15008 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15009 </gallery>
15010 !! result
15011 <ul class="gallery">
15012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15013 <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>
15014 <div class="gallerytext">
15015 <p>caption
15016 </p>
15017 </div>
15018 </div></li>
15019 </ul>
15020
15021 !! end
15022
15023 !!test
15024 Gallery with invalid title as link (bug 43964)
15025 !! input
15026 <gallery>
15027 File:foobar.jpg|link=<
15028 </gallery>
15029 !! result
15030 <ul class="gallery">
15031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15032 <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>
15033 <div class="gallerytext">
15034 </div>
15035 </div></li>
15036 </ul>
15037
15038 !! end
15039
15040 !!test
15041 Language parser function
15042 !! input
15043 {{#language:ar}}
15044 !! result
15045 <p>العربية
15046 </p>
15047 !! end
15048
15049 !!test
15050 Padleft and padright as substr
15051 !! input
15052 {{padleft:|3|abcde}}
15053 {{padright:|3|abcde}}
15054 !! result
15055 <p>abc
15056 abc
15057 </p>
15058 !! end
15059
15060 !!test
15061 Special parser function
15062 !! input
15063 {{#special:RandomPage}}
15064 {{#special:BaDtItLe}}
15065 {{#special:Foobar}}
15066 !! result
15067 <p>Special:Random
15068 Special:Badtitle
15069 Special:Foobar
15070 </p>
15071 !! end
15072
15073 !!test
15074 Bug 34939 - Case insensitive link parsing ([HttP://])
15075 !! input
15076 [HttP://MediaWiki.Org/]
15077 !! result
15078 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15079 </p>
15080 !! end
15081
15082 !!test
15083 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15084 !! input
15085 [HttP://MediaWiki.Org/ MediaWiki]
15086 !! result
15087 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15088 </p>
15089 !! end
15090
15091 !!test
15092 Bug 34939 - Case insensitive link parsing (HttP://)
15093 !! input
15094 HttP://MediaWiki.Org/
15095 !! result
15096 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15097 </p>
15098 !! end
15099
15100
15101 ###
15102 ### Parsoids-specific tests
15103 ### Parsoid-PHP parser incompatibilities
15104 ###
15105 !!test
15106 1. SOL-sensitive wikitext tokens as template-args
15107 !!options
15108 parsoid=wt2html,wt2wt
15109 !!input
15110 {{echo|*a}}
15111 {{echo|#a}}
15112 {{echo|:a}}
15113 !!result
15114 <span about="#mwt1" typeof="mw:Transclusion">
15115 </span><ul about="#mwt1"><li>a</li></ul>
15116 <span about="#mwt2" typeof="mw:Transclusion">
15117 </span><ol about="#mwt2"><li>a</li></ol>
15118 <span about="#mwt3" typeof="mw:Transclusion">
15119 </span><dl about="#mwt3"><dd>a</dd></dl>
15120 !!end
15121
15122 #### ----------------------------------------------------------------
15123 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15124 #### tags. Parsoid's output for these tags differs from that of the
15125 #### PHP parser.
15126 #### ----------------------------------------------------------------
15127
15128 !!test
15129 Ref: 1. ref-location should be replaced with an index span
15130 !!options
15131 parsoid
15132 !!input
15133 A <ref>foo</ref>
15134 B <ref name="x">foo</ref>
15135 C <ref name="y" />
15136 !!result
15137 <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>
15138 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>
15139 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>
15140 !!end
15141
15142 !!test
15143 Ref: 2. ref-tags with identical names should all get the same index
15144 !!options
15145 parsoid
15146 !!input
15147 A <ref name="x">foo</ref>
15148 B <ref name="x" />
15149 !!result
15150 <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>
15151 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>
15152 !!end
15153
15154 !!test
15155 Ref: 3. spaces in ref-names should be ignored
15156 !!options
15157 parsoid
15158 !!input
15159 A <ref name="x">foo</ref>
15160 B <ref name=" x " />
15161 C <ref name= x />
15162 !!result
15163 <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>
15164 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>
15165 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>
15166 !!end
15167
15168 !!test
15169 Ref: 4. 'constructor' should be accepted as a valid ref-name
15170 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15171 !!options
15172 parsoid
15173 !!input
15174 A <ref name="constructor">foo</ref>
15175 !!result
15176 <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>
15177 !!end
15178
15179 !!test
15180 Ref: 5. body should accept generic wikitext
15181 !!options
15182 parsoid
15183 !!input
15184 A <ref>
15185 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15186 </ref>
15187
15188 <references />
15189 !!result
15190 <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>
15191
15192 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15193 <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>
15194 </li></ol>
15195 !!end
15196
15197 !!test
15198 Ref: 6. indent-pres should not be output in ref-body
15199 !!options
15200 parsoid
15201 !!input
15202 A <ref>
15203 foo
15204 bar
15205 baz
15206 </ref>
15207
15208 <references />
15209 !!result
15210 <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>
15211
15212 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15213 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15214 bar
15215 baz
15216 </li></ol>
15217 !!end
15218
15219 !!test
15220 Ref: 6. No p-wrapping in ref-body
15221 !!options
15222 parsoid
15223 !!input
15224 A <ref>
15225 foo
15226
15227 bar
15228
15229
15230 baz
15231
15232
15233
15234 booz
15235 </ref>
15236
15237 <references />
15238 !!result
15239 <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>
15240
15241 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15242 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15243
15244 bar
15245
15246
15247 baz
15248
15249
15250
15251 booz
15252 </li></ol>
15253 !!end
15254
15255 !!test
15256 Ref: 8. transclusion wikitext has lower precedence
15257 !!options
15258 parsoid
15259 !!input
15260 A <ref> foo {{echo|</ref> B C}}
15261
15262 <references />
15263 !!result
15264 <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>
15265
15266 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15267 <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>
15268 !!end
15269
15270 !!test
15271 Ref: 9. unclosed comments should not leak out of ref-body
15272 !!options
15273 parsoid
15274 !!input
15275 A <ref> foo <!--</ref> B C
15276
15277 <references />
15278 !!result
15279 <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>
15280
15281 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15282 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15283 !!end
15284
15285 !!test
15286 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15287 !!options
15288 parsoid
15289 !!input
15290 A <ref> <b> foo </ref> B C
15291
15292 <references />
15293 !!result
15294 <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>
15295
15296 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
15297 <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>
15298 !!end
15299
15300 !!test
15301 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15302 !!options
15303 parsoid
15304 !!input
15305 A <ref>foo</ref> B
15306 C <ref>bar</ref> D
15307 !!result
15308 <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
15309 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>
15310 !!end
15311
15312 !!test
15313 Ref: 12. ref-tags act as trailing newline migration barrier
15314 !!options
15315 parsoid
15316 !!input
15317 <!--the newline at the end of this line moves out of the p-tag-->a
15318
15319 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15320 <ref />
15321
15322 c
15323 !!result
15324 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15325
15326
15327 <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>
15328 <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>
15329
15330
15331 <p>c</p>
15332 !!end
15333
15334 !!test
15335 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15336 !!options
15337 parsoid
15338 !!input
15339 <ref>foo</ref> A
15340 <ref>bar
15341 </ref> B
15342 !!result
15343 <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
15344 <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>
15345 !!end
15346
15347 !!test
15348 Ref: 14. A nested ref-tag should be emitted as plain text
15349 !!options
15350 parsoid
15351 !!input
15352 <ref>foo <ref>bar</ref> baz</ref>
15353
15354 <references />
15355 !!result
15356 <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>
15357
15358 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15359 <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>
15360 !!end
15361
15362 !!test
15363 Ref: 15. ref-tags with identical names should get identical indexes
15364 !!options
15365 parsoid
15366 !!input
15367 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15368 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15369
15370 <references />
15371 !!result
15372 <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>
15373 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>
15374
15375 <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>
15376 !!end
15377
15378 !!test
15379 References: 1. references tag without any refs should be handled properly
15380 !!options
15381 parsoid
15382 !!input
15383 <references />
15384 !!result
15385 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15386 !!end
15387
15388 !!test
15389 References: 2. references tag with group only outputs references from that group
15390 !!options
15391 parsoid
15392 !!input
15393 A <ref group="a">foo</ref>
15394 B <ref group="b">bar</ref>
15395
15396 <references group='a' />
15397 !!result
15398 <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>
15399 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>
15400
15401 <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>
15402 !!end
15403
15404 !!test
15405 References: 3. ref list should be cleared after processing references
15406 !!options
15407 parsoid
15408 !!input
15409 A <ref>foo</ref>
15410
15411 <references />
15412
15413 B <ref>bar</ref>
15414
15415 <references />
15416 !!result
15417 <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>
15418
15419 <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>
15420
15421 <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>
15422
15423 <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>
15424 !!end
15425
15426 !!test
15427 References: 4. only referenced group should be cleared after processing references
15428 !!options
15429 parsoid
15430 !!input
15431 A <ref group="a">afoo</ref>
15432 B <ref>bfoo</ref>
15433
15434 <references group="a"/>
15435
15436 C <ref>cfoo</ref>
15437
15438 <references />
15439 !!result
15440 <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>
15441 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>
15442
15443 <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>
15444
15445 <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>
15446
15447 <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>
15448 !!end
15449
15450 !!test
15451 References: 5. ref tags in references should be processed while ignoring all other content
15452 !!options
15453 parsoid
15454 !!input
15455 A <ref name="a" />
15456 B <ref name="b">bar</ref>
15457
15458 <references>
15459 <ref name="a">foo</ref>
15460 This should just get lost.
15461 </references>
15462 !!result
15463 <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>
15464 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>
15465
15466 <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>
15467 !!end
15468
15469 !!test
15470 References: 6. <references /> from a transclusion
15471 !!options
15472 parsoid
15473 !!input
15474 {{echo|<references />}}
15475 !!result
15476 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15477 !!end
15478
15479 !! test
15480 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15481 !! options
15482 parsoid
15483 !! input
15484 A <ref>foo bar for a</ref>
15485 B <ref name="b" />
15486
15487 <references />
15488
15489 <references>
15490 <ref name="b">foo</ref>
15491 </references>
15492 !! result
15493 <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>
15494 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>
15495
15496 <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>
15497
15498 <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>
15499
15500 !! end
15501
15502 #### ----------------------------------------------------------------
15503 #### The following section of tests are primarily to test
15504 #### wikitext escaping capabilities of Parsoid. Given that
15505 #### escaping can be done any number of ways, the wikitext (input)
15506 #### is always adjusted to reflect how Parsoid adds nowiki
15507 #### escape tags.
15508 ####
15509 #### We are marking several tests as parsoid-only since the
15510 #### HTML in the result section is different from what the
15511 #### PHP parser generates for it.
15512 #### ----------------------------------------------------------------
15513
15514
15515 #### --------------- Headings ---------------
15516 #### 0. Unnested
15517 #### 1. Nested inside html <h1>=foo=</h1>
15518 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15519 #### 3. Nested inside html with wikitext split by html tags
15520 #### 4. No escape needed
15521 #### 5. Empty headings <h1></h1>
15522 #### 6. Heading chars in SOL context
15523 #### ----------------------------------------
15524 !! test
15525 Headings: 0. Unnested
15526 !! options
15527 parsoid
15528 !! input
15529 <nowiki>=foo=</nowiki>
15530
15531 <nowiki> =foo= </nowiki>
15532 <!--cmt-->
15533 <nowiki>=foo=</nowiki>
15534
15535 =foo''a''<nowiki>=</nowiki>
15536 !! result
15537 <p><span typeof="mw:Nowiki">=foo=</span></p>
15538
15539 <p><span typeof="mw:Nowiki"> =foo= </span>
15540 <!--cmt-->
15541 <span typeof="mw:Nowiki">=foo=</span></p>
15542
15543 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15544 !!end
15545
15546 !! test
15547 Headings: 1. Nested inside html
15548 !! options
15549 parsoid
15550 !! input
15551 =<nowiki>=foo=</nowiki>=
15552
15553 ==<nowiki>=foo=</nowiki>==
15554
15555 ===<nowiki>=foo=</nowiki>===
15556
15557 ====<nowiki>=foo=</nowiki>====
15558
15559 =====<nowiki>=foo=</nowiki>=====
15560
15561 ======<nowiki>=foo=</nowiki>======
15562 !! result
15563 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15564 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15565 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15566 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15567 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15568 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15569 !!end
15570
15571 !! test
15572 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15573 !! options
15574 parsoid
15575 !! input
15576 =foo=
15577 <nowiki>*</nowiki>bar
15578
15579 =foo=
15580 =bar
15581
15582 =foo=
15583 <nowiki>=bar=</nowiki>
15584 !! result
15585 <h1>foo</h1>*bar
15586 <h1>foo</h1>=bar
15587 <h1>foo</h1>=bar=
15588 !!end
15589
15590 !! test
15591 Headings: 3. Nested inside html with wikitext split by html tags
15592 !! options
15593 parsoid
15594 !! input
15595 =='''bold'''<nowiki>foo=</nowiki>=
15596 !! result
15597 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15598 !!end
15599
15600 !! test
15601 Headings: 4a. No escaping needed (testing just h1 and h2)
15602 !! options
15603 parsoid
15604 !! input
15605 ==foo=
15606
15607 =foo==
15608
15609 = =foo= =
15610
15611 ==foo= bar=
15612
15613 ===foo==
15614
15615 ==foo===
15616
15617 =''=''foo==
15618
15619 =<nowiki>=</nowiki>=
15620 !! result
15621 <h1>=foo</h1>
15622 <h1>foo=</h1>
15623 <h1> =foo= </h1>
15624 <h1>=foo= bar</h1>
15625 <h2>=foo</h2>
15626 <h2>foo=</h2>
15627 <h1><i>=</i>foo=</h1>
15628 <h1><span typeof="mw:Nowiki">=</span></h1>
15629 !!end
15630
15631 !! test
15632 Headings: 4b. No escaping needed (inside p-tags)
15633 !! options
15634 parsoid
15635 !! input
15636 ===
15637 =foo= x
15638 =foo= <s></s>
15639 !! result
15640 <p>===
15641 =foo= x
15642 =foo= <s></s>
15643 </p>
15644 !!end
15645
15646 !! test
15647 Headings: 5. Empty headings
15648 !! options
15649 parsoid
15650 !! input
15651 =<nowiki/>=
15652
15653 ==<nowiki/>==
15654
15655 ===<nowiki/>===
15656
15657 ====<nowiki/>====
15658
15659 =====<nowiki/>=====
15660
15661 ======<nowiki/>======
15662 !! result
15663 <h1></h1>
15664 <h2></h2>
15665 <h3></h3>
15666 <h4></h4>
15667 <h5></h5>
15668 <h6></h6>
15669 !!end
15670
15671 !! test
15672 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15673 !! options
15674 parsoid
15675 !! input
15676 <nowiki>=a=</nowiki>
15677
15678 <nowiki>=a=</nowiki>
15679
15680 <nowiki>=a=</nowiki>
15681
15682 <nowiki>=a=</nowiki>
15683 !! result
15684 <p>=a=</p>
15685 <p>=a= </p>
15686 <p>=a= </p>
15687 <p>=a= </p>
15688 !!end
15689
15690 !! test
15691 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15692 !! options
15693 parsoid
15694 !! input
15695 <nowiki>=a=
15696 b</nowiki>
15697
15698 <nowiki>=a=
15699 b</nowiki>
15700
15701 <nowiki>=a=
15702 b</nowiki>
15703
15704 <nowiki>=a=
15705 b</nowiki>
15706 !! result
15707 <p>=a=
15708 b</p>
15709 <p>=a=
15710 b</p>
15711 <p>=a=
15712 b</p>
15713 <p>=a=
15714 b</p>
15715 </p>
15716 !!end
15717
15718 !! test
15719 Headings: 6c. Heading chars in SOL context (leading newline break)
15720 !! options
15721 parsoid
15722 !! input
15723 a
15724 <nowiki>=b=</nowiki>
15725 !! result
15726 <p>a
15727 =b=</p>
15728 !!end
15729
15730 !! test
15731 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15732 !! options
15733 parsoid
15734 !! input
15735 <!--c0--><nowiki>=a=</nowiki>
15736 <!--c1-->
15737 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
15738 !! result
15739 <p><!--c0-->=a=</p>
15740 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
15741 !!end
15742
15743 !! test
15744 Headings: 6d. Heading chars in SOL context (No escaping needed)
15745 !! options
15746 parsoid=html2wt
15747 !! input
15748 =a=<div>b</div>
15749 !! result
15750 =a=<div>b</div>
15751 !!end
15752
15753 #### --------------- Lists ---------------
15754 #### 0. Outside nests (*foo, etc.)
15755 #### 1. Nested inside html <ul><li>*foo</li></ul>
15756 #### 2. Inside definition lists
15757 #### 3. Only bullets at start should be escaped
15758 #### 4. No escapes needed
15759 #### 5. No unnecessary escapes
15760 #### 6. Escape bullets in SOL position
15761 #### 7. Escape bullets in a multi-line context
15762 #### ----------------------------------------
15763
15764 !! test
15765 Lists: 0. Outside nests
15766 !! input
15767 <nowiki>*</nowiki>foo
15768
15769 <nowiki>#</nowiki>foo
15770 !! result
15771 <p>*foo
15772 </p><p>#foo
15773 </p>
15774 !!end
15775
15776 !! test
15777 Lists: 1. Nested inside html
15778 !! input
15779 *<nowiki>*foo</nowiki>
15780
15781 *<nowiki>#foo</nowiki>
15782
15783 *<nowiki>:foo</nowiki>
15784
15785 *<nowiki>;foo</nowiki>
15786
15787 #<nowiki>*foo</nowiki>
15788
15789 #<nowiki>#foo</nowiki>
15790
15791 #<nowiki>:foo</nowiki>
15792
15793 #<nowiki>;foo</nowiki>
15794 !! result
15795 <ul><li>*foo
15796 </li></ul>
15797 <ul><li>#foo
15798 </li></ul>
15799 <ul><li>:foo
15800 </li></ul>
15801 <ul><li>;foo
15802 </li></ul>
15803 <ol><li>*foo
15804 </li></ol>
15805 <ol><li>#foo
15806 </li></ol>
15807 <ol><li>:foo
15808 </li></ol>
15809 <ol><li>;foo
15810 </li></ol>
15811
15812 !!end
15813
15814 !! test
15815 Lists: 2. Inside definition lists
15816 !! input
15817 ;<nowiki>;foo</nowiki>
15818
15819 ;<nowiki>:foo</nowiki>
15820
15821 ;<nowiki>:foo</nowiki>
15822 :bar
15823
15824 :<nowiki>:foo</nowiki>
15825 !! result
15826 <dl><dt>;foo
15827 </dt></dl>
15828 <dl><dt>:foo
15829 </dt></dl>
15830 <dl><dt>:foo
15831 </dt><dd>bar
15832 </dd></dl>
15833 <dl><dd>:foo
15834 </dd></dl>
15835
15836 !!end
15837
15838 !! test
15839 Lists: 3. Only bullets at start of text should be escaped
15840 !! input
15841 *<nowiki>*foo*bar</nowiki>
15842
15843 *<nowiki>*foo</nowiki>''it''*bar
15844 !! result
15845 <ul><li>*foo*bar
15846 </li></ul>
15847 <ul><li>*foo<i>it</i>*bar
15848 </li></ul>
15849
15850 !!end
15851
15852 !! test
15853 Lists: 4. No escapes needed
15854 !! options
15855 parsoid
15856 !! input
15857 *foo*bar
15858
15859 *''foo''*bar
15860
15861 *[[Foo]]: bar
15862 !! result
15863 <ul><li>foo*bar
15864 </li></ul>
15865 <ul><li><i>foo</i>*bar
15866 </li></ul>
15867 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15868 </li></ul>
15869 !!end
15870
15871 !! test
15872 Lists: 5. No unnecessary escapes
15873 !! input
15874 * bar <span><nowiki>[[foo]]</nowiki></span>
15875
15876 *=bar <span><nowiki>[[foo]]</nowiki></span>
15877
15878 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15879
15880 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15881
15882 *=bar <span>foo]]</span>=
15883
15884 * <s></s>: a
15885 !! result
15886 <ul><li> bar <span>[[foo]]</span>
15887 </li></ul>
15888 <ul><li>=bar <span>[[foo]]</span>
15889 </li></ul>
15890 <ul><li>[[bar <span>[[foo]]</span>
15891 </li></ul>
15892 <ul><li>]]bar <span>[[foo]]</span>
15893 </li></ul>
15894 <ul><li>=bar <span>foo]]</span>=
15895 </li></ul>
15896 <ul><li> <s></s>: a
15897 </li></ul>
15898
15899 !!end
15900
15901 !! test
15902 Lists: 6. Escape bullets in SOL position
15903 !! options
15904 parsoid
15905 !! input
15906 <!--cmt--><nowiki>*foo</nowiki>
15907 !! result
15908 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15909 !!end
15910
15911 !! test
15912 Lists: 7. Escape bullets in a multi-line context
15913 !! input
15914 a
15915 <nowiki>*</nowiki>b
15916 !! result
15917 <p>a
15918 *b
15919 </p>
15920 !!end
15921
15922 #### --------------- HRs ---------------
15923 #### 1. Single line
15924 #### -----------------------------------
15925
15926 !! test
15927 HRs: 1. Single line
15928 !! options
15929 parsoid
15930 !! input
15931 ----<nowiki>----</nowiki>
15932 ----=foo=
15933 ----*foo
15934 !! result
15935 <hr><span typeof="mw:Nowiki">----</span>
15936 <hr>=foo=
15937 <hr>*foo
15938 !! end
15939
15940 #### --------------- Tables ---------------
15941 #### 1a. Simple example
15942 #### 1b. No escaping needed (!foo)
15943 #### 1c. No escaping needed (|foo)
15944 #### 1d. No escaping needed (|}foo)
15945 ####
15946 #### 2a. Nested in td (<td>foo|bar</td>)
15947 #### 2b. Nested in td (<td>foo||bar</td>)
15948 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15949 ####
15950 #### 3a. Nested in th (<th>foo!bar</th>)
15951 #### 3b. Nested in th (<th>foo!!bar</th>)
15952 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15953 ####
15954 #### 4a. Escape -
15955 #### 4b. Escape +
15956 #### 4c. No escaping needed
15957 #### --------------------------------------
15958
15959 !! test
15960 Tables: 1a. Simple example
15961 !! input
15962 <nowiki>{|
15963 |}</nowiki>
15964 !! result
15965 <p>{|
15966 |}
15967 </p>
15968 !! end
15969
15970 !! test
15971 Tables: 1b. No escaping needed
15972 !! input
15973 !foo
15974 !! result
15975 <p>!foo
15976 </p>
15977 !! end
15978
15979 !! test
15980 Tables: 1c. No escaping needed
15981 !! input
15982 |foo
15983 !! result
15984 <p>|foo
15985 </p>
15986 !! end
15987
15988 !! test
15989 Tables: 1d. No escaping needed
15990 !! input
15991 |}foo
15992 !! result
15993 <p>|}foo
15994 </p>
15995 !! end
15996
15997 !! test
15998 Tables: 2a. Nested in td
15999 !! options
16000 parsoid
16001 !! input
16002 {|
16003 |<nowiki>foo|bar</nowiki>
16004 |}
16005 !! result
16006 <table><tbody><tr>
16007 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16008 !! end
16009
16010 !! test
16011 Tables: 2b. Nested in td
16012 !! options
16013 parsoid
16014 !! input
16015 {|
16016 |<nowiki>foo||bar</nowiki>
16017 |''it''<nowiki>foo||bar</nowiki>
16018 |}
16019 !! result
16020 <table><tbody><tr>
16021 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16022 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16023 !! end
16024
16025 !! test
16026 Tables: 2c. Nested in td -- no escaping needed
16027 !! options
16028 parsoid
16029 !! input
16030 {|
16031 |foo!!bar
16032 |}
16033 !! result
16034 <table><tbody><tr><td>foo!!bar
16035 </td></tr></tbody></table>
16036
16037 !! end
16038
16039 !! test
16040 Tables: 3a. Nested in th
16041 !! options
16042 parsoid
16043 !! input
16044 {|
16045 !foo!bar
16046 |}
16047 !! result
16048 <table><tbody><tr><th>foo!bar
16049 </th></tr></tbody></table>
16050
16051 !! end
16052
16053 !! test
16054 Tables: 3b. Nested in th
16055 !! options
16056 parsoid
16057 !! input
16058 {|
16059 !<nowiki>foo!!bar</nowiki>
16060 |}
16061 !! result
16062 <table>
16063 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16064 </tbody></table>
16065 !! end
16066
16067 !! test
16068 Tables: 3c. Nested in th -- no escaping needed
16069 !! options
16070 parsoid
16071 !! input
16072 {|
16073 !<nowiki>foo||bar</nowiki>
16074 |}
16075 !! result
16076 <table><tbody><tr>
16077 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16078 !! end
16079
16080 !! test
16081 Tables: 4a. Escape -
16082 !! options
16083 parsoid
16084 !! input
16085 {|
16086 |-
16087 !-bar
16088 |-
16089 |<nowiki>-bar</nowiki>
16090 |}
16091 !! result
16092 <table><tbody>
16093 <tr><th>-bar</th></tr>
16094 <tr>
16095 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16096 !! end
16097
16098 !! test
16099 Tables: 4b. Escape +
16100 !! options
16101 parsoid
16102 !! input
16103 {|
16104 |-
16105 !+bar
16106 |-
16107 |<nowiki>+bar</nowiki>
16108 |}
16109 !! result
16110 <table><tbody>
16111 <tr><th>+bar</th></tr>
16112 <tr>
16113 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16114 !! end
16115
16116 !! test
16117 Tables: 4c. No escaping needed
16118 !! options
16119 parsoid
16120 !! input
16121 {|
16122 |-
16123 |foo-bar
16124 |foo+bar
16125 |-
16126 |''foo''-bar
16127 |''foo''+bar
16128 |-
16129 |foo
16130 bar|baz
16131 +bar
16132 -bar
16133 |}
16134 !! result
16135 <table><tbody>
16136 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16137 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16138 <tr><td>foo
16139 <p>bar|baz
16140 +bar
16141 -bar</p></td></tr>
16142 </tbody></table>
16143 !! end
16144
16145 ### SSS FIXME: Disabled right now because accurate html2wt
16146 ### on this snippet requires data-parsoid flags that we've
16147 ### stripped out of these tests. We should scheme how we
16148 ### we want to handle these kind of tests that require
16149 ### data-parsoid flags for accurate html2wt serialization
16150
16151 !! test
16152 Tables: 4d. No escaping needed
16153 !! options
16154 disabled
16155 !! input
16156 {|
16157 ||+1
16158 ||-2
16159 |}
16160 !! result
16161 <table>
16162 <tr>
16163 <td>+1
16164 </td>
16165 <td>-2
16166 </td></tr></table>
16167
16168 !! end
16169
16170 #### --------------- Links ----------------
16171 #### 1. Quote marks in link text
16172 #### 2. Wikilinks: Escapes needed
16173 #### 3. Wikilinks: No escapes needed
16174 #### 4. Extlinks: Escapes needed
16175 #### 5. Extlinks: No escapes needed
16176 #### --------------------------------------
16177 !! test
16178 Links 1. Quote marks in link text
16179 !! options
16180 parsoid
16181 !! input
16182 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16183 !! result
16184 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16185 !! end
16186
16187 !! test
16188 Links 2. WikiLinks: Escapes needed
16189 !! options
16190 parsoid
16191 !! input
16192 [[Foo|<nowiki>[Foobar]</nowiki>]]
16193 [[Foo|<nowiki>Foobar]</nowiki>]]
16194 [[Foo|x [Foobar] x]]
16195 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16196 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16197 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16198 [[Foo|<nowiki>|Bar</nowiki>]]
16199 [[Foo|<nowiki>]]bar</nowiki>]]
16200 [[Foo|<nowiki>[[bar</nowiki>]]
16201 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16202 !! result
16203 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16204 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16205 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16206 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16207 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16208 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16209 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16210 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16211 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16212 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16213 !! end
16214
16215 !! test
16216 Links 3. WikiLinks: No escapes needed
16217 !! options
16218 parsoid
16219 !! input
16220 [[Foo|[Foobar]]
16221 [[Foo|foo|bar]]
16222 !! result
16223 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16224 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16225 !! end
16226
16227 !! test
16228 Links 4. ExtLinks: Escapes needed
16229 !! options
16230 parsoid
16231 !! input
16232 [http://google.com <nowiki>[google]</nowiki>]
16233 [http://google.com <nowiki>google]</nowiki>]
16234 !! result
16235 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16236 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16237 !! end
16238
16239 !! test
16240 Links 5. ExtLinks: No escapes needed
16241 !! options
16242 parsoid
16243 !! input
16244 [http://google.com [google]
16245 !! result
16246 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16247 !! end
16248
16249 #### --------------- Quotes ---------------
16250 #### 1. Quotes inside <b> and <i>
16251 #### 2. Link fragments separated by <i> and <b> tags
16252 #### 3. Link fragments inside <i> and <b>
16253 #### 4. No escaping needed
16254 #### --------------------------------------
16255 !! test
16256 1. Quotes inside <b> and <i>
16257 !! options
16258 parsoid=html2wt,wt2wt
16259 !! input
16260 ''<nowiki>'foo'</nowiki>''
16261 ''<nowiki>''foo''</nowiki>''
16262 ''<nowiki>'''foo'''</nowiki>''
16263 ''foo''<nowiki/>'s
16264 '''<nowiki>'foo'</nowiki>'''
16265 '''<nowiki>''foo''</nowiki>'''
16266 '''<nowiki>'''foo'''</nowiki>'''
16267 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16268 '''foo'''<nowiki/>'s
16269 '''foo''
16270 ''foo''<nowiki/>'
16271 '<nowiki/>''foo''<nowiki/>'
16272 ''''foo'''
16273 '''foo'''<nowiki/>'
16274 '<nowiki/>'''foo'''<nowiki/>'
16275 !! result
16276 <p><i>'foo'</i>
16277 <i>''foo''</i>
16278 <i>'''foo'''</i>
16279 <i>foo</i>'s
16280 <b>'foo'</b>
16281 <b>''foo''</b>
16282 <b>'''foo'''</b>
16283 <b>foo'<i>bar'</i>baz</b>
16284 <b>foo</b>'s
16285 '<i>foo</i>
16286 <i>foo</i>'
16287 '<i>foo</i>'
16288 '<b>foo</b>
16289 <b>foo</b>'
16290 '<b>foo</b>'</p>
16291 !! end
16292
16293 !! test
16294 2. Link fragments separated by <i> and <b> tags
16295 !! input
16296 [[''foo''<nowiki>hello]]</nowiki>
16297
16298 [['''foo'''<nowiki>hello]]</nowiki>
16299 !! result
16300 <p>[[<i>foo</i>hello]]
16301 </p><p>[[<b>foo</b>hello]]
16302 </p>
16303 !! end
16304
16305 !! test
16306 3. Link fragments inside <i> and <b>
16307 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16308 this is one of the shortcomings of this format)
16309 !! input
16310 ''[[foo''<nowiki>]]</nowiki>
16311
16312 '''[[foo'''<nowiki>]]</nowiki>
16313 !! result
16314 <p><i>[[foo</i>]]
16315 </p><p><b>[[foo</b>]]
16316 </p>
16317 !! end
16318
16319 !! test
16320 4. No escaping needed
16321 !! input
16322 '<span>''bar''</span>'
16323 '<span>'''bar'''</span>'
16324 !! result
16325 <p>'<span><i>bar</i></span>'
16326 '<span><b>bar</b></span>'
16327 </p>
16328 !! end
16329
16330 #### ----------- Paragraphs ---------------
16331 #### 1. No unnecessary escapes
16332 #### --------------------------------------
16333
16334 !! test
16335 1. No unnecessary escapes
16336 !! input
16337 bar <span><nowiki>[[foo]]</nowiki></span>
16338
16339 =bar <span><nowiki>[[foo]]</nowiki></span>
16340
16341 [[bar <span><nowiki>[[foo]]</nowiki></span>
16342
16343 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16344
16345 =bar <span>foo]]</span><nowiki>=</nowiki>
16346 !! result
16347 <p>bar <span>[[foo]]</span>
16348 </p><p>=bar <span>[[foo]]</span>
16349 </p><p>[[bar <span>[[foo]]</span>
16350 </p><p>]]bar <span>[[foo]]</span>
16351 </p><p>=bar <span>foo]]</span>=
16352 </p>
16353 !!end
16354
16355 #### ----------------------- PRE --------------------------
16356 #### 1. Leading whitespace in SOL context should be escaped
16357 #### ------------------------------------------------------
16358 !! test
16359 1. Leading whitespace in SOL context should be escaped
16360 !! options
16361 parsoid
16362 !! input
16363 <nowiki> </nowiki>a
16364
16365 <nowiki> </nowiki> a
16366
16367 <nowiki> </nowiki>a(tab)
16368
16369 <nowiki> </nowiki> a
16370 <!--cmt-->
16371 <nowiki> </nowiki> a
16372
16373 a
16374 <nowiki> </nowiki>b
16375
16376 a
16377 <nowiki> </nowiki>b
16378
16379 a
16380 <nowiki> </nowiki> b
16381 !! result
16382 <p> a</p>
16383 <p> a</p>
16384 <p> a(tab)</p>
16385 <p> a</p>
16386 <p><!--cmt--> a</p>
16387 <p>a
16388 b</p>
16389 <p>a
16390 b</p>
16391 <p>a
16392 b</p>
16393 !! end
16394
16395 #### --------------- HTML tags ---------------
16396 #### 1. a tags
16397 #### 2. other tags
16398 #### 3. multi-line html tag
16399 #### -----------------------------------------
16400 !! test
16401 1. a tags
16402 !! options
16403 parsoid
16404 !! input
16405 <a href="http://google.com">google</a>
16406 !! result
16407 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16408 !! end
16409
16410 !! test
16411 2. other tags
16412 !! input
16413 <nowiki><div>foo</div>
16414 <div style="color:red">foo</div></nowiki>
16415 !! result
16416 <p>&lt;div&gt;foo&lt;/div&gt;
16417 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16418 </p>
16419 !! end
16420
16421 !! test
16422 3. multi-line html tag
16423 !! input
16424 <nowiki><div
16425 >foo</div
16426 ></nowiki>
16427 !! result
16428 <p>&lt;div
16429 &gt;foo&lt;/div
16430 &gt;
16431 </p>
16432 !! end
16433
16434 !! test
16435 4. extension tags
16436 !! input
16437 <nowiki><ref>foo</ref></nowiki>
16438 !! result
16439 <p>&lt;ref&gt;foo&lt;/ref&gt;
16440 </p>
16441 !! end
16442
16443 #### --------------- Others ---------------
16444 !! test
16445 Escaping nowikis
16446 !! input
16447 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16448 !! result
16449 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16450 </p>
16451 !! end
16452
16453 ## The quote-char in the input is necessary for triggering the bug
16454 !! test
16455 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16456 !! options
16457 parsoid=wt2wt,html2wt
16458 !! input
16459 foo's bar :
16460 !! result
16461 <p>foo's bar :</p>
16462 !! end
16463
16464 !! test
16465
16466 Tag-like HTML structures are passed through as text
16467 !! input
16468 <x y>
16469
16470 <x.y>
16471
16472 <x-y>
16473
16474 1>2
16475
16476 x<y
16477
16478 a>b
16479
16480 1<d e>f
16481 !! result
16482 <p>&lt;x y&gt;
16483 </p><p>&lt;x.y&gt;
16484 </p><p>&lt;x-y&gt;
16485 </p><p>1&gt;2
16486 </p><p>x&lt;y
16487 </p><p>a&gt;b
16488 </p><p>1&lt;d e&gt;f
16489 </p>
16490 !! end
16491
16492
16493 # This was a bug in the PHP parser (see bug 17663 and its dups,
16494 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
16495 !! test
16496 Tag names followed by punctuation should not be recognized as tags
16497 !! input
16498 <s.ome> text
16499 !! result
16500 <p>&lt;s.ome&gt; text
16501 </p>
16502 !! end
16503
16504 !! test
16505 HTML tag with necessary entities in attributes
16506 !! input
16507 <span title="&amp;amp;">foo</span>
16508 !! result
16509 <p><span title="&amp;amp;">foo</span>
16510 </p>
16511 !! end
16512
16513 !! test
16514 HTML tag with 'unnecessary' entity encoding in attributes
16515 !! input
16516 <span title="&amp;">foo</span>
16517 !! result
16518 <p><span title="&amp;">foo</span>
16519 </p>
16520 !! end
16521
16522 !! test
16523 HTML tag with broken attribute value quoting
16524 !! input
16525 <span title="Hello world>Foo</span>
16526 !! result
16527 <p><span>Foo</span>
16528 </p>
16529 !! end
16530
16531 !! test
16532 Parsoid-only: HTML tag with broken attribute value quoting
16533 !! options
16534 parsoid
16535 !! input
16536 <span title="Hello world>Foo</span>
16537 !! result
16538 <p><span title="Hello world">Foo</span>
16539 </p>
16540 !! end
16541
16542 !! test
16543 Table with broken attribute value quoting
16544 !! input
16545 {|
16546 | title="Hello world|Foo
16547 |}
16548 !! result
16549 <table>
16550 <tr>
16551 <td>Foo
16552 </td></tr></table>
16553
16554 !! end
16555
16556 !! test
16557 Table with broken attribute value quoting on consecutive lines
16558 !! input
16559 {|
16560 | title="Hello world|Foo
16561 | style="color:red|Bar
16562 |}
16563 !! result
16564 <table>
16565 <tr>
16566 <td>Foo
16567 </td>
16568 <td>Bar
16569 </td></tr></table>
16570
16571 !! end
16572
16573 !! test
16574 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16575 !! options
16576 parsoid
16577 !! input
16578 {|
16579 | title="Hello world|Foo
16580 | style="color:red|Bar
16581 |}
16582 !! result
16583 <table><tbody>
16584 <tr>
16585 <td title="Hello world">Foo
16586 </td><td style="color: red">Bar
16587 </td></tr></tbody></table>
16588
16589 !! end
16590
16591 !! test
16592 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16593 !! options
16594 parsoid
16595 !! input
16596 {{}}
16597 !! result
16598 {{}}
16599 !! end
16600
16601 !! test
16602 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16603 !! options
16604 parsoid
16605 !! input
16606 }}{{
16607 !! result
16608 }}{{
16609 !! end
16610
16611 !!test
16612 Accept empty td cell attribute
16613 !!input
16614 {|
16615 | align="center" | foo || |
16616 |}
16617 !!result
16618 <table>
16619 <tr>
16620 <td align="center"> foo </td>
16621 <td>
16622 </td></tr></table>
16623
16624 !!end
16625
16626 !!test
16627 Non-empty attributes in th-cells
16628 !!input
16629 {|
16630 ! Foo !! style="color: red" | Bar
16631 |}
16632 !!result
16633 <table>
16634 <tr>
16635 <th> Foo </th>
16636 <th style="color: red"> Bar
16637 </th></tr></table>
16638
16639 !!end
16640
16641 !!test
16642 Accept empty attributes in th-cells
16643 !!input
16644 {|
16645 !| foo !!| bar
16646 |}
16647 !!result
16648 <table>
16649 <tr>
16650 <th> foo </th>
16651 <th> bar
16652 </th></tr></table>
16653
16654 !!end
16655
16656 !!test
16657 Empty table rows go away
16658 !!input
16659 {|
16660 | Hello
16661 | there
16662 |- class="foo"
16663 |-
16664 |}
16665 !! result
16666 <table>
16667 <tr>
16668 <td> Hello
16669 </td>
16670 <td> there
16671 </td></tr>
16672
16673 </table>
16674
16675 !! end
16676
16677 ###
16678 ### Parsoid-centric tests for testing RTing of inter-element separators
16679 ### Edge cases not tested by existing parser tests and specific to
16680 ### Parsoid-specific serialization strategies.
16681 ###
16682
16683 !!test
16684 RT-ed inter-element separators should be valid separators
16685 !!input
16686 {|
16687 |- [[foo]]
16688 |}
16689 !!result
16690 <table>
16691
16692 </table>
16693
16694 !!end
16695
16696 !!test
16697 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16698 (Parsoid-only since PHP parser relies on Tidy for correct output)
16699 !!options
16700 parsoid
16701 !!input
16702 {|
16703 |<small>foo
16704 bar
16705 |}
16706
16707 {|
16708 |<small>foo<small>
16709 |}
16710 !!result
16711 !!end
16712
16713 !!test
16714 Empty TD followed by TD with tpl-generated attribute
16715 !!input
16716 {|
16717 |-
16718 |
16719 |{{echo|style='color:red'}}|foo
16720 |}
16721 !!result
16722 <table>
16723
16724 <tr>
16725 <td>
16726 </td>
16727 <td>foo
16728 </td></tr></table>
16729
16730 !!end
16731
16732 !!test
16733 Indented table with an empty td
16734 !!input
16735 {|
16736 |-
16737 |
16738 |foo
16739 |}
16740 !!result
16741 <table>
16742
16743 <tr>
16744 <td>
16745 </td>
16746 <td>foo
16747 </td></tr></table>
16748
16749 !!end
16750
16751 !!test
16752 Empty TR followed by a template-generated TR
16753 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16754 !!options
16755 parsoid=wt2html,wt2wt
16756 !!input
16757 {|
16758 |-
16759 {{echo|<tr><td>foo</td></tr>}}
16760 |}
16761 !!result
16762 <table>
16763 <tbody>
16764 <tr></tr>
16765 <tr typeof="mw:Transclusion">
16766 <td>foo</td></tr></tbody></table>
16767 !!end
16768
16769 ## PHP and parsoid output differ for this, and since this is primarily
16770 ## for testing Parsoid's serializer, marking this Parsoid only
16771 !!test
16772 Empty TR followed by mixed-ws-comment line should RT correctly
16773 !!options
16774 parsoid
16775 !!input
16776 {|
16777 |-
16778 <!--c-->
16779 |-
16780 <!--c--> <!--d-->
16781 |}
16782 !!result
16783 <table>
16784 <tbody>
16785 <tr>
16786 <td> <!--c--></td></tr>
16787 <tr>
16788 <td><!--c--> <!--d--></td></tr>
16789 </tbody></table>
16790
16791 !!end
16792
16793 !!test
16794 Multi-line image caption generated by templates with/without trailing newlines
16795 !!options
16796 parsoid
16797 !!input
16798 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16799 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16800 !!result
16801 <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>
16802 <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>
16803
16804 !!end
16805
16806 ## PHP emits broken html for this, and since this is primarily
16807 ## a Parsoid serializer test, marking this Parsoid only
16808 !!test
16809 Improperly nested inline or quotes tags with whitespace in between
16810 !!options
16811 parsoid
16812 !!input
16813 <span> <s>x</span> </s>
16814 ''' ''x''' ''
16815 !!result
16816 <p><span> <s>x</s></span><s> </s>
16817 <b> <i>x</i></b><i> </i>
16818 </p>
16819 !!end
16820
16821 !!test
16822 Encapsulate protected attributes from wt
16823 !!options
16824 parsoid
16825 !!input
16826 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16827 !!result
16828 <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>
16829 </body>
16830 !!end
16831
16832 # -----------------------------------------------------------------
16833 # The following section of tests are primarily to spec requirements
16834 # around serialization of new/edited content.
16835 #
16836 # All these tests are marked Parsoid html2wt and html2html only
16837 # ----------------------------------------------------------------
16838
16839 !! test
16840 Image: Modifying size of an image
16841 !! options
16842 parsoid=html2wt
16843 !! input
16844 [[Image:Wiki.png|230x230px]]
16845 !! result
16846 <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>
16847 !!end
16848
16849 !! test
16850 Image: New block level image should have \n before and after
16851 !! options
16852 parsoid=html2wt
16853 !! input
16854 123
16855 [[File:Wiki.png|right|thumb|150x150px]]
16856 456
16857 !! result
16858 <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>
16859 !!end
16860
16861 !! test
16862 Lists: Add space after bullets
16863 !! options
16864 parsoid=html2wt
16865 !! input
16866
16867 * foo
16868 * bar
16869 * <span> baz</span>
16870 !! result
16871 <ul>
16872 <li>foo</li>
16873 <li> bar</li>
16874 <li><span> baz</span></li>
16875 </ul>
16876 !! end
16877
16878 !! test
16879 Parsoid: Serialize positional parameters with = in them as named parameter
16880 !! options
16881 parsoid=html2wt
16882 !! input
16883 {{echo|1 = f=oo}}
16884 !! result
16885 <p about="#mwt1" typeof="mw:Transclusion"
16886 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16887 >foo</p>
16888 !! end
16889
16890 # -----------------------------------------------------------------
16891 # End of section for Parsoid-only html2wt tests for serialization
16892 # of new content
16893 # -----------------------------------------------------------------
16894
16895 TODO:
16896 more images
16897 more tables
16898 character entities
16899 and much more
16900 Try for 100% code coverage