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