Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # You can also set the following parser properties via test options:
31 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 # wgLinkHolderBatchSize, wgRawHtml
33 #
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
37
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
44
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
50
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
55
56 !! article
57 Template:pipe
58 !! text
59 |
60 !! endarticle
61
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
67
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
73
74 !! article
75 Template:tbl-start
76 !! text
77 {|
78 !! endarticle
79
80 !! article
81 Template:tbl-end
82 !! text
83 |}
84 !! endarticle
85
86 !! article
87 Template:!
88 !! text
89 |
90 !! endarticle
91
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
97
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
103
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
109
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
115
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
122
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
128
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
135
136 !! article
137 A?b
138 !! text
139 Weirdo titles!
140 !! endarticle
141
142 !!article
143 Template:Bullet
144 !!text
145 * Bar
146 !!endarticle
147
148 ###
149 ### Basic tests
150 ###
151 !! test
152 Blank input
153 !! input
154 !! result
155 !! end
156
157
158 !! test
159 Simple paragraph
160 !! input
161 This is a simple paragraph.
162 !! result
163 <p>This is a simple paragraph.
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with extra newline spacing
169 !! input
170 foo
171
172 bar
173
174
175 baz
176
177
178
179 booz
180 !! result
181 <p>foo
182 </p><p>bar
183 </p><p><br />
184 baz
185 </p><p><br />
186 </p><p>booz
187 </p>
188 !! end
189
190 !! test
191 Paragraphs with newline spacing with comment lines in between
192 !! input
193 ----
194 a
195 <!--foo-->
196 b
197 ----
198 a
199 <!--foo--><!--More than 1 comment, still stripped-->
200 b
201 ----
202 a
203 <!--foo--> <!----> <!-- bar -->
204 b
205 ----
206 a
207 <!--foo-->
208
209 b
210 ----
211 a
212
213 <!--foo-->
214 b
215 ----
216 a
217 <!--foo-->
218
219
220 b
221 ----
222 a
223
224
225 <!--foo-->
226 b
227 ----
228 !! result
229 <hr />
230 <p>a
231 b
232 </p>
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 </p><p>b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p><br />
252 b
253 </p>
254 <hr />
255 <p>a
256 </p><p><br />
257 b
258 </p>
259 <hr />
260
261 !! end
262
263 !! test
264 Paragraphs with newline spacing with non-empty white-space lines in between
265 !! input
266 ----
267 a
268
269 b
270 ----
271 a
272
273
274 b
275 ----
276 !! result
277 <hr />
278 <p>a
279 </p><p>b
280 </p>
281 <hr />
282 <p>a
283 </p><p><br />
284 b
285 </p>
286 <hr />
287
288 !! end
289
290 !! test
291 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
292 !! input
293 ----
294 a
295 <!--foo-->
296 b
297 ----
298 a
299 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
300 b
301 ----
302 a
303
304 <!--foo-->
305 <!--bar-->
306 b
307 ----
308 a
309
310 <!--foo-->
311 <!--bar-->
312
313 b
314 ----
315 !! result
316 <hr />
317 <p>a
318 b
319 </p>
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 </p><p>b
327 </p>
328 <hr />
329 <p>a
330 </p><p><br />
331 b
332 </p>
333 <hr />
334
335 !! end
336
337 !! test
338 Extra newlines: More paragraphs with indented comment
339 !! input
340 a
341
342 <!--boo-->
343
344 b
345 !!result
346 <p>a
347 </p><p><br />
348 b
349 </p>
350 !!end
351
352 !! test
353 Extra newlines followed by heading
354 !! input
355 a
356
357
358
359 =b=
360 [[a]]
361
362
363 =b=
364 !! result
365 <p>a
366 </p><p><br />
367 </p>
368 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
369 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
370 </p><p><br />
371 </p>
372 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
373
374 !! end
375
376 !! test
377 Extra newlines between heading and content are swallowed
378 !! input
379 =b=
380
381
382
383 [[a]]
384 !! result
385 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
386 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
387 </p>
388 !! end
389
390 !! test
391 Parsing an URL
392 !! input
393 http://fr.wikipedia.org/wiki/🍺
394 <!-- EasterEgg we love beer, better be able be able to link to it -->
395 !! result
396 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
397 </p>
398 !! end
399
400 !! test
401 Simple list
402 !! input
403 * Item 1
404 * Item 2
405 !! result
406 <ul><li> Item 1
407 </li><li> Item 2
408 </li></ul>
409
410 !! end
411
412 !! test
413 Italics and bold
414 !! input
415 * plain
416 * plain''italic''plain
417 * plain''italic''plain''italic''plain
418 * plain'''bold'''plain
419 * plain'''bold'''plain'''bold'''plain
420 * plain''italic''plain'''bold'''plain
421 * plain'''bold'''plain''italic''plain
422 * plain''italic'''bold-italic'''italic''plain
423 * plain'''bold''bold-italic''bold'''plain
424 * plain'''''bold-italic'''italic''plain
425 * plain'''''bold-italic''bold'''plain
426 * plain''italic'''bold-italic'''''plain
427 * plain'''bold''bold-italic'''''plain
428 * plain l'''italic''plain
429 * plain l''''bold''' plain
430 !! result
431 <ul><li> plain
432 </li><li> plain<i>italic</i>plain
433 </li><li> plain<i>italic</i>plain<i>italic</i>plain
434 </li><li> plain<b>bold</b>plain
435 </li><li> plain<b>bold</b>plain<b>bold</b>plain
436 </li><li> plain<i>italic</i>plain<b>bold</b>plain
437 </li><li> plain<b>bold</b>plain<i>italic</i>plain
438 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
439 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
440 </li><li> plain<i><b>bold-italic</b>italic</i>plain
441 </li><li> plain<b><i>bold-italic</i>bold</b>plain
442 </li><li> plain<i>italic<b>bold-italic</b></i>plain
443 </li><li> plain<b>bold<i>bold-italic</i></b>plain
444 </li><li> plain l'<i>italic</i>plain
445 </li><li> plain l'<b>bold</b> plain
446 </li></ul>
447
448 !! end
449
450 # this example taken from the [[simple:Moon]] article (bug 47326)
451 !! test
452 Italics and possessives (1)
453 !! input
454 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
455 !! result
456 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
457 </p>
458 !! end
459
460 # this example taken from [[en:Flaming Pie]] (bug 49926)
461 !! test
462 Italics and possessives (2)
463 !! input
464 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
465 !! result
466 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
467 </p>
468 !! end
469
470 # this example taken from [[en:Dictionary]] (bug 49926)
471 !! test
472 Italics and possessives (3)
473 !! input
474 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
475 !! result
476 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
477 </p>
478 !! end
479
480
481 ###
482 ### 2-quote opening sequence tests
483 ###
484 !! test
485 Italics and bold: 2-quote opening sequence: (2,2)
486 !! input
487 ''foo''
488 !! result
489 <p><i>foo</i>
490 </p>
491 !!end
492
493
494 !! test
495 Italics and bold: 2-quote opening sequence: (2,3)
496 !! input
497 ''foo'''
498 !! result
499 <p><i>foo'</i>
500 </p>
501 !!end
502
503
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,4)
506 !! input
507 ''foo''''
508 !! result
509 <p><i>foo''</i>
510 </p>
511 !!end
512
513
514 !! test
515 Italics and bold: 2-quote opening sequence: (2,5) (php)
516 !! options
517 php
518 !! input
519 ''foo'''''
520 !! result
521 <p><i>foo</i>
522 </p>
523 !!end
524 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
525 !! test
526 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
527 !! options
528 parsoid
529 !! input
530 ''foo'''''
531 !! result
532 <p><i>foo</i><b></b>
533 </p>
534 !!end
535
536
537 ###
538 ### 3-quote opening sequence tests
539 ###
540
541 !! test
542 Italics and bold: 3-quote opening sequence: (3,2)
543 !! input
544 '''foo''
545 !! result
546 <p>'<i>foo</i>
547 </p>
548 !!end
549
550
551 !! test
552 Italics and bold: 3-quote opening sequence: (3,3)
553 !! input
554 '''foo'''
555 !! result
556 <p><b>foo</b>
557 </p>
558 !!end
559
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,4)
563 !! input
564 '''foo''''
565 !! result
566 <p><b>foo'</b>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,5) (php)
573 !! options
574 php
575 !! input
576 '''foo'''''
577 !! result
578 <p><b>foo</b>
579 </p>
580 !!end
581 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
582 !! test
583 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
584 !! options
585 parsoid
586 !! input
587 '''foo'''''
588 !! result
589 <p><b>foo</b><i></i>
590 </p>
591 !!end
592
593
594 ###
595 ### 4-quote opening sequence tests
596 ###
597
598 !! test
599 Italics and bold: 4-quote opening sequence: (4,2)
600 !! input
601 ''''foo''
602 !! result
603 <p>''<i>foo</i>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 4-quote opening sequence: (4,3)
610 !! input
611 ''''foo'''
612 !! result
613 <p>'<b>foo</b>
614 </p>
615 !!end
616
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,4)
620 !! input
621 ''''foo''''
622 !! result
623 <p>'<b>foo'</b>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,5) (php)
630 !! options
631 php
632 !! input
633 ''''foo'''''
634 !! result
635 <p>'<b>foo</b>
636 </p>
637 !!end
638 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
639 !! test
640 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
641 !! options
642 parsoid
643 !! input
644 ''''foo'''''
645 !! result
646 <p>'<b>foo</b><i></i>
647 </p>
648 !!end
649
650
651 ###
652 ### 5-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 5-quote opening sequence: (5,2)
657 !! options
658 !! input
659 '''''foo''
660 !! result
661 <p><b><i>foo</i></b>
662 </p>
663 !!end
664
665
666 !! test
667 Italics and bold: 5-quote opening sequence: (5,3)
668 !! input
669 '''''foo'''
670 !! result
671 <p><i><b>foo</b></i>
672 </p>
673 !!end
674
675
676 !! test
677 Italics and bold: 5-quote opening sequence: (5,4)
678 !! input
679 '''''foo''''
680 !! result
681 <p><i><b>foo'</b></i>
682 </p>
683 !!end
684
685
686 !! test
687 Italics and bold: 5-quote opening sequence: (5,5)
688 !! input
689 '''''foo'''''
690 !! result
691 <p><i><b>foo</b></i>
692 </p>
693 !!end
694
695 ###
696 ### multiple quote sequences in a line
697 ###
698 !! test
699 Italics and bold: multiple quote sequences: (2,4,2)
700 !! input
701 ''foo''''bar''
702 !! result
703 <p><i>foo'<b>bar</b></i>
704 </p>
705 !!end
706
707
708 !! test
709 Italics and bold: multiple quote sequences: (2,4,3)
710 !! input
711 ''foo''''bar'''
712 !! result
713 <p><i>foo'<b>bar</b></i>
714 </p>
715 !!end
716
717
718 !! test
719 Italics and bold: multiple quote sequences: (2,4,4)
720 !! input
721 ''foo''''bar''''
722 !! result
723 <p><i>foo'<b>bar'</b></i>
724 </p>
725 !!end
726
727
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,2) (php)
730 !! options
731 php
732 !! input
733 '''foo''''bar''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar''
745 !! result
746 <p><b>foo'</b>bar<i></i>
747 </p>
748 !!end
749
750
751 !! test
752 Italics and bold: multiple quote sequences: (3,4,3) (php)
753 !! options
754 php
755 !! input
756 '''foo''''bar'''
757 !! result
758 <p><b>foo'</b>bar
759 </p>
760 !!end
761 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
762 !! test
763 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
764 !! options
765 parsoid
766 !! input
767 '''foo''''bar'''
768 !! result
769 <p><b>foo'</b>bar<b></b>
770 </p>
771 !!end
772
773 ###
774 ### other quote tests
775 ###
776 !! test
777 Italics and bold: other quote tests: (2,3,5)
778 !! input
779 ''this is about '''foo's family'''''
780 !! result
781 <p><i>this is about <b>foo's family</b></i>
782 </p>
783 !!end
784
785
786 !! test
787 Italics and bold: other quote tests: (2,(3,3),2)
788 !! input
789 ''this is about '''foo's''' family''
790 !! result
791 <p><i>this is about <b>foo's</b> family</i>
792 </p>
793 !!end
794
795
796 !! test
797 Italics and bold: other quote tests: (3,2,3,2)
798 !! input
799 '''this is about ''foo'''s family''
800 !! result
801 <p><b>this is about <i>foo</i></b><i>s family</i>
802 </p>
803 !!end
804
805
806 !! test
807 Italics and bold: other quote tests: (3,2,3,3)
808 !! options
809 !! input
810 '''this is about ''foo'''s family'''
811 !! result
812 <p>'<i>this is about </i>foo<b>s family</b>
813 </p>
814 !!end
815
816
817 !! test
818 Italics and bold: other quote tests: (3,(2,2),3)
819 !! input
820 '''this is about ''foo's'' family'''
821 !! result
822 <p><b>this is about <i>foo's</i> family</b>
823 </p>
824 !!end
825
826
827 !! test
828 Italicized possessive
829 !! input
830 The ''[[Main Page]]'''s talk page.
831 !! result
832 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
833 </p>
834 !! end
835
836 !! test
837 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
838 (Requires tidy for PHP parser output to be fixed up)
839 !! options
840 parsoid=wt2html,wt2wt
841 !! input
842 {|
843 !''a!!''b
844 |''a||''b
845 |}
846 !! result
847 <table>
848 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
849 <td><i>a</i></td><td><i>b</i></td></tr>
850 </tbody></table>
851 !! end
852
853 ###
854 ### Non-html5 tags
855 ###
856
857 !! test
858 Non-html5 tags should be accepted
859 !! input
860 <center>''foo''</center>
861 <big>''foo''</big>
862 <font>''foo''</font>
863 <strike>''foo''</strike>
864 <tt>''foo''</tt>
865 !! result
866 <center><i>foo</i></center>
867 <p><big><i>foo</i></big>
868 <font><i>foo</i></font>
869 <strike><i>foo</i></strike>
870 <tt><i>foo</i></tt>
871 </p>
872 !! end
873
874 !! test
875 <wbr> is valid wikitext (bug 52468)
876 !! input
877 <wbr>
878 !! result
879 <p><wbr />
880 </p>
881 !! end
882
883 # <strike> is HTML4, <s> is HTML4/5.
884 !! test
885 <s> or <strike> for strikethrough
886 !! input
887 <strike>strike</strike>
888
889 <s>s</s>
890 !! result
891 <p><strike>strike</strike>
892 </p><p><s>s</s>
893 </p>
894 !! end
895
896 !! test
897 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
898 !! input
899 <b→> doesn't work! </b>
900
901 <bä> doesn't work! </b>
902
903 <boo> works fine </b>
904
905 <s.foo>foo</s>
906
907 <s.foo>s.foo</s.foo>
908
909 <sub-ID#1>
910 !! result
911 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
912 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
913 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
914 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
915 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
916 </p><p>&lt;sub-ID#1&gt;
917 </p>
918 !! end
919
920 ###
921 ### Special characters
922 ###
923
924 !! test
925 Bare pipe character (bug 52363)
926 !! input
927 |
928 !! result
929 <p>|
930 </p>
931 !! end
932
933 !! test
934 Bare pipe character from a template (bug 52363)
935 !! input
936 {{pipe}}
937 !! result
938 <p>|
939 </p>
940 !! end
941
942 ###
943 ### <nowiki> test cases
944 ###
945
946 !! test
947 <nowiki> unordered list
948 !! input
949 <nowiki>* This is not an unordered list item.</nowiki>
950 !! result
951 <p>* This is not an unordered list item.
952 </p>
953 !! end
954
955 !! test
956 <nowiki> spacing
957 !! input
958 <nowiki>Lorem ipsum dolor
959
960 sed abit.
961 sed nullum.
962
963 :and a colon
964 </nowiki>
965 !! result
966 <p>Lorem ipsum dolor
967
968 sed abit.
969 sed nullum.
970
971 :and a colon
972
973 </p>
974 !! end
975
976 !! test
977 nowiki 3
978 !! input
979 :There is not nowiki.
980 :There is <nowiki>nowiki</nowiki>.
981
982 #There is not nowiki.
983 #There is <nowiki>nowiki</nowiki>.
984
985 *There is not nowiki.
986 *There is <nowiki>nowiki</nowiki>.
987 !! result
988 <dl><dd>There is not nowiki.
989 </dd><dd>There is nowiki.
990 </dd></dl>
991 <ol><li>There is not nowiki.
992 </li><li>There is nowiki.
993 </li></ol>
994 <ul><li>There is not nowiki.
995 </li><li>There is nowiki.
996 </li></ul>
997
998 !! end
999
1000 !! test
1001 Entities inside <nowiki>
1002 !! input
1003 <nowiki>&lt;</nowiki>
1004 !! result
1005 <p>&lt;
1006 </p>
1007 !! end
1008
1009 !! test
1010 Entities inside template parameters
1011 !! options
1012 parsoid
1013 !! input
1014 {{echo|&ndash;}}
1015 !! result
1016 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1017 </p>
1018 !! end
1019
1020 ###
1021 ### Comments
1022 ###
1023 !! test
1024 Comments and Indent-Pre
1025 !! input
1026 <!-- comment 1 --> asdf
1027
1028 <!-- comment 1 --> asdf
1029 <!-- comment 2 -->
1030
1031 <!-- comment 1 --> asdf
1032 <!-- comment 2 -->xyz
1033
1034 <!-- comment 1 --> asdf
1035 <!-- comment 2 --> xyz
1036 !! result
1037 <pre>asdf
1038 </pre>
1039 <pre>asdf
1040 </pre>
1041 <pre>asdf
1042 </pre>
1043 <p>xyz
1044 </p>
1045 <pre>asdf
1046 xyz
1047 </pre>
1048 !! end
1049
1050 !! test
1051 Comment test 2a
1052 !! input
1053 asdf
1054 <!-- comment 1 -->
1055 jkl
1056 !! result
1057 <p>asdf
1058 jkl
1059 </p>
1060 !! end
1061
1062 !! test
1063 Comment test 2b
1064 !! input
1065 asdf
1066 <!-- comment 1 -->
1067
1068 jkl
1069 !! result
1070 <p>asdf
1071 </p><p>jkl
1072 </p>
1073 !! end
1074
1075 !! test
1076 Comment test 3
1077 !! input
1078 asdf
1079 <!-- comment 1 -->
1080 <!-- comment 2 -->
1081 jkl
1082 !! result
1083 <p>asdf
1084 jkl
1085 </p>
1086 !! end
1087
1088 !! test
1089 Comment test 4
1090 !! input
1091 asdf<!-- comment 1 -->jkl
1092 !! result
1093 <p>asdfjkl
1094 </p>
1095 !! end
1096
1097 !! test
1098 Comment spacing
1099 !! input
1100 a
1101 <!-- foo --> b <!-- bar -->
1102 c
1103 !! result
1104 <p>a
1105 </p>
1106 <pre> b
1107 </pre>
1108 <p>c
1109 </p>
1110 !! end
1111
1112 !! test
1113 Comment whitespace
1114 !! input
1115 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1116 !! result
1117
1118 !! end
1119
1120 !! test
1121 Comment semantics and delimiters
1122 !! input
1123 <!-- --><!----><!-----><!------>
1124 !! result
1125
1126 !! end
1127
1128 !! test
1129 Comment semantics and delimiters, redux
1130 !! input
1131 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1132 -- foo -- funky huh? ... -->
1133 !! result
1134
1135 !! end
1136
1137 !! test
1138 Comment semantics and delimiters: directors cut
1139 !! input
1140 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1141 everything starting with < followed by !-- until the first -- and > we see,
1142 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1143 -->-->
1144 !! result
1145 <p>--&gt;
1146 </p>
1147 !! end
1148
1149 !! test
1150 Comment semantics: nesting
1151 !! input
1152 <!--<!-- no, we're not going to do anything fancy here -->-->
1153 !! result
1154 <p>--&gt;
1155 </p>
1156 !! end
1157
1158 !! test
1159 Comment semantics: unclosed comment at end
1160 !! input
1161 <!--This comment will run out to the end of the document
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment in template title
1168 !! input
1169 {{f<!---->oo}}
1170 !! result
1171 <p>FOO
1172 </p>
1173 !! end
1174
1175 !! test
1176 Comment on its own line post-expand
1177 !! input
1178 a
1179 {{blank}}<!---->
1180 b
1181 !! result
1182 <p>a
1183 </p><p>b
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment on its own line post-expand with non-significant whitespace
1189 !! input
1190 a
1191 {{blank}} <!---->
1192 b
1193 !! result
1194 <p>a
1195 </p><p>b
1196 </p>
1197 !! end
1198
1199 ###
1200 ### paragraph wrapping tests
1201 ###
1202 !! test
1203 No block tags
1204 !! input
1205 a
1206
1207 b
1208 !! result
1209 <p>a
1210 </p><p>b
1211 </p>
1212 !! end
1213
1214 !! test
1215 Block tag on one line (<div>)
1216 !! input
1217 a <div>foo</div>
1218
1219 b
1220 !! result
1221 a <div>foo</div>
1222 <p>b
1223 </p>
1224 !! end
1225
1226 !! test
1227 Block tag on one line (<blockquote>)
1228 !! input
1229 a <blockquote>foo</blockquote>
1230
1231 b
1232 !! result
1233 a <blockquote>foo</blockquote>
1234 <p>b
1235 </p>
1236 !! end
1237
1238 !! test
1239 Block tag on both lines (<div>)
1240 !! input
1241 a <div>foo</div>
1242
1243 b <div>foo</div>
1244 !! result
1245 a <div>foo</div>
1246 b <div>foo</div>
1247
1248 !! end
1249
1250 !! test
1251 Block tag on both lines (<blockquote>)
1252 !! input
1253 a <blockquote>foo</blockquote>
1254
1255 b <blockquote>foo</blockquote>
1256 !! result
1257 a <blockquote>foo</blockquote>
1258 b <blockquote>foo</blockquote>
1259
1260 !! end
1261
1262 !! test
1263 Multiple lines without block tags
1264 !! input
1265 <div>foo</div> a
1266 b
1267 c
1268 d<!--foo--> e
1269 x <div>foo</div> z
1270 !! result
1271 <div>foo</div> a
1272 <p>b
1273 c
1274 d e
1275 </p>
1276 x <div>foo</div> z
1277
1278 !! end
1279
1280 !! test
1281 Empty lines between lines with block tags
1282 !! input
1283 <div></div>
1284
1285
1286 <div></div>a
1287
1288 b
1289 <div>a</div>b
1290
1291 <div>b</div>d
1292
1293
1294 <div>e</div>
1295 !! result
1296 <div></div>
1297 <p><br />
1298 </p>
1299 <div></div>a
1300 <p>b
1301 </p>
1302 <div>a</div>b
1303 <div>b</div>d
1304 <p><br />
1305 </p>
1306 <div>e</div>
1307
1308 !! end
1309
1310 ###
1311 ### Preformatted text
1312 ###
1313 !! test
1314 Preformatted text
1315 !! input
1316 This is some
1317 Preformatted text
1318 With ''italic''
1319 And '''bold'''
1320 And a [[Main Page|link]]
1321 !! result
1322 <pre>This is some
1323 Preformatted text
1324 With <i>italic</i>
1325 And <b>bold</b>
1326 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1327 </pre>
1328 !! end
1329
1330 !! test
1331 Tabs don't trigger preformatted text
1332 !! input
1333 This is not
1334 preformatted text.
1335 This is preformatted text.
1336 So is this.
1337 !! result
1338 <p> This is not
1339 preformatted text.
1340 </p>
1341 <pre>This is preformatted text.
1342 So is this.
1343 </pre>
1344 !! end
1345
1346 !! test
1347 Ident preformatting with inline content
1348 !! input
1349 a
1350 ''b''
1351 !! result
1352 <pre>a
1353 <i>b</i>
1354 </pre>
1355 !! end
1356
1357 !! test
1358 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1359 !! input
1360 <pre><nowiki>
1361 <b>
1362 <cite>
1363 <em>
1364 </nowiki></pre>
1365 !! result
1366 <pre>
1367 &lt;b&gt;
1368 &lt;cite&gt;
1369 &lt;em&gt;
1370 </pre>
1371
1372 !! end
1373
1374 !! test
1375 Regression with preformatted in <center>
1376 !! input
1377 <center>
1378 Blah
1379 </center>
1380 !! result
1381 <center>
1382 <pre>Blah
1383 </pre>
1384 </center>
1385
1386 !! end
1387
1388 !! test
1389 Bug 52763: Preformatted in <blockquote>
1390 !! input
1391 <blockquote>
1392 Blah
1393 </blockquote>
1394 !! result
1395 <blockquote>
1396 <p> Blah
1397 </p>
1398 </blockquote>
1399
1400 !! end
1401
1402 !! test
1403 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1404 !! input
1405 <blockquote>
1406 Foo
1407
1408 Bar
1409 </blockquote>
1410 !! result
1411 <blockquote>
1412 <p>Foo
1413 </p><p>Bar
1414 </p>
1415 </blockquote>
1416
1417 !! end
1418
1419 !! test
1420 Bug 15491: <ins>/<del> in blockquote
1421 !! input
1422 <blockquote>
1423 Foo <del>bar</del> <ins>baz</ins> quux
1424 </blockquote>
1425 !! result
1426 <blockquote>
1427 <p>Foo <del>bar</del> <ins>baz</ins> quux
1428 </p>
1429 </blockquote>
1430
1431 !! end
1432
1433 # Note that the p-wrapping is newline sensitive, which could be
1434 # considered a bug: tidy will wrap only the 'Foo' in the example
1435 # below in a <p> tag. (see comment 23-25 of bug #6200)
1436 !! test
1437 Bug 15491: <ins>/<del> in blockquote (2)
1438 !! input
1439 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1440 </blockquote>
1441 !! result
1442 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1443 </blockquote>
1444
1445 !! end
1446
1447 !! test
1448 <pre> with attributes (bug 3202)
1449 !! input
1450 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1451 !! result
1452 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1453
1454 !! end
1455
1456 !! test
1457 <pre> with width attribute (bug 3202)
1458 !! input
1459 <pre width="8">Narrow screen goodies</pre>
1460 !! result
1461 <pre width="8">Narrow screen goodies</pre>
1462
1463 !! end
1464
1465 !! test
1466 <pre> with forbidden attribute (bug 3202)
1467 !! input
1468 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1469 !! result
1470 <pre width="8">Narrow screen goodies</pre>
1471
1472 !! end
1473
1474 !! test
1475 Entities inside <pre>
1476 !! input
1477 <pre>&lt;</pre>
1478 !! result
1479 <pre>&lt;</pre>
1480
1481 !! end
1482
1483 !! test
1484 <pre> with forbidden attribute values (bug 3202)
1485 !! input
1486 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1487 !! result
1488 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1489
1490 !! end
1491
1492 !! test
1493 <nowiki> inside <pre> (bug 13238)
1494 !! input
1495 <pre>
1496 <nowiki>
1497 </pre>
1498 <pre>
1499 <nowiki></nowiki>
1500 </pre>
1501 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1502 !! result
1503 <pre>
1504 &lt;nowiki&gt;
1505 </pre>
1506 <pre>
1507
1508 </pre>
1509 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1510
1511 !! end
1512
1513 !! test
1514 <nowiki> and <pre> preference (first one wins)
1515 !! input
1516 <pre>
1517 <nowiki>
1518 </pre>
1519 </nowiki>
1520 </pre>
1521
1522 <nowiki>
1523 <pre>
1524 <nowiki>
1525 </pre>
1526 </nowiki>
1527 </pre>
1528
1529 !! result
1530 <pre>
1531 &lt;nowiki&gt;
1532 </pre>
1533 <p>&lt;/nowiki&gt;
1534 &lt;/pre&gt;
1535 </p><p>
1536 &lt;pre&gt;
1537 &lt;nowiki&gt;
1538 &lt;/pre&gt;
1539
1540 &lt;/pre&gt;
1541 </p>
1542 !! end
1543
1544 !! test
1545 </pre> inside nowiki
1546 !! input
1547 <nowiki></pre></nowiki>
1548 !! result
1549 <p>&lt;/pre&gt;
1550 </p>
1551 !! end
1552
1553 !!test
1554 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1555 !!input
1556 {{echo|}}
1557 !!result
1558
1559 !!end
1560
1561 !!test
1562 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1563 !!input
1564 {{echo|
1565 foo}}
1566 !!result
1567 <p>foo
1568 </p>
1569 !!end
1570
1571 !! test
1572 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1573 !! input
1574 {{echo|a
1575 b}}
1576 !!result
1577 <pre>a
1578 </pre>
1579 <p>b
1580 </p>
1581 !!end
1582
1583 !! test
1584 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1585 !! input
1586 {{echo|a
1587 b
1588 c
1589 d
1590 e
1591 }}
1592 !!result
1593 <pre>a
1594 </pre>
1595 <p>b
1596 c
1597 </p>
1598 <pre>d
1599 </pre>
1600 <p>e
1601 </p>
1602 !!end
1603
1604 !!test
1605 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1606 !!input
1607 {{echo| foo}}
1608
1609 {{echo| foo}}{{echo| bar}}
1610
1611 {{echo| foo}}
1612 {{echo| bar}}
1613
1614 {{echo|<!--cmt--> foo}}
1615
1616 <!--cmt-->{{echo| foo}}
1617
1618 {{echo|{{echo| }}bar}}
1619 !!result
1620 <pre>foo
1621 </pre>
1622 <pre>foo bar
1623 </pre>
1624 <pre>foo
1625 bar
1626 </pre>
1627 <pre>foo
1628 </pre>
1629 <pre>foo
1630 </pre>
1631 <pre>bar
1632 </pre>
1633 !!end
1634
1635 !! test
1636 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1637 !! input
1638 {{echo| }}a
1639
1640 {{echo|
1641 }}a
1642
1643 {{echo|
1644 b}}
1645
1646 {{echo|a
1647 }}b
1648
1649 {{echo|a
1650 }} b
1651 !!result
1652 <pre>a
1653 </pre>
1654 <p><br />
1655 </p>
1656 <pre>a
1657 </pre>
1658 <p><br />
1659 </p>
1660 <pre>b
1661 </pre>
1662 <p>a
1663 </p>
1664 <pre>b
1665 </pre>
1666 <p>a
1667 </p>
1668 <pre>b
1669 </pre>
1670 !!end
1671
1672 # TODO / maybe: fix wt2wt for this
1673 !! test
1674 Parsoid: Don't paragraph-wrap fosterable content
1675 !! options
1676 parsoid=wt2html
1677 !! input
1678 {|
1679 <td></td>
1680 <td></td>
1681
1682
1683
1684 |}
1685 !! result
1686 <table>
1687
1688 <tbody>
1689 <tr>
1690 <td></td>
1691
1692 <td></td></tr>
1693
1694
1695
1696 </tbody></table>
1697 !! end
1698
1699 !! test
1700 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1701 !! options
1702 parsoid=wt2html
1703 !! input
1704 {|
1705 <td>
1706 <td>
1707 </td>
1708
1709
1710
1711 |}
1712 !! result
1713 <table>
1714
1715 <tbody>
1716 <tr>
1717 <td></td>
1718
1719 <td>
1720 </td></tr>
1721
1722
1723
1724 </tbody></table>
1725 !! end
1726
1727
1728 #--------------------------------------------------------------------
1729 # Transclusion parameter whitespace stripping tests
1730 # Behavior is different for positional and named parameters
1731 #--------------------------------------------------------------------
1732 !! test
1733 Templates: Strip leading and trailing whitespace from named-param values
1734 !! input
1735 {{echo|1= a }}
1736
1737 {{echo|1= {{echo|b}} }}
1738
1739 {{echo| 1 =
1740 c }}
1741
1742 {{echo| 1 =
1743 * d
1744 }}
1745 !! result
1746 <p>a
1747 </p><p>b
1748 </p><p>c
1749 </p>
1750 <ul><li> d
1751 </li></ul>
1752
1753 !! end
1754
1755 !! test
1756 Templates: Don't strip whitespace from positional-param values
1757 !! input
1758 {{echo|a }}
1759
1760 {{echo|{{echo|b}} }}
1761
1762 {{echo| c
1763 }}
1764
1765 {{echo| {{echo|d}}
1766 }}
1767
1768 {{echo|
1769 e}}
1770
1771 {{echo|
1772 * f}}
1773
1774 {{echo|
1775 }}g
1776 !! result
1777 <p>a
1778 </p><p>b
1779 </p>
1780 <pre>c
1781 </pre>
1782 <p><br />
1783 </p>
1784 <pre>d
1785 </pre>
1786 <p><br />
1787 </p>
1788 <pre>e
1789 </pre>
1790 <p><br />
1791 </p>
1792 <ul><li> f
1793 </li></ul>
1794 <p><br />
1795 </p>
1796 <pre>g
1797 </pre>
1798 !! end
1799
1800 !! test
1801 Templates: Handle empty comment-and-ws-only lines correctly
1802 !! input
1803 {{echo|foo
1804 <!--should be ignored-->
1805 <!--should be ignored as well-->
1806 bar}}
1807 !! result
1808 <p>foo
1809 bar
1810 </p>
1811 !! end
1812
1813 #--------------------------------------------------------------------
1814 # Transclusion parameter escaping tests
1815 #--------------------------------------------------------------------
1816 !! test
1817 Templates: Parsoid parameter escaping test 1
1818 !! options
1819 parsoid
1820 !! input
1821 {{echo|[foo]|{{echo|[bar]}}}}
1822 !! result
1823 <p about="#mwt1" typeof="mw:Transclusion"
1824 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1825 !! end
1826
1827 !! test
1828 Parsoid: Pipes in external links in template parameter
1829 !! options
1830 parsoid
1831 !! input
1832 {{echo|[{{echo|http://example.com}} link]}}
1833 !! result
1834 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1835 !! end
1836
1837 !! test
1838 Parsoid: pipe in transclusion parameter
1839 !! options
1840 parsoid
1841 !! input
1842 {{echo|http://foo.com/a&#124;b}}
1843 !! result
1844 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1845 typeof="mw:Transclusion"
1846 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
1847 !! end
1848
1849 !! test
1850 Parsoid: Pipe in external link target and content in template parameter
1851 !! options
1852 parsoid=html2wt,wt2wt
1853 !! input
1854 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1855 !! result
1856 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1857 typeof="mw:Transclusion"
1858 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1859 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1860 !! end
1861
1862 !! test
1863 Templates: Dont escape already nowiki-escaped text in template parameters
1864 !! options
1865 parsoid=html2wt,wt2wt
1866 !! input
1867 {{echo|foo<nowiki>|</nowiki>bar}}
1868 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1869 {{echo|<nowiki></nowiki>}}
1870 !! result
1871 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"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>
1872 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"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>
1873 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
1874 </p>
1875 !! end
1876
1877 ## Bug 52824
1878 !! test
1879 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1880 !! options
1881 parsoid=html2wt,wt2wt
1882 !! input
1883 {{echo|{{echo|1=bar}}}}
1884 !! result
1885 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
1886 !! end
1887
1888 ###
1889 ### Parsoid-centric tests for testing RT edge cases for pre
1890 ###
1891
1892 !!test
1893 1a. Indent-Pre and Comments
1894 !!input
1895 a
1896 <!--a-->
1897 c
1898 !!result
1899 <pre>a
1900 </pre>
1901 <p>c
1902 </p>
1903 !!end
1904
1905 !!test
1906 1b. Indent-Pre and Comments
1907 !!input
1908 a
1909 <!--a-->
1910 c
1911 !!result
1912 <pre>a
1913 </pre>
1914 <p>c
1915 </p>
1916 !!end
1917
1918 !!test
1919 1c. Indent-Pre and Comments
1920 !!input
1921 <!--a--> a
1922
1923 <!--a--> a
1924 !!result
1925 <pre> a
1926 </pre>
1927 <pre> a
1928 </pre>
1929 !!end
1930
1931 !!test
1932 1d. Indent-Pre and Comments
1933 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1934 !!input
1935 <!--a--> a
1936
1937 <!--b-->b
1938 !!result
1939 <pre>a
1940 </pre>
1941 <pre>b
1942 </pre>
1943 !!end
1944
1945 !!test
1946 2a. Indent-Pre and tables
1947 !!input
1948 {|
1949 |-
1950 !h1!!h2
1951 |foo||bar
1952 |}
1953 !!result
1954 <table>
1955
1956 <tr>
1957 <th>h1</th>
1958 <th>h2
1959 </th>
1960 <td>foo</td>
1961 <td>bar
1962 </td></tr></table>
1963
1964 !!end
1965
1966 !!test
1967 2b. Indent-Pre and tables
1968 !!input
1969 {|
1970 |-
1971 |foo
1972 |}
1973 !!result
1974 <table>
1975
1976 <tr>
1977 <td>foo
1978 </td></tr></table>
1979
1980 !!end
1981
1982 !!test
1983 2c. Indent-Pre and tables (bug 42252)
1984 !!input
1985 {|
1986 |+ foo
1987 ! | bar
1988 |}
1989 !!result
1990 <table>
1991 <caption> foo
1992 </caption>
1993 <tr>
1994 <th> bar
1995 </th></tr></table>
1996
1997 !!end
1998
1999 !!test
2000 3a. Indent-Pre and block tags (single-line html)
2001 !!input
2002 <p> foo </p>
2003 <div> foo </div>
2004 <blockquote> foo </blockquote>
2005 <span> foo </span>
2006 !!result
2007 <p> foo </p>
2008 <div> foo </div>
2009 <blockquote> foo </blockquote>
2010 <pre><span> foo </span>
2011 </pre>
2012 !!end
2013
2014 !!test
2015 3b. Indent-Pre and block tags (pre-content on separate line)
2016 !!input
2017 <p>
2018 foo
2019 </p>
2020
2021 <div>
2022 foo
2023 </div>
2024
2025 <center>
2026 foo
2027 </center>
2028
2029 <blockquote>
2030 foo
2031 </blockquote>
2032
2033 <blockquote>
2034 <pre>
2035 foo
2036 </pre>
2037 </blockquote>
2038
2039 <table><tr><td>
2040 foo
2041 </td></tr></table>
2042
2043 <ul><li>
2044 foo
2045 </li></ul>
2046
2047 !!result
2048 <p>
2049 foo
2050 </p>
2051 <div>
2052 <pre>foo
2053 </pre>
2054 </div>
2055 <center>
2056 <pre>foo
2057 </pre>
2058 </center>
2059 <blockquote>
2060 <p> foo
2061 </p>
2062 </blockquote>
2063 <blockquote>
2064 <pre>
2065 foo
2066 </pre>
2067 </blockquote>
2068 <table><tr><td>
2069 <pre>foo
2070 </pre>
2071 </td></tr></table>
2072 <ul><li>
2073 foo
2074 </li></ul>
2075
2076 !!end
2077
2078 !!test
2079 4. Multiple spaces at start-of-line
2080 !!input
2081 <p> foo </p>
2082 foo
2083 {|
2084 |foo
2085 |}
2086 !!result
2087 <p> foo </p>
2088 <pre> foo
2089 </pre>
2090 <table>
2091 <tr>
2092 <td>foo
2093 </td></tr></table>
2094
2095 !!end
2096
2097 !! test
2098 5. White-space in indent-pre
2099 NOTE: the white-space char on 2nd line is significant
2100 !! input
2101 a<br/>
2102
2103 b
2104 !! result
2105 <pre>a<br />
2106
2107 b
2108 </pre>
2109 !! end
2110
2111 !! test
2112 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2113 !! input
2114 a
2115
2116 <!-- continue -->
2117 b
2118
2119 c
2120
2121 d
2122 !! result
2123 <pre>a
2124
2125 b
2126 </pre>
2127 <pre>c
2128
2129 </pre>
2130 <p>d
2131 </p>
2132 !! end
2133
2134 !! test
2135 7a. Indent-pre and category links
2136 !! options
2137 parsoid=wt2html,wt2wt
2138 !! input
2139 [[Category:foo]] <!-- No pre-wrapping -->
2140 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2141 !! result
2142 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2143 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2144 <link rel="mw:WikiLink/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2145 !! end
2146
2147 !! test
2148 7b. Indent-pre and category links
2149 !! options
2150 parsoid=wt2html,wt2wt
2151 !! input
2152 [[Category:foo]] a
2153 [[Category:foo]] {{echo|b}}
2154 !! result
2155 <pre>
2156 <link rel="mw:WikiLink/Category" href="./Category:Foo"> a
2157
2158 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2159 !! end
2160
2161 ###
2162 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2163 ###
2164
2165 !!test
2166 HTML-pre: 1. embedded newlines
2167 !!input
2168 <pre>foo</pre>
2169
2170 <pre>
2171 foo
2172 </pre>
2173
2174 <pre>
2175
2176 foo
2177 </pre>
2178
2179 <pre>
2180
2181
2182 foo
2183 </pre>
2184 !!result
2185 <pre>foo</pre>
2186 <pre>
2187 foo
2188 </pre>
2189 <pre>
2190
2191 foo
2192 </pre>
2193 <pre>
2194
2195
2196 foo
2197 </pre>
2198
2199 !!end
2200
2201 !!test
2202 HTML-pre: 2: indented text
2203 !!input
2204 <pre>
2205 foo
2206 </pre>
2207 !!result
2208 <pre>
2209 foo
2210 </pre>
2211
2212 !!end
2213
2214 !!test
2215 HTML-pre: 3: other wikitext
2216 !!input
2217 <pre>
2218 * foo
2219 # bar
2220 = no-h =
2221 '' no-italic ''
2222 [[ NoLink ]]
2223 </pre>
2224 !!result
2225 <pre>
2226 * foo
2227 # bar
2228 = no-h =
2229 '' no-italic ''
2230 [[ NoLink ]]
2231 </pre>
2232
2233 !!end
2234
2235 ###
2236 ### Definition lists
2237 ###
2238 !! test
2239 Simple definition
2240 !! input
2241 ; name : Definition
2242 !! result
2243 <dl><dt> name&#160;</dt><dd> Definition
2244 </dd></dl>
2245
2246 !! end
2247
2248 !! test
2249 Definition list for indentation only
2250 !! input
2251 : Indented text
2252 !! result
2253 <dl><dd> Indented text
2254 </dd></dl>
2255
2256 !! end
2257
2258 !! test
2259 Definition list with no space
2260 !! input
2261 ;name:Definition
2262 !! result
2263 <dl><dt>name</dt><dd>Definition
2264 </dd></dl>
2265
2266 !!end
2267
2268 !! test
2269 Definition list with URL link
2270 !! input
2271 ; http://example.com/ : definition
2272 !! result
2273 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
2274 </dd></dl>
2275
2276 !! end
2277
2278 !! test
2279 Definition list with bracketed URL link
2280 !! input
2281 ;[http://www.example.com/ Example]:Something about it
2282 !! result
2283 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
2284 </dd></dl>
2285
2286 !! end
2287
2288 !! test
2289 Definition list with wikilink containing colon
2290 !! input
2291 ; [[Help:FAQ]]: The least-read page on Wikipedia
2292 !! result
2293 <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
2294 </dd></dl>
2295
2296 !! end
2297
2298 # At Brion's and JeLuF's insistence... :)
2299 !! test
2300 Definition list with news link containing colon
2301 !! input
2302 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2303 !! result
2304 <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!
2305 </dd></dl>
2306
2307 !! end
2308
2309 !! test
2310 Malformed definition list with colon
2311 !! input
2312 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2313 !! result
2314 <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
2315 </dt></dl>
2316
2317 !! end
2318
2319 !! test
2320 Definition lists: colon in external link text
2321 !! input
2322 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2323 !! result
2324 <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
2325 </dd></dl>
2326
2327 !! end
2328
2329 !! test
2330 Definition lists: colon in HTML attribute
2331 !! input
2332 ;<b style="display: inline">bold</b>
2333 !! result
2334 <dl><dt><b style="display: inline">bold</b>
2335 </dt></dl>
2336
2337 !! end
2338
2339 !! test
2340 Definition lists: self-closed tag
2341 !! input
2342 ;one<br/>two : two-line fun
2343 !! result
2344 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2345 </dd></dl>
2346
2347 !! end
2348
2349 !! test
2350 Bug 11748: Literal closing tags
2351 !! input
2352 <dl>
2353 <dt>test 1</dt>
2354 <dd>test test test test test</dd>
2355 <dt>test 2</dt>
2356 <dd>test test test test test</dd>
2357 </dl>
2358 !! result
2359 <dl>
2360 <dt>test 1</dt>
2361 <dd>test test test test test</dd>
2362 <dt>test 2</dt>
2363 <dd>test test test test test</dd>
2364 </dl>
2365
2366 !! end
2367
2368 !! test
2369 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2370 !! input
2371 <ul><li>
2372 ; term : description
2373 * unordered
2374 </li>
2375 </ul>
2376 !! result
2377 <ul><li>
2378 <dl><dt> term&#160;</dt><dd> description
2379 </dd></dl>
2380 <ul><li> unordered
2381 </li></ul>
2382 </li>
2383 </ul>
2384
2385 !! end
2386
2387 !! test
2388
2389 Definition list with empty definition and following paragraph
2390 !! input
2391 ; term:
2392 Paragraph text
2393 !! result
2394 <dl><dt> term</dt><dd>
2395 </dd></dl>
2396 <p>Paragraph text
2397 </p>
2398 !! end
2399
2400 !! test
2401 Nested definition lists using html syntax
2402 !! input
2403 <dl><dd>
2404 <dl>
2405 <dd>Foo</dd>
2406 </dl>
2407 </dd></dl>
2408 !! result
2409 <dl><dd>
2410 <dl>
2411 <dd>Foo</dd>
2412 </dl>
2413 </dd></dl>
2414
2415 !! end
2416
2417 !! test
2418 Definition Lists: No nesting: Multiple dd's
2419 !! input
2420 ;x
2421 :a
2422 :b
2423 !! result
2424 <dl><dt>x
2425 </dt><dd>a
2426 </dd><dd>b
2427 </dd></dl>
2428
2429 !! end
2430
2431 !! test
2432 Definition Lists: Indentation: Regular
2433 !! input
2434 :i1
2435 ::i2
2436 :::i3
2437 !! result
2438 <dl><dd>i1
2439 <dl><dd>i2
2440 <dl><dd>i3
2441 </dd></dl>
2442 </dd></dl>
2443 </dd></dl>
2444
2445 !! end
2446
2447 !! test
2448 Definition Lists: Indentation: Missing 1st level
2449 !! input
2450 ::i2
2451 :::i3
2452 !! result
2453 <dl><dd><dl><dd>i2
2454 <dl><dd>i3
2455 </dd></dl>
2456 </dd></dl>
2457 </dd></dl>
2458
2459 !! end
2460
2461 !! test
2462 Definition Lists: Indentation: Multi-level indent
2463 !! input
2464 :::i3
2465 !! result
2466 <dl><dd><dl><dd><dl><dd>i3
2467 </dd></dl>
2468 </dd></dl>
2469 </dd></dl>
2470
2471 !! end
2472
2473 !! test
2474 Definition Lists: Hacky use to indent tables
2475 !! input
2476 ::{|
2477 |foo
2478 |bar
2479 |}
2480 this text
2481 should be left alone
2482 !! result
2483 <dl><dd><dl><dd><table>
2484 <tr>
2485 <td>foo
2486 </td>
2487 <td>bar
2488 </td></tr></table></dd></dl></dd></dl>
2489 <p>this text
2490 should be left alone
2491 </p>
2492 !! end
2493
2494 # Bug 52473
2495 !! test
2496 Definition Lists: Hacky use to indent tables (WS-insensitive)
2497 !! options
2498 parsoid
2499 !! input
2500 : {|
2501 |a
2502 |}
2503 !! result
2504 <dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
2505 !! end
2506 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2507 ## as an empty dt item. It also ignores all but the last ";" when followed
2508 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2509 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2510 ## ";"s.
2511 ##
2512 ## Ex: ";;t2 ::d2" is transformed into:
2513 ##
2514 ## <dl>
2515 ## <dt>t2 </dt>
2516 ## <dd>
2517 ## <dl>
2518 ## <dt></dt>
2519 ## <dd>d2</dd>
2520 ## </dl>
2521 ## </dd>
2522 ## </dl>
2523 ##
2524 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2525 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2526 ##
2527 ## <dl>
2528 ## <dt>
2529 ## <dl>
2530 ## <dt>t2 </dt>
2531 ## <dd>:d2</dd>
2532 ## </dl>
2533 ## </dt>
2534 ## </dl>
2535 ##
2536 ## All Parsoid only definition list tests have this difference.
2537 ##
2538 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2539 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2540
2541 !! test
2542 Table / list interaction: indented table with lists in table contents
2543 !! input
2544 :{|
2545 |-
2546 | a
2547 * b
2548 |-
2549 | c
2550 * d
2551 |}
2552 !! result
2553 <dl><dd><table>
2554
2555 <tr>
2556 <td> a
2557 <ul><li> b
2558 </li></ul>
2559 </td></tr>
2560 <tr>
2561 <td> c
2562 <ul><li> d
2563 </li></ul>
2564 </td></tr></table></dd></dl>
2565
2566 !! end
2567
2568 !!test
2569 Table / list interaction: lists nested in tables nested in indented lists
2570 !!input
2571 :{|
2572 |
2573 :a
2574 :b
2575 |
2576 *c
2577 *d
2578 |}
2579
2580 *e
2581 *f
2582 !!result
2583 <dl><dd><table>
2584 <tr>
2585 <td>
2586 <dl><dd>a
2587 </dd><dd>b
2588 </dd></dl>
2589 </td>
2590 <td>
2591 <ul><li>c
2592 </li><li>d
2593 </li></ul>
2594 </td></tr></table></dd></dl>
2595 <ul><li>e
2596 </li><li>f
2597 </li></ul>
2598
2599 !!end
2600
2601 !! test
2602 Definition Lists: Nesting: Multi-level (Parsoid only)
2603 !! options
2604 parsoid
2605 !! input
2606 ;t1 :d1
2607 ;;t2 ::d2
2608 ;;;t3 :::d3
2609 !! result
2610 <dl>
2611 <dt>t1 </dt>
2612 <dd>d1</dd>
2613 <dt>
2614 <dl>
2615 <dt>t2 </dt>
2616 <dd>:d2</dd>
2617 <dt>
2618 <dl>
2619 <dt>t3 </dt>
2620 <dd>::d3</dd>
2621 </dl>
2622 </dt>
2623 </dl>
2624 </dt>
2625 </dl>
2626
2627
2628 !! end
2629
2630
2631 !! test
2632 Definition Lists: Nesting: Test 2 (Parsoid only)
2633 !! options
2634 parsoid
2635 !! input
2636 ;t1
2637 ::d2
2638 !! result
2639 <dl>
2640 <dt>t1</dt>
2641 <dd>
2642 <dl>
2643 <dd>d2</dd>
2644 </dl>
2645 </dd>
2646 </dl>
2647
2648 !! end
2649
2650
2651 !! test
2652 Definition Lists: Nesting: Test 3 (Parsoid only)
2653 !! options
2654 parsoid
2655 !! input
2656 :;t1
2657 ::::d2
2658 !! result
2659 <dl>
2660 <dd>
2661 <dl>
2662 <dt>t1</dt>
2663 <dd>
2664 <dl>
2665 <dd>
2666 <dl>
2667 <dd>d2</dd>
2668 </dl>
2669 </dd>
2670 </dl>
2671 </dd>
2672 </dl>
2673 </dd>
2674 </dl>
2675
2676 !! end
2677
2678
2679 !! test
2680 Definition Lists: Nesting: Test 4
2681 !! input
2682 ::;t3
2683 :::d3
2684 !! result
2685 <dl><dd><dl><dd><dl><dt>t3
2686 </dt><dd>d3
2687 </dd></dl>
2688 </dd></dl>
2689 </dd></dl>
2690
2691 !! end
2692
2693
2694 ## The Parsoid team believes the following three test exposes a
2695 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2696 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2697 !! test
2698 Definition Lists: Mixed Lists: Test 1 (php)
2699 !! options
2700 php
2701 !! input
2702 :;* foo
2703 ::* bar
2704 :; baz
2705 !! result
2706 <dl><dd><dl><dt><ul><li> foo
2707 </li><li> bar
2708 </li></ul>
2709 </dt></dl>
2710 <dl><dt> baz
2711 </dt></dl>
2712 </dd></dl>
2713
2714 !! end
2715 !! test
2716 Definition Lists: Mixed Lists: Test 1 (parsoid)
2717 !! options
2718 parsoid
2719 !! input
2720 :;* foo
2721 ::* bar
2722 :; baz
2723 !! result
2724 <dl><dd><dl><dt><ul><li> foo
2725 </li></ul></dt><dd><ul><li> bar
2726 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2727 !! end
2728
2729 !! test
2730 Definition Lists: Mixed Lists: Test 2
2731 !! input
2732 *: d1
2733 *: d2
2734 !! result
2735 <ul><li><dl><dd> d1
2736 </dd><dd> d2
2737 </dd></dl>
2738 </li></ul>
2739
2740 !! end
2741
2742
2743 !! test
2744 Definition Lists: Mixed Lists: Test 3
2745 !! input
2746 *::: d1
2747 *::: d2
2748 !! result
2749 <ul><li><dl><dd><dl><dd><dl><dd> d1
2750 </dd><dd> d2
2751 </dd></dl>
2752 </dd></dl>
2753 </dd></dl>
2754 </li></ul>
2755
2756 !! end
2757
2758
2759 !! test
2760 Definition Lists: Mixed Lists: Test 4
2761 !! input
2762 *;d1 :d2
2763 *;d3 :d4
2764 !! result
2765 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2766 </dd><dt>d3&#160;</dt><dd>d4
2767 </dd></dl>
2768 </li></ul>
2769
2770 !! end
2771
2772
2773 !! test
2774 Definition Lists: Mixed Lists: Test 5
2775 !! input
2776 *:d1
2777 *:: d2
2778 !! result
2779 <ul><li><dl><dd>d1
2780 <dl><dd> d2
2781 </dd></dl>
2782 </dd></dl>
2783 </li></ul>
2784
2785 !! end
2786
2787
2788 !! test
2789 Definition Lists: Mixed Lists: Test 6
2790 !! input
2791 #*:d1
2792 #*::: d3
2793 !! result
2794 <ol><li><ul><li><dl><dd>d1
2795 <dl><dd><dl><dd> d3
2796 </dd></dl>
2797 </dd></dl>
2798 </dd></dl>
2799 </li></ul>
2800 </li></ol>
2801
2802 !! end
2803
2804
2805 !! test
2806 Definition Lists: Mixed Lists: Test 7
2807 !! input
2808 :* d1
2809 :* d2
2810 !! result
2811 <dl><dd><ul><li> d1
2812 </li><li> d2
2813 </li></ul>
2814 </dd></dl>
2815
2816 !! end
2817
2818
2819 !! test
2820 Definition Lists: Mixed Lists: Test 8
2821 !! input
2822 :* d1
2823 ::* d2
2824 !! result
2825 <dl><dd><ul><li> d1
2826 </li></ul>
2827 <dl><dd><ul><li> d2
2828 </li></ul>
2829 </dd></dl>
2830 </dd></dl>
2831
2832 !! end
2833
2834
2835 !! test
2836 Definition Lists: Mixed Lists: Test 9
2837 !! input
2838 *;foo :bar
2839 !! result
2840 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2841 </dd></dl>
2842 </li></ul>
2843
2844 !! end
2845
2846
2847 !! test
2848 Definition Lists: Mixed Lists: Test 10
2849 !! input
2850 *#;foo :bar
2851 !! result
2852 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2853 </dd></dl>
2854 </li></ol>
2855 </li></ul>
2856
2857 !! end
2858
2859 # The Parsoid team disagrees with the PHP parser's seemingly-random
2860 # rules regarding dd/dt on the next two tests. Parsoid is more
2861 # consistent, and recognizes the shared nesting and keeps the
2862 # still-open tags around until the nesting is complete.
2863
2864 !! test
2865 Definition Lists: Mixed Lists: Test 11 (php)
2866 !! options
2867 php
2868 !! input
2869 *#*#;*;;foo :bar
2870 *#*#;boo :baz
2871 !! result
2872 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2873 </dt></dl>
2874 </dd></dl>
2875 </li></ul>
2876 </dd></dl>
2877 <dl><dt>boo&#160;</dt><dd>baz
2878 </dd></dl>
2879 </li></ol>
2880 </li></ul>
2881 </li></ol>
2882 </li></ul>
2883
2884 !! end
2885 !! test
2886 Definition Lists: Mixed Lists: Test 11 (parsoid)
2887 !! options
2888 parsoid
2889 !! input
2890 *#*#;*;;foo :bar
2891 *#*#;boo :baz
2892 !! result
2893 <ul>
2894 <li>
2895 <ol>
2896 <li>
2897 <ul>
2898 <li>
2899 <ol>
2900 <li>
2901 <dl>
2902 <dt>
2903 <ul>
2904 <li>
2905 <dl>
2906 <dt>
2907 <dl>
2908 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2909 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2910 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2911 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2912 !! end
2913
2914
2915 !! test
2916 Definition Lists: Weird Ones: Test 1 (php)
2917 !! options
2918 php
2919 !! input
2920 *#;*::;; foo : bar (who uses this?)
2921 !! result
2922 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2923 </dt></dl>
2924 </dd></dl>
2925 </dd></dl>
2926 </dd></dl>
2927 </li></ul>
2928 </dd></dl>
2929 </li></ol>
2930 </li></ul>
2931
2932 !! end
2933 !! test
2934 Definition Lists: Weird Ones: Test 1 (parsoid)
2935 !! options
2936 parsoid
2937 !! input
2938 *#;*::;; foo : bar (who uses this?)
2939 !! result
2940 <ul>
2941 <li>
2942 <ol>
2943 <li>
2944 <dl>
2945 <dt>
2946 <ul>
2947 <li>
2948 <dl>
2949 <dd>
2950 <dl>
2951 <dd>
2952 <dl>
2953 <dt>
2954 <dl>
2955 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2956 <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>
2957 !! end
2958
2959 ###
2960 ### External links
2961 ###
2962 !! test
2963 External links: non-bracketed
2964 !! input
2965 Non-bracketed: http://example.com
2966 !! result
2967 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2968 </p>
2969 !! end
2970
2971 !! test
2972 External links: numbered
2973 !! input
2974 Numbered: [http://example.com]
2975 Numbered: [http://example.net]
2976 Numbered: [http://example.com]
2977 !! result
2978 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2979 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2980 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2981 </p>
2982 !!end
2983
2984 !! test
2985 External links: specified text
2986 !! input
2987 Specified text: [http://example.com link]
2988 !! result
2989 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2990 </p>
2991 !!end
2992
2993 !! test
2994 External links: trail
2995 !! input
2996 Linktrails should not work for external links: [http://example.com link]s
2997 !! result
2998 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2999 </p>
3000 !! end
3001
3002 !! test
3003 External links: dollar sign in URL
3004 !! input
3005 http://example.com/1$2345
3006 !! result
3007 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3008 </p>
3009 !! end
3010
3011 !! test
3012 External links: dollar sign in URL (named)
3013 !! input
3014 [http://example.com/1$2345]
3015 !! result
3016 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3017 </p>
3018 !!end
3019
3020 !! test
3021 External links: open square bracket forbidden in URL (bug 4377)
3022 !! input
3023 http://example.com/1[2345
3024 !! result
3025 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3026 </p>
3027 !! end
3028
3029 !! test
3030 External links: open square bracket forbidden in URL (named) (bug 4377)
3031 !! input
3032 [http://example.com/1[2345]
3033 !! result
3034 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3035 </p>
3036 !!end
3037
3038 !! test
3039 External links: nowiki in URL link text (bug 6230)
3040 !!input
3041 [http://example.com/ <nowiki>''example site''</nowiki>]
3042 !! result
3043 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3044 </p>
3045 !! end
3046
3047 !! test
3048 External links: newline forbidden in text (bug 6230 regression check)
3049 !! input
3050 [http://example.com/ first
3051 second]
3052 !! result
3053 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3054 second]
3055 </p>
3056 !!end
3057
3058 !! test
3059 External links: Pipe char between url and text
3060 !! input
3061 [http://example.com | link]
3062 !! result
3063 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3064 </p>
3065 !!end
3066
3067 !! test
3068 External links: protocol-relative URL in brackets
3069 !! input
3070 [//example.com/ Test]
3071 !! result
3072 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3073 </p>
3074 !! end
3075
3076 !! test
3077 External links: protocol-relative URL in brackets without text
3078 !! input
3079 [//example.com]
3080 !! result
3081 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3082 </p>
3083 !! end
3084
3085 !! test
3086 External links: protocol-relative URL in free text is left alone
3087 !! input
3088 //example.com/Foo
3089 !! result
3090 <p>//example.com/Foo
3091 </p>
3092 !!end
3093
3094 !! test
3095 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3096 !! input
3097 foo//example.com/Foo
3098 !! result
3099 <p>foo//example.com/Foo
3100 </p>
3101 !! end
3102
3103 !! test
3104 External image
3105 !! input
3106 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3107 !! result
3108 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3109 </p>
3110 !! end
3111
3112 !! test
3113 External image from https
3114 !! input
3115 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3116 !! result
3117 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3118 </p>
3119 !! end
3120
3121 !! test
3122 External image (when not allowed)
3123 !! options
3124 wgAllowExternalImages=0
3125 !! input
3126 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3127 !! result
3128 <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>
3129 </p>
3130 !! end
3131
3132 !! test
3133 Link to non-http image, no img tag
3134 !! input
3135 Link to non-http image, no img tag: ftp://example.com/test.jpg
3136 !! result
3137 <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>
3138 </p>
3139 !! end
3140
3141 !! test
3142 External links: terminating separator
3143 !! input
3144 Terminating separator: http://example.com/thing,
3145 !! result
3146 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3147 </p>
3148 !! end
3149
3150 !! test
3151 External links: intervening separator
3152 !! input
3153 Intervening separator: http://example.com/1,2,3
3154 !! result
3155 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3156 </p>
3157 !! end
3158
3159 !! test
3160 External links: old bug with URL in query
3161 !! input
3162 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3163 !! result
3164 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3165 </p>
3166 !! end
3167
3168 !! test
3169 External links: old URL-in-URL bug, mixed protocols
3170 !! input
3171 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3172 !! result
3173 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3174 </p>
3175 !!end
3176
3177 !! test
3178 External links: URL in text
3179 !! input
3180 URL in text: [http://example.com http://example.com]
3181 !! result
3182 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3183 </p>
3184 !! end
3185
3186 !! test
3187 External links: Clickable images
3188 !! input
3189 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3190 !! result
3191 <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>
3192 </p>
3193 !!end
3194
3195 !! test
3196 External links: raw ampersand
3197 !! input
3198 Old &amp; use: http://x&y
3199 !! result
3200 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3201 </p>
3202 !! end
3203
3204 !! test
3205 External links: encoded ampersand
3206 !! input
3207 Old &amp; use: http://x&amp;y
3208 !! result
3209 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3210 </p>
3211 !! end
3212
3213 !! test
3214 External links: encoded equals (bug 6102)
3215 !! input
3216 http://example.com/?foo&#61;bar
3217 !! result
3218 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3219 </p>
3220 !! end
3221
3222 !! test
3223 External links: [raw ampersand]
3224 !! input
3225 Old &amp; use: [http://x&y]
3226 !! result
3227 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3228 </p>
3229 !! end
3230
3231 !! test
3232 External links: [encoded ampersand]
3233 !! input
3234 Old &amp; use: [http://x&amp;y]
3235 !! result
3236 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3237 </p>
3238 !! end
3239
3240 !! test
3241 External links: [encoded equals] (bug 6102)
3242 !! input
3243 [http://example.com/?foo&#61;bar]
3244 !! result
3245 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3246 </p>
3247 !! end
3248
3249 !! test
3250 External links: [IDN ignored character reference in hostname; strip it right off]
3251 !! input
3252 [http://e&zwnj;xample.com/]
3253 !! result
3254 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3255 </p>
3256 !! end
3257
3258 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3259 # Where an external link could easily circumvent the sanitization of the text of
3260 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3261 # test demands a higher standard. That's a bit strange.
3262 #
3263 # Example:
3264 #
3265 # http://e‌xample.com -> [http://example.com|http://example.com]
3266 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3267 #
3268 # The first example is sanitized, but the second is not. Any security benefits
3269 # from this production are trivial to circumvent. Either remove this test and
3270 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3271 # the test accordingly.
3272 #
3273 # All our love,
3274 # The Parsoid team.
3275 !! test
3276 External links: IDN ignored character reference in hostname; strip it right off
3277 !! input
3278 http://e&zwnj;xample.com/
3279 !! result
3280 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3281 </p>
3282 !! end
3283
3284 !! test
3285 External links: www.jpeg.org (bug 554)
3286 !! input
3287 http://www.jpeg.org
3288 !!result
3289 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 External links: URL within URL (original bug 2)
3295 !! input
3296 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3297 !! result
3298 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3299 </p>
3300 !! end
3301
3302 !! test
3303 BUG 361: URL inside bracketed URL
3304 !! input
3305 [http://www.example.com/foo http://www.example.com/bar]
3306 !! result
3307 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3308 </p>
3309 !! end
3310
3311 !! test
3312 BUG 361: URL within URL, not bracketed
3313 !! input
3314 http://www.example.com/foo?=http://www.example.com/bar
3315 !! result
3316 <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>
3317 </p>
3318 !! end
3319
3320 !! test
3321 BUG 289: ">"-token in URL-tail
3322 !! input
3323 http://www.example.com/<hello>
3324 !! result
3325 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3326 </p>
3327 !!end
3328
3329 !! test
3330 BUG 289: literal ">"-token in URL-tail
3331 !! input
3332 http://www.example.com/<b>html</b>
3333 !! result
3334 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3335 </p>
3336 !!end
3337
3338 !! test
3339 BUG 289: ">"-token in bracketed URL
3340 !! input
3341 [http://www.example.com/<hello> stuff]
3342 !! result
3343 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3344 </p>
3345 !!end
3346
3347 !! test
3348 BUG 289: literal ">"-token in bracketed URL
3349 !! input
3350 [http://www.example.com/<b>html</b> stuff]
3351 !! result
3352 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3353 </p>
3354 !!end
3355
3356 !! test
3357 BUG 289: literal double quote at end of URL
3358 !! input
3359 http://www.example.com/"hello"
3360 !! result
3361 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3362 </p>
3363 !!end
3364
3365 !! test
3366 BUG 289: literal double quote in bracketed URL
3367 !! input
3368 [http://www.example.com/"hello" stuff]
3369 !! result
3370 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3371 </p>
3372 !!end
3373
3374 !! test
3375 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3376 !! input
3377 [http://www.example.com test]
3378 !! result
3379 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3380 </p>
3381 !! end
3382
3383 !! test
3384 External links: link text with spaces
3385 !! input
3386 [http://www.example.com a b c]
3387 [http://www.example.com ''a'' ''b'']
3388 !! result
3389 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3390 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3391 </p>
3392 !! end
3393
3394 !! test
3395 External links: wiki links within external link (Bug 3695)
3396 !! input
3397 [http://example.com [[wikilink]] embedded in ext link]
3398 !! result
3399 <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>
3400 </p>
3401 !! end
3402
3403 !! test
3404 BUG 787: Links with one slash after the url protocol are invalid
3405 !! input
3406 http:/example.com
3407
3408 [http:/example.com title]
3409 !! result
3410 <p>http:/example.com
3411 </p><p>[http:/example.com title]
3412 </p>
3413 !! end
3414
3415 !! test
3416 Bracketed external links with template-generated invalid target
3417 !! input
3418 [{{echo|http:/example.com}} title]
3419 !! result
3420 <p>[http:/example.com title]
3421 </p>
3422 !! end
3423
3424 !! test
3425 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3426 !! input
3427 ''[http://example.com text'']
3428 [http://example.com '''text]'''
3429 ''Something [http://example.com in italic'']
3430 ''Something [http://example.com mixed''''', even bold]'''
3431 '''''Now [http://example.com both''''']
3432 !! result
3433 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3434 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3435 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3436 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3437 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3438 </p>
3439 !! end
3440
3441
3442 !! test
3443 Bug 4781: %26 in URL
3444 !! input
3445 http://www.example.com/?title=AT%26T
3446 !! result
3447 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3448 </p>
3449 !! end
3450
3451 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3452 # % is actually legal in HTML5. Any change in output would need testing though.
3453 !! test
3454 Bug 4781, 5267: %25 in URL
3455 !! input
3456 http://www.example.com/?title=100%25_Bran
3457 !! result
3458 <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>
3459 </p>
3460 !! end
3461
3462 !! test
3463 Bug 4781, 5267: %28, %29 in URL
3464 !! input
3465 http://www.example.com/?title=Ben-Hur_%281959_film%29
3466 !! result
3467 <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>
3468 </p>
3469 !! end
3470
3471
3472 !! test
3473 Bug 4781: %26 in autonumber URL
3474 !! input
3475 [http://www.example.com/?title=AT%26T]
3476 !! result
3477 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3478 </p>
3479 !! end
3480
3481 !! test
3482 Bug 4781, 5267: %26 in autonumber URL
3483 !! input
3484 [http://www.example.com/?title=100%25_Bran]
3485 !! result
3486 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3487 </p>
3488 !! end
3489
3490 !! test
3491 Bug 4781, 5267: %28, %29 in autonumber URL
3492 !! input
3493 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3494 !! result
3495 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3496 </p>
3497 !! end
3498
3499
3500 !! test
3501 Bug 4781: %26 in bracketed URL
3502 !! input
3503 [http://www.example.com/?title=AT%26T link]
3504 !! result
3505 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3506 </p>
3507 !! end
3508
3509 !! test
3510 Bug 4781, 5267: %26 in bracketed URL
3511 !! input
3512 [http://www.example.com/?title=100%25_Bran link]
3513 !! result
3514 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3515 </p>
3516 !! end
3517
3518 !! test
3519 Bug 4781, 5267: %28, %29 in bracketed URL
3520 !! input
3521 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3522 !! result
3523 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3524 </p>
3525 !! end
3526
3527 !! test
3528 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3529 !! input
3530 Some [http://example.com/ pretty ''italics'' and stuff]!
3531 !! result
3532 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3533 </p>
3534 !! end
3535
3536 !! test
3537 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3538 !! input
3539 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3540 !! result
3541 <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>
3542 </p>
3543 !! end
3544
3545 !! test
3546 External link containing double-single-quotes with no space separating the url from text in italics
3547 !! input
3548 [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]].]
3549 !! result
3550 <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>
3551 </p>
3552 !! end
3553
3554 !! test
3555 External link with comments in link text
3556 !! input
3557 [http://www.google.com Google <!-- comment -->]
3558 !! result
3559 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3560 </p>
3561 !! end
3562
3563 !! test
3564 URL-encoding in URL functions (single parameter)
3565 !! input
3566 {{localurl:Some page|amp=&}}
3567 !! result
3568 <p>/index.php?title=Some_page&amp;amp=&amp;
3569 </p>
3570 !! end
3571
3572 !! test
3573 URL-encoding in URL functions (multiple parameters)
3574 !! input
3575 {{localurl:Some page|q=?&amp=&}}
3576 !! result
3577 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3578 </p>
3579 !! end
3580
3581 !! test
3582 Brackets in urls
3583 !! input
3584 http://example.com/index.php?foozoid%5B%5D=bar
3585
3586 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3587 !! result
3588 <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>
3589 </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>
3590 </p>
3591 !! end
3592
3593 !! test
3594 IPv6 urls (bug 21261)
3595 !! options
3596 disabled
3597 !! input
3598 http://[2404:130:0:1000::187:2]/index.php
3599 !! result
3600 <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>
3601 </p>
3602 !! end
3603
3604 !! test
3605 Non-extlinks in brackets
3606 !! input
3607 [foo]
3608 [foo bar]
3609 [foo ''bar'']
3610 [fool's] errand
3611 [fool's errand]
3612 [{{echo|foo}}]
3613 [{{echo|foo}} bar]
3614 [{{echo|foo}} ''bar'']
3615 [{{echo|foo}}l's] errand
3616 [{{echo|foo}}l's errand]
3617 [url={{echo|foo}}]
3618 [url=http://example.com]
3619 !! result
3620 <p>[foo]
3621 [foo bar]
3622 [foo <i>bar</i>]
3623 [fool's] errand
3624 [fool's errand]
3625 [foo]
3626 [foo bar]
3627 [foo <i>bar</i>]
3628 [fool's] errand
3629 [fool's errand]
3630 [url=foo]
3631 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3632 </p>
3633 !! end
3634
3635 !! test
3636 Parsoid: Percent encoding in external links
3637 !! options
3638 parsoid
3639 !! input
3640 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3641 !! result
3642 <p><a rel="mw:ExtLink"
3643 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3644 !! end
3645
3646 !! test
3647 Parsoid: use url link syntax for links where the content is equal the link
3648 target
3649 !! options
3650 parsoid
3651 !! input
3652 http://example.com
3653 !! result
3654 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3655 !! end
3656
3657 ###
3658 ### Quotes
3659 ###
3660
3661 !! test
3662 Quotes
3663 !! input
3664 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3665
3666 Normal text. '''''Bold italic text.''''' Normal text.
3667 !!result
3668 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3669 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3670 </p>
3671 !! end
3672
3673
3674 !! test
3675 Unclosed and unmatched quotes (php)
3676 !! options
3677 php
3678 !! input
3679 '''''Bold italic text '''with bold deactivated''' in between.'''''
3680
3681 '''''Bold italic text ''with italic deactivated'' in between.'''''
3682
3683 '''Bold text..
3684
3685 ..spanning two paragraphs (should not work).'''
3686
3687 '''Bold tag left open
3688
3689 ''Italic tag left open
3690
3691 Normal text.
3692
3693 <!-- Unmatching number of opening, closing tags: -->
3694 '''This year''''s election ''should'' beat '''last year''''s.
3695
3696 ''Tom'''s car is bigger than ''Susan'''s.
3697
3698 Plain ''italic'''s plain
3699 !! result
3700 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3701 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3702 </p><p><b>Bold text..</b>
3703 </p><p>..spanning two paragraphs (should not work).
3704 </p><p><b>Bold tag left open</b>
3705 </p><p><i>Italic tag left open</i>
3706 </p><p>Normal text.
3707 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3708 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3709 </p><p>Plain <i>italic'</i>s plain
3710 </p>
3711 !! end
3712 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3713 # parser strips. The wikitext contains just the first half of the bold
3714 # quote pair.
3715 !! test
3716 Unclosed and unmatched quotes (parsoid)
3717 !! options
3718 parsoid
3719 !! input
3720 '''''Bold italic text '''with bold deactivated''' in between.'''''
3721
3722 '''''Bold italic text ''with italic deactivated'' in between.'''''
3723
3724 '''Bold text..
3725
3726 ..spanning two paragraphs (should not work).'''
3727
3728 '''Bold tag left open
3729
3730 ''Italic tag left open
3731
3732 Normal text.
3733
3734 <!-- Unmatching number of opening, closing tags: -->
3735 '''This year''''s election ''should'' beat '''last year''''s.
3736
3737 ''Tom'''s car is bigger than ''Susan'''s.
3738
3739 Plain ''italic'''s plain
3740 !! result
3741 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3742 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3743 </p><p><b>Bold text..</b>
3744 </p><p>..spanning two paragraphs (should not work).<b></b>
3745 </p><p><b>Bold tag left open</b>
3746 </p><p><i>Italic tag left open</i>
3747 </p><p>Normal text.
3748 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3749 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3750 </p><p>Plain <i>italic'</i>s plain
3751 </p>
3752 !! end
3753
3754 ###
3755 ### Tables
3756 ###
3757 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3758 ###
3759
3760 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3761 # is the bare minimum required by the spec, see:
3762 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3763 !! test
3764 A table with no data. (php)
3765 !! options
3766 php
3767 !! input
3768 {||}
3769 !! result
3770 !! end
3771 # Parsoid team replies: empty table tags are legal in HTML5
3772 !! test
3773 A table with no data. (parsoid)
3774 !! options
3775 parsoid
3776 !! input
3777 {||}
3778 !! result
3779 <table></table>
3780 !! end
3781
3782 # A table with nothing but a caption is invalid XHTML, we might want to render
3783 # this as <p>caption</p>
3784 !! test
3785 A table with nothing but a caption (php)
3786 !! options
3787 php
3788 !! input
3789 {|
3790 |+ caption
3791 |}
3792 !! result
3793 <table>
3794 <caption> caption
3795 </caption><tr><td></td></tr></table>
3796
3797 !! end
3798 # Parsoid team replies: table with only a caption is legal in HTML5
3799 !! test
3800 A table with nothing but a caption (parsoid)
3801 !! options
3802 parsoid
3803 !! input
3804 {|
3805 |+ caption
3806 |}
3807 !! result
3808 <table><caption> caption</caption></table>
3809 !! end
3810
3811 !! test
3812 A table with caption with default-spaced attributes and a table row
3813 !! input
3814 {|
3815 |+ style="color: red;" | caption1
3816 |-
3817 | foo
3818 |}
3819 !! result
3820 <table>
3821 <caption style="color: red;"> caption1
3822 </caption>
3823 <tr>
3824 <td> foo
3825 </td></tr></table>
3826
3827 !! end
3828
3829 !! test
3830 A table with captions with non-default spaced attributes and a table row
3831 !! input
3832 {|
3833 |+style="color: red;"|caption2
3834 |+ style="color: red;"| caption3
3835 |-
3836 | foo
3837 |}
3838 !! result
3839 <table>
3840 <caption style="color: red;">caption2
3841 </caption>
3842 <caption style="color: red;"> caption3
3843 </caption>
3844 <tr>
3845 <td> foo
3846 </td></tr></table>
3847
3848 !! end
3849
3850 !! test
3851 Table td-cell syntax variations
3852 !! input
3853 {|
3854 | foo bar foo | baz
3855 | foo bar foo || baz
3856 | style='color:red;' | baz
3857 | style='color:red;' || baz
3858 |}
3859 !! result
3860 <table>
3861 <tr>
3862 <td> baz
3863 </td>
3864 <td> foo bar foo </td>
3865 <td> baz
3866 </td>
3867 <td style="color:red;"> baz
3868 </td>
3869 <td> style='color:red;' </td>
3870 <td> baz
3871 </td></tr></table>
3872
3873 !! end
3874
3875 !! test
3876 Simple table
3877 !! input
3878 {|
3879 | 1 || 2
3880 |-
3881 | 3 || 4
3882 |}
3883 !! result
3884 <table>
3885 <tr>
3886 <td> 1 </td>
3887 <td> 2
3888 </td></tr>
3889 <tr>
3890 <td> 3 </td>
3891 <td> 4
3892 </td></tr></table>
3893
3894 !! end
3895
3896 !! test
3897 Simple table but with multiple dashes for row wikitext
3898 !! input
3899 {|
3900 | foo
3901 |-----
3902 | bar
3903 |}
3904 !! result
3905 <table>
3906 <tr>
3907 <td> foo
3908 </td></tr>
3909 <tr>
3910 <td> bar
3911 </td></tr></table>
3912
3913 !! end
3914 !! test
3915 Multiplication table
3916 !! input
3917 {| border="1" cellpadding="2"
3918 |+Multiplication table
3919 |-
3920 ! &times; !! 1 !! 2 !! 3
3921 |-
3922 ! 1
3923 | 1 || 2 || 3
3924 |-
3925 ! 2
3926 | 2 || 4 || 6
3927 |-
3928 ! 3
3929 | 3 || 6 || 9
3930 |-
3931 ! 4
3932 | 4 || 8 || 12
3933 |-
3934 ! 5
3935 | 5 || 10 || 15
3936 |}
3937 !! result
3938 <table border="1" cellpadding="2">
3939 <caption>Multiplication table
3940 </caption>
3941 <tr>
3942 <th> &#215; </th>
3943 <th> 1 </th>
3944 <th> 2 </th>
3945 <th> 3
3946 </th></tr>
3947 <tr>
3948 <th> 1
3949 </th>
3950 <td> 1 </td>
3951 <td> 2 </td>
3952 <td> 3
3953 </td></tr>
3954 <tr>
3955 <th> 2
3956 </th>
3957 <td> 2 </td>
3958 <td> 4 </td>
3959 <td> 6
3960 </td></tr>
3961 <tr>
3962 <th> 3
3963 </th>
3964 <td> 3 </td>
3965 <td> 6 </td>
3966 <td> 9
3967 </td></tr>
3968 <tr>
3969 <th> 4
3970 </th>
3971 <td> 4 </td>
3972 <td> 8 </td>
3973 <td> 12
3974 </td></tr>
3975 <tr>
3976 <th> 5
3977 </th>
3978 <td> 5 </td>
3979 <td> 10 </td>
3980 <td> 15
3981 </td></tr></table>
3982
3983 !! end
3984
3985 !! test
3986 Accept "||" in table headings
3987 !! input
3988 {|
3989 !h1 || h2
3990 |}
3991 !! result
3992 <table>
3993 <tr>
3994 <th>h1 </th>
3995 <th> h2
3996 </th></tr></table>
3997
3998 !! end
3999
4000 !! test
4001 Accept "||" in indented table headings
4002 !! input
4003 :{|
4004 !h1 || h2
4005 |}
4006 !! result
4007 <dl><dd><table>
4008 <tr>
4009 <th>h1 </th>
4010 <th> h2
4011 </th></tr></table></dd></dl>
4012
4013 !! end
4014
4015 !! test
4016 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4017 !! input
4018 {|
4019 !| h1
4020 || a
4021 |}
4022 !! result
4023 <table>
4024 <tr>
4025 <th> h1
4026 </th>
4027 <td> a
4028 </td></tr></table>
4029
4030 !! end
4031
4032 !!test
4033 Accept "| !" at start of line in tables (ignore !-attribute)
4034 !!input
4035 {|
4036 |-
4037 | !style="color:red" | bar
4038 |}
4039 !!result
4040 <table>
4041
4042 <tr>
4043 <td> bar
4044 </td></tr></table>
4045
4046 !!end
4047
4048 !!test
4049 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 +/-
4050 !!input
4051 {|
4052 |-
4053 |style='color:red;'|+1
4054 |style='color:blue;'|-1
4055 |-
4056 | 1 || 2 || 3
4057 | 1 ||+2 ||-3
4058 |-
4059 | +1
4060 | -1
4061 |}
4062 !!result
4063 <table>
4064
4065 <tr>
4066 <td style="color:red;">+1
4067 </td>
4068 <td style="color:blue;">-1
4069 </td></tr>
4070 <tr>
4071 <td> 1 </td>
4072 <td> 2 </td>
4073 <td> 3
4074 </td>
4075 <td> 1 </td>
4076 <td>+2 </td>
4077 <td>-3
4078 </td></tr>
4079 <tr>
4080 <td> +1
4081 </td>
4082 <td> -1
4083 </td></tr></table>
4084
4085 !!end
4086
4087 !! test
4088 Table rowspan
4089 !! input
4090 {| border=1
4091 | Cell 1, row 1
4092 |rowspan=2| Cell 2, row 1 (and 2)
4093 | Cell 3, row 1
4094 |-
4095 | Cell 1, row 2
4096 | Cell 3, row 2
4097 |}
4098 !! result
4099 <table border="1">
4100 <tr>
4101 <td> Cell 1, row 1
4102 </td>
4103 <td rowspan="2"> Cell 2, row 1 (and 2)
4104 </td>
4105 <td> Cell 3, row 1
4106 </td></tr>
4107 <tr>
4108 <td> Cell 1, row 2
4109 </td>
4110 <td> Cell 3, row 2
4111 </td></tr></table>
4112
4113 !! end
4114
4115 !! test
4116 Nested table
4117 !! input
4118 {| border=1
4119 | &alpha;
4120 |
4121 {| bgcolor=#ABCDEF border=2
4122 |nested
4123 |-
4124 |table
4125 |}
4126 |the original table again
4127 |}
4128 !! result
4129 <table border="1">
4130 <tr>
4131 <td> &#945;
4132 </td>
4133 <td>
4134 <table bgcolor="#ABCDEF" border="2">
4135 <tr>
4136 <td>nested
4137 </td></tr>
4138 <tr>
4139 <td>table
4140 </td></tr></table>
4141 </td>
4142 <td>the original table again
4143 </td></tr></table>
4144
4145 !! end
4146
4147 !! test
4148 Invalid attributes in table cell (bug 1830)
4149 !! input
4150 {|
4151 |Cell:|broken
4152 |}
4153 !! result
4154 <table>
4155 <tr>
4156 <td>broken
4157 </td></tr></table>
4158
4159 !! end
4160
4161
4162 !! test
4163 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4164 !! input
4165 {|
4166 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4167 !! result
4168 <table>
4169 <tr>
4170 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4171 <td>]" onmouseover="alert(document.cookie)"&gt;test
4172 </td>
4173 </tr>
4174 </table>
4175
4176 !! end
4177
4178
4179 !! test
4180 Indented table markup mixed with indented pre content (proposed in bug 6200)
4181 !! input
4182 <table>
4183 <tr>
4184 <td>
4185 Text that should be rendered preformatted
4186 </td>
4187 </tr>
4188 </table>
4189 !! result
4190 <table>
4191 <tr>
4192 <td>
4193 <pre>Text that should be rendered preformatted
4194 </pre>
4195 </td>
4196 </tr>
4197 </table>
4198
4199 !! end
4200
4201 !! test
4202 Template-generated table cell attributes and cell content
4203 !! input
4204 {|
4205 |{{table_attribs}}
4206 | {{table_attribs}}
4207 |}
4208 !! result
4209 <table>
4210 <tr>
4211 <td style="color: red"> Foo
4212 </td>
4213 <td style="color: red"> Foo
4214 </td></tr></table>
4215
4216 !! end
4217
4218 !! test
4219 Template-generated table cell attributes and cell content (2)
4220 !! input
4221 {|
4222 |align=center {{table_attribs}}
4223 |}
4224 !! result
4225 <table>
4226 <tr>
4227 <td align="center" style="color: red"> Foo
4228 </td></tr></table>
4229
4230 !! end
4231
4232 !! test
4233 Template-generated table cell attributes and cell content (3)
4234 !! input
4235 {|
4236 |align=center {{table_cells}}
4237 |}
4238 !! result
4239 <table>
4240 <tr>
4241 <td align="center" style="color: red"> Foo </td>
4242 <td> Bar </td>
4243 <td> Baz
4244 </td></tr></table>
4245
4246 !! end
4247
4248 !! test
4249 Table with row followed by newlines and table heading
4250 !! input
4251 {|
4252 |-
4253
4254 ! foo
4255 |}
4256 !! result
4257 <table>
4258
4259
4260 <tr>
4261 <th> foo
4262 </th></tr></table>
4263
4264 !! end
4265
4266 !! test
4267 Table with empty line following the start tag
4268 !! input
4269 {|
4270
4271 |-
4272 | foo
4273 |}
4274 !! result
4275 <table>
4276
4277
4278 <tr>
4279 <td> foo
4280 </td></tr></table>
4281
4282 !! end
4283
4284 # FIXME: Preserve the attribute properly (with an empty string as value) in
4285 # the PHP parser. Parsoid implements the behavior below.
4286 !! test
4287 Table attributes with empty value
4288 !! options
4289 parsoid
4290 !! input
4291 {|
4292 | style=| hello
4293 |}
4294 !! result
4295 <table>
4296 <tbody>
4297 <tr>
4298 <td style=""> hello
4299 </td></tr></tbody></table>
4300
4301 !! end
4302
4303 !! test
4304 Wikitext table with a lot of comments
4305 !! input
4306 {|
4307 <!-- c0 -->
4308 | foo
4309 <!-- c1 -->
4310 |- <!-- c2 -->
4311 <!-- c3 -->
4312 |<!-- c4 -->
4313 <!-- c5 -->
4314 |}
4315 !! result
4316 <table>
4317 <tr>
4318 <td> foo
4319 </td></tr>
4320 <tr>
4321 <td>
4322 </td></tr></table>
4323
4324 !! end
4325
4326 !! test
4327 Wikitext table with double-line table cell
4328 !! input
4329 {|
4330 |a
4331 b
4332 |}
4333 !! result
4334 <table>
4335 <tr>
4336 <td>a
4337 <p>b
4338 </p>
4339 </td></tr></table>
4340
4341 !! end
4342
4343 !! test
4344 Table cell with a single comment
4345 !! input
4346 {|
4347 | <!-- c1 -->
4348 | a
4349 |}
4350 !! result
4351 <table>
4352 <tr>
4353 <td>
4354 </td>
4355 <td> a
4356 </td></tr></table>
4357
4358 !! end
4359
4360 # The expected HTML structure in this test is debatable. The PHP parser does
4361 # not parse this kind of table at all. The main focus for Parsoid is on
4362 # round-tripping, so this output is ok for now. TODO: revisit!
4363 !! test
4364 Wikitext table with html-syntax row (Parsoid)
4365 !! options
4366 parsoid
4367 !! input
4368 {|
4369 |-
4370 <td>foo</td>
4371 |}
4372 !! result
4373 <table>
4374 <tbody>
4375 <tr>
4376 <td>foo</td></tr></tbody></table>
4377 !! end
4378
4379 !! test
4380 Implicit <td> after a |-
4381 (PHP parser relies on Tidy to add the missing <td> tags)
4382 !! options
4383 parsoid=wt2html,wt2wt
4384 !! input
4385 {|
4386 |-
4387 a
4388 |}
4389 !! result
4390 <table>
4391 <tr><td>a</td></tr>
4392 </table>
4393 !! end
4394
4395 !! test
4396 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4397 (PHP parser relies on Tidy to add the missing <td> tags)
4398 !! options
4399 parsoid=wt2html,wt2wt
4400 !! input
4401 {|
4402 |-
4403 |
4404 a
4405 |-
4406 b
4407 |}
4408 !! result
4409 <table>
4410 <tbody>
4411 <tr><td><pre>a</pre></td></tr>
4412 <tr><td> b</td></tr>
4413 </tbody>
4414 </table>
4415 !! end
4416
4417 !! test
4418 Lists should be recognized in an implicit <td> context
4419 (PHP parser relies on Tidy to add the missing <td> tags)
4420 !! options
4421 parsoid=wt2html,wt2wt
4422 !! input
4423 {|
4424 |-
4425 *a
4426 |}
4427 !! result
4428 <table>
4429 <tr>
4430 <td><ul><li>a</li></ul></td>
4431 </tr>
4432 </table>
4433 !! end
4434
4435 !! test
4436 Parsoid: Round-trip tables directly followed by content (bug 51219)
4437 !! options
4438 parsoid=wt2html,wt2wt
4439 !! input
4440 {|
4441 |foo
4442 |} bar
4443
4444 {|
4445 |baz
4446 |}<b>quux</b>
4447 !! result
4448 <table><tbody>
4449 <tr>
4450 <td>foo</td></tr></tbody></table> bar
4451 <table>
4452 <tbody>
4453 <tr>
4454 <td>baz</td></tr></tbody></table><b>quux</b>
4455 !! end
4456
4457 !! test
4458 Parsoid: Default to a newline after tables in new content (bug 51219)
4459 !! options
4460 parsoid=html2wt
4461 !! input
4462 {|
4463 |foo
4464 |}
4465 <nowiki> </nowiki>bar
4466 {|
4467 |baz
4468 |}
4469 '''quux'''
4470 !! result
4471 <table><tbody>
4472 <tr><td>foo</td></tr></tbody></table> bar
4473 <table><tbody>
4474 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4475 !! end
4476
4477 ###
4478 ### Internal links
4479 ###
4480 !! test
4481 Plain link, capitalized
4482 !! input
4483 [[Main Page]]
4484 !! result
4485 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4486 </p>
4487 !! end
4488
4489 !! test
4490 Plain link, uncapitalized
4491 !! input
4492 [[main Page]]
4493 !! result
4494 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4495 </p>
4496 !! end
4497
4498 !! test
4499 Piped link
4500 !! input
4501 [[Main Page|The Main Page]]
4502 !! result
4503 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4504 </p>
4505 !! end
4506
4507 !! test
4508 Piped link with comment in link text
4509 !! input
4510 [[Main Page|The Main<!--front--> Page]]
4511 !! result
4512 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4513 </p>
4514 !! end
4515
4516 !! test
4517 Broken link
4518 !! input
4519 [[Zigzagzogzagzig]]
4520 !! result
4521 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4522 </p>
4523 !! end
4524
4525 !! test
4526 Broken link with fragment
4527 !! input
4528 [[Zigzagzogzagzig#zug]]
4529 !! result
4530 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4531 </p>
4532 !! end
4533
4534 !! test
4535 Special page link with fragment
4536 !! input
4537 [[Special:Version#anchor]]
4538 !! result
4539 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 Nonexistent special page link with fragment
4545 !! input
4546 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4547 !! result
4548 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4549 </p>
4550 !! end
4551
4552 !! test
4553 Link with prefix
4554 !! input
4555 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4556 !! result
4557 <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>
4558 </p>
4559 !! end
4560
4561 !! test
4562 Link with suffix
4563 !! input
4564 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4565 !! result
4566 <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>!!!
4567 </p>
4568 !! end
4569
4570 !! article
4571 prefixed article
4572 !! text
4573 Some text
4574 !! endarticle
4575
4576 !! test
4577 Bug 43661: Piped links with identical prefixes
4578 !! input
4579 [[prefixed article|prefixed articles with spaces]]
4580
4581 [[prefixed article|prefixed articlesaoeu]]
4582
4583 [[Main Page|Main Page test]]
4584 !! result
4585 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4586 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4587 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4588 </p>
4589 !! end
4590
4591
4592 !! test
4593 Link with HTML entity in suffix / tail
4594 !! input
4595 [[Main Page]]&quot;, [[Main Page]]&#97;
4596 !! result
4597 <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;
4598 </p>
4599 !! end
4600
4601 !! test
4602 Link with 3 brackets
4603 !! input
4604 [[[main page]]]
4605 !! result
4606 <p>[[[main page]]]
4607 </p>
4608 !! end
4609
4610 !! test
4611 Piped link with 3 brackets
4612 !! input
4613 [[[main page|the main page]]]
4614 !! result
4615 <p>[[[main page|the main page]]]
4616 </p>
4617 !! end
4618
4619 !! test
4620 Link with multiple pipes
4621 !! input
4622 [[Main Page|The|Main|Page]]
4623 !! result
4624 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 Link to namespaces
4630 !! input
4631 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4632 !! result
4633 <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>
4634 </p>
4635 !! end
4636
4637 !! test
4638 Piped link to namespace
4639 !! input
4640 [[Meta:Disclaimers|The disclaimers]]
4641 !! result
4642 <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>
4643 </p>
4644 !! end
4645
4646 !! test
4647 Link containing }
4648 !! input
4649 [[Usually caused by a typo (oops}]]
4650 !! result
4651 <p>[[Usually caused by a typo (oops}]]
4652 </p>
4653 !! end
4654
4655 !! test
4656 Link containing % (not as a hex sequence)
4657 !! input
4658 [[7% Solution]]
4659 !! result
4660 <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>
4661 </p>
4662 !! end
4663
4664 !! test
4665 Link containing % as a single hex sequence interpreted to char
4666 !! input
4667 [[7%25 Solution]]
4668 !! result
4669 <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>
4670 </p>
4671 !!end
4672
4673 !! test
4674 Link containing % as a double hex sequence interpreted to hex sequence
4675 !! input
4676 [[7%2525 Solution]]
4677 !! result
4678 <p>[[7%2525 Solution]]
4679 </p>
4680 !!end
4681
4682 !! test
4683 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4684 Example for such a section: == < ==
4685 !! input
4686 [[%23%3c]][[%23%3e]]
4687 !! result
4688 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4689 </p>
4690 !! end
4691
4692 !! test
4693 Link containing "<#" and ">#" as a hex sequences
4694 !! input
4695 [[%3c%23]][[%3e%23]]
4696 !! result
4697 <p>[[%3c%23]][[%3e%23]]
4698 </p>
4699 !! end
4700
4701 !! test
4702 Link containing an equals sign
4703 !! input
4704 [[Special:BookSources/isbn=4-00-026157-6]]
4705 !! result
4706 <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>
4707 </p>
4708 !! end
4709
4710 !! article
4711 Foo~bar
4712 !! text
4713 Just a test of an article title containing a tilde.
4714 !! endarticle
4715
4716 # note that links containing signatures, like [[Foo~~~~]], are
4717 # massaged by the pre-save transform (PST) and so the tildes are never
4718 # seen by the parser.
4719 !! test
4720 Link containing a tilde
4721 !! input
4722 [[Foo~bar]]
4723 !! result
4724 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4725 </p>
4726 !! end
4727
4728 !! test
4729 Link containing double-single-quotes '' (bug 4598)
4730 !! input
4731 [[Lista d''e paise d''o munno]]
4732 !! result
4733 <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>
4734 </p>
4735 !! end
4736
4737 !! test
4738 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4739 !! input
4740 Some [[Link|pretty ''italics'' and stuff]]!
4741 !! result
4742 <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>!
4743 </p>
4744 !! end
4745
4746 !! test
4747 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4748 !! input
4749 ''Some [[Link|pretty ''italics'' and stuff]]!
4750 !! result
4751 <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>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Link with double quotes in title part (literal) and alternate part (interpreted)
4757 !! input
4758 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4759
4760 [[''Pentecoste'']]
4761
4762 [[''Pentecoste''|Pentecoste]]
4763
4764 [[''Pentecoste''|''Pentecoste'']]
4765 !! result
4766 <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>
4767 </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>
4768 </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>
4769 </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>
4770 </p>
4771 !! end
4772
4773 !! test
4774 Broken image links with HTML captions (bug 39700)
4775 !! input
4776 [[File:Nonexistent|<script></script>]]
4777 [[File:Nonexistent|100px|<script></script>]]
4778 [[File:Nonexistent|&lt;]]
4779 [[File:Nonexistent|a<i>b</i>c]]
4780 !! result
4781 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4782 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4783 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4784 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4785 </p>
4786 !! end
4787
4788 !! test
4789 Plain link to URL
4790 !! input
4791 [[http://www.example.com]]
4792 !! result
4793 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4794 </p>
4795 !! end
4796
4797 !! test
4798 Plain link to URL with link text
4799 !! input
4800 [[http://www.example.com Link text]]
4801 !! result
4802 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4803 </p>
4804 !! end
4805
4806 !! test
4807 Plain link to protocol-relative URL
4808 !! input
4809 [[//www.example.com]]
4810 !! result
4811 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4812 </p>
4813 !! end
4814
4815 !! test
4816 Plain link to protocol-relative URL with link text
4817 !! input
4818 [[//www.example.com Link text]]
4819 !! result
4820 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4821 </p>
4822 !! end
4823
4824 !! test
4825 Plain link to page with question mark in title
4826 !! input
4827 [[A?b]]
4828
4829 [[A?b|Baz]]
4830 !! result
4831 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4832 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4833 </p>
4834 !! end
4835
4836
4837 # I'm fairly sure the expected result here is wrong.
4838 # We want these to be URL links, not pseudo-pages with URLs for titles....
4839 # However the current output is also pretty screwy.
4840 #
4841 # ----
4842 # I'm changing it to match the current output--it arguably makes more
4843 # sense in the light of the test above. Old expected result was:
4844 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4845 #</p>
4846 # But I think this test is bordering on "garbage in, garbage out" anyway.
4847 # -- wtm
4848 !! test
4849 Piped link to URL
4850 !! input
4851 Piped link to URL: [[http://www.example.com|an example URL]]
4852 !! result
4853 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4854 </p>
4855 !! end
4856
4857 !! test
4858 BUG 2: [[page|http://url/]] should link to page, not http://url/
4859 !! input
4860 [[Main Page|http://url/]]
4861 !! result
4862 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4863 </p>
4864 !! end
4865
4866 !! test
4867 BUG 337: Escaped self-links should be bold
4868 !! options
4869 title=[[Bug462]]
4870 !! input
4871 [[Bu&#103;462]] [[Bug462]]
4872 !! result
4873 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4874 </p>
4875 !! end
4876
4877 !! test
4878 Self-link to section should not be bold
4879 !! options
4880 title=[[Main Page]]
4881 !! input
4882 [[Main Page#section]]
4883 !! result
4884 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4885 </p>
4886 !! end
4887
4888 !! article
4889 00
4890 !! text
4891 This is 00.
4892 !! endarticle
4893
4894 !!test
4895 Self-link to numeric title
4896 !!options
4897 title=[[0]]
4898 !!input
4899 [[0]]
4900 !!result
4901 <p><strong class="selflink">0</strong>
4902 </p>
4903 !!end
4904
4905 !!test
4906 Link to numeric-equivalent title
4907 !!options
4908 title=[[0]]
4909 !!input
4910 [[00]]
4911 !!result
4912 <p><a href="/wiki/00" title="00">00</a>
4913 </p>
4914 !!end
4915
4916 !! test
4917 <nowiki> inside a link
4918 !! input
4919 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4920 !! result
4921 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4922 </p>
4923 !! end
4924
4925 !! test
4926 Non-breaking spaces in title
4927 !! input
4928 [[&nbsp; Main &nbsp; Page &nbsp;]]
4929 !! result
4930 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4931 </p>
4932 !!end
4933
4934 !! test
4935 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4936 !! options
4937 language=ca
4938 !! input
4939 '''[[Main Page]]'''
4940 !! result
4941 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4942 </p>
4943 !! end
4944
4945 !! test
4946 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4947 !! options
4948 language=ca
4949 !! input
4950 ''[[Main Page]]''
4951 !! result
4952 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4953 </p>
4954 !! end
4955
4956 !! test
4957 Internal link with en linktrail: no apostrophes (bug 27473)
4958 !! options
4959 language=en
4960 !! input
4961 [[Something]]'nice
4962 !! result
4963 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4964 </p>
4965 !! end
4966
4967 !! test
4968 Internal link with ca linktrail with apostrophes (bug 27473)
4969 !! options
4970 language=ca
4971 !! input
4972 [[Something]]'nice
4973 !! result
4974 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4975 </p>
4976 !! end
4977
4978 !! test
4979 Internal link with kaa linktrail with apostrophes (bug 27473)
4980 !! options
4981 language=kaa
4982 !! input
4983 [[Something]]'nice
4984 !! result
4985 <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>
4986 </p>
4987 !! end
4988
4989 !! article
4990 Söfnuður
4991 !! text
4992 Test.
4993 !! endarticle
4994
4995 !! test
4996 Internal link with is link prefix
4997 !! options
4998 language=is
4999 !! input
5000 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5001 !! result
5002 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5003 </p>
5004 !! end
5005
5006 !! article
5007 Mótmælendatrú
5008 !! text
5009 Test.
5010 !! endarticle
5011
5012 !! test
5013 Internal link with is link trail and link prefix
5014 !! options
5015 language=is
5016 !! input
5017 [[mótmælendatrú|xxx]]ar
5018 [[mótmælendatrú]]ar
5019 mótmælenda[[söfnuður]]
5020 mótmælenda[[söfnuður|söfnuðir]]
5021 mótmælenda[[söfnuður|söfnuðir]]xxx
5022 !! result
5023 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5024 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5025 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5026 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5027 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 Parsoid link trail escaping
5033 !! options
5034 parsoid=html2wt,html2html
5035 !! input
5036 [[apple]]<nowiki/>s
5037 !! result
5038 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5039 !! end
5040
5041 !! test
5042 Parsoid link prefix escaping
5043 !! options
5044 language=is
5045 parsoid=html2wt,html2html
5046 !! input
5047 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5048 !! result
5049 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5050 !! end
5051
5052 !! test
5053 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5054 !! input
5055 [[Foo| bar]]
5056
5057 [[Foo| ''bar'']]
5058
5059 [http://wp.org foo]
5060
5061 [http://wp.org ''foo'']
5062 !! result
5063 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5064 </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>
5065 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5066 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5067 </p>
5068 !! end
5069
5070 ###
5071 ### Interwiki links (see maintenance/interwiki.sql)
5072 ###
5073
5074 !! test
5075 Inline interwiki link
5076 !! input
5077 [[MeatBall:SoftSecurity]]
5078 !! result
5079 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5080 </p>
5081 !! end
5082
5083 !! test
5084 Inline interwiki link with empty title (bug 2372)
5085 !! input
5086 [[MeatBall:]]
5087 !! result
5088 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5089 </p>
5090 !! end
5091
5092 !! test
5093 Interwiki link encoding conversion (bug 1636)
5094 !! input
5095 *[[Wikipedia:ro:Olteni&#0355;a]]
5096 *[[Wikipedia:ro:Olteni&#355;a]]
5097 !! result
5098 <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>
5099 </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>
5100 </li></ul>
5101
5102 !! end
5103
5104 !! test
5105 Interwiki link with fragment (bug 2130)
5106 !! input
5107 [[MeatBall:SoftSecurity#foo]]
5108 !! result
5109 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5110 </p>
5111 !! end
5112
5113
5114 ###
5115 ### Interlanguage links
5116 ### Language links (so that searching for '### language' matches..)
5117 ###
5118
5119 !! test
5120 Interlanguage link
5121 !! input
5122 Blah blah blah
5123 [[zh:Chinese]]
5124 !!result
5125 <p>Blah blah blah
5126 </p>
5127 !! end
5128
5129 !! test
5130 Double interlanguage link
5131 !! input
5132 Blah blah blah
5133 [[es:Spanish]]
5134 [[zh:Chinese]]
5135 !!result
5136 <p>Blah blah blah
5137 </p>
5138 !! end
5139
5140 !! test
5141 Interlanguage link, with prefix links
5142 !! options
5143 language=ln
5144 !! input
5145 Blah blah blah
5146 [[zh:Chinese]]
5147 !!result
5148 <p>Blah blah blah
5149 </p>
5150 !! end
5151
5152 !! test
5153 Double interlanguage link, with prefix links (bug 8897)
5154 !! options
5155 language=ln
5156 !! input
5157 Blah blah blah
5158 [[es:Spanish]]
5159 [[zh:Chinese]]
5160 !!result
5161 <p>Blah blah blah
5162 </p>
5163 !! end
5164
5165 !! test
5166 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5167 !! options
5168 language=ln
5169 !! input
5170 [[WW&nbsp;II]]
5171 !!result
5172 <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>
5173 </p>
5174 !! end
5175
5176 !! test
5177 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5178 !! options
5179 parsoid=html2wt
5180 !! input
5181 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5182
5183 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5184 !!result
5185 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5186 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5187 !! end
5188
5189 !! test
5190 Parsoid: handle constructor well
5191 !! options
5192 parsoid
5193 !! input
5194 [[constructor]]
5195
5196 [[constructor:foo]]
5197 !! result
5198 <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>
5199
5200
5201 <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>
5202 !! end
5203
5204 !! test
5205 Parsoid: recognize interlanguage links without a target page
5206 !! options
5207 parsoid
5208 !! input
5209 [[ko:]]
5210 !! result
5211 <p>
5212 <link rel="mw:WikiLink/Language" href="http://ko.wikipedia.org/wiki/"></p>
5213 !! end
5214
5215 !! test
5216 Parsoid: recognize interwiki links without a target page
5217 !! options
5218 parsoid
5219 !! input
5220 [[:ko:]]
5221 !! result
5222 <p><a rel="mw:WikiLink/Interwiki" href="http://ko.wikipedia.org/wiki/">ko:</a></p>
5223 !! end
5224
5225 ###
5226 ### Redirects, Parsoid-only
5227 ###
5228 !! test
5229 Simple redirect to page
5230 !! options
5231 parsoid
5232 !! input
5233 #REDIRECT [[Main Page]]
5234 !! result
5235 <link rel="mw:PageProp/redirect" href="./Main_Page">
5236 !! end
5237
5238 !! test
5239 Optional colon in #REDIRECT
5240 !! options
5241 # the colon is archaic syntax. we support it for wt2html, but we
5242 # don't care that it roundtrips back to the modern syntax.
5243 parsoid=wt2html,html2html
5244 !! input
5245 #REDIRECT:[[Main Page]]
5246 !! result
5247 <link rel="mw:PageProp/redirect" href="./Main_Page">
5248 !! end
5249
5250 !! test
5251 Whitespace in #REDIRECT with optional colon
5252 !! options
5253 # the colon and gratuitous whitespace is archaic syntax. we support
5254 # it for wt2html, but we don't care that it roundtrips back to the
5255 # modern syntax (without extra whitespace)
5256 parsoid=wt2html,html2html
5257 !! input
5258
5259 #REDIRECT
5260 :
5261 [[Main Page]]
5262 !! result
5263 <link rel="mw:PageProp/redirect" href="./Main_Page">
5264 !! end
5265
5266 !! test
5267 Piped link in #REDIRECT
5268 !! options
5269 # content after piped link is ignored. we support this syntax,
5270 # but don't care that the piped link is lost when we roundtrip this.
5271 parsoid=wt2html
5272 !! input
5273 #REDIRECT [[Main Page|bar]]
5274 !! result
5275 <link rel="mw:PageProp/redirect" href="./Main_Page">
5276 !! end
5277
5278 !! test
5279 Redirect to category
5280 !! options
5281 parsoid=wt2html
5282 !! input
5283 #REDIRECT [[Category:Foo]]
5284 !! result
5285 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5286 !! end
5287
5288 !! test
5289 Redirect to category with URL encoding
5290 !! options
5291 parsoid=wt2html
5292 !! input
5293 #REDIRECT [[Category%3AFoo]]
5294 !! result
5295 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5296 !! end
5297
5298 !! test
5299 Redirect to category page
5300 !! options
5301 parsoid=wt2html,html2html
5302 !! input
5303 #REDIRECT [[:Category:Foo]]
5304 !! result
5305 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5306 !! end
5307
5308 !! test
5309 Redirect to image page (1)
5310 !! options
5311 parsoid
5312 !! input
5313 #REDIRECT [[File:Wiki.png]]
5314 !! result
5315 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5316 !! end
5317
5318 !! test
5319 Redirect to image page (2)
5320 !! options
5321 parsoid
5322 !! input
5323 #REDIRECT [[Image:Wiki.png]]
5324 !! result
5325 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5326 !! end
5327
5328 !! test
5329 Redirect to language
5330 !! options
5331 parsoid
5332 !! input
5333 #REDIRECT [[en:File:Wiki.png]]
5334 !! result
5335 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5336 !! end
5337
5338 !! test
5339 Redirect to interwiki
5340 !! options
5341 parsoid
5342 !! input
5343 #REDIRECT [[meatball:File:Wiki.png]]
5344 !! result
5345 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5346 !! end
5347
5348 !! test
5349 Non-English #REDIRECT
5350 !! options
5351 parsoid
5352 language=is
5353 !! input
5354 #TILVÍSUN [[Main Page]]
5355 !! result
5356 <link rel="mw:PageProp/redirect" href="./Main_Page">
5357 !! end
5358
5359 ##
5360 ## XHTML tidiness
5361 ###
5362
5363 !! test
5364 <br> to <br />
5365 !! input
5366 1<br>2<br />3
5367 !! result
5368 <p>1<br />2<br />3
5369 </p>
5370 !! end
5371
5372 !! test
5373 Broken br tag sanitization
5374 !! options
5375 php
5376 !! input
5377 </br>
5378 !! result
5379 <p>&lt;/br&gt;
5380 </p>
5381 !! end
5382
5383 # TODO: Fix html2html mode (bug 51055)!
5384 !! test
5385 Parsoid: Broken br tag recognition
5386 !! options
5387 parsoid=wt2html
5388 !! input
5389 </br>
5390 !! result
5391 <p><br></p>
5392 !! end
5393
5394 !! test
5395 Incorrecly removing closing slashes from correctly formed XHTML
5396 !! input
5397 <br style="clear:both;" />
5398 !! result
5399 <p><br style="clear:both;" />
5400 </p>
5401 !! end
5402
5403 !! test
5404 Failing to transform badly formed HTML into correct XHTML
5405 !! input
5406 <br style="clear: left;">
5407 <br style="clear: right;">
5408 <br style="clear: both;">
5409 !! result
5410 <p><br style="clear: left;" />
5411 <br style="clear: right;" />
5412 <br style="clear: both;" />
5413 </p>
5414 !!end
5415
5416 !! test
5417 Handling html with a div self-closing tag
5418 !! input
5419 <div title />
5420 <div title/>
5421 <div title/ >
5422 <div title=bar />
5423 <div title=bar/>
5424 <div title=bar/ >
5425 !! result
5426 <p>&lt;div title /&gt;
5427 &lt;div title/&gt;
5428 </p>
5429 <div>
5430 <p>&lt;div title=bar /&gt;
5431 &lt;div title=bar/&gt;
5432 </p>
5433 <div title="bar/"></div>
5434 </div>
5435
5436 !! end
5437
5438 !! test
5439 Handling html with a br self-closing tag
5440 !! input
5441 <br title />
5442 <br title/>
5443 <br title/ >
5444 <br title=bar />
5445 <br title=bar/>
5446 <br title=bar/ >
5447 !! result
5448 <p><br title="title" />
5449 <br title="title" />
5450 <br />
5451 <br title="bar" />
5452 <br title="bar" />
5453 <br title="bar/" />
5454 </p>
5455 !! end
5456
5457 !! test
5458 Horizontal ruler (should it add that extra space?)
5459 !! input
5460 <hr>
5461 <hr >
5462 foo <hr
5463 > bar
5464 !! result
5465 <hr />
5466 <hr />
5467 foo <hr /> bar
5468
5469 !! end
5470
5471 !! test
5472 Horizontal ruler -- 4+ dashes render hr
5473 !! input
5474 ----
5475 !! result
5476 <hr />
5477
5478 !! end
5479
5480 !! test
5481 Horizontal ruler -- eats additional dashes on the same line
5482 !! input
5483 ---------
5484 !! result
5485 <hr />
5486
5487 !! end
5488
5489 !! test
5490 Horizontal ruler -- does not collapse dashes on consecutive lines
5491 !! input
5492 ----
5493 ----
5494 !! result
5495 <hr />
5496 <hr />
5497
5498 !! end
5499
5500 !! test
5501 Horizontal ruler -- <4 dashes render as plain text
5502 !! input
5503 ---
5504 !! result
5505 <p>---
5506 </p>
5507 !! end
5508
5509 !! test
5510 Horizontal ruler -- Supports content following dashes on same line
5511 !! input
5512 ---- Foo
5513 !! result
5514 <hr /> Foo
5515
5516 !! end
5517
5518 ###
5519 ### Block-level elements
5520 ###
5521 !! test
5522 Common list
5523 !! input
5524 *Common list
5525 * item 2
5526 *item 3
5527 !! result
5528 <ul><li>Common list
5529 </li><li> item 2
5530 </li><li>item 3
5531 </li></ul>
5532
5533 !! end
5534
5535 !! test
5536 Numbered list
5537 !! input
5538 #Numbered list
5539 #item 2
5540 # item 3
5541 !! result
5542 <ol><li>Numbered list
5543 </li><li>item 2
5544 </li><li> item 3
5545 </li></ol>
5546
5547 !! end
5548
5549 !! test
5550 Mixed list
5551 !! input
5552 *Mixed list
5553 *# with numbers
5554 ** and bullets
5555 *# and numbers
5556 *bullets again
5557 **bullet level 2
5558 ***bullet level 3
5559 ***#Number on level 4
5560 **bullet level 2
5561 **#Number on level 3
5562 **#Number on level 3
5563 *#number level 2
5564 *Level 1
5565 *** Level 3
5566 #** Level 3, but ordered
5567 !! result
5568 <ul><li>Mixed list
5569 <ol><li> with numbers
5570 </li></ol>
5571 <ul><li> and bullets
5572 </li></ul>
5573 <ol><li> and numbers
5574 </li></ol>
5575 </li><li>bullets again
5576 <ul><li>bullet level 2
5577 <ul><li>bullet level 3
5578 <ol><li>Number on level 4
5579 </li></ol>
5580 </li></ul>
5581 </li><li>bullet level 2
5582 <ol><li>Number on level 3
5583 </li><li>Number on level 3
5584 </li></ol>
5585 </li></ul>
5586 <ol><li>number level 2
5587 </li></ol>
5588 </li><li>Level 1
5589 <ul><li><ul><li> Level 3
5590 </li></ul>
5591 </li></ul>
5592 </li></ul>
5593 <ol><li><ul><li><ul><li> Level 3, but ordered
5594 </li></ul>
5595 </li></ul>
5596 </li></ol>
5597
5598 !! end
5599
5600 !! test
5601 Nested lists 1
5602 !! input
5603 *foo
5604 **bar
5605 !! result
5606 <ul><li>foo
5607 <ul><li>bar
5608 </li></ul>
5609 </li></ul>
5610
5611 !! end
5612
5613 !! test
5614 Nested lists 2
5615 !! input
5616 **foo
5617 *bar
5618 !! result
5619 <ul><li><ul><li>foo
5620 </li></ul>
5621 </li><li>bar
5622 </li></ul>
5623
5624 !! end
5625
5626 !! test
5627 Nested lists 3 (first element empty)
5628 !! input
5629 *
5630 **bar
5631 !! result
5632 <ul><li>
5633 <ul><li>bar
5634 </li></ul>
5635 </li></ul>
5636
5637 !! end
5638
5639 !! test
5640 Nested lists 4 (first element empty)
5641 !! input
5642 **
5643 *bar
5644 !! result
5645 <ul><li><ul><li>
5646 </li></ul>
5647 </li><li>bar
5648 </li></ul>
5649
5650 !! end
5651
5652 !! test
5653 Nested lists 5 (both elements empty)
5654 !! input
5655 **
5656 *
5657 !! result
5658 <ul><li><ul><li>
5659 </li></ul>
5660 </li><li>
5661 </li></ul>
5662
5663 !! end
5664
5665 !! test
5666 Nested lists 6 (both elements empty)
5667 !! input
5668 *
5669 **
5670 !! result
5671 <ul><li>
5672 <ul><li>
5673 </li></ul>
5674 </li></ul>
5675
5676 !! end
5677
5678 !! test
5679 Nested lists 7 (skip initial nesting levels)
5680 !! input
5681 *** foo
5682 !! result
5683 <ul><li><ul><li><ul><li> foo
5684 </li></ul>
5685 </li></ul>
5686 </li></ul>
5687
5688 !! end
5689
5690 !! test
5691 Nested lists 8 (multiple nesting transitions)
5692 !! input
5693 * foo
5694 *** bar
5695 ** baz
5696 * boo
5697 !! result
5698 <ul><li> foo
5699 <ul><li><ul><li> bar
5700 </li></ul>
5701 </li><li> baz
5702 </li></ul>
5703 </li><li> boo
5704 </li></ul>
5705
5706 !! end
5707
5708 !! test
5709 1. Lists with start-of-line-transparent tokens before bullets: Comments
5710 !! input
5711 *foo
5712 *<!--cmt-->bar
5713 <!--cmt-->*baz
5714 !! result
5715 <ul><li>foo
5716 </li><li>bar
5717 </li><li>baz
5718 </li></ul>
5719
5720 !! end
5721
5722 !! test
5723 2. Lists with start-of-line-transparent tokens before bullets: Template close
5724 !! input
5725 *foo {{echo|bar
5726 }}*baz
5727 !! result
5728 <ul><li>foo bar
5729 </li><li>baz
5730 </li></ul>
5731
5732 !! end
5733
5734 !! test
5735 List items are not parsed correctly following a <pre> block (bug 785)
5736 !! input
5737 * <pre>foo</pre>
5738 * <pre>bar</pre>
5739 * zar
5740 !! result
5741 <ul><li> <pre>foo</pre>
5742 </li><li> <pre>bar</pre>
5743 </li><li> zar
5744 </li></ul>
5745
5746 !! end
5747
5748 !! test
5749 List items from template
5750 !! input
5751
5752 {{inner list}}
5753 * item 2
5754
5755 * item 0
5756 {{inner list}}
5757 * item 2
5758
5759 * item 0
5760 * notSOL{{inner list}}
5761 * item 2
5762 !! result
5763 <ul><li> item 1
5764 </li><li> item 2
5765 </li></ul>
5766 <ul><li> item 0
5767 </li><li> item 1
5768 </li><li> item 2
5769 </li></ul>
5770 <ul><li> item 0
5771 </li><li> notSOL
5772 </li><li> item 1
5773 </li><li> item 2
5774 </li></ul>
5775
5776 !! end
5777
5778 !! test
5779 List interrupted by empty line or heading
5780 !! input
5781 * foo
5782
5783 ** bar
5784 == A heading ==
5785 * Another list item
5786 !! result
5787 <ul><li> foo
5788 </li></ul>
5789 <ul><li><ul><li> bar
5790 </li></ul>
5791 </li></ul>
5792 <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>
5793 <ul><li> Another list item
5794 </li></ul>
5795
5796 !!end
5797
5798 !!test
5799 Multiple list tags generated by templates
5800 !!input
5801 {{echo|<li>}}a
5802 {{echo|<li>}}b
5803 {{echo|<li>}}c
5804 !!result
5805 <li>a
5806 <li>b
5807 <li>c</li>
5808 </li>
5809 </li>
5810
5811 !!end
5812
5813 !!test
5814 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
5815 !!input
5816 *a
5817 <!--This line will NOT split the list-->
5818 *b
5819 <!--This line will NOT split the list either-->
5820 *c
5821 <!--foo--> <!----> <!--This line NOT split the list either-->
5822 *d
5823 !!result
5824 <ul><li>a
5825 </li><li>b
5826 </li><li>c
5827 </li><li>d
5828 </li></ul>
5829
5830 !!end
5831
5832 !!test
5833 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
5834 !!input
5835 *a
5836 <!--This line will NOT split the list-->
5837 *b
5838 <!--This line will NOT split the list either-->
5839 *c
5840 <!--foo--> <!----> <!--This line NOT split the list
5841 either-->
5842 *d
5843 !!result
5844 <ul><li>a
5845 </li><li>b
5846 </li><li>c
5847 </li><li>d
5848 </li></ul>
5849
5850 !!end
5851
5852 !!test
5853 Test the li-hack
5854 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5855 !!options
5856 parsoid=wt2html,wt2wt
5857 !!input
5858 * foo
5859 * <li>li-hack
5860 * {{echo|<li>templated li-hack}}
5861 * <!--foo--> <li> unsupported li-hack with preceding comments
5862
5863 <ul>
5864 <li><li>not a li-hack
5865 </li>
5866 </ul>
5867 !!result
5868 <ul><li> foo</li>
5869 <li>li-hack</li>
5870 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
5871 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5872
5873 <ul>
5874 <li></li><li>not a li-hack
5875 </li>
5876 </ul>
5877 !!end
5878
5879 !! test
5880 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5881 !! options
5882 parsoid
5883 !! input
5884 # foo
5885 ## bar
5886 * foo
5887 ** bar
5888 : foo
5889 :: bar
5890 !! result
5891 <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>
5892 !! end
5893
5894 !! test
5895 Parsoid: Test of whitespace serialization with Templated bullets
5896 !! options
5897 parsoid
5898 !! input
5899 * {{bullet}}
5900 !! result
5901 <ul>
5902 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
5903 </ul>
5904 !! end
5905
5906 # ------------------------------------------------------------------------
5907 # The next set of tests are about Parsoid's ability to handle badly nested
5908 # tags (parse, minimize scope of fixup, and roundtrip back)
5909 # ------------------------------------------------------------------------
5910
5911 !! test
5912 Unbalanced closing block tags break a list
5913 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5914 !! options
5915 parsoid
5916 !! input
5917 <div>
5918 *a</div><div>
5919 *b</div>
5920 !! result
5921 <div>
5922 <ul><li>a
5923 </li></ul></div><div>
5924 <ul><li>b
5925 </li></ul></div>
5926 !! end
5927
5928 !! test
5929 Unbalanced closing non-block tags don't break a list
5930 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5931 !! options
5932 parsoid
5933 !! input
5934 <span>
5935 *a</span><span>
5936 *b</span>
5937 !! result
5938 <p><span></span>
5939 </p>
5940 <ul><li>a<span></span>
5941 </li><li>b
5942 </li></ul>
5943 !! end
5944
5945 !! test
5946 Unclosed formatting tags that straddle lists are closed and reopened
5947 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5948 !! options
5949 parsoid
5950 !! input
5951 # <s> a
5952 # b </s>
5953 !! result
5954 <ol><li> <s> a </s>
5955 </li><li> <s> b </s>
5956 </li></ol>
5957 !! end
5958
5959 !!test
5960 List embedded in a non-block tag
5961 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5962 !! options
5963 parsoid
5964 !!input
5965 <small>
5966 * foo
5967 </small>
5968 !!result
5969 <p><small></small></p>
5970 <small>
5971 <ul>
5972 <li> foo</li>
5973 </ul>
5974 </small>
5975 <p><small></small></p>
5976 !!end
5977
5978 !! test
5979 Table with missing opening <tr> tag
5980 !! options
5981 parsoid=wt2html,wt2wt
5982 !! input
5983 <table>
5984 <td>foo</td>
5985 </tr>
5986 </table>
5987 !! result
5988 <table>
5989 <tr>
5990 <td>foo</td>
5991 </tr>
5992 </table>
5993 !! end
5994
5995 ###
5996 ### Magic Words
5997 ###
5998
5999 # Note that the current date is hard-coded as
6000 # 1970-01-01T00:02:03Z (a Thursday)
6001 # when running parser tests. The timezone is also fixed to GMT, so
6002 # local date will be identical to current date.
6003
6004 !! test
6005 Magic Word: {{CURRENTDAY}}
6006 !! input
6007 {{CURRENTDAY}}
6008 !! result
6009 <p>1
6010 </p>
6011 !! end
6012
6013 !! test
6014 Magic Word: {{CURRENTDAY2}}
6015 !! input
6016 {{CURRENTDAY2}}
6017 !! result
6018 <p>01
6019 </p>
6020 !! end
6021
6022 !! test
6023 Magic Word: {{CURRENTDAYNAME}}
6024 !! input
6025 {{CURRENTDAYNAME}}
6026 !! result
6027 <p>Thursday
6028 </p>
6029 !! end
6030
6031 !! test
6032 Magic Word: {{CURRENTDOW}}
6033 !! input
6034 {{CURRENTDOW}}
6035 !! result
6036 <p>4
6037 </p>
6038 !! end
6039
6040 !! test
6041 Magic Word: {{CURRENTMONTH}}
6042 !! input
6043 {{CURRENTMONTH}}
6044 !! result
6045 <p>01
6046 </p>
6047 !! end
6048
6049 !! test
6050 Magic Word: {{CURRENTMONTH1}}
6051 !! input
6052 {{CURRENTMONTH1}}
6053 !! result
6054 <p>1
6055 </p>
6056 !! end
6057
6058 !! test
6059 Magic Word: {{CURRENTMONTHABBREV}}
6060 !! input
6061 {{CURRENTMONTHABBREV}}
6062 !! result
6063 <p>Jan
6064 </p>
6065 !! end
6066
6067 !! test
6068 Magic Word: {{CURRENTMONTHNAME}}
6069 !! input
6070 {{CURRENTMONTHNAME}}
6071 !! result
6072 <p>January
6073 </p>
6074 !! end
6075
6076 !! test
6077 Magic Word: {{CURRENTMONTHNAMEGEN}}
6078 !! input
6079 {{CURRENTMONTHNAMEGEN}}
6080 !! result
6081 <p>January
6082 </p>
6083 !! end
6084
6085 !! test
6086 Magic Word: {{CURRENTTIME}}
6087 !! input
6088 {{CURRENTTIME}}
6089 !! result
6090 <p>00:02
6091 </p>
6092 !! end
6093
6094 !! test
6095 Magic Word: {{CURRENTHOUR}}
6096 !! input
6097 {{CURRENTHOUR}}
6098 !! result
6099 <p>00
6100 </p>
6101 !! end
6102
6103 !! test
6104 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6105 !! input
6106 {{CURRENTWEEK}}
6107 !! result
6108 <p>1
6109 </p>
6110 !! end
6111
6112 !! test
6113 Magic Word: {{CURRENTYEAR}}
6114 !! input
6115 {{CURRENTYEAR}}
6116 !! result
6117 <p>1970
6118 </p>
6119 !! end
6120
6121 !! test
6122 Magic Word: {{CURRENTTIMESTAMP}}
6123 !! input
6124 {{CURRENTTIMESTAMP}}
6125 !! result
6126 <p>19700101000203
6127 </p>
6128 !! end
6129
6130 !! test
6131 Magic Words LOCAL (UTC)
6132 !! input
6133 * {{LOCALMONTH}}
6134 * {{LOCALMONTH1}}
6135 * {{LOCALMONTHNAME}}
6136 * {{LOCALMONTHNAMEGEN}}
6137 * {{LOCALMONTHABBREV}}
6138 * {{LOCALDAY}}
6139 * {{LOCALDAY2}}
6140 * {{LOCALDAYNAME}}
6141 * {{LOCALYEAR}}
6142 * {{LOCALTIME}}
6143 * {{LOCALHOUR}}
6144 * {{LOCALWEEK}}
6145 * {{LOCALDOW}}
6146 * {{LOCALTIMESTAMP}}
6147 !! result
6148 <ul><li> 01
6149 </li><li> 1
6150 </li><li> January
6151 </li><li> January
6152 </li><li> Jan
6153 </li><li> 1
6154 </li><li> 01
6155 </li><li> Thursday
6156 </li><li> 1970
6157 </li><li> 00:02
6158 </li><li> 00
6159 </li><li> 1
6160 </li><li> 4
6161 </li><li> 19700101000203
6162 </li></ul>
6163
6164 !! end
6165
6166 !! test
6167 Magic Word: {{FULLPAGENAME}}
6168 !! options
6169 title=[[User:Ævar Arnfjörð Bjarmason]]
6170 !! input
6171 {{FULLPAGENAME}}
6172 !! result
6173 <p>User:Ævar Arnfjörð Bjarmason
6174 </p>
6175 !! end
6176
6177 !! test
6178 Magic Word: {{FULLPAGENAMEE}}
6179 !! options
6180 title=[[User:Ævar Arnfjörð Bjarmason]]
6181 !! input
6182 {{FULLPAGENAMEE}}
6183 !! result
6184 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6185 </p>
6186 !! end
6187
6188 !! test
6189 Magic Word: {{TALKSPACE}}
6190 !! options
6191 title=[[User:Ævar Arnfjörð Bjarmason]]
6192 !! input
6193 {{TALKSPACE}}
6194 !! result
6195 <p>User talk
6196 </p>
6197 !! end
6198
6199 !! test
6200 Magic Word: {{TALKSPACE}}, same namespace
6201 !! options
6202 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6203 !! input
6204 {{TALKSPACE}}
6205 !! result
6206 <p>User talk
6207 </p>
6208 !! end
6209
6210 !! test
6211 Magic Word: {{TALKSPACE}}, main namespace
6212 !! options
6213 title=[[Parser Test]]
6214 !! input
6215 {{TALKSPACE}}
6216 !! result
6217 <p>Talk
6218 </p>
6219 !! end
6220
6221 !! test
6222 Magic Word: {{TALKSPACEE}}
6223 !! options
6224 title=[[User:Ævar Arnfjörð Bjarmason]]
6225 !! input
6226 {{TALKSPACEE}}
6227 !! result
6228 <p>User_talk
6229 </p>
6230 !! end
6231
6232 !! test
6233 Magic Word: {{SUBJECTSPACE}}
6234 !! options
6235 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6236 !! input
6237 {{SUBJECTSPACE}}
6238 !! result
6239 <p>User
6240 </p>
6241 !! end
6242
6243 !! test
6244 Magic Word: {{SUBJECTSPACE}}, same namespace
6245 !! options
6246 title=[[User:Ævar Arnfjörð Bjarmason]]
6247 !! input
6248 {{SUBJECTSPACE}}
6249 !! result
6250 <p>User
6251 </p>
6252 !! end
6253
6254 !! test
6255 Magic Word: {{SUBJECTSPACE}}, main namespace
6256 !! options
6257 title=[[Parser Test]]
6258 !! input
6259 {{SUBJECTSPACE}}
6260 !! result
6261
6262 !! end
6263
6264 !! test
6265 Magic Word: {{SUBJECTSPACEE}}
6266 !! options
6267 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6268 !! input
6269 {{SUBJECTSPACEE}}
6270 !! result
6271 <p>User
6272 </p>
6273 !! end
6274
6275 !! test
6276 Magic Word: {{NAMESPACE}}
6277 !! options
6278 title=[[User:Ævar Arnfjörð Bjarmason]]
6279 !! input
6280 {{NAMESPACE}}
6281 !! result
6282 <p>User
6283 </p>
6284 !! end
6285
6286 !! test
6287 Magic Word: {{NAMESPACEE}}
6288 !! options
6289 title=[[User:Ævar Arnfjörð Bjarmason]]
6290 !! input
6291 {{NAMESPACEE}}
6292 !! result
6293 <p>User
6294 </p>
6295 !! end
6296
6297 !! test
6298 Magic Word: {{NAMESPACENUMBER}}
6299 !! options
6300 title=[[User:Ævar Arnfjörð Bjarmason]]
6301 !! input
6302 {{NAMESPACENUMBER}}
6303 !! result
6304 <p>2
6305 </p>
6306 !! end
6307
6308 !! test
6309 Magic Word: {{SUBPAGENAME}}
6310 !! options
6311 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6312 !! input
6313 {{SUBPAGENAME}}
6314 !! result
6315 <p>sub ö
6316 </p>
6317 !! end
6318
6319 !! test
6320 Magic Word: {{SUBPAGENAMEE}}
6321 !! options
6322 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6323 !! input
6324 {{SUBPAGENAMEE}}
6325 !! result
6326 <p>sub_%C3%B6
6327 </p>
6328 !! end
6329
6330 !! test
6331 Magic Word: {{ROOTPAGENAME}}
6332 !! options
6333 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6334 !! input
6335 {{ROOTPAGENAME}}
6336 !! result
6337 <p>Ævar Arnfjörð Bjarmason
6338 </p>
6339 !! end
6340
6341 !! test
6342 Magic Word: {{ROOTPAGENAMEE}}
6343 !! options
6344 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6345 !! input
6346 {{ROOTPAGENAMEE}}
6347 !! result
6348 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6349 </p>
6350 !! end
6351
6352 !! test
6353 Magic Word: {{BASEPAGENAME}}
6354 !! options
6355 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6356 !! input
6357 {{BASEPAGENAME}}
6358 !! result
6359 <p>Ævar Arnfjörð Bjarmason
6360 </p>
6361 !! end
6362
6363 !! test
6364 Magic Word: {{BASEPAGENAMEE}}
6365 !! options
6366 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6367 !! input
6368 {{BASEPAGENAMEE}}
6369 !! result
6370 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6371 </p>
6372 !! end
6373
6374 !! test
6375 Magic Word: {{TALKPAGENAME}}
6376 !! options
6377 title=[[User:Ævar Arnfjörð Bjarmason]]
6378 !! input
6379 {{TALKPAGENAME}}
6380 !! result
6381 <p>User talk:Ævar Arnfjörð Bjarmason
6382 </p>
6383 !! end
6384
6385 !! test
6386 Magic Word: {{TALKPAGENAMEE}}
6387 !! options
6388 title=[[User:Ævar Arnfjörð Bjarmason]]
6389 !! input
6390 {{TALKPAGENAMEE}}
6391 !! result
6392 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6393 </p>
6394 !! end
6395
6396 !! test
6397 Magic Word: {{SUBJECTPAGENAME}}
6398 !! options
6399 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6400 !! input
6401 {{SUBJECTPAGENAME}}
6402 !! result
6403 <p>User:Ævar Arnfjörð Bjarmason
6404 </p>
6405 !! end
6406
6407 !! test
6408 Magic Word: {{SUBJECTPAGENAMEE}}
6409 !! options
6410 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6411 !! input
6412 {{SUBJECTPAGENAMEE}}
6413 !! result
6414 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6415 </p>
6416 !! end
6417
6418 !! test
6419 Magic Word: {{NUMBEROFFILES}}
6420 !! input
6421 {{NUMBEROFFILES}}
6422 !! result
6423 <p>4
6424 </p>
6425 !! end
6426
6427 !! test
6428 Magic Word: {{PAGENAME}}
6429 !! options
6430 title=[[User:Ævar Arnfjörð Bjarmason]]
6431 !! input
6432 {{PAGENAME}}
6433 !! result
6434 <p>Ævar Arnfjörð Bjarmason
6435 </p>
6436 !! end
6437
6438 !! test
6439 Magic Word: {{PAGENAME}} with metacharacters
6440 !! options
6441 title=[['foo & bar = baz']]
6442 !! input
6443 ''{{PAGENAME}}''
6444 !! result
6445 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6446 </p>
6447 !! end
6448
6449 !! test
6450 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6451 !! options
6452 title=[[*RFC 1234 http://example.com/]]
6453 !! input
6454 {{PAGENAME}}
6455 !! result
6456 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6457 </p>
6458 !! end
6459
6460 !! test
6461 Magic Word: {{PAGENAMEE}}
6462 !! options
6463 title=[[User:Ævar Arnfjörð Bjarmason]]
6464 !! input
6465 {{PAGENAMEE}}
6466 !! result
6467 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6468 </p>
6469 !! end
6470
6471 !! test
6472 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6473 !! options
6474 title=[[*RFC 1234 http://example.com/]]
6475 !! input
6476 {{PAGENAMEE}}
6477 !! result
6478 <p>&#42;RFC_1234_http&#58;//example.com/
6479 </p>
6480 !! end
6481
6482 !! test
6483 Magic Word: {{REVISIONID}}
6484 !! input
6485 {{REVISIONID}}
6486 !! result
6487 <p>1337
6488 </p>
6489 !! end
6490
6491 !! test
6492 Magic Word: {{SCRIPTPATH}}
6493 !! input
6494 {{SCRIPTPATH}}
6495 !! result
6496 <p>/
6497 </p>
6498 !! end
6499
6500 !! test
6501 Magic Word: {{STYLEPATH}}
6502 !! input
6503 {{STYLEPATH}}
6504 !! result
6505 <p>/skins
6506 </p>
6507 !! end
6508
6509 !! test
6510 Magic Word: {{SERVER}}
6511 !! input
6512 {{SERVER}}
6513 !! result
6514 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6515 </p>
6516 !! end
6517
6518 !! test
6519 Magic Word: {{SERVERNAME}}
6520 !! input
6521 {{SERVERNAME}}
6522 !! result
6523 <p>example.org
6524 </p>
6525 !! end
6526
6527 !! test
6528 Magic Word: {{SITENAME}}
6529 !! input
6530 {{SITENAME}}
6531 !! result
6532 <p>MediaWiki
6533 </p>
6534 !! end
6535
6536 !! test
6537 Case-sensitive magic words, when cased differently, should just be template transclusions
6538 !! input
6539 {{CurrentMonth}}
6540 {{currentday}}
6541 {{cURreNTweEK}}
6542 {{currentHour}}
6543 !! result
6544 <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>
6545 <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>
6546 <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>
6547 <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>
6548 </p>
6549 !! end
6550
6551 !! test
6552 Case-insensitive magic words should still work with weird casing.
6553 !! input
6554 {{sErVeRNaMe}}
6555 {{LCFirst:AOEU}}
6556 {{ucFIRST:aoeu}}
6557 {{SERver}}
6558 !! result
6559 <p>example.org
6560 aOEU
6561 Aoeu
6562 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6563 </p>
6564 !! end
6565
6566 !! test
6567 Namespace 1 {{ns:1}}
6568 !! input
6569 {{ns:1}}
6570 !! result
6571 <p>Talk
6572 </p>
6573 !! end
6574
6575 !! test
6576 Namespace 1 {{ns:01}}
6577 !! input
6578 {{ns:01}}
6579 !! result
6580 <p>Talk
6581 </p>
6582 !! end
6583
6584 !! test
6585 Namespace 0 {{ns:0}} (bug 4783)
6586 !! input
6587 {{ns:0}}
6588 !! result
6589
6590 !! end
6591
6592 !! test
6593 Namespace 0 {{ns:00}} (bug 4783)
6594 !! input
6595 {{ns:00}}
6596 !! result
6597
6598 !! end
6599
6600 !! test
6601 Namespace -1 {{ns:-1}}
6602 !! input
6603 {{ns:-1}}
6604 !! result
6605 <p>Special
6606 </p>
6607 !! end
6608
6609 !! test
6610 Namespace User {{ns:User}}
6611 !! input
6612 {{ns:User}}
6613 !! result
6614 <p>User
6615 </p>
6616 !! end
6617
6618 !! test
6619 Namespace User talk {{ns:User_talk}}
6620 !! input
6621 {{ns:User_talk}}
6622 !! result
6623 <p>User talk
6624 </p>
6625 !! end
6626
6627 !! test
6628 Namespace User talk {{ns:uSeR tAlK}}
6629 !! input
6630 {{ns:uSeR tAlK}}
6631 !! result
6632 <p>User talk
6633 </p>
6634 !! end
6635
6636 !! test
6637 Namespace File {{ns:File}}
6638 !! input
6639 {{ns:File}}
6640 !! result
6641 <p>File
6642 </p>
6643 !! end
6644
6645 !! test
6646 Namespace File {{ns:Image}}
6647 !! input
6648 {{ns:Image}}
6649 !! result
6650 <p>File
6651 </p>
6652 !! end
6653
6654 !! test
6655 Namespace (lang=de) Benutzer {{ns:User}}
6656 !! options
6657 language=de
6658 !! input
6659 {{ns:User}}
6660 !! result
6661 <p>Benutzer
6662 </p>
6663 !! end
6664
6665 !! test
6666 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
6667 !! options
6668 language=de
6669 !! input
6670 {{ns:3}}
6671 !! result
6672 <p>Benutzer Diskussion
6673 </p>
6674 !! end
6675
6676
6677 !! test
6678 Urlencode
6679 !! input
6680 {{urlencode:hi world?!}}
6681 {{urlencode:hi world?!|WIKI}}
6682 {{urlencode:hi world?!|PATH}}
6683 {{urlencode:hi world?!|QUERY}}
6684 !! result
6685 <p>hi+world%3F%21
6686 hi_world%3F!
6687 hi%20world%3F%21
6688 hi+world%3F%21
6689 </p>
6690 !! end
6691
6692 ###
6693 ### Magic links
6694 ###
6695 !! test
6696 Magic links: internal link to RFC (bug 479)
6697 !! input
6698 [[RFC 123]]
6699 !! result
6700 <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>
6701 </p>
6702 !! end
6703
6704 !! test
6705 Magic links: RFC (bug 479)
6706 !! input
6707 RFC 822
6708 !! result
6709 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
6710 </p>
6711 !! end
6712
6713 !! test
6714 Magic links: ISBN (bug 1937)
6715 !! input
6716 ISBN 0-306-40615-2
6717 !! result
6718 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
6719 </p>
6720 !! end
6721
6722 !! test
6723 Magic links: PMID incorrectly converts space to underscore
6724 !! input
6725 PMID 1234
6726 !! result
6727 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
6728 </p>
6729 !! end
6730
6731 ###
6732 ### Templates
6733 ####
6734
6735 !! test
6736 Nonexistent template
6737 !! input
6738 {{thistemplatedoesnotexist}}
6739 !! result
6740 <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>
6741 </p>
6742 !! end
6743
6744 !! test
6745 Template with invalid target containing tags
6746 !! input
6747 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6748 !! result
6749 <p>{{a<b>b</b>|foo|a=b|a = b}}
6750 </p>
6751 !! end
6752
6753 !! test
6754 Template with invalid target containing unclosed tag
6755 !! input
6756 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
6757 !! result
6758 <p>{{a<b>|foo|a=b|a = b}}</b>
6759 </p>
6760 !! end
6761
6762 !! article
6763 Template:test
6764 !! text
6765 This is a test template
6766 !! endarticle
6767
6768 !! test
6769 Simple template
6770 !! input
6771 {{test}}
6772 !! result
6773 <p>This is a test template
6774 </p>
6775 !! end
6776
6777 !! test
6778 Template with explicit namespace
6779 !! input
6780 {{Template:test}}
6781 !! result
6782 <p>This is a test template
6783 </p>
6784 !! end
6785
6786
6787 !! article
6788 Template:paramtest
6789 !! text
6790 This is a test template with parameter {{{param}}}
6791 !! endarticle
6792
6793 !! test
6794 Template parameter
6795 !! input
6796 {{paramtest|param=foo}}
6797 !! result
6798 <p>This is a test template with parameter foo
6799 </p>
6800 !! end
6801
6802 !! article
6803 Template:paramtestnum
6804 !! text
6805 [[{{{1}}}|{{{2}}}]]
6806 !! endarticle
6807
6808 !! test
6809 Template unnamed parameter
6810 !! input
6811 {{paramtestnum|Main Page|the main page}}
6812 !! result
6813 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6814 </p>
6815 !! end
6816
6817 !! article
6818 Template:templatesimple
6819 !! text
6820 (test)
6821 !! endarticle
6822
6823 !! article
6824 Template:templateredirect
6825 !! text
6826 #redirect [[Template:templatesimple]]
6827 !! endarticle
6828
6829 !! article
6830 Template:templateasargtestnum
6831 !! text
6832 {{{{{1}}}}}
6833 !! endarticle
6834
6835 !! article
6836 Template:templateasargtest
6837 !! text
6838 {{template{{{templ}}}}}
6839 !! endarticle
6840
6841 !! article
6842 Template:templateasargtest2
6843 !! text
6844 {{{{{templ}}}}}
6845 !! endarticle
6846
6847 !! test
6848 Template with template name as unnamed argument
6849 !! input
6850 {{templateasargtestnum|templatesimple}}
6851 !! result
6852 <p>(test)
6853 </p>
6854 !! end
6855
6856 !! test
6857 Template with template name as argument
6858 !! input
6859 {{templateasargtest|templ=simple}}
6860 !! result
6861 <p>(test)
6862 </p>
6863 !! end
6864
6865 !! test
6866 Template with template name as argument (2)
6867 !! input
6868 {{templateasargtest2|templ=templatesimple}}
6869 !! result
6870 <p>(test)
6871 </p>
6872 !! end
6873
6874 !! article
6875 Template:templateasargtestdefault
6876 !! text
6877 {{{{{templ|templatesimple}}}}}
6878 !! endarticle
6879
6880 !! article
6881 Template:templa
6882 !! text
6883 '''templ'''
6884 !! endarticle
6885
6886 !! test
6887 Template with default value
6888 !! input
6889 {{templateasargtestdefault}}
6890 !! result
6891 <p>(test)
6892 </p>
6893 !! end
6894
6895 !! test
6896 Template with default value (value set)
6897 !! input
6898 {{templateasargtestdefault|templ=templa}}
6899 !! result
6900 <p><b>templ</b>
6901 </p>
6902 !! end
6903
6904 !! test
6905 Template redirect
6906 !! input
6907 {{templateredirect}}
6908 !! result
6909 <p>(test)
6910 </p>
6911 !! end
6912
6913 !! test
6914 Template with argument in separate line
6915 !! input
6916 {{ templateasargtest |
6917 templ = simple }}
6918 !! result
6919 <p>(test)
6920 </p>
6921 !! end
6922
6923 !! test
6924 Template with complex template as argument
6925 !! input
6926 {{paramtest|
6927 param ={{ templateasargtest |
6928 templ = simple }}}}
6929 !! result
6930 <p>This is a test template with parameter (test)
6931 </p>
6932 !! end
6933
6934 !! test
6935 Template with thumb image (with link in description)
6936 !! input
6937 {{paramtest|
6938 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6939 !! result
6940 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>
6941
6942 !! end
6943
6944 !! article
6945 Template:complextemplate
6946 !! text
6947 {{{1}}} {{paramtest|
6948 param ={{{param}}}}}
6949 !! endarticle
6950
6951 !! test
6952 Template with complex arguments
6953 !! input
6954 {{complextemplate|
6955 param ={{ templateasargtest |
6956 templ = simple }}|[[Template:complextemplate|link]]}}
6957 !! result
6958 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6959 </p>
6960 !! end
6961
6962 !! test
6963 BUG 553: link with two variables in a piped link
6964 !! input
6965 {|
6966 |[[{{{1}}}|{{{2}}}]]
6967 |}
6968 !! result
6969 <table>
6970 <tr>
6971 <td>[[{{{1}}}|{{{2}}}]]
6972 </td></tr></table>
6973
6974 !! end
6975
6976 !! test
6977 Magic variable as template parameter
6978 !! input
6979 {{paramtest|param={{SITENAME}}}}
6980 !! result
6981 <p>This is a test template with parameter MediaWiki
6982 </p>
6983 !! end
6984
6985 !! article
6986 Template:linktest
6987 !! text
6988 [[{{{param}}}|link]]
6989 !! endarticle
6990
6991 !! test
6992 Template parameter as link source
6993 !! input
6994 {{linktest|param=Main Page}}
6995 !! result
6996 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6997 </p>
6998 !! end
6999
7000 !!test
7001 Template-generated attribute string (k='v')
7002 !!input
7003 <span {{attr_str|id|v1}}>bar</span>
7004 !!result
7005 <p><span id="v1">bar</span>
7006 </p>
7007 !!end
7008
7009 !!article
7010 Template:paramtest2
7011 !! text
7012 including another template, {{paramtest|param={{{arg}}}}}
7013 !! endarticle
7014
7015 !! test
7016 Template passing argument to another template
7017 !! input
7018 {{paramtest2|arg='hmm'}}
7019 !! result
7020 <p>including another template, This is a test template with parameter 'hmm'
7021 </p>
7022 !! end
7023
7024 !! article
7025 Template:Linktest2
7026 !! text
7027 Main Page
7028 !! endarticle
7029
7030 !! test
7031 Template as link source
7032 !! input
7033 [[{{linktest2}}]]
7034
7035 [[{{linktest2}}|Main Page]]
7036
7037 [[{{linktest2}}]]Page
7038 !! result
7039 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7040 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7041 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7042 </p>
7043 !! end
7044
7045
7046 !! article
7047 Template:loop1
7048 !! text
7049 {{loop2}}
7050 !! endarticle
7051
7052 !! article
7053 Template:loop2
7054 !! text
7055 {{loop1}}
7056 !! endarticle
7057
7058 !! test
7059 Template infinite loop
7060 !! input
7061 {{loop1}}
7062 !! result
7063 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7064 </p>
7065 !! end
7066
7067 !! test
7068 Template from main namespace
7069 !! input
7070 {{:Main Page}}
7071 !! result
7072 <p>blah blah
7073 </p>
7074 !! end
7075
7076 !! article
7077 Template:table
7078 !! text
7079 {|
7080 | 1 || 2
7081 |-
7082 | 3 || 4
7083 |}
7084 !! endarticle
7085
7086 !! test
7087 BUG 529: Template with table, not included at beginning of line
7088 !! input
7089 foo {{table}}
7090 !! result
7091 <p>foo
7092 </p>
7093 <table>
7094 <tr>
7095 <td> 1 </td>
7096 <td> 2
7097 </td></tr>
7098 <tr>
7099 <td> 3 </td>
7100 <td> 4
7101 </td></tr></table>
7102
7103 !! end
7104
7105 !! test
7106 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7107 !! input
7108 foo
7109 {{table}}
7110 !! result
7111 <p>foo
7112 </p>
7113 <table>
7114 <tr>
7115 <td> 1 </td>
7116 <td> 2
7117 </td></tr>
7118 <tr>
7119 <td> 3 </td>
7120 <td> 4
7121 </td></tr></table>
7122
7123 !! end
7124
7125 !! test
7126 BUG 41: Template parameters shown as broken links
7127 !! input
7128 {{{parameter}}}
7129 !! result
7130 <p>{{{parameter}}}
7131 </p>
7132 !! end
7133
7134 !! test
7135 Template with targets containing wikilinks
7136 !! input
7137 {{[[foo]]}}
7138
7139 {{[[{{echo|foo}}]]}}
7140
7141 {{{{echo|[[foo}}]]}}
7142 !! result
7143 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7144 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7145 </p><p>{{[[foo}}]]
7146 </p>
7147 !! end
7148
7149 !! article
7150 Template:MSGNW test
7151 !! text
7152 ''None'' of '''this''' should be
7153 * interpreted
7154 but rather passed unmodified
7155 {{test}}
7156 !! endarticle
7157
7158 # hmm, fix this or just deprecate msgnw and document its behavior?
7159 !! test
7160 msgnw keyword
7161 !! options
7162 disabled
7163 !! input
7164 {{msgnw:MSGNW test}}
7165 !! result
7166 <p>''None'' of '''this''' should be
7167 * interpreted
7168 but rather passed unmodified
7169 {{test}}
7170 </p>
7171 !! end
7172
7173 !! test
7174 int keyword
7175 !! input
7176 {{int:youhavenewmessages|lots of money|not!}}
7177 !! result
7178 <p>You have lots of money (not!).
7179 </p>
7180 !! end
7181
7182 !! article
7183 Template:Includes
7184 !! text
7185 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7186 !! endarticle
7187
7188 !! test
7189 <includeonly> and <noinclude> being included
7190 !! input
7191 {{Includes}}
7192 !! result
7193 <p>Foobar
7194 </p>
7195 !! end
7196
7197 !! article
7198 Template:Includes2
7199 !! text
7200 <onlyinclude>Foo</onlyinclude>bar
7201 !! endarticle
7202
7203 !! test
7204 <onlyinclude> being included
7205 !! input
7206 {{Includes2}}
7207 !! result
7208 <p>Foo
7209 </p>
7210 !! end
7211
7212
7213 !! article
7214 Template:Includes3
7215 !! text
7216 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7217 !! endarticle
7218
7219 !! test
7220 <onlyinclude> and <includeonly> being included
7221 !! input
7222 {{Includes3}}
7223 !! result
7224 <p>Foo
7225 </p>
7226 !! end
7227
7228 !! test
7229 <includeonly> and <noinclude> on a page
7230 !! input
7231 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7232 !! result
7233 <p>Foozar
7234 </p>
7235 !! end
7236
7237 !! test
7238 Un-closed <noinclude>
7239 !! input
7240 <noinclude>
7241 !! result
7242 !! end
7243
7244 !! test
7245 <onlyinclude> on a page
7246 !! input
7247 <onlyinclude>Foo</onlyinclude>bar
7248 !! result
7249 <p>Foobar
7250 </p>
7251 !! end
7252
7253 !! test
7254 Un-closed <onlyinclude>
7255 !! input
7256 <onlyinclude>
7257 !! result
7258 !! end
7259
7260 !!test
7261 Self-closed noinclude, includeonly, onlyinclude tags
7262 !!input
7263 <noinclude />
7264 <includeonly />
7265 <onlyinclude />
7266 !!result
7267 <p><br />
7268 </p>
7269 !!end
7270
7271 !!test
7272 Unbalanced includeonly and noinclude tags
7273 !!input
7274 {|
7275 |a</noinclude>
7276 |b</noinclude></noinclude>
7277 |c</noinclude></includeonly>
7278 |d</includeonly></includeonly>
7279 |}
7280 !!result
7281 <table>
7282 <tr>
7283 <td>a
7284 </td>
7285 <td>b
7286 </td>
7287 <td>c&lt;/includeonly&gt;
7288 </td>
7289 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7290 </td></tr></table>
7291
7292 !!end
7293
7294 !! article
7295 Template:Includeonly section
7296 !! text
7297 <includeonly>
7298 ==Includeonly section==
7299 </includeonly>
7300 ==Section T-1==
7301 !!endarticle
7302
7303 !! test
7304 Bug 6563: Edit link generation for section shown by <includeonly>
7305 !! input
7306 {{includeonly section}}
7307 !! result
7308 <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>
7309 <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>
7310
7311 !! end
7312
7313 # Uses same input as the contents of [[Template:Includeonly section]]
7314 !! test
7315 Bug 6563: Section extraction for section shown by <includeonly>
7316 !! options
7317 section=T-2
7318 !! input
7319 <includeonly>
7320 ==Includeonly section==
7321 </includeonly>
7322 ==Section T-2==
7323 !! result
7324 ==Section T-2==
7325 !! end
7326
7327 !! test
7328 Bug 6563: Edit link generation for section suppressed by <includeonly>
7329 !! input
7330 <includeonly>
7331 ==Includeonly section==
7332 </includeonly>
7333 ==Section 1==
7334 !! result
7335 <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>
7336
7337 !! end
7338
7339 !! test
7340 Bug 6563: Section extraction for section suppressed by <includeonly>
7341 !! options
7342 section=1
7343 !! input
7344 <includeonly>
7345 ==Includeonly section==
7346 </includeonly>
7347 ==Section 1==
7348 !! result
7349 ==Section 1==
7350 !! end
7351
7352 !! test
7353 Un-closed <includeonly>
7354 !! input
7355 <includeonly>
7356 !! result
7357 !! end
7358
7359 # TODO: test with DOM fragment reuse!
7360 !! test
7361 Parsoid: DOM fragment reuse
7362 !! options
7363 parsoid=wt2wt,wt2html
7364 !! input
7365 a{{echo|b<table></table>c}}d
7366
7367 a{{echo|b
7368 <table></table>
7369 c}}d
7370
7371 {{echo|a
7372
7373 <table></table>
7374
7375 b}}
7376 !! result
7377 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7378 <table></table>c"}},"i":0}}]}'>b</span>
7379 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7380
7381
7382 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
7383 </span>
7384 <table about="#mwt2"></table><span about="#mwt2">
7385 </span>
7386 <p about="#mwt2">cd</p>
7387
7388
7389 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
7390
7391 </span>
7392 <table about="#mwt3"></table><span about="#mwt3">
7393
7394 </span>
7395 <p about="#mwt3">b</p>
7396 !! end
7397
7398 !! test
7399 Parsoid: Merge double tds (bug 50603)
7400 !! options
7401 parsoid
7402 !! input
7403 {|
7404 |{{echo|{{!}} foo}}
7405 |}
7406 !! result
7407 <table><tbody>
7408 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
7409 </tbody></table>
7410 !! end
7411
7412 !! test
7413 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7414 !! options
7415 parsoid
7416 !! input
7417 {{echo|<div>}}
7418 {|
7419 |{{echo|{{!}} foo}}
7420 |}
7421 {{echo|</div>}}
7422 !! result
7423 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
7424 <table><tbody>
7425 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7426 </tbody></table>
7427 </div>
7428 !! end
7429
7430 ###
7431 ### <includeonly> and <noinclude> in attributes
7432 ###
7433 !!test
7434 0. includeonly around the entire attribute
7435 !!input
7436 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7437 !!result
7438 <p><span id="v2">bar</span>
7439 </p>
7440 !!end
7441
7442 !!test
7443 1. includeonly in html attr key
7444 !!input
7445 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7446 !!result
7447 <p><span id="foo">bar</span>
7448 </p>
7449 !!end
7450
7451 !!test
7452 2. includeonly in html attr value
7453 !!input
7454 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7455 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7456 !!result
7457 <p><span id="v1">bar</span>
7458 <span id="v1">bar</span>
7459 </p>
7460 !!end
7461
7462 !!test
7463 3. includeonly in part of an attr value
7464 !!input
7465 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7466 !!result
7467 <p><span style="color:red;">bar</span>
7468 </p>
7469 !!end
7470
7471 ###
7472 ### Testing parsing of templates where a template arg
7473 ### has the same name as the template itself.
7474 ###
7475
7476 !! article
7477 Template:quote
7478 !! text
7479 {{{quote|{{{1}}}}}}
7480 !! endarticle
7481
7482 !!test
7483 Templates: Template Name/Arg clash: 1. Use of positional param
7484 !!input
7485 {{quote|foo}}
7486 !!result
7487 <p>foo
7488 </p>
7489 !!end
7490
7491 !!test
7492 Templates: Template Name/Arg clash: 2. Use of named param
7493 !!input
7494 {{quote|quote=foo}}
7495 !!result
7496 <p>foo
7497 </p>
7498 !!end
7499
7500 !!test
7501 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7502 !!input
7503 {{quote|quote}}
7504 !!result
7505 <p>quote
7506 </p>
7507 !!end
7508
7509 ###
7510 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7511 ###
7512
7513 !!test
7514 Templates: 1. Simple use
7515 !!input
7516 {{echo|Foo}}
7517 !!result
7518 <p>Foo
7519 </p>
7520 !!end
7521
7522 !!test
7523 Templates: 2. Inside a block tag
7524 !!input
7525 <div>{{echo|Foo}}</div>
7526 <blockquote>{{echo|Foo}}</blockquote>
7527 !!result
7528 <div>Foo</div>
7529 <blockquote>Foo</blockquote>
7530
7531 !!end
7532
7533 !!test
7534 Templates: P-wrapping: 1a. Templates on consecutive lines
7535 !!input
7536 {{echo|Foo}}
7537 {{echo|bar}}
7538 !!result
7539 <p>Foo
7540 bar
7541 </p>
7542 !!end
7543
7544 !!test
7545 Templates: P-wrapping: 1b. Templates on consecutive lines
7546 !!input
7547 Foo
7548
7549 {{echo|bar}}
7550 {{echo|baz}}
7551 !!result
7552 <p>Foo
7553 </p><p>bar
7554 baz
7555 </p>
7556 !!end
7557
7558 !!test
7559 Templates: P-wrapping: 1c. Templates on consecutive lines
7560 !!input
7561 {{echo|Foo}}
7562 {{echo|bar}} <div>baz</div>
7563 !!result
7564 <p>Foo
7565 </p>
7566 bar <div>baz</div>
7567
7568 !!end
7569
7570 !!test
7571 Templates: P-wrapping: 1d. Template preceded by comment-only line
7572 !!options
7573 parsoid
7574 !!input
7575 <!-- foo -->
7576 {{echo|Bar}}
7577 !!result
7578 <!-- foo -->
7579
7580 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
7581 !!end
7582
7583 !!test
7584 Templates: Inline Text: 1. Multiple tmeplate uses
7585 !!input
7586 {{echo|Foo}}bar{{echo|baz}}
7587 !!result
7588 <p>Foobarbaz
7589 </p>
7590 !!end
7591
7592 !!test
7593 Templates: Inline Text: 2. Back-to-back template uses
7594 !!input
7595 {{echo|Foo}}{{echo|bar}}
7596 !!result
7597 <p>Foobar
7598 </p>
7599 !!end
7600
7601 !!test
7602 Templates: Block Tags: 1. Multiple template uses
7603 !!input
7604 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
7605 !!result
7606 <div>Foo</div><div>bar</div><div>baz</div>
7607
7608 !!end
7609
7610 !!test
7611 Templates: Block Tags: 2. Back-to-back template uses
7612 !!input
7613 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
7614 !!result
7615 <div>Foo</div><div>bar</div>
7616
7617 !!end
7618
7619 !!test
7620 Templates: Links: 1. Simple example
7621 !!input
7622 {{echo|[[Foo|bar]]}}
7623 !!result
7624 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7625 </p>
7626 !!end
7627
7628 !!test
7629 Templates: Links: 2. Generation of link href
7630 !!input
7631 [[{{echo|Foo}}|bar]]
7632 !!result
7633 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7634 </p>
7635 !!end
7636
7637 !!test
7638 Templates: Links: 3. Generation of part of a link href
7639 !!input
7640 [[Fo{{echo|o}}|bar]]
7641
7642 [[Foo{{echo|bar}}]]
7643
7644 [[Foo{{echo|bar}}baz]]
7645
7646 [[Foo{{echo|bar}}|bar]]
7647
7648 [[:Foo{{echo|bar}}]]
7649
7650 [[:Foo{{echo|bar}}|bar]]
7651 !!result
7652 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7653 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7654 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
7655 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7656 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7657 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
7658 </p>
7659 !!end
7660
7661 !!test
7662 Templates: Links: 4. Multiple templates generating link href
7663 !!input
7664 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
7665 !!result
7666 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
7667 </p>
7668 !!end
7669
7670 !!test
7671 Templates: Links: 5. Generation of link text
7672 !!input
7673 [[Foo|{{echo|bar}}]]
7674 !!result
7675 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7676 </p>
7677 !!end
7678
7679 !!test
7680 Templates: Links: 5. Nested templates (only outermost template should be marked)
7681 !!input
7682 {{echo|[[{{echo|Foo}}|bar]]}}
7683 !!result
7684 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
7685 </p>
7686 !!end
7687
7688 !!test
7689 Templates: HTML Tag: 1. Generation of HTML attr. key
7690 !!input
7691 <div {{echo|style}}="color:red;">foo</div>
7692 !!result
7693 <div style="color:red;">foo</div>
7694
7695 !!end
7696
7697 !!test
7698 Templates: HTML Tag: 2. Generation of HTML attr. value
7699 !!input
7700 <div style={{echo|'color:red;'}}>foo</div>
7701 !!result
7702 <div style="color:red;">foo</div>
7703
7704 !!end
7705
7706 !!test
7707 Templates: HTML Tag: 3. Generation of HTML attr key and value
7708 !!input
7709 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
7710 !!result
7711 <div style="color:red;">foo</div>
7712
7713 !!end
7714
7715 !!test
7716 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
7717 !!input
7718 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
7719 !!result
7720 <div title="This is a long title with just one piece templated">foo</div>
7721
7722 !!end
7723
7724 !!test
7725 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
7726 !!input
7727 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
7728 !!result
7729 <div title="This is a long title with just one piece templated">foo</div>
7730
7731 !!end
7732
7733 !!test
7734 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
7735 !!input
7736 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
7737 !!result
7738 <div title="This is a long title with just one piece templated">foo</div>
7739
7740 !!end
7741
7742 !!test
7743 Templates: HTML Tag: 7. Generation of partial attribute key string
7744 !!input
7745 <div st{{echo|yle}}="color:red;">foo</div>
7746 !!result
7747 <div style="color:red;">foo</div>
7748
7749 !!end
7750
7751 !!test
7752 Templates: HTML Tables: 1. Generating start of a HTML table
7753 !!input
7754 {{echo|<table><tr><td>foo</td>}}</tr></table>
7755 !!result
7756 <table><tr><td>foo</td></tr></table>
7757
7758 !!end
7759
7760 !!test
7761 Templates: HTML Tables: 2a. Generating middle of a HTML table
7762 !!input
7763 <table><tr>{{echo|<td>foo</td>}}</tr></table>
7764 !!result
7765 <table><tr><td>foo</td></tr></table>
7766
7767 !!end
7768
7769 !!test
7770 Templates: HTML Tables: 2b. Generating middle of a HTML table
7771 !!input
7772 <table>{{echo|<tr><td>foo</td></tr>}}</table>
7773 !!result
7774 <table><tr><td>foo</td></tr></table>
7775
7776 !!end
7777
7778 !!test
7779 Templates: HTML Tables: 3. Generating end of a HTML table
7780 !!input
7781 <table><tr>{{echo|<td>foo</td></tr></table>}}
7782 !!result
7783 <table><tr><td>foo</td></tr></table>
7784
7785 !!end
7786
7787 !!test
7788 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
7789 !!input
7790 {{echo|<table>}}<tr><td>foo</td></tr></table>
7791 !!result
7792 <table><tr><td>foo</td></tr></table>
7793
7794 !!end
7795
7796 !!test
7797 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
7798 !!input
7799 <table>{{echo|<tr>}}<td>foo</td></tr></table>
7800 !!result
7801 <table><tr><td>foo</td></tr></table>
7802
7803 !!end
7804
7805 !!test
7806 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
7807 !!input
7808 <table><tr>{{echo|<td>}}foo</td></tr></table>
7809 !!result
7810 <table><tr><td>foo</td></tr></table>
7811
7812 !!end
7813
7814 !!test
7815 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
7816 !!input
7817 <table><tr><td>foo{{echo|</td>}}</tr></table>
7818 !!result
7819 <table><tr><td>foo</td></tr></table>
7820
7821 !!end
7822
7823 !!test
7824 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
7825 !!input
7826 <table><tr><td>foo</td>{{echo|</tr>}}</table>
7827 !!result
7828 <table><tr><td>foo</td></tr></table>
7829
7830 !!end
7831
7832 !!test
7833 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
7834 !!input
7835 <table><tr><td>foo</td></tr>{{echo|</table>}}
7836 !!result
7837 <table><tr><td>foo</td></tr></table>
7838
7839 !!end
7840
7841 !!test
7842 Templates: HTML Tables: 5. Proper fostering of categories from inside
7843 !!options
7844 parsoid=wt2html,wt2wt
7845 !!input
7846 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7847 <!--Two categories (Bug 50330)-->
7848 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7849 !!result
7850 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7851 <!--Two categories (Bug 50330)-->
7852 <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>
7853 !!end
7854
7855 !!test
7856 Templates: Wiki Tables: 1a. Fostering of entire template content
7857 !!input
7858 {|
7859 {{echo|a}}
7860 |}
7861 !!result
7862 <table>
7863 a
7864 <tr><td></td></tr></table>
7865
7866 !!end
7867
7868 !!test
7869 Templates: Wiki Tables: 1b. Fostering of entire template content
7870 !!input
7871 {|
7872 {{echo|<div>}}
7873 foo
7874 {{echo|</div>}}
7875 |}
7876 !!result
7877 <table>
7878 <div>
7879 <p>foo
7880 </p>
7881 </div>
7882 <tr><td></td></tr></table>
7883
7884 !!end
7885
7886 !!test
7887 Templates: Wiki Tables: 2. Fostering of partial template content
7888 !!input
7889 {|
7890 {{echo|a
7891 <div>b</div>}}
7892 |}
7893 !!result
7894 <table>
7895 a
7896 <div>b</div>
7897 <tr><td></td></tr></table>
7898
7899 !!end
7900
7901 !!test
7902 Templates: Wiki Tables: 3. td-content via multiple templates
7903 !!input
7904 {|
7905 {{echo|{{pipe}}a}}{{echo|b}}
7906 |}
7907 !!result
7908 <table>
7909 <tr>
7910 <td>ab
7911 </td></tr></table>
7912
7913 !!end
7914
7915 !!test
7916 Templates: Wiki Tables: 4. Templated tags, no content
7917 !!input
7918 {{tbl-start}}
7919 {{tbl-end}}
7920 !!result
7921 <table>
7922 <tr><td></td></tr></table>
7923
7924 !!end
7925
7926 !!test
7927 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7928 !!input
7929 {{tbl-start}}
7930 |foo
7931 {{tbl-end}}
7932 !!result
7933 <table>
7934 <tr>
7935 <td>foo
7936 </td></tr></table>
7937
7938 !!end
7939
7940 !!test
7941 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7942 !!input
7943 {{tbl-start}}
7944 {{!}}foo
7945 {{tbl-end}}
7946 !!result
7947 <table>
7948 <tr>
7949 <td>foo
7950 </td></tr></table>
7951
7952 !!end
7953
7954 !!test
7955 Templates: Lists: Multi-line list-items via templates
7956 !!input
7957 *{{echo|a {{nonexistent|
7958 unused}}}}
7959 *{{echo|b {{nonexistent|
7960 unused}}}}
7961 !!result
7962 <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>
7963 </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>
7964 </li></ul>
7965
7966 !!end
7967
7968 !!test
7969 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7970 !!input
7971 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7972 !!result
7973 <p><i>ab</i>c<i>d</i>e
7974 </p>
7975 !!end
7976
7977 !!test
7978 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7979 (PHP parser generates misnested html)
7980 !! options
7981 parsoid
7982 !!input
7983 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7984 !!result
7985 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
7986 !!end
7987
7988 !!test
7989 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7990 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
7991 !! options
7992 parsoid=wt2html,wt2wt
7993 !!input
7994 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7995 !!result
7996 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
7997 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
7998 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
7999 !!end
8000
8001 !!test
8002 Templates: Ugly nesting: 4. Divs opened/closed across templates
8003 !!input
8004 a<div>b{{echo|c</div>d}}e
8005 !!result
8006 a<div>bc</div>de
8007
8008 !!end
8009
8010 !!test
8011 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8012 (Parsoid-centric)
8013 !! options
8014 parsoid
8015 !!input
8016 {|
8017 |{{echo|foo</table>}}
8018 |bar
8019 |}
8020 !!result
8021 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
8022
8023 <tbody>
8024 <tr>
8025 <td>foo</td></tr></tbody></table><span about="#mwt1">
8026 </span><span about="#mwt1">bar</span><span about="#mwt1">
8027 </span>
8028 !!end
8029
8030 !!test
8031 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8032 (Parsoid-centric)
8033 !! options
8034 parsoid
8035 !!input
8036 <table>
8037 <tr>
8038 <td>
8039 <table>
8040 <tr>
8041 <td>1. {{echo|foo </table>}}</td>
8042 <td> bar </td>
8043 <td>2. {{echo|baz </table>}}</td>
8044 </tr>
8045 <tr>
8046 <td>abc</td>
8047 </tr>
8048 </table>
8049 </td>
8050 </tr>
8051 <tr>
8052 <td>xyz</td>
8053 </tr>
8054 </table>
8055 !!result
8056 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
8057 <tbody><tr>
8058 <td>
8059 <table>
8060 <tbody><tr>
8061 <td>1. foo </td></tr></tbody></table></td>
8062 <td> bar </td>
8063 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8064 </span><span about="#mwt2">
8065 </span><span about="#mwt2">
8066 </span><span about="#mwt2">abc</span><span about="#mwt2">
8067 </span><span about="#mwt2">
8068 </span><span about="#mwt2">
8069 </span><span about="#mwt2">
8070 </span><span about="#mwt2">
8071 </span><span about="#mwt2">
8072 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8073 </span><span about="#mwt2">
8074 </span>
8075 !!end
8076
8077 !! test
8078 Templates: Ugly templates: 3. newline-only template parameter
8079 !! input
8080 foo {{echo|
8081 }}
8082 !! result
8083 <p>foo
8084 </p>
8085 !! end
8086
8087 # This looks like a bug: a single newline triggers p/br for some reason.
8088 !! test
8089 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8090 !! input
8091 {{echo|
8092 }}
8093 !! result
8094 <p><br />
8095 </p>
8096 !! end
8097
8098
8099 !!test
8100 Parser Functions: 1. Simple example
8101 !!input
8102 {{uc:foo}}
8103 !!result
8104 <p>FOO
8105 </p>
8106 !!end
8107
8108 !!test
8109 Parser Functions: 2. Nested use (only outermost should be marked up)
8110 !!input
8111 {{uc:{{lc:FOO}}}}
8112 !!result
8113 <p>FOO
8114 </p>
8115 !!end
8116
8117 ###
8118 ### Pre-save transform tests
8119 ###
8120 !! test
8121 pre-save transform: subst:
8122 !! options
8123 PST
8124 !! input
8125 {{subst:test}}
8126 !! result
8127 This is a test template
8128 !! end
8129
8130 !! test
8131 pre-save transform: normal template
8132 !! options
8133 PST
8134 !! input
8135 {{test}}
8136 !! result
8137 {{test}}
8138 !! end
8139
8140 !! test
8141 pre-save transform: nonexistent template
8142 !! options
8143 PST
8144 !! input
8145 {{thistemplatedoesnotexist}}
8146 !! result
8147 {{thistemplatedoesnotexist}}
8148 !! end
8149
8150
8151 !! test
8152 pre-save transform: subst magic variables
8153 !! options
8154 PST
8155 !! input
8156 {{subst:SITENAME}}
8157 !! result
8158 MediaWiki
8159 !! end
8160
8161 # This is bug 89, which I fixed. -- wtm
8162 !! test
8163 pre-save transform: subst: templates with parameters
8164 !! options
8165 pst
8166 !! input
8167 {{subst:paramtest|param="something else"}}
8168 !! result
8169 This is a test template with parameter "something else"
8170 !! end
8171
8172 !! article
8173 Template:nowikitest
8174 !! text
8175 <nowiki>'''not wiki'''</nowiki>
8176 !! endarticle
8177
8178 !! test
8179 pre-save transform: nowiki in subst (bug 1188)
8180 !! options
8181 pst
8182 !! input
8183 {{subst:nowikitest}}
8184 !! result
8185 <nowiki>'''not wiki'''</nowiki>
8186 !! end
8187
8188
8189 !! article
8190 Template:commenttest
8191 !! text
8192 This template has <!-- a comment --> in it.
8193 !! endarticle
8194
8195 !! test
8196 pre-save transform: comment in subst (bug 1936)
8197 !! options
8198 pst
8199 !! input
8200 {{subst:commenttest}}
8201 !! result
8202 This template has <!-- a comment --> in it.
8203 !! end
8204
8205 !! test
8206 pre-save transform: unclosed tag
8207 !! options
8208 pst noxml
8209 !! input
8210 <nowiki>'''not wiki'''
8211 !! result
8212 <nowiki>'''not wiki'''
8213 !! end
8214
8215 !! test
8216 pre-save transform: mixed tag case
8217 !! options
8218 pst noxml
8219 !! input
8220 <NOwiki>'''not wiki'''</noWIKI>
8221 !! result
8222 <NOwiki>'''not wiki'''</noWIKI>
8223 !! end
8224
8225 !! test
8226 pre-save transform: unclosed comment in <nowiki>
8227 !! options
8228 pst noxml
8229 !! input
8230 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8231 !! result
8232 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8233 !!end
8234
8235 # Leading @ in this template definition works around a limitation
8236 # in parsoid's parserTests which otherwise strips the <span> from the
8237 # result (confusing it for a template wrapper)
8238 !! article
8239 Template:dangerous
8240 !!text
8241 @<span onmouseover="alert('crap')">Oh no</span>
8242 !!endarticle
8243
8244 !!test
8245 (confirming safety of fix for subst bug 1936)
8246 !! input
8247 {{Template:dangerous}}
8248 !! result
8249 <p>@<span>Oh no</span>
8250 </p>
8251 !! end
8252
8253 !! test
8254 pre-save transform: comment containing gallery (bug 5024)
8255 !! options
8256 pst
8257 !! input
8258 <!-- <gallery>data</gallery> -->
8259 !!result
8260 <!-- <gallery>data</gallery> -->
8261 !!end
8262
8263 !! test
8264 pre-save transform: comment containing extension
8265 !! options
8266 pst
8267 !! input
8268 <!-- <tag>data</tag> -->
8269 !!result
8270 <!-- <tag>data</tag> -->
8271 !!end
8272
8273 !! test
8274 pre-save transform: comment containing nowiki
8275 !! options
8276 pst
8277 !! input
8278 <!-- <nowiki>data</nowiki> -->
8279 !!result
8280 <!-- <nowiki>data</nowiki> -->
8281 !!end
8282
8283 !! test
8284 pre-save transform: <noinclude> in subst (bug 3298)
8285 !! options
8286 pst
8287 !! input
8288 {{subst:Includes}}
8289 !! result
8290 Foobar
8291 !! end
8292
8293 !! test
8294 pre-save transform: <onlyinclude> in subst (bug 3298)
8295 !! options
8296 pst
8297 !! input
8298 {{subst:Includes2}}
8299 !! result
8300 Foo
8301 !! end
8302
8303 !! article
8304 Template:SubstTest
8305 !!text
8306 {{<includeonly>subst:</includeonly>Includes}}
8307 !! endarticle
8308
8309 !! article
8310 Template:SafeSubstTest
8311 !! text
8312 {{<includeonly>safesubst:</includeonly>Includes}}
8313 !! endarticle
8314
8315 !! test
8316 bug 22297: safesubst: works during PST
8317 !! options
8318 pst
8319 !! input
8320 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8321 !! result
8322 FoobarFoobar
8323 !! end
8324
8325 !! test
8326 bug 22297: safesubst: works during normal parse
8327 !! input
8328 {{SafeSubstTest}}
8329 !! result
8330 <p>Foobar
8331 </p>
8332 !! end
8333
8334 !! test:
8335 subst: does not work during normal parse
8336 !! input
8337 {{SubstTest}}
8338 !! result
8339 <p>{{subst:Includes}}
8340 </p>
8341 !! end
8342
8343 !! test
8344 pre-save transform: context links ("pipe trick")
8345 !! options
8346 pst
8347 !! input
8348 [[Article (context)|]]
8349 [[Bar:Article|]]
8350 [[:Bar:Article|]]
8351 [[Bar:Article (context)|]]
8352 [[:Bar:Article (context)|]]
8353 [[|Article]]
8354 [[|Article (context)]]
8355 [[Bar:X (Y) Z|]]
8356 [[:Bar:X (Y) Z|]]
8357 !! result
8358 [[Article (context)|Article]]
8359 [[Bar:Article|Article]]
8360 [[:Bar:Article|Article]]
8361 [[Bar:Article (context)|Article]]
8362 [[:Bar:Article (context)|Article]]
8363 [[Article]]
8364 [[Article (context)]]
8365 [[Bar:X (Y) Z|X (Y) Z]]
8366 [[:Bar:X (Y) Z|X (Y) Z]]
8367 !! end
8368
8369 !! test
8370 pre-save transform: context links ("pipe trick") with interwiki prefix
8371 !! options
8372 pst
8373 !! input
8374 [[interwiki:Article|]]
8375 [[:interwiki:Article|]]
8376 [[interwiki:Bar:Article|]]
8377 [[:interwiki:Bar:Article|]]
8378 !! result
8379 [[interwiki:Article|Article]]
8380 [[:interwiki:Article|Article]]
8381 [[interwiki:Bar:Article|Bar:Article]]
8382 [[:interwiki:Bar:Article|Bar:Article]]
8383 !! end
8384
8385 !! test
8386 pre-save transform: context links ("pipe trick") with parens in title
8387 !! options
8388 pst title=[[Somearticle (context)]]
8389 !! input
8390 [[|Article]]
8391 !! result
8392 [[Article (context)|Article]]
8393 !! end
8394
8395 !! test
8396 pre-save transform: context links ("pipe trick") with comma in title
8397 !! options
8398 pst title=[[Someplace, Somewhere]]
8399 !! input
8400 [[|Otherplace]]
8401 [[Otherplace, Elsewhere|]]
8402 [[Otherplace, Elsewhere, Anywhere|]]
8403 !! result
8404 [[Otherplace, Somewhere|Otherplace]]
8405 [[Otherplace, Elsewhere|Otherplace]]
8406 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8407 !! end
8408
8409 !! test
8410 pre-save transform: context links ("pipe trick") with parens and comma
8411 !! options
8412 pst title=[[Someplace (IGNORED), Somewhere]]
8413 !! input
8414 [[|Otherplace]]
8415 [[Otherplace (place), Elsewhere|]]
8416 !! result
8417 [[Otherplace, Somewhere|Otherplace]]
8418 [[Otherplace (place), Elsewhere|Otherplace]]
8419 !! end
8420
8421 !! test
8422 pre-save transform: context links ("pipe trick") with comma and parens
8423 !! options
8424 pst title=[[Who, me? (context)]]
8425 !! input
8426 [[|Yes, you.]]
8427 [[Me, Myself, and I (1937 song)|]]
8428 !! result
8429 [[Yes, you. (context)|Yes, you.]]
8430 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8431 !! end
8432
8433 !! test
8434 pre-save transform: context links ("pipe trick") with namespace
8435 !! options
8436 pst title=[[Ns:Somearticle]]
8437 !! input
8438 [[|Article]]
8439 !! result
8440 [[Ns:Article|Article]]
8441 !! end
8442
8443 !! test
8444 pre-save transform: context links ("pipe trick") with namespace and parens
8445 !! options
8446 pst title=[[Ns:Somearticle (context)]]
8447 !! input
8448 [[|Article]]
8449 !! result
8450 [[Ns:Article (context)|Article]]
8451 !! end
8452
8453 !! test
8454 pre-save transform: context links ("pipe trick") with namespace and comma
8455 !! options
8456 pst title=[[Ns:Somearticle, Context, Whatever]]
8457 !! input
8458 [[|Article]]
8459 !! result
8460 [[Ns:Article, Context, Whatever|Article]]
8461 !! end
8462
8463 !! test
8464 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8465 !! options
8466 pst title=[[Ns:Somearticle, Context (context)]]
8467 !! input
8468 [[|Article]]
8469 !! result
8470 [[Ns:Article (context)|Article]]
8471 !! end
8472
8473 !! test
8474 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8475 !! options
8476 pst title=[[Ns:Somearticle (IGNORED), Context]]
8477 !! input
8478 [[|Article]]
8479 !! result
8480 [[Ns:Article, Context|Article]]
8481 !! end
8482
8483 !! test
8484 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8485 !! options
8486 pst
8487 !! input
8488 [[Article(context)|]]
8489 [[Bar:Article(context)|]]
8490 [[:Bar:Article(context)|]]
8491 [[|Article(context)]]
8492 [[Bar:X(Y)Z|]]
8493 [[:Bar:X(Y)Z|]]
8494 !! result
8495 [[Article(context)|Article]]
8496 [[Bar:Article(context)|Article]]
8497 [[:Bar:Article(context)|Article]]
8498 [[Article(context)]]
8499 [[Bar:X(Y)Z|X(Y)Z]]
8500 [[:Bar:X(Y)Z|X(Y)Z]]
8501 !! end
8502
8503 !! test
8504 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8505 !! options
8506 pst
8507 !! input
8508 [[Article (context)|]]
8509 [[Bar:Article (context)|]]
8510 [[:Bar:Article (context)|]]
8511 [[|Article (context)]]
8512 [[Bar:X (Y) Z|]]
8513 [[:Bar:X (Y) Z|]]
8514 !! result
8515 [[Article (context)|Article]]
8516 [[Bar:Article (context)|Article]]
8517 [[:Bar:Article (context)|Article]]
8518 [[Article (context)]]
8519 [[Bar:X (Y) Z|X (Y) Z]]
8520 [[:Bar:X (Y) Z|X (Y) Z]]
8521 !! end
8522
8523 !! test
8524 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8525 !! options
8526 pst
8527 !! input
8528 [[Article(context)|]]
8529 [[Bar:Article(context)|]]
8530 [[:Bar:Article(context)|]]
8531 [[|Article(context)]]
8532 [[Bar:X(Y)Z|]]
8533 [[:Bar:X(Y)Z|]]
8534 !! result
8535 [[Article(context)|Article]]
8536 [[Bar:Article(context)|Article]]
8537 [[:Bar:Article(context)|Article]]
8538 [[Article(context)]]
8539 [[Bar:X(Y)Z|X(Y)Z]]
8540 [[:Bar:X(Y)Z|X(Y)Z]]
8541 !! end
8542
8543 !! test
8544 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8545 !! options
8546 pst
8547 !! input
8548 [[Article (context), context|]]
8549 [[Article (context),context|]]
8550 [[Bar:Article (context), context|]]
8551 [[Bar:Article (context),context|]]
8552 [[:Bar:Article (context), context|]]
8553 [[:Bar:Article (context),context|]]
8554 !! result
8555 [[Article (context), context|Article]]
8556 [[Article (context),context|Article]]
8557 [[Bar:Article (context), context|Article]]
8558 [[Bar:Article (context),context|Article]]
8559 [[:Bar:Article (context), context|Article]]
8560 [[:Bar:Article (context),context|Article]]
8561 !! end
8562
8563 !! test
8564 pre-save transform: trim trailing empty lines
8565 !! options
8566 pst
8567 !! input
8568 Empty lines are trimmed
8569
8570
8571
8572
8573 !! result
8574 Empty lines are trimmed
8575 !! end
8576
8577 !! test
8578 pre-save transform: Signature expansion
8579 !! options
8580 pst
8581 !! input
8582 * ~~~
8583 * <noinclude>~~~</noinclude>
8584 * <includeonly>~~~</includeonly>
8585 * <onlyinclude>~~~</onlyinclude>
8586 !! result
8587 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
8588 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
8589 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
8590 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
8591 !! end
8592
8593
8594 !! test
8595 pre-save transform: Signature expansion in nowiki tags (bug 93)
8596 !! options
8597 pst disabled
8598 !! input
8599 Shall not expand:
8600
8601 <nowiki>~~~~</nowiki>
8602
8603 <includeonly><nowiki>~~~~</nowiki></includeonly>
8604
8605 <noinclude><nowiki>~~~~</nowiki></noinclude>
8606
8607 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8608
8609 {{subst:Foo}} shall be converted to FOO
8610
8611 As well as inside noinclude/onlyinclude
8612 <noinclude>{{subst:Foo}}</noinclude>
8613 <onlyinclude>{{subst:Foo}}</onlyinclude>
8614
8615 But not inside includeonly
8616 <includeonly>{{subst:Foo}}</includeonly>
8617 !! result
8618 Shall not expand:
8619
8620 <nowiki>~~~~</nowiki>
8621
8622 <includeonly><nowiki>~~~~</nowiki></includeonly>
8623
8624 <noinclude><nowiki>~~~~</nowiki></noinclude>
8625
8626 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
8627
8628 FOO shall be converted to FOO
8629
8630 As well as inside noinclude/onlyinclude
8631 <noinclude>FOO</noinclude>
8632 <onlyinclude>FOO</onlyinclude>
8633
8634 But not inside includeonly
8635 <includeonly>{{subst:Foo}}</includeonly>
8636 !! end
8637
8638 !! test
8639 Parsoid: Recognize nowiki with trailing space in tags
8640 !! options
8641 parsoid=wt2html
8642 !! input
8643 <nowiki ><div>[[foo]]</nowiki >
8644
8645 a<nowiki / >b
8646
8647 c<nowiki />d
8648
8649 e<nowiki/ >f
8650 !! result
8651 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8652 <p>ab</p>
8653 <p>cd</p>
8654 <p>ef</p>
8655 !! end
8656
8657 !! test
8658 Parsoid: Recognize nowiki with odd capitalization
8659 !! options
8660 parsoid=wt2html
8661 !! input
8662 <noWikI ><div>[[foo]]</Nowiki >
8663 !! result
8664 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
8665 !! end
8666
8667
8668 !! test
8669 Parsoid: Escape nowiki with trailing space in tags
8670 !! options
8671 parsoid=html2wt
8672 !! input
8673 &lt;nowiki &gt; foo &lt;/nowiki &gt;
8674
8675 a&lt;nowiki /&gt;b
8676
8677 c&lt;nowiki/ &gt;d
8678 !! result
8679 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
8680 <p>a&lt;nowiki /&gt;b</p>
8681 <p>c&lt;nowiki/ &gt;d</p>
8682 !! end
8683
8684 !! test
8685 Parsoid: Escape weird noWikI capitalizations
8686 !! options
8687 parsoid=html2wt
8688 !! input
8689 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
8690 !! result
8691 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
8692 !! end
8693
8694 ###
8695 ### Message transform tests
8696 ###
8697 !! test
8698 message transform: magic variables
8699 !! options
8700 msg
8701 !! input
8702 {{SITENAME}}
8703 !! result
8704 MediaWiki
8705 !! end
8706
8707 !! test
8708 message transform: should not transform wiki markup
8709 !! options
8710 msg
8711 !! input
8712 ''test''
8713 !! result
8714 ''test''
8715 !! end
8716
8717 !! test
8718 message transform: <noinclude> in transcluded template (bug 4926)
8719 !! options
8720 msg
8721 !! input
8722 {{Includes}}
8723 !! result
8724 Foobar
8725 !! end
8726
8727 !! test
8728 message transform: <onlyinclude> in transcluded template (bug 4926)
8729 !! options
8730 msg
8731 !! input
8732 {{Includes2}}
8733 !! result
8734 Foo
8735 !! end
8736
8737 !! test
8738 {{#special:}} page name, known
8739 !! options
8740 msg
8741 !! input
8742 {{#special:Recentchanges}}
8743 !! result
8744 Special:RecentChanges
8745 !! end
8746
8747 !! test
8748 {{#special:}} page name with subpage, known
8749 !! options
8750 msg
8751 !! input
8752 {{#special:Recentchanges/param}}
8753 !! result
8754 Special:RecentChanges/param
8755 !! end
8756
8757 !! test
8758 {{#special:}} page name, unknown
8759 !! options
8760 msg
8761 !! input
8762 {{#special:foobar nonexistent}}
8763 !! result
8764 Special:Foobar nonexistent
8765 !! end
8766
8767 !! test
8768 {{#speciale:}} page name, known
8769 !! options
8770 msg
8771 !! input
8772 {{#speciale:Recentchanges}}
8773 !! result
8774 Special:RecentChanges
8775 !! end
8776
8777 !! test
8778 {{#speciale:}} page name with subpage, known
8779 !! options
8780 msg
8781 !! input
8782 {{#speciale:Recentchanges/param}}
8783 !! result
8784 Special:RecentChanges/param
8785 !! end
8786
8787 !! test
8788 {{#speciale:}} page name, unknown
8789 !! options
8790 msg
8791 !! input
8792 {{#speciale:foobar nonexistent}}
8793 !! result
8794 Special:Foobar_nonexistent
8795 !! end
8796
8797 ###
8798 ### Images
8799 ###
8800 ### For Parsoid-specific tests, see
8801 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8802
8803 !! test
8804 Simple image (php)
8805 !! options
8806 php
8807 !! input
8808 [[Image:foobar.jpg]]
8809 !! result
8810 <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>
8811 </p>
8812 !! end
8813
8814 !! test
8815 Simple image (parsoid)
8816 !! options
8817 parsoid=wt2html
8818 !! input
8819 [[Image:foobar.jpg]]
8820 !! result
8821 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
8822 </p>
8823 !! end
8824
8825 !! test
8826 Simple image (using File: namespace, now canonical) (php)
8827 !! options
8828 php
8829 !! input
8830 [[File:foobar.jpg]]
8831 !! result
8832 <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>
8833 </p>
8834 !! end
8835
8836 !! test
8837 Simple image (using File: namespace, now canonical) (parsoid)
8838 !! options
8839 parsoid
8840 !! input
8841 [[File:Foobar.jpg]]
8842 !! result
8843 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
8844 </p>
8845 !! end
8846
8847 !! test
8848 Right-aligned image (php)
8849 !! options
8850 php
8851 !! input
8852 [[Image:foobar.jpg|right]]
8853 !! result
8854 <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>
8855
8856 !! end
8857
8858 !! test
8859 Right-aligned image (parsoid)
8860 !! options
8861 parsoid
8862 !! input
8863 [[File:Foobar.jpg|right]]
8864 !! result
8865 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
8866 !! end
8867
8868 !! test
8869 Image with caption (php)
8870 !! options
8871 php
8872 !! input
8873 [[File:Foobar.jpg|right|Caption text]]
8874 !! result
8875 <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>
8876
8877 !! end
8878
8879 !! test
8880 Image with caption (parsoid)
8881 !! options
8882 parsoid
8883 !! input
8884 [[File:Foobar.jpg|right|Caption text]]
8885 !! result
8886 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8887 !! end
8888
8889 !! test
8890 Image with empty attribute (php)
8891 !! options
8892 php
8893 !! input
8894 [[File:Foobar.jpg|right||Caption text]]
8895 !! result
8896 <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>
8897
8898 !! end
8899
8900 !! test
8901 Image with empty attribute (parsoid)
8902 !! options
8903 parsoid=wt2html
8904 !! input
8905 [[File:Foobar.jpg|right||Caption text]]
8906 !! result
8907 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8908 !! end
8909
8910 !! test
8911 Image with attributes from template (php)
8912 !! options
8913 php
8914 !! input
8915 [[File:Foobar.jpg|{{image_attribs}}]]
8916 !! result
8917 <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>
8918
8919 !! end
8920
8921 !! test
8922 Image with attributes from template (parsoid)
8923 !! options
8924 parsoid
8925 !! input
8926 [[File:Foobar.jpg|{{image_attribs}}]]
8927 !! result
8928 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
8929 !! end
8930
8931 !! test
8932 Image with link tails (php)
8933 !! options
8934 php
8935 !! input
8936 123[[File:Foobar.jpg]]456
8937 123[[File:Foobar.jpg|right]]456
8938 123[[File:Foobar.jpg|thumb]]456
8939 !! result
8940 <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
8941 </p>
8942 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
8943 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
8944
8945 !! end
8946
8947 !! test
8948 Image with link tails (parsoid)
8949 !! options
8950 parsoid
8951 !! input
8952 123[[File:Foobar.jpg]]456
8953 123[[File:Foobar.jpg|right]]456
8954 123[[File:Foobar.jpg|thumb]]456
8955 !! result
8956 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p>
8957 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456
8958 123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" width="180"></a></figure>456
8959 !! end
8960
8961 !! test
8962 Image with multiple captions -- only last one is accepted (php)
8963 !! options
8964 php
8965 !! input
8966 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8967 !! result
8968 <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>
8969
8970 !! end
8971
8972 !! test
8973 Image with multiple captions -- only last one is accepted (parsoid)
8974 !! options
8975 parsoid
8976 !! input
8977 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8978 !! result
8979 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
8980 !! end
8981
8982 !! test
8983 Image with width attribute at different positions (php)
8984 !! options
8985 php
8986 !! input
8987 [[File:Foobar.jpg|200px|right|Caption]]
8988 [[File:Foobar.jpg|right|200px|Caption]]
8989 [[File:Foobar.jpg|right|Caption|200px]]
8990 !! result
8991 <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>
8992 <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>
8993 <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>
8994
8995 !! end
8996
8997 !! test
8998 Image with width attribute at different positions (parsoid)
8999 !! options
9000 parsoid
9001 !! input
9002 [[File:Foobar.jpg|200px|right|Caption]]
9003 [[File:Foobar.jpg|right|200px|Caption]]
9004 [[File:Foobar.jpg|right|Caption|200px]]
9005 !! result
9006 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9007 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9008 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
9009 !! end
9010
9011 !! test
9012 Image with link parameter, wiki target (php)
9013 !! options
9014 php
9015 !! input
9016 [[File:Foobar.jpg|link=Main Page]]
9017 !! result
9018 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9019 </p>
9020 !! end
9021
9022 !! test
9023 Image with link parameter, wiki target (parsoid)
9024 !! options
9025 parsoid
9026 !! input
9027 [[File:Foobar.jpg|link=Main Page]]
9028 !! result
9029 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9030 !! end
9031
9032 !! test
9033 Image with link parameter, URL target (php)
9034 !! options
9035 php
9036 !! input
9037 [[File:Foobar.jpg|link=http://example.com/]]
9038 !! result
9039 <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>
9040 </p>
9041 !! end
9042
9043 # parsoid bug 49293 (part 1)
9044 !! test
9045 Image with link parameter, URL target (parsoid)
9046 !! options
9047 parsoid
9048 !! input
9049 [[File:Foobar.jpg|link=http://example.com/]]
9050 !! result
9051 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9052 !! end
9053
9054 !! test
9055 Image with link parameter, protocol-less URL target (php)
9056 !! options
9057 php
9058 !! input
9059 [[File:Foobar.jpg|link=//example.com/]]
9060 !! result
9061 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9062 </p>
9063 !! end
9064
9065 # parsoid bug 49293 (part 2)
9066 !! test
9067 Image with link parameter, protocol-less URL target (parsoid)
9068 !! options
9069 parsoid
9070 !! input
9071 [[File:Foobar.jpg|link=//example.com/]]
9072 !! result
9073 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9074 !! end
9075
9076 !! test
9077 Image with link parameter, wgExternalLinkTarget
9078 !! input
9079 [[Image:foobar.jpg|link=http://example.com/]]
9080 !! config
9081 wgExternalLinkTarget='foobar'
9082 !! result
9083 <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>
9084 </p>
9085 !! end
9086
9087 !! test
9088 Image with link parameter, wgNoFollowLinks set to false
9089 !! input
9090 [[Image:foobar.jpg|link=http://example.com/]]
9091 !! config
9092 wgNoFollowLinks=false
9093 !! result
9094 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9095 </p>
9096 !! end
9097
9098 !! test
9099 Image with link parameter, wgNoFollowDomainExceptions
9100 !! input
9101 [[Image:foobar.jpg|link=http://example.com/]]
9102 !! config
9103 wgNoFollowDomainExceptions='example.com'
9104 !! result
9105 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9106 </p>
9107 !! end
9108
9109 !! test
9110 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9111 !! input
9112 [[Image:foobar.jpg|link=http://example.com/|Title]]
9113 !! config
9114 wgExternalLinkTarget='foobar'
9115 !! result
9116 <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>
9117 </p>
9118 !! end
9119
9120 !! test
9121 Image with empty link parameter (php)
9122 !! options
9123 php
9124 !! input
9125 [[File:Foobar.jpg|link=]]
9126 !! result
9127 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9128 </p>
9129 !! end
9130
9131 !! test
9132 Image with empty link parameter (parsoid)
9133 !! options
9134 parsoid
9135 !! input
9136 [[File:Foobar.jpg|link=]]
9137 !! result
9138 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
9139 !! end
9140
9141 !! test
9142 Image with link parameter (wiki target) and unnamed parameter (php)
9143 !! options
9144 php
9145 !! input
9146 [[File:Foobar.jpg|link=Main Page|Title]]
9147 !! result
9148 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9149 </p>
9150 !! end
9151
9152 !! test
9153 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9154 !! options
9155 parsoid
9156 !! input
9157 [[File:Foobar.jpg|link=Main Page|Title]]
9158 !! result
9159 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9160 !! end
9161
9162 !! test
9163 Image with link parameter (URL target) and unnamed parameter (php)
9164 !! options
9165 php
9166 !! input
9167 [[File:Foobar.jpg|link=http://example.com/|Title]]
9168 !! result
9169 <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>
9170 </p>
9171 !! end
9172
9173 !! test
9174 Image with link parameter (URL target) and unnamed parameter (parsoid)
9175 !! options
9176 parsoid
9177 !! input
9178 [[File:Foobar.jpg|link=http://example.com/|Title]]
9179 !! result
9180 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
9181 !! end
9182
9183 !! test
9184 Thumbnail image with link parameter
9185 !! options
9186 php
9187 !! input
9188 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9189 !! result
9190 <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>
9191
9192 !! end
9193
9194 !! test
9195 Manually-specified thumbnail image
9196 !! options
9197 php
9198 !! input
9199 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9200 !! result
9201 <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>
9202
9203 !! end
9204
9205 !! test
9206 Manually-specified thumbnail image with explicit link to wiki page
9207 !! options
9208 php
9209 !! input
9210 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9211 !! result
9212 <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>
9213
9214 !! end
9215
9216 !! test
9217 Manually-specified thumbnail image with explicit link to url
9218 !! options
9219 php
9220 !! input
9221 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9222 !! result
9223 <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>
9224
9225 !! end
9226
9227 !! test
9228 Manually-specified thumbnail image with explicit no link
9229 !! options
9230 php
9231 !! input
9232 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9233 !! result
9234 <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>
9235
9236 !! end
9237
9238 !! test
9239 Manually-specified thumbnail image with explicit link and alt text
9240 !! options
9241 php
9242 !! input
9243 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9244 !! result
9245 <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>
9246
9247 !! end
9248
9249 !! test
9250 Image with frame and link
9251 !! input
9252 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9253 !! result
9254 <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>
9255
9256 !! end
9257
9258 !! test
9259 Image with frame and link and explicit alt
9260 !! input
9261 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9262 !! result
9263 <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>
9264
9265 !! end
9266
9267 !! test
9268 Image with wiki markup in implicit alt
9269 !! input
9270 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9271 !! result
9272 <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>
9273 </p>
9274 !! end
9275
9276 !! test
9277 Image with wiki markup in explicit alt
9278 !! input
9279 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9280 !! result
9281 <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>
9282 </p>
9283 !! end
9284
9285 !! test
9286 Link to image page- image page normally doesn't exists, hence edit link
9287 Add test with existing image page
9288 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9289 !! input
9290 [[:Image:test]]
9291 !! result
9292 <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>
9293 </p>
9294 !! end
9295
9296 !! test
9297 bug 18784 Link to non-existent image page with caption should use caption as link text
9298 !! input
9299 [[:Image:test|caption]]
9300 !! result
9301 <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>
9302 </p>
9303 !! end
9304
9305 !! test
9306 Frameless image caption with a free URL
9307 !! input
9308 [[Image:foobar.jpg|http://example.com]]
9309 !! result
9310 <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>
9311 </p>
9312 !! end
9313
9314 !! test
9315 Thumbnail image caption with a free URL
9316 !! input
9317 [[Image:foobar.jpg|thumb|http://example.com]]
9318 !! result
9319 <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>
9320
9321 !! end
9322
9323 !! test
9324 Thumbnail image caption with a free URL and explicit alt
9325 !! input
9326 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9327 !! result
9328 <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>
9329
9330 !! end
9331
9332 !! test
9333 SVG thumbnails with no language set
9334 !! options
9335 !! input
9336 [[File:Foobar.svg|thumb|width=200]]
9337 !! result
9338 <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>
9339
9340 !! end
9341
9342 !! test
9343 SVG thumbnails with language de
9344 !! options
9345 !! input
9346 [[File:Foobar.svg|thumb|width=200|lang=de]]
9347 !! result
9348 <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>
9349
9350 !! end
9351
9352 !! test
9353 SVG thumbnails with invalid language code
9354 !! options
9355 !! input
9356 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9357 !! result
9358 <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>
9359
9360 !! end
9361
9362 !! test
9363 BUG 1887: A ISBN with a thumbnail
9364 !! input
9365 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9366 !! result
9367 <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>
9368
9369 !! end
9370
9371 !! test
9372 BUG 1887: A RFC with a thumbnail
9373 !! input
9374 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9375 !! result
9376 <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>
9377
9378 !! end
9379
9380 !! test
9381 BUG 1887: A mailto link with a thumbnail
9382 !! input
9383 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9384 !! result
9385 <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>
9386
9387 !! end
9388
9389 # Pending resolution to bug 368
9390 !! test
9391 BUG 648: Frameless image caption with a link
9392 !! input
9393 [[Image:foobar.jpg|text with a [[link]] in it]]
9394 !! result
9395 <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>
9396 </p>
9397 !! end
9398
9399 !! test
9400 BUG 648: Frameless image caption with a link (suffix)
9401 !! input
9402 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9403 !! result
9404 <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>
9405 </p>
9406 !! end
9407
9408 !! test
9409 BUG 648: Frameless image caption with an interwiki link
9410 !! input
9411 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9412 !! result
9413 <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>
9414 </p>
9415 !! end
9416
9417 !! test
9418 BUG 648: Frameless image caption with a piped interwiki link
9419 !! input
9420 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9421 !! result
9422 <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>
9423 </p>
9424 !! end
9425
9426 !! test
9427 Escape HTML special chars in image alt text
9428 !! input
9429 [[Image:foobar.jpg|& < > "]]
9430 !! result
9431 <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>
9432 </p>
9433 !! end
9434
9435 !! test
9436 BUG 499: Alt text should have &#1234;, not &amp;1234;
9437 !! input
9438 [[Image:foobar.jpg|&#9792;]]
9439 !! result
9440 <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>
9441 </p>
9442 !! end
9443
9444 !! test
9445 Broken image caption with link
9446 !! input
9447 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9448 !! result
9449 <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.
9450 </p>
9451 !! end
9452
9453 !! test
9454 Image caption containing another image
9455 !! input
9456 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9457 !! result
9458 <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>
9459
9460 !! end
9461
9462 !! test
9463 Image caption containing a newline
9464 !! input
9465 [[Image:Foobar.jpg|This
9466 *is some text]]
9467 !! result
9468 <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>
9469 </p>
9470 !!end
9471
9472 !!test
9473 Parsoid: Image caption containing leading space
9474 (The leading space should not trigger nowiki escaping in wt2wt mode)
9475 !! input
9476 [[Image:Foobar.jpg|thumb| bar]]
9477 !! result
9478 <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>
9479
9480 !!end
9481
9482 !! test
9483 Bug 3090: External links other than http: in image captions
9484 !! input
9485 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9486 !! result
9487 <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>
9488
9489 !! end
9490
9491 !! test
9492 Custom class
9493 !! input
9494 [[Image:foobar.jpg|a|class=b]]
9495 !! result
9496 <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>
9497 </p>
9498 !! end
9499
9500 !! test
9501 Localized image handling (1).
9502 !! options
9503 language=es
9504 !! input
9505 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9506 !! result
9507 <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>
9508
9509 !! end
9510
9511 !! test
9512 Localized image handling (2).
9513 !! options
9514 language=es
9515 !! input
9516 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9517 !! result
9518 <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>
9519
9520 !! end
9521
9522 !! test
9523 "border", "frameless" and "class" attributes on an image.
9524 !! input
9525 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9526 !! result
9527 <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>
9528 </p>
9529 !! end
9530
9531 !! article
9532 File:Barfoo.jpg
9533 !! text
9534 #REDIRECT [[File:Barfoo.jpg]]
9535 !! endarticle
9536
9537 !! test
9538 Redirected image
9539 !! input
9540 [[Image:Barfoo.jpg]]
9541 !! result
9542 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9543 </p>
9544 !! end
9545
9546 !! test
9547 Missing image with uploads disabled
9548 !! options
9549 wgEnableUploads=0
9550 !! input
9551 [[Image:Foobaz.jpg]]
9552 !! result
9553 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9554 </p>
9555 !! end
9556
9557 # Parsoid-specific testing for images
9558 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9559 # Currently imperfect due to a flaw in the Parsoid testrunner
9560 # Work in progress
9561 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9562 # image tests.
9563
9564 !! test
9565 Parsoid-specific image handling - simple image with size and middle alignment
9566 !! options
9567 parsoid
9568 !! input
9569 [[Image:Foobar.jpg|50px|middle]]
9570 !! result
9571 <p>
9572 <span class="mw-valign-middle" typeof="mw:Image">
9573 <a href="File:Foobar.jpg">
9574 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9575 </a>
9576 </span>
9577 </p>
9578 !! end
9579
9580 !! test
9581 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
9582 !! options
9583 parsoid
9584 !! input
9585 [[Image:Foobar.jpg|500x10px|baseline|caption]]
9586 !! result
9587 <p>
9588 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9589 <a href="File:Foobar.jpg">
9590 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
9591 </a>
9592 </span>
9593 </p>
9594 !! end
9595
9596 !! test
9597 Parsoid-specific image handling - simple image with border and size spec
9598 !! options
9599 parsoid
9600 !! input
9601 [[Image:Foobar.jpg|50px|border|caption]]
9602 !! result
9603 <p>
9604 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9605 <a href="File:Foobar.jpg">
9606 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
9607 </a>
9608 </span>
9609 </p>
9610 !! end
9611
9612 !! test
9613 Parsoid-specific image handling - thumbnail with halign, valign, and caption
9614 !! options
9615 parsoid
9616 !! input
9617 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
9618 !! result
9619 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
9620 <a href="File:Foobar.jpg">
9621 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
9622 </a>
9623 <figcaption>caption content</figcaption>
9624 </figure>
9625 !! end
9626
9627 !! test
9628 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
9629 !! options
9630 parsoid
9631 !! input
9632 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
9633 !! result
9634 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
9635 <a href="File:Foobar.jpg">
9636 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
9637 </a>
9638 <figcaption>caption</figcaption>
9639 </figure>
9640 !! end
9641
9642 !! test
9643 Parsoid-specific image handling - framed image with specific size and caption
9644 !! options
9645 parsoid
9646 !! input
9647 [[Image:Foobar.jpg|500x50px|frame|caption]]
9648 !! result
9649 <figure typeof="mw:Image/Frame">
9650 <a href="File:Foobar.jpg">
9651 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9652 </a>
9653 <figcaption>caption</figcaption>
9654 </figure>
9655 !! end
9656
9657 !! test
9658 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
9659 !! options
9660 parsoid
9661 !! input
9662 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
9663 !! result
9664 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
9665 <a href="File:Foobar.jpg">
9666 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9667 </a>
9668 <figcaption>caption</figcaption>
9669 </figure>
9670 !! end
9671
9672 !! test
9673 Parsoid-specific image handling - frameless image with specific size, border, and caption
9674 !! options
9675 parsoid
9676 !! input
9677 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
9678 !! result
9679 <p>
9680 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
9681 <a href="File:Foobar.jpg">
9682 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
9683 </a>
9684 </p>
9685 !! end
9686
9687 #!! test
9688 #Parsoid-specific image handling - simple image with a formatted caption
9689 #!! options
9690 #parsoid
9691 #!! input
9692 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
9693 #!! result
9694 #<p>
9695 #<span typeof="mw:Image">
9696 #<a class="mw-default-size" href="Image:Foobar.jpg">
9697 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
9698 #</a>
9699 #<span>abc</span>
9700 #</span>
9701 #</p>
9702
9703
9704 ###
9705 ### Subpages
9706 ###
9707 !! article
9708 Subpage test/subpage
9709 !! text
9710 foo
9711 !! endarticle
9712
9713 !! test
9714 Subpage link
9715 !! options
9716 subpage title=[[Subpage test]]
9717 !! input
9718 [[/subpage]]
9719 !! result
9720 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
9721 </p>
9722 !! end
9723
9724 !! test
9725 Subpage noslash link
9726 !! options
9727 subpage title=[[Subpage test]]
9728 !!input
9729 [[/subpage/]]
9730 !! result
9731 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
9732 </p>
9733 !! end
9734
9735 # TODO: make this PHP-parser compatible!
9736 !! test
9737 Relative subpage noslash link
9738 !! options
9739 parsoid=wt2wt,wt2html,html2html
9740 subpage title=[[Subpage test/1/2/3/4]]
9741 !!input
9742 [[../../subpage/]]
9743
9744 [[../../subpage]]
9745 !! result
9746 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
9747 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
9748 !! end
9749
9750 # TODO: make this PHP-parser compatible!
9751 !! test
9752 Parsoid: dot-slash prefixed wikilinks
9753 !! options
9754 parsoid=wt2wt,wt2html,html2html
9755 !!input
9756 [[./foo]]
9757
9758 [[././bar]]
9759
9760 [[././baz/]]
9761 !! result
9762 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
9763 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
9764 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
9765 !! end
9766
9767 !! test
9768 Disabled subpages
9769 !! input
9770 [[/subpage]]
9771 !! result
9772 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
9773 </p>
9774 !! end
9775
9776 !! test
9777 BUG 561: {{/Subpage}}
9778 !! options
9779 subpage title=[[Page]]
9780 !! input
9781 {{/Subpage}}
9782 !! result
9783 <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>
9784 </p>
9785 !! end
9786
9787 ###
9788 ### Categories
9789 ###
9790 !! article
9791 Category:MediaWiki User's Guide
9792 !! text
9793 blah
9794 !! endarticle
9795
9796 !! test
9797 Link to category
9798 !! input
9799 [[:Category:MediaWiki User's Guide]]
9800 !! result
9801 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
9802 </p>
9803 !! end
9804
9805 !! test
9806 Simple category
9807 !! options
9808 cat
9809 !! input
9810 [[Category:MediaWiki User's Guide]]
9811 !! result
9812 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9813 !! end
9814
9815 !! test
9816 PAGESINCATEGORY invalid title fatal (r33546 fix)
9817 !! input
9818 {{PAGESINCATEGORY:<bogus>}}
9819 !! result
9820 <p>0
9821 </p>
9822 !! end
9823
9824 !! test
9825 Category with different sort key
9826 !! options
9827 cat
9828 !! input
9829 [[Category:MediaWiki User's Guide|Foo]]
9830 !! result
9831 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9832 !! end
9833
9834 !! test
9835 Category with identical sort key
9836 !! options
9837 cat
9838 !! input
9839 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9840 !! result
9841 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
9842 !! end
9843
9844 !! test
9845 Category with empty sort key
9846 !! options
9847 cat
9848 pst
9849 !! input
9850 [[Category:MediaWiki User's Guide|]]
9851 !! result
9852 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
9853 !! end
9854
9855 !! test
9856 Category with empty sort key and parentheses
9857 !! options
9858 cat
9859 pst
9860 !! input
9861 [[Category:Foo (bar)|]]
9862 !! result
9863 [[Category:Foo (bar)|Foo]]
9864 !! end
9865
9866 !! test
9867 Category with link tail
9868 !! options
9869 cat
9870 pst
9871 !! input
9872 123[[Category:Foo]]456
9873 !! result
9874 123[[Category:Foo]]456
9875 !! end
9876
9877 !! test
9878 Category with template
9879 !! options
9880 cat
9881 pst
9882 !! input
9883 [[Category:{{echo|Foo}}]]
9884 !! result
9885 [[Category:{{echo|Foo}}]]
9886 !! end
9887
9888 !! test
9889 Category with template in sort key
9890 !! options
9891 cat
9892 pst
9893 !! input
9894 [[Category:Foo|{{echo|Bar}}]]
9895 !! result
9896 [[Category:Foo|{{echo|Bar}}]]
9897 !! end
9898
9899 !! test
9900 Category with template in sort key and title
9901 !! options
9902 cat
9903 pst
9904 !! input
9905 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9906 !! result
9907 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
9908 !! end
9909
9910 !! test
9911 Category / paragraph interactions
9912 !! input
9913 Foo [[Category:Baz]] Bar
9914
9915 Foo [[Category:Baz]]
9916 Bar
9917
9918 Foo
9919 [[Category:Baz]]
9920 Bar
9921
9922 Foo
9923 [[Category:Baz]] Bar
9924
9925 Foo
9926 [[Category:Baz]]
9927 [[Category:Baz]]
9928 [[Category:Baz]]
9929 Bar
9930
9931 [[Category:Baz]]
9932 [[Category:Baz]]
9933 [[Category:Baz]]
9934
9935 [[Category:Baz]]
9936 {{echo|[[Category:Baz]]}}
9937 [[Category:Baz]]
9938 !! result
9939 <p>Foo Bar
9940 </p><p>Foo
9941 Bar
9942 </p><p>Foo
9943 Bar
9944 </p><p>Foo Bar
9945 </p><p>Foo
9946 Bar
9947 </p>
9948 !! end
9949
9950 !! test
9951 Parsoid: Serialize link to category page with colon escape
9952 !! options
9953 parsoid
9954 !! input
9955
9956 [[:Category:Foo]]
9957 [[:Category:Foo|Bar]]
9958 !! result
9959 <p>
9960 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
9961 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
9962 </p>
9963 !! end
9964
9965 !! test
9966 Parsoid: Link prefix/suffixes aren't applied to category links
9967 !! options
9968 parsoid=wt2html,wt2wt,html2html
9969 language=is
9970 !! input
9971 x[[Category:Foo]]y
9972 !! result
9973 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
9974 !! end
9975
9976 !! test
9977 Parsoid: Serialize link to file page with colon escape
9978 !! options
9979 parsoid
9980 !! input
9981
9982 [[:File:Foo.png]]
9983 [[:File:Foo.png|Bar]]
9984 !! result
9985 <p>
9986 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
9987 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
9988 </p>
9989 !! end
9990
9991 !! test
9992 Parsoid: Serialize a genuine category link without colon escape
9993 !! options
9994 parsoid
9995 !! input
9996 [[Category:Foo]]
9997 [[Category:Foo|Bar]]
9998 !! result
9999 <link rel="mw:WikiLink/Category" href="Category:Foo">
10000 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
10001 !! end
10002
10003 ###
10004 ### Inter-language links
10005 ###
10006 !! test
10007 Inter-language links
10008 !! options
10009 ill
10010 !! input
10011 [[es:Alimento]]
10012 [[fr:Nourriture]]
10013 [[zh:&#39135;&#21697;]]
10014 !! result
10015 es:Alimento fr:Nourriture zh:食品
10016 !! end
10017
10018 !! test
10019 Duplicate interlanguage links (bug 24502)
10020 !! options
10021 ill
10022 !! input
10023 [[es:1]]
10024 [[es:2]]
10025 [[fr:1]]
10026 [[fr:2]]
10027 !! result
10028 es:1 fr:1
10029 !! end
10030
10031 ###
10032 ### Sections
10033 ###
10034 !! test
10035 Basic section headings
10036 !! input
10037 == Headline 1 ==
10038 Some text
10039
10040 ==Headline 2==
10041 More
10042 ===Smaller headline===
10043 Blah blah
10044 !! result
10045 <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>
10046 <p>Some text
10047 </p>
10048 <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>
10049 <p>More
10050 </p>
10051 <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>
10052 <p>Blah blah
10053 </p>
10054 !! end
10055
10056 !! test
10057 Section headings with TOC
10058 !! input
10059 == Headline 1 ==
10060 === Subheadline 1 ===
10061 ===== Skipping a level =====
10062 ====== Skipping a level ======
10063
10064 == Headline 2 ==
10065 Some text
10066 ===Another headline===
10067 !! result
10068 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10069 <ul>
10070 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10071 <ul>
10072 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10073 <ul>
10074 <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>
10075 <ul>
10076 <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>
10077 </ul>
10078 </li>
10079 </ul>
10080 </li>
10081 </ul>
10082 </li>
10083 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10084 <ul>
10085 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10086 </ul>
10087 </li>
10088 </ul>
10089 </div>
10090 <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>
10091 <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>
10092 <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>
10093 <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>
10094 <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>
10095 <p>Some text
10096 </p>
10097 <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>
10098
10099 !! end
10100
10101 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10102 !! test
10103 Handling of sections up to level 6 and beyond
10104 !! input
10105 = Level 1 Heading=
10106 == Level 2 Heading==
10107 === Level 3 Heading===
10108 ==== Level 4 Heading====
10109 ===== Level 5 Heading=====
10110 ====== Level 6 Heading======
10111 ======= Level 7 Heading=======
10112 ======== Level 8 Heading========
10113 ========= Level 9 Heading=========
10114 ========== Level 10 Heading==========
10115 !! result
10116 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10117 <ul>
10118 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10119 <ul>
10120 <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>
10121 <ul>
10122 <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>
10123 <ul>
10124 <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>
10125 <ul>
10126 <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>
10127 <ul>
10128 <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>
10129 <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>
10130 <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>
10131 <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>
10132 <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>
10133 </ul>
10134 </li>
10135 </ul>
10136 </li>
10137 </ul>
10138 </li>
10139 </ul>
10140 </li>
10141 </ul>
10142 </li>
10143 </ul>
10144 </div>
10145 <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>
10146 <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>
10147 <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>
10148 <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>
10149 <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>
10150 <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>
10151 <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>
10152 <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>
10153 <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>
10154 <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>
10155
10156 !! end
10157
10158 !! test
10159 TOC regression (bug 9764)
10160 !! input
10161 == title 1 ==
10162 === title 1.1 ===
10163 ==== title 1.1.1 ====
10164 === title 1.2 ===
10165 == title 2 ==
10166 === title 2.1 ===
10167 !! result
10168 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10169 <ul>
10170 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10171 <ul>
10172 <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>
10173 <ul>
10174 <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>
10175 </ul>
10176 </li>
10177 <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>
10178 </ul>
10179 </li>
10180 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10181 <ul>
10182 <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>
10183 </ul>
10184 </li>
10185 </ul>
10186 </div>
10187 <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>
10188 <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>
10189 <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>
10190 <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>
10191 <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>
10192 <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>
10193
10194 !! end
10195
10196 !! test
10197 TOC with wgMaxTocLevel=3 (bug 6204)
10198 !! options
10199 wgMaxTocLevel=3
10200 !! input
10201 == title 1 ==
10202 === title 1.1 ===
10203 ==== title 1.1.1 ====
10204 === title 1.2 ===
10205 == title 2 ==
10206 === title 2.1 ===
10207 !! result
10208 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10209 <ul>
10210 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10211 <ul>
10212 <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>
10213 <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>
10214 </ul>
10215 </li>
10216 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10217 <ul>
10218 <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>
10219 </ul>
10220 </li>
10221 </ul>
10222 </div>
10223 <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>
10224 <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>
10225 <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>
10226 <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>
10227 <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>
10228 <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>
10229
10230 !! end
10231
10232 !! test
10233 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10234 !! options
10235 wgMaxTocLevel=3
10236 !! input
10237 ==Section 1==
10238 ===Section 1.1===
10239 ====Section 1.1.1====
10240 ====Section 1.1.1.1====
10241 ==Section 2==
10242 !! result
10243 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10244 <ul>
10245 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10246 <ul>
10247 <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>
10248 </ul>
10249 </li>
10250 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10251 </ul>
10252 </div>
10253 <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>
10254 <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>
10255 <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>
10256 <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>
10257 <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>
10258
10259 !! end
10260
10261
10262 !! test
10263 Resolving duplicate section names
10264 !! input
10265 == Foo bar ==
10266 == Foo bar ==
10267 !! result
10268 <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>
10269 <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>
10270
10271 !! end
10272
10273 !! test
10274 Resolving duplicate section names with differing case (bug 10721)
10275 !! input
10276 == Foo bar ==
10277 == Foo Bar ==
10278 !! result
10279 <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>
10280 <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>
10281
10282 !! end
10283
10284 !! article
10285 Template:sections
10286 !! text
10287 ===Section 1===
10288 ==Section 2==
10289 !! endarticle
10290
10291 !! test
10292 Template with sections, __NOTOC__
10293 !! input
10294 __NOTOC__
10295 ==Section 0==
10296 {{sections}}
10297 ==Section 4==
10298 !! result
10299 <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>
10300 <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>
10301 <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>
10302 <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>
10303
10304 !! end
10305
10306 !! test
10307 __NOEDITSECTION__ keyword
10308 !! input
10309 __NOEDITSECTION__
10310 ==Section 1==
10311 ==Section 2==
10312 !! result
10313 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10314 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10315
10316 !! end
10317
10318 !! test
10319 Link inside a section heading
10320 !! input
10321 ==Section with a [[Main Page|link]] in it==
10322 !! result
10323 <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>
10324
10325 !! end
10326
10327 !! test
10328 TOC regression (bug 12077)
10329 !! input
10330 __TOC__
10331 == title 1 ==
10332 === title 1.1 ===
10333 == title 2 ==
10334 !! result
10335 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10336 <ul>
10337 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10338 <ul>
10339 <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>
10340 </ul>
10341 </li>
10342 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10343 </ul>
10344 </div>
10345 <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>
10346 <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>
10347 <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>
10348
10349 !! end
10350
10351 !! test
10352 BUG 1219 URL next to image (good)
10353 !! input
10354 http://example.com [[Image:foobar.jpg]]
10355 !! result
10356 <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>
10357 </p>
10358 !!end
10359
10360 !! test
10361 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10362 !! input
10363 ===
10364 The line above must have a trailing space!
10365 === <!--
10366 --> <!-- -->
10367 But just in case it doesn't...
10368 !! result
10369 <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>
10370 <p>The line above must have a trailing space!
10371 </p>
10372 <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>
10373 <p>But just in case it doesn't...
10374 </p>
10375 !! end
10376
10377 !! test
10378 Header with special characters (bug 25462)
10379 !! input
10380 The tooltips shall not show entities to the user (ie. be double escaped)
10381
10382 == text > text ==
10383 section 1
10384
10385 == text < text ==
10386 section 2
10387
10388 == text & text ==
10389 section 3
10390
10391 == text ' text ==
10392 section 4
10393
10394 == text " text ==
10395 section 5
10396 !! result
10397 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10398 </p>
10399 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10400 <ul>
10401 <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>
10402 <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>
10403 <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>
10404 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10405 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10406 </ul>
10407 </div>
10408 <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>
10409 <p>section 1
10410 </p>
10411 <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>
10412 <p>section 2
10413 </p>
10414 <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>
10415 <p>section 3
10416 </p>
10417 <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>
10418 <p>section 4
10419 </p>
10420 <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>
10421 <p>section 5
10422 </p>
10423 !! end
10424
10425 !! test
10426 Headers with excess '=' characters
10427 (Are similar tests necessary beyond the 1st level?)
10428 !! input
10429 =foo==
10430 ==foo=
10431 =''italic'' heading==
10432 ==''italic'' heading=
10433 !! result
10434 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10435 <ul>
10436 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10437 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10438 <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>
10439 <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>
10440 </ul>
10441 </div>
10442 <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>
10443 <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>
10444 <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>
10445 <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>
10446
10447 !! end
10448
10449 !! test
10450 HTML headers vs TOC (bug 23393)
10451 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10452 !! input
10453 <h1>Header 1</h1>
10454 == Header 1.1 ==
10455 == Header 1.2 ==
10456
10457 <h1>Header 2
10458 </h1>
10459 == Header 2.1 ==
10460 == Header 2.2 ==
10461 __NOEDITSECTION__
10462 !! result
10463 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10464 <ul>
10465 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10466 <ul>
10467 <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>
10468 <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>
10469 </ul>
10470 </li>
10471 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10472 <ul>
10473 <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>
10474 <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>
10475 </ul>
10476 </li>
10477 </ul>
10478 </div>
10479 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10480 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10481 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10482 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10483 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10484 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10485
10486 !! end
10487
10488 !! test
10489 BUG 1219 URL next to image (broken)
10490 !! input
10491 http://example.com[[Image:foobar.jpg]]
10492 !! result
10493 <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>
10494 </p>
10495 !!end
10496
10497 !! test
10498 Bug 1186 news: in the middle of text
10499 !! input
10500 http://en.wikinews.org/wiki/Wikinews:Workplace
10501 !! result
10502 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10503 </p>
10504 !!end
10505
10506
10507 !! test
10508 Namespaced link must have a title
10509 !! input
10510 [[Project:]]
10511 !! result
10512 <p>[[Project:]]
10513 </p>
10514 !!end
10515
10516 !! test
10517 Namespaced link must have a title (bad fragment version)
10518 !! input
10519 [[Project:#fragment]]
10520 !! result
10521 <p>[[Project:#fragment]]
10522 </p>
10523 !!end
10524
10525
10526 ###
10527 ### HTML tags and HTML attributes
10528 ###
10529
10530 !! test
10531 div with no attributes
10532 !! input
10533 <div>HTML rocks</div>
10534 !! result
10535 <div>HTML rocks</div>
10536
10537 !! end
10538
10539 !! test
10540 div with double-quoted attribute
10541 !! input
10542 <div id="rock">HTML rocks</div>
10543 !! result
10544 <div id="rock">HTML rocks</div>
10545
10546 !! end
10547
10548 !! test
10549 div with single-quoted attribute
10550 !! input
10551 <div id='rock'>HTML rocks</div>
10552 !! result
10553 <div id="rock">HTML rocks</div>
10554
10555 !! end
10556
10557 !! test
10558 div with unquoted attribute
10559 !! input
10560 <div id=rock>HTML rocks</div>
10561 !! result
10562 <div id="rock">HTML rocks</div>
10563
10564 !! end
10565
10566 !! test
10567 div with illegal double attributes
10568 !! input
10569 <div id="a" id="b">HTML rocks</div>
10570 !! result
10571 <div id="b">HTML rocks</div>
10572
10573 !!end
10574
10575 # FIXME: produce empty string instead of "class" in the PHP parser, following
10576 # the HTML5 spec.
10577 !! test
10578 div with empty attribute value, space before equals
10579 !! options
10580 parsoid
10581 !! input
10582 <div class =>HTML rocks</div>
10583 !! result
10584 <div class="">HTML rocks</div>
10585
10586 !! end
10587
10588 # The PHP parser escapes the opening brace to &#123; for some reason, so
10589 # disabled this test for it.
10590 !! test
10591 div with braces in attribute value
10592 !! options
10593 parsoid
10594 !! input
10595 <div title="{}">Foo</div>
10596 !! result
10597 <div title="{}">Foo</div>
10598 !! end
10599
10600 # This it very inconsistent in the PHP parser: it returns
10601 # class="class" if there is a space between the name and the equal sign (see
10602 # 'div with empty attribute value, space before equals'), but strips the
10603 # attribute completely if the space is missing. We hope that not much content
10604 # depends on this, so are implementing the behavior below in Parsoid for
10605 # consistencies' sake. Disabled for the PHP parser.
10606 # FIXME: fix this behavior in the PHP parser?
10607 !! test
10608 div with empty attribute value, no space before equals
10609 !! options
10610 parsoid
10611 !! input
10612 <div class=>HTML rocks</div>
10613 !! result
10614 <div class="">HTML rocks</div>
10615
10616 !! end
10617
10618 !! test
10619 HTML multiple attributes correction
10620 !! input
10621 <p class="error" class="awesome">Awesome!</p>
10622 !! result
10623 <p class="awesome">Awesome!</p>
10624
10625 !!end
10626
10627 !! test
10628 Table multiple attributes correction
10629 !! input
10630 {|
10631 !+ class="error" class="awesome"| status
10632 |}
10633 !! result
10634 <table>
10635 <tr>
10636 <th class="awesome"> status
10637 </th></tr></table>
10638
10639 !!end
10640
10641 !! test
10642 DIV IN UPPERCASE
10643 !! input
10644 <DIV ID="x">HTML ROCKS</DIV>
10645 !! result
10646 <div id="x">HTML ROCKS</div>
10647
10648 !!end
10649
10650 !! test
10651 Non-ASCII pseudo-tags are rendered as text
10652 !! input
10653 <khyô>
10654 !! result
10655 <p>&lt;khyô&gt;
10656 </p>
10657 !! end
10658
10659 !! test
10660 Pseudo-tag with URL 'name' renders as url link
10661 !! input
10662 <http://example.com/>
10663 !! result
10664 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
10665 </p>
10666 !! end
10667
10668 !! test
10669 text with amp in the middle of nowhere
10670 !! input
10671 Remember AT&T?
10672 !!result
10673 <p>Remember AT&amp;T?
10674 </p>
10675 !! end
10676
10677 !! test
10678 text with character entity: eacute
10679 !! input
10680 I always thought &eacute; was a cute letter.
10681 !! result
10682 <p>I always thought &#233; was a cute letter.
10683 </p>
10684 !! end
10685
10686 !! test
10687 text with entity-escaped character entity-like string: eacute
10688 !! input
10689 I always thought &amp;eacute; was a cute letter.
10690 !! result
10691 <p>I always thought &amp;eacute; was a cute letter.
10692 </p>
10693 !! end
10694
10695 !! test
10696 text with undefined character entity: xacute
10697 !! input
10698 I always thought &xacute; was a cute letter.
10699 !! result
10700 <p>I always thought &amp;xacute; was a cute letter.
10701 </p>
10702 !! end
10703
10704
10705 ###
10706 ### Nesting tests (see bug 41545, 50604, 51081)
10707 ###
10708
10709 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
10710 # Note that html2wt is considerably more difficult if we use <b> in
10711 # the test case, instead of <big>
10712 !! test
10713 Ensure that HTML adoption agency algorithm is properly implemented.
10714 !! input
10715 <big>X<big>Y</big>Z</big>
10716 !! result
10717 <p><big>X<big>Y</big>Z</big>
10718 </p>
10719 !! end
10720
10721 # This was bug 41545 in the PHP parser.
10722 !! test
10723 Nesting of <kbd>
10724 !! input
10725 <kbd>X<kbd>Y</kbd>Z</kbd>
10726 !! result
10727 <p><kbd>X<kbd>Y</kbd>Z</kbd>
10728 </p>
10729 !! end
10730
10731 # The following cases were bug 51081 in the PHP parser.
10732 # Note that there are some other nestable tags (b, i, etc) which are
10733 # not covered; see bug 51081 for discussion.
10734 !! test
10735 Nesting of <em>
10736 !! input
10737 <em>X<em>Y</em>Z</em>
10738 !! result
10739 <p><em>X<em>Y</em>Z</em>
10740 </p>
10741 !! end
10742
10743 !! test
10744 Nesting of <strong>
10745 !! input
10746 <strong>X<strong>Y</strong>Z</strong>
10747 !! result
10748 <p><strong>X<strong>Y</strong>Z</strong>
10749 </p>
10750 !! end
10751
10752 !! test
10753 Nesting of <q>
10754 !! input
10755 <q>X<q>Y</q>Z</q>
10756 !! result
10757 <p><q>X<q>Y</q>Z</q>
10758 </p>
10759 !! end
10760
10761 !! test
10762 Nesting of <ruby>
10763 !! input
10764 <ruby>X<ruby>Y</ruby>Z</ruby>
10765 !! result
10766 <p><ruby>X<ruby>Y</ruby>Z</ruby>
10767 </p>
10768 !! end
10769
10770 !! test
10771 Nesting of <bdo>
10772 !! input
10773 <bdo>X<bdo>Y</bdo>Z</bdo>
10774 !! result
10775 <p><bdo>X<bdo>Y</bdo>Z</bdo>
10776 </p>
10777 !! end
10778
10779
10780 ###
10781 ### Media links
10782 ###
10783
10784 !! test
10785 Media link
10786 !! input
10787 [[Media:Foobar.jpg]]
10788 !! result
10789 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
10790 </p>
10791 !! end
10792
10793 !! test
10794 Media link with text
10795 !! input
10796 [[Media:Foobar.jpg|A neat file to look at]]
10797 !! result
10798 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
10799 </p>
10800 !! end
10801
10802 # FIXME: this is still bad HTML tag nesting
10803 !! test
10804 Media link with nasty text
10805 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
10806 !! input
10807 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
10808 !! result
10809 <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>
10810
10811 !! end
10812
10813 !! test
10814 Media link to nonexistent file (bug 1702)
10815 !! input
10816 [[Media:No such.jpg]]
10817 !! result
10818 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
10819 </p>
10820 !! end
10821
10822 !! test
10823 Image link to nonexistent file (bug 1850 - good)
10824 !! input
10825 [[Image:No such.jpg]]
10826 !! result
10827 <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>
10828 </p>
10829 !! end
10830
10831 !! test
10832 :Image link to nonexistent file (bug 1850 - bad)
10833 !! input
10834 [[:Image:No such.jpg]]
10835 !! result
10836 <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>
10837 </p>
10838 !! end
10839
10840
10841
10842 !! test
10843 Character reference normalization in link text (bug 1938)
10844 !! input
10845 [[Main Page|this&that]]
10846 !! result
10847 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
10848 </p>
10849 !!end
10850
10851 !! article
10852 אַ
10853 !! text
10854 Test for unicode normalization
10855
10856 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
10857 !! endarticle
10858
10859 !! test
10860 (bug 19451) Links should refer to the normalized form.
10861 !! input
10862 [[&#xFB2E;]]
10863 [[&#x5d0;&#x5b7;]]
10864 [[&#x5d0;ַ]]
10865 [[א&#x5b7;]]
10866 [[אַ]]
10867 !! result
10868 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
10869 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
10870 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
10871 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
10872 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
10873 </p>
10874 !! end
10875
10876 !! test
10877 Empty attribute crash test (bug 2067)
10878 !! input
10879 <font color="">foo</font>
10880 !! result
10881 <p><font color="">foo</font>
10882 </p>
10883 !! end
10884
10885 !! test
10886 Empty attribute crash test single-quotes (bug 2067)
10887 !! input
10888 <font color=''>foo</font>
10889 !! result
10890 <p><font color="">foo</font>
10891 </p>
10892 !! end
10893
10894 !! test
10895 Attribute test: equals, then nothing
10896 !! input
10897 <font color=>foo</font>
10898 !! result
10899 <p><font>foo</font>
10900 </p>
10901 !! end
10902
10903 !! test
10904 Attribute test: unquoted value
10905 !! input
10906 <font color=x>foo</font>
10907 !! result
10908 <p><font color="x">foo</font>
10909 </p>
10910 !! end
10911
10912 !! test
10913 Attribute test: unquoted but illegal value (hash)
10914 !! input
10915 <font color=#x>foo</font>
10916 !! result
10917 <p><font color="#x">foo</font>
10918 </p>
10919 !! end
10920
10921 !! test
10922 Attribute test: no value
10923 !! input
10924 <font color>foo</font>
10925 !! result
10926 <p><font color="color">foo</font>
10927 </p>
10928 !! end
10929
10930 !! test
10931 Bug 2095: link with three closing brackets
10932 !! input
10933 [[Main Page]]]
10934 !! result
10935 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
10936 </p>
10937 !! end
10938
10939 !! test
10940 Bug 2095: link with pipe and three closing brackets
10941 !! input
10942 [[Main Page|link]]]
10943 !! result
10944 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
10945 </p>
10946 !! end
10947
10948 !! test
10949 Bug 2095: link with pipe and three closing brackets, version 2
10950 !! input
10951 [[Main Page|[http://example.com/]]]
10952 !! result
10953 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
10954 </p>
10955 !! end
10956
10957
10958 ###
10959 ### Safety
10960 ###
10961
10962 !! article
10963 Template:Dangerous attribute
10964 !! text
10965 " onmouseover="alert(document.cookie)
10966 !! endarticle
10967
10968 !! article
10969 Template:Dangerous style attribute
10970 !! text
10971 border-size: expression(alert(document.cookie))
10972 !! endarticle
10973
10974 !! article
10975 Template:Div style
10976 !! text
10977 <div style="float: right; {{{1}}}">Magic div</div>
10978 !! endarticle
10979
10980 !! test
10981 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
10982 !! input
10983 <div title="{{test}}"></div>
10984 !! result
10985 <div title="This is a test template"></div>
10986
10987 !! end
10988
10989 !! test
10990 Bug 2304: HTML attribute safety (dangerous template; 2309)
10991 !! input
10992 <div title="{{dangerous attribute}}"></div>
10993 !! result
10994 <div title=""></div>
10995
10996 !! end
10997
10998 !! test
10999 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11000 !! input
11001 <div style="{{dangerous style attribute}}"></div>
11002 !! result
11003 <div style="/* insecure input */"></div>
11004
11005 !! end
11006
11007 !! test
11008 Bug 2304: HTML attribute safety (safe parameter; 2309)
11009 !! input
11010 {{div style|width: 200px}}
11011 !! result
11012 <div style="float: right; width: 200px">Magic div</div>
11013
11014 !! end
11015
11016 !! test
11017 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11018 !! input
11019 {{div style|width: expression(alert(document.cookie))}}
11020 !! result
11021 <div style="/* insecure input */">Magic div</div>
11022
11023 !! end
11024
11025 !! test
11026 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11027 !! input
11028 {{div style|"><script>alert(document.cookie)</script>}}
11029 !! result
11030 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11031
11032 !! end
11033
11034 !! test
11035 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11036 !! input
11037 {{div style|" ><script>alert(document.cookie)</script>}}
11038 !! result
11039 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11040
11041 !! end
11042
11043 !! test
11044 Bug 2304: HTML attribute safety (link)
11045 !! input
11046 <div title="[[Main Page]]"></div>
11047 !! result
11048 <div title="&#91;&#91;Main Page]]"></div>
11049
11050 !! end
11051
11052 !! test
11053 Bug 2304: HTML attribute safety (italics)
11054 !! input
11055 <div title="''foobar''"></div>
11056 !! result
11057 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11058
11059 !! end
11060
11061 !! test
11062 Bug 2304: HTML attribute safety (bold)
11063 !! input
11064 <div title="'''foobar'''"></div>
11065 !! result
11066 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11067
11068 !! end
11069
11070
11071 !! test
11072 Bug 2304: HTML attribute safety (ISBN)
11073 !! input
11074 <div title="ISBN 1234567890"></div>
11075 !! result
11076 <div title="&#73;SBN 1234567890"></div>
11077
11078 !! end
11079
11080 !! test
11081 Bug 2304: HTML attribute safety (RFC)
11082 !! input
11083 <div title="RFC 1234"></div>
11084 !! result
11085 <div title="&#82;FC 1234"></div>
11086
11087 !! end
11088
11089 !! test
11090 Bug 2304: HTML attribute safety (PMID)
11091 !! input
11092 <div title="PMID 1234567890"></div>
11093 !! result
11094 <div title="&#80;MID 1234567890"></div>
11095
11096 !! end
11097
11098 !! test
11099 Bug 2304: HTML attribute safety (web link)
11100 !! input
11101 <div title="http://example.com/"></div>
11102 !! result
11103 <div title="http&#58;//example.com/"></div>
11104
11105 !! end
11106
11107 !! test
11108 Bug 2304: HTML attribute safety (named web link)
11109 !! input
11110 <div title="[http://example.com/ link]"></div>
11111 !! result
11112 <div title="&#91;http&#58;//example.com/ link]"></div>
11113
11114 !! end
11115
11116 !! test
11117 Bug 3244: HTML attribute safety (extension; safe)
11118 !! input
11119 <div style="<nowiki>background:blue</nowiki>"></div>
11120 !! result
11121 <div style="background:blue"></div>
11122
11123 !! end
11124
11125 !! test
11126 Bug 3244: HTML attribute safety (extension; unsafe)
11127 !! input
11128 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11129 !! result
11130 <div style="/* insecure input */"></div>
11131
11132 !! end
11133
11134 # More MSIE fun discovered by Tom Gilder
11135
11136 !! test
11137 MSIE CSS safety test: spurious slash
11138 !! input
11139 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11140 !! result
11141 <div style="/* insecure input */">evil</div>
11142
11143 !! end
11144
11145 !! test
11146 MSIE CSS safety test: hex code
11147 !! input
11148 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11149 !! result
11150 <div style="/* insecure input */">evil</div>
11151
11152 !! end
11153
11154 !! test
11155 MSIE CSS safety test: comment in url
11156 !! input
11157 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11158 !! result
11159 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11160
11161 !! end
11162
11163 !! test
11164 MSIE CSS safety test: comment in expression
11165 !! input
11166 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11167 !! result
11168 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11169
11170 !! end
11171
11172
11173 !! test
11174 Table attribute legitimate extension
11175 !! input
11176 {|
11177 !+ style="<nowiki>color:blue</nowiki>"| status
11178 |}
11179 !! result
11180 <table>
11181 <tr>
11182 <th style="color:blue"> status
11183 </th></tr></table>
11184
11185 !!end
11186
11187 !! test
11188 Table attribute safety
11189 !! input
11190 {|
11191 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11192 |}
11193 !! result
11194 <table>
11195 <tr>
11196 <th style="/* insecure input */"> status
11197 </th></tr></table>
11198
11199 !! end
11200
11201 !! test
11202 CSS line continuation 1
11203 !! input
11204 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11205 !! result
11206 <div style="/* insecure input */"></div>
11207
11208 !! end
11209
11210 !! test
11211 CSS line continuation 2
11212 !! input
11213 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11214 !! result
11215 <div style="/* insecure input */"></div>
11216
11217 !! end
11218
11219 !! article
11220 Template:Identity
11221 !! text
11222 {{{1}}}
11223 !! endarticle
11224
11225 !! test
11226 Expansion of multi-line templates in attribute values (bug 6255)
11227 !! input
11228 <div style="background: {{identity|#00FF00}}">-</div>
11229 !! result
11230 <div style="background: #00FF00">-</div>
11231
11232 !! end
11233
11234
11235 !! test
11236 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11237 !! input
11238 <div style="background:
11239 #00FF00">-</div>
11240 !! result
11241 <div style="background: #00FF00">-</div>
11242
11243 !! end
11244
11245 !! test
11246 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11247 !! input
11248 <div style="background: &#10;#00FF00">-</div>
11249 !! result
11250 <div style="background: &#10;#00FF00">-</div>
11251
11252 !! end
11253
11254 ###
11255 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11256 ###
11257 !! test
11258 Parser hook: empty input
11259 !! input
11260 <tag></tag>
11261 !! result
11262 <pre>
11263 ''
11264 array (
11265 )
11266 </pre>
11267
11268 !! end
11269
11270 !! test
11271 Parser hook: empty input using terminated empty elements
11272 !! input
11273 <tag/>
11274 !! result
11275 <pre>
11276 NULL
11277 array (
11278 )
11279 </pre>
11280
11281 !! end
11282
11283 !! test
11284 Parser hook: empty input using terminated empty elements (space before)
11285 !! input
11286 <tag />
11287 !! result
11288 <pre>
11289 NULL
11290 array (
11291 )
11292 </pre>
11293
11294 !! end
11295
11296 !! test
11297 Parser hook: basic input
11298 !! input
11299 <tag>input</tag>
11300 !! result
11301 <pre>
11302 'input'
11303 array (
11304 )
11305 </pre>
11306
11307 !! end
11308
11309
11310 !! test
11311 Parser hook: case insensitive
11312 !! input
11313 <TAG>input</TAG>
11314 !! result
11315 <pre>
11316 'input'
11317 array (
11318 )
11319 </pre>
11320
11321 !! end
11322
11323
11324 !! test
11325 Parser hook: case insensitive, redux
11326 !! input
11327 <TaG>input</TAg>
11328 !! result
11329 <pre>
11330 'input'
11331 array (
11332 )
11333 </pre>
11334
11335 !! end
11336
11337 !! test
11338 Parser hook: nested tags
11339 !! options
11340 noxml
11341 !! input
11342 <tag><tag></tag></tag>
11343 !! result
11344 <pre>
11345 '<tag>'
11346 array (
11347 )
11348 </pre>&lt;/tag&gt;
11349
11350 !! end
11351
11352 !! test
11353 Parser hook: basic arguments
11354 !! input
11355 <tag width=200 height = "100" depth = '50' square></tag>
11356 !! result
11357 <pre>
11358 ''
11359 array (
11360 'width' => '200',
11361 'height' => '100',
11362 'depth' => '50',
11363 'square' => 'square',
11364 )
11365 </pre>
11366
11367 !! end
11368
11369 !! test
11370 Parser hook: argument containing a forward slash (bug 5344)
11371 !! input
11372 <tag filename='/tmp/bla'></tag>
11373 !! result
11374 <pre>
11375 ''
11376 array (
11377 'filename' => '/tmp/bla',
11378 )
11379 </pre>
11380
11381 !! end
11382
11383 !! test
11384 Parser hook: empty input using terminated empty elements (bug 2374)
11385 !! input
11386 <tag foo=bar/>text
11387 !! result
11388 <pre>
11389 NULL
11390 array (
11391 'foo' => 'bar',
11392 )
11393 </pre>text
11394
11395 !! end
11396
11397 # </tag> should be output literally since there is no matching tag that begins it
11398 !! test
11399 Parser hook: basic arguments using terminated empty elements (bug 2374)
11400 !! input
11401 <tag width=200 height = "100" depth = '50' square/>
11402 other stuff
11403 </tag>
11404 !! result
11405 <pre>
11406 NULL
11407 array (
11408 'width' => '200',
11409 'height' => '100',
11410 'depth' => '50',
11411 'square' => 'square',
11412 )
11413 </pre>
11414 <p>other stuff
11415 &lt;/tag&gt;
11416 </p>
11417 !! end
11418
11419 ###
11420 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11421 ###
11422
11423 !! test
11424 Parser hook: static parser hook not inside a comment
11425 !! input
11426 <statictag>hello, world</statictag>
11427 <statictag action=flush/>
11428 !! result
11429 <p>hello, world
11430 </p>
11431 !! end
11432
11433
11434 !! test
11435 Parser hook: static parser hook inside a comment
11436 !! input
11437 <!-- <statictag>hello, world</statictag> -->
11438 <statictag action=flush/>
11439 !! result
11440 <p><br />
11441 </p>
11442 !! end
11443
11444 # Nested template calls; this case was broken by Parser.php rev 1.506,
11445 # since reverted.
11446
11447 !! article
11448 Template:One-parameter
11449 !! text
11450 (My parameter is: {{{1}}})
11451 !! endarticle
11452
11453 !! article
11454 Template:Map-one-parameter
11455 !! text
11456 {{{{{1}}}|{{{2}}}}}
11457 !! endarticle
11458
11459 !! test
11460 Nested template calls
11461 !! input
11462 {{Map-one-parameter|One-parameter|param}}
11463 !! result
11464 <p>(My parameter is: param)
11465 </p>
11466 !! end
11467
11468
11469 ###
11470 ### Sanitizer
11471 ###
11472 !! test
11473 Sanitizer: Closing of open tags
11474 !! input
11475 <s></s><table></table>
11476 !! result
11477 <s></s><table></table>
11478
11479 !! end
11480
11481 !! test
11482 Sanitizer: Closing of open but not closed tags
11483 !! input
11484 <s>foo
11485 !! result
11486 <p><s>foo</s>
11487 </p>
11488 !! end
11489
11490 !! test
11491 Sanitizer: Closing of closed but not open tags
11492 !! input
11493 </s>
11494 !! result
11495 <p>&lt;/s&gt;
11496 </p>
11497 !! end
11498
11499 !! test
11500 Sanitizer: Closing of closed but not open table tags
11501 !! input
11502 Table not started</td></tr></table>
11503 !! result
11504 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11505 </p>
11506 !! end
11507
11508 !! test
11509 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11510 !! input
11511 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11512 !! result
11513 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11514 </p>
11515 !! end
11516
11517 !! test
11518 Sanitizer: Validating the contents of the id attribute (bug 4515)
11519 !! options
11520 disabled
11521 !! input
11522 <br id=9 />
11523 !! result
11524 Something, but definitely not <br id="9" />...
11525 !! end
11526
11527 !! test
11528 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11529 !! options
11530 disabled
11531 !! input
11532 <br id="foo" /><br id="foo" />
11533 !! result
11534 Something need to be done. foo-2 ?
11535 !! end
11536
11537 !! test
11538 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11539 !! input
11540 <div itemscope>
11541 <meta itemprop="hello" content="world">
11542 <meta http-equiv="refresh" content="5">
11543 <meta itemprop="hello" http-equiv="refresh" content="5">
11544 <link itemprop="hello" href="{{SERVER}}">
11545 <link rel="stylesheet" href="{{SERVER}}">
11546 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11547 </div>
11548 !! result
11549 <div itemscope="itemscope">
11550 <p> <meta itemprop="hello" content="world" />
11551 &lt;meta http-equiv="refresh" content="5"&gt;
11552 <meta itemprop="hello" content="5" />
11553 </p>
11554 <link itemprop="hello" href="http&#58;//example.org" />
11555 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11556 <link itemprop="hello" href="http&#58;//example.org" />
11557 </div>
11558
11559 !! end
11560
11561 !! test
11562 Language converter: output gets cut off unexpectedly (bug 5757)
11563 !! options
11564 language=zh
11565 !! input
11566 this bit is safe: }-
11567
11568 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
11569
11570 then we get cut off here: }-
11571
11572 all additional text is vanished
11573 !! result
11574 <p>this bit is safe: }-
11575 </p><p>but if we add a conversion instance: xxx
11576 </p><p>then we get cut off here: }-
11577 </p><p>all additional text is vanished
11578 </p>
11579 !! end
11580
11581 !! test
11582 Self closed html pairs (bug 5487)
11583 !! options
11584 !! input
11585 <center><font id="bug" />Centered text</center>
11586 <div><font id="bug2" />In div text</div>
11587 !! result
11588 <center>&lt;font id="bug" /&gt;Centered text</center>
11589 <div>&lt;font id="bug2" /&gt;In div text</div>
11590
11591 !! end
11592
11593 #
11594 #
11595 #
11596
11597 !! test
11598 Punctuation: nbsp before exclamation
11599 !! input
11600 C'est grave !
11601 !! result
11602 <p>C'est grave&#160;!
11603 </p>
11604 !! end
11605
11606 !! test
11607 Punctuation: CSS !important (bug 11874)
11608 !! input
11609 <div style="width:50% !important">important</div>
11610 !! result
11611 <div style="width:50% !important">important</div>
11612
11613 !!end
11614
11615 !! test
11616 Punctuation: CSS ! important (bug 11874; with space after)
11617 !! input
11618 <div style="width:50% ! important">important</div>
11619 !! result
11620 <div style="width:50% ! important">important</div>
11621
11622 !!end
11623
11624
11625 !! test
11626 HTML bullet list, closed tags (bug 5497)
11627 !! input
11628 <ul>
11629 <li>One</li>
11630 <li>Two</li>
11631 </ul>
11632 !! result
11633 <ul>
11634 <li>One</li>
11635 <li>Two</li>
11636 </ul>
11637
11638 !! end
11639
11640 !! test
11641 HTML bullet list, unclosed tags (bug 5497)
11642 !! options
11643 disabled
11644 !! input
11645 <ul>
11646 <li>One
11647 <li>Two
11648 </ul>
11649 !! result
11650 <ul>
11651 <li>One
11652 </li><li>Two
11653 </li></ul>
11654
11655 !! end
11656
11657 !! test
11658 HTML ordered list, closed tags (bug 5497)
11659 !! input
11660 <ol>
11661 <li>One</li>
11662 <li>Two</li>
11663 </ol>
11664 !! result
11665 <ol>
11666 <li>One</li>
11667 <li>Two</li>
11668 </ol>
11669
11670 !! end
11671
11672 !! test
11673 HTML ordered list, unclosed tags (bug 5497)
11674 !! options
11675 disabled
11676 !! input
11677 <ol>
11678 <li>One
11679 <li>Two
11680 </ol>
11681 !! result
11682 <ol>
11683 <li>One
11684 </li><li>Two
11685 </li></ol>
11686
11687 !! end
11688
11689 !! test
11690 HTML nested bullet list, closed tags (bug 5497)
11691 !! input
11692 <ul>
11693 <li>One</li>
11694 <li>Two:
11695 <ul>
11696 <li>Sub-one</li>
11697 <li>Sub-two</li>
11698 </ul>
11699 </li>
11700 </ul>
11701 !! result
11702 <ul>
11703 <li>One</li>
11704 <li>Two:
11705 <ul>
11706 <li>Sub-one</li>
11707 <li>Sub-two</li>
11708 </ul>
11709 </li>
11710 </ul>
11711
11712 !! end
11713
11714 !! test
11715 HTML nested bullet list, open tags (bug 5497)
11716 !! options
11717 disabled
11718 !! input
11719 <ul>
11720 <li>One
11721 <li>Two:
11722 <ul>
11723 <li>Sub-one
11724 <li>Sub-two
11725 </ul>
11726 </ul>
11727 !! result
11728 <ul>
11729 <li>One
11730 </li><li>Two:
11731 <ul>
11732 <li>Sub-one
11733 </li><li>Sub-two
11734 </li></ul>
11735 </li></ul>
11736
11737 !! end
11738
11739 !! test
11740 HTML nested ordered list, closed tags (bug 5497)
11741 !! input
11742 <ol>
11743 <li>One</li>
11744 <li>Two:
11745 <ol>
11746 <li>Sub-one</li>
11747 <li>Sub-two</li>
11748 </ol>
11749 </li>
11750 </ol>
11751 !! result
11752 <ol>
11753 <li>One</li>
11754 <li>Two:
11755 <ol>
11756 <li>Sub-one</li>
11757 <li>Sub-two</li>
11758 </ol>
11759 </li>
11760 </ol>
11761
11762 !! end
11763
11764 !! test
11765 HTML nested ordered list, open tags (bug 5497)
11766 !! options
11767 disabled
11768 !! input
11769 <ol>
11770 <li>One
11771 <li>Two:
11772 <ol>
11773 <li>Sub-one
11774 <li>Sub-two
11775 </ol>
11776 </ol>
11777 !! result
11778 <ol>
11779 <li>One
11780 </li><li>Two:
11781 <ol>
11782 <li>Sub-one
11783 </li><li>Sub-two
11784 </li></ol>
11785 </li></ol>
11786
11787 !! end
11788
11789 !! test
11790 HTML ordered list item with parameters oddity
11791 !! input
11792 <ol><li id="fragment">One</li></ol>
11793 !! result
11794 <ol><li id="fragment">One</li></ol>
11795
11796 !! end
11797
11798 !!test
11799 bug 5918: autonumbering
11800 !! input
11801 [http://first/] [http://second] [ftp://ftp]
11802
11803 ftp://inlineftp
11804
11805 [mailto:enclosed@mail.tld With target]
11806
11807 [mailto:enclosed@mail.tld]
11808
11809 mailto:inline@mail.tld
11810 !! result
11811 <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>
11812 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
11813 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
11814 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
11815 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
11816 </p>
11817 !! end
11818
11819
11820 #
11821 # Security and HTML correctness
11822 # From Nick Jenkins' fuzz testing
11823 #
11824
11825 !! test
11826 Fuzz testing: Parser13
11827 !! input
11828 {|
11829 | http://a|
11830 !! result
11831 <table>
11832 <tr>
11833 <td>
11834 </td>
11835 </tr>
11836 </table>
11837
11838 !! end
11839
11840 !! test
11841 Fuzz testing: Parser14
11842 !! input
11843 == onmouseover= ==
11844 http://__TOC__
11845 !! result
11846 <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>
11847 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11848 <ul>
11849 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
11850 </ul>
11851 </div>
11852
11853 !! end
11854
11855 !! test
11856 Fuzz testing: Parser14-table
11857 !! input
11858 ==a==
11859 {| STYLE=__TOC__
11860 !! result
11861 <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>
11862 <table style="&#95;_TOC&#95;_">
11863 <tr><td></td></tr>
11864 </table>
11865
11866 !! end
11867
11868 # Known to produce bogus xml (extra </td>)
11869 !! test
11870 Fuzz testing: Parser16
11871 !! options
11872 noxml
11873 !! input
11874 {|
11875 !https://||||||
11876 !! result
11877 <table>
11878 <tr>
11879 <th>https://</th>
11880 <th></th>
11881 <th></th>
11882 <th>
11883 </td>
11884 </tr>
11885 </table>
11886
11887 !! end
11888
11889 !! test
11890 Fuzz testing: Parser21
11891 !! input
11892 {|
11893 ! irc://{{ftp://a" onmouseover="alert('hello world');"
11894 |
11895 !! result
11896 <table>
11897 <tr>
11898 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
11899 </th>
11900 <td>
11901 </td>
11902 </tr>
11903 </table>
11904
11905 !! end
11906
11907 !! test
11908 Fuzz testing: Parser22
11909 !! input
11910 http://===r:::https://b
11911
11912 {|
11913 !!result
11914 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
11915 </p>
11916 <table>
11917 <tr><td></td></tr>
11918 </table>
11919
11920 !! end
11921
11922 # Known to produce bad XML for now
11923 !! test
11924 Fuzz testing: Parser24
11925 !! options
11926 noxml
11927 !! input
11928 {|
11929 {{{|
11930 <u CLASS=
11931 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
11932 <br style="onmouseover='alert(document.cookie);' " />
11933
11934 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11935 |
11936 !! result
11937 <table>
11938 {{{|
11939 <u class="&#124;">}}}} &gt;
11940 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
11941
11942 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
11943 <tr>
11944 <td></u>
11945 </td>
11946 </tr>
11947 </table>
11948
11949 !! end
11950
11951 # Note: the current result listed for this is not what the original one was,
11952 # but the original bug was JavaScript injection, which is fixed in any case.
11953 # It's not clear that the original result listed was any more correct than the
11954 # current one. Original result:
11955 # <p>{{{|
11956 # </p>
11957 # <li class="&#124;&#124;">
11958 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11959 !!test
11960 Fuzz testing: Parser25 (bug 6055)
11961 !! input
11962 {{{
11963 |
11964 <LI CLASS=||
11965 >
11966 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
11967 !! result
11968 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
11969 </p>
11970 !! end
11971
11972 !!test
11973 Fuzz testing: URL adjacent extension (with space, clean)
11974 !! options
11975 !! input
11976 http://example.com <nowiki>junk</nowiki>
11977 !! result
11978 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
11979 </p>
11980 !!end
11981
11982 !!test
11983 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
11984 !! options
11985 !! input
11986 http://example.com<nowiki>junk</nowiki>
11987 !! result
11988 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
11989 </p>
11990 !!end
11991
11992 !!test
11993 Fuzz testing: URL adjacent extension (no space, dirty; pre)
11994 !! options
11995 !! input
11996 http://example.com<pre>junk</pre>
11997 !! result
11998 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11999
12000 !!end
12001
12002 !!test
12003 Fuzz testing: image with bogus manual thumbnail
12004 !!input
12005 [[Image:foobar.jpg|thumbnail= ]]
12006 !!result
12007 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12008
12009 !!end
12010
12011 !! test
12012 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12013 !! input
12014 <pre dir="&#10;"></pre>
12015 !! result
12016 <pre dir="&#10;"></pre>
12017
12018 !! end
12019
12020 !! test
12021 Parsing optional HTML elements (Bug 6171)
12022 !! options
12023 !! input
12024 <table>
12025 <tr>
12026 <td> Some tabular data</td>
12027 <td> More tabular data ...
12028 <td> And yet som tabular data</td>
12029 </tr>
12030 </table>
12031 !! result
12032 <table>
12033 <tr>
12034 <td> Some tabular data</td>
12035 <td> More tabular data ...
12036 </td><td> And yet som tabular data</td>
12037 </tr>
12038 </table>
12039
12040 !! end
12041
12042 !! test
12043 Correct handling of <td>, <tr> (Bug 6171)
12044 !! options
12045 !! input
12046 <table>
12047 <tr>
12048 <td> Some tabular data</td>
12049 <td> More tabular data ...</td>
12050 <td> And yet som tabular data</td>
12051 </tr>
12052 </table>
12053 !! result
12054 <table>
12055 <tr>
12056 <td> Some tabular data</td>
12057 <td> More tabular data ...</td>
12058 <td> And yet som tabular data</td>
12059 </tr>
12060 </table>
12061
12062 !! end
12063
12064
12065 !! test
12066 Parsing crashing regression (fr:JavaScript)
12067 !! input
12068 </body></x>
12069 !! result
12070 <p>&lt;/body&gt;&lt;/x&gt;
12071 </p>
12072 !! end
12073
12074 !! test
12075 Inline wiki vs wiki block nesting
12076 !! input
12077 '''Bold paragraph
12078
12079 New wiki paragraph
12080 !! result
12081 <p><b>Bold paragraph</b>
12082 </p><p>New wiki paragraph
12083 </p>
12084 !! end
12085
12086 !! test
12087 Inline HTML vs wiki block nesting
12088 !! options
12089 disabled
12090 !! input
12091 <b>Bold paragraph
12092
12093 New wiki paragraph
12094 !! result
12095 <p><b>Bold paragraph</b>
12096 </p><p>New wiki paragraph
12097 </p>
12098 !! end
12099
12100 # Original result was this:
12101 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12102 # </p>
12103 # While that might be marginally more intuitive, maybe, the six-apostrophe
12104 # construct is clearly pathological and the result stated here (which is what
12105 # the parser actually does) is about as reasonable as anything.
12106 !!test
12107 Mixing markup for italics and bold
12108 !! options
12109 !! input
12110 '''bold''''''bold''bolditalics'''''
12111 !! result
12112 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12113 </p>
12114 !! end
12115
12116
12117 !! article
12118 Xyzzyx
12119 !! text
12120 Article for special page transclusion test
12121 !! endarticle
12122
12123 !! test
12124 Special page transclusion
12125 !! options
12126 !! input
12127 {{Special:Prefixindex/Xyzzyx}}
12128 !! result
12129 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12130
12131 !! end
12132
12133 !! test
12134 Special page transclusion twice (bug 5021)
12135 !! options
12136 !! input
12137 {{Special:Prefixindex/Xyzzyx}}
12138 {{Special:Prefixindex/Xyzzyx}}
12139 !! result
12140 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12141 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12142
12143 !! end
12144
12145 !! test
12146 Transclusion of default MediaWiki message
12147 !! input
12148 {{MediaWiki:Mainpage}}
12149 !!result
12150 <p>Main Page
12151 </p>
12152 !! end
12153
12154 !! test
12155 Transclusion of nonexistent MediaWiki message
12156 !! input
12157 {{MediaWiki:Mainpagexxx}}
12158 !!result
12159 <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>
12160 </p>
12161 !! end
12162
12163 !! test
12164 Transclusion of MediaWiki message with underscore
12165 !! input
12166 {{MediaWiki:history_short}}
12167 !! result
12168 <p>History
12169 </p>
12170 !! end
12171
12172 !! test
12173 Transclusion of MediaWiki message with space
12174 !! input
12175 {{MediaWiki:history short}}
12176 !! result
12177 <p>History
12178 </p>
12179 !! end
12180
12181 !! test
12182 Invalid header with following text
12183 !! input
12184 = x = y
12185 !! result
12186 <p>= x = y
12187 </p>
12188 !! end
12189
12190
12191 !! test
12192 Section extraction test (section 0)
12193 !! options
12194 section=0
12195 !! input
12196 start
12197 ==a==
12198 ===aa===
12199 ====aaa====
12200 ==b==
12201 ===ba===
12202 ===bb===
12203 ====bba====
12204 ===bc===
12205 ==c==
12206 ===ca===
12207 !! result
12208 start
12209 !! end
12210
12211 !! test
12212 Section extraction test (section 1)
12213 !! options
12214 section=1
12215 !! input
12216 start
12217 ==a==
12218 ===aa===
12219 ====aaa====
12220 ==b==
12221 ===ba===
12222 ===bb===
12223 ====bba====
12224 ===bc===
12225 ==c==
12226 ===ca===
12227 !! result
12228 ==a==
12229 ===aa===
12230 ====aaa====
12231 !! end
12232
12233 !! test
12234 Section extraction test (section 2)
12235 !! options
12236 section=2
12237 !! input
12238 start
12239 ==a==
12240 ===aa===
12241 ====aaa====
12242 ==b==
12243 ===ba===
12244 ===bb===
12245 ====bba====
12246 ===bc===
12247 ==c==
12248 ===ca===
12249 !! result
12250 ===aa===
12251 ====aaa====
12252 !! end
12253
12254 !! test
12255 Section extraction test (section 3)
12256 !! options
12257 section=3
12258 !! input
12259 start
12260 ==a==
12261 ===aa===
12262 ====aaa====
12263 ==b==
12264 ===ba===
12265 ===bb===
12266 ====bba====
12267 ===bc===
12268 ==c==
12269 ===ca===
12270 !! result
12271 ====aaa====
12272 !! end
12273
12274 !! test
12275 Section extraction test (section 4)
12276 !! options
12277 section=4
12278 !! input
12279 start
12280 ==a==
12281 ===aa===
12282 ====aaa====
12283 ==b==
12284 ===ba===
12285 ===bb===
12286 ====bba====
12287 ===bc===
12288 ==c==
12289 ===ca===
12290 !! result
12291 ==b==
12292 ===ba===
12293 ===bb===
12294 ====bba====
12295 ===bc===
12296 !! end
12297
12298 !! test
12299 Section extraction test (section 5)
12300 !! options
12301 section=5
12302 !! input
12303 start
12304 ==a==
12305 ===aa===
12306 ====aaa====
12307 ==b==
12308 ===ba===
12309 ===bb===
12310 ====bba====
12311 ===bc===
12312 ==c==
12313 ===ca===
12314 !! result
12315 ===ba===
12316 !! end
12317
12318 !! test
12319 Section extraction test (section 6)
12320 !! options
12321 section=6
12322 !! input
12323 start
12324 ==a==
12325 ===aa===
12326 ====aaa====
12327 ==b==
12328 ===ba===
12329 ===bb===
12330 ====bba====
12331 ===bc===
12332 ==c==
12333 ===ca===
12334 !! result
12335 ===bb===
12336 ====bba====
12337 !! end
12338
12339 !! test
12340 Section extraction test (section 7)
12341 !! options
12342 section=7
12343 !! input
12344 start
12345 ==a==
12346 ===aa===
12347 ====aaa====
12348 ==b==
12349 ===ba===
12350 ===bb===
12351 ====bba====
12352 ===bc===
12353 ==c==
12354 ===ca===
12355 !! result
12356 ====bba====
12357 !! end
12358
12359 !! test
12360 Section extraction test (section 8)
12361 !! options
12362 section=8
12363 !! input
12364 start
12365 ==a==
12366 ===aa===
12367 ====aaa====
12368 ==b==
12369 ===ba===
12370 ===bb===
12371 ====bba====
12372 ===bc===
12373 ==c==
12374 ===ca===
12375 !! result
12376 ===bc===
12377 !! end
12378
12379 !! test
12380 Section extraction test (section 9)
12381 !! options
12382 section=9
12383 !! input
12384 start
12385 ==a==
12386 ===aa===
12387 ====aaa====
12388 ==b==
12389 ===ba===
12390 ===bb===
12391 ====bba====
12392 ===bc===
12393 ==c==
12394 ===ca===
12395 !! result
12396 ==c==
12397 ===ca===
12398 !! end
12399
12400 !! test
12401 Section extraction test (section 10)
12402 !! options
12403 section=10
12404 !! input
12405 start
12406 ==a==
12407 ===aa===
12408 ====aaa====
12409 ==b==
12410 ===ba===
12411 ===bb===
12412 ====bba====
12413 ===bc===
12414 ==c==
12415 ===ca===
12416 !! result
12417 ===ca===
12418 !! end
12419
12420 !! test
12421 Section extraction test (nonexistent section 11)
12422 !! options
12423 section=11
12424 !! input
12425 start
12426 ==a==
12427 ===aa===
12428 ====aaa====
12429 ==b==
12430 ===ba===
12431 ===bb===
12432 ====bba====
12433 ===bc===
12434 ==c==
12435 ===ca===
12436 !! result
12437 !! end
12438
12439 !! test
12440 Section extraction test with bogus heading (section 1)
12441 !! options
12442 section=1
12443 !! input
12444 ==a==
12445 ==bogus== not a legal section
12446 ==b==
12447 !! result
12448 ==a==
12449 ==bogus== not a legal section
12450 !! end
12451
12452 !! test
12453 Section extraction test with bogus heading (section 2)
12454 !! options
12455 section=2
12456 !! input
12457 ==a==
12458 ==bogus== not a legal section
12459 ==b==
12460 !! result
12461 ==b==
12462 !! end
12463
12464 !! test
12465 Section extraction test with comment after heading (section 1)
12466 !! options
12467 section=1
12468 !! input
12469 ==a==
12470 ==b== <!-- -->
12471 ==c==
12472 !! result
12473 ==a==
12474 !! end
12475
12476 !! test
12477 Section extraction test with comment after heading (section 2)
12478 !! options
12479 section=2
12480 !! input
12481 ==a==
12482 ==b== <!-- -->
12483 ==c==
12484 !! result
12485 ==b== <!-- -->
12486 !! end
12487
12488 !! test
12489 Section extraction test with bogus <nowiki> heading (section 1)
12490 !! options
12491 section=1
12492 !! input
12493 ==a==
12494 ==bogus== <nowiki>not a legal section</nowiki>
12495 ==b==
12496 !! result
12497 ==a==
12498 ==bogus== <nowiki>not a legal section</nowiki>
12499 !! end
12500
12501 !! test
12502 Section extraction test with bogus <nowiki> heading (section 2)
12503 !! options
12504 section=2
12505 !! input
12506 ==a==
12507 ==bogus== <nowiki>not a legal section</nowiki>
12508 ==b==
12509 !! result
12510 ==b==
12511 !! end
12512
12513
12514 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12515 # instead of respecting commented sections
12516 !! test
12517 Section extraction prefixed by comment (section 1)
12518 !! options
12519 section=1
12520 !! input
12521 <!-- -->==sec1==
12522 ==sec2==
12523 !!result
12524 ==sec2==
12525 !!end
12526
12527 !! test
12528 Section extraction prefixed by comment (section 2)
12529 !! options
12530 section=2
12531 !! input
12532 <!-- -->==sec1==
12533 ==sec2==
12534 !!result
12535
12536 !!end
12537
12538
12539 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12540 # instead of respecting HTML-style headings
12541 !! test
12542 Section extraction, mixed wiki and html (section 1)
12543 !! options
12544 section=1
12545 !! input
12546 <h2>unmarked</h2>
12547 unmarked
12548 ==1==
12549 one
12550 ==2==
12551 two
12552 !! result
12553 ==1==
12554 one
12555 !! end
12556
12557 !! test
12558 Section extraction, mixed wiki and html (section 2)
12559 !! options
12560 section=2
12561 !! input
12562 <h2>unmarked</h2>
12563 unmarked
12564 ==1==
12565 one
12566 ==2==
12567 two
12568 !! result
12569 ==2==
12570 two
12571 !! end
12572
12573
12574 # Formerly testing for bug 3342
12575 !! test
12576 Section extraction, heading surrounded by <noinclude>
12577 !! options
12578 section=1
12579 !! input
12580 <noinclude>==unmarked==</noinclude>
12581 ==marked==
12582 !! result
12583 ==marked==
12584 !!end
12585
12586 # Test behavior of bug 19910
12587 !! test
12588 Sectiion with all-equals
12589 !! options
12590 section=2
12591 !! input
12592 ===
12593 The line above must have a trailing space
12594 === <!--
12595 --> <!-- -->
12596 But just in case it doesn't...
12597 !! result
12598 === <!--
12599 --> <!-- -->
12600 But just in case it doesn't...
12601 !! end
12602
12603 !! test
12604 Section replacement test (section 0)
12605 !! options
12606 replace=0,"xxx"
12607 !! input
12608 start
12609 ==a==
12610 ===aa===
12611 ====aaa====
12612 ==b==
12613 ===ba===
12614 ===bb===
12615 ====bba====
12616 ===bc===
12617 ==c==
12618 ===ca===
12619 !! result
12620 xxx
12621
12622 ==a==
12623 ===aa===
12624 ====aaa====
12625 ==b==
12626 ===ba===
12627 ===bb===
12628 ====bba====
12629 ===bc===
12630 ==c==
12631 ===ca===
12632 !! end
12633
12634 !! test
12635 Section replacement test (section 1)
12636 !! options
12637 replace=1,"xxx"
12638 !! input
12639 start
12640 ==a==
12641 ===aa===
12642 ====aaa====
12643 ==b==
12644 ===ba===
12645 ===bb===
12646 ====bba====
12647 ===bc===
12648 ==c==
12649 ===ca===
12650 !! result
12651 start
12652 xxx
12653
12654 ==b==
12655 ===ba===
12656 ===bb===
12657 ====bba====
12658 ===bc===
12659 ==c==
12660 ===ca===
12661 !! end
12662
12663 !! test
12664 Section replacement test (section 2)
12665 !! options
12666 replace=2,"xxx"
12667 !! input
12668 start
12669 ==a==
12670 ===aa===
12671 ====aaa====
12672 ==b==
12673 ===ba===
12674 ===bb===
12675 ====bba====
12676 ===bc===
12677 ==c==
12678 ===ca===
12679 !! result
12680 start
12681 ==a==
12682 xxx
12683
12684 ==b==
12685 ===ba===
12686 ===bb===
12687 ====bba====
12688 ===bc===
12689 ==c==
12690 ===ca===
12691 !! end
12692
12693 !! test
12694 Section replacement test (section 3)
12695 !! options
12696 replace=3,"xxx"
12697 !! input
12698 start
12699 ==a==
12700 ===aa===
12701 ====aaa====
12702 ==b==
12703 ===ba===
12704 ===bb===
12705 ====bba====
12706 ===bc===
12707 ==c==
12708 ===ca===
12709 !! result
12710 start
12711 ==a==
12712 ===aa===
12713 xxx
12714
12715 ==b==
12716 ===ba===
12717 ===bb===
12718 ====bba====
12719 ===bc===
12720 ==c==
12721 ===ca===
12722 !! end
12723
12724 !! test
12725 Section replacement test (section 4)
12726 !! options
12727 replace=4,"xxx"
12728 !! input
12729 start
12730 ==a==
12731 ===aa===
12732 ====aaa====
12733 ==b==
12734 ===ba===
12735 ===bb===
12736 ====bba====
12737 ===bc===
12738 ==c==
12739 ===ca===
12740 !! result
12741 start
12742 ==a==
12743 ===aa===
12744 ====aaa====
12745 xxx
12746
12747 ==c==
12748 ===ca===
12749 !! end
12750
12751 !! test
12752 Section replacement test (section 5)
12753 !! options
12754 replace=5,"xxx"
12755 !! input
12756 start
12757 ==a==
12758 ===aa===
12759 ====aaa====
12760 ==b==
12761 ===ba===
12762 ===bb===
12763 ====bba====
12764 ===bc===
12765 ==c==
12766 ===ca===
12767 !! result
12768 start
12769 ==a==
12770 ===aa===
12771 ====aaa====
12772 ==b==
12773 xxx
12774
12775 ===bb===
12776 ====bba====
12777 ===bc===
12778 ==c==
12779 ===ca===
12780 !! end
12781
12782 !! test
12783 Section replacement test (section 6)
12784 !! options
12785 replace=6,"xxx"
12786 !! input
12787 start
12788 ==a==
12789 ===aa===
12790 ====aaa====
12791 ==b==
12792 ===ba===
12793 ===bb===
12794 ====bba====
12795 ===bc===
12796 ==c==
12797 ===ca===
12798 !! result
12799 start
12800 ==a==
12801 ===aa===
12802 ====aaa====
12803 ==b==
12804 ===ba===
12805 xxx
12806
12807 ===bc===
12808 ==c==
12809 ===ca===
12810 !! end
12811
12812 !! test
12813 Section replacement test (section 7)
12814 !! options
12815 replace=7,"xxx"
12816 !! input
12817 start
12818 ==a==
12819 ===aa===
12820 ====aaa====
12821 ==b==
12822 ===ba===
12823 ===bb===
12824 ====bba====
12825 ===bc===
12826 ==c==
12827 ===ca===
12828 !! result
12829 start
12830 ==a==
12831 ===aa===
12832 ====aaa====
12833 ==b==
12834 ===ba===
12835 ===bb===
12836 xxx
12837
12838 ===bc===
12839 ==c==
12840 ===ca===
12841 !! end
12842
12843 !! test
12844 Section replacement test (section 8)
12845 !! options
12846 replace=8,"xxx"
12847 !! input
12848 start
12849 ==a==
12850 ===aa===
12851 ====aaa====
12852 ==b==
12853 ===ba===
12854 ===bb===
12855 ====bba====
12856 ===bc===
12857 ==c==
12858 ===ca===
12859 !! result
12860 start
12861 ==a==
12862 ===aa===
12863 ====aaa====
12864 ==b==
12865 ===ba===
12866 ===bb===
12867 ====bba====
12868 xxx
12869
12870 ==c==
12871 ===ca===
12872 !!end
12873
12874 !! test
12875 Section replacement test (section 9)
12876 !! options
12877 replace=9,"xxx"
12878 !! input
12879 start
12880 ==a==
12881 ===aa===
12882 ====aaa====
12883 ==b==
12884 ===ba===
12885 ===bb===
12886 ====bba====
12887 ===bc===
12888 ==c==
12889 ===ca===
12890 !! result
12891 start
12892 ==a==
12893 ===aa===
12894 ====aaa====
12895 ==b==
12896 ===ba===
12897 ===bb===
12898 ====bba====
12899 ===bc===
12900 xxx
12901 !! end
12902
12903 !! test
12904 Section replacement test (section 10)
12905 !! options
12906 replace=10,"xxx"
12907 !! input
12908 start
12909 ==a==
12910 ===aa===
12911 ====aaa====
12912 ==b==
12913 ===ba===
12914 ===bb===
12915 ====bba====
12916 ===bc===
12917 ==c==
12918 ===ca===
12919 !! result
12920 start
12921 ==a==
12922 ===aa===
12923 ====aaa====
12924 ==b==
12925 ===ba===
12926 ===bb===
12927 ====bba====
12928 ===bc===
12929 ==c==
12930 xxx
12931 !! end
12932
12933 !! test
12934 Section replacement test with initial whitespace (bug 13728)
12935 !! options
12936 replace=2,"xxx"
12937 !! input
12938 Preformatted initial line
12939 ==a==
12940 ===a===
12941 !! result
12942 Preformatted initial line
12943 ==a==
12944 xxx
12945 !! end
12946
12947
12948 !! test
12949 Section extraction, heading followed by pre with 20 spaces (bug 6398)
12950 !! options
12951 section=1
12952 !! input
12953 ==a==
12954 a
12955 !! result
12956 ==a==
12957 a
12958 !! end
12959
12960 !! test
12961 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
12962 !! options
12963 section=1
12964 !! input
12965 ==a==
12966 a
12967 !! result
12968 ==a==
12969 a
12970 !! end
12971
12972
12973 !! test
12974 Section extraction, <pre> around bogus header (bug 10309)
12975 !! options
12976 noxml section=2
12977 !! input
12978 == Section One ==
12979 <pre>
12980 =======
12981 </pre>
12982
12983 == Section Two ==
12984 stuff
12985 !! result
12986 == Section Two ==
12987 stuff
12988 !! end
12989
12990 !! test
12991 Section replacement, <pre> around bogus header (bug 10309)
12992 !! options
12993 noxml replace=2,"xxx"
12994 !! input
12995 == Section One ==
12996 <pre>
12997 =======
12998 </pre>
12999
13000 == Section Two ==
13001 stuff
13002 !! result
13003 == Section One ==
13004 <pre>
13005 =======
13006 </pre>
13007
13008 xxx
13009 !! end
13010
13011
13012
13013 !! test
13014 Handling of &#x0A; in URLs
13015 !! input
13016 **irc://&#x0A;a
13017 !! result
13018 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13019 </li></ul>
13020 </li></ul>
13021
13022 !!end
13023
13024 !! test
13025 5 quotes, code coverage +1 line (php)
13026 !! options
13027 php
13028 !! input
13029 '''''
13030 !! result
13031 !! end
13032 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13033 !! test
13034 5 quotes, code coverage +1 line (parsoid)
13035 !! options
13036 parsoid
13037 !! input
13038 '''''
13039 !! result
13040 <p><b><i></i></b></p>
13041 !! end
13042
13043 !! test
13044 Special:Search page linking.
13045 !! input
13046 {{Special:search}}
13047 !! result
13048 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13049 </p>
13050 !! end
13051
13052 !! test
13053 Say the magic word
13054 !! options
13055 title=[[Parser test]]
13056 !! input
13057 * {{PAGENAME}}
13058 * {{PAGENAMEE}}
13059 * {{FULLPAGENAME}}
13060 * {{FULLPAGENAMEE}}
13061 * {{BASEPAGENAME}}
13062 * {{BASEPAGENAMEE}}
13063 * {{SUBPAGENAME}}
13064 * {{SUBPAGENAMEE}}
13065 * {{ROOTPAGENAME}}
13066 * {{ROOTPAGENAMEE}}
13067 * {{TALKPAGENAME}}
13068 * {{TALKPAGENAMEE}}
13069 * {{SUBJECTPAGENAME}}
13070 * {{SUBJECTPAGENAMEE}}
13071 * {{NAMESPACEE}}
13072 * {{NAMESPACE}}
13073 * {{NAMESPACENUMBER}}
13074 * {{TALKSPACE}}
13075 * {{TALKSPACEE}}
13076 * {{SUBJECTSPACE}}
13077 * {{SUBJECTSPACEE}}
13078 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13079 !! result
13080 <ul><li> Parser test
13081 </li><li> Parser_test
13082 </li><li> Parser test
13083 </li><li> Parser_test
13084 </li><li> Parser test
13085 </li><li> Parser_test
13086 </li><li> Parser test
13087 </li><li> Parser_test
13088 </li><li> Parser test
13089 </li><li> Parser_test
13090 </li><li> Talk:Parser test
13091 </li><li> Talk:Parser_test
13092 </li><li> Parser test
13093 </li><li> Parser_test
13094 </li><li>
13095 </li><li>
13096 </li><li> 0
13097 </li><li> Talk
13098 </li><li> Talk
13099 </li><li>
13100 </li><li>
13101 </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>
13102 </li></ul>
13103
13104 !! end
13105 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13106
13107 !! test
13108 Gallery
13109 !! input
13110 <gallery>
13111 image1.png |
13112 image2.gif|||||
13113
13114 image3|
13115 image4 |300px| centre
13116 image5.svg| http://///////
13117 [[x|xx]]]]
13118 * image6
13119 </gallery>
13120 !! result
13121 <ul class="gallery mw-gallery-traditional">
13122 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13123 <div class="thumb" style="height: 150px;">Image1.png</div>
13124 <div class="gallerytext">
13125 </div>
13126 </div></li>
13127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13128 <div class="thumb" style="height: 150px;">Image2.gif</div>
13129 <div class="gallerytext">
13130 <p>||||
13131 </p>
13132 </div>
13133 </div></li>
13134 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13135 <div class="thumb" style="height: 150px;">Image3</div>
13136 <div class="gallerytext">
13137 </div>
13138 </div></li>
13139 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13140 <div class="thumb" style="height: 150px;">Image4</div>
13141 <div class="gallerytext">
13142 <p>300px| centre
13143 </p>
13144 </div>
13145 </div></li>
13146 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13147 <div class="thumb" style="height: 150px;">Image5.svg</div>
13148 <div class="gallerytext">
13149 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13150 </p>
13151 </div>
13152 </div></li>
13153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13154 <div class="thumb" style="height: 150px;">* image6</div>
13155 <div class="gallerytext">
13156 </div>
13157 </div></li>
13158 </ul>
13159
13160 !! end
13161
13162 !! test
13163 Gallery (with options)
13164 !! input
13165 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13166 File:Nonexistant.jpg|caption
13167 File:Nonexistant.jpg
13168 image:foobar.jpg|some '''caption''' [[Main Page]]
13169 image:foobar.jpg
13170 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13171 </gallery>
13172 !! result
13173 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13174 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13175 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13176 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13177 <div class="gallerytext">
13178 <p>caption
13179 </p>
13180 </div>
13181 </div></li>
13182 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13183 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13184 <div class="gallerytext">
13185 </div>
13186 </div></li>
13187 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13188 <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>
13189 <div class="gallerytext">
13190 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13191 </p>
13192 </div>
13193 </div></li>
13194 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13195 <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>
13196 <div class="gallerytext">
13197 </div>
13198 </div></li>
13199 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13200 <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>
13201 <div class="gallerytext">
13202 <p>Blabla|blabla.
13203 </p>
13204 </div>
13205 </div></li>
13206 </ul>
13207
13208 !! end
13209
13210 !! test
13211 Gallery with wikitext inside caption
13212 !! input
13213 <gallery>
13214 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13215 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13216 </gallery>
13217 !! result
13218 <ul class="gallery mw-gallery-traditional">
13219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13220 <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>
13221 <div class="gallerytext">
13222 <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>
13223 </p>
13224 </div>
13225 </div></li>
13226 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13227 <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>
13228 <div class="gallerytext">
13229 <p>This is a test template
13230 </p>
13231 </div>
13232 </div></li>
13233 </ul>
13234
13235 !! end
13236
13237 !! test
13238 gallery (with showfilename option)
13239 !! input
13240 <gallery showfilename>
13241 File:Nonexistant.jpg|caption
13242 File:Nonexistant.jpg
13243 image:foobar.jpg|some '''caption''' [[Main Page]]
13244 File:Foobar.jpg
13245 </gallery>
13246 !! result
13247 <ul class="gallery mw-gallery-traditional">
13248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13249 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13250 <div class="gallerytext">
13251 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13252 caption
13253 </p>
13254 </div>
13255 </div></li>
13256 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13257 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13258 <div class="gallerytext">
13259 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13260 </p>
13261 </div>
13262 </div></li>
13263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13264 <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>
13265 <div class="gallerytext">
13266 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13267 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13268 </p>
13269 </div>
13270 </div></li>
13271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13272 <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>
13273 <div class="gallerytext">
13274 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13275 </p>
13276 </div>
13277 </div></li>
13278 </ul>
13279
13280 !! end
13281
13282 !! test
13283 Gallery (with namespace-less filenames)
13284 !! input
13285 <gallery>
13286 File:Nonexistant.jpg
13287 Nonexistant.jpg
13288 image:foobar.jpg
13289 foobar.jpg
13290 </gallery>
13291 !! result
13292 <ul class="gallery mw-gallery-traditional">
13293 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13294 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13295 <div class="gallerytext">
13296 </div>
13297 </div></li>
13298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13299 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13300 <div class="gallerytext">
13301 </div>
13302 </div></li>
13303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13304 <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>
13305 <div class="gallerytext">
13306 </div>
13307 </div></li>
13308 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13309 <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>
13310 <div class="gallerytext">
13311 </div>
13312 </div></li>
13313 </ul>
13314
13315 !! end
13316
13317 !! test
13318 HTML Hex character encoding (spells the word "JavaScript")
13319 !! input
13320 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13321 !! result
13322 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13323 </p>
13324 !! end
13325
13326 !! test
13327 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13328 !! input
13329 &#xsee;&#XSEE;
13330 !! result
13331 <p>&amp;#xsee;&amp;#XSEE;
13332 </p>
13333 !! end
13334
13335 !! test
13336 HTML Hex character encoding mixed case
13337 !! input
13338 &#xEE;&#Xee;
13339 !! result
13340 <p>&#xee;&#xee;
13341 </p>
13342 !! end
13343
13344 !! test
13345 __FORCETOC__ override
13346 !! input
13347 __NEWSECTIONLINK__
13348 __FORCETOC__
13349 !! result
13350 <p><br />
13351 </p>
13352 !! end
13353
13354 !! test
13355 ISBN code coverage
13356 !! input
13357 ISBN 978-0-1234-56&#x20;789
13358 !! result
13359 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13360 </p>
13361 !! end
13362
13363 !! test
13364 ISBN followed by 5 spaces
13365 !! input
13366 ISBN
13367 !! result
13368 <p>ISBN
13369 </p>
13370 !! end
13371
13372 !! test
13373 Double ISBN
13374 !! input
13375 ISBN ISBN 1234567890
13376 !! result
13377 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13378 </p>
13379 !! end
13380
13381 !! test
13382 Bug 22905: <abbr> followed by ISBN followed by </a>
13383 !! input
13384 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13385 !! result
13386 <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>
13387 </p>
13388 !! end
13389
13390 !! test
13391 Double RFC
13392 !! input
13393 RFC RFC 1234
13394 !! result
13395 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13396 </p>
13397 !! end
13398
13399 !! test
13400 Double RFC with a wiki link
13401 !! input
13402 RFC [[RFC 1234]]
13403 !! result
13404 <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>
13405 </p>
13406 !! end
13407
13408 !! test
13409 RFC code coverage
13410 !! input
13411 RFC 983&#x20;987
13412 !! result
13413 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13414 </p>
13415 !! end
13416
13417 !! test
13418 Centre-aligned image
13419 !! input
13420 [[Image:foobar.jpg|centre]]
13421 !! result
13422 <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>
13423
13424 !!end
13425
13426 !! test
13427 None-aligned image
13428 !! input
13429 [[Image:foobar.jpg|none]]
13430 !! result
13431 <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>
13432
13433 !!end
13434
13435 !! test
13436 Width + Height sized image (using px) (height is ignored)
13437 !! input
13438 [[Image:foobar.jpg|640x480px]]
13439 !! result
13440 <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>
13441 </p>
13442 !!end
13443
13444 !! test
13445 Width-sized image (using px, no following whitespace)
13446 !! input
13447 [[Image:foobar.jpg|640px]]
13448 !! result
13449 <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>
13450 </p>
13451 !!end
13452
13453 !! test
13454 Width-sized image (using px, with following whitespace - test regression from r39467)
13455 !! input
13456 [[Image:foobar.jpg|640px ]]
13457 !! result
13458 <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>
13459 </p>
13460 !!end
13461
13462 !! test
13463 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13464 !! input
13465 [[Image:foobar.jpg| 640px]]
13466 !! result
13467 <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>
13468 </p>
13469 !!end
13470
13471 !! test
13472 Another italics / bold test
13473 !! input
13474 ''' ''x'
13475 !! result
13476 <pre>'<i> </i>x'
13477 </pre>
13478 !!end
13479
13480 # Note the results may be incorrect, as parserTest output included this:
13481 # XML error: Mismatched tag at byte 6120:
13482 # ...<dd> </dt></dl> </dd...
13483 !! test
13484 dt/dd/dl test
13485 !! options
13486 disabled
13487 !! input
13488 :;;;::
13489 !! result
13490 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
13491 </dd></dl>
13492 </dd></dl>
13493 </dt></dl>
13494 </dt></dl>
13495 </dt></dl>
13496 </dd></dl>
13497
13498 !!end
13499
13500
13501 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13502 !! test
13503 Images with the "|" character in the comment
13504 !! input
13505 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
13506 !! result
13507 <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>
13508
13509 !!end
13510
13511 !! test
13512 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
13513 !! input
13514 <html><script>alert(1);</script></html>
13515 !! result
13516 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
13517 </p>
13518 !! end
13519
13520 !! test
13521 HTML with raw HTML ($wgRawHtml==true)
13522 !! options
13523 wgRawHtml=1
13524 !! input
13525 <html><script>alert(1);</script></html>
13526 !! result
13527 <p><script>alert(1);</script>
13528 </p>
13529 !! end
13530
13531 !! test
13532 Parents of subpages, one level up
13533 !! options
13534 subpage title=[[Subpage test/L1/L2/L3]]
13535 !! input
13536 [[../|L2]]
13537 !! result
13538 <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>
13539 </p>
13540 !! end
13541
13542
13543 !! test
13544 Parents of subpages, one level up, not named
13545 !! options
13546 subpage title=[[Subpage test/L1/L2/L3]]
13547 !! input
13548 [[../]]
13549 !! result
13550 <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>
13551 </p>
13552 !! end
13553
13554
13555
13556 !! test
13557 Parents of subpages, two levels up
13558 !! options
13559 subpage title=[[Subpage test/L1/L2/L3]]
13560 !! input
13561 [[../../|L1]]2
13562
13563 [[../../|L1]]l
13564 !! result
13565 <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
13566 </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>
13567 </p>
13568 !! end
13569
13570 !! test
13571 Parents of subpages, two levels up, without trailing slash or name.
13572 !! options
13573 subpage title=[[Subpage test/L1/L2/L3]]
13574 !! input
13575 [[../..]]
13576 !! result
13577 <p>[[../..]]
13578 </p>
13579 !! end
13580
13581 !! test
13582 Parents of subpages, two levels up, with lots of extra trailing slashes.
13583 !! options
13584 subpage title=[[Subpage test/L1/L2/L3]]
13585 !! input
13586 [[../../////]]
13587 !! result
13588 <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>
13589 </p>
13590 !! end
13591
13592 !! article
13593 Subpage test/L1/L2/L3Sibling
13594 !! text
13595 Sibling article
13596 !! endarticle
13597
13598 !! test
13599 Transclusion of a sibling page (one level up)
13600 !! options
13601 subpage title=[[Subpage test/L1/L2/L3]]
13602 !! input
13603 {{../L3Sibling}}
13604 !! result
13605 <p>Sibling article
13606 </p>
13607 !! end
13608
13609 !! test
13610 Transclusion of a child page
13611 !! options
13612 subpage title=[[Subpage test/L1/L2]]
13613 !! input
13614 {{/L3Sibling}}
13615 !! result
13616 <p>Sibling article
13617 </p>
13618 !! end
13619
13620 !! test
13621 Non-transclusion because of too many up levels
13622 !! options
13623 subpage title=[[Subpage test/L1/L2/L3]]
13624 !! input
13625 {{../../../../More than parent}}
13626 !! result
13627 <p>{{../../../../More than parent}}
13628 </p>
13629 !! end
13630
13631 !! test
13632 Definition list code coverage
13633 !! input
13634 ; title : def
13635 ; title : def
13636 ;title: def
13637 !! result
13638 <dl><dt> title &#160;</dt><dd> def
13639 </dd><dt> title&#160;</dt><dd> def
13640 </dd><dt>title</dt><dd> def
13641 </dd></dl>
13642
13643 !! end
13644
13645 !! test
13646 Don't fall for the self-closing div
13647 !! input
13648 <div>hello world</div/>
13649 !! result
13650 <div>hello world</div>
13651
13652 !! end
13653
13654 !! test
13655 MSGNW magic word
13656 !! input
13657 {{MSGNW:msg}}
13658 !! result
13659 <p>&#91;&#91;:Template:Msg&#93;&#93;
13660 </p>
13661 !! end
13662
13663 !! test
13664 RAW magic word
13665 !! input
13666 {{RAW:QUERTY}}
13667 !! result
13668 <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>
13669 </p>
13670 !! end
13671
13672 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
13673 !! test
13674 Always escape literal '>' in output, not just after '<'
13675 !! input
13676 ><>
13677 !! result
13678 <p>&gt;&lt;&gt;
13679 </p>
13680 !! end
13681
13682 !! test
13683 Template caching
13684 !! input
13685 {{Test}}
13686 {{Test}}
13687 !! result
13688 <p>This is a test template
13689 This is a test template
13690 </p>
13691 !! end
13692
13693
13694 !! article
13695 MediaWiki:Fake
13696 !! text
13697 ==header==
13698 !! endarticle
13699
13700 !! test
13701 Inclusion of !userCanEdit() content
13702 !! input
13703 {{MediaWiki:Fake}}
13704 !! result
13705 <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>
13706
13707 !! end
13708
13709
13710 !! test
13711 Out-of-order TOC heading levels
13712 !! input
13713 ==2==
13714 ======6======
13715 ===3===
13716 =1=
13717 =====5=====
13718 ==2==
13719 !! result
13720 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13721 <ul>
13722 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
13723 <ul>
13724 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
13725 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
13726 </ul>
13727 </li>
13728 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
13729 <ul>
13730 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
13731 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
13732 </ul>
13733 </li>
13734 </ul>
13735 </div>
13736 <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>
13737 <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>
13738 <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>
13739 <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>
13740 <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>
13741 <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>
13742
13743 !! end
13744
13745
13746 !! test
13747 ISBN with a dummy number
13748 !! input
13749 ISBN ---
13750 !! result
13751 <p>ISBN ---
13752 </p>
13753 !! end
13754
13755
13756 !! test
13757 ISBN with space-delimited number
13758 !! input
13759 ISBN 92 9017 032 8
13760 !! result
13761 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
13762 </p>
13763 !! end
13764
13765
13766 !! test
13767 ISBN with multiple spaces, no number
13768 !! input
13769 ISBN foo
13770 !! result
13771 <p>ISBN foo
13772 </p>
13773 !! end
13774
13775
13776 !! test
13777 ISBN length
13778 !! input
13779 ISBN 123456789
13780
13781 ISBN 1234567890
13782
13783 ISBN 12345678901
13784 !! result
13785 <p>ISBN 123456789
13786 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13787 </p><p>ISBN 12345678901
13788 </p>
13789 !! end
13790
13791
13792 !! test
13793 ISBN with trailing year (bug 8110)
13794 !! input
13795 ISBN 1-234-56789-0 - 2006
13796
13797 ISBN 1 234 56789 0 - 2006
13798 !! result
13799 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
13800 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
13801 </p>
13802 !! end
13803
13804
13805 !! test
13806 anchorencode
13807 !! input
13808 {{anchorencode:foo bar©#%n}}
13809 !! result
13810 <p>foo_bar.C2.A9.23.25n
13811 </p>
13812 !! end
13813
13814 !! test
13815 anchorencode trims spaces
13816 !! input
13817 {{anchorencode: __pretty__please__}}
13818 !! result
13819 <p>pretty_please
13820 </p>
13821 !! end
13822
13823 !! test
13824 anchorencode deals with links
13825 !! input
13826 {{anchorencode: [[hello|world]] [[hi]]}}
13827 !! result
13828 <p>world_hi
13829 </p>
13830 !! end
13831
13832 !! test
13833 anchorencode deals with templates
13834 !! input
13835 {{anchorencode: {{Foo}} }}
13836 !! result
13837 <p>FOO
13838 </p>
13839 !! end
13840
13841 !! test
13842 anchorencode encodes like the TOC generator: (bug 18431)
13843 !! input
13844 === _ +:.3A%3A&&amp;]] ===
13845 {{anchorencode: _ +:.3A%3A&&amp;]] }}
13846 __NOEDITSECTION__
13847 !! result
13848 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
13849 <p>.2B:.3A.253A.26.26.5D.5D
13850 </p>
13851 !! end
13852
13853 !! test
13854 Bug 6200: blockquotes and paragraph formatting
13855 !! input
13856 <blockquote>
13857 foo
13858 </blockquote>
13859
13860 bar
13861
13862 baz
13863 !! result
13864 <blockquote>
13865 <p>foo
13866 </p>
13867 </blockquote>
13868 <p>bar
13869 </p>
13870 <pre>baz
13871 </pre>
13872 !! end
13873
13874 !! test
13875 Bug 8293: Use of center tag ruins paragraph formatting
13876 !! input
13877 <center>
13878 foo
13879 </center>
13880
13881 bar
13882
13883 baz
13884 !! result
13885 <center>
13886 <p>foo
13887 </p>
13888 </center>
13889 <p>bar
13890 </p>
13891 <pre>baz
13892 </pre>
13893 !! end
13894
13895 !!test
13896 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
13897 !!options
13898 php
13899 !!input
13900 <span><s>x</span></s>
13901 !!result
13902 <p><span><s>x&lt;/span&gt;</s></span>
13903 </p>
13904 !!end
13905
13906 !!test
13907 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
13908 !!options
13909 parsoid
13910 !!input
13911 <span><s>x</span></s>
13912 !!result
13913 <p><span><s>x</s></span><s></s>
13914 </p>
13915 !!end
13916
13917 ###
13918 ### Language variants related tests
13919 ###
13920 !! test
13921 Self-link in language variants
13922 !! options
13923 title=[[Dunav]] language=sr
13924 !! input
13925 Both [[Dunav]] and [[Дунав]] are names for this river.
13926 !! result
13927 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
13928 </p>
13929 !!end
13930
13931 !! article
13932 Дуна
13933 !! text
13934 content
13935 !! endarticle
13936
13937 !! test
13938 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
13939 !! options
13940 title=[[Duna]] language=sr
13941 !! input
13942 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
13943 !! result
13944 <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.
13945 </p>
13946 !! end
13947
13948 !! test
13949 Link to pages in language variants
13950 !! options
13951 language=sr
13952 !! input
13953 Main Page can be written as [[Маин Паге]]
13954 !! result
13955 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
13956 </p>
13957 !!end
13958
13959
13960 !! test
13961 Multiple links to pages in language variants
13962 !! options
13963 language=sr
13964 !! input
13965 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
13966 !! result
13967 <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>.
13968 </p>
13969 !!end
13970
13971
13972 !! test
13973 Simple template in language variants
13974 !! options
13975 language=sr
13976 !! input
13977 {{тест}}
13978 !! result
13979 <p>This is a test template
13980 </p>
13981 !! end
13982
13983
13984 !! test
13985 Template with explicit namespace in language variants
13986 !! options
13987 language=sr
13988 !! input
13989 {{Template:тест}}
13990 !! result
13991 <p>This is a test template
13992 </p>
13993 !! end
13994
13995
13996 !! test
13997 Basic test for template parameter in language variants
13998 !! options
13999 language=sr
14000 !! input
14001 {{парамтест|param=foo}}
14002 !! result
14003 <p>This is a test template with parameter foo
14004 </p>
14005 !! end
14006
14007
14008 !! test
14009 Simple category in language variants
14010 !! options
14011 language=sr cat
14012 !! input
14013 [[Category:МедиаWики Усер'с Гуиде]]
14014 !! result
14015 <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>
14016 !! end
14017
14018
14019 !! article
14020 Category:分类
14021 !! text
14022 blah
14023 !! endarticle
14024
14025 !! article
14026 Category:分類
14027 !! text
14028 blah
14029 !! endarticle
14030
14031 !! test
14032 Don't convert blue categorylinks to another variant (bug 33210)
14033 !! options
14034 language=zh cat
14035 !! input
14036 [[A]][[Category:分类]]
14037 !! result
14038 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14039 !! end
14040
14041
14042 !! test
14043 Stripping -{}- tags (language variants)
14044 !! options
14045 language=sr
14046 !! input
14047 Latin proverb: -{Ne nuntium necare}-
14048 !! result
14049 <p>Latin proverb: Ne nuntium necare
14050 </p>
14051 !! end
14052
14053
14054 !! test
14055 Prevent conversion with -{}- tags (language variants)
14056 !! options
14057 language=sr variant=sr-ec
14058 !! input
14059 Latinski: -{Ne nuntium necare}-
14060 !! result
14061 <p>Латински: Ne nuntium necare
14062 </p>
14063 !! end
14064
14065
14066 !! test
14067 Prevent conversion of text with -{}- tags (language variants)
14068 !! options
14069 language=sr variant=sr-ec
14070 !! input
14071 Latinski: -{Ne nuntium necare}-
14072 !! result
14073 <p>Латински: Ne nuntium necare
14074 </p>
14075 !! end
14076
14077
14078 !! test
14079 Prevent conversion of links with -{}- tags (language variants)
14080 !! options
14081 language=sr variant=sr-ec
14082 !! input
14083 -{[[Main Page]]}-
14084 !! result
14085 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14086 </p>
14087 !! end
14088
14089
14090 !! test
14091 -{}- tags within headlines (within html for parserConvert())
14092 !! options
14093 language=sr variant=sr-ec
14094 !! input
14095 == -{Naslov}- ==
14096 !! result
14097 <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>
14098
14099 !! end
14100
14101
14102 !! test
14103 Explicit definition of language variant alternatives
14104 !! options
14105 language=zh variant=zh-tw
14106 !! input
14107 -{zh:China;zh-tw:Taiwan}-, not China
14108 !! result
14109 <p>Taiwan, not China
14110 </p>
14111 !! end
14112
14113
14114 !! test
14115 Conversion around HTML tags
14116 !! options
14117 language=sr variant=sr-ec
14118 !! input
14119 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14120 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14121 !! result
14122 <p>
14123 <span title="ЛаCтин">ски</span>
14124 </p>
14125 !! end
14126
14127
14128 !! test
14129 Explicit session-wise language variant mapping (A flag and - flag)
14130 !! options
14131 language=zh variant=zh-tw
14132 !! input
14133 Taiwan is not China.
14134 But -{A|zh:China;zh-tw:Taiwan}- is China,
14135 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14136 and -{China}- is China.
14137 !! result
14138 <p>Taiwan is not China.
14139 But Taiwan is Taiwan,
14140 (This should be stripped!)
14141 and China is China.
14142 </p>
14143 !! end
14144
14145 !! test
14146 Explicit session-wise language variant mapping (H flag for hide)
14147 !! options
14148 language=zh variant=zh-tw
14149 !! input
14150 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14151 Taiwan is China.
14152 !! result
14153 <p>(This should be stripped!)
14154 Taiwan is Taiwan.
14155 </p>
14156 !! end
14157
14158 !! test
14159 Adding explicit conversion rule for title (T flag)
14160 !! options
14161 language=zh variant=zh-tw showtitle
14162 !! input
14163 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14164 !! result
14165 Taiwan
14166 <p>Should be stripped!
14167 </p>
14168 !! end
14169
14170 !! test
14171 Testing that changing the language variant here in the tests actually works
14172 !! options
14173 language=zh variant=zh showtitle
14174 !! input
14175 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14176 !! result
14177 China
14178 <p>Should be stripped!
14179 </p>
14180 !! end
14181
14182 !! test
14183 Recursive conversion of alt and title attrs shouldn't clear converter state
14184 !! options
14185 language=zh variant=zh-cn showtitle
14186 !! input
14187 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14188 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14189 !! result
14190 China
14191 <p>
14192 Should be stripped<span title="Exclamation">!</span>
14193 </p>
14194 !! end
14195
14196 !! test
14197 Bug 24072: more test on conversion rule for title
14198 !! options
14199 language=zh variant=zh-tw showtitle
14200 !! input
14201 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14202 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14203 !! result
14204 Taiwan
14205 <p>This should be stripped!
14206 This won't take interferes with the title rule.
14207 </p>
14208 !! end
14209
14210 !! test
14211 Partly disable title conversion if variant == main language code
14212 !! options
14213 language=zh variant=zh title=[[ZH]] showtitle
14214 !! input
14215 -{T|zh-cn:CN;zh-tw:TW}-
14216 !! result
14217 ZH
14218 <p>
14219 </p>
14220 !! end
14221
14222 !! test
14223 Partly disable title conversion if variant == main language code, more
14224 !! options
14225 language=zh variant=zh title=[[ZH]] showtitle
14226 !! input
14227 -{T|TW}-
14228 !! result
14229 ZH
14230 <p>
14231 </p>
14232 !! end
14233
14234 !! test
14235 Raw output of variant escape tags (R flag)
14236 !! options
14237 language=zh variant=zh-tw
14238 !! input
14239 Raw: -{R|zh:China;zh-tw:Taiwan}-
14240 !! result
14241 <p>Raw: zh:China;zh-tw:Taiwan
14242 </p>
14243 !! end
14244
14245 !! test
14246 Nested using of manual convert syntax
14247 !! options
14248 language=zh variant=zh-hk
14249 !! input
14250 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14251 !! result
14252 <p>Nested: Hello Hong Kong!
14253 </p>
14254 !! end
14255
14256 !! test
14257 Proper conversion of text in external links
14258 !! options
14259 language=sr variant=sr-ec
14260 !! input
14261 http://www.google.com
14262 gopher://www.google.com
14263 [http://www.google.com http://www.google.com]
14264 [gopher://www.google.com gopher://www.google.com]
14265 [https://www.google.com irc://www.google.com]
14266 [ftp://www.google.com www.google.com/ftp://dir]
14267 [//www.google.com www.google.com]
14268 !! result
14269 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14270 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14271 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14272 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14273 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14274 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14275 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14276 </p>
14277 !! end
14278
14279 !! test
14280 Do not convert roman numbers to language variants
14281 !! options
14282 language=sr variant=sr-ec
14283 !! input
14284 Fridrih IV je car.
14285 !! result
14286 <p>Фридрих IV је цар.
14287 </p>
14288 !! end
14289
14290 !! test
14291 Unclosed language converter markup "-{"
14292 !! options
14293 language=sr
14294 !! input
14295 -{T|hello
14296 !! result
14297 <p>-{T|hello
14298 </p>
14299 !! end
14300
14301 !! test
14302 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14303 !! options
14304 language=sr
14305 !! input
14306 -{R|=&gt;}-
14307 !! result
14308 <p>=&gt;
14309 </p>
14310 !!end
14311
14312 !! test
14313 Bug 529: Uncovered bullet
14314 !! input
14315 * Foo {{bullet}}
14316 !! result
14317 <ul><li> Foo
14318 </li><li> Bar
14319 </li></ul>
14320
14321 !! end
14322
14323 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14324 # Templates in Wikipedia rely on this behavior, as tidy has always been
14325 # enabled there. These tests are normally run *without* tidy, so specify the
14326 # full output here.
14327 # To test realistic parsing behavior, apply a tidy-like transformation to both
14328 # the expected output and your parser's output.
14329 !! test
14330 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14331 !! input
14332 ******* Foo {{bullet}}
14333 !! result
14334 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
14335 </li></ul>
14336 </li></ul>
14337 </li></ul>
14338 </li></ul>
14339 </li></ul>
14340 </li></ul>
14341 </li><li> Bar
14342 </li></ul>
14343
14344 !! end
14345
14346 !! test
14347 Bug 529: Uncovered table already at line-start
14348 !! input
14349 x
14350
14351 {{table}}
14352 y
14353 !! result
14354 <p>x
14355 </p>
14356 <table>
14357 <tr>
14358 <td> 1 </td>
14359 <td> 2
14360 </td></tr>
14361 <tr>
14362 <td> 3 </td>
14363 <td> 4
14364 </td></tr></table>
14365 <p>y
14366 </p>
14367 !! end
14368
14369 !! test
14370 Bug 529: Uncovered bullet in parser function result
14371 !! input
14372 * Foo {{lc:{{bullet}} }}
14373 !! result
14374 <ul><li> Foo
14375 </li><li> bar
14376 </li></ul>
14377
14378 !! end
14379
14380 !! test
14381 Bug 5678: Double-parsed template argument
14382 !! input
14383 {{lc:{{{1}}}|hello}}
14384 !! result
14385 <p>{{{1}}}
14386 </p>
14387 !! end
14388
14389 !! test
14390 Bug 5678: Double-parsed template invocation
14391 !! input
14392 {{lc:{{paramtest {{!}} param = hello }} }}
14393 !! result
14394 <p>{{paramtest | param = hello }}
14395 </p>
14396 !! end
14397
14398 !! test
14399 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14400 !! options
14401 language=cs
14402 title=[[Main Page]]
14403 !! input
14404 {{PRVNÍVELKÉ:ěščř}}
14405 {{prvnívelké:ěščř}}
14406 {{PRVNÍMALÉ:ěščř}}
14407 {{prvnímalé:ěščř}}
14408 {{MALÁ:ěščř}}
14409 {{malá:ěščř}}
14410 {{VELKÁ:ěščř}}
14411 {{velká:ěščř}}
14412 !! result
14413 <p>Ěščř
14414 Ěščř
14415 ěščř
14416 ěščř
14417 ěščř
14418 ěščř
14419 ĚŠČŘ
14420 ĚŠČŘ
14421 </p>
14422 !! end
14423
14424 !! test
14425 Morwen/13: Unclosed link followed by heading
14426 !! input
14427 [[link
14428 ==heading==
14429 !! result
14430 <p>[[link
14431 </p>
14432 <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>
14433
14434 !! end
14435
14436 !! test
14437 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14438 !! input
14439 {{foo|
14440 =heading=
14441 !! result
14442 <p>{{foo|
14443 </p>
14444 <h1><span class="mw-headline" id="heading">heading</span></h1>
14445
14446 !! end
14447
14448 !! test
14449 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14450 !! input
14451 {{foo|
14452 ==heading==
14453 !! result
14454 <p>{{foo|
14455 </p>
14456 <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>
14457
14458 !! end
14459
14460 !! test
14461 Tildes in comments
14462 !! options
14463 pst
14464 !! input
14465 <!-- ~~~~ -->
14466 !! result
14467 <!-- ~~~~ -->
14468 !! end
14469
14470 !! test
14471 Paragraphs inside divs (no extra line breaks)
14472 !! input
14473 <div>Line one
14474
14475 Line two</div>
14476 !! result
14477 <div>Line one
14478 Line two</div>
14479
14480 !! end
14481
14482 !! test
14483 Paragraphs inside divs (extra line break on open)
14484 !! input
14485 <div>
14486 Line one
14487
14488 Line two</div>
14489 !! result
14490 <div>
14491 <p>Line one
14492 </p>
14493 Line two</div>
14494
14495 !! end
14496
14497 !! test
14498 Paragraphs inside divs (extra line break on close)
14499 !! input
14500 <div>Line one
14501
14502 Line two
14503 </div>
14504 !! result
14505 <div>Line one
14506 <p>Line two
14507 </p>
14508 </div>
14509
14510 !! end
14511
14512 !! test
14513 Paragraphs inside divs (extra line break on open and close)
14514 !! input
14515 <div>
14516 Line one
14517
14518 Line two
14519 </div>
14520 !! result
14521 <div>
14522 <p>Line one
14523 </p><p>Line two
14524 </p>
14525 </div>
14526
14527 !! end
14528
14529 !! test
14530 Nesting tags, paragraphs on lines which begin with <div>
14531 !! options
14532 disabled
14533 !! input
14534 <div></div><strong>A
14535 B</strong>
14536 !! result
14537 <div></div>
14538 <p><strong>A
14539 B</strong>
14540 </p>
14541 !! end
14542
14543 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
14544 !! test
14545 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
14546 !! input
14547 <blockquote>Line one
14548
14549 Line two</blockquote>
14550 !! result
14551 <blockquote>Line one
14552 Line two</blockquote>
14553
14554 !! end
14555
14556 !! test
14557 Bug 6200: paragraphs inside blockquotes (extra line break on open)
14558 !! input
14559 <blockquote>
14560 Line one
14561
14562 Line two</blockquote>
14563 !! result
14564 <blockquote>
14565 <p>Line one
14566 </p>
14567 Line two</blockquote>
14568
14569 !! end
14570
14571 !! test
14572 Bug 6200: paragraphs inside blockquotes (extra line break on close)
14573 !! input
14574 <blockquote>Line one
14575
14576 Line two
14577 </blockquote>
14578 !! result
14579 <blockquote>Line one
14580 <p>Line two
14581 </p>
14582 </blockquote>
14583
14584 !! end
14585
14586 !! test
14587 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
14588 !! input
14589 <blockquote>
14590 Line one
14591
14592 Line two
14593 </blockquote>
14594 !! result
14595 <blockquote>
14596 <p>Line one
14597 </p><p>Line two
14598 </p>
14599 </blockquote>
14600
14601 !! end
14602
14603 !! test
14604 Paragraphs inside blockquotes/divs (no extra line breaks)
14605 !! input
14606 <blockquote><div>Line one
14607
14608 Line two</div></blockquote>
14609 !! result
14610 <blockquote><div>Line one
14611 Line two</div></blockquote>
14612
14613 !! end
14614
14615 !! test
14616 Paragraphs inside blockquotes/divs (extra line break on open)
14617 !! input
14618 <blockquote><div>
14619 Line one
14620
14621 Line two</div></blockquote>
14622 !! result
14623 <blockquote><div>
14624 <p>Line one
14625 </p>
14626 Line two</div></blockquote>
14627
14628 !! end
14629
14630 !! test
14631 Paragraphs inside blockquotes/divs (extra line break on close)
14632 !! input
14633 <blockquote><div>Line one
14634
14635 Line two
14636 </div></blockquote>
14637 !! result
14638 <blockquote><div>Line one
14639 <p>Line two
14640 </p>
14641 </div></blockquote>
14642
14643 !! end
14644
14645 !! test
14646 Paragraphs inside blockquotes/divs (extra line break on open and close)
14647 !! input
14648 <blockquote><div>
14649 Line one
14650
14651 Line two
14652 </div></blockquote>
14653 !! result
14654 <blockquote><div>
14655 <p>Line one
14656 </p><p>Line two
14657 </p>
14658 </div></blockquote>
14659
14660 !! end
14661
14662 !! test
14663 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
14664 !! options
14665 wgLinkHolderBatchSize=0
14666 !! input
14667 [[meatball:1]]
14668 [[meatball:2]]
14669 [[meatball:3]]
14670 !! result
14671 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
14672 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
14673 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
14674 </p>
14675 !! end
14676
14677 !! test
14678 Free external link invading image caption
14679 !! input
14680 [[Image:Foobar.jpg|thumb|http://x|hello]]
14681 !! result
14682 <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>
14683
14684 !! end
14685
14686 !! test
14687 Bug 15196: localised external link numbers
14688 !! options
14689 language=fa
14690 !! input
14691 [http://en.wikipedia.org/]
14692 !! result
14693 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
14694 </p>
14695 !! end
14696
14697 !! test
14698 Multibyte character in padleft
14699 !! input
14700 {{padleft:-Hello|7|Æ}}
14701 !! result
14702 <p>Æ-Hello
14703 </p>
14704 !! end
14705
14706 !! test
14707 Multibyte character in padright
14708 !! input
14709 {{padright:Hello-|7|Æ}}
14710 !! result
14711 <p>Hello-Æ
14712 </p>
14713 !! end
14714
14715 !!test
14716 formatdate parser function
14717 !!input
14718 {{#formatdate:2009-03-24}}
14719 !! result
14720 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
14721 </p>
14722 !! end
14723
14724 !!test
14725 formatdate parser function, with default format
14726 !!input
14727 {{#formatdate:2009-03-24|mdy}}
14728 !! result
14729 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
14730 </p>
14731 !! end
14732
14733 !! test
14734 Spacing of numbers in formatted dates
14735 !! input
14736 {{#formatdate:January 15}}
14737 !! result
14738 <p><span class="mw-formatted-date" title="01-15">January 15</span>
14739 </p>
14740 !! end
14741
14742 !! test
14743 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
14744 !! options
14745 language=nl title=[[MediaWiki:Common.css]]
14746 !! input
14747 {{#formatdate:2009-03-24|dmy}}
14748 !! result
14749 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
14750 </p>
14751 !! end
14752
14753 #
14754 #
14755 #
14756
14757 #
14758 # Edit comments
14759 #
14760
14761 !! test
14762 Edit comment with link
14763 !! options
14764 comment
14765 !! input
14766 I like the [[Main Page]] a lot
14767 !! result
14768 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
14769 !!end
14770
14771 !! test
14772 Edit comment with link and link text
14773 !! options
14774 comment
14775 !! input
14776 I like the [[Main Page|best pages]] a lot
14777 !! result
14778 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14779 !!end
14780
14781 !! test
14782 Edit comment with link and link text with suffix
14783 !! options
14784 comment
14785 !! input
14786 I like the [[Main Page|best page]]s a lot
14787 !! result
14788 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
14789 !!end
14790
14791 !! test
14792 Edit comment with section link (non-local, eg in history list)
14793 !! options
14794 comment title=[[Main Page]]
14795 !! input
14796 /* External links */ removed bogus entries
14797 !! result
14798 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14799 !!end
14800
14801 !! test
14802 Edit comment with section link and text before it (non-local, eg in history list)
14803 !! options
14804 comment title=[[Main Page]]
14805 !! input
14806 pre-comment text /* External links */ removed bogus entries
14807 !! result
14808 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>
14809 !!end
14810
14811 !! test
14812 Edit comment with section link (local, eg in diff view)
14813 !! options
14814 comment local title=[[Main Page]]
14815 !! input
14816 /* External links */ removed bogus entries
14817 !! result
14818 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
14819 !!end
14820
14821 !! test
14822 Edit comment with subpage link (bug 14080)
14823 !! options
14824 comment
14825 subpage
14826 title=[[Subpage test]]
14827 !! input
14828 Poked at a [[/subpage]] here...
14829 !! result
14830 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
14831 !!end
14832
14833 !! test
14834 Edit comment with subpage link and link text (bug 14080)
14835 !! options
14836 comment
14837 subpage
14838 title=[[Subpage test]]
14839 !! input
14840 Poked at a [[/subpage|neat little page]] here...
14841 !! result
14842 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
14843 !!end
14844
14845 !! test
14846 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
14847 !! options
14848 comment
14849 title=[[Subpage test]]
14850 !! input
14851 Poked at a [[/subpage]] here...
14852 !! result
14853 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...
14854 !!end
14855
14856 !! test
14857 Edit comment with bare anchor link (local, as on diff)
14858 !! options
14859 comment
14860 local
14861 title=[[Main Page]]
14862 !!input
14863 [[#section]]
14864 !! result
14865 <a href="#section">#section</a>
14866 !! end
14867
14868 !! test
14869 Edit comment with bare anchor link (non-local, as on history)
14870 !! options
14871 comment
14872 title=[[Main Page]]
14873 !!input
14874 [[#section]]
14875 !! result
14876 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
14877 !! end
14878
14879 !! test
14880 Anchor starting with underscore
14881 !!input
14882 [[#_ref|One]]
14883 !! result
14884 <p><a href="#_ref">One</a>
14885 </p>
14886 !! end
14887
14888 !! test
14889 Id starting with underscore
14890 !!input
14891 <div id="_ref"></div>
14892 !! result
14893 <div id="_ref"></div>
14894
14895 !! end
14896
14897 !! test
14898 Space normalisation on autocomment (bug 22784)
14899 !! options
14900 comment
14901 title=[[Main Page]]
14902 !!input
14903 /* __hello__world__ */
14904 !! result
14905 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
14906 !! end
14907
14908 !! test
14909 percent-encoding and + signs in comments (Bug 26410)
14910 !! options
14911 comment
14912 !!input
14913 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
14914 !! result
14915 <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>
14916 !! end
14917
14918 !! test
14919 Bad images - basic functionality
14920 !! options
14921 disabled
14922 !! input
14923 [[File:Bad.jpg]]
14924 !! result
14925 !! end
14926
14927 !! test
14928 Bad images - bug 16039: text after bad image disappears
14929 !! options
14930 disabled
14931 !! input
14932 Foo bar
14933 [[File:Bad.jpg]]
14934 Bar foo
14935 !! result
14936 <p>Foo bar
14937 </p><p>Bar foo
14938 </p>
14939 !! end
14940
14941 !! test
14942 Verify that displaytitle works (bug #22501) no displaytitle
14943 !! options
14944 showtitle
14945 !! config
14946 wgAllowDisplayTitle=true
14947 wgRestrictDisplayTitle=false
14948 !! input
14949 this is not the the title
14950 !! result
14951 Parser test
14952 <p>this is not the the title
14953 </p>
14954 !! end
14955
14956 !! test
14957 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
14958 !! options
14959 showtitle
14960 title=[[Screen]]
14961 !! config
14962 wgAllowDisplayTitle=true
14963 wgRestrictDisplayTitle=false
14964 !! input
14965 this is not the the title
14966 {{DISPLAYTITLE:whatever}}
14967 !! result
14968 whatever
14969 <p>this is not the the title
14970 </p>
14971 !! end
14972
14973 !! test
14974 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
14975 !! options
14976 showtitle
14977 title=[[Screen]]
14978 !! config
14979 wgAllowDisplayTitle=true
14980 wgRestrictDisplayTitle=true
14981 !! input
14982 this is not the the title
14983 {{DISPLAYTITLE:whatever}}
14984 !! result
14985 Screen
14986 <p>this is not the the title
14987 </p>
14988 !! end
14989
14990 !! test
14991 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14992 !! options
14993 showtitle
14994 title=[[Screen]]
14995 !! config
14996 wgAllowDisplayTitle=true
14997 wgRestrictDisplayTitle=true
14998 !! input
14999 this is not the the title
15000 {{DISPLAYTITLE:screen}}
15001 !! result
15002 screen
15003 <p>this is not the the title
15004 </p>
15005 !! end
15006
15007 !! test
15008 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15009 !! options
15010 showtitle
15011 title=[[Screen]]
15012 !! config
15013 wgAllowDisplayTitle=false
15014 !! input
15015 this is not the the title
15016 {{DISPLAYTITLE:screen}}
15017 !! result
15018 Screen
15019 <p>this is not the the title
15020 <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>
15021 </p>
15022 !! end
15023
15024 !! test
15025 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15026 !! options
15027 showtitle
15028 title=[[Screen]]
15029 !! config
15030 wgAllowDisplayTitle=false
15031 !! input
15032 this is not the the title
15033 !! result
15034 Screen
15035 <p>this is not the the title
15036 </p>
15037 !! end
15038
15039 !! test
15040 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15041 !! options
15042 showtitle
15043 title=[[Screen]]
15044 !! config
15045 wgAllowDisplayTitle=true
15046 wgRestrictDisplayTitle=true
15047 !! input
15048 this is not the the title
15049 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15050 !! result
15051 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15052 <p>this is not the the title
15053 </p>
15054 !! end
15055
15056 !! test
15057 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15058 !! options
15059 showtitle
15060 title=[[Screen]]
15061 !! config
15062 wgAllowDisplayTitle=true
15063 wgRestrictDisplayTitle=true
15064 !! input
15065 this is not the the title
15066 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15067 !! result
15068 <span style="color: red;">s</span>creen
15069 <p>this is not the the title
15070 </p>
15071 !! end
15072
15073 !! test
15074 preload: check <noinclude> and <includeonly>
15075 !! options
15076 preload
15077 !! input
15078 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15079 !! result
15080 Hello kind world.
15081 !! end
15082
15083 !! test
15084 preload: check <onlyinclude>
15085 !! options
15086 preload
15087 !! input
15088 Goodbye <onlyinclude>Hello world</onlyinclude>
15089 !! result
15090 Hello world
15091 !! end
15092
15093 !! test
15094 preload: can pass tags through if we want to
15095 !! options
15096 preload
15097 !! input
15098 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15099 !! result
15100 <includeonly>Hello world</includeonly>
15101 !! end
15102
15103 !! test
15104 preload: check that it doesn't try to do tricks
15105 !! options
15106 preload
15107 !! input
15108 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15109 !! result
15110 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15111 !! end
15112
15113 !! test
15114 Play a bit with r67090 and bug 3158
15115 !! options
15116 disabled
15117 !! input
15118 <div style="width:50% !important">&nbsp;</div>
15119 <div style="width:50%&nbsp;!important">&nbsp;</div>
15120 <div style="width:50%&#160;!important">&nbsp;</div>
15121 <div style="border : solid;">&nbsp;</div>
15122 !! result
15123 <div style="width:50% !important">&nbsp;</div>
15124 <div style="width:50% !important">&nbsp;</div>
15125 <div style="width:50% !important">&nbsp;</div>
15126 <div style="border&#160;: solid;">&nbsp;</div>
15127
15128 !! end
15129
15130 !! test
15131 HTML5 data attributes
15132 !! input
15133 <span data-foo="bar">Baz</span>
15134 <p data-abc-def_hij="">Quuz</p>
15135 !! result
15136 <p><span data-foo="bar">Baz</span>
15137 </p>
15138 <p data-abc-def_hij="">Quuz</p>
15139
15140 !! end
15141
15142 !! test
15143 percent-encoding and + signs in internal links (Bug 26410)
15144 !! input
15145 [[User:+%]] [[Page+title%]]
15146 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15147 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15148 [[%33%45]] [[%33%45+]]
15149 !! result
15150 <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>
15151 <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>
15152 <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>
15153 <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>
15154 </p>
15155 !! end
15156
15157 !! test
15158 Special characters in embedded file links (bug 27679)
15159 !! input
15160 [[File:Contains & ampersand.jpg]]
15161 [[File:Does not exist.jpg|Title with & ampersand]]
15162 !! result
15163 <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>
15164 <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>
15165 </p>
15166 !! end
15167
15168
15169 !! test
15170 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15171 !! input
15172 Text&apos;s been normalized?
15173 !! result
15174 <p>Text&#39;s been normalized?
15175 </p>
15176 !! end
15177
15178 !! test
15179 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15180 !! input
15181 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15182 !! result
15183 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15184 </p>
15185 !! end
15186
15187 !! test
15188 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15189 !! input
15190 [http://www.example.org/ ideograms]
15191 !! result
15192 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15193 </p>
15194 !! end
15195
15196 !! test
15197 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15198 !! input
15199 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15200 !! result
15201 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15202 </p>
15203 !! end
15204
15205 !! article
15206 Mediawiki:loop1
15207 !! text
15208 {{Identical|A}}
15209 !! endarticle
15210
15211 !! article
15212 Mediawiki:loop2
15213 !! text
15214 {{Identical|B}}
15215 !! endarticle
15216
15217 !! article
15218 Template:Identical
15219 !! text
15220 {{int:loop1}}
15221 {{int:loop2}}
15222 !! endarticle
15223
15224 !! test
15225 Bug 31098 Template which includes system messages which includes the template
15226 !! input
15227 {{Identical}}
15228 !! result
15229 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15230 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15231 </p>
15232 !! end
15233
15234 !! test
15235 Bug31490 Turkish: ucfirst 'blah'
15236 !! options
15237 language=tr
15238 !! input
15239 {{ucfirst:blah}}
15240 !! result
15241 <p>Blah
15242 </p>
15243 !! end
15244
15245 !! test
15246 Bug31490 Turkish: ucfirst 'ix'
15247 !! options
15248 language=tr
15249 !! input
15250 {{ucfirst:ix}}
15251 !! result
15252 <p>İx
15253 </p>
15254 !! end
15255
15256 !! test
15257 Bug31490 Turkish: lcfirst 'BLAH'
15258 !! options
15259 language=tr
15260 !! input
15261 {{lcfirst:BLAH}}
15262 !! result
15263 <p>bLAH
15264 </p>
15265 !! end
15266
15267 !! test
15268 Bug31490 Turkish: ucfırst (with a dotless i)
15269 !! options
15270 language=tr
15271 !! input
15272 {{ucfırst:blah}}
15273 !! result
15274 <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>
15275 </p>
15276 !! end
15277
15278 !! test
15279 Bug31490 ucfırst (with a dotless i) with English language
15280 !! options
15281 language=en
15282 !! input
15283 {{ucfırst:blah}}
15284 !! result
15285 <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>
15286 </p>
15287 !! end
15288
15289 !! test
15290 Bug 26375: TOC with italics
15291 !! options
15292 title=[[Main Page]]
15293 !! input
15294 __TOC__
15295 == ''Lost'' episodes ==
15296 !! result
15297 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15298 <ul>
15299 <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>
15300 </ul>
15301 </div>
15302 <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>
15303
15304 !! end
15305
15306 !! test
15307 Bug 26375: TOC with bold
15308 !! options
15309 title=[[Main Page]]
15310 !! input
15311 __TOC__
15312 == '''should be bold''' then normal text ==
15313 !! result
15314 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15315 <ul>
15316 <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>
15317 </ul>
15318 </div>
15319 <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>
15320
15321 !! end
15322
15323 !! test
15324 Bug 33845: Headings become cursive in TOC when they contain an image
15325 !! options
15326 title=[[Main Page]]
15327 !! input
15328 __TOC__
15329 == Image [[Image:foobar.jpg]] ==
15330 !! result
15331 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15332 <ul>
15333 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15334 </ul>
15335 </div>
15336 <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>
15337
15338 !! end
15339
15340 !! test
15341 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15342 !! options
15343 title=[[Main Page]]
15344 !! input
15345 __TOC__
15346 == <blockquote>Quote</blockquote> ==
15347 !! result
15348 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15349 <ul>
15350 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15351 </ul>
15352 </div>
15353 <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>
15354
15355 !! end
15356
15357 !! test
15358 Unclosed tags in TOC
15359 !! options
15360 title=[[Main Page]]
15361 !! input
15362 __TOC__
15363 == Proof: 2 < 3 ==
15364 <small>Hanc marginis exiguitas non caperet.</small>
15365 QED
15366 !! result
15367 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15368 <ul>
15369 <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>
15370 </ul>
15371 </div>
15372 <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>
15373 <p><small>Hanc marginis exiguitas non caperet.</small>
15374 QED
15375 </p>
15376 !! end
15377
15378 !! test
15379 Multiple tags in TOC
15380 !! input
15381 __TOC__
15382 == <i>Foo</i> <b>Bar</b> ==
15383
15384 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15385 !! result
15386 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15387 <ul>
15388 <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>
15389 <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>
15390 </ul>
15391 </div>
15392 <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>
15393 <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>
15394
15395 !! end
15396
15397 !! test
15398 Tags with parameters in TOC
15399 !! input
15400 __TOC__
15401 == <sup class="in-h2">Hello</sup> ==
15402
15403 == <sup class="a > b">Evilbye</sup> ==
15404 !! result
15405 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15406 <ul>
15407 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15408 <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>
15409 </ul>
15410 </div>
15411 <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>
15412 <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>
15413
15414 !! end
15415
15416 !! test
15417 span tags with directionality in TOC
15418 !! input
15419 __TOC__
15420 == <span dir="ltr">C++</span> ==
15421
15422 == <span dir="rtl">זבנג!</span> ==
15423
15424 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15425
15426 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15427
15428 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15429 !! result
15430 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15431 <ul>
15432 <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>
15433 <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>
15434 <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>
15435 <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>
15436 <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>
15437 </ul>
15438 </div>
15439 <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>
15440 <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>
15441 <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>
15442 <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>
15443 <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>
15444
15445 !! end
15446
15447 !! article
15448 MediaWiki:Bug32057
15449 !! text
15450 == {{int:headline_sample}} ==
15451 !! endarticle
15452
15453 !! test
15454 Bug 32057: Title needed when expanding <h> nodes.
15455 !! options
15456 title=[[Main Page]]
15457 !! input
15458 {{int:Bug32057}}
15459 !! result
15460 <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>
15461
15462 !! end
15463
15464 !! test
15465 Strip marker in urlencode
15466 !! input
15467 {{urlencode:x<nowiki/>y}}
15468 {{urlencode:x<nowiki/>y|wiki}}
15469 {{urlencode:x<nowiki/>y|path}}
15470 !! result
15471 <p>xy
15472 xy
15473 xy
15474 </p>
15475 !! end
15476
15477 !! test
15478 Strip marker in lc
15479 !! input
15480 {{lc:x<nowiki/>y}}
15481 !! result
15482 <p>xy
15483 </p>
15484 !! end
15485
15486 !! test
15487 Strip marker in uc
15488 !! input
15489 {{uc:x<nowiki/>y}}
15490 !! result
15491 <p>XY
15492 </p>
15493 !! end
15494
15495 !! test
15496 Strip marker in formatNum
15497 !! input
15498 {{formatnum:1<nowiki/>2}}
15499 {{formatnum:1<nowiki/>2|R}}
15500 !! result
15501 <p>12
15502 12
15503 </p>
15504 !! end
15505
15506 !! test
15507 Check noCommafy in formatNum
15508 !! options
15509 language=be-tarask
15510 !! input
15511 {{formatnum:123456.78}}
15512 {{formatnum:123456.78|NOSEP}}
15513 !! result
15514 <p>123 456,78
15515 123456.78
15516 </p>
15517 !! end
15518
15519 !! test
15520 Strip marker in grammar
15521 !! options
15522 language=fi
15523 !! input
15524 {{grammar:elative|foo<nowiki/>bar}}
15525 !! result
15526 <p>foobarista
15527 </p>
15528 !! end
15529
15530 !! test
15531 Strip marker in padleft
15532 !! input
15533 {{padleft:|2|x<nowiki/>y}}
15534 !! result
15535 <p>xy
15536 </p>
15537 !! end
15538
15539 !! test
15540 Strip marker in padright
15541 !! input
15542 {{padright:|2|x<nowiki/>y}}
15543 !! result
15544 <p>xy
15545 </p>
15546 !! end
15547
15548 !! test
15549 Strip marker in anchorencode
15550 !! input
15551 {{anchorencode:x<nowiki/>y}}
15552 !! result
15553 <p>xy
15554 </p>
15555 !! end
15556
15557 !! test
15558 nowiki inside link inside heading (bug 18295)
15559 !! input
15560 ==[[foo|x<nowiki>y</nowiki>z]]==
15561 !! result
15562 <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>
15563
15564 !! end
15565
15566 !! test
15567 new support for bdi element (bug 31817)
15568 !! input
15569 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15570 !! result
15571 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
15572
15573 !!end
15574
15575 !! test
15576 Ignore pipe between table row attributes
15577 !! input
15578 {|
15579 | quux
15580 |- id=foo | style='color: red'
15581 | bar
15582 |}
15583 !! result
15584 <table>
15585 <tr>
15586 <td> quux
15587 </td></tr>
15588 <tr id="foo" style="color: red">
15589 <td> bar
15590 </td></tr></table>
15591
15592 !! end
15593
15594 !!test
15595 Gallery override link with WikiLink (bug 34852)
15596 !! input
15597 <gallery>
15598 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
15599 </gallery>
15600 !! result
15601 <ul class="gallery mw-gallery-traditional">
15602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15603 <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>
15604 <div class="gallerytext">
15605 <p>caption
15606 </p>
15607 </div>
15608 </div></li>
15609 </ul>
15610
15611 !! end
15612
15613 !!test
15614 Gallery override link with absolute external link (bug 34852)
15615 !! input
15616 <gallery>
15617 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
15618 </gallery>
15619 !! result
15620 <ul class="gallery mw-gallery-traditional">
15621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15622 <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>
15623 <div class="gallerytext">
15624 <p>caption
15625 </p>
15626 </div>
15627 </div></li>
15628 </ul>
15629
15630 !! end
15631
15632 !!test
15633 Gallery override link with malicious javascript (bug 34852)
15634 !! input
15635 <gallery>
15636 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
15637 </gallery>
15638 !! result
15639 <ul class="gallery mw-gallery-traditional">
15640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15641 <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>
15642 <div class="gallerytext">
15643 <p>caption
15644 </p>
15645 </div>
15646 </div></li>
15647 </ul>
15648
15649 !! end
15650
15651 !!test
15652 Gallery with invalid title as link (bug 43964)
15653 !! input
15654 <gallery>
15655 File:foobar.jpg|link=<
15656 </gallery>
15657 !! result
15658 <ul class="gallery mw-gallery-traditional">
15659 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15660 <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>
15661 <div class="gallerytext">
15662 </div>
15663 </div></li>
15664 </ul>
15665
15666 !! end
15667
15668 !!test
15669 Language parser function
15670 !! input
15671 {{#language:ar}}
15672 !! result
15673 <p>العربية
15674 </p>
15675 !! end
15676
15677 !!test
15678 Padleft and padright as substr
15679 !! input
15680 {{padleft:|3|abcde}}
15681 {{padright:|3|abcde}}
15682 !! result
15683 <p>abc
15684 abc
15685 </p>
15686 !! end
15687
15688 !!test
15689 Special parser function
15690 !! input
15691 {{#special:RandomPage}}
15692 {{#special:BaDtItLe}}
15693 {{#special:Foobar}}
15694 !! result
15695 <p>Special:Random
15696 Special:Badtitle
15697 Special:Foobar
15698 </p>
15699 !! end
15700
15701 !!test
15702 Bug 34939 - Case insensitive link parsing ([HttP://])
15703 !! input
15704 [HttP://MediaWiki.Org/]
15705 !! result
15706 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
15707 </p>
15708 !! end
15709
15710 !!test
15711 Bug 34939 - Case insensitive link parsing ([HttP:// title])
15712 !! input
15713 [HttP://MediaWiki.Org/ MediaWiki]
15714 !! result
15715 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
15716 </p>
15717 !! end
15718
15719 !!test
15720 Bug 34939 - Case insensitive link parsing (HttP://)
15721 !! input
15722 HttP://MediaWiki.Org/
15723 !! result
15724 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
15725 </p>
15726 !! end
15727
15728
15729 ###
15730 ### Parsoids-specific tests
15731 ### Parsoid-PHP parser incompatibilities
15732 ###
15733 !!test
15734 1. SOL-sensitive wikitext tokens as template-args
15735 !!options
15736 parsoid=wt2html,wt2wt
15737 !!input
15738 {{echo|*a}}
15739 {{echo|#a}}
15740 {{echo|:a}}
15741 !!result
15742 <span about="#mwt1" typeof="mw:Transclusion">
15743 </span><ul about="#mwt1"><li>a</li></ul>
15744 <span about="#mwt2" typeof="mw:Transclusion">
15745 </span><ol about="#mwt2"><li>a</li></ol>
15746 <span about="#mwt3" typeof="mw:Transclusion">
15747 </span><dl about="#mwt3"><dd>a</dd></dl>
15748 !!end
15749
15750 #### ----------------------------------------------------------------
15751 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
15752 #### tags. Parsoid's output for these tags differs from that of the
15753 #### PHP parser.
15754 #### ----------------------------------------------------------------
15755
15756 !!test
15757 Ref: 1. ref-location should be replaced with an index span
15758 !!options
15759 parsoid
15760 !!input
15761 A <ref>foo</ref>
15762 B <ref name="x">foo</ref>
15763 C <ref name="y" />
15764 !!result
15765 <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>
15766 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>
15767 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>
15768 !!end
15769
15770 !!test
15771 Ref: 2. ref-tags with identical names should all get the same index
15772 !!options
15773 parsoid
15774 !!input
15775 A <ref name="x">foo</ref>
15776 B <ref name="x" />
15777 !!result
15778 <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>
15779 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>
15780 !!end
15781
15782 !!test
15783 Ref: 3. spaces in ref-names should be ignored
15784 !!options
15785 parsoid
15786 !!input
15787 A <ref name="x">foo</ref>
15788 B <ref name=" x " />
15789 C <ref name= x />
15790 !!result
15791 <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>
15792 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>
15793 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>
15794 !!end
15795
15796 !!test
15797 Ref: 4. 'constructor' should be accepted as a valid ref-name
15798 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
15799 !!options
15800 parsoid
15801 !!input
15802 A <ref name="constructor">foo</ref>
15803 !!result
15804 <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>
15805 !!end
15806
15807 !!test
15808 Ref: 5. body should accept generic wikitext
15809 !!options
15810 parsoid
15811 !!input
15812 A <ref>
15813 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
15814 </ref>
15815
15816 <references />
15817 !!result
15818 <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;stx&amp;quot;:&amp;quot;simple&amp;quot;,&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;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt5\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&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;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[55,76,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\">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>
15819
15820 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
15821 <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='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
15822 </li></ol>
15823 !!end
15824
15825 !!test
15826 Ref: 6. indent-pres should not be output in ref-body
15827 !!options
15828 parsoid
15829 !!input
15830 A <ref>
15831 foo
15832 bar
15833 baz
15834 </ref>
15835
15836 <references />
15837 !!result
15838 <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>
15839
15840 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
15841 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15842 bar
15843 baz
15844 </li></ol>
15845 !!end
15846
15847 !!test
15848 Ref: 7. No p-wrapping in ref-body
15849 !!options
15850 parsoid
15851 !!input
15852 A <ref>
15853 foo
15854
15855 bar
15856
15857
15858 baz
15859
15860
15861
15862 booz
15863 </ref>
15864
15865 <references />
15866 !!result
15867 <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>
15868
15869 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15870 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
15871
15872 bar
15873
15874
15875 baz
15876
15877
15878
15879 booz
15880 </li></ol>
15881 !!end
15882
15883 !!test
15884 Ref: 8. transclusion wikitext has lower precedence
15885 !!options
15886 parsoid
15887 !!input
15888 A <ref> foo {{echo|</ref> B C}}
15889
15890 <references />
15891 !!result
15892 <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,0,0]}\">{{</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>
15893
15894 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15895 <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>
15896 !!end
15897
15898 !!test
15899 Ref: 9. unclosed comments should not leak out of ref-body
15900 !!options
15901 parsoid
15902 !!input
15903 A <ref> foo <!--</ref> B C
15904
15905 <references />
15906 !!result
15907 <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>
15908
15909 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15910 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
15911 !!end
15912
15913 !!test
15914 Ref: 10. Unclosed HTML tags should not leak out of ref-body
15915 !!options
15916 parsoid
15917 !!input
15918 A <ref> <b> foo </ref> B C
15919
15920 <references />
15921 !!result
15922 <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>
15923
15924 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
15925 <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>
15926 !!end
15927
15928 !!test
15929 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
15930 !!options
15931 parsoid
15932 !!input
15933 A <ref>foo</ref> B
15934 C <ref>bar</ref> D
15935 !!result
15936 <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
15937 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>
15938 !!end
15939
15940 !!test
15941 Ref: 12. ref-tags act as trailing newline migration barrier
15942 !!options
15943 parsoid
15944 !!input
15945 <!--the newline at the end of this line moves out of the p-tag-->a
15946
15947 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
15948 <ref />
15949
15950 c
15951 !!result
15952 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
15953
15954
15955 <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>
15956 <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>
15957
15958
15959 <p>c</p>
15960 !!end
15961
15962 !!test
15963 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
15964 !!options
15965 parsoid
15966 !!input
15967 <ref>foo</ref> A
15968 <ref>bar
15969 </ref> B
15970 !!result
15971 <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
15972 <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>
15973 !!end
15974
15975 !!test
15976 Ref: 14. A nested ref-tag should be emitted as plain text
15977 !!options
15978 parsoid
15979 !!input
15980 <ref>foo <ref>bar</ref> baz</ref>
15981
15982 <references />
15983 !!result
15984 <p><span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
15985
15986 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
15987 <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>
15988 !!end
15989
15990 !!test
15991 Ref: 15. ref-tags with identical names should get identical indexes
15992 !!options
15993 parsoid
15994 !!input
15995 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15996 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15997
15998 <references />
15999 !!result
16000 <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>
16001 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>
16002
16003 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><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>
16004 !!end
16005
16006 !!test
16007 References: 1. references tag without any refs should be handled properly
16008 !!options
16009 parsoid
16010 !!input
16011 <references />
16012 !!result
16013 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16014 !!end
16015
16016 !!test
16017 References: 2. references tag with group only outputs references from that group
16018 !!options
16019 parsoid
16020 !!input
16021 A <ref group="a">foo</ref>
16022 B <ref group="b">bar</ref>
16023
16024 <references group='a' />
16025 !!result
16026 <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>
16027 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>
16028
16029 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
16030 !!end
16031
16032 !!test
16033 References: 3. ref list should be cleared after processing references
16034 !!options
16035 parsoid
16036 !!input
16037 A <ref>foo</ref>
16038
16039 <references />
16040
16041 B <ref>bar</ref>
16042
16043 <references />
16044 !!result
16045 <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>
16046
16047 <ol about="#mwt4" class="references" typeof="mw:Extension/references" 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</li></ol>
16048
16049 <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>
16050
16051 <ol about="#mwt8" class="references" typeof="mw:Extension/references" 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> bar</li></ol>
16052 !!end
16053
16054 !!test
16055 References: 4. only referenced group should be cleared after processing references
16056 !!options
16057 parsoid
16058 !!input
16059 A <ref group="a">afoo</ref>
16060 B <ref>bfoo</ref>
16061
16062 <references group="a"/>
16063
16064 C <ref>cfoo</ref>
16065
16066 <references />
16067 !!result
16068 <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>
16069 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>
16070
16071 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
16072
16073 <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>
16074
16075 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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> 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>
16076 !!end
16077
16078 !!test
16079 References: 5. ref tags in references should be processed while ignoring all other content
16080 !!options
16081 parsoid
16082 !!input
16083 A <ref name="a" />
16084 B <ref name="b">bar</ref>
16085
16086 <references>
16087 <ref name="a">foo</ref>
16088 This should just get lost.
16089 </references>
16090 !!result
16091 <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>
16092 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>
16093
16094 <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":"\n<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>\n"},"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>
16095 !!end
16096
16097 !!test
16098 References: 6. <references /> from a transclusion
16099 !!options
16100 parsoid
16101 !!input
16102 {{echo|<references />}}
16103 !!result
16104 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'></ol>
16105 !!end
16106
16107 !! test
16108 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16109 !! options
16110 parsoid
16111 !! input
16112 A <ref>foo bar for a</ref>
16113 B <ref name="b" />
16114
16115 <references />
16116
16117 <references>
16118 <ref name="b">foo</ref>
16119 </references>
16120 !! result
16121 <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>
16122 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>
16123
16124 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
16125 <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>
16126 <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>
16127
16128 <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":{}}'>
16129 <li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
16130 !! end
16131
16132 #### ----------------------------------------------------------------
16133 #### The following section of tests are primarily to test
16134 #### wikitext escaping capabilities of Parsoid. Given that
16135 #### escaping can be done any number of ways, the wikitext (input)
16136 #### is always adjusted to reflect how Parsoid adds nowiki
16137 #### escape tags.
16138 ####
16139 #### We are marking several tests as parsoid-only since the
16140 #### HTML in the result section is different from what the
16141 #### PHP parser generates for it.
16142 #### ----------------------------------------------------------------
16143
16144
16145 #### --------------- Headings ---------------
16146 #### 0. Unnested
16147 #### 1. Nested inside html <h1>=foo=</h1>
16148 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16149 #### 3. Nested inside html with wikitext split by html tags
16150 #### 4. No escape needed
16151 #### 5. Empty headings <h1></h1>
16152 #### 6. Heading chars in SOL context
16153 #### ----------------------------------------
16154 !! test
16155 Headings: 0. Unnested
16156 !! options
16157 parsoid
16158 !! input
16159 <nowiki>=foo=</nowiki>
16160
16161 <nowiki> =foo= </nowiki>
16162 <!--cmt-->
16163 <nowiki>=foo=</nowiki>
16164
16165 =foo''a''<nowiki>=</nowiki>
16166 !! result
16167 <p><span typeof="mw:Nowiki">=foo=</span></p>
16168
16169 <p><span typeof="mw:Nowiki"> =foo= </span>
16170 <!--cmt-->
16171 <span typeof="mw:Nowiki">=foo=</span></p>
16172
16173 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16174 !!end
16175
16176 !! test
16177 Headings: 1. Nested inside html
16178 !! options
16179 parsoid
16180 !! input
16181 =<nowiki>=foo=</nowiki>=
16182
16183 ==<nowiki>=foo=</nowiki>==
16184
16185 ===<nowiki>=foo=</nowiki>===
16186
16187 ====<nowiki>=foo=</nowiki>====
16188
16189 =====<nowiki>=foo=</nowiki>=====
16190
16191 ======<nowiki>=foo=</nowiki>======
16192 !! result
16193 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16194 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16195 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16196 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16197 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16198 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16199 !!end
16200
16201 !! test
16202 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16203 !! options
16204 parsoid
16205 !! input
16206 =foo=
16207 <nowiki>*</nowiki>bar
16208
16209 =foo=
16210 =bar
16211
16212 =foo=
16213 <nowiki>=bar=</nowiki>
16214 !! result
16215 <h1>foo</h1>*bar
16216 <h1>foo</h1>=bar
16217 <h1>foo</h1>=bar=
16218 !!end
16219
16220 !! test
16221 Headings: 3. Nested inside html with wikitext split by html tags
16222 !! options
16223 parsoid
16224 !! input
16225 =='''bold'''<nowiki>foo=</nowiki>=
16226 !! result
16227 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16228 !!end
16229
16230 !! test
16231 Headings: 4a. No escaping needed (testing just h1 and h2)
16232 !! options
16233 parsoid
16234 !! input
16235 ==foo=
16236
16237 =foo==
16238
16239 = =foo= =
16240
16241 ==foo= bar=
16242
16243 ===foo==
16244
16245 ==foo===
16246
16247 =''=''foo==
16248
16249 =<nowiki>=</nowiki>=
16250 !! result
16251 <h1>=foo</h1>
16252 <h1>foo=</h1>
16253 <h1> =foo= </h1>
16254 <h1>=foo= bar</h1>
16255 <h2>=foo</h2>
16256 <h2>foo=</h2>
16257 <h1><i>=</i>foo=</h1>
16258 <h1><span typeof="mw:Nowiki">=</span></h1>
16259 !!end
16260
16261 !! test
16262 Headings: 4b. No escaping needed (inside p-tags)
16263 !! options
16264 parsoid
16265 !! input
16266 ===
16267 =foo= x
16268 =foo= <s></s>
16269 !! result
16270 <p>===
16271 =foo= x
16272 =foo= <s></s>
16273 </p>
16274 !!end
16275
16276 !! test
16277 Headings: 5. Empty headings
16278 !! options
16279 parsoid
16280 !! input
16281 =<nowiki/>=
16282
16283 ==<nowiki/>==
16284
16285 ===<nowiki/>===
16286
16287 ====<nowiki/>====
16288
16289 =====<nowiki/>=====
16290
16291 ======<nowiki/>======
16292 !! result
16293 <h1></h1>
16294 <h2></h2>
16295 <h3></h3>
16296 <h4></h4>
16297 <h5></h5>
16298 <h6></h6>
16299 !!end
16300
16301 !! test
16302 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16303 !! options
16304 parsoid
16305 !! input
16306 <nowiki>=a=</nowiki>
16307
16308 <nowiki>=a=</nowiki>
16309
16310 <nowiki>=a=</nowiki>
16311
16312 <nowiki>=a=</nowiki>
16313 !! result
16314 <p>=a=</p>
16315 <p>=a= </p>
16316 <p>=a= </p>
16317 <p>=a= </p>
16318 !!end
16319
16320 !! test
16321 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16322 !! options
16323 parsoid
16324 !! input
16325 <nowiki>=a=
16326 b</nowiki>
16327
16328 <nowiki>=a=
16329 b</nowiki>
16330
16331 <nowiki>=a=
16332 b</nowiki>
16333
16334 <nowiki>=a=
16335 b</nowiki>
16336 !! result
16337 <p>=a=
16338 b</p>
16339 <p>=a=
16340 b</p>
16341 <p>=a=
16342 b</p>
16343 <p>=a=
16344 b</p>
16345 </p>
16346 !!end
16347
16348 !! test
16349 Headings: 6c. Heading chars in SOL context (leading newline break)
16350 !! options
16351 parsoid
16352 !! input
16353 a
16354 <nowiki>=b=</nowiki>
16355 !! result
16356 <p>a
16357 =b=</p>
16358 !!end
16359
16360 !! test
16361 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16362 !! options
16363 parsoid
16364 !! input
16365 <!--c0--><nowiki>=a=</nowiki>
16366 <!--c1-->
16367 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16368 !! result
16369 <p><!--c0-->=a=</p>
16370 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16371 !!end
16372
16373 !! test
16374 Headings: 6d. Heading chars in SOL context (No escaping needed)
16375 !! options
16376 parsoid=html2wt
16377 !! input
16378 =a=<div>b</div>
16379 !! result
16380 =a=<div>b</div>
16381 !!end
16382
16383 #### --------------- Lists ---------------
16384 #### 0. Outside nests (*foo, etc.)
16385 #### 1. Nested inside html <ul><li>*foo</li></ul>
16386 #### 2. Inside definition lists
16387 #### 3. Only bullets at start should be escaped
16388 #### 4. No escapes needed
16389 #### 5. No unnecessary escapes
16390 #### 6. Escape bullets in SOL position
16391 #### 7. Escape bullets in a multi-line context
16392 #### ----------------------------------------
16393
16394 !! test
16395 Lists: 0. Outside nests
16396 !! input
16397 <nowiki>*</nowiki>foo
16398
16399 <nowiki>#</nowiki>foo
16400 !! result
16401 <p>*foo
16402 </p><p>#foo
16403 </p>
16404 !!end
16405
16406 !! test
16407 Lists: 1. Nested inside html
16408 !! input
16409 *<nowiki>*foo</nowiki>
16410
16411 *<nowiki>#foo</nowiki>
16412
16413 *<nowiki>:foo</nowiki>
16414
16415 *<nowiki>;foo</nowiki>
16416
16417 #<nowiki>*foo</nowiki>
16418
16419 #<nowiki>#foo</nowiki>
16420
16421 #<nowiki>:foo</nowiki>
16422
16423 #<nowiki>;foo</nowiki>
16424 !! result
16425 <ul><li>*foo
16426 </li></ul>
16427 <ul><li>#foo
16428 </li></ul>
16429 <ul><li>:foo
16430 </li></ul>
16431 <ul><li>;foo
16432 </li></ul>
16433 <ol><li>*foo
16434 </li></ol>
16435 <ol><li>#foo
16436 </li></ol>
16437 <ol><li>:foo
16438 </li></ol>
16439 <ol><li>;foo
16440 </li></ol>
16441
16442 !!end
16443
16444 !! test
16445 Lists: 2. Inside definition lists
16446 !! input
16447 ;<nowiki>;foo</nowiki>
16448
16449 ;<nowiki>:foo</nowiki>
16450
16451 ;<nowiki>:foo</nowiki>
16452 :bar
16453
16454 :<nowiki>:foo</nowiki>
16455 !! result
16456 <dl><dt>;foo
16457 </dt></dl>
16458 <dl><dt>:foo
16459 </dt></dl>
16460 <dl><dt>:foo
16461 </dt><dd>bar
16462 </dd></dl>
16463 <dl><dd>:foo
16464 </dd></dl>
16465
16466 !!end
16467
16468 !! test
16469 Lists: 3. Only bullets at start of text should be escaped
16470 !! input
16471 *<nowiki>*foo*bar</nowiki>
16472
16473 *<nowiki>*foo</nowiki>''it''*bar
16474 !! result
16475 <ul><li>*foo*bar
16476 </li></ul>
16477 <ul><li>*foo<i>it</i>*bar
16478 </li></ul>
16479
16480 !!end
16481
16482 !! test
16483 Lists: 4. No escapes needed
16484 !! options
16485 parsoid
16486 !! input
16487 *foo*bar
16488
16489 *''foo''*bar
16490
16491 *[[Foo]]: bar
16492 !! result
16493 <ul><li>foo*bar
16494 </li></ul>
16495 <ul><li><i>foo</i>*bar
16496 </li></ul>
16497 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
16498 </li></ul>
16499 !!end
16500
16501 !! test
16502 Lists: 5. No unnecessary escapes
16503 !! input
16504 * bar <span><nowiki>[[foo]]</nowiki></span>
16505
16506 *=bar <span><nowiki>[[foo]]</nowiki></span>
16507
16508 *[[bar <span><nowiki>[[foo]]</nowiki></span>
16509
16510 *]]bar <span><nowiki>[[foo]]</nowiki></span>
16511
16512 *=bar <span>foo]]</span>=
16513
16514 * <s></s>: a
16515 !! result
16516 <ul><li> bar <span>[[foo]]</span>
16517 </li></ul>
16518 <ul><li>=bar <span>[[foo]]</span>
16519 </li></ul>
16520 <ul><li>[[bar <span>[[foo]]</span>
16521 </li></ul>
16522 <ul><li>]]bar <span>[[foo]]</span>
16523 </li></ul>
16524 <ul><li>=bar <span>foo]]</span>=
16525 </li></ul>
16526 <ul><li> <s></s>: a
16527 </li></ul>
16528
16529 !!end
16530
16531 !! test
16532 Lists: 6. Escape bullets in SOL position
16533 !! options
16534 parsoid
16535 !! input
16536 <!--cmt--><nowiki>*foo</nowiki>
16537 !! result
16538 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
16539 !!end
16540
16541 !! test
16542 Lists: 7. Escape bullets in a multi-line context
16543 !! input
16544 a
16545 <nowiki>*</nowiki>b
16546 !! result
16547 <p>a
16548 *b
16549 </p>
16550 !!end
16551
16552 #### --------------- HRs ---------------
16553 #### 1. Single line
16554 #### -----------------------------------
16555
16556 !! test
16557 HRs: 1. Single line
16558 !! options
16559 parsoid
16560 !! input
16561 ----<nowiki>----</nowiki>
16562 ----=foo=
16563 ----*foo
16564 !! result
16565 <hr><span typeof="mw:Nowiki">----</span>
16566 <hr>=foo=
16567 <hr>*foo
16568 !! end
16569
16570 #### --------------- Tables ---------------
16571 #### 1a. Simple example
16572 #### 1b. No escaping needed (!foo)
16573 #### 1c. No escaping needed (|foo)
16574 #### 1d. No escaping needed (|}foo)
16575 ####
16576 #### 2a. Nested in td (<td>foo|bar</td>)
16577 #### 2b. Nested in td (<td>foo||bar</td>)
16578 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
16579 ####
16580 #### 3a. Nested in th (<th>foo!bar</th>)
16581 #### 3b. Nested in th (<th>foo!!bar</th>)
16582 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
16583 ####
16584 #### 4a. Escape -
16585 #### 4b. Escape +
16586 #### 4c. No escaping needed
16587 #### --------------------------------------
16588
16589 !! test
16590 Tables: 1a. Simple example
16591 !! input
16592 <nowiki>{|
16593 |}</nowiki>
16594 !! result
16595 <p>{|
16596 |}
16597 </p>
16598 !! end
16599
16600 !! test
16601 Tables: 1b. No escaping needed
16602 !! input
16603 !foo
16604 !! result
16605 <p>!foo
16606 </p>
16607 !! end
16608
16609 !! test
16610 Tables: 1c. No escaping needed
16611 !! input
16612 |foo
16613 !! result
16614 <p>|foo
16615 </p>
16616 !! end
16617
16618 !! test
16619 Tables: 1d. No escaping needed
16620 !! input
16621 |}foo
16622 !! result
16623 <p>|}foo
16624 </p>
16625 !! end
16626
16627 !! test
16628 Tables: 2a. Nested in td
16629 !! options
16630 parsoid
16631 !! input
16632 {|
16633 |<nowiki>foo|bar</nowiki>
16634 |}
16635 !! result
16636 <table><tbody><tr>
16637 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
16638 !! end
16639
16640 !! test
16641 Tables: 2b. Nested in td
16642 !! options
16643 parsoid
16644 !! input
16645 {|
16646 |<nowiki>foo||bar</nowiki>
16647 |''it''<nowiki>foo||bar</nowiki>
16648 |}
16649 !! result
16650 <table><tbody><tr>
16651 <td><span typeof="mw:Nowiki">foo||bar</span></td>
16652 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
16653 !! end
16654
16655 !! test
16656 Tables: 2c. Nested in td -- no escaping needed
16657 !! options
16658 parsoid
16659 !! input
16660 {|
16661 |foo!!bar
16662 |}
16663 !! result
16664 <table><tbody><tr><td>foo!!bar
16665 </td></tr></tbody></table>
16666
16667 !! end
16668
16669 !! test
16670 Tables: 3a. Nested in th
16671 !! options
16672 parsoid
16673 !! input
16674 {|
16675 !foo!bar
16676 |}
16677 !! result
16678 <table><tbody><tr><th>foo!bar
16679 </th></tr></tbody></table>
16680
16681 !! end
16682
16683 !! test
16684 Tables: 3b. Nested in th
16685 !! options
16686 parsoid
16687 !! input
16688 {|
16689 !<nowiki>foo!!bar</nowiki>
16690 |}
16691 !! result
16692 <table>
16693 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
16694 </tbody></table>
16695 !! end
16696
16697 !! test
16698 Tables: 3c. Nested in th -- no escaping needed
16699 !! options
16700 parsoid
16701 !! input
16702 {|
16703 !<nowiki>foo||bar</nowiki>
16704 |}
16705 !! result
16706 <table><tbody><tr>
16707 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
16708 !! end
16709
16710 !! test
16711 Tables: 4a. Escape -
16712 !! options
16713 parsoid
16714 !! input
16715 {|
16716 !-bar
16717 |-
16718 |<nowiki>-bar</nowiki>
16719 |}
16720 !! result
16721 <table><tbody>
16722 <tr><th>-bar</th></tr>
16723 <tr>
16724 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
16725 !! end
16726
16727 !! test
16728 Tables: 4b. Escape +
16729 !! options
16730 parsoid
16731 !! input
16732 {|
16733 !+bar
16734 |-
16735 |<nowiki>+bar</nowiki>
16736 |}
16737 !! result
16738 <table><tbody>
16739 <tr><th>+bar</th></tr>
16740 <tr>
16741 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
16742 !! end
16743
16744 !! test
16745 Tables: 4c. No escaping needed
16746 !! options
16747 parsoid
16748 !! input
16749 {|
16750 |foo-bar
16751 |foo+bar
16752 |-
16753 |''foo''-bar
16754 |''foo''+bar
16755 |-
16756 |foo
16757 bar|baz
16758 +bar
16759 -bar
16760 |}
16761 !! result
16762 <table><tbody>
16763 <tr><td>foo-bar</td><td>foo+bar</td></tr>
16764 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
16765 <tr><td>foo
16766 <p>bar|baz
16767 +bar
16768 -bar</p></td></tr>
16769 </tbody></table>
16770 !! end
16771
16772 ### SSS FIXME: Disabled right now because accurate html2wt
16773 ### on this snippet requires data-parsoid flags that we've
16774 ### stripped out of these tests. We should scheme how we
16775 ### we want to handle these kind of tests that require
16776 ### data-parsoid flags for accurate html2wt serialization
16777
16778 !! test
16779 Tables: 4d. No escaping needed
16780 !! options
16781 disabled
16782 !! input
16783 {|
16784 ||+1
16785 ||-2
16786 |}
16787 !! result
16788 <table>
16789 <tr>
16790 <td>+1
16791 </td>
16792 <td>-2
16793 </td></tr></table>
16794
16795 !! end
16796
16797 #### --------------- Links ----------------
16798 #### 1. Quote marks in link text
16799 #### 2. Wikilinks: Escapes needed
16800 #### 3. Wikilinks: No escapes needed
16801 #### 4. Extlinks: Escapes needed
16802 #### 5. Extlinks: No escapes needed
16803 #### --------------------------------------
16804 !! test
16805 Links 1. Quote marks in link text
16806 !! options
16807 parsoid
16808 !! input
16809 [[Foo|Foo<nowiki>''boo''</nowiki>]]
16810 !! result
16811 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
16812 !! end
16813
16814 !! test
16815 Links 2. WikiLinks: Escapes needed
16816 !! options
16817 parsoid
16818 !! input
16819 [[Foo|<nowiki>[Foobar]</nowiki>]]
16820 [[Foo|<nowiki>Foobar]</nowiki>]]
16821 [[Foo|x [Foobar] x]]
16822 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
16823 [[Foo|<nowiki>[[Bar]]</nowiki>]]
16824 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
16825 [[Foo|<nowiki>|Bar</nowiki>]]
16826 [[Foo|<nowiki>]]bar</nowiki>]]
16827 [[Foo|<nowiki>[[bar</nowiki>]]
16828 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
16829 !! result
16830 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
16831 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
16832 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
16833 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
16834 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
16835 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
16836 <a href="Foo" rel="mw:WikiLink">|Bar</a>
16837 <a href="Foo" rel="mw:WikiLink">]]bar</a>
16838 <a href="Foo" rel="mw:WikiLink">[[bar</a>
16839 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
16840 !! end
16841
16842 !! test
16843 Links 3. WikiLinks: No escapes needed
16844 !! options
16845 parsoid
16846 !! input
16847 [[Foo|[Foobar]]
16848 [[Foo|foo|bar]]
16849 !! result
16850 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
16851 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
16852 !! end
16853
16854 !! test
16855 Links 4. ExtLinks: Escapes needed
16856 !! options
16857 parsoid
16858 !! input
16859 [http://google.com <nowiki>[google]</nowiki>]
16860 [http://google.com <nowiki>google]</nowiki>]
16861 !! result
16862 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
16863 <a href="http://google.com" rel="mw:ExtLink">google]</a>
16864 !! end
16865
16866 !! test
16867 Links 5. ExtLinks: No escapes needed
16868 !! options
16869 parsoid
16870 !! input
16871 [http://google.com [google]
16872 !! result
16873 <a href="http://google.com" rel="mw:ExtLink">[google</a>
16874 !! end
16875
16876 #### --------------- Quotes ---------------
16877 #### 1. Quotes inside <b> and <i>
16878 #### 2. Link fragments separated by <i> and <b> tags
16879 #### 3. Link fragments inside <i> and <b>
16880 #### 4. No escaping needed
16881 #### --------------------------------------
16882 !! test
16883 1. Quotes inside <b> and <i>
16884 !! options
16885 parsoid=html2wt,wt2wt
16886 !! input
16887 ''<nowiki>'foo'</nowiki>''
16888 ''<nowiki>''foo''</nowiki>''
16889 ''<nowiki>'''foo'''</nowiki>''
16890 ''foo''<nowiki/>'s
16891 '''<nowiki>'foo'</nowiki>'''
16892 '''<nowiki>''foo''</nowiki>'''
16893 '''<nowiki>'''foo'''</nowiki>'''
16894 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
16895 '''foo'''<nowiki/>'s
16896 '''foo''
16897 ''foo''<nowiki/>'
16898 '<nowiki/>''foo''<nowiki/>'
16899 ''''foo'''
16900 '''foo'''<nowiki/>'
16901 '<nowiki/>'''foo'''<nowiki/>'
16902 !! result
16903 <p><i>'foo'</i>
16904 <i>''foo''</i>
16905 <i>'''foo'''</i>
16906 <i>foo</i>'s
16907 <b>'foo'</b>
16908 <b>''foo''</b>
16909 <b>'''foo'''</b>
16910 <b>foo'<i>bar'</i>baz</b>
16911 <b>foo</b>'s
16912 '<i>foo</i>
16913 <i>foo</i>'
16914 '<i>foo</i>'
16915 '<b>foo</b>
16916 <b>foo</b>'
16917 '<b>foo</b>'</p>
16918 !! end
16919
16920 !! test
16921 2. Link fragments separated by <i> and <b> tags
16922 !! input
16923 [[''foo''<nowiki>hello]]</nowiki>
16924
16925 [['''foo'''<nowiki>hello]]</nowiki>
16926 !! result
16927 <p>[[<i>foo</i>hello]]
16928 </p><p>[[<b>foo</b>hello]]
16929 </p>
16930 !! end
16931
16932 !! test
16933 3. Link fragments inside <i> and <b>
16934 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
16935 this is one of the shortcomings of this format)
16936 !! input
16937 ''[[foo''<nowiki>]]</nowiki>
16938
16939 '''[[foo'''<nowiki>]]</nowiki>
16940 !! result
16941 <p><i>[[foo</i>]]
16942 </p><p><b>[[foo</b>]]
16943 </p>
16944 !! end
16945
16946 !! test
16947 4. No escaping needed
16948 !! input
16949 '<span>''bar''</span>'
16950 '<span>'''bar'''</span>'
16951 !! result
16952 <p>'<span><i>bar</i></span>'
16953 '<span><b>bar</b></span>'
16954 </p>
16955 !! end
16956
16957 #### ----------- Paragraphs ---------------
16958 #### 1. No unnecessary escapes
16959 #### --------------------------------------
16960
16961 !! test
16962 1. No unnecessary escapes
16963 !! input
16964 bar <span><nowiki>[[foo]]</nowiki></span>
16965
16966 =bar <span><nowiki>[[foo]]</nowiki></span>
16967
16968 [[bar <span><nowiki>[[foo]]</nowiki></span>
16969
16970 ]]bar <span><nowiki>[[foo]]</nowiki></span>
16971
16972 =bar <span>foo]]</span><nowiki>=</nowiki>
16973 !! result
16974 <p>bar <span>[[foo]]</span>
16975 </p><p>=bar <span>[[foo]]</span>
16976 </p><p>[[bar <span>[[foo]]</span>
16977 </p><p>]]bar <span>[[foo]]</span>
16978 </p><p>=bar <span>foo]]</span>=
16979 </p>
16980 !!end
16981
16982 #### ----------------------- PRE --------------------------
16983 #### 1. Leading whitespace in SOL context should be escaped
16984 #### ------------------------------------------------------
16985 !! test
16986 1. Leading whitespace in SOL context should be escaped
16987 !! options
16988 parsoid
16989 !! input
16990 <nowiki> </nowiki>a
16991
16992 <nowiki> </nowiki> a
16993
16994 <nowiki> </nowiki>a(tab)
16995
16996 <nowiki> </nowiki> a
16997 <!--cmt-->
16998 <nowiki> </nowiki> a
16999
17000 a
17001 <nowiki> </nowiki>b
17002
17003 a
17004 <nowiki> </nowiki>b
17005
17006 a
17007 <nowiki> </nowiki> b
17008 !! result
17009 <p> a</p>
17010 <p> a</p>
17011 <p> a(tab)</p>
17012 <p> a</p>
17013 <p><!--cmt--> a</p>
17014 <p>a
17015 b</p>
17016 <p>a
17017 b</p>
17018 <p>a
17019 b</p>
17020 !! end
17021
17022 #### --------------- HTML tags ---------------
17023 #### 1. a tags
17024 #### 2. other tags
17025 #### 3. multi-line html tag
17026 #### -----------------------------------------
17027 !! test
17028 1. a tags
17029 !! options
17030 parsoid
17031 !! input
17032 <a href="http://google.com">google</a>
17033 !! result
17034 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17035 !! end
17036
17037 !! test
17038 2. other tags
17039 !! input
17040 <nowiki><div>foo</div>
17041 <div style="color:red">foo</div></nowiki>
17042 !! result
17043 <p>&lt;div&gt;foo&lt;/div&gt;
17044 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17045 </p>
17046 !! end
17047
17048 !! test
17049 3. multi-line html tag
17050 !! input
17051 <nowiki><div
17052 >foo</div
17053 ></nowiki>
17054 !! result
17055 <p>&lt;div
17056 &gt;foo&lt;/div
17057 &gt;
17058 </p>
17059 !! end
17060
17061 !! test
17062 4. extension tags
17063 !! input
17064 <nowiki><ref>foo</ref></nowiki>
17065 !! result
17066 <p>&lt;ref&gt;foo&lt;/ref&gt;
17067 </p>
17068 !! end
17069
17070 #### --------------- Others ---------------
17071 !! test
17072 Escaping nowikis
17073 !! input
17074 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17075 !! result
17076 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17077 </p>
17078 !! end
17079
17080 ## The quote-char in the input is necessary for triggering the bug
17081 !! test
17082 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17083 !! options
17084 parsoid=wt2wt,html2wt
17085 !! input
17086 foo's bar :
17087 !! result
17088 <p>foo's bar :</p>
17089 !! end
17090
17091 !! test
17092
17093 Tag-like HTML structures are passed through as text
17094 !! input
17095 <x y>
17096
17097 <x.y>
17098
17099 <x-y>
17100
17101 1>2
17102
17103 x<y
17104
17105 a>b
17106
17107 1<d e>f
17108 !! result
17109 <p>&lt;x y&gt;
17110 </p><p>&lt;x.y&gt;
17111 </p><p>&lt;x-y&gt;
17112 </p><p>1&gt;2
17113 </p><p>x&lt;y
17114 </p><p>a&gt;b
17115 </p><p>1&lt;d e&gt;f
17116 </p>
17117 !! end
17118
17119
17120 # This was a bug in the PHP parser (see bug 17663 and its dups,
17121 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17122 !! test
17123 Tag names followed by punctuation should not be recognized as tags
17124 !! input
17125 <s.ome> text
17126 !! result
17127 <p>&lt;s.ome&gt; text
17128 </p>
17129 !! end
17130
17131 !! test
17132 HTML tag with necessary entities in attributes
17133 !! input
17134 <span title="&amp;amp;">foo</span>
17135 !! result
17136 <p><span title="&amp;amp;">foo</span>
17137 </p>
17138 !! end
17139
17140 !! test
17141 HTML tag with 'unnecessary' entity encoding in attributes
17142 !! input
17143 <span title="&amp;">foo</span>
17144 !! result
17145 <p><span title="&amp;">foo</span>
17146 </p>
17147 !! end
17148
17149 !! test
17150 HTML tag with broken attribute value quoting
17151 !! input
17152 <span title="Hello world>Foo</span>
17153 !! result
17154 <p><span>Foo</span>
17155 </p>
17156 !! end
17157
17158 !! test
17159 Parsoid-only: HTML tag with broken attribute value quoting
17160 !! options
17161 parsoid
17162 !! input
17163 <span title="Hello world>Foo</span>
17164 !! result
17165 <p><span title="Hello world">Foo</span>
17166 </p>
17167 !! end
17168
17169 !! test
17170 Table with broken attribute value quoting
17171 !! input
17172 {|
17173 | title="Hello world|Foo
17174 |}
17175 !! result
17176 <table>
17177 <tr>
17178 <td>Foo
17179 </td></tr></table>
17180
17181 !! end
17182
17183 !! test
17184 Table with broken attribute value quoting on consecutive lines
17185 !! input
17186 {|
17187 | title="Hello world|Foo
17188 | style="color:red|Bar
17189 |}
17190 !! result
17191 <table>
17192 <tr>
17193 <td>Foo
17194 </td>
17195 <td>Bar
17196 </td></tr></table>
17197
17198 !! end
17199
17200 !! test
17201 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17202 !! options
17203 parsoid
17204 !! input
17205 {|
17206 | title="Hello world|Foo
17207 | style="color:red|Bar
17208 |}
17209 !! result
17210 <table><tbody>
17211 <tr>
17212 <td title="Hello world">Foo
17213 </td><td style="color: red">Bar
17214 </td></tr></tbody></table>
17215
17216 !! end
17217
17218 !! test
17219 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17220 !! options
17221 parsoid
17222 !! input
17223 {{}}
17224 !! result
17225 {{}}
17226 !! end
17227
17228 !! test
17229 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17230 !! options
17231 parsoid
17232 !! input
17233 }}{{
17234 !! result
17235 }}{{
17236 !! end
17237
17238 !!test
17239 Accept empty td cell attribute
17240 !!input
17241 {|
17242 | align="center" | foo || |
17243 |}
17244 !!result
17245 <table>
17246 <tr>
17247 <td align="center"> foo </td>
17248 <td>
17249 </td></tr></table>
17250
17251 !!end
17252
17253 !!test
17254 Non-empty attributes in th-cells
17255 !!input
17256 {|
17257 ! Foo !! style="color: red" | Bar
17258 |}
17259 !!result
17260 <table>
17261 <tr>
17262 <th> Foo </th>
17263 <th style="color: red"> Bar
17264 </th></tr></table>
17265
17266 !!end
17267
17268 !!test
17269 Accept empty attributes in th-cells
17270 !!input
17271 {|
17272 !| foo !!| bar
17273 |}
17274 !!result
17275 <table>
17276 <tr>
17277 <th> foo </th>
17278 <th> bar
17279 </th></tr></table>
17280
17281 !!end
17282
17283 !!test
17284 Empty table rows go away
17285 !!input
17286 {|
17287 | Hello
17288 | there
17289 |- class="foo"
17290 |-
17291 |}
17292 !! result
17293 <table>
17294 <tr>
17295 <td> Hello
17296 </td>
17297 <td> there
17298 </td></tr>
17299
17300 </table>
17301
17302 !! end
17303
17304 ###
17305 ### Parsoid-centric tests for testing RTing of inter-element separators
17306 ### Edge cases not tested by existing parser tests and specific to
17307 ### Parsoid-specific serialization strategies.
17308 ###
17309
17310 !!test
17311 RT-ed inter-element separators should be valid separators
17312 !!input
17313 {|
17314 |- [[foo]]
17315 |}
17316 !!result
17317 <table>
17318
17319 </table>
17320
17321 !!end
17322
17323 !!test
17324 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17325 (Parsoid-only since PHP parser relies on Tidy for correct output)
17326 !!options
17327 parsoid
17328 !!input
17329 {|
17330 |<small>foo
17331 bar
17332 |}
17333
17334 {|
17335 |<small>foo<small>
17336 |}
17337 !!result
17338 !!end
17339
17340 !!test
17341 Empty TD followed by TD with tpl-generated attribute
17342 !!input
17343 {|
17344 |-
17345 |
17346 |{{echo|style='color:red'}}|foo
17347 |}
17348 !!result
17349 <table>
17350
17351 <tr>
17352 <td>
17353 </td>
17354 <td>foo
17355 </td></tr></table>
17356
17357 !!end
17358
17359 !!test
17360 Indented table with an empty td
17361 !!input
17362 {|
17363 |-
17364 |
17365 |foo
17366 |}
17367 !!result
17368 <table>
17369
17370 <tr>
17371 <td>
17372 </td>
17373 <td>foo
17374 </td></tr></table>
17375
17376 !!end
17377
17378 !!test
17379 Empty TR followed by a template-generated TR
17380 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
17381 !!options
17382 parsoid
17383 !!input
17384 {|
17385 |-
17386 {{echo|<tr><td>foo</td></tr>}}
17387 |}
17388 !!result
17389 <table>
17390 <tbody>
17391 <tr></tr>
17392 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
17393 <td>foo</td></tr>
17394 </tbody></table>
17395 !!end
17396
17397 ## PHP and parsoid output differ for this, and since this is primarily
17398 ## for testing Parsoid's serializer, marking this Parsoid only
17399 !!test
17400 Empty TR followed by mixed-ws-comment line should RT correctly
17401 !!options
17402 parsoid
17403 !!input
17404 {|
17405 |-
17406 <!--c-->
17407 |-
17408 <!--c--> <!--d-->
17409 |}
17410 !!result
17411 <table>
17412 <tbody>
17413 <tr></tr>
17414 <!--c-->
17415 <tr>
17416 <!--c--> </tr><!--d-->
17417 </tbody></table>
17418
17419 !!end
17420
17421 !!test
17422 Multi-line image caption generated by templates with/without trailing newlines
17423 !!options
17424 parsoid
17425 !!input
17426 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
17427 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
17428 !!result
17429 <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>
17430 <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>
17431
17432 !!end
17433
17434 ## PHP emits broken html for this, and since this is primarily
17435 ## a Parsoid serializer test, marking this Parsoid only
17436 !!test
17437 Improperly nested inline or quotes tags with whitespace in between
17438 !!options
17439 parsoid
17440 !!input
17441 <span> <s>x</span> </s>
17442 ''' ''x''' ''
17443 !!result
17444 <p><span> <s>x</s></span><s> </s>
17445 <b> <i>x</i></b><i> </i>
17446 </p>
17447 !!end
17448
17449 !!test
17450 Encapsulate protected attributes from wt
17451 !!options
17452 parsoid
17453 !!input
17454 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
17455 !!result
17456 <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>
17457 </body>
17458 !!end
17459
17460 ## Currently the p-wrapper is fragile in how adds / removes transformations.
17461 ## Having nested or stray pre tags results in the attempt to add duplicates,
17462 ## causing an assertion fail. This test tries to prevent that situation.
17463 !!test
17464 Ensure ParagraphWrapper can deal with stray closing pre tags
17465 !!options
17466 parsoid=wt2html
17467 !!input
17468 plain text</pre>
17469 !!result
17470 plain text
17471 !!end
17472
17473 !!test
17474 Ensure fostered text content is wrapped in spans
17475 !!options
17476 parsoid=wt2html
17477 !!input
17478 <table>hi</table><table>ho</table>
17479 !!result
17480 <span>hi</span>
17481 <table></table>
17482 <span>ho</span>
17483 <table></table>
17484 !!end
17485
17486 # -----------------------------------------------------------------
17487 # The following section of tests are primarily to spec requirements
17488 # around serialization of new/edited content.
17489 #
17490 # All these tests are marked Parsoid html2wt and html2html only
17491 # ----------------------------------------------------------------
17492
17493 !! test
17494 Image: Modifying size of an image
17495 !! options
17496 parsoid=html2wt
17497 !! input
17498 [[Image:Wiki.png|230x230px]]
17499 !! result
17500 <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>
17501 !!end
17502
17503 !! test
17504 Image: New block level image should have \n before and after
17505 !! options
17506 parsoid=html2wt
17507 !! input
17508 123
17509 [[File:Wiki.png|right|thumb|150x150px]]
17510 456
17511 !! result
17512 <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>
17513 !!end
17514
17515 # Wacky -- the leading newline in input is required because
17516 # that is what the serializer emits. To be fixed. Not fixing
17517 # the test because this test is required to test serialization of
17518 # new content and preferred whitespace style.
17519 !! test
17520 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
17521 !! options
17522 parsoid=html2wt
17523 !! input
17524
17525 * foo
17526 !! result
17527 <ul>
17528 <li><p>foo</p></li>
17529 </ul>
17530 !! end
17531
17532 # Wacky -- the leading newline in input is required because
17533 # that is what the serializer emits. To be fixed. Not fixing
17534 # the test because this test is required to test serialization of
17535 # new content and preferred whitespace style.
17536 !! test
17537 Lists: Add space after bullets
17538 !! options
17539 parsoid=html2wt
17540 !! input
17541
17542 * foo
17543 * bar
17544 * <span> baz</span>
17545 !! result
17546 <ul>
17547 <li>foo</li>
17548 <li> bar</li>
17549 <li><span> baz</span></li>
17550 </ul>
17551 !! end
17552
17553 !! test
17554 Parsoid: Serialize positional parameters with = in them as named parameter
17555 !! options
17556 parsoid=html2wt
17557 !! input
17558 {{echo|1 = f=oo}}
17559
17560 {{echo|1 = f=oo|2 = bar}}
17561
17562 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17563 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17564 {{echo|<nowiki>f=oo</nowiki>|bar}}
17565 !! result
17566 <p about="#mwt1" typeof="mw:Transclusion"
17567 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
17568
17569 <p about="#mwt1" typeof="mw:Transclusion"
17570 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
17571
17572 <!--Orig params with data-parsoid has heuristics for handling = chars-->
17573 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
17574 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
17575 !! end
17576
17577 !! test
17578 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
17579 !! options
17580 parsoid=html2wt
17581 !! input
17582 <div>a
17583 b
17584 </div>
17585 <div>a
17586 b
17587 </div>
17588 <div>
17589 a
17590
17591 b
17592 </div>
17593 !! result
17594 <div>a<p>b</p></div>
17595 <div>a
17596 <p>b</p></div>
17597 <div>
17598 a
17599 <p>b</p></div>
17600 !! end
17601
17602 #-----------------------------
17603 # I/B quote minimization tests
17604 #-----------------------------
17605
17606 !! test
17607 1. I/B qoute minimization: wikitext-only tags should be combined
17608 !! options
17609 parsoid=html2wt
17610 !! input
17611 ''AB''
17612
17613 '''AB'''
17614
17615 ''A'''B'''''
17616
17617 '''A''B'''''
17618
17619 '''A''BC''D'''
17620 !! result
17621 <p><i>A</i><i>B</i></p>
17622 <p><b>A</b><b>B</b></p>
17623 <p><i>A</i><b><i>B</i></b></p>
17624 <p><b>A</b><i><b>B</b></i></p>
17625 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
17626 !! end
17627
17628 !! test
17629 2. I/B qoute minimization: wikitext and html tags should not be combined
17630 !! options
17631 parsoid=html2wt
17632 !! input
17633 ''A''<i>B</i>
17634
17635 ''A'''''<i>B</i>'''
17636 !! result
17637 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
17638 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
17639 !! end
17640
17641 !! test
17642 3. I/B qoute minimization: templated content stops minimization
17643 !! options
17644 parsoid=html2wt
17645 !! input
17646 ''A''{{echo|''B''}}
17647
17648 ''A''{{echo|'''''B'''''}}
17649 !! result
17650 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
17651 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
17652 !! end
17653
17654 !! test
17655 4. I/B qoute minimization: new content should be mimimized with adjacent old content
17656 !! options
17657 parsoid=html2wt
17658 !! input
17659 ''AB''
17660
17661 '''AB'''
17662
17663 ''A'''B'''''
17664 !! result
17665 <p><i>A</i><i data-parsoid='{}'>B</i></p>
17666 <p><b data-parsoid='{}'>A</b><b>B</b></p>
17667 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
17668 !! end
17669
17670 # -----------------------------------------------------------------
17671 # End of section for Parsoid-only html2wt tests for serialization
17672 # of new content
17673 # -----------------------------------------------------------------
17674
17675 TODO:
17676 more images
17677 more tables
17678 character entities
17679 and much more
17680 Try for 100% code coverage