Merge "mediawiki.Title: Generalise filename-matching in newFromImg"
[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 # notoc disable table of contents
30 #
31 # You can also set the following parser properties via test options:
32 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
33 # wgLinkHolderBatchSize, wgRawHtml
34 #
35 # For testing purposes, temporary articles can created:
36 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
37 # where '/' denotes a newline.
38
39 # This is the standard article assumed to exist.
40 !! article
41 Main Page
42 !! text
43 blah blah
44 !! endarticle
45
46 !!article
47 Template:Foo
48 !!text
49 FOO
50 !!endarticle
51
52 !! article
53 Template:Blank
54 !! text
55 !! endarticle
56
57 !! article
58 Template:pipe
59 !! text
60 |
61 !! endarticle
62
63 !!article
64 MediaWiki:bad image list
65 !!text
66 * [[File:Bad.jpg]] except [[Nasty page]]
67 !!endarticle
68
69 !! article
70 Template:inner list
71 !! text
72 * item 1
73 !! endarticle
74
75 !! article
76 Template:tbl-start
77 !! text
78 {|
79 !! endarticle
80
81 !! article
82 Template:tbl-end
83 !! text
84 |}
85 !! endarticle
86
87 !! article
88 Template:!
89 !! text
90 |
91 !! endarticle
92
93 !! article
94 Template:echo
95 !! text
96 {{{1}}}
97 !! endarticle
98
99 !! article
100 Template:echo_with_span
101 !! text
102 <span>{{{1}}}</span>
103 !! endarticle
104
105 !! article
106 Template:echo_with_div
107 !! text
108 <div>{{{1}}}</div>
109 !! endarticle
110
111 !! article
112 Template:attr_str
113 !! text
114 {{{1}}}="{{{2}}}"
115 !! endarticle
116
117 !! article
118 Template:table_attribs
119 !! text
120 <noinclude>
121 |</noinclude>style="color: red"| Foo
122 !! endarticle
123
124 !! article
125 Template:table_cells
126 !! text
127 {{table_attribs}} || Bar || Baz
128 !! endarticle
129
130 !! article
131 Template:image_attribs
132 !! text
133 <noinclude>
134 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
135 !! endarticle
136
137 !! article
138 A?b
139 !! text
140 Weirdo titles!
141 !! endarticle
142
143 !!article
144 Template:Bullet
145 !!text
146 * Bar
147 !!endarticle
148
149 ###
150 ### Basic tests
151 ###
152 !! test
153 Blank input
154 !! input
155 !! result
156 !! end
157
158
159 !! test
160 Simple paragraph
161 !! input
162 This is a simple paragraph.
163 !! result
164 <p>This is a simple paragraph.
165 </p>
166 !! end
167
168 !! test
169 Paragraphs with extra newline spacing
170 !! input
171 foo
172
173 bar
174
175
176 baz
177
178
179
180 booz
181 !! result
182 <p>foo
183 </p><p>bar
184 </p><p><br />
185 baz
186 </p><p><br />
187 </p><p>booz
188 </p>
189 !! end
190
191 !! test
192 Paragraphs with newline spacing with comment lines in between
193 !! input
194 ----
195 a
196 <!--foo-->
197 b
198 ----
199 a
200 <!--foo--><!--More than 1 comment, still stripped-->
201 b
202 ----
203 a
204 <!--foo--> <!----> <!-- bar -->
205 b
206 ----
207 a
208 <!--foo-->
209
210 b
211 ----
212 a
213
214 <!--foo-->
215 b
216 ----
217 a
218 <!--foo-->
219
220
221 b
222 ----
223 a
224
225
226 <!--foo-->
227 b
228 ----
229 !! result
230 <hr />
231 <p>a
232 b
233 </p>
234 <hr />
235 <p>a
236 b
237 </p>
238 <hr />
239 <p>a
240 b
241 </p>
242 <hr />
243 <p>a
244 </p><p>b
245 </p>
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256 <p>a
257 </p><p><br />
258 b
259 </p>
260 <hr />
261
262 !! end
263
264 !! test
265 Paragraphs with newline spacing with non-empty white-space lines in between
266 !! input
267 ----
268 a
269
270 b
271 ----
272 a
273
274
275 b
276 ----
277 !! result
278 <hr />
279 <p>a
280 </p><p>b
281 </p>
282 <hr />
283 <p>a
284 </p><p><br />
285 b
286 </p>
287 <hr />
288
289 !! end
290
291 !! test
292 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
293 !! input
294 ----
295 a
296 <!--foo-->
297 b
298 ----
299 a
300 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
301 b
302 ----
303 a
304
305 <!--foo-->
306 <!--bar-->
307 b
308 ----
309 a
310
311 <!--foo-->
312 <!--bar-->
313
314 b
315 ----
316 !! result
317 <hr />
318 <p>a
319 b
320 </p>
321 <hr />
322 <p>a
323 b
324 </p>
325 <hr />
326 <p>a
327 </p><p>b
328 </p>
329 <hr />
330 <p>a
331 </p><p><br />
332 b
333 </p>
334 <hr />
335
336 !! end
337
338 !! test
339 Extra newlines: More paragraphs with indented comment
340 !! input
341 a
342
343 <!--boo-->
344
345 b
346 !!result
347 <p>a
348 </p><p><br />
349 b
350 </p>
351 !!end
352
353 !! test
354 Extra newlines followed by heading
355 !! input
356 a
357
358
359
360 =b=
361 [[a]]
362
363
364 =b=
365 !! result
366 <p>a
367 </p><p><br />
368 </p>
369 <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>
370 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
371 </p><p><br />
372 </p>
373 <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>
374
375 !! end
376
377 !! test
378 Extra newlines between heading and content are swallowed
379 !! input
380 =b=
381
382
383
384 [[a]]
385 !! result
386 <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>
387 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
388 </p>
389 !! end
390
391 !! test
392 Parsing an URL
393 !! input
394 http://fr.wikipedia.org/wiki/🍺
395 <!-- EasterEgg we love beer, better be able be able to link to it -->
396 !! result
397 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
398 </p>
399 !! end
400
401 !! test
402 Simple list
403 !! input
404 * Item 1
405 * Item 2
406 !! result
407 <ul>
408 <li> Item 1
409 </li>
410 <li> Item 2
411 </li>
412 </ul>
413
414 !! end
415
416 !! test
417 Italics and bold
418 !! input
419 * plain
420 * plain''italic''plain
421 * plain''italic''plain''italic''plain
422 * plain'''bold'''plain
423 * plain'''bold'''plain'''bold'''plain
424 * plain''italic''plain'''bold'''plain
425 * plain'''bold'''plain''italic''plain
426 * plain''italic'''bold-italic'''italic''plain
427 * plain'''bold''bold-italic''bold'''plain
428 * plain'''''bold-italic'''italic''plain
429 * plain'''''bold-italic''bold'''plain
430 * plain''italic'''bold-italic'''''plain
431 * plain'''bold''bold-italic'''''plain
432 * plain l'''italic''plain
433 * plain l''''bold''' plain
434 !! result
435 <ul>
436 <li> plain
437 </li>
438 <li> plain<i>italic</i>plain
439 </li>
440 <li> plain<i>italic</i>plain<i>italic</i>plain
441 </li>
442 <li> plain<b>bold</b>plain
443 </li>
444 <li> plain<b>bold</b>plain<b>bold</b>plain
445 </li>
446 <li> plain<i>italic</i>plain<b>bold</b>plain
447 </li>
448 <li> plain<b>bold</b>plain<i>italic</i>plain
449 </li>
450 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
451 </li>
452 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
453 </li>
454 <li> plain<i><b>bold-italic</b>italic</i>plain
455 </li>
456 <li> plain<b><i>bold-italic</i>bold</b>plain
457 </li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain
459 </li>
460 <li> plain<b>bold<i>bold-italic</i></b>plain
461 </li>
462 <li> plain l'<i>italic</i>plain
463 </li>
464 <li> plain l'<b>bold</b> plain
465 </li>
466 </ul>
467
468 !! end
469
470 # this example taken from the [[simple:Moon]] article (bug 47326)
471 !! test
472 Italics and possessives (1)
473 !! input
474 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
475 !! result
476 <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
477 </p>
478 !! end
479
480 # this example taken from [[en:Flaming Pie]] (bug 49926)
481 !! test
482 Italics and possessives (2)
483 !! input
484 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
485 !! result
486 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
487 </p>
488 !! end
489
490 # this example taken from [[en:Dictionary]] (bug 49926)
491 !! test
492 Italics and possessives (3)
493 !! input
494 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''.
495 !! result
496 <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>.
497 </p>
498 !! end
499
500
501 ###
502 ### 2-quote opening sequence tests
503 ###
504 !! test
505 Italics and bold: 2-quote opening sequence: (2,2)
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,3)
516 !! input
517 ''foo'''
518 !! result
519 <p><i>foo'</i>
520 </p>
521 !!end
522
523
524 !! test
525 Italics and bold: 2-quote opening sequence: (2,4)
526 !! input
527 ''foo''''
528 !! result
529 <p><i>foo''</i>
530 </p>
531 !!end
532
533
534 !! test
535 Italics and bold: 2-quote opening sequence: (2,5) (php)
536 !! options
537 php
538 !! input
539 ''foo'''''
540 !! result
541 <p><i>foo</i>
542 </p>
543 !!end
544 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
547 !! options
548 parsoid
549 !! input
550 ''foo'''''
551 !! result
552 <p><i>foo</i><b></b>
553 </p>
554 !!end
555
556
557 ###
558 ### 3-quote opening sequence tests
559 ###
560
561 !! test
562 Italics and bold: 3-quote opening sequence: (3,2)
563 !! input
564 '''foo''
565 !! result
566 <p>'<i>foo</i>
567 </p>
568 !!end
569
570
571 !! test
572 Italics and bold: 3-quote opening sequence: (3,3)
573 !! input
574 '''foo'''
575 !! result
576 <p><b>foo</b>
577 </p>
578 !!end
579
580
581 !! test
582 Italics and bold: 3-quote opening sequence: (3,4)
583 !! input
584 '''foo''''
585 !! result
586 <p><b>foo'</b>
587 </p>
588 !!end
589
590
591 !! test
592 Italics and bold: 3-quote opening sequence: (3,5) (php)
593 !! options
594 php
595 !! input
596 '''foo'''''
597 !! result
598 <p><b>foo</b>
599 </p>
600 !!end
601 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
602 !! test
603 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
604 !! options
605 parsoid
606 !! input
607 '''foo'''''
608 !! result
609 <p><b>foo</b><i></i>
610 </p>
611 !!end
612
613
614 ###
615 ### 4-quote opening sequence tests
616 ###
617
618 !! test
619 Italics and bold: 4-quote opening sequence: (4,2)
620 !! input
621 ''''foo''
622 !! result
623 <p>''<i>foo</i>
624 </p>
625 !!end
626
627
628 !! test
629 Italics and bold: 4-quote opening sequence: (4,3)
630 !! input
631 ''''foo'''
632 !! result
633 <p>'<b>foo</b>
634 </p>
635 !!end
636
637
638 !! test
639 Italics and bold: 4-quote opening sequence: (4,4)
640 !! input
641 ''''foo''''
642 !! result
643 <p>'<b>foo'</b>
644 </p>
645 !!end
646
647
648 !! test
649 Italics and bold: 4-quote opening sequence: (4,5) (php)
650 !! options
651 php
652 !! input
653 ''''foo'''''
654 !! result
655 <p>'<b>foo</b>
656 </p>
657 !!end
658 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
659 !! test
660 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
661 !! options
662 parsoid
663 !! input
664 ''''foo'''''
665 !! result
666 <p>'<b>foo</b><i></i>
667 </p>
668 !!end
669
670
671 ###
672 ### 5-quote opening sequence tests
673 ###
674
675 !! test
676 Italics and bold: 5-quote opening sequence: (5,2)
677 !! options
678 !! input
679 '''''foo''
680 !! result
681 <p><b><i>foo</i></b>
682 </p>
683 !!end
684
685
686 !! test
687 Italics and bold: 5-quote opening sequence: (5,3)
688 !! input
689 '''''foo'''
690 !! result
691 <p><i><b>foo</b></i>
692 </p>
693 !!end
694
695
696 !! test
697 Italics and bold: 5-quote opening sequence: (5,4)
698 !! input
699 '''''foo''''
700 !! result
701 <p><i><b>foo'</b></i>
702 </p>
703 !!end
704
705
706 !! test
707 Italics and bold: 5-quote opening sequence: (5,5)
708 !! input
709 '''''foo'''''
710 !! result
711 <p><i><b>foo</b></i>
712 </p>
713 !!end
714
715 ###
716 ### multiple quote sequences in a line
717 ###
718 !! test
719 Italics and bold: multiple quote sequences: (2,4,2)
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: (2,4,3)
730 !! input
731 ''foo''''bar'''
732 !! result
733 <p><i>foo'<b>bar</b></i>
734 </p>
735 !!end
736
737
738 !! test
739 Italics and bold: multiple quote sequences: (2,4,4)
740 !! input
741 ''foo''''bar''''
742 !! result
743 <p><i>foo'<b>bar'</b></i>
744 </p>
745 !!end
746
747
748 !! test
749 Italics and bold: multiple quote sequences: (3,4,2) (php)
750 !! options
751 php
752 !! input
753 '''foo''''bar''
754 !! result
755 <p><b>foo'</b>bar
756 </p>
757 !!end
758 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
759 !! test
760 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
761 !! options
762 parsoid
763 !! input
764 '''foo''''bar''
765 !! result
766 <p><b>foo'</b>bar<i></i>
767 </p>
768 !!end
769
770
771 !! test
772 Italics and bold: multiple quote sequences: (3,4,3) (php)
773 !! options
774 php
775 !! input
776 '''foo''''bar'''
777 !! result
778 <p><b>foo'</b>bar
779 </p>
780 !!end
781 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
782 !! test
783 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''foo''''bar'''
788 !! result
789 <p><b>foo'</b>bar<b></b>
790 </p>
791 !!end
792
793 ###
794 ### other quote tests
795 ###
796 !! test
797 Italics and bold: other quote tests: (2,3,5)
798 !! input
799 ''this is about '''foo's family'''''
800 !! result
801 <p><i>this is about <b>foo's family</b></i>
802 </p>
803 !!end
804
805
806 !! test
807 Italics and bold: other quote tests: (2,(3,3),2)
808 !! input
809 ''this is about '''foo's''' family''
810 !! result
811 <p><i>this is about <b>foo's</b> family</i>
812 </p>
813 !!end
814
815
816 !! test
817 Italics and bold: other quote tests: (3,2,3,2)
818 !! input
819 '''this is about ''foo'''s family''
820 !! result
821 <p><b>this is about <i>foo</i></b><i>s family</i>
822 </p>
823 !!end
824
825
826 !! test
827 Italics and bold: other quote tests: (3,2,3,3)
828 !! options
829 !! input
830 '''this is about ''foo'''s family'''
831 !! result
832 <p>'<i>this is about </i>foo<b>s family</b>
833 </p>
834 !!end
835
836
837 !! test
838 Italics and bold: other quote tests: (3,(2,2),3)
839 !! input
840 '''this is about ''foo's'' family'''
841 !! result
842 <p><b>this is about <i>foo's</i> family</b>
843 </p>
844 !!end
845
846
847 !! test
848 Italicized possessive
849 !! input
850 The ''[[Main Page]]'''s talk page.
851 !! result
852 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
853 </p>
854 !! end
855
856 !! test
857 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
858 (Requires tidy for PHP parser output to be fixed up)
859 !! options
860 parsoid=wt2html,wt2wt
861 !! input
862 {|
863 !''a!!''b
864 |''a||''b
865 |}
866 !! result
867 <table>
868 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
869 <td><i>a</i></td><td><i>b</i></td></tr>
870 </tbody></table>
871 !! end
872
873 ###
874 ### Non-html5 tags
875 ###
876
877 !! test
878 Non-html5 tags should be accepted
879 !! input
880 <center>''foo''</center>
881 <big>''foo''</big>
882 <font>''foo''</font>
883 <strike>''foo''</strike>
884 <tt>''foo''</tt>
885 !! result
886 <center><i>foo</i></center>
887 <p><big><i>foo</i></big>
888 <font><i>foo</i></font>
889 <strike><i>foo</i></strike>
890 <tt><i>foo</i></tt>
891 </p>
892 !! end
893
894 !! test
895 <wbr> is valid wikitext (bug 52468)
896 !! input
897 <wbr>
898 !! result
899 <p><wbr />
900 </p>
901 !! end
902
903 # <strike> is HTML4, <s> is HTML4/5.
904 !! test
905 <s> or <strike> for strikethrough
906 !! input
907 <strike>strike</strike>
908
909 <s>s</s>
910 !! result
911 <p><strike>strike</strike>
912 </p><p><s>s</s>
913 </p>
914 !! end
915
916 !! test
917 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
918 !! input
919 <b→> doesn't work! </b>
920
921 <bä> doesn't work! </b>
922
923 <boo> works fine </b>
924
925 <s.foo>foo</s>
926
927 <s.foo>s.foo</s.foo>
928
929 <sub-ID#1>
930 !! result
931 <p>&lt;b→&gt; doesn't work! &lt;/b&gt;
932 </p><p>&lt;bä&gt; doesn't work! &lt;/b&gt;
933 </p><p>&lt;boo&gt; works fine &lt;/b&gt;
934 </p><p>&lt;s.foo&gt;foo&lt;/s&gt;
935 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
936 </p><p>&lt;sub-ID#1&gt;
937 </p>
938 !! end
939
940 ###
941 ### Special characters
942 ###
943
944 !! test
945 Bare pipe character (bug 52363)
946 !! input
947 |
948 !! result
949 <p>|
950 </p>
951 !! end
952
953 !! test
954 Bare pipe character from a template (bug 52363)
955 !! input
956 {{pipe}}
957 !! result
958 <p>|
959 </p>
960 !! end
961
962 ###
963 ### <nowiki> test cases
964 ###
965
966 !! test
967 <nowiki> unordered list
968 !! input
969 <nowiki>* This is not an unordered list item.</nowiki>
970 !! result
971 <p>* This is not an unordered list item.
972 </p>
973 !! end
974
975 !! test
976 <nowiki> spacing
977 !! input
978 <nowiki>Lorem ipsum dolor
979
980 sed abit.
981 sed nullum.
982
983 :and a colon
984 </nowiki>
985 !! result
986 <p>Lorem ipsum dolor
987
988 sed abit.
989 sed nullum.
990
991 :and a colon
992
993 </p>
994 !! end
995
996 !! test
997 nowiki 3
998 !! input
999 :There is not nowiki.
1000 :There is <nowiki>nowiki</nowiki>.
1001
1002 #There is not nowiki.
1003 #There is <nowiki>nowiki</nowiki>.
1004
1005 *There is not nowiki.
1006 *There is <nowiki>nowiki</nowiki>.
1007 !! result
1008 <dl>
1009 <dd>There is not nowiki.
1010 </dd>
1011 <dd>There is nowiki.
1012 </dd>
1013 </dl>
1014 <ol>
1015 <li>There is not nowiki.
1016 </li>
1017 <li>There is nowiki.
1018 </li>
1019 </ol>
1020 <ul>
1021 <li>There is not nowiki.
1022 </li>
1023 <li>There is nowiki.
1024 </li>
1025 </ul>
1026
1027 !! end
1028
1029 !! test
1030 Entities inside <nowiki>
1031 !! input
1032 <nowiki>&lt;</nowiki>
1033 !! result
1034 <p>&lt;
1035 </p>
1036 !! end
1037
1038 !! test
1039 Entities inside template parameters
1040 !! options
1041 parsoid
1042 !! input
1043 {{echo|&ndash;}}
1044 !! result
1045 <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>
1046 </p>
1047 !! end
1048
1049 ###
1050 ### Comments
1051 ###
1052 !! test
1053 Comments and Indent-Pre
1054 !! input
1055 <!-- comment 1 --> asdf
1056
1057 <!-- comment 1 --> asdf
1058 <!-- comment 2 -->
1059
1060 <!-- comment 1 --> asdf
1061 <!-- comment 2 -->xyz
1062
1063 <!-- comment 1 --> asdf
1064 <!-- comment 2 --> xyz
1065 !! result
1066 <pre>asdf
1067 </pre>
1068 <pre>asdf
1069 </pre>
1070 <pre>asdf
1071 </pre>
1072 <p>xyz
1073 </p>
1074 <pre>asdf
1075 xyz
1076 </pre>
1077 !! end
1078
1079 !! test
1080 Comment test 2a
1081 !! input
1082 asdf
1083 <!-- comment 1 -->
1084 jkl
1085 !! result
1086 <p>asdf
1087 jkl
1088 </p>
1089 !! end
1090
1091 !! test
1092 Comment test 2b
1093 !! input
1094 asdf
1095 <!-- comment 1 -->
1096
1097 jkl
1098 !! result
1099 <p>asdf
1100 </p><p>jkl
1101 </p>
1102 !! end
1103
1104 !! test
1105 Comment test 3
1106 !! input
1107 asdf
1108 <!-- comment 1 -->
1109 <!-- comment 2 -->
1110 jkl
1111 !! result
1112 <p>asdf
1113 jkl
1114 </p>
1115 !! end
1116
1117 !! test
1118 Comment test 4
1119 !! input
1120 asdf<!-- comment 1 -->jkl
1121 !! result
1122 <p>asdfjkl
1123 </p>
1124 !! end
1125
1126 !! test
1127 Comment spacing
1128 !! input
1129 a
1130 <!-- foo --> b <!-- bar -->
1131 c
1132 !! result
1133 <p>a
1134 </p>
1135 <pre> b
1136 </pre>
1137 <p>c
1138 </p>
1139 !! end
1140
1141 !! test
1142 Comment whitespace
1143 !! input
1144 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1145 !! result
1146
1147 !! end
1148
1149 !! test
1150 Comment semantics and delimiters
1151 !! input
1152 <!-- --><!----><!-----><!------>
1153 !! result
1154
1155 !! end
1156
1157 !! test
1158 Comment semantics and delimiters, redux
1159 !! input
1160 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1161 -- foo -- funky huh? ... -->
1162 !! result
1163
1164 !! end
1165
1166 !! test
1167 Comment semantics and delimiters: directors cut
1168 !! input
1169 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1170 everything starting with < followed by !-- until the first -- and > we see,
1171 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1172 -->-->
1173 !! result
1174 <p>--&gt;
1175 </p>
1176 !! end
1177
1178 !! test
1179 Comment semantics: nesting
1180 !! input
1181 <!--<!-- no, we're not going to do anything fancy here -->-->
1182 !! result
1183 <p>--&gt;
1184 </p>
1185 !! end
1186
1187 !! test
1188 Comment semantics: unclosed comment at end
1189 !! input
1190 <!--This comment will run out to the end of the document
1191 !! result
1192
1193 !! end
1194
1195 !! test
1196 Comment in template title
1197 !! input
1198 {{f<!---->oo}}
1199 !! result
1200 <p>FOO
1201 </p>
1202 !! end
1203
1204 !! test
1205 Comment on its own line post-expand
1206 !! input
1207 a
1208 {{blank}}<!---->
1209 b
1210 !! result
1211 <p>a
1212 </p><p>b
1213 </p>
1214 !! end
1215
1216 !! test
1217 Comment on its own line post-expand with non-significant whitespace
1218 !! input
1219 a
1220 {{blank}} <!---->
1221 b
1222 !! result
1223 <p>a
1224 </p><p>b
1225 </p>
1226 !! end
1227
1228 ###
1229 ### paragraph wrapping tests
1230 ###
1231 !! test
1232 No block tags
1233 !! input
1234 a
1235
1236 b
1237 !! result
1238 <p>a
1239 </p><p>b
1240 </p>
1241 !! end
1242
1243 !! test
1244 Block tag on one line (<div>)
1245 !! input
1246 a <div>foo</div>
1247
1248 b
1249 !! result
1250 a <div>foo</div>
1251 <p>b
1252 </p>
1253 !! end
1254
1255 !! test
1256 Block tag on one line (<blockquote>)
1257 !! input
1258 a <blockquote>foo</blockquote>
1259
1260 b
1261 !! result
1262 a <blockquote>foo</blockquote>
1263 <p>b
1264 </p>
1265 !! end
1266
1267 !! test
1268 Block tag on both lines (<div>)
1269 !! input
1270 a <div>foo</div>
1271
1272 b <div>foo</div>
1273 !! result
1274 a <div>foo</div>
1275 b <div>foo</div>
1276
1277 !! end
1278
1279 !! test
1280 Block tag on both lines (<blockquote>)
1281 !! input
1282 a <blockquote>foo</blockquote>
1283
1284 b <blockquote>foo</blockquote>
1285 !! result
1286 a <blockquote>foo</blockquote>
1287 b <blockquote>foo</blockquote>
1288
1289 !! end
1290
1291 !! test
1292 Multiple lines without block tags
1293 !! input
1294 <div>foo</div> a
1295 b
1296 c
1297 d<!--foo--> e
1298 x <div>foo</div> z
1299 !! result
1300 <div>foo</div> a
1301 <p>b
1302 c
1303 d e
1304 </p>
1305 x <div>foo</div> z
1306
1307 !! end
1308
1309 !! test
1310 Empty lines between lines with block tags
1311 !! input
1312 <div></div>
1313
1314
1315 <div></div>a
1316
1317 b
1318 <div>a</div>b
1319
1320 <div>b</div>d
1321
1322
1323 <div>e</div>
1324 !! result
1325 <div></div>
1326 <p><br />
1327 </p>
1328 <div></div>a
1329 <p>b
1330 </p>
1331 <div>a</div>b
1332 <div>b</div>d
1333 <p><br />
1334 </p>
1335 <div>e</div>
1336
1337 !! end
1338
1339 ###
1340 ### Preformatted text
1341 ###
1342 !! test
1343 Preformatted text
1344 !! input
1345 This is some
1346 Preformatted text
1347 With ''italic''
1348 And '''bold'''
1349 And a [[Main Page|link]]
1350 !! result
1351 <pre>This is some
1352 Preformatted text
1353 With <i>italic</i>
1354 And <b>bold</b>
1355 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1356 </pre>
1357 !! end
1358
1359 !! test
1360 Tabs don't trigger preformatted text
1361 !! input
1362 This is not
1363 preformatted text.
1364 This is preformatted text.
1365 So is this.
1366 !! result
1367 <p> This is not
1368 preformatted text.
1369 </p>
1370 <pre>This is preformatted text.
1371 So is this.
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Ident preformatting with inline content
1377 !! input
1378 a
1379 ''b''
1380 !! result
1381 <pre>a
1382 <i>b</i>
1383 </pre>
1384 !! end
1385
1386 !! test
1387 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1388 !! input
1389 <pre><nowiki>
1390 <b>
1391 <cite>
1392 <em>
1393 </nowiki></pre>
1394 !! result
1395 <pre>
1396 &lt;b&gt;
1397 &lt;cite&gt;
1398 &lt;em&gt;
1399 </pre>
1400
1401 !! end
1402
1403 !! test
1404 Regression with preformatted in <center>
1405 !! input
1406 <center>
1407 Blah
1408 </center>
1409 !! result
1410 <center>
1411 <pre>Blah
1412 </pre>
1413 </center>
1414
1415 !! end
1416
1417 !! test
1418 Bug 52763: Preformatted in <blockquote>
1419 !! input
1420 <blockquote>
1421 Blah
1422 </blockquote>
1423 !! result
1424 <blockquote>
1425 <p> Blah
1426 </p>
1427 </blockquote>
1428
1429 !! end
1430
1431 !! test
1432 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1433 !! input
1434 <blockquote>
1435 Foo
1436
1437 Bar
1438 </blockquote>
1439 !! result
1440 <blockquote>
1441 <p>Foo
1442 </p><p>Bar
1443 </p>
1444 </blockquote>
1445
1446 !! end
1447
1448 !! test
1449 Bug 15491: <ins>/<del> in blockquote
1450 !! input
1451 <blockquote>
1452 Foo <del>bar</del> <ins>baz</ins> quux
1453 </blockquote>
1454 !! result
1455 <blockquote>
1456 <p>Foo <del>bar</del> <ins>baz</ins> quux
1457 </p>
1458 </blockquote>
1459
1460 !! end
1461
1462 # Note that the p-wrapping is newline sensitive, which could be
1463 # considered a bug: tidy will wrap only the 'Foo' in the example
1464 # below in a <p> tag. (see comment 23-25 of bug #6200)
1465 !! test
1466 Bug 15491: <ins>/<del> in blockquote (2)
1467 !! input
1468 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1469 </blockquote>
1470 !! result
1471 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1472 </blockquote>
1473
1474 !! end
1475
1476 !! test
1477 <pre> with attributes (bug 3202)
1478 !! input
1479 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1480 !! result
1481 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1482
1483 !! end
1484
1485 !! test
1486 <pre> with width attribute (bug 3202)
1487 !! input
1488 <pre width="8">Narrow screen goodies</pre>
1489 !! result
1490 <pre width="8">Narrow screen goodies</pre>
1491
1492 !! end
1493
1494 !! test
1495 <pre> with forbidden attribute (bug 3202)
1496 !! input
1497 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1498 !! result
1499 <pre width="8">Narrow screen goodies</pre>
1500
1501 !! end
1502
1503 !! test
1504 Entities inside <pre>
1505 !! input
1506 <pre>&lt;</pre>
1507 !! result
1508 <pre>&lt;</pre>
1509
1510 !! end
1511
1512 !! test
1513 <pre> with forbidden attribute values (bug 3202)
1514 !! input
1515 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1516 !! result
1517 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1518
1519 !! end
1520
1521 !! test
1522 <nowiki> inside <pre> (bug 13238)
1523 !! input
1524 <pre>
1525 <nowiki>
1526 </pre>
1527 <pre>
1528 <nowiki></nowiki>
1529 </pre>
1530 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1531 !! result
1532 <pre>
1533 &lt;nowiki&gt;
1534 </pre>
1535 <pre>
1536
1537 </pre>
1538 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1539
1540 !! end
1541
1542 !! test
1543 <nowiki> and <pre> preference (first one wins)
1544 !! input
1545 <pre>
1546 <nowiki>
1547 </pre>
1548 </nowiki>
1549 </pre>
1550
1551 <nowiki>
1552 <pre>
1553 <nowiki>
1554 </pre>
1555 </nowiki>
1556 </pre>
1557
1558 !! result
1559 <pre>
1560 &lt;nowiki&gt;
1561 </pre>
1562 <p>&lt;/nowiki&gt;
1563 &lt;/pre&gt;
1564 </p><p>
1565 &lt;pre&gt;
1566 &lt;nowiki&gt;
1567 &lt;/pre&gt;
1568
1569 &lt;/pre&gt;
1570 </p>
1571 !! end
1572
1573 !! test
1574 </pre> inside nowiki
1575 !! input
1576 <nowiki></pre></nowiki>
1577 !! result
1578 <p>&lt;/pre&gt;
1579 </p>
1580 !! end
1581
1582 !!test
1583 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1584 !!input
1585 {{echo|}}
1586 !!result
1587
1588 !!end
1589
1590 !!test
1591 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1592 !!input
1593 {{echo|
1594 foo}}
1595 !!result
1596 <p>foo
1597 </p>
1598 !!end
1599
1600 !! test
1601 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1602 !! input
1603 {{echo|a
1604 b}}
1605 !!result
1606 <pre>a
1607 </pre>
1608 <p>b
1609 </p>
1610 !!end
1611
1612 !! test
1613 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1614 !! input
1615 {{echo|a
1616 b
1617 c
1618 d
1619 e
1620 }}
1621 !!result
1622 <pre>a
1623 </pre>
1624 <p>b
1625 c
1626 </p>
1627 <pre>d
1628 </pre>
1629 <p>e
1630 </p>
1631 !!end
1632
1633 !!test
1634 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1635 !!input
1636 {{echo| foo}}
1637
1638 {{echo| foo}}{{echo| bar}}
1639
1640 {{echo| foo}}
1641 {{echo| bar}}
1642
1643 {{echo|<!--cmt--> foo}}
1644
1645 <!--cmt-->{{echo| foo}}
1646
1647 {{echo|{{echo| }}bar}}
1648 !!result
1649 <pre>foo
1650 </pre>
1651 <pre>foo bar
1652 </pre>
1653 <pre>foo
1654 bar
1655 </pre>
1656 <pre>foo
1657 </pre>
1658 <pre>foo
1659 </pre>
1660 <pre>bar
1661 </pre>
1662 !!end
1663
1664 !! test
1665 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1666 !! input
1667 {{echo| }}a
1668
1669 {{echo|
1670 }}a
1671
1672 {{echo|
1673 b}}
1674
1675 {{echo|a
1676 }}b
1677
1678 {{echo|a
1679 }} b
1680 !!result
1681 <pre>a
1682 </pre>
1683 <p><br />
1684 </p>
1685 <pre>a
1686 </pre>
1687 <p><br />
1688 </p>
1689 <pre>b
1690 </pre>
1691 <p>a
1692 </p>
1693 <pre>b
1694 </pre>
1695 <p>a
1696 </p>
1697 <pre>b
1698 </pre>
1699 !!end
1700
1701 # TODO / maybe: fix wt2wt for this
1702 !! test
1703 Parsoid: Don't paragraph-wrap fosterable content
1704 !! options
1705 parsoid=wt2html
1706 !! input
1707 {|
1708 <td></td>
1709 <td></td>
1710
1711
1712
1713 |}
1714 !! result
1715 <table>
1716
1717 <tbody>
1718 <tr>
1719 <td></td>
1720
1721 <td></td></tr>
1722
1723
1724
1725 </tbody></table>
1726 !! end
1727
1728 !! test
1729 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
1730 !! options
1731 parsoid=wt2html
1732 !! input
1733 {|
1734 <td>
1735 <td>
1736 </td>
1737
1738
1739
1740 |}
1741 !! result
1742 <table>
1743
1744 <tbody>
1745 <tr>
1746 <td></td>
1747
1748 <td>
1749 </td></tr>
1750
1751
1752
1753 </tbody></table>
1754 !! end
1755
1756
1757 #--------------------------------------------------------------------
1758 # Transclusion parameter whitespace stripping tests
1759 # Behavior is different for positional and named parameters
1760 #--------------------------------------------------------------------
1761 !! test
1762 Templates: Strip leading and trailing whitespace from named-param values
1763 !! input
1764 {{echo|1= a }}
1765
1766 {{echo|1= {{echo|b}} }}
1767
1768 {{echo| 1 =
1769 c }}
1770
1771 {{echo| 1 =
1772 * d
1773 }}
1774 !! result
1775 <p>a
1776 </p><p>b
1777 </p><p>c
1778 </p>
1779 <ul>
1780 <li> d
1781 </li>
1782 </ul>
1783
1784 !! end
1785
1786 !! test
1787 Templates: Don't strip whitespace from positional-param values
1788 !! input
1789 {{echo|a }}
1790
1791 {{echo|{{echo|b}} }}
1792
1793 {{echo| c
1794 }}
1795
1796 {{echo| {{echo|d}}
1797 }}
1798
1799 {{echo|
1800 e}}
1801
1802 {{echo|
1803 * f}}
1804
1805 {{echo|
1806 }}g
1807 !! result
1808 <p>a
1809 </p><p>b
1810 </p>
1811 <pre>c
1812 </pre>
1813 <p><br />
1814 </p>
1815 <pre>d
1816 </pre>
1817 <p><br />
1818 </p>
1819 <pre>e
1820 </pre>
1821 <p><br />
1822 </p>
1823 <ul>
1824 <li> f
1825 </li>
1826 </ul>
1827 <p><br />
1828 </p>
1829 <pre>g
1830 </pre>
1831 !! end
1832
1833 !! test
1834 Templates: Handle empty comment-and-ws-only lines correctly
1835 !! input
1836 {{echo|foo
1837 <!--should be ignored-->
1838 <!--should be ignored as well-->
1839 bar}}
1840 !! result
1841 <p>foo
1842 bar
1843 </p>
1844 !! end
1845
1846 #--------------------------------------------------------------------
1847 # Transclusion parameter escaping tests
1848 #--------------------------------------------------------------------
1849 !! test
1850 Templates: Parsoid parameter escaping test 1
1851 !! options
1852 parsoid
1853 !! input
1854 {{echo|[foo]|{{echo|[bar]}}}}
1855 !! result
1856 <p about="#mwt1" typeof="mw:Transclusion"
1857 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
1858 !! end
1859
1860 !! test
1861 Parsoid: Pipes in external links in template parameter
1862 !! options
1863 parsoid
1864 !! input
1865 {{echo|[{{echo|http://example.com}} link]}}
1866 !! result
1867 <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>
1868 !! end
1869
1870 !! test
1871 Parsoid: pipe in transclusion parameter
1872 !! options
1873 parsoid
1874 !! input
1875 {{echo|http://foo.com/a&#124;b}}
1876 !! result
1877 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1878 typeof="mw:Transclusion"
1879 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>
1880 !! end
1881
1882 !! test
1883 Parsoid: Pipe in external link target and content in template parameter
1884 !! options
1885 parsoid=html2wt,wt2wt
1886 !! input
1887 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1888 !! result
1889 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1890 typeof="mw:Transclusion"
1891 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
1892 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1893 !! end
1894
1895 !! test
1896 Templates: Dont escape already nowiki-escaped text in template parameters
1897 !! options
1898 parsoid=html2wt,wt2wt
1899 !! input
1900 {{echo|foo<nowiki>|</nowiki>bar}}
1901 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1902 {{echo|<nowiki></nowiki>}}
1903 !! result
1904 <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>
1905 <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>
1906 <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>
1907 </p>
1908 !! end
1909
1910 ## Bug 52824
1911 !! test
1912 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1913 !! options
1914 parsoid=html2wt,wt2wt
1915 !! input
1916 {{echo|{{echo|1=bar}}}}
1917 !! result
1918 <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>
1919 !! end
1920
1921 ###
1922 ### Parsoid-centric tests for testing RT edge cases for pre
1923 ###
1924
1925 !!test
1926 1a. Indent-Pre and Comments
1927 !!input
1928 a
1929 <!--a-->
1930 c
1931 !!result
1932 <pre>a
1933 </pre>
1934 <p>c
1935 </p>
1936 !!end
1937
1938 !!test
1939 1b. Indent-Pre and Comments
1940 !!input
1941 a
1942 <!--a-->
1943 c
1944 !!result
1945 <pre>a
1946 </pre>
1947 <p>c
1948 </p>
1949 !!end
1950
1951 !!test
1952 1c. Indent-Pre and Comments
1953 !!input
1954 <!--a--> a
1955
1956 <!--a--> a
1957 !!result
1958 <pre> a
1959 </pre>
1960 <pre> a
1961 </pre>
1962 !!end
1963
1964 !!test
1965 1d. Indent-Pre and Comments
1966 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
1967 !!input
1968 <!--a--> a
1969
1970 <!--b-->b
1971 !!result
1972 <pre>a
1973 </pre>
1974 <pre>b
1975 </pre>
1976 !!end
1977
1978 !!test
1979 2a. Indent-Pre and tables
1980 !!input
1981 {|
1982 |-
1983 !h1!!h2
1984 |foo||bar
1985 |}
1986 !!result
1987 <table>
1988
1989 <tr>
1990 <th>h1</th>
1991 <th>h2
1992 </th>
1993 <td>foo</td>
1994 <td>bar
1995 </td></tr></table>
1996
1997 !!end
1998
1999 !!test
2000 2b. Indent-Pre and tables
2001 !!input
2002 {|
2003 |-
2004 |foo
2005 |}
2006 !!result
2007 <table>
2008
2009 <tr>
2010 <td>foo
2011 </td></tr></table>
2012
2013 !!end
2014
2015 !!test
2016 2c. Indent-Pre and tables (bug 42252)
2017 !!input
2018 {|
2019 |+ foo
2020 ! | bar
2021 |}
2022 !!result
2023 <table>
2024 <caption> foo
2025 </caption>
2026 <tr>
2027 <th> bar
2028 </th></tr></table>
2029
2030 !!end
2031
2032 !!test
2033 3a. Indent-Pre and block tags (single-line html)
2034 !!input
2035 <p> foo </p>
2036 <div> foo </div>
2037 <blockquote> foo </blockquote>
2038 <span> foo </span>
2039 !!result
2040 <p> foo </p>
2041 <div> foo </div>
2042 <blockquote> foo </blockquote>
2043 <pre><span> foo </span>
2044 </pre>
2045 !!end
2046
2047 !!test
2048 3b. Indent-Pre and block tags (pre-content on separate line)
2049 !!input
2050 <p>
2051 foo
2052 </p>
2053
2054 <div>
2055 foo
2056 </div>
2057
2058 <center>
2059 foo
2060 </center>
2061
2062 <blockquote>
2063 foo
2064 </blockquote>
2065
2066 <blockquote>
2067 <pre>
2068 foo
2069 </pre>
2070 </blockquote>
2071
2072 <table><tr><td>
2073 foo
2074 </td></tr></table>
2075
2076 <ul><li>
2077 foo
2078 </li></ul>
2079
2080 !!result
2081 <p>
2082 foo
2083 </p>
2084 <div>
2085 <pre>foo
2086 </pre>
2087 </div>
2088 <center>
2089 <pre>foo
2090 </pre>
2091 </center>
2092 <blockquote>
2093 <p> foo
2094 </p>
2095 </blockquote>
2096 <blockquote>
2097 <pre>
2098 foo
2099 </pre>
2100 </blockquote>
2101 <table><tr><td>
2102 <pre>foo
2103 </pre>
2104 </td></tr></table>
2105 <ul><li>
2106 foo
2107 </li></ul>
2108
2109 !!end
2110
2111 !!test
2112 4. Multiple spaces at start-of-line
2113 !!input
2114 <p> foo </p>
2115 foo
2116 {|
2117 |foo
2118 |}
2119 !!result
2120 <p> foo </p>
2121 <pre> foo
2122 </pre>
2123 <table>
2124 <tr>
2125 <td>foo
2126 </td></tr></table>
2127
2128 !!end
2129
2130 !! test
2131 5. White-space in indent-pre
2132 NOTE: the white-space char on 2nd line is significant
2133 !! input
2134 a<br/>
2135
2136 b
2137 !! result
2138 <pre>a<br />
2139
2140 b
2141 </pre>
2142 !! end
2143
2144 !! test
2145 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2146 !! input
2147 a
2148
2149 <!-- continue -->
2150 b
2151
2152 c
2153
2154 d
2155 !! result
2156 <pre>a
2157
2158 b
2159 </pre>
2160 <pre>c
2161
2162 </pre>
2163 <p>d
2164 </p>
2165 !! end
2166
2167 !! test
2168 7a. Indent-pre and category links
2169 !! options
2170 parsoid=wt2html,wt2wt
2171 !! input
2172 [[Category:foo]] <!-- No pre-wrapping -->
2173 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2174 !! result
2175 <link rel="mw:WikiLink/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2176 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2177 <link rel="mw:WikiLink/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2178 !! end
2179
2180 !! test
2181 7b. Indent-pre and category links
2182 !! options
2183 parsoid=wt2html,wt2wt
2184 !! input
2185 [[Category:foo]] a
2186 [[Category:foo]] {{echo|b}}
2187 !! result
2188 <pre>
2189 <link rel="mw:WikiLink/Category" href="./Category:Foo"> a
2190
2191 <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>
2192 !! end
2193
2194 ###
2195 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2196 ###
2197
2198 !!test
2199 HTML-pre: 1. embedded newlines
2200 !!input
2201 <pre>foo</pre>
2202
2203 <pre>
2204 foo
2205 </pre>
2206
2207 <pre>
2208
2209 foo
2210 </pre>
2211
2212 <pre>
2213
2214
2215 foo
2216 </pre>
2217 !!result
2218 <pre>foo</pre>
2219 <pre>
2220 foo
2221 </pre>
2222 <pre>
2223
2224 foo
2225 </pre>
2226 <pre>
2227
2228
2229 foo
2230 </pre>
2231
2232 !!end
2233
2234 !!test
2235 HTML-pre: 2: indented text
2236 !!input
2237 <pre>
2238 foo
2239 </pre>
2240 !!result
2241 <pre>
2242 foo
2243 </pre>
2244
2245 !!end
2246
2247 !!test
2248 HTML-pre: 3: other wikitext
2249 !!input
2250 <pre>
2251 * foo
2252 # bar
2253 = no-h =
2254 '' no-italic ''
2255 [[ NoLink ]]
2256 </pre>
2257 !!result
2258 <pre>
2259 * foo
2260 # bar
2261 = no-h =
2262 '' no-italic ''
2263 [[ NoLink ]]
2264 </pre>
2265
2266 !!end
2267
2268 ###
2269 ### Definition lists
2270 ###
2271 !! test
2272 Simple definition
2273 !! input
2274 ; name : Definition
2275 !! result
2276 <dl>
2277 <dt> name&#160;</dt>
2278 <dd> Definition
2279 </dd>
2280 </dl>
2281
2282 !! end
2283
2284 !! test
2285 Definition list for indentation only
2286 !! input
2287 : Indented text
2288 !! result
2289 <dl>
2290 <dd> Indented text
2291 </dd>
2292 </dl>
2293
2294 !! end
2295
2296 !! test
2297 Definition list with no space
2298 !! input
2299 ;name:Definition
2300 !! result
2301 <dl>
2302 <dt>name</dt>
2303 <dd>Definition
2304 </dd>
2305 </dl>
2306
2307 !!end
2308
2309 !! test
2310 Definition list with URL link
2311 !! input
2312 ; http://example.com/ : definition
2313 !! result
2314 <dl>
2315 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2316 <dd> definition
2317 </dd>
2318 </dl>
2319
2320 !! end
2321
2322 !! test
2323 Definition list with bracketed URL link
2324 !! input
2325 ;[http://www.example.com/ Example]:Something about it
2326 !! result
2327 <dl>
2328 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2329 <dd>Something about it
2330 </dd>
2331 </dl>
2332
2333 !! end
2334
2335 !! test
2336 Definition list with wikilink containing colon
2337 !! input
2338 ; [[Help:FAQ]]: The least-read page on Wikipedia
2339 !! result
2340 <dl>
2341 <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>
2342 <dd> The least-read page on Wikipedia
2343 </dd>
2344 </dl>
2345
2346 !! end
2347
2348 # At Brion's and JeLuF's insistence... :)
2349 !! test
2350 Definition list with news link containing colon
2351 !! input
2352 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2353 !! result
2354 <dl>
2355 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2356 <dd> This isn't even a real newsgroup!
2357 </dd>
2358 </dl>
2359
2360 !! end
2361
2362 !! test
2363 Malformed definition list with colon
2364 !! input
2365 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2366 !! result
2367 <dl>
2368 <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
2369 </dt>
2370 </dl>
2371
2372 !! end
2373
2374 !! test
2375 Definition lists: colon in external link text
2376 !! input
2377 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2378 !! result
2379 <dl>
2380 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2381 <dd> OK, I made that up
2382 </dd>
2383 </dl>
2384
2385 !! end
2386
2387 !! test
2388 Definition lists: colon in HTML attribute
2389 !! input
2390 ;<b style="display: inline">bold</b>
2391 !! result
2392 <dl>
2393 <dt><b style="display: inline">bold</b>
2394 </dt>
2395 </dl>
2396
2397 !! end
2398
2399 !! test
2400 Definition lists: self-closed tag
2401 !! input
2402 ;one<br/>two : two-line fun
2403 !! result
2404 <dl>
2405 <dt>one<br />two&#160;</dt>
2406 <dd> two-line fun
2407 </dd>
2408 </dl>
2409
2410 !! end
2411
2412 !! test
2413 Bug 11748: Literal closing tags
2414 !! input
2415 <dl>
2416 <dt>test 1</dt>
2417 <dd>test test test test test</dd>
2418 <dt>test 2</dt>
2419 <dd>test test test test test</dd>
2420 </dl>
2421 !! result
2422 <dl>
2423 <dt>test 1</dt>
2424 <dd>test test test test test</dd>
2425 <dt>test 2</dt>
2426 <dd>test test test test test</dd>
2427 </dl>
2428
2429 !! end
2430
2431 !! test
2432 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2433 !! input
2434 <ul><li>
2435 ; term : description
2436 * unordered
2437 </li></ul>
2438 !! result
2439 <ul><li>
2440 <dl>
2441 <dt> term&#160;</dt>
2442 <dd> description
2443 </dd>
2444 </dl>
2445 <ul>
2446 <li> unordered
2447 </li>
2448 </ul>
2449 </li></ul>
2450
2451 !! end
2452
2453 !! test
2454
2455 Definition list with empty definition and following paragraph
2456 !! input
2457 ; term:
2458 Paragraph text
2459 !! result
2460 <dl>
2461 <dt> term</dt>
2462 <dd>
2463 </dd>
2464 </dl>
2465 <p>Paragraph text
2466 </p>
2467 !! end
2468
2469 !! test
2470 Nested definition lists using html syntax
2471 !! input
2472 <dl><dd>
2473 <dl>
2474 <dd>Foo</dd>
2475 </dl>
2476 </dd></dl>
2477 !! result
2478 <dl><dd>
2479 <dl>
2480 <dd>Foo</dd>
2481 </dl>
2482 </dd></dl>
2483
2484 !! end
2485
2486 !! test
2487 Definition Lists: No nesting: Multiple dd's
2488 !! input
2489 ;x
2490 :a
2491 :b
2492 !! result
2493 <dl>
2494 <dt>x
2495 </dt>
2496 <dd>a
2497 </dd>
2498 <dd>b
2499 </dd>
2500 </dl>
2501
2502 !! end
2503
2504 !! test
2505 Definition Lists: Indentation: Regular
2506 !! input
2507 :i1
2508 ::i2
2509 :::i3
2510 !! result
2511 <dl>
2512 <dd>i1
2513 <dl>
2514 <dd>i2
2515 <dl>
2516 <dd>i3
2517 </dd>
2518 </dl>
2519 </dd>
2520 </dl>
2521 </dd>
2522 </dl>
2523
2524 !! end
2525
2526 !! test
2527 Definition Lists: Indentation: Missing 1st level
2528 !! input
2529 ::i2
2530 :::i3
2531 !! result
2532 <dl>
2533 <dd><dl>
2534 <dd>i2
2535 <dl>
2536 <dd>i3
2537 </dd>
2538 </dl>
2539 </dd>
2540 </dl>
2541 </dd>
2542 </dl>
2543
2544 !! end
2545
2546 !! test
2547 Definition Lists: Indentation: Multi-level indent
2548 !! input
2549 :::i3
2550 !! result
2551 <dl>
2552 <dd><dl>
2553 <dd><dl>
2554 <dd>i3
2555 </dd>
2556 </dl>
2557 </dd>
2558 </dl>
2559 </dd>
2560 </dl>
2561
2562 !! end
2563
2564 !! test
2565 Definition Lists: Hacky use to indent tables
2566 !! input
2567 ::{|
2568 |foo
2569 |bar
2570 |}
2571 this text
2572 should be left alone
2573 !! result
2574 <dl><dd><dl><dd><table>
2575 <tr>
2576 <td>foo
2577 </td>
2578 <td>bar
2579 </td></tr></table></dd></dl></dd></dl>
2580 <p>this text
2581 should be left alone
2582 </p>
2583 !! end
2584
2585 # Bug 52473
2586 !! test
2587 Definition Lists: Hacky use to indent tables (WS-insensitive)
2588 !! options
2589 parsoid
2590 !! input
2591 : {|
2592 |a
2593 |}
2594 !! result
2595 <dl>
2596 <dd> <table><tr><td>a</td></tr></table> </dd>
2597 </dl>
2598 !! end
2599 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2600 ## as an empty dt item. It also ignores all but the last ";" when followed
2601 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2602 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2603 ## ";"s.
2604 ##
2605 ## Ex: ";;t2 ::d2" is transformed into:
2606 ##
2607 ## <dl>
2608 ## <dt>t2 </dt>
2609 ## <dd>
2610 ## <dl>
2611 ## <dt></dt>
2612 ## <dd>d2</dd>
2613 ## </dl>
2614 ## </dd>
2615 ## </dl>
2616 ##
2617 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2618 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2619 ##
2620 ## <dl>
2621 ## <dt>
2622 ## <dl>
2623 ## <dt>t2 </dt>
2624 ## <dd>:d2</dd>
2625 ## </dl>
2626 ## </dt>
2627 ## </dl>
2628 ##
2629 ## All Parsoid only definition list tests have this difference.
2630 ##
2631 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2632 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2633
2634 !! test
2635 Table / list interaction: indented table with lists in table contents
2636 !! input
2637 :{|
2638 |-
2639 | a
2640 * b
2641 |-
2642 | c
2643 * d
2644 |}
2645 !! result
2646 <dl><dd><table>
2647
2648 <tr>
2649 <td> a
2650 <ul>
2651 <li> b
2652 </li>
2653 </ul>
2654 </td></tr>
2655 <tr>
2656 <td> c
2657 <ul>
2658 <li> d
2659 </li>
2660 </ul>
2661 </td></tr></table></dd></dl>
2662
2663 !! end
2664
2665 !!test
2666 Table / list interaction: lists nested in tables nested in indented lists
2667 !!input
2668 :{|
2669 |
2670 :a
2671 :b
2672 |
2673 *c
2674 *d
2675 |}
2676
2677 *e
2678 *f
2679 !!result
2680 <dl><dd><table>
2681 <tr>
2682 <td>
2683 <dl>
2684 <dd>a
2685 </dd>
2686 <dd>b
2687 </dd>
2688 </dl>
2689 </td>
2690 <td>
2691 <ul>
2692 <li>c
2693 </li>
2694 <li>d
2695 </li>
2696 </ul>
2697 </td></tr></table></dd></dl>
2698 <ul>
2699 <li>e
2700 </li>
2701 <li>f
2702 </li>
2703 </ul>
2704
2705 !!end
2706
2707 !! test
2708 Definition Lists: Nesting: Multi-level (Parsoid only)
2709 !! options
2710 parsoid
2711 !! input
2712 ;t1 :d1
2713 ;;t2 ::d2
2714 ;;;t3 :::d3
2715 !! result
2716 <dl>
2717 <dt>t1 </dt>
2718 <dd>d1</dd>
2719 <dt>
2720 <dl>
2721 <dt>t2 </dt>
2722 <dd>:d2</dd>
2723 <dt>
2724 <dl>
2725 <dt>t3 </dt>
2726 <dd>::d3</dd>
2727 </dl>
2728 </dt>
2729 </dl>
2730 </dt>
2731 </dl>
2732
2733
2734 !! end
2735
2736
2737 !! test
2738 Definition Lists: Nesting: Test 2 (Parsoid only)
2739 !! options
2740 parsoid
2741 !! input
2742 ;t1
2743 ::d2
2744 !! result
2745 <dl>
2746 <dt>t1</dt>
2747 <dd>
2748 <dl>
2749 <dd>d2</dd>
2750 </dl>
2751 </dd>
2752 </dl>
2753
2754 !! end
2755
2756
2757 !! test
2758 Definition Lists: Nesting: Test 3 (Parsoid only)
2759 !! options
2760 parsoid
2761 !! input
2762 :;t1
2763 ::::d2
2764 !! result
2765 <dl>
2766 <dd>
2767 <dl>
2768 <dt>t1</dt>
2769 <dd>
2770 <dl>
2771 <dd>
2772 <dl>
2773 <dd>d2</dd>
2774 </dl>
2775 </dd>
2776 </dl>
2777 </dd>
2778 </dl>
2779 </dd>
2780 </dl>
2781
2782 !! end
2783
2784
2785 !! test
2786 Definition Lists: Nesting: Test 4
2787 !! input
2788 ::;t3
2789 :::d3
2790 !! result
2791 <dl>
2792 <dd><dl>
2793 <dd><dl>
2794 <dt>t3
2795 </dt>
2796 <dd>d3
2797 </dd>
2798 </dl>
2799 </dd>
2800 </dl>
2801 </dd>
2802 </dl>
2803
2804 !! end
2805
2806
2807 ## The Parsoid team believes the following three test exposes a
2808 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2809 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2810 !! test
2811 Definition Lists: Mixed Lists: Test 1 (php)
2812 !! options
2813 php
2814 !! input
2815 :;* foo
2816 ::* bar
2817 :; baz
2818 !! result
2819 <dl>
2820 <dd><dl>
2821 <dt><ul>
2822 <li> foo
2823 </li>
2824 <li> bar
2825 </li>
2826 </ul>
2827 </dt>
2828 </dl>
2829 <dl>
2830 <dt> baz
2831 </dt>
2832 </dl>
2833 </dd>
2834 </dl>
2835
2836 !! end
2837 !! test
2838 Definition Lists: Mixed Lists: Test 1 (parsoid)
2839 !! options
2840 parsoid
2841 !! input
2842 :;* foo
2843 ::* bar
2844 :; baz
2845 !! result
2846 <dl>
2847 <dd><dl>
2848 <dt><ul>
2849 <li> foo
2850 </li>
2851 </ul></dt>
2852 <dd><ul>
2853 <li> bar
2854 </li>
2855 </ul></dd>
2856 <dt> baz</dt>
2857 </dl></dd>
2858 </dl>
2859 !! end
2860
2861 !! test
2862 Definition Lists: Mixed Lists: Test 2
2863 !! input
2864 *: d1
2865 *: d2
2866 !! result
2867 <ul>
2868 <li><dl>
2869 <dd> d1
2870 </dd>
2871 <dd> d2
2872 </dd>
2873 </dl>
2874 </li>
2875 </ul>
2876
2877 !! end
2878
2879
2880 !! test
2881 Definition Lists: Mixed Lists: Test 3
2882 !! input
2883 *::: d1
2884 *::: d2
2885 !! result
2886 <ul>
2887 <li><dl>
2888 <dd><dl>
2889 <dd><dl>
2890 <dd> d1
2891 </dd>
2892 <dd> d2
2893 </dd>
2894 </dl>
2895 </dd>
2896 </dl>
2897 </dd>
2898 </dl>
2899 </li>
2900 </ul>
2901
2902 !! end
2903
2904
2905 !! test
2906 Definition Lists: Mixed Lists: Test 4
2907 !! input
2908 *;d1 :d2
2909 *;d3 :d4
2910 !! result
2911 <ul>
2912 <li><dl>
2913 <dt>d1&#160;</dt>
2914 <dd>d2
2915 </dd>
2916 <dt>d3&#160;</dt>
2917 <dd>d4
2918 </dd>
2919 </dl>
2920 </li>
2921 </ul>
2922
2923 !! end
2924
2925
2926 !! test
2927 Definition Lists: Mixed Lists: Test 5
2928 !! input
2929 *:d1
2930 *:: d2
2931 !! result
2932 <ul>
2933 <li><dl>
2934 <dd>d1
2935 <dl>
2936 <dd> d2
2937 </dd>
2938 </dl>
2939 </dd>
2940 </dl>
2941 </li>
2942 </ul>
2943
2944 !! end
2945
2946
2947 !! test
2948 Definition Lists: Mixed Lists: Test 6
2949 !! input
2950 #*:d1
2951 #*::: d3
2952 !! result
2953 <ol>
2954 <li><ul>
2955 <li><dl>
2956 <dd>d1
2957 <dl>
2958 <dd><dl>
2959 <dd> d3
2960 </dd>
2961 </dl>
2962 </dd>
2963 </dl>
2964 </dd>
2965 </dl>
2966 </li>
2967 </ul>
2968 </li>
2969 </ol>
2970
2971 !! end
2972
2973
2974 !! test
2975 Definition Lists: Mixed Lists: Test 7
2976 !! input
2977 :* d1
2978 :* d2
2979 !! result
2980 <dl>
2981 <dd><ul>
2982 <li> d1
2983 </li>
2984 <li> d2
2985 </li>
2986 </ul>
2987 </dd>
2988 </dl>
2989
2990 !! end
2991
2992
2993 !! test
2994 Definition Lists: Mixed Lists: Test 8
2995 !! input
2996 :* d1
2997 ::* d2
2998 !! result
2999 <dl>
3000 <dd><ul>
3001 <li> d1
3002 </li>
3003 </ul>
3004 <dl>
3005 <dd><ul>
3006 <li> d2
3007 </li>
3008 </ul>
3009 </dd>
3010 </dl>
3011 </dd>
3012 </dl>
3013
3014 !! end
3015
3016
3017 !! test
3018 Definition Lists: Mixed Lists: Test 9
3019 !! input
3020 *;foo :bar
3021 !! result
3022 <ul>
3023 <li><dl>
3024 <dt>foo&#160;</dt>
3025 <dd>bar
3026 </dd>
3027 </dl>
3028 </li>
3029 </ul>
3030
3031 !! end
3032
3033
3034 !! test
3035 Definition Lists: Mixed Lists: Test 10
3036 !! input
3037 *#;foo :bar
3038 !! result
3039 <ul>
3040 <li><ol>
3041 <li><dl>
3042 <dt>foo&#160;</dt>
3043 <dd>bar
3044 </dd>
3045 </dl>
3046 </li>
3047 </ol>
3048 </li>
3049 </ul>
3050
3051 !! end
3052
3053 # The Parsoid team disagrees with the PHP parser's seemingly-random
3054 # rules regarding dd/dt on the next two tests. Parsoid is more
3055 # consistent, and recognizes the shared nesting and keeps the
3056 # still-open tags around until the nesting is complete.
3057
3058 !! test
3059 Definition Lists: Mixed Lists: Test 11 (php)
3060 !! options
3061 php
3062 !! input
3063 *#*#;*;;foo :bar
3064 *#*#;boo :baz
3065 !! result
3066 <ul>
3067 <li><ol>
3068 <li><ul>
3069 <li><ol>
3070 <li><dl>
3071 <dt>foo&#160;</dt>
3072 <dd><ul>
3073 <li><dl>
3074 <dt><dl>
3075 <dt>bar
3076 </dt>
3077 </dl>
3078 </dd>
3079 </dl>
3080 </li>
3081 </ul>
3082 </dd>
3083 </dl>
3084 <dl>
3085 <dt>boo&#160;</dt>
3086 <dd>baz
3087 </dd>
3088 </dl>
3089 </li>
3090 </ol>
3091 </li>
3092 </ul>
3093 </li>
3094 </ol>
3095 </li>
3096 </ul>
3097
3098 !! end
3099 !! test
3100 Definition Lists: Mixed Lists: Test 11 (parsoid)
3101 !! options
3102 parsoid
3103 !! input
3104 *#*#;*;;foo :bar
3105 *#*#;boo :baz
3106 !! result
3107 <ul>
3108 <li>
3109 <ol>
3110 <li>
3111 <ul>
3112 <li>
3113 <ol>
3114 <li>
3115 <dl>
3116 <dt>
3117 <ul>
3118 <li>
3119 <dl>
3120 <dt>
3121 <dl>
3122 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3123 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3124 </dl></dt>
3125 </dl></li>
3126 </ul></dt>
3127 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3128 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3129 </dl></li>
3130 </ol></li>
3131 </ul></li>
3132 </ol></li>
3133 </ul>
3134 !! end
3135
3136
3137 !! test
3138 Definition Lists: Weird Ones: Test 1 (php)
3139 !! options
3140 php
3141 !! input
3142 *#;*::;; foo : bar (who uses this?)
3143 !! result
3144 <ul>
3145 <li><ol>
3146 <li><dl>
3147 <dt> foo&#160;</dt>
3148 <dd><ul>
3149 <li><dl>
3150 <dd><dl>
3151 <dd><dl>
3152 <dt><dl>
3153 <dt> bar (who uses this?)
3154 </dt>
3155 </dl>
3156 </dd>
3157 </dl>
3158 </dd>
3159 </dl>
3160 </dd>
3161 </dl>
3162 </li>
3163 </ul>
3164 </dd>
3165 </dl>
3166 </li>
3167 </ol>
3168 </li>
3169 </ul>
3170
3171 !! end
3172 !! test
3173 Definition Lists: Weird Ones: Test 1 (parsoid)
3174 !! options
3175 parsoid
3176 !! input
3177 *#;*::;; foo : bar (who uses this?)
3178 !! result
3179 <ul>
3180 <li>
3181 <ol>
3182 <li>
3183 <dl>
3184 <dt>
3185 <ul>
3186 <li>
3187 <dl>
3188 <dd>
3189 <dl>
3190 <dd>
3191 <dl>
3192 <dt>
3193 <dl>
3194 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3195 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3196 </dl></dt>
3197 </dl></dd>
3198 </dl></dd>
3199 </dl></li>
3200 </ul></dt>
3201 </dl></li>
3202 </ol></li>
3203 </ul>
3204 !! end
3205
3206 ###
3207 ### External links
3208 ###
3209 !! test
3210 External links: non-bracketed
3211 !! input
3212 Non-bracketed: http://example.com
3213 !! result
3214 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3215 </p>
3216 !! end
3217
3218 !! test
3219 External links: numbered
3220 !! input
3221 Numbered: [http://example.com]
3222 Numbered: [http://example.net]
3223 Numbered: [http://example.com]
3224 !! result
3225 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3226 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3227 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3228 </p>
3229 !!end
3230
3231 !! test
3232 External links: specified text
3233 !! input
3234 Specified text: [http://example.com link]
3235 !! result
3236 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3237 </p>
3238 !!end
3239
3240 !! test
3241 External links: trail
3242 !! input
3243 Linktrails should not work for external links: [http://example.com link]s
3244 !! result
3245 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3246 </p>
3247 !! end
3248
3249 !! test
3250 External links: dollar sign in URL
3251 !! input
3252 http://example.com/1$2345
3253 !! result
3254 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3255 </p>
3256 !! end
3257
3258 !! test
3259 External links: dollar sign in URL (named)
3260 !! input
3261 [http://example.com/1$2345]
3262 !! result
3263 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3264 </p>
3265 !!end
3266
3267 !! test
3268 External links: open square bracket forbidden in URL (bug 4377)
3269 !! input
3270 http://example.com/1[2345
3271 !! result
3272 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3273 </p>
3274 !! end
3275
3276 !! test
3277 External links: open square bracket forbidden in URL (named) (bug 4377)
3278 !! input
3279 [http://example.com/1[2345]
3280 !! result
3281 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3282 </p>
3283 !!end
3284
3285 !! test
3286 External links: nowiki in URL link text (bug 6230)
3287 !!input
3288 [http://example.com/ <nowiki>''example site''</nowiki>]
3289 !! result
3290 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 External links: newline forbidden in text (bug 6230 regression check)
3296 !! input
3297 [http://example.com/ first
3298 second]
3299 !! result
3300 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3301 second]
3302 </p>
3303 !!end
3304
3305 !! test
3306 External links: Pipe char between url and text
3307 !! input
3308 [http://example.com | link]
3309 !! result
3310 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3311 </p>
3312 !!end
3313
3314 !! test
3315 External links: protocol-relative URL in brackets
3316 !! input
3317 [//example.com/ Test]
3318 !! result
3319 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3320 </p>
3321 !! end
3322
3323 !! test
3324 External links: protocol-relative URL in brackets without text
3325 !! input
3326 [//example.com]
3327 !! result
3328 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3329 </p>
3330 !! end
3331
3332 !! test
3333 External links: protocol-relative URL in free text is left alone
3334 !! input
3335 //example.com/Foo
3336 !! result
3337 <p>//example.com/Foo
3338 </p>
3339 !!end
3340
3341 !! test
3342 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3343 !! input
3344 foo//example.com/Foo
3345 !! result
3346 <p>foo//example.com/Foo
3347 </p>
3348 !! end
3349
3350 !! test
3351 External image
3352 !! input
3353 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3354 !! result
3355 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3356 </p>
3357 !! end
3358
3359 !! test
3360 External image from https
3361 !! input
3362 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3363 !! result
3364 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3365 </p>
3366 !! end
3367
3368 !! test
3369 External image (when not allowed)
3370 !! options
3371 wgAllowExternalImages=0
3372 !! input
3373 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3374 !! result
3375 <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>
3376 </p>
3377 !! end
3378
3379 !! test
3380 Link to non-http image, no img tag
3381 !! input
3382 Link to non-http image, no img tag: ftp://example.com/test.jpg
3383 !! result
3384 <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>
3385 </p>
3386 !! end
3387
3388 !! test
3389 External links: terminating separator
3390 !! input
3391 Terminating separator: http://example.com/thing,
3392 !! result
3393 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3394 </p>
3395 !! end
3396
3397 !! test
3398 External links: intervening separator
3399 !! input
3400 Intervening separator: http://example.com/1,2,3
3401 !! result
3402 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3403 </p>
3404 !! end
3405
3406 !! test
3407 External links: old bug with URL in query
3408 !! input
3409 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3410 !! result
3411 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3412 </p>
3413 !! end
3414
3415 !! test
3416 External links: old URL-in-URL bug, mixed protocols
3417 !! input
3418 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3419 !! result
3420 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3421 </p>
3422 !!end
3423
3424 !! test
3425 External links: URL in text
3426 !! input
3427 URL in text: [http://example.com http://example.com]
3428 !! result
3429 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3430 </p>
3431 !! end
3432
3433 !! test
3434 External links: Clickable images
3435 !! input
3436 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3437 !! result
3438 <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>
3439 </p>
3440 !!end
3441
3442 !! test
3443 External links: raw ampersand
3444 !! input
3445 Old &amp; use: http://x&y
3446 !! result
3447 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3448 </p>
3449 !! end
3450
3451 !! test
3452 External links: encoded ampersand
3453 !! input
3454 Old &amp; use: http://x&amp;y
3455 !! result
3456 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3457 </p>
3458 !! end
3459
3460 !! test
3461 External links: encoded equals (bug 6102)
3462 !! input
3463 http://example.com/?foo&#61;bar
3464 !! result
3465 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3466 </p>
3467 !! end
3468
3469 !! test
3470 External links: [raw ampersand]
3471 !! input
3472 Old &amp; use: [http://x&y]
3473 !! result
3474 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3475 </p>
3476 !! end
3477
3478 !! test
3479 External links: [encoded ampersand]
3480 !! input
3481 Old &amp; use: [http://x&amp;y]
3482 !! result
3483 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3484 </p>
3485 !! end
3486
3487 !! test
3488 External links: [encoded equals] (bug 6102)
3489 !! input
3490 [http://example.com/?foo&#61;bar]
3491 !! result
3492 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3493 </p>
3494 !! end
3495
3496 !! test
3497 External links: [IDN ignored character reference in hostname; strip it right off]
3498 !! input
3499 [http://e&zwnj;xample.com/]
3500 !! result
3501 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3502 </p>
3503 !! end
3504
3505 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3506 # Where an external link could easily circumvent the sanitization of the text of
3507 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3508 # test demands a higher standard. That's a bit strange.
3509 #
3510 # Example:
3511 #
3512 # http://e‌xample.com -> [http://example.com|http://example.com]
3513 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3514 #
3515 # The first example is sanitized, but the second is not. Any security benefits
3516 # from this production are trivial to circumvent. Either remove this test and
3517 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3518 # the test accordingly.
3519 #
3520 # All our love,
3521 # The Parsoid team.
3522 !! test
3523 External links: IDN ignored character reference in hostname; strip it right off
3524 !! input
3525 http://e&zwnj;xample.com/
3526 !! result
3527 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3528 </p>
3529 !! end
3530
3531 !! test
3532 External links: www.jpeg.org (bug 554)
3533 !! input
3534 http://www.jpeg.org
3535 !!result
3536 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3537 </p>
3538 !! end
3539
3540 !! test
3541 External links: URL within URL (original bug 2)
3542 !! input
3543 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3544 !! result
3545 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3546 </p>
3547 !! end
3548
3549 !! test
3550 BUG 361: URL inside bracketed URL
3551 !! input
3552 [http://www.example.com/foo http://www.example.com/bar]
3553 !! result
3554 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3555 </p>
3556 !! end
3557
3558 !! test
3559 BUG 361: URL within URL, not bracketed
3560 !! input
3561 http://www.example.com/foo?=http://www.example.com/bar
3562 !! result
3563 <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>
3564 </p>
3565 !! end
3566
3567 !! test
3568 BUG 289: ">"-token in URL-tail
3569 !! input
3570 http://www.example.com/<hello>
3571 !! result
3572 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3573 </p>
3574 !!end
3575
3576 !! test
3577 BUG 289: literal ">"-token in URL-tail
3578 !! input
3579 http://www.example.com/<b>html</b>
3580 !! result
3581 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3582 </p>
3583 !!end
3584
3585 !! test
3586 BUG 289: ">"-token in bracketed URL
3587 !! input
3588 [http://www.example.com/<hello> stuff]
3589 !! result
3590 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3591 </p>
3592 !!end
3593
3594 !! test
3595 BUG 289: literal ">"-token in bracketed URL
3596 !! input
3597 [http://www.example.com/<b>html</b> stuff]
3598 !! result
3599 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3600 </p>
3601 !!end
3602
3603 !! test
3604 BUG 289: literal double quote at end of URL
3605 !! input
3606 http://www.example.com/"hello"
3607 !! result
3608 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3609 </p>
3610 !!end
3611
3612 !! test
3613 BUG 289: literal double quote in bracketed URL
3614 !! input
3615 [http://www.example.com/"hello" stuff]
3616 !! result
3617 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3618 </p>
3619 !!end
3620
3621 !! test
3622 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3623 !! input
3624 [http://www.example.com test]
3625 !! result
3626 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3627 </p>
3628 !! end
3629
3630 !! test
3631 External links: link text with spaces
3632 !! input
3633 [http://www.example.com a b c]
3634 [http://www.example.com ''a'' ''b'']
3635 !! result
3636 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3637 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3638 </p>
3639 !! end
3640
3641 !! test
3642 External links: wiki links within external link (Bug 3695)
3643 !! input
3644 [http://example.com [[wikilink]] embedded in ext link]
3645 !! result
3646 <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>
3647 </p>
3648 !! end
3649
3650 !! test
3651 BUG 787: Links with one slash after the url protocol are invalid
3652 !! input
3653 http:/example.com
3654
3655 [http:/example.com title]
3656 !! result
3657 <p>http:/example.com
3658 </p><p>[http:/example.com title]
3659 </p>
3660 !! end
3661
3662 !! test
3663 Bracketed external links with template-generated invalid target
3664 !! input
3665 [{{echo|http:/example.com}} title]
3666 !! result
3667 <p>[http:/example.com title]
3668 </p>
3669 !! end
3670
3671 !! test
3672 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3673 !! input
3674 ''[http://example.com text'']
3675 [http://example.com '''text]'''
3676 ''Something [http://example.com in italic'']
3677 ''Something [http://example.com mixed''''', even bold]'''
3678 '''''Now [http://example.com both''''']
3679 !! result
3680 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3681 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3682 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3683 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3684 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3685 </p>
3686 !! end
3687
3688
3689 !! test
3690 Bug 4781: %26 in URL
3691 !! input
3692 http://www.example.com/?title=AT%26T
3693 !! result
3694 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3695 </p>
3696 !! end
3697
3698 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3699 # % is actually legal in HTML5. Any change in output would need testing though.
3700 !! test
3701 Bug 4781, 5267: %25 in URL
3702 !! input
3703 http://www.example.com/?title=100%25_Bran
3704 !! result
3705 <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>
3706 </p>
3707 !! end
3708
3709 !! test
3710 Bug 4781, 5267: %28, %29 in URL
3711 !! input
3712 http://www.example.com/?title=Ben-Hur_%281959_film%29
3713 !! result
3714 <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>
3715 </p>
3716 !! end
3717
3718
3719 !! test
3720 Bug 4781: %26 in autonumber URL
3721 !! input
3722 [http://www.example.com/?title=AT%26T]
3723 !! result
3724 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3725 </p>
3726 !! end
3727
3728 !! test
3729 Bug 4781, 5267: %26 in autonumber URL
3730 !! input
3731 [http://www.example.com/?title=100%25_Bran]
3732 !! result
3733 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3734 </p>
3735 !! end
3736
3737 !! test
3738 Bug 4781, 5267: %28, %29 in autonumber URL
3739 !! input
3740 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3741 !! result
3742 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3743 </p>
3744 !! end
3745
3746
3747 !! test
3748 Bug 4781: %26 in bracketed URL
3749 !! input
3750 [http://www.example.com/?title=AT%26T link]
3751 !! result
3752 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3753 </p>
3754 !! end
3755
3756 !! test
3757 Bug 4781, 5267: %26 in bracketed URL
3758 !! input
3759 [http://www.example.com/?title=100%25_Bran link]
3760 !! result
3761 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3762 </p>
3763 !! end
3764
3765 !! test
3766 Bug 4781, 5267: %28, %29 in bracketed URL
3767 !! input
3768 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3769 !! result
3770 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3771 </p>
3772 !! end
3773
3774 !! test
3775 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3776 !! input
3777 Some [http://example.com/ pretty ''italics'' and stuff]!
3778 !! result
3779 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3780 </p>
3781 !! end
3782
3783 !! test
3784 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3785 !! input
3786 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3787 !! result
3788 <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>
3789 </p>
3790 !! end
3791
3792 !! test
3793 External link containing double-single-quotes with no space separating the url from text in italics
3794 !! input
3795 [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]].]
3796 !! result
3797 <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>
3798 </p>
3799 !! end
3800
3801 !! test
3802 External link with comments in link text
3803 !! input
3804 [http://www.google.com Google <!-- comment -->]
3805 !! result
3806 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3807 </p>
3808 !! end
3809
3810 !! test
3811 URL-encoding in URL functions (single parameter)
3812 !! input
3813 {{localurl:Some page|amp=&}}
3814 !! result
3815 <p>/index.php?title=Some_page&amp;amp=&amp;
3816 </p>
3817 !! end
3818
3819 !! test
3820 URL-encoding in URL functions (multiple parameters)
3821 !! input
3822 {{localurl:Some page|q=?&amp=&}}
3823 !! result
3824 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3825 </p>
3826 !! end
3827
3828 !! test
3829 Brackets in urls
3830 !! input
3831 http://example.com/index.php?foozoid%5B%5D=bar
3832
3833 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3834 !! result
3835 <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>
3836 </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>
3837 </p>
3838 !! end
3839
3840 !! test
3841 IPv6 urls (bug 21261)
3842 !! options
3843 disabled
3844 !! input
3845 http://[2404:130:0:1000::187:2]/index.php
3846 !! result
3847 <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>
3848 </p>
3849 !! end
3850
3851 !! test
3852 Non-extlinks in brackets
3853 !! input
3854 [foo]
3855 [foo bar]
3856 [foo ''bar'']
3857 [fool's] errand
3858 [fool's errand]
3859 [{{echo|foo}}]
3860 [{{echo|foo}} bar]
3861 [{{echo|foo}} ''bar'']
3862 [{{echo|foo}}l's] errand
3863 [{{echo|foo}}l's errand]
3864 [url={{echo|foo}}]
3865 [url=http://example.com]
3866 !! result
3867 <p>[foo]
3868 [foo bar]
3869 [foo <i>bar</i>]
3870 [fool's] errand
3871 [fool's errand]
3872 [foo]
3873 [foo bar]
3874 [foo <i>bar</i>]
3875 [fool's] errand
3876 [fool's errand]
3877 [url=foo]
3878 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3879 </p>
3880 !! end
3881
3882 !! test
3883 Parsoid: Percent encoding in external links
3884 !! options
3885 parsoid
3886 !! input
3887 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3888 !! result
3889 <p><a rel="mw:ExtLink"
3890 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3891 !! end
3892
3893 !! test
3894 Parsoid: use url link syntax for links where the content is equal the link
3895 target
3896 !! options
3897 parsoid
3898 !! input
3899 http://example.com
3900 !! result
3901 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3902 !! end
3903
3904 ###
3905 ### Quotes
3906 ###
3907
3908 !! test
3909 Quotes
3910 !! input
3911 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3912
3913 Normal text. '''''Bold italic text.''''' Normal text.
3914 !!result
3915 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3916 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3917 </p>
3918 !! end
3919
3920
3921 !! test
3922 Unclosed and unmatched quotes (php)
3923 !! options
3924 php
3925 !! input
3926 '''''Bold italic text '''with bold deactivated''' in between.'''''
3927
3928 '''''Bold italic text ''with italic deactivated'' in between.'''''
3929
3930 '''Bold text..
3931
3932 ..spanning two paragraphs (should not work).'''
3933
3934 '''Bold tag left open
3935
3936 ''Italic tag left open
3937
3938 Normal text.
3939
3940 <!-- Unmatching number of opening, closing tags: -->
3941 '''This year''''s election ''should'' beat '''last year''''s.
3942
3943 ''Tom'''s car is bigger than ''Susan'''s.
3944
3945 Plain ''italic'''s plain
3946 !! result
3947 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3948 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3949 </p><p><b>Bold text..</b>
3950 </p><p>..spanning two paragraphs (should not work).
3951 </p><p><b>Bold tag left open</b>
3952 </p><p><i>Italic tag left open</i>
3953 </p><p>Normal text.
3954 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3955 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3956 </p><p>Plain <i>italic'</i>s plain
3957 </p>
3958 !! end
3959 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3960 # parser strips. The wikitext contains just the first half of the bold
3961 # quote pair.
3962 !! test
3963 Unclosed and unmatched quotes (parsoid)
3964 !! options
3965 parsoid
3966 !! input
3967 '''''Bold italic text '''with bold deactivated''' in between.'''''
3968
3969 '''''Bold italic text ''with italic deactivated'' in between.'''''
3970
3971 '''Bold text..
3972
3973 ..spanning two paragraphs (should not work).'''
3974
3975 '''Bold tag left open
3976
3977 ''Italic tag left open
3978
3979 Normal text.
3980
3981 <!-- Unmatching number of opening, closing tags: -->
3982 '''This year''''s election ''should'' beat '''last year''''s.
3983
3984 ''Tom'''s car is bigger than ''Susan'''s.
3985
3986 Plain ''italic'''s plain
3987 !! result
3988 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3989 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3990 </p><p><b>Bold text..</b>
3991 </p><p>..spanning two paragraphs (should not work).<b></b>
3992 </p><p><b>Bold tag left open</b>
3993 </p><p><i>Italic tag left open</i>
3994 </p><p>Normal text.
3995 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3996 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3997 </p><p>Plain <i>italic'</i>s plain
3998 </p>
3999 !! end
4000
4001 ###
4002 ### Tables
4003 ###
4004 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4005 ###
4006
4007 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4008 # is the bare minimum required by the spec, see:
4009 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4010 !! test
4011 A table with no data. (php)
4012 !! options
4013 php
4014 !! input
4015 {||}
4016 !! result
4017 !! end
4018 # Parsoid team replies: empty table tags are legal in HTML5
4019 !! test
4020 A table with no data. (parsoid)
4021 !! options
4022 parsoid
4023 !! input
4024 {||}
4025 !! result
4026 <table></table>
4027 !! end
4028
4029 # A table with nothing but a caption is invalid XHTML, we might want to render
4030 # this as <p>caption</p>
4031 !! test
4032 A table with nothing but a caption (php)
4033 !! options
4034 php
4035 !! input
4036 {|
4037 |+ caption
4038 |}
4039 !! result
4040 <table>
4041 <caption> caption
4042 </caption><tr><td></td></tr></table>
4043
4044 !! end
4045 # Parsoid team replies: table with only a caption is legal in HTML5
4046 !! test
4047 A table with nothing but a caption (parsoid)
4048 !! options
4049 parsoid
4050 !! input
4051 {|
4052 |+ caption
4053 |}
4054 !! result
4055 <table><caption> caption</caption></table>
4056 !! end
4057
4058 !! test
4059 A table with caption with default-spaced attributes and a table row
4060 !! input
4061 {|
4062 |+ style="color: red;" | caption1
4063 |-
4064 | foo
4065 |}
4066 !! result
4067 <table>
4068 <caption style="color: red;"> caption1
4069 </caption>
4070 <tr>
4071 <td> foo
4072 </td></tr></table>
4073
4074 !! end
4075
4076 !! test
4077 A table with captions with non-default spaced attributes and a table row
4078 !! input
4079 {|
4080 |+style="color: red;"|caption2
4081 |+ style="color: red;"| caption3
4082 |-
4083 | foo
4084 |}
4085 !! result
4086 <table>
4087 <caption style="color: red;">caption2
4088 </caption>
4089 <caption style="color: red;"> caption3
4090 </caption>
4091 <tr>
4092 <td> foo
4093 </td></tr></table>
4094
4095 !! end
4096
4097 !! test
4098 Table td-cell syntax variations
4099 !! input
4100 {|
4101 | foo bar foo | baz
4102 | foo bar foo || baz
4103 | style='color:red;' | baz
4104 | style='color:red;' || baz
4105 |}
4106 !! result
4107 <table>
4108 <tr>
4109 <td> baz
4110 </td>
4111 <td> foo bar foo </td>
4112 <td> baz
4113 </td>
4114 <td style="color:red;"> baz
4115 </td>
4116 <td> style='color:red;' </td>
4117 <td> baz
4118 </td></tr></table>
4119
4120 !! end
4121
4122 !! test
4123 Simple table
4124 !! input
4125 {|
4126 | 1 || 2
4127 |-
4128 | 3 || 4
4129 |}
4130 !! result
4131 <table>
4132 <tr>
4133 <td> 1 </td>
4134 <td> 2
4135 </td></tr>
4136 <tr>
4137 <td> 3 </td>
4138 <td> 4
4139 </td></tr></table>
4140
4141 !! end
4142
4143 !! test
4144 Simple table but with multiple dashes for row wikitext
4145 !! input
4146 {|
4147 | foo
4148 |-----
4149 | bar
4150 |}
4151 !! result
4152 <table>
4153 <tr>
4154 <td> foo
4155 </td></tr>
4156 <tr>
4157 <td> bar
4158 </td></tr></table>
4159
4160 !! end
4161 !! test
4162 Multiplication table
4163 !! input
4164 {| border="1" cellpadding="2"
4165 |+Multiplication table
4166 |-
4167 ! &times; !! 1 !! 2 !! 3
4168 |-
4169 ! 1
4170 | 1 || 2 || 3
4171 |-
4172 ! 2
4173 | 2 || 4 || 6
4174 |-
4175 ! 3
4176 | 3 || 6 || 9
4177 |-
4178 ! 4
4179 | 4 || 8 || 12
4180 |-
4181 ! 5
4182 | 5 || 10 || 15
4183 |}
4184 !! result
4185 <table border="1" cellpadding="2">
4186 <caption>Multiplication table
4187 </caption>
4188 <tr>
4189 <th> &#215; </th>
4190 <th> 1 </th>
4191 <th> 2 </th>
4192 <th> 3
4193 </th></tr>
4194 <tr>
4195 <th> 1
4196 </th>
4197 <td> 1 </td>
4198 <td> 2 </td>
4199 <td> 3
4200 </td></tr>
4201 <tr>
4202 <th> 2
4203 </th>
4204 <td> 2 </td>
4205 <td> 4 </td>
4206 <td> 6
4207 </td></tr>
4208 <tr>
4209 <th> 3
4210 </th>
4211 <td> 3 </td>
4212 <td> 6 </td>
4213 <td> 9
4214 </td></tr>
4215 <tr>
4216 <th> 4
4217 </th>
4218 <td> 4 </td>
4219 <td> 8 </td>
4220 <td> 12
4221 </td></tr>
4222 <tr>
4223 <th> 5
4224 </th>
4225 <td> 5 </td>
4226 <td> 10 </td>
4227 <td> 15
4228 </td></tr></table>
4229
4230 !! end
4231
4232 !! test
4233 Accept "||" in table headings
4234 !! input
4235 {|
4236 !h1 || h2
4237 |}
4238 !! result
4239 <table>
4240 <tr>
4241 <th>h1 </th>
4242 <th> h2
4243 </th></tr></table>
4244
4245 !! end
4246
4247 !! test
4248 Accept "||" in indented table headings
4249 !! input
4250 :{|
4251 !h1 || h2
4252 |}
4253 !! result
4254 <dl><dd><table>
4255 <tr>
4256 <th>h1 </th>
4257 <th> h2
4258 </th></tr></table></dd></dl>
4259
4260 !! end
4261
4262 !! test
4263 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4264 !! input
4265 {|
4266 !| h1
4267 || a
4268 |}
4269 !! result
4270 <table>
4271 <tr>
4272 <th> h1
4273 </th>
4274 <td> a
4275 </td></tr></table>
4276
4277 !! end
4278
4279 !!test
4280 Accept "| !" at start of line in tables (ignore !-attribute)
4281 !!input
4282 {|
4283 |-
4284 | !style="color:red" | bar
4285 |}
4286 !!result
4287 <table>
4288
4289 <tr>
4290 <td> bar
4291 </td></tr></table>
4292
4293 !!end
4294
4295 !!test
4296 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 +/-
4297 !!input
4298 {|
4299 |-
4300 |style='color:red;'|+1
4301 |style='color:blue;'|-1
4302 |-
4303 | 1 || 2 || 3
4304 | 1 ||+2 ||-3
4305 |-
4306 | +1
4307 | -1
4308 |}
4309 !!result
4310 <table>
4311
4312 <tr>
4313 <td style="color:red;">+1
4314 </td>
4315 <td style="color:blue;">-1
4316 </td></tr>
4317 <tr>
4318 <td> 1 </td>
4319 <td> 2 </td>
4320 <td> 3
4321 </td>
4322 <td> 1 </td>
4323 <td>+2 </td>
4324 <td>-3
4325 </td></tr>
4326 <tr>
4327 <td> +1
4328 </td>
4329 <td> -1
4330 </td></tr></table>
4331
4332 !!end
4333
4334 !! test
4335 Table rowspan
4336 !! input
4337 {| border=1
4338 | Cell 1, row 1
4339 |rowspan=2| Cell 2, row 1 (and 2)
4340 | Cell 3, row 1
4341 |-
4342 | Cell 1, row 2
4343 | Cell 3, row 2
4344 |}
4345 !! result
4346 <table border="1">
4347 <tr>
4348 <td> Cell 1, row 1
4349 </td>
4350 <td rowspan="2"> Cell 2, row 1 (and 2)
4351 </td>
4352 <td> Cell 3, row 1
4353 </td></tr>
4354 <tr>
4355 <td> Cell 1, row 2
4356 </td>
4357 <td> Cell 3, row 2
4358 </td></tr></table>
4359
4360 !! end
4361
4362 !! test
4363 Nested table
4364 !! input
4365 {| border=1
4366 | &alpha;
4367 |
4368 {| bgcolor=#ABCDEF border=2
4369 |nested
4370 |-
4371 |table
4372 |}
4373 |the original table again
4374 |}
4375 !! result
4376 <table border="1">
4377 <tr>
4378 <td> &#945;
4379 </td>
4380 <td>
4381 <table bgcolor="#ABCDEF" border="2">
4382 <tr>
4383 <td>nested
4384 </td></tr>
4385 <tr>
4386 <td>table
4387 </td></tr></table>
4388 </td>
4389 <td>the original table again
4390 </td></tr></table>
4391
4392 !! end
4393
4394 !! test
4395 Invalid attributes in table cell (bug 1830)
4396 !! input
4397 {|
4398 |Cell:|broken
4399 |}
4400 !! result
4401 <table>
4402 <tr>
4403 <td>broken
4404 </td></tr></table>
4405
4406 !! end
4407
4408
4409 !! test
4410 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4411 !! input
4412 {|
4413 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4414 !! result
4415 <table>
4416 <tr>
4417 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4418 <td>]" onmouseover="alert(document.cookie)"&gt;test
4419 </td>
4420 </tr>
4421 </table>
4422
4423 !! end
4424
4425
4426 !! test
4427 Indented table markup mixed with indented pre content (proposed in bug 6200)
4428 !! input
4429 <table>
4430 <tr>
4431 <td>
4432 Text that should be rendered preformatted
4433 </td>
4434 </tr>
4435 </table>
4436 !! result
4437 <table>
4438 <tr>
4439 <td>
4440 <pre>Text that should be rendered preformatted
4441 </pre>
4442 </td>
4443 </tr>
4444 </table>
4445
4446 !! end
4447
4448 !! test
4449 Template-generated table cell attributes and cell content
4450 !! input
4451 {|
4452 |{{table_attribs}}
4453 | {{table_attribs}}
4454 |}
4455 !! result
4456 <table>
4457 <tr>
4458 <td style="color: red"> Foo
4459 </td>
4460 <td style="color: red"> Foo
4461 </td></tr></table>
4462
4463 !! end
4464
4465 !! test
4466 Template-generated table cell attributes and cell content (2)
4467 !! input
4468 {|
4469 |align=center {{table_attribs}}
4470 |}
4471 !! result
4472 <table>
4473 <tr>
4474 <td align="center" style="color: red"> Foo
4475 </td></tr></table>
4476
4477 !! end
4478
4479 !! test
4480 Template-generated table cell attributes and cell content (3)
4481 !! input
4482 {|
4483 |align=center {{table_cells}}
4484 |}
4485 !! result
4486 <table>
4487 <tr>
4488 <td align="center" style="color: red"> Foo </td>
4489 <td> Bar </td>
4490 <td> Baz
4491 </td></tr></table>
4492
4493 !! end
4494
4495 !! test
4496 Table with row followed by newlines and table heading
4497 !! input
4498 {|
4499 |-
4500
4501 ! foo
4502 |}
4503 !! result
4504 <table>
4505
4506
4507 <tr>
4508 <th> foo
4509 </th></tr></table>
4510
4511 !! end
4512
4513 !! test
4514 Table with empty line following the start tag
4515 !! input
4516 {|
4517
4518 |-
4519 | foo
4520 |}
4521 !! result
4522 <table>
4523
4524
4525 <tr>
4526 <td> foo
4527 </td></tr></table>
4528
4529 !! end
4530
4531 # FIXME: Preserve the attribute properly (with an empty string as value) in
4532 # the PHP parser. Parsoid implements the behavior below.
4533 !! test
4534 Table attributes with empty value
4535 !! options
4536 parsoid
4537 !! input
4538 {|
4539 | style=| hello
4540 |}
4541 !! result
4542 <table>
4543 <tbody>
4544 <tr>
4545 <td style=""> hello
4546 </td></tr></tbody></table>
4547
4548 !! end
4549
4550 !! test
4551 Wikitext table with a lot of comments
4552 !! input
4553 {|
4554 <!-- c0 -->
4555 | foo
4556 <!-- c1 -->
4557 |- <!-- c2 -->
4558 <!-- c3 -->
4559 |<!-- c4 -->
4560 <!-- c5 -->
4561 |}
4562 !! result
4563 <table>
4564 <tr>
4565 <td> foo
4566 </td></tr>
4567 <tr>
4568 <td>
4569 </td></tr></table>
4570
4571 !! end
4572
4573 !! test
4574 Wikitext table with double-line table cell
4575 !! input
4576 {|
4577 |a
4578 b
4579 |}
4580 !! result
4581 <table>
4582 <tr>
4583 <td>a
4584 <p>b
4585 </p>
4586 </td></tr></table>
4587
4588 !! end
4589
4590 !! test
4591 Table cell with a single comment
4592 !! input
4593 {|
4594 | <!-- c1 -->
4595 | a
4596 |}
4597 !! result
4598 <table>
4599 <tr>
4600 <td>
4601 </td>
4602 <td> a
4603 </td></tr></table>
4604
4605 !! end
4606
4607 # The expected HTML structure in this test is debatable. The PHP parser does
4608 # not parse this kind of table at all. The main focus for Parsoid is on
4609 # round-tripping, so this output is ok for now. TODO: revisit!
4610 !! test
4611 Wikitext table with html-syntax row (Parsoid)
4612 !! options
4613 parsoid
4614 !! input
4615 {|
4616 |-
4617 <td>foo</td>
4618 |}
4619 !! result
4620 <table>
4621 <tbody>
4622 <tr>
4623 <td>foo</td></tr></tbody></table>
4624 !! end
4625
4626 !! test
4627 Implicit <td> after a |-
4628 (PHP parser relies on Tidy to add the missing <td> tags)
4629 !! options
4630 parsoid=wt2html,wt2wt
4631 !! input
4632 {|
4633 |-
4634 a
4635 |}
4636 !! result
4637 <table>
4638 <tr><td>a</td></tr>
4639 </table>
4640 !! end
4641
4642 !! test
4643 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4644 (PHP parser relies on Tidy to add the missing <td> tags)
4645 !! options
4646 parsoid=wt2html,wt2wt
4647 !! input
4648 {|
4649 |-
4650 |
4651 a
4652 |-
4653 b
4654 |}
4655 !! result
4656 <table>
4657 <tbody>
4658 <tr><td><pre>a</pre></td></tr>
4659 <tr><td> b</td></tr>
4660 </tbody>
4661 </table>
4662 !! end
4663
4664 !! test
4665 Lists should be recognized in an implicit <td> context
4666 (PHP parser relies on Tidy to add the missing <td> tags)
4667 !! options
4668 parsoid=wt2html,wt2wt
4669 !! input
4670 {|
4671 |-
4672 *a
4673 |}
4674 !! result
4675 <table>
4676 <tr>
4677 <td><ul>
4678 <li>a</li>
4679 </ul></td>
4680 </tr>
4681 </table>
4682 !! end
4683
4684 !! test
4685 Parsoid: Round-trip tables directly followed by content (bug 51219)
4686 !! options
4687 parsoid=wt2html,wt2wt
4688 !! input
4689 {|
4690 |foo
4691 |} bar
4692
4693 {|
4694 |baz
4695 |}<b>quux</b>
4696 !! result
4697 <table><tbody>
4698 <tr>
4699 <td>foo</td></tr></tbody></table> bar
4700 <table>
4701 <tbody>
4702 <tr>
4703 <td>baz</td></tr></tbody></table><b>quux</b>
4704 !! end
4705
4706 !! test
4707 Parsoid: Default to a newline after tables in new content (bug 51219)
4708 !! options
4709 parsoid=html2wt
4710 !! input
4711 {|
4712 |foo
4713 |}
4714 <nowiki> </nowiki>bar
4715 {|
4716 |baz
4717 |}
4718 '''quux'''
4719 !! result
4720 <table><tbody>
4721 <tr><td>foo</td></tr></tbody></table> bar
4722 <table><tbody>
4723 <tr><td>baz</td></tr></tbody></table><b>quux</b>
4724 !! end
4725
4726 ###
4727 ### Internal links
4728 ###
4729 !! test
4730 Plain link, capitalized
4731 !! input
4732 [[Main Page]]
4733 !! result
4734 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4735 </p>
4736 !! end
4737
4738 !! test
4739 Plain link, uncapitalized
4740 !! input
4741 [[main Page]]
4742 !! result
4743 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4744 </p>
4745 !! end
4746
4747 !! test
4748 Piped link
4749 !! input
4750 [[Main Page|The Main Page]]
4751 !! result
4752 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4753 </p>
4754 !! end
4755
4756 !! test
4757 Piped link with comment in link text
4758 !! input
4759 [[Main Page|The Main<!--front--> Page]]
4760 !! result
4761 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4762 </p>
4763 !! end
4764
4765 !! test
4766 Broken link
4767 !! input
4768 [[Zigzagzogzagzig]]
4769 !! result
4770 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4771 </p>
4772 !! end
4773
4774 !! test
4775 Broken link with fragment
4776 !! input
4777 [[Zigzagzogzagzig#zug]]
4778 !! result
4779 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4780 </p>
4781 !! end
4782
4783 !! test
4784 Special page link with fragment
4785 !! input
4786 [[Special:Version#anchor]]
4787 !! result
4788 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 Nonexistent special page link with fragment
4794 !! input
4795 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4796 !! result
4797 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4798 </p>
4799 !! end
4800
4801 !! test
4802 Link with prefix
4803 !! input
4804 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4805 !! result
4806 <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>
4807 </p>
4808 !! end
4809
4810 !! test
4811 Link with suffix
4812 !! input
4813 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4814 !! result
4815 <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>!!!
4816 </p>
4817 !! end
4818
4819 !! article
4820 prefixed article
4821 !! text
4822 Some text
4823 !! endarticle
4824
4825 !! test
4826 Bug 43661: Piped links with identical prefixes
4827 !! input
4828 [[prefixed article|prefixed articles with spaces]]
4829
4830 [[prefixed article|prefixed articlesaoeu]]
4831
4832 [[Main Page|Main Page test]]
4833 !! result
4834 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4835 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4836 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4837 </p>
4838 !! end
4839
4840
4841 !! test
4842 Link with HTML entity in suffix / tail
4843 !! input
4844 [[Main Page]]&quot;, [[Main Page]]&#97;
4845 !! result
4846 <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;
4847 </p>
4848 !! end
4849
4850 !! test
4851 Link with 3 brackets
4852 !! input
4853 [[[main page]]]
4854 !! result
4855 <p>[[[main page]]]
4856 </p>
4857 !! end
4858
4859 !! test
4860 Piped link with 3 brackets
4861 !! input
4862 [[[main page|the main page]]]
4863 !! result
4864 <p>[[[main page|the main page]]]
4865 </p>
4866 !! end
4867
4868 !! test
4869 Link with multiple pipes
4870 !! input
4871 [[Main Page|The|Main|Page]]
4872 !! result
4873 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 Link to namespaces
4879 !! input
4880 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4881 !! result
4882 <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>
4883 </p>
4884 !! end
4885
4886 !! article
4887 MemoryAlpha:AlphaTest
4888 !! text
4889 This is an article in the MemoryAlpha namespace
4890 (which shadows the memoryalpha interwiki link).
4891 !! endarticle
4892
4893 !! test
4894 Namespace takes precedence over interwiki link (bug 51680)
4895 !! input
4896 [[MemoryAlpha:AlphaTest]]
4897 !! result
4898 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
4899 </p>
4900 !! end
4901
4902 !! test
4903 Piped link to namespace
4904 !! input
4905 [[Meta:Disclaimers|The disclaimers]]
4906 !! result
4907 <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>
4908 </p>
4909 !! end
4910
4911 !! test
4912 Link containing }
4913 !! input
4914 [[Usually caused by a typo (oops}]]
4915 !! result
4916 <p>[[Usually caused by a typo (oops}]]
4917 </p>
4918 !! end
4919
4920 !! test
4921 Link containing % (not as a hex sequence)
4922 !! input
4923 [[7% Solution]]
4924 !! result
4925 <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>
4926 </p>
4927 !! end
4928
4929 !! test
4930 Link containing % as a single hex sequence interpreted to char
4931 !! input
4932 [[7%25 Solution]]
4933 !! result
4934 <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>
4935 </p>
4936 !!end
4937
4938 !! test
4939 Link containing % as a double hex sequence interpreted to hex sequence
4940 !! input
4941 [[7%2525 Solution]]
4942 !! result
4943 <p>[[7%2525 Solution]]
4944 </p>
4945 !!end
4946
4947 !! test
4948 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4949 Example for such a section: == < ==
4950 !! input
4951 [[%23%3c]][[%23%3e]]
4952 !! result
4953 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4954 </p>
4955 !! end
4956
4957 !! test
4958 Link containing "<#" and ">#" as a hex sequences
4959 !! input
4960 [[%3c%23]][[%3e%23]]
4961 !! result
4962 <p>[[%3c%23]][[%3e%23]]
4963 </p>
4964 !! end
4965
4966 !! test
4967 Link containing an equals sign
4968 !! input
4969 [[Special:BookSources/isbn=4-00-026157-6]]
4970 !! result
4971 <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>
4972 </p>
4973 !! end
4974
4975 !! article
4976 Foo~bar
4977 !! text
4978 Just a test of an article title containing a tilde.
4979 !! endarticle
4980
4981 # note that links containing signatures, like [[Foo~~~~]], are
4982 # massaged by the pre-save transform (PST) and so the tildes are never
4983 # seen by the parser.
4984 !! test
4985 Link containing a tilde
4986 !! input
4987 [[Foo~bar]]
4988 !! result
4989 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4990 </p>
4991 !! end
4992
4993 !! test
4994 Link containing double-single-quotes '' (bug 4598)
4995 !! input
4996 [[Lista d''e paise d''o munno]]
4997 !! result
4998 <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>
4999 </p>
5000 !! end
5001
5002 !! test
5003 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5004 !! input
5005 Some [[Link|pretty ''italics'' and stuff]]!
5006 !! result
5007 <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>!
5008 </p>
5009 !! end
5010
5011 !! test
5012 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5013 !! input
5014 ''Some [[Link|pretty ''italics'' and stuff]]!
5015 !! result
5016 <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>
5017 </p>
5018 !! end
5019
5020 !! test
5021 Link with double quotes in title part (literal) and alternate part (interpreted)
5022 !! input
5023 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5024
5025 [[''Pentecoste'']]
5026
5027 [[''Pentecoste''|Pentecoste]]
5028
5029 [[''Pentecoste''|''Pentecoste'']]
5030 !! result
5031 <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>
5032 </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>
5033 </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>
5034 </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>
5035 </p>
5036 !! end
5037
5038 !! test
5039 Broken image links with HTML captions (bug 39700)
5040 !! input
5041 [[File:Nonexistent|<script></script>]]
5042 [[File:Nonexistent|100px|<script></script>]]
5043 [[File:Nonexistent|&lt;]]
5044 [[File:Nonexistent|a<i>b</i>c]]
5045 !! result
5046 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5047 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5048 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5049 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5050 </p>
5051 !! end
5052
5053 !! test
5054 Plain link to URL
5055 !! input
5056 [[http://www.example.com]]
5057 !! result
5058 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5059 </p>
5060 !! end
5061
5062 !! test
5063 Plain link to URL with link text
5064 !! input
5065 [[http://www.example.com Link text]]
5066 !! result
5067 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5068 </p>
5069 !! end
5070
5071 !! test
5072 Plain link to protocol-relative URL
5073 !! input
5074 [[//www.example.com]]
5075 !! result
5076 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5077 </p>
5078 !! end
5079
5080 !! test
5081 Plain link to protocol-relative URL with link text
5082 !! input
5083 [[//www.example.com Link text]]
5084 !! result
5085 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5086 </p>
5087 !! end
5088
5089 !! test
5090 Plain link to page with question mark in title
5091 !! input
5092 [[A?b]]
5093
5094 [[A?b|Baz]]
5095 !! result
5096 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5097 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5098 </p>
5099 !! end
5100
5101
5102 # I'm fairly sure the expected result here is wrong.
5103 # We want these to be URL links, not pseudo-pages with URLs for titles....
5104 # However the current output is also pretty screwy.
5105 #
5106 # ----
5107 # I'm changing it to match the current output--it arguably makes more
5108 # sense in the light of the test above. Old expected result was:
5109 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5110 #</p>
5111 # But I think this test is bordering on "garbage in, garbage out" anyway.
5112 # -- wtm
5113 !! test
5114 Piped link to URL
5115 !! input
5116 Piped link to URL: [[http://www.example.com|an example URL]]
5117 !! result
5118 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5119 </p>
5120 !! end
5121
5122 !! test
5123 BUG 2: [[page|http://url/]] should link to page, not http://url/
5124 !! input
5125 [[Main Page|http://url/]]
5126 !! result
5127 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5128 </p>
5129 !! end
5130
5131 !! test
5132 BUG 337: Escaped self-links should be bold
5133 !! options
5134 title=[[Bug462]]
5135 !! input
5136 [[Bu&#103;462]] [[Bug462]]
5137 !! result
5138 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5139 </p>
5140 !! end
5141
5142 !! test
5143 Self-link to section should not be bold
5144 !! options
5145 title=[[Main Page]]
5146 !! input
5147 [[Main Page#section]]
5148 !! result
5149 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5150 </p>
5151 !! end
5152
5153 !! article
5154 00
5155 !! text
5156 This is 00.
5157 !! endarticle
5158
5159 !!test
5160 Self-link to numeric title
5161 !!options
5162 title=[[0]]
5163 !!input
5164 [[0]]
5165 !!result
5166 <p><strong class="selflink">0</strong>
5167 </p>
5168 !!end
5169
5170 !!test
5171 Link to numeric-equivalent title
5172 !!options
5173 title=[[0]]
5174 !!input
5175 [[00]]
5176 !!result
5177 <p><a href="/wiki/00" title="00">00</a>
5178 </p>
5179 !!end
5180
5181 !! test
5182 <nowiki> inside a link
5183 !! input
5184 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5185 !! result
5186 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5187 </p>
5188 !! end
5189
5190 !! test
5191 Non-breaking spaces in title
5192 !! input
5193 [[&nbsp; Main &nbsp; Page &nbsp;]]
5194 !! result
5195 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5196 </p>
5197 !!end
5198
5199 !! test
5200 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5201 !! options
5202 language=ca
5203 !! input
5204 '''[[Main Page]]'''
5205 !! result
5206 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5207 </p>
5208 !! end
5209
5210 !! test
5211 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5212 !! options
5213 language=ca
5214 !! input
5215 ''[[Main Page]]''
5216 !! result
5217 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5218 </p>
5219 !! end
5220
5221 !! test
5222 Internal link with en linktrail: no apostrophes (bug 27473)
5223 !! options
5224 language=en
5225 !! input
5226 [[Something]]'nice
5227 !! result
5228 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5229 </p>
5230 !! end
5231
5232 !! test
5233 Internal link with ca linktrail with apostrophes (bug 27473)
5234 !! options
5235 language=ca
5236 !! input
5237 [[Something]]'nice
5238 !! result
5239 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5240 </p>
5241 !! end
5242
5243 !! test
5244 Internal link with kaa linktrail with apostrophes (bug 27473)
5245 !! options
5246 language=kaa
5247 !! input
5248 [[Something]]'nice
5249 !! result
5250 <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>
5251 </p>
5252 !! end
5253
5254 !! article
5255 Söfnuður
5256 !! text
5257 Test.
5258 !! endarticle
5259
5260 !! test
5261 Internal link with is link prefix
5262 !! options
5263 language=is
5264 !! input
5265 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5266 !! result
5267 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5268 </p>
5269 !! end
5270
5271 !! article
5272 Mótmælendatrú
5273 !! text
5274 Test.
5275 !! endarticle
5276
5277 !! test
5278 Internal link with is link trail and link prefix
5279 !! options
5280 language=is
5281 !! input
5282 [[mótmælendatrú|xxx]]ar
5283 [[mótmælendatrú]]ar
5284 mótmælenda[[söfnuður]]
5285 mótmælenda[[söfnuður|söfnuðir]]
5286 mótmælenda[[söfnuður|söfnuðir]]xxx
5287 !! result
5288 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5289 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5290 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5291 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5292 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5293 </p>
5294 !! end
5295
5296 !! test
5297 Parsoid link trail escaping
5298 !! options
5299 parsoid=html2wt,html2html
5300 !! input
5301 [[apple]]<nowiki/>s
5302 !! result
5303 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5304 !! end
5305
5306 !! test
5307 Parsoid link prefix escaping
5308 !! options
5309 language=is
5310 parsoid=html2wt,html2html
5311 !! input
5312 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5313 !! result
5314 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5315 !! end
5316
5317 !! test
5318 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5319 !! input
5320 [[Foo| bar]]
5321
5322 [[Foo| ''bar'']]
5323
5324 [http://wp.org foo]
5325
5326 [http://wp.org ''foo'']
5327 !! result
5328 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5329 </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>
5330 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5331 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5332 </p>
5333 !! end
5334
5335 ###
5336 ### Interwiki links (see maintenance/interwiki.sql)
5337 ###
5338
5339 !! test
5340 Inline interwiki link
5341 !! input
5342 [[MeatBall:SoftSecurity]]
5343 !! result
5344 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5345 </p>
5346 !! end
5347
5348 !! test
5349 Inline interwiki link with empty title (bug 2372)
5350 !! input
5351 [[MeatBall:]]
5352 !! result
5353 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5354 </p>
5355 !! end
5356
5357 !! test
5358 Interwiki link encoding conversion (bug 1636)
5359 !! input
5360 *[[Wikipedia:ro:Olteni&#0355;a]]
5361 *[[Wikipedia:ro:Olteni&#355;a]]
5362 !! result
5363 <ul>
5364 <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>
5365 </li>
5366 <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>
5367 </li>
5368 </ul>
5369
5370 !! end
5371
5372 !! test
5373 Interwiki link with fragment (bug 2130)
5374 !! input
5375 [[MeatBall:SoftSecurity#foo]]
5376 !! result
5377 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5378 </p>
5379 !! end
5380
5381
5382 ###
5383 ### Interlanguage links
5384 ### Language links (so that searching for '### language' matches..)
5385 ###
5386
5387 !! test
5388 Interlanguage link
5389 !! input
5390 Blah blah blah
5391 [[zh:Chinese]]
5392 !!result
5393 <p>Blah blah blah
5394 </p>
5395 !! end
5396
5397 !! test
5398 Double interlanguage link
5399 !! input
5400 Blah blah blah
5401 [[es:Spanish]]
5402 [[zh:Chinese]]
5403 !!result
5404 <p>Blah blah blah
5405 </p>
5406 !! end
5407
5408 !! test
5409 Interlanguage link, with prefix links
5410 !! options
5411 language=ln
5412 !! input
5413 Blah blah blah
5414 [[zh:Chinese]]
5415 !!result
5416 <p>Blah blah blah
5417 </p>
5418 !! end
5419
5420 !! test
5421 Double interlanguage link, with prefix links (bug 8897)
5422 !! options
5423 language=ln
5424 !! input
5425 Blah blah blah
5426 [[es:Spanish]]
5427 [[zh:Chinese]]
5428 !!result
5429 <p>Blah blah blah
5430 </p>
5431 !! end
5432
5433 !! test
5434 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
5435 !! options
5436 language=ln
5437 !! input
5438 [[WW&nbsp;II]]
5439 !!result
5440 <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>
5441 </p>
5442 !! end
5443
5444 !! test
5445 Parsoid bug 53221: Wikilinks should be properly entity-escaped
5446 !! options
5447 parsoid=html2wt
5448 !! input
5449 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
5450
5451 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
5452 !!result
5453 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5454 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
5455 !! end
5456
5457 !! test
5458 Parsoid: handle constructor well
5459 !! options
5460 parsoid
5461 !! input
5462 [[constructor]]
5463
5464 [[constructor:foo]]
5465 !! result
5466 <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>
5467
5468
5469 <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>
5470 !! end
5471
5472 !! test
5473 Parsoid: recognize interlanguage links without a target page
5474 !! options
5475 parsoid
5476 !! input
5477 [[ko:]]
5478 !! result
5479 <p>
5480 <link rel="mw:WikiLink/Language" href="http://ko.wikipedia.org/wiki/"></p>
5481 !! end
5482
5483 !! test
5484 Parsoid: recognize interwiki links without a target page
5485 !! options
5486 parsoid
5487 !! input
5488 [[:ko:]]
5489 !! result
5490 <p><a rel="mw:WikiLink/Interwiki" href="http://ko.wikipedia.org/wiki/">ko:</a></p>
5491 !! end
5492
5493 ###
5494 ### Redirects, Parsoid-only
5495 ###
5496 !! test
5497 Simple redirect to page
5498 !! options
5499 parsoid
5500 !! input
5501 #REDIRECT [[Main Page]]
5502 !! result
5503 <link rel="mw:PageProp/redirect" href="./Main_Page">
5504 !! end
5505
5506 !! test
5507 Optional colon in #REDIRECT
5508 !! options
5509 # the colon is archaic syntax. we support it for wt2html, but we
5510 # don't care that it roundtrips back to the modern syntax.
5511 parsoid=wt2html,html2html
5512 !! input
5513 #REDIRECT:[[Main Page]]
5514 !! result
5515 <link rel="mw:PageProp/redirect" href="./Main_Page">
5516 !! end
5517
5518 !! test
5519 Whitespace in #REDIRECT with optional colon
5520 !! options
5521 # the colon and gratuitous whitespace is archaic syntax. we support
5522 # it for wt2html, but we don't care that it roundtrips back to the
5523 # modern syntax (without extra whitespace)
5524 parsoid=wt2html,html2html
5525 !! input
5526
5527 #REDIRECT
5528 :
5529 [[Main Page]]
5530 !! result
5531 <link rel="mw:PageProp/redirect" href="./Main_Page">
5532 !! end
5533
5534 !! test
5535 Piped link in #REDIRECT
5536 !! options
5537 # content after piped link is ignored. we support this syntax,
5538 # but don't care that the piped link is lost when we roundtrip this.
5539 parsoid=wt2html
5540 !! input
5541 #REDIRECT [[Main Page|bar]]
5542 !! result
5543 <link rel="mw:PageProp/redirect" href="./Main_Page">
5544 !! end
5545
5546 !! test
5547 Redirect to category
5548 !! options
5549 parsoid=wt2html
5550 !! input
5551 #REDIRECT [[Category:Foo]]
5552 !! result
5553 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5554 !! end
5555
5556 !! test
5557 Redirect to category with URL encoding
5558 !! options
5559 parsoid=wt2html
5560 !! input
5561 #REDIRECT [[Category%3AFoo]]
5562 !! result
5563 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
5564 !! end
5565
5566 !! test
5567 Redirect to category page
5568 !! options
5569 parsoid=wt2html,html2html
5570 !! input
5571 #REDIRECT [[:Category:Foo]]
5572 !! result
5573 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
5574 !! end
5575
5576 !! test
5577 Redirect to image page (1)
5578 !! options
5579 parsoid
5580 !! input
5581 #REDIRECT [[File:Wiki.png]]
5582 !! result
5583 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5584 !! end
5585
5586 !! test
5587 Redirect to image page (2)
5588 !! options
5589 parsoid
5590 !! input
5591 #REDIRECT [[Image:Wiki.png]]
5592 !! result
5593 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
5594 !! end
5595
5596 !! test
5597 Redirect to language
5598 !! options
5599 parsoid
5600 !! input
5601 #REDIRECT [[en:File:Wiki.png]]
5602 !! result
5603 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5604 !! end
5605
5606 !! test
5607 Redirect to interwiki
5608 !! options
5609 parsoid
5610 !! input
5611 #REDIRECT [[meatball:File:Wiki.png]]
5612 !! result
5613 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
5614 !! end
5615
5616 !! test
5617 Non-English #REDIRECT
5618 !! options
5619 parsoid
5620 language=is
5621 !! input
5622 #TILVÍSUN [[Main Page]]
5623 !! result
5624 <link rel="mw:PageProp/redirect" href="./Main_Page">
5625 !! end
5626
5627 ##
5628 ## XHTML tidiness
5629 ###
5630
5631 !! test
5632 <br> to <br />
5633 !! input
5634 1<br>2<br />3
5635 !! result
5636 <p>1<br />2<br />3
5637 </p>
5638 !! end
5639
5640 !! test
5641 Broken br tag sanitization
5642 !! options
5643 php
5644 !! input
5645 </br>
5646 !! result
5647 <p>&lt;/br&gt;
5648 </p>
5649 !! end
5650
5651 # TODO: Fix html2html mode (bug 51055)!
5652 !! test
5653 Parsoid: Broken br tag recognition
5654 !! options
5655 parsoid=wt2html
5656 !! input
5657 </br>
5658 !! result
5659 <p><br></p>
5660 !! end
5661
5662 !! test
5663 Incorrecly removing closing slashes from correctly formed XHTML
5664 !! input
5665 <br style="clear:both;" />
5666 !! result
5667 <p><br style="clear:both;" />
5668 </p>
5669 !! end
5670
5671 !! test
5672 Failing to transform badly formed HTML into correct XHTML
5673 !! input
5674 <br style="clear: left;">
5675 <br style="clear: right;">
5676 <br style="clear: both;">
5677 !! result
5678 <p><br style="clear: left;" />
5679 <br style="clear: right;" />
5680 <br style="clear: both;" />
5681 </p>
5682 !!end
5683
5684 !! test
5685 Handling html with a div self-closing tag
5686 !! input
5687 <div title />
5688 <div title/>
5689 <div title/ >
5690 <div title=bar />
5691 <div title=bar/>
5692 <div title=bar/ >
5693 !! result
5694 <p>&lt;div title /&gt;
5695 &lt;div title/&gt;
5696 </p>
5697 <div>
5698 <p>&lt;div title=bar /&gt;
5699 &lt;div title=bar/&gt;
5700 </p>
5701 <div title="bar/"></div>
5702 </div>
5703
5704 !! end
5705
5706 !! test
5707 Handling html with a br self-closing tag
5708 !! input
5709 <br title />
5710 <br title/>
5711 <br title/ >
5712 <br title=bar />
5713 <br title=bar/>
5714 <br title=bar/ >
5715 !! result
5716 <p><br title="title" />
5717 <br title="title" />
5718 <br />
5719 <br title="bar" />
5720 <br title="bar" />
5721 <br title="bar/" />
5722 </p>
5723 !! end
5724
5725 !! test
5726 Horizontal ruler (should it add that extra space?)
5727 !! input
5728 <hr>
5729 <hr >
5730 foo <hr
5731 > bar
5732 !! result
5733 <hr />
5734 <hr />
5735 foo <hr /> bar
5736
5737 !! end
5738
5739 !! test
5740 Horizontal ruler -- 4+ dashes render hr
5741 !! input
5742 ----
5743 !! result
5744 <hr />
5745
5746 !! end
5747
5748 !! test
5749 Horizontal ruler -- eats additional dashes on the same line
5750 !! input
5751 ---------
5752 !! result
5753 <hr />
5754
5755 !! end
5756
5757 !! test
5758 Horizontal ruler -- does not collapse dashes on consecutive lines
5759 !! input
5760 ----
5761 ----
5762 !! result
5763 <hr />
5764 <hr />
5765
5766 !! end
5767
5768 !! test
5769 Horizontal ruler -- <4 dashes render as plain text
5770 !! input
5771 ---
5772 !! result
5773 <p>---
5774 </p>
5775 !! end
5776
5777 !! test
5778 Horizontal ruler -- Supports content following dashes on same line
5779 !! input
5780 ---- Foo
5781 !! result
5782 <hr /> Foo
5783
5784 !! end
5785
5786 ###
5787 ### Block-level elements
5788 ###
5789 !! test
5790 Common list
5791 !! input
5792 *Common list
5793 * item 2
5794 *item 3
5795 !! result
5796 <ul>
5797 <li>Common list
5798 </li>
5799 <li> item 2
5800 </li>
5801 <li>item 3
5802 </li>
5803 </ul>
5804
5805 !! end
5806
5807 !! test
5808 Numbered list
5809 !! input
5810 #Numbered list
5811 #item 2
5812 # item 3
5813 !! result
5814 <ol>
5815 <li>Numbered list
5816 </li>
5817 <li>item 2
5818 </li>
5819 <li> item 3
5820 </li>
5821 </ol>
5822
5823 !! end
5824
5825 !! test
5826 Mixed list
5827 !! input
5828 *Mixed list
5829 *# with numbers
5830 ** and bullets
5831 *# and numbers
5832 *bullets again
5833 **bullet level 2
5834 ***bullet level 3
5835 ***#Number on level 4
5836 **bullet level 2
5837 **#Number on level 3
5838 **#Number on level 3
5839 *#number level 2
5840 *Level 1
5841 *** Level 3
5842 #** Level 3, but ordered
5843 !! result
5844 <ul>
5845 <li>Mixed list
5846 <ol>
5847 <li> with numbers
5848 </li>
5849 </ol>
5850 <ul>
5851 <li> and bullets
5852 </li>
5853 </ul>
5854 <ol>
5855 <li> and numbers
5856 </li>
5857 </ol>
5858 </li>
5859 <li>bullets again
5860 <ul>
5861 <li>bullet level 2
5862 <ul>
5863 <li>bullet level 3
5864 <ol>
5865 <li>Number on level 4
5866 </li>
5867 </ol>
5868 </li>
5869 </ul>
5870 </li>
5871 <li>bullet level 2
5872 <ol>
5873 <li>Number on level 3
5874 </li>
5875 <li>Number on level 3
5876 </li>
5877 </ol>
5878 </li>
5879 </ul>
5880 <ol>
5881 <li>number level 2
5882 </li>
5883 </ol>
5884 </li>
5885 <li>Level 1
5886 <ul>
5887 <li><ul>
5888 <li> Level 3
5889 </li>
5890 </ul>
5891 </li>
5892 </ul>
5893 </li>
5894 </ul>
5895 <ol>
5896 <li><ul>
5897 <li><ul>
5898 <li> Level 3, but ordered
5899 </li>
5900 </ul>
5901 </li>
5902 </ul>
5903 </li>
5904 </ol>
5905
5906 !! end
5907
5908 !! test
5909 Nested lists 1
5910 !! input
5911 *foo
5912 **bar
5913 !! result
5914 <ul>
5915 <li>foo
5916 <ul>
5917 <li>bar
5918 </li>
5919 </ul>
5920 </li>
5921 </ul>
5922
5923 !! end
5924
5925 !! test
5926 Nested lists 2
5927 !! input
5928 **foo
5929 *bar
5930 !! result
5931 <ul>
5932 <li><ul>
5933 <li>foo
5934 </li>
5935 </ul>
5936 </li>
5937 <li>bar
5938 </li>
5939 </ul>
5940
5941 !! end
5942
5943 !! test
5944 Nested lists 3 (first element empty)
5945 !! input
5946 *
5947 **bar
5948 !! result
5949 <ul>
5950 <li>
5951 <ul>
5952 <li>bar
5953 </li>
5954 </ul>
5955 </li>
5956 </ul>
5957
5958 !! end
5959
5960 !! test
5961 Nested lists 4 (first element empty)
5962 !! input
5963 **
5964 *bar
5965 !! result
5966 <ul>
5967 <li><ul>
5968 <li>
5969 </li>
5970 </ul>
5971 </li>
5972 <li>bar
5973 </li>
5974 </ul>
5975
5976 !! end
5977
5978 !! test
5979 Nested lists 5 (both elements empty)
5980 !! input
5981 **
5982 *
5983 !! result
5984 <ul>
5985 <li><ul>
5986 <li>
5987 </li>
5988 </ul>
5989 </li>
5990 <li>
5991 </li>
5992 </ul>
5993
5994 !! end
5995
5996 !! test
5997 Nested lists 6 (both elements empty)
5998 !! input
5999 *
6000 **
6001 !! result
6002 <ul>
6003 <li>
6004 <ul>
6005 <li>
6006 </li>
6007 </ul>
6008 </li>
6009 </ul>
6010
6011 !! end
6012
6013 !! test
6014 Nested lists 7 (skip initial nesting levels)
6015 !! input
6016 *** foo
6017 !! result
6018 <ul>
6019 <li><ul>
6020 <li><ul>
6021 <li> foo
6022 </li>
6023 </ul>
6024 </li>
6025 </ul>
6026 </li>
6027 </ul>
6028
6029 !! end
6030
6031 !! test
6032 Nested lists 8 (multiple nesting transitions)
6033 !! input
6034 * foo
6035 *** bar
6036 ** baz
6037 * boo
6038 !! result
6039 <ul>
6040 <li> foo
6041 <ul>
6042 <li><ul>
6043 <li> bar
6044 </li>
6045 </ul>
6046 </li>
6047 <li> baz
6048 </li>
6049 </ul>
6050 </li>
6051 <li> boo
6052 </li>
6053 </ul>
6054
6055 !! end
6056
6057 !! test
6058 1. Lists with start-of-line-transparent tokens before bullets: Comments
6059 !! input
6060 *foo
6061 *<!--cmt-->bar
6062 <!--cmt-->*baz
6063 !! result
6064 <ul>
6065 <li>foo
6066 </li>
6067 <li>bar
6068 </li>
6069 <li>baz
6070 </li>
6071 </ul>
6072
6073 !! end
6074
6075 !! test
6076 2. Lists with start-of-line-transparent tokens before bullets: Template close
6077 !! input
6078 *foo {{echo|bar
6079 }}*baz
6080 !! result
6081 <ul>
6082 <li>foo bar
6083 </li>
6084 <li>baz
6085 </li>
6086 </ul>
6087
6088 !! end
6089
6090 !! test
6091 List items are not parsed correctly following a <pre> block (bug 785)
6092 !! input
6093 * <pre>foo</pre>
6094 * <pre>bar</pre>
6095 * zar
6096 !! result
6097 <ul>
6098 <li> <pre>foo</pre>
6099 </li>
6100 <li> <pre>bar</pre>
6101 </li>
6102 <li> zar
6103 </li>
6104 </ul>
6105
6106 !! end
6107
6108 !! test
6109 List items from template
6110 !! input
6111
6112 {{inner list}}
6113 * item 2
6114
6115 * item 0
6116 {{inner list}}
6117 * item 2
6118
6119 * item 0
6120 * notSOL{{inner list}}
6121 * item 2
6122 !! result
6123 <ul>
6124 <li> item 1
6125 </li>
6126 <li> item 2
6127 </li>
6128 </ul>
6129 <ul>
6130 <li> item 0
6131 </li>
6132 <li> item 1
6133 </li>
6134 <li> item 2
6135 </li>
6136 </ul>
6137 <ul>
6138 <li> item 0
6139 </li>
6140 <li> notSOL
6141 </li>
6142 <li> item 1
6143 </li>
6144 <li> item 2
6145 </li>
6146 </ul>
6147
6148 !! end
6149
6150 !! test
6151 List interrupted by empty line or heading
6152 !! input
6153 * foo
6154
6155 ** bar
6156 == A heading ==
6157 * Another list item
6158 !! result
6159 <ul>
6160 <li> foo
6161 </li>
6162 </ul>
6163 <ul>
6164 <li><ul>
6165 <li> bar
6166 </li>
6167 </ul>
6168 </li>
6169 </ul>
6170 <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>
6171 <ul>
6172 <li> Another list item
6173 </li>
6174 </ul>
6175
6176 !!end
6177
6178 !!test
6179 Multiple list tags generated by templates
6180 !!input
6181 {{echo|<li>}}a
6182 {{echo|<li>}}b
6183 {{echo|<li>}}c
6184 !!result
6185 <li>a
6186 <li>b
6187 <li>c</li>
6188 </li>
6189 </li>
6190
6191 !!end
6192
6193 !!test
6194 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6195 !!input
6196 *a
6197 <!--This line will NOT split the list-->
6198 *b
6199 <!--This line will NOT split the list either-->
6200 *c
6201 <!--foo--> <!----> <!--This line NOT split the list either-->
6202 *d
6203 !!result
6204 <ul>
6205 <li>a
6206 </li>
6207 <li>b
6208 </li>
6209 <li>c
6210 </li>
6211 <li>d
6212 </li>
6213 </ul>
6214
6215 !!end
6216
6217 !!test
6218 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6219 !!input
6220 *a
6221 <!--This line will NOT split the list-->
6222 *b
6223 <!--This line will NOT split the list either-->
6224 *c
6225 <!--foo--> <!----> <!--This line NOT split the list
6226 either-->
6227 *d
6228 !!result
6229 <ul>
6230 <li>a
6231 </li>
6232 <li>b
6233 </li>
6234 <li>c
6235 </li>
6236 <li>d
6237 </li>
6238 </ul>
6239
6240 !!end
6241
6242 !!test
6243 Test the li-hack
6244 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6245 !!options
6246 parsoid=wt2html,wt2wt
6247 !!input
6248 * foo
6249 * <li>li-hack
6250 * {{echo|<li>templated li-hack}}
6251 * <!--foo--> <li> unsupported li-hack with preceding comments
6252
6253 <ul>
6254 <li><li>not a li-hack
6255 </li>
6256 </ul>
6257 !!result
6258 <ul>
6259 <li> foo</li>
6260 <li>li-hack</li>
6261 <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>
6262 <li> <!--foo--> </li>
6263 <li> li-hack with preceding comments</li>
6264 </ul>
6265
6266 <ul>
6267 <li></li>
6268 <li>not a li-hack
6269 </li>
6270 </ul>
6271 !!end
6272
6273 !! test
6274 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6275 !! options
6276 parsoid
6277 !! input
6278 # foo
6279 ## bar
6280 * foo
6281 ** bar
6282 : foo
6283 :: bar
6284 !! result
6285 <ol>
6286 <li> foo<ol>
6287 <li> bar</li>
6288 </ol></li>
6289 </ol><ul>
6290 <li> foo<ul>
6291 <li> bar</li>
6292 </ul></li>
6293 </ul><dl>
6294 <dd> foo<dl>
6295 <dd> bar</dd>
6296 </dl></dd>
6297 </dl>
6298 !! end
6299
6300 !! test
6301 Parsoid: Test of whitespace serialization with Templated bullets
6302 !! options
6303 parsoid
6304 !! input
6305 * {{bullet}}
6306 !! result
6307 <ul>
6308 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6309 </ul>
6310 !! end
6311
6312 # ------------------------------------------------------------------------
6313 # The next set of tests are about Parsoid's ability to handle badly nested
6314 # tags (parse, minimize scope of fixup, and roundtrip back)
6315 # ------------------------------------------------------------------------
6316
6317 !! test
6318 Unbalanced closing block tags break a list
6319 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6320 !! options
6321 parsoid
6322 !! input
6323 <div>
6324 *a</div><div>
6325 *b</div>
6326 !! result
6327 <div>
6328 <ul>
6329 <li>a
6330 </li>
6331 </ul></div><div>
6332 <ul>
6333 <li>b
6334 </li>
6335 </ul></div>
6336 !! end
6337
6338 !! test
6339 Unbalanced closing non-block tags don't break a list
6340 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6341 !! options
6342 parsoid
6343 !! input
6344 <span>
6345 *a</span><span>
6346 *b</span>
6347 !! result
6348 <p><span></span>
6349 </p>
6350 <ul>
6351 <li>a<span></span>
6352 </li>
6353 <li>b
6354 </li>
6355 </ul>
6356 !! end
6357
6358 !! test
6359 Unclosed formatting tags that straddle lists are closed and reopened
6360 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6361 !! options
6362 parsoid
6363 !! input
6364 # <s> a
6365 # b </s>
6366 !! result
6367 <ol>
6368 <li> <s> a </s>
6369 </li>
6370 <li> <s> b </s>
6371 </li>
6372 </ol>
6373 !! end
6374
6375 !!test
6376 List embedded in a non-block tag
6377 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6378 !! options
6379 parsoid
6380 !!input
6381 <small>
6382 * foo
6383 </small>
6384 !!result
6385 <p><small></small></p>
6386 <small>
6387 <ul>
6388 <li> foo</li>
6389 </ul>
6390 </small>
6391 <p><small></small></p>
6392 !!end
6393
6394 !! test
6395 Table with missing opening <tr> tag
6396 !! options
6397 parsoid=wt2html,wt2wt
6398 !! input
6399 <table>
6400 <td>foo</td>
6401 </tr>
6402 </table>
6403 !! result
6404 <table>
6405 <tr>
6406 <td>foo</td>
6407 </tr>
6408 </table>
6409 !! end
6410
6411 ###
6412 ### Magic Words
6413 ###
6414
6415 # Note that the current date is hard-coded as
6416 # 1970-01-01T00:02:03Z (a Thursday)
6417 # when running parser tests. The timezone is also fixed to GMT, so
6418 # local date will be identical to current date.
6419
6420 !! test
6421 Magic Word: {{CURRENTDAY}}
6422 !! input
6423 {{CURRENTDAY}}
6424 !! result
6425 <p>1
6426 </p>
6427 !! end
6428
6429 !! test
6430 Magic Word: {{CURRENTDAY2}}
6431 !! input
6432 {{CURRENTDAY2}}
6433 !! result
6434 <p>01
6435 </p>
6436 !! end
6437
6438 !! test
6439 Magic Word: {{CURRENTDAYNAME}}
6440 !! input
6441 {{CURRENTDAYNAME}}
6442 !! result
6443 <p>Thursday
6444 </p>
6445 !! end
6446
6447 !! test
6448 Magic Word: {{CURRENTDOW}}
6449 !! input
6450 {{CURRENTDOW}}
6451 !! result
6452 <p>4
6453 </p>
6454 !! end
6455
6456 !! test
6457 Magic Word: {{CURRENTMONTH}}
6458 !! input
6459 {{CURRENTMONTH}}
6460 !! result
6461 <p>01
6462 </p>
6463 !! end
6464
6465 !! test
6466 Magic Word: {{CURRENTMONTH1}}
6467 !! input
6468 {{CURRENTMONTH1}}
6469 !! result
6470 <p>1
6471 </p>
6472 !! end
6473
6474 !! test
6475 Magic Word: {{CURRENTMONTHABBREV}}
6476 !! input
6477 {{CURRENTMONTHABBREV}}
6478 !! result
6479 <p>Jan
6480 </p>
6481 !! end
6482
6483 !! test
6484 Magic Word: {{CURRENTMONTHNAME}}
6485 !! input
6486 {{CURRENTMONTHNAME}}
6487 !! result
6488 <p>January
6489 </p>
6490 !! end
6491
6492 !! test
6493 Magic Word: {{CURRENTMONTHNAMEGEN}}
6494 !! input
6495 {{CURRENTMONTHNAMEGEN}}
6496 !! result
6497 <p>January
6498 </p>
6499 !! end
6500
6501 !! test
6502 Magic Word: {{CURRENTTIME}}
6503 !! input
6504 {{CURRENTTIME}}
6505 !! result
6506 <p>00:02
6507 </p>
6508 !! end
6509
6510 !! test
6511 Magic Word: {{CURRENTHOUR}}
6512 !! input
6513 {{CURRENTHOUR}}
6514 !! result
6515 <p>00
6516 </p>
6517 !! end
6518
6519 !! test
6520 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6521 !! input
6522 {{CURRENTWEEK}}
6523 !! result
6524 <p>1
6525 </p>
6526 !! end
6527
6528 !! test
6529 Magic Word: {{CURRENTYEAR}}
6530 !! input
6531 {{CURRENTYEAR}}
6532 !! result
6533 <p>1970
6534 </p>
6535 !! end
6536
6537 !! test
6538 Magic Word: {{CURRENTTIMESTAMP}}
6539 !! input
6540 {{CURRENTTIMESTAMP}}
6541 !! result
6542 <p>19700101000203
6543 </p>
6544 !! end
6545
6546 !! test
6547 Magic Words LOCAL (UTC)
6548 !! input
6549 * {{LOCALMONTH}}
6550 * {{LOCALMONTH1}}
6551 * {{LOCALMONTHNAME}}
6552 * {{LOCALMONTHNAMEGEN}}
6553 * {{LOCALMONTHABBREV}}
6554 * {{LOCALDAY}}
6555 * {{LOCALDAY2}}
6556 * {{LOCALDAYNAME}}
6557 * {{LOCALYEAR}}
6558 * {{LOCALTIME}}
6559 * {{LOCALHOUR}}
6560 * {{LOCALWEEK}}
6561 * {{LOCALDOW}}
6562 * {{LOCALTIMESTAMP}}
6563 !! result
6564 <ul>
6565 <li> 01
6566 </li>
6567 <li> 1
6568 </li>
6569 <li> January
6570 </li>
6571 <li> January
6572 </li>
6573 <li> Jan
6574 </li>
6575 <li> 1
6576 </li>
6577 <li> 01
6578 </li>
6579 <li> Thursday
6580 </li>
6581 <li> 1970
6582 </li>
6583 <li> 00:02
6584 </li>
6585 <li> 00
6586 </li>
6587 <li> 1
6588 </li>
6589 <li> 4
6590 </li>
6591 <li> 19700101000203
6592 </li>
6593 </ul>
6594
6595 !! end
6596
6597 !! test
6598 Magic Word: {{FULLPAGENAME}}
6599 !! options
6600 title=[[User:Ævar Arnfjörð Bjarmason]]
6601 !! input
6602 {{FULLPAGENAME}}
6603 !! result
6604 <p>User:Ævar Arnfjörð Bjarmason
6605 </p>
6606 !! end
6607
6608 !! test
6609 Magic Word: {{FULLPAGENAMEE}}
6610 !! options
6611 title=[[User:Ævar Arnfjörð Bjarmason]]
6612 !! input
6613 {{FULLPAGENAMEE}}
6614 !! result
6615 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6616 </p>
6617 !! end
6618
6619 !! test
6620 Magic Word: {{TALKSPACE}}
6621 !! options
6622 title=[[User:Ævar Arnfjörð Bjarmason]]
6623 !! input
6624 {{TALKSPACE}}
6625 !! result
6626 <p>User talk
6627 </p>
6628 !! end
6629
6630 !! test
6631 Magic Word: {{TALKSPACE}}, same namespace
6632 !! options
6633 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6634 !! input
6635 {{TALKSPACE}}
6636 !! result
6637 <p>User talk
6638 </p>
6639 !! end
6640
6641 !! test
6642 Magic Word: {{TALKSPACE}}, main namespace
6643 !! options
6644 title=[[Parser Test]]
6645 !! input
6646 {{TALKSPACE}}
6647 !! result
6648 <p>Talk
6649 </p>
6650 !! end
6651
6652 !! test
6653 Magic Word: {{TALKSPACEE}}
6654 !! options
6655 title=[[User:Ævar Arnfjörð Bjarmason]]
6656 !! input
6657 {{TALKSPACEE}}
6658 !! result
6659 <p>User_talk
6660 </p>
6661 !! end
6662
6663 !! test
6664 Magic Word: {{SUBJECTSPACE}}
6665 !! options
6666 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6667 !! input
6668 {{SUBJECTSPACE}}
6669 !! result
6670 <p>User
6671 </p>
6672 !! end
6673
6674 !! test
6675 Magic Word: {{SUBJECTSPACE}}, same namespace
6676 !! options
6677 title=[[User:Ævar Arnfjörð Bjarmason]]
6678 !! input
6679 {{SUBJECTSPACE}}
6680 !! result
6681 <p>User
6682 </p>
6683 !! end
6684
6685 !! test
6686 Magic Word: {{SUBJECTSPACE}}, main namespace
6687 !! options
6688 title=[[Parser Test]]
6689 !! input
6690 {{SUBJECTSPACE}}
6691 !! result
6692
6693 !! end
6694
6695 !! test
6696 Magic Word: {{SUBJECTSPACEE}}
6697 !! options
6698 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6699 !! input
6700 {{SUBJECTSPACEE}}
6701 !! result
6702 <p>User
6703 </p>
6704 !! end
6705
6706 !! test
6707 Magic Word: {{NAMESPACE}}
6708 !! options
6709 title=[[User:Ævar Arnfjörð Bjarmason]]
6710 !! input
6711 {{NAMESPACE}}
6712 !! result
6713 <p>User
6714 </p>
6715 !! end
6716
6717 !! test
6718 Magic Word: {{NAMESPACEE}}
6719 !! options
6720 title=[[User:Ævar Arnfjörð Bjarmason]]
6721 !! input
6722 {{NAMESPACEE}}
6723 !! result
6724 <p>User
6725 </p>
6726 !! end
6727
6728 !! test
6729 Magic Word: {{NAMESPACENUMBER}}
6730 !! options
6731 title=[[User:Ævar Arnfjörð Bjarmason]]
6732 !! input
6733 {{NAMESPACENUMBER}}
6734 !! result
6735 <p>2
6736 </p>
6737 !! end
6738
6739 !! test
6740 Magic Word: {{SUBPAGENAME}}
6741 !! options
6742 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6743 !! input
6744 {{SUBPAGENAME}}
6745 !! result
6746 <p>sub ö
6747 </p>
6748 !! end
6749
6750 !! test
6751 Magic Word: {{SUBPAGENAMEE}}
6752 !! options
6753 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
6754 !! input
6755 {{SUBPAGENAMEE}}
6756 !! result
6757 <p>sub_%C3%B6
6758 </p>
6759 !! end
6760
6761 !! test
6762 Magic Word: {{ROOTPAGENAME}}
6763 !! options
6764 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6765 !! input
6766 {{ROOTPAGENAME}}
6767 !! result
6768 <p>Ævar Arnfjörð Bjarmason
6769 </p>
6770 !! end
6771
6772 !! test
6773 Magic Word: {{ROOTPAGENAMEE}}
6774 !! options
6775 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
6776 !! input
6777 {{ROOTPAGENAMEE}}
6778 !! result
6779 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6780 </p>
6781 !! end
6782
6783 !! test
6784 Magic Word: {{BASEPAGENAME}}
6785 !! options
6786 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6787 !! input
6788 {{BASEPAGENAME}}
6789 !! result
6790 <p>Ævar Arnfjörð Bjarmason
6791 </p>
6792 !! end
6793
6794 !! test
6795 Magic Word: {{BASEPAGENAMEE}}
6796 !! options
6797 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
6798 !! input
6799 {{BASEPAGENAMEE}}
6800 !! result
6801 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6802 </p>
6803 !! end
6804
6805 !! test
6806 Magic Word: {{TALKPAGENAME}}
6807 !! options
6808 title=[[User:Ævar Arnfjörð Bjarmason]]
6809 !! input
6810 {{TALKPAGENAME}}
6811 !! result
6812 <p>User talk:Ævar Arnfjörð Bjarmason
6813 </p>
6814 !! end
6815
6816 !! test
6817 Magic Word: {{TALKPAGENAMEE}}
6818 !! options
6819 title=[[User:Ævar Arnfjörð Bjarmason]]
6820 !! input
6821 {{TALKPAGENAMEE}}
6822 !! result
6823 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6824 </p>
6825 !! end
6826
6827 !! test
6828 Magic Word: {{SUBJECTPAGENAME}}
6829 !! options
6830 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6831 !! input
6832 {{SUBJECTPAGENAME}}
6833 !! result
6834 <p>User:Ævar Arnfjörð Bjarmason
6835 </p>
6836 !! end
6837
6838 !! test
6839 Magic Word: {{SUBJECTPAGENAMEE}}
6840 !! options
6841 title=[[User talk:Ævar Arnfjörð Bjarmason]]
6842 !! input
6843 {{SUBJECTPAGENAMEE}}
6844 !! result
6845 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6846 </p>
6847 !! end
6848
6849 !! test
6850 Magic Word: {{NUMBEROFFILES}}
6851 !! input
6852 {{NUMBEROFFILES}}
6853 !! result
6854 <p>4
6855 </p>
6856 !! end
6857
6858 !! test
6859 Magic Word: {{PAGENAME}}
6860 !! options
6861 title=[[User:Ævar Arnfjörð Bjarmason]]
6862 !! input
6863 {{PAGENAME}}
6864 !! result
6865 <p>Ævar Arnfjörð Bjarmason
6866 </p>
6867 !! end
6868
6869 !! test
6870 Magic Word: {{PAGENAME}} with metacharacters
6871 !! options
6872 title=[['foo & bar = baz']]
6873 !! input
6874 ''{{PAGENAME}}''
6875 !! result
6876 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
6877 </p>
6878 !! end
6879
6880 !! test
6881 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
6882 !! options
6883 title=[[*RFC 1234 http://example.com/]]
6884 !! input
6885 {{PAGENAME}}
6886 !! result
6887 <p>&#42;RFC&#32;1234 http&#58;//example.com/
6888 </p>
6889 !! end
6890
6891 !! test
6892 Magic Word: {{PAGENAMEE}}
6893 !! options
6894 title=[[User:Ævar Arnfjörð Bjarmason]]
6895 !! input
6896 {{PAGENAMEE}}
6897 !! result
6898 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
6899 </p>
6900 !! end
6901
6902 !! test
6903 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
6904 !! options
6905 title=[[*RFC 1234 http://example.com/]]
6906 !! input
6907 {{PAGENAMEE}}
6908 !! result
6909 <p>&#42;RFC_1234_http&#58;//example.com/
6910 </p>
6911 !! end
6912
6913 !! test
6914 Magic Word: {{REVISIONID}}
6915 !! input
6916 {{REVISIONID}}
6917 !! result
6918 <p>1337
6919 </p>
6920 !! end
6921
6922 !! test
6923 Magic Word: {{SCRIPTPATH}}
6924 !! input
6925 {{SCRIPTPATH}}
6926 !! result
6927 <p>/
6928 </p>
6929 !! end
6930
6931 !! test
6932 Magic Word: {{STYLEPATH}}
6933 !! input
6934 {{STYLEPATH}}
6935 !! result
6936 <p>/skins
6937 </p>
6938 !! end
6939
6940 !! test
6941 Magic Word: {{SERVER}}
6942 !! input
6943 {{SERVER}}
6944 !! result
6945 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6946 </p>
6947 !! end
6948
6949 !! test
6950 Magic Word: {{SERVERNAME}}
6951 !! input
6952 {{SERVERNAME}}
6953 !! result
6954 <p>example.org
6955 </p>
6956 !! end
6957
6958 !! test
6959 Magic Word: {{SITENAME}}
6960 !! input
6961 {{SITENAME}}
6962 !! result
6963 <p>MediaWiki
6964 </p>
6965 !! end
6966
6967 !! test
6968 Case-sensitive magic words, when cased differently, should just be template transclusions
6969 !! input
6970 {{CurrentMonth}}
6971 {{currentday}}
6972 {{cURreNTweEK}}
6973 {{currentHour}}
6974 !! result
6975 <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>
6976 <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>
6977 <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>
6978 <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>
6979 </p>
6980 !! end
6981
6982 !! test
6983 Case-insensitive magic words should still work with weird casing.
6984 !! input
6985 {{sErVeRNaMe}}
6986 {{LCFirst:AOEU}}
6987 {{ucFIRST:aoeu}}
6988 {{SERver}}
6989 !! result
6990 <p>example.org
6991 aOEU
6992 Aoeu
6993 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
6994 </p>
6995 !! end
6996
6997 !! test
6998 Namespace 1 {{ns:1}}
6999 !! input
7000 {{ns:1}}
7001 !! result
7002 <p>Talk
7003 </p>
7004 !! end
7005
7006 !! test
7007 Namespace 1 {{ns:01}}
7008 !! input
7009 {{ns:01}}
7010 !! result
7011 <p>Talk
7012 </p>
7013 !! end
7014
7015 !! test
7016 Namespace 0 {{ns:0}} (bug 4783)
7017 !! input
7018 {{ns:0}}
7019 !! result
7020
7021 !! end
7022
7023 !! test
7024 Namespace 0 {{ns:00}} (bug 4783)
7025 !! input
7026 {{ns:00}}
7027 !! result
7028
7029 !! end
7030
7031 !! test
7032 Namespace -1 {{ns:-1}}
7033 !! input
7034 {{ns:-1}}
7035 !! result
7036 <p>Special
7037 </p>
7038 !! end
7039
7040 !! test
7041 Namespace User {{ns:User}}
7042 !! input
7043 {{ns:User}}
7044 !! result
7045 <p>User
7046 </p>
7047 !! end
7048
7049 !! test
7050 Namespace User talk {{ns:User_talk}}
7051 !! input
7052 {{ns:User_talk}}
7053 !! result
7054 <p>User talk
7055 </p>
7056 !! end
7057
7058 !! test
7059 Namespace User talk {{ns:uSeR tAlK}}
7060 !! input
7061 {{ns:uSeR tAlK}}
7062 !! result
7063 <p>User talk
7064 </p>
7065 !! end
7066
7067 !! test
7068 Namespace File {{ns:File}}
7069 !! input
7070 {{ns:File}}
7071 !! result
7072 <p>File
7073 </p>
7074 !! end
7075
7076 !! test
7077 Namespace File {{ns:Image}}
7078 !! input
7079 {{ns:Image}}
7080 !! result
7081 <p>File
7082 </p>
7083 !! end
7084
7085 !! test
7086 Namespace (lang=de) Benutzer {{ns:User}}
7087 !! options
7088 language=de
7089 !! input
7090 {{ns:User}}
7091 !! result
7092 <p>Benutzer
7093 </p>
7094 !! end
7095
7096 !! test
7097 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7098 !! options
7099 language=de
7100 !! input
7101 {{ns:3}}
7102 !! result
7103 <p>Benutzer Diskussion
7104 </p>
7105 !! end
7106
7107
7108 !! test
7109 Urlencode
7110 !! input
7111 {{urlencode:hi world?!}}
7112 {{urlencode:hi world?!|WIKI}}
7113 {{urlencode:hi world?!|PATH}}
7114 {{urlencode:hi world?!|QUERY}}
7115 !! result
7116 <p>hi+world%3F%21
7117 hi_world%3F!
7118 hi%20world%3F%21
7119 hi+world%3F%21
7120 </p>
7121 !! end
7122
7123 ###
7124 ### Magic links
7125 ###
7126 !! test
7127 Magic links: internal link to RFC (bug 479)
7128 !! input
7129 [[RFC 123]]
7130 !! result
7131 <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>
7132 </p>
7133 !! end
7134
7135 !! test
7136 Magic links: RFC (bug 479)
7137 !! input
7138 RFC 822
7139 !! result
7140 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7141 </p>
7142 !! end
7143
7144 !! test
7145 Magic links: ISBN (bug 1937)
7146 !! input
7147 ISBN 0-306-40615-2
7148 !! result
7149 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Magic links: PMID incorrectly converts space to underscore
7155 !! input
7156 PMID 1234
7157 !! result
7158 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7159 </p>
7160 !! end
7161
7162 ###
7163 ### Templates
7164 ####
7165
7166 !! test
7167 Nonexistent template
7168 !! input
7169 {{thistemplatedoesnotexist}}
7170 !! result
7171 <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>
7172 </p>
7173 !! end
7174
7175 !! test
7176 Template with invalid target containing tags
7177 !! input
7178 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7179 !! result
7180 <p>{{a<b>b</b>|foo|a=b|a = b}}
7181 </p>
7182 !! end
7183
7184 !! test
7185 Template with invalid target containing unclosed tag
7186 !! input
7187 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7188 !! result
7189 <p>{{a<b>|foo|a=b|a = b}}</b>
7190 </p>
7191 !! end
7192
7193 !! article
7194 Template:test
7195 !! text
7196 This is a test template
7197 !! endarticle
7198
7199 !! test
7200 Simple template
7201 !! input
7202 {{test}}
7203 !! result
7204 <p>This is a test template
7205 </p>
7206 !! end
7207
7208 !! test
7209 Template with explicit namespace
7210 !! input
7211 {{Template:test}}
7212 !! result
7213 <p>This is a test template
7214 </p>
7215 !! end
7216
7217
7218 !! article
7219 Template:paramtest
7220 !! text
7221 This is a test template with parameter {{{param}}}
7222 !! endarticle
7223
7224 !! test
7225 Template parameter
7226 !! input
7227 {{paramtest|param=foo}}
7228 !! result
7229 <p>This is a test template with parameter foo
7230 </p>
7231 !! end
7232
7233 !! article
7234 Template:paramtestnum
7235 !! text
7236 [[{{{1}}}|{{{2}}}]]
7237 !! endarticle
7238
7239 !! test
7240 Template unnamed parameter
7241 !! input
7242 {{paramtestnum|Main Page|the main page}}
7243 !! result
7244 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7245 </p>
7246 !! end
7247
7248 !! article
7249 Template:templatesimple
7250 !! text
7251 (test)
7252 !! endarticle
7253
7254 !! article
7255 Template:templateredirect
7256 !! text
7257 #redirect [[Template:templatesimple]]
7258 !! endarticle
7259
7260 !! article
7261 Template:templateasargtestnum
7262 !! text
7263 {{{{{1}}}}}
7264 !! endarticle
7265
7266 !! article
7267 Template:templateasargtest
7268 !! text
7269 {{template{{{templ}}}}}
7270 !! endarticle
7271
7272 !! article
7273 Template:templateasargtest2
7274 !! text
7275 {{{{{templ}}}}}
7276 !! endarticle
7277
7278 !! test
7279 Template with template name as unnamed argument
7280 !! input
7281 {{templateasargtestnum|templatesimple}}
7282 !! result
7283 <p>(test)
7284 </p>
7285 !! end
7286
7287 !! test
7288 Template with template name as argument
7289 !! input
7290 {{templateasargtest|templ=simple}}
7291 !! result
7292 <p>(test)
7293 </p>
7294 !! end
7295
7296 !! test
7297 Template with template name as argument (2)
7298 !! input
7299 {{templateasargtest2|templ=templatesimple}}
7300 !! result
7301 <p>(test)
7302 </p>
7303 !! end
7304
7305 !! article
7306 Template:templateasargtestdefault
7307 !! text
7308 {{{{{templ|templatesimple}}}}}
7309 !! endarticle
7310
7311 !! article
7312 Template:templa
7313 !! text
7314 '''templ'''
7315 !! endarticle
7316
7317 !! test
7318 Template with default value
7319 !! input
7320 {{templateasargtestdefault}}
7321 !! result
7322 <p>(test)
7323 </p>
7324 !! end
7325
7326 !! test
7327 Template with default value (value set)
7328 !! input
7329 {{templateasargtestdefault|templ=templa}}
7330 !! result
7331 <p><b>templ</b>
7332 </p>
7333 !! end
7334
7335 !! test
7336 Template redirect
7337 !! input
7338 {{templateredirect}}
7339 !! result
7340 <p>(test)
7341 </p>
7342 !! end
7343
7344 !! test
7345 Template with argument in separate line
7346 !! input
7347 {{ templateasargtest |
7348 templ = simple }}
7349 !! result
7350 <p>(test)
7351 </p>
7352 !! end
7353
7354 !! test
7355 Template with complex template as argument
7356 !! input
7357 {{paramtest|
7358 param ={{ templateasargtest |
7359 templ = simple }}}}
7360 !! result
7361 <p>This is a test template with parameter (test)
7362 </p>
7363 !! end
7364
7365 !! test
7366 Template with thumb image (with link in description)
7367 !! input
7368 {{paramtest|
7369 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7370 !! result
7371 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>
7372
7373 !! end
7374
7375 !! article
7376 Template:complextemplate
7377 !! text
7378 {{{1}}} {{paramtest|
7379 param ={{{param}}}}}
7380 !! endarticle
7381
7382 !! test
7383 Template with complex arguments
7384 !! input
7385 {{complextemplate|
7386 param ={{ templateasargtest |
7387 templ = simple }}|[[Template:complextemplate|link]]}}
7388 !! result
7389 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7390 </p>
7391 !! end
7392
7393 !! test
7394 BUG 553: link with two variables in a piped link
7395 !! input
7396 {|
7397 |[[{{{1}}}|{{{2}}}]]
7398 |}
7399 !! result
7400 <table>
7401 <tr>
7402 <td>[[{{{1}}}|{{{2}}}]]
7403 </td></tr></table>
7404
7405 !! end
7406
7407 !! test
7408 Magic variable as template parameter
7409 !! input
7410 {{paramtest|param={{SITENAME}}}}
7411 !! result
7412 <p>This is a test template with parameter MediaWiki
7413 </p>
7414 !! end
7415
7416 !! article
7417 Template:linktest
7418 !! text
7419 [[{{{param}}}|link]]
7420 !! endarticle
7421
7422 !! test
7423 Template parameter as link source
7424 !! input
7425 {{linktest|param=Main Page}}
7426 !! result
7427 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7428 </p>
7429 !! end
7430
7431 !!test
7432 Template-generated attribute string (k='v')
7433 !!input
7434 <span {{attr_str|id|v1}}>bar</span>
7435 !!result
7436 <p><span id="v1">bar</span>
7437 </p>
7438 !!end
7439
7440 !!article
7441 Template:paramtest2
7442 !! text
7443 including another template, {{paramtest|param={{{arg}}}}}
7444 !! endarticle
7445
7446 !! test
7447 Template passing argument to another template
7448 !! input
7449 {{paramtest2|arg='hmm'}}
7450 !! result
7451 <p>including another template, This is a test template with parameter 'hmm'
7452 </p>
7453 !! end
7454
7455 !! article
7456 Template:Linktest2
7457 !! text
7458 Main Page
7459 !! endarticle
7460
7461 !! test
7462 Template as link source
7463 !! input
7464 [[{{linktest2}}]]
7465
7466 [[{{linktest2}}|Main Page]]
7467
7468 [[{{linktest2}}]]Page
7469 !! result
7470 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7471 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7472 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7473 </p>
7474 !! end
7475
7476
7477 !! article
7478 Template:loop1
7479 !! text
7480 {{loop2}}
7481 !! endarticle
7482
7483 !! article
7484 Template:loop2
7485 !! text
7486 {{loop1}}
7487 !! endarticle
7488
7489 !! test
7490 Template infinite loop
7491 !! input
7492 {{loop1}}
7493 !! result
7494 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7495 </p>
7496 !! end
7497
7498 !! test
7499 Template from main namespace
7500 !! input
7501 {{:Main Page}}
7502 !! result
7503 <p>blah blah
7504 </p>
7505 !! end
7506
7507 !! article
7508 Template:table
7509 !! text
7510 {|
7511 | 1 || 2
7512 |-
7513 | 3 || 4
7514 |}
7515 !! endarticle
7516
7517 !! test
7518 BUG 529: Template with table, not included at beginning of line
7519 !! input
7520 foo {{table}}
7521 !! result
7522 <p>foo
7523 </p>
7524 <table>
7525 <tr>
7526 <td> 1 </td>
7527 <td> 2
7528 </td></tr>
7529 <tr>
7530 <td> 3 </td>
7531 <td> 4
7532 </td></tr></table>
7533
7534 !! end
7535
7536 !! test
7537 BUG 523: Template shouldn't eat newline (or add an extra one before table)
7538 !! input
7539 foo
7540 {{table}}
7541 !! result
7542 <p>foo
7543 </p>
7544 <table>
7545 <tr>
7546 <td> 1 </td>
7547 <td> 2
7548 </td></tr>
7549 <tr>
7550 <td> 3 </td>
7551 <td> 4
7552 </td></tr></table>
7553
7554 !! end
7555
7556 !! test
7557 BUG 41: Template parameters shown as broken links
7558 !! input
7559 {{{parameter}}}
7560 !! result
7561 <p>{{{parameter}}}
7562 </p>
7563 !! end
7564
7565 !! test
7566 Template with targets containing wikilinks
7567 !! input
7568 {{[[foo]]}}
7569
7570 {{[[{{echo|foo}}]]}}
7571
7572 {{{{echo|[[foo}}]]}}
7573 !! result
7574 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7575 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
7576 </p><p>{{[[foo}}]]
7577 </p>
7578 !! end
7579
7580 !! article
7581 Template:MSGNW test
7582 !! text
7583 ''None'' of '''this''' should be
7584 * interpreted
7585 but rather passed unmodified
7586 {{test}}
7587 !! endarticle
7588
7589 # hmm, fix this or just deprecate msgnw and document its behavior?
7590 !! test
7591 msgnw keyword
7592 !! options
7593 disabled
7594 !! input
7595 {{msgnw:MSGNW test}}
7596 !! result
7597 <p>''None'' of '''this''' should be
7598 * interpreted
7599 but rather passed unmodified
7600 {{test}}
7601 </p>
7602 !! end
7603
7604 !! test
7605 int keyword
7606 !! input
7607 {{int:youhavenewmessages|lots of money|not!}}
7608 !! result
7609 <p>You have lots of money (not!).
7610 </p>
7611 !! end
7612
7613 !! article
7614 Template:Includes
7615 !! text
7616 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7617 !! endarticle
7618
7619 !! test
7620 <includeonly> and <noinclude> being included
7621 !! input
7622 {{Includes}}
7623 !! result
7624 <p>Foobar
7625 </p>
7626 !! end
7627
7628 !! article
7629 Template:Includes2
7630 !! text
7631 <onlyinclude>Foo</onlyinclude>bar
7632 !! endarticle
7633
7634 !! test
7635 <onlyinclude> being included
7636 !! input
7637 {{Includes2}}
7638 !! result
7639 <p>Foo
7640 </p>
7641 !! end
7642
7643
7644 !! article
7645 Template:Includes3
7646 !! text
7647 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
7648 !! endarticle
7649
7650 !! test
7651 <onlyinclude> and <includeonly> being included
7652 !! input
7653 {{Includes3}}
7654 !! result
7655 <p>Foo
7656 </p>
7657 !! end
7658
7659 !! test
7660 <includeonly> and <noinclude> on a page
7661 !! input
7662 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
7663 !! result
7664 <p>Foozar
7665 </p>
7666 !! end
7667
7668 !! test
7669 Un-closed <noinclude>
7670 !! input
7671 <noinclude>
7672 !! result
7673 !! end
7674
7675 !! test
7676 <onlyinclude> on a page
7677 !! input
7678 <onlyinclude>Foo</onlyinclude>bar
7679 !! result
7680 <p>Foobar
7681 </p>
7682 !! end
7683
7684 !! test
7685 Un-closed <onlyinclude>
7686 !! input
7687 <onlyinclude>
7688 !! result
7689 !! end
7690
7691 !!test
7692 Self-closed noinclude, includeonly, onlyinclude tags
7693 !!input
7694 <noinclude />
7695 <includeonly />
7696 <onlyinclude />
7697 !!result
7698 <p><br />
7699 </p>
7700 !!end
7701
7702 !!test
7703 Unbalanced includeonly and noinclude tags
7704 !!input
7705 {|
7706 |a</noinclude>
7707 |b</noinclude></noinclude>
7708 |c</noinclude></includeonly>
7709 |d</includeonly></includeonly>
7710 |}
7711 !!result
7712 <table>
7713 <tr>
7714 <td>a
7715 </td>
7716 <td>b
7717 </td>
7718 <td>c&lt;/includeonly&gt;
7719 </td>
7720 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
7721 </td></tr></table>
7722
7723 !!end
7724
7725 !! article
7726 Template:Includeonly section
7727 !! text
7728 <includeonly>
7729 ==Includeonly section==
7730 </includeonly>
7731 ==Section T-1==
7732 !!endarticle
7733
7734 !! test
7735 Bug 6563: Edit link generation for section shown by <includeonly>
7736 !! input
7737 {{includeonly section}}
7738 !! result
7739 <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>
7740 <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>
7741
7742 !! end
7743
7744 # Uses same input as the contents of [[Template:Includeonly section]]
7745 !! test
7746 Bug 6563: Section extraction for section shown by <includeonly>
7747 !! options
7748 section=T-2
7749 !! input
7750 <includeonly>
7751 ==Includeonly section==
7752 </includeonly>
7753 ==Section T-2==
7754 !! result
7755 ==Section T-2==
7756 !! end
7757
7758 !! test
7759 Bug 6563: Edit link generation for section suppressed by <includeonly>
7760 !! input
7761 <includeonly>
7762 ==Includeonly section==
7763 </includeonly>
7764 ==Section 1==
7765 !! result
7766 <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>
7767
7768 !! end
7769
7770 !! test
7771 Bug 6563: Section extraction for section suppressed by <includeonly>
7772 !! options
7773 section=1
7774 !! input
7775 <includeonly>
7776 ==Includeonly section==
7777 </includeonly>
7778 ==Section 1==
7779 !! result
7780 ==Section 1==
7781 !! end
7782
7783 !! test
7784 Un-closed <includeonly>
7785 !! input
7786 <includeonly>
7787 !! result
7788 !! end
7789
7790 # TODO: test with DOM fragment reuse!
7791 !! test
7792 Parsoid: DOM fragment reuse
7793 !! options
7794 parsoid=wt2wt,wt2html
7795 !! input
7796 a{{echo|b<table></table>c}}d
7797
7798 a{{echo|b
7799 <table></table>
7800 c}}d
7801
7802 {{echo|a
7803
7804 <table></table>
7805
7806 b}}
7807 !! result
7808 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
7809 <table></table>c"}},"i":0}}]}'>b</span>
7810 <table about="#mwt1"></table><span about="#mwt1">c</span>d
7811
7812
7813 <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">
7814 </span>
7815 <table about="#mwt2"></table><span about="#mwt2">
7816 </span>
7817 <p about="#mwt2">cd</p>
7818
7819
7820 <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">
7821
7822 </span>
7823 <table about="#mwt3"></table><span about="#mwt3">
7824
7825 </span>
7826 <p about="#mwt3">b</p>
7827 !! end
7828
7829 !! test
7830 Parsoid: Merge double tds (bug 50603)
7831 !! options
7832 parsoid
7833 !! input
7834 {|
7835 |{{echo|{{!}} foo}}
7836 |}
7837 !! result
7838 <table><tbody>
7839 <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>
7840 </tbody></table>
7841 !! end
7842
7843 !! test
7844 Parsoid: Merge double tds in nested transclusion content (bug 50603)
7845 !! options
7846 parsoid
7847 !! input
7848 {{echo|<div>}}
7849 {|
7850 |{{echo|{{!}} foo}}
7851 |}
7852 {{echo|</div>}}
7853 !! result
7854 <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}}]}'>
7855 <table><tbody>
7856 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
7857 </tbody></table>
7858 </div>
7859 !! end
7860
7861 ###
7862 ### <includeonly> and <noinclude> in attributes
7863 ###
7864 !!test
7865 0. includeonly around the entire attribute
7866 !!input
7867 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
7868 !!result
7869 <p><span id="v2">bar</span>
7870 </p>
7871 !!end
7872
7873 !!test
7874 1. includeonly in html attr key
7875 !!input
7876 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
7877 !!result
7878 <p><span id="foo">bar</span>
7879 </p>
7880 !!end
7881
7882 !!test
7883 2. includeonly in html attr value
7884 !!input
7885 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
7886 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
7887 !!result
7888 <p><span id="v1">bar</span>
7889 <span id="v1">bar</span>
7890 </p>
7891 !!end
7892
7893 !!test
7894 3. includeonly in part of an attr value
7895 !!input
7896 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
7897 !!result
7898 <p><span style="color:red;">bar</span>
7899 </p>
7900 !!end
7901
7902 ###
7903 ### Testing parsing of templates where a template arg
7904 ### has the same name as the template itself.
7905 ###
7906
7907 !! article
7908 Template:quote
7909 !! text
7910 {{{quote|{{{1}}}}}}
7911 !! endarticle
7912
7913 !!test
7914 Templates: Template Name/Arg clash: 1. Use of positional param
7915 !!input
7916 {{quote|foo}}
7917 !!result
7918 <p>foo
7919 </p>
7920 !!end
7921
7922 !!test
7923 Templates: Template Name/Arg clash: 2. Use of named param
7924 !!input
7925 {{quote|quote=foo}}
7926 !!result
7927 <p>foo
7928 </p>
7929 !!end
7930
7931 !!test
7932 Templates: Template Name/Arg clash: 3. Use of named param with empty input
7933 !!input
7934 {{quote|quote}}
7935 !!result
7936 <p>quote
7937 </p>
7938 !!end
7939
7940 ###
7941 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
7942 ###
7943
7944 !!test
7945 Templates: 1. Simple use
7946 !!input
7947 {{echo|Foo}}
7948 !!result
7949 <p>Foo
7950 </p>
7951 !!end
7952
7953 !!test
7954 Templates: 2. Inside a block tag
7955 !!input
7956 <div>{{echo|Foo}}</div>
7957 <blockquote>{{echo|Foo}}</blockquote>
7958 !!result
7959 <div>Foo</div>
7960 <blockquote>Foo</blockquote>
7961
7962 !!end
7963
7964 !!test
7965 Templates: P-wrapping: 1a. Templates on consecutive lines
7966 !!input
7967 {{echo|Foo}}
7968 {{echo|bar}}
7969 !!result
7970 <p>Foo
7971 bar
7972 </p>
7973 !!end
7974
7975 !!test
7976 Templates: P-wrapping: 1b. Templates on consecutive lines
7977 !!input
7978 Foo
7979
7980 {{echo|bar}}
7981 {{echo|baz}}
7982 !!result
7983 <p>Foo
7984 </p><p>bar
7985 baz
7986 </p>
7987 !!end
7988
7989 !!test
7990 Templates: P-wrapping: 1c. Templates on consecutive lines
7991 !!input
7992 {{echo|Foo}}
7993 {{echo|bar}} <div>baz</div>
7994 !!result
7995 <p>Foo
7996 </p>
7997 bar <div>baz</div>
7998
7999 !!end
8000
8001 !!test
8002 Templates: P-wrapping: 1d. Template preceded by comment-only line
8003 !!options
8004 parsoid
8005 !!input
8006 <!-- foo -->
8007 {{echo|Bar}}
8008 !!result
8009 <!-- foo -->
8010
8011 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8012 !!end
8013
8014 !!test
8015 Templates: Inline Text: 1. Multiple tmeplate uses
8016 !!input
8017 {{echo|Foo}}bar{{echo|baz}}
8018 !!result
8019 <p>Foobarbaz
8020 </p>
8021 !!end
8022
8023 !!test
8024 Templates: Inline Text: 2. Back-to-back template uses
8025 !!input
8026 {{echo|Foo}}{{echo|bar}}
8027 !!result
8028 <p>Foobar
8029 </p>
8030 !!end
8031
8032 !!test
8033 Templates: Block Tags: 1. Multiple template uses
8034 !!input
8035 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8036 !!result
8037 <div>Foo</div><div>bar</div><div>baz</div>
8038
8039 !!end
8040
8041 !!test
8042 Templates: Block Tags: 2. Back-to-back template uses
8043 !!input
8044 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8045 !!result
8046 <div>Foo</div><div>bar</div>
8047
8048 !!end
8049
8050 !!test
8051 Templates: Links: 1. Simple example
8052 !!input
8053 {{echo|[[Foo|bar]]}}
8054 !!result
8055 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8056 </p>
8057 !!end
8058
8059 !!test
8060 Templates: Links: 2. Generation of link href
8061 !!input
8062 [[{{echo|Foo}}|bar]]
8063 !!result
8064 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8065 </p>
8066 !!end
8067
8068 !!test
8069 Templates: Links: 3. Generation of part of a link href
8070 !!input
8071 [[Fo{{echo|o}}|bar]]
8072
8073 [[Foo{{echo|bar}}]]
8074
8075 [[Foo{{echo|bar}}baz]]
8076
8077 [[Foo{{echo|bar}}|bar]]
8078
8079 [[:Foo{{echo|bar}}]]
8080
8081 [[:Foo{{echo|bar}}|bar]]
8082 !!result
8083 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8084 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8085 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8086 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8087 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8088 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8089 </p>
8090 !!end
8091
8092 !!test
8093 Templates: Links: 4. Multiple templates generating link href
8094 !!input
8095 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8096 !!result
8097 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8098 </p>
8099 !!end
8100
8101 !!test
8102 Templates: Links: 5. Generation of link text
8103 !!input
8104 [[Foo|{{echo|bar}}]]
8105 !!result
8106 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8107 </p>
8108 !!end
8109
8110 !!test
8111 Templates: Links: 5. Nested templates (only outermost template should be marked)
8112 !!input
8113 {{echo|[[{{echo|Foo}}|bar]]}}
8114 !!result
8115 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8116 </p>
8117 !!end
8118
8119 !!test
8120 Templates: HTML Tag: 1. Generation of HTML attr. key
8121 !!input
8122 <div {{echo|style}}="color:red;">foo</div>
8123 !!result
8124 <div style="color:red;">foo</div>
8125
8126 !!end
8127
8128 !!test
8129 Templates: HTML Tag: 2. Generation of HTML attr. value
8130 !!input
8131 <div style={{echo|'color:red;'}}>foo</div>
8132 !!result
8133 <div style="color:red;">foo</div>
8134
8135 !!end
8136
8137 !!test
8138 Templates: HTML Tag: 3. Generation of HTML attr key and value
8139 !!input
8140 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8141 !!result
8142 <div style="color:red;">foo</div>
8143
8144 !!end
8145
8146 !!test
8147 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8148 !!input
8149 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8150 !!result
8151 <div title="This is a long title with just one piece templated">foo</div>
8152
8153 !!end
8154
8155 !!test
8156 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8157 !!input
8158 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8159 !!result
8160 <div title="This is a long title with just one piece templated">foo</div>
8161
8162 !!end
8163
8164 !!test
8165 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8166 !!input
8167 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8168 !!result
8169 <div title="This is a long title with just one piece templated">foo</div>
8170
8171 !!end
8172
8173 !!test
8174 Templates: HTML Tag: 7. Generation of partial attribute key string
8175 !!input
8176 <div st{{echo|yle}}="color:red;">foo</div>
8177 !!result
8178 <div style="color:red;">foo</div>
8179
8180 !!end
8181
8182 !!test
8183 Templates: HTML Tables: 1. Generating start of a HTML table
8184 !!input
8185 {{echo|<table><tr><td>foo</td>}}</tr></table>
8186 !!result
8187 <table><tr><td>foo</td></tr></table>
8188
8189 !!end
8190
8191 !!test
8192 Templates: HTML Tables: 2a. Generating middle of a HTML table
8193 !!input
8194 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8195 !!result
8196 <table><tr><td>foo</td></tr></table>
8197
8198 !!end
8199
8200 !!test
8201 Templates: HTML Tables: 2b. Generating middle of a HTML table
8202 !!input
8203 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8204 !!result
8205 <table><tr><td>foo</td></tr></table>
8206
8207 !!end
8208
8209 !!test
8210 Templates: HTML Tables: 3. Generating end of a HTML table
8211 !!input
8212 <table><tr>{{echo|<td>foo</td></tr></table>}}
8213 !!result
8214 <table><tr><td>foo</td></tr></table>
8215
8216 !!end
8217
8218 !!test
8219 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8220 !!input
8221 {{echo|<table>}}<tr><td>foo</td></tr></table>
8222 !!result
8223 <table><tr><td>foo</td></tr></table>
8224
8225 !!end
8226
8227 !!test
8228 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8229 !!input
8230 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8231 !!result
8232 <table><tr><td>foo</td></tr></table>
8233
8234 !!end
8235
8236 !!test
8237 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8238 !!input
8239 <table><tr>{{echo|<td>}}foo</td></tr></table>
8240 !!result
8241 <table><tr><td>foo</td></tr></table>
8242
8243 !!end
8244
8245 !!test
8246 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8247 !!input
8248 <table><tr><td>foo{{echo|</td>}}</tr></table>
8249 !!result
8250 <table><tr><td>foo</td></tr></table>
8251
8252 !!end
8253
8254 !!test
8255 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8256 !!input
8257 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8258 !!result
8259 <table><tr><td>foo</td></tr></table>
8260
8261 !!end
8262
8263 !!test
8264 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8265 !!input
8266 <table><tr><td>foo</td></tr>{{echo|</table>}}
8267 !!result
8268 <table><tr><td>foo</td></tr></table>
8269
8270 !!end
8271
8272 !!test
8273 Templates: HTML Tables: 5. Proper fostering of categories from inside
8274 !!options
8275 parsoid=wt2html,wt2wt
8276 !!input
8277 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8278 <!--Two categories (Bug 50330)-->
8279 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8280 !!result
8281 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8282 <!--Two categories (Bug 50330)-->
8283 <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>
8284 !!end
8285
8286 !!test
8287 Templates: Wiki Tables: 1a. Fostering of entire template content
8288 !!input
8289 {|
8290 {{echo|a}}
8291 |}
8292 !!result
8293 <table>
8294 a
8295 <tr><td></td></tr></table>
8296
8297 !!end
8298
8299 !!test
8300 Templates: Wiki Tables: 1b. Fostering of entire template content
8301 !!input
8302 {|
8303 {{echo|<div>}}
8304 foo
8305 {{echo|</div>}}
8306 |}
8307 !!result
8308 <table>
8309 <div>
8310 <p>foo
8311 </p>
8312 </div>
8313 <tr><td></td></tr></table>
8314
8315 !!end
8316
8317 !!test
8318 Templates: Wiki Tables: 2. Fostering of partial template content
8319 !!input
8320 {|
8321 {{echo|a
8322 <div>b</div>}}
8323 |}
8324 !!result
8325 <table>
8326 a
8327 <div>b</div>
8328 <tr><td></td></tr></table>
8329
8330 !!end
8331
8332 !!test
8333 Templates: Wiki Tables: 3. td-content via multiple templates
8334 !!input
8335 {|
8336 {{echo|{{pipe}}a}}{{echo|b}}
8337 |}
8338 !!result
8339 <table>
8340 <tr>
8341 <td>ab
8342 </td></tr></table>
8343
8344 !!end
8345
8346 !!test
8347 Templates: Wiki Tables: 4. Templated tags, no content
8348 !!input
8349 {{tbl-start}}
8350 {{tbl-end}}
8351 !!result
8352 <table>
8353 <tr><td></td></tr></table>
8354
8355 !!end
8356
8357 !!test
8358 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8359 !!input
8360 {{tbl-start}}
8361 |foo
8362 {{tbl-end}}
8363 !!result
8364 <table>
8365 <tr>
8366 <td>foo
8367 </td></tr></table>
8368
8369 !!end
8370
8371 !!test
8372 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8373 !!input
8374 {{tbl-start}}
8375 {{!}}foo
8376 {{tbl-end}}
8377 !!result
8378 <table>
8379 <tr>
8380 <td>foo
8381 </td></tr></table>
8382
8383 !!end
8384
8385 !!test
8386 Templates: Lists: Multi-line list-items via templates
8387 !!input
8388 *{{echo|a {{nonexistent|
8389 unused}}}}
8390 *{{echo|b {{nonexistent|
8391 unused}}}}
8392 !!result
8393 <ul>
8394 <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>
8395 </li>
8396 <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>
8397 </li>
8398 </ul>
8399
8400 !!end
8401
8402 !!test
8403 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8404 !!input
8405 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8406 !!result
8407 <p><i>ab</i>c<i>d</i>e
8408 </p>
8409 !!end
8410
8411 !!test
8412 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8413 (PHP parser generates misnested html)
8414 !! options
8415 parsoid
8416 !!input
8417 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8418 !!result
8419 <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>
8420 !!end
8421
8422 !!test
8423 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8424 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8425 !! options
8426 parsoid=wt2html,wt2wt
8427 !!input
8428 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8429 !!result
8430 <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>
8431 <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>
8432 <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>
8433 !!end
8434
8435 !!test
8436 Templates: Ugly nesting: 4. Divs opened/closed across templates
8437 !!input
8438 a<div>b{{echo|c</div>d}}e
8439 !!result
8440 a<div>bc</div>de
8441
8442 !!end
8443
8444 !!test
8445 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8446 (Parsoid-centric)
8447 !! options
8448 parsoid
8449 !!input
8450 {|
8451 |{{echo|foo</table>}}
8452 |bar
8453 |}
8454 !!result
8455 <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|}"]}'>
8456
8457 <tbody>
8458 <tr>
8459 <td>foo</td></tr></tbody></table><span about="#mwt1">
8460 </span><span about="#mwt1">bar</span><span about="#mwt1">
8461 </span>
8462 !!end
8463
8464 !!test
8465 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8466 (Parsoid-centric)
8467 !! options
8468 parsoid
8469 !!input
8470 <table>
8471 <tr>
8472 <td>
8473 <table>
8474 <tr>
8475 <td>1. {{echo|foo </table>}}</td>
8476 <td> bar </td>
8477 <td>2. {{echo|baz </table>}}</td>
8478 </tr>
8479 <tr>
8480 <td>abc</td>
8481 </tr>
8482 </table>
8483 </td>
8484 </tr>
8485 <tr>
8486 <td>xyz</td>
8487 </tr>
8488 </table>
8489 !!result
8490 <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>"]}'>
8491 <tbody><tr>
8492 <td>
8493 <table>
8494 <tbody><tr>
8495 <td>1. foo </td></tr></tbody></table></td>
8496 <td> bar </td>
8497 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8498 </span><span about="#mwt2">
8499 </span><span about="#mwt2">
8500 </span><span about="#mwt2">abc</span><span about="#mwt2">
8501 </span><span about="#mwt2">
8502 </span><span about="#mwt2">
8503 </span><span about="#mwt2">
8504 </span><span about="#mwt2">
8505 </span><span about="#mwt2">
8506 </span><span about="#mwt2">xyz</span><span about="#mwt2">
8507 </span><span about="#mwt2">
8508 </span>
8509 !!end
8510
8511 !! test
8512 Templates: Ugly templates: 3. newline-only template parameter
8513 !! input
8514 foo {{echo|
8515 }}
8516 !! result
8517 <p>foo
8518 </p>
8519 !! end
8520
8521 # This looks like a bug: a single newline triggers p/br for some reason.
8522 !! test
8523 Templates: Ugly templates: 4. newline-only template parameter inconsistency
8524 !! input
8525 {{echo|
8526 }}
8527 !! result
8528 <p><br />
8529 </p>
8530 !! end
8531
8532
8533 !!test
8534 Parser Functions: 1. Simple example
8535 !!input
8536 {{uc:foo}}
8537 !!result
8538 <p>FOO
8539 </p>
8540 !!end
8541
8542 !!test
8543 Parser Functions: 2. Nested use (only outermost should be marked up)
8544 !!input
8545 {{uc:{{lc:FOO}}}}
8546 !!result
8547 <p>FOO
8548 </p>
8549 !!end
8550
8551 ###
8552 ### Pre-save transform tests
8553 ###
8554 !! test
8555 pre-save transform: subst:
8556 !! options
8557 PST
8558 !! input
8559 {{subst:test}}
8560 !! result
8561 This is a test template
8562 !! end
8563
8564 !! test
8565 pre-save transform: normal template
8566 !! options
8567 PST
8568 !! input
8569 {{test}}
8570 !! result
8571 {{test}}
8572 !! end
8573
8574 !! test
8575 pre-save transform: nonexistent template
8576 !! options
8577 PST
8578 !! input
8579 {{thistemplatedoesnotexist}}
8580 !! result
8581 {{thistemplatedoesnotexist}}
8582 !! end
8583
8584
8585 !! test
8586 pre-save transform: subst magic variables
8587 !! options
8588 PST
8589 !! input
8590 {{subst:SITENAME}}
8591 !! result
8592 MediaWiki
8593 !! end
8594
8595 # This is bug 89, which I fixed. -- wtm
8596 !! test
8597 pre-save transform: subst: templates with parameters
8598 !! options
8599 pst
8600 !! input
8601 {{subst:paramtest|param="something else"}}
8602 !! result
8603 This is a test template with parameter "something else"
8604 !! end
8605
8606 !! article
8607 Template:nowikitest
8608 !! text
8609 <nowiki>'''not wiki'''</nowiki>
8610 !! endarticle
8611
8612 !! test
8613 pre-save transform: nowiki in subst (bug 1188)
8614 !! options
8615 pst
8616 !! input
8617 {{subst:nowikitest}}
8618 !! result
8619 <nowiki>'''not wiki'''</nowiki>
8620 !! end
8621
8622
8623 !! article
8624 Template:commenttest
8625 !! text
8626 This template has <!-- a comment --> in it.
8627 !! endarticle
8628
8629 !! test
8630 pre-save transform: comment in subst (bug 1936)
8631 !! options
8632 pst
8633 !! input
8634 {{subst:commenttest}}
8635 !! result
8636 This template has <!-- a comment --> in it.
8637 !! end
8638
8639 !! test
8640 pre-save transform: unclosed tag
8641 !! options
8642 pst noxml
8643 !! input
8644 <nowiki>'''not wiki'''
8645 !! result
8646 <nowiki>'''not wiki'''
8647 !! end
8648
8649 !! test
8650 pre-save transform: mixed tag case
8651 !! options
8652 pst noxml
8653 !! input
8654 <NOwiki>'''not wiki'''</noWIKI>
8655 !! result
8656 <NOwiki>'''not wiki'''</noWIKI>
8657 !! end
8658
8659 !! test
8660 pre-save transform: unclosed comment in <nowiki>
8661 !! options
8662 pst noxml
8663 !! input
8664 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8665 !! result
8666 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
8667 !!end
8668
8669 # Leading @ in this template definition works around a limitation
8670 # in parsoid's parserTests which otherwise strips the <span> from the
8671 # result (confusing it for a template wrapper)
8672 !! article
8673 Template:dangerous
8674 !!text
8675 @<span onmouseover="alert('crap')">Oh no</span>
8676 !!endarticle
8677
8678 !!test
8679 (confirming safety of fix for subst bug 1936)
8680 !! input
8681 {{Template:dangerous}}
8682 !! result
8683 <p>@<span>Oh no</span>
8684 </p>
8685 !! end
8686
8687 !! test
8688 pre-save transform: comment containing gallery (bug 5024)
8689 !! options
8690 pst
8691 !! input
8692 <!-- <gallery>data</gallery> -->
8693 !!result
8694 <!-- <gallery>data</gallery> -->
8695 !!end
8696
8697 !! test
8698 pre-save transform: comment containing extension
8699 !! options
8700 pst
8701 !! input
8702 <!-- <tag>data</tag> -->
8703 !!result
8704 <!-- <tag>data</tag> -->
8705 !!end
8706
8707 !! test
8708 pre-save transform: comment containing nowiki
8709 !! options
8710 pst
8711 !! input
8712 <!-- <nowiki>data</nowiki> -->
8713 !!result
8714 <!-- <nowiki>data</nowiki> -->
8715 !!end
8716
8717 !! test
8718 pre-save transform: <noinclude> in subst (bug 3298)
8719 !! options
8720 pst
8721 !! input
8722 {{subst:Includes}}
8723 !! result
8724 Foobar
8725 !! end
8726
8727 !! test
8728 pre-save transform: <onlyinclude> in subst (bug 3298)
8729 !! options
8730 pst
8731 !! input
8732 {{subst:Includes2}}
8733 !! result
8734 Foo
8735 !! end
8736
8737 !! article
8738 Template:SubstTest
8739 !!text
8740 {{<includeonly>subst:</includeonly>Includes}}
8741 !! endarticle
8742
8743 !! article
8744 Template:SafeSubstTest
8745 !! text
8746 {{<includeonly>safesubst:</includeonly>Includes}}
8747 !! endarticle
8748
8749 !! test
8750 bug 22297: safesubst: works during PST
8751 !! options
8752 pst
8753 !! input
8754 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
8755 !! result
8756 FoobarFoobar
8757 !! end
8758
8759 !! test
8760 bug 22297: safesubst: works during normal parse
8761 !! input
8762 {{SafeSubstTest}}
8763 !! result
8764 <p>Foobar
8765 </p>
8766 !! end
8767
8768 !! test:
8769 subst: does not work during normal parse
8770 !! input
8771 {{SubstTest}}
8772 !! result
8773 <p>{{subst:Includes}}
8774 </p>
8775 !! end
8776
8777 !! test
8778 pre-save transform: context links ("pipe trick")
8779 !! options
8780 pst
8781 !! input
8782 [[Article (context)|]]
8783 [[Bar:Article|]]
8784 [[:Bar:Article|]]
8785 [[Bar:Article (context)|]]
8786 [[:Bar:Article (context)|]]
8787 [[|Article]]
8788 [[|Article (context)]]
8789 [[Bar:X (Y) Z|]]
8790 [[:Bar:X (Y) Z|]]
8791 !! result
8792 [[Article (context)|Article]]
8793 [[Bar:Article|Article]]
8794 [[:Bar:Article|Article]]
8795 [[Bar:Article (context)|Article]]
8796 [[:Bar:Article (context)|Article]]
8797 [[Article]]
8798 [[Article (context)]]
8799 [[Bar:X (Y) Z|X (Y) Z]]
8800 [[:Bar:X (Y) Z|X (Y) Z]]
8801 !! end
8802
8803 !! test
8804 pre-save transform: context links ("pipe trick") with interwiki prefix
8805 !! options
8806 pst
8807 !! input
8808 [[interwiki:Article|]]
8809 [[:interwiki:Article|]]
8810 [[interwiki:Bar:Article|]]
8811 [[:interwiki:Bar:Article|]]
8812 !! result
8813 [[interwiki:Article|Article]]
8814 [[:interwiki:Article|Article]]
8815 [[interwiki:Bar:Article|Bar:Article]]
8816 [[:interwiki:Bar:Article|Bar:Article]]
8817 !! end
8818
8819 !! test
8820 pre-save transform: context links ("pipe trick") with parens in title
8821 !! options
8822 pst title=[[Somearticle (context)]]
8823 !! input
8824 [[|Article]]
8825 !! result
8826 [[Article (context)|Article]]
8827 !! end
8828
8829 !! test
8830 pre-save transform: context links ("pipe trick") with comma in title
8831 !! options
8832 pst title=[[Someplace, Somewhere]]
8833 !! input
8834 [[|Otherplace]]
8835 [[Otherplace, Elsewhere|]]
8836 [[Otherplace, Elsewhere, Anywhere|]]
8837 !! result
8838 [[Otherplace, Somewhere|Otherplace]]
8839 [[Otherplace, Elsewhere|Otherplace]]
8840 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
8841 !! end
8842
8843 !! test
8844 pre-save transform: context links ("pipe trick") with parens and comma
8845 !! options
8846 pst title=[[Someplace (IGNORED), Somewhere]]
8847 !! input
8848 [[|Otherplace]]
8849 [[Otherplace (place), Elsewhere|]]
8850 !! result
8851 [[Otherplace, Somewhere|Otherplace]]
8852 [[Otherplace (place), Elsewhere|Otherplace]]
8853 !! end
8854
8855 !! test
8856 pre-save transform: context links ("pipe trick") with comma and parens
8857 !! options
8858 pst title=[[Who, me? (context)]]
8859 !! input
8860 [[|Yes, you.]]
8861 [[Me, Myself, and I (1937 song)|]]
8862 !! result
8863 [[Yes, you. (context)|Yes, you.]]
8864 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
8865 !! end
8866
8867 !! test
8868 pre-save transform: context links ("pipe trick") with namespace
8869 !! options
8870 pst title=[[Ns:Somearticle]]
8871 !! input
8872 [[|Article]]
8873 !! result
8874 [[Ns:Article|Article]]
8875 !! end
8876
8877 !! test
8878 pre-save transform: context links ("pipe trick") with namespace and parens
8879 !! options
8880 pst title=[[Ns:Somearticle (context)]]
8881 !! input
8882 [[|Article]]
8883 !! result
8884 [[Ns:Article (context)|Article]]
8885 !! end
8886
8887 !! test
8888 pre-save transform: context links ("pipe trick") with namespace and comma
8889 !! options
8890 pst title=[[Ns:Somearticle, Context, Whatever]]
8891 !! input
8892 [[|Article]]
8893 !! result
8894 [[Ns:Article, Context, Whatever|Article]]
8895 !! end
8896
8897 !! test
8898 pre-save transform: context links ("pipe trick") with namespace, comma and parens
8899 !! options
8900 pst title=[[Ns:Somearticle, Context (context)]]
8901 !! input
8902 [[|Article]]
8903 !! result
8904 [[Ns:Article (context)|Article]]
8905 !! end
8906
8907 !! test
8908 pre-save transform: context links ("pipe trick") with namespace, parens and comma
8909 !! options
8910 pst title=[[Ns:Somearticle (IGNORED), Context]]
8911 !! input
8912 [[|Article]]
8913 !! result
8914 [[Ns:Article, Context|Article]]
8915 !! end
8916
8917 !! test
8918 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
8919 !! options
8920 pst
8921 !! input
8922 [[Article(context)|]]
8923 [[Bar:Article(context)|]]
8924 [[:Bar:Article(context)|]]
8925 [[|Article(context)]]
8926 [[Bar:X(Y)Z|]]
8927 [[:Bar:X(Y)Z|]]
8928 !! result
8929 [[Article(context)|Article]]
8930 [[Bar:Article(context)|Article]]
8931 [[:Bar:Article(context)|Article]]
8932 [[Article(context)]]
8933 [[Bar:X(Y)Z|X(Y)Z]]
8934 [[:Bar:X(Y)Z|X(Y)Z]]
8935 !! end
8936
8937 !! test
8938 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
8939 !! options
8940 pst
8941 !! input
8942 [[Article (context)|]]
8943 [[Bar:Article (context)|]]
8944 [[:Bar:Article (context)|]]
8945 [[|Article (context)]]
8946 [[Bar:X (Y) Z|]]
8947 [[:Bar:X (Y) Z|]]
8948 !! result
8949 [[Article (context)|Article]]
8950 [[Bar:Article (context)|Article]]
8951 [[:Bar:Article (context)|Article]]
8952 [[Article (context)]]
8953 [[Bar:X (Y) Z|X (Y) Z]]
8954 [[:Bar:X (Y) Z|X (Y) Z]]
8955 !! end
8956
8957 !! test
8958 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
8959 !! options
8960 pst
8961 !! input
8962 [[Article(context)|]]
8963 [[Bar:Article(context)|]]
8964 [[:Bar:Article(context)|]]
8965 [[|Article(context)]]
8966 [[Bar:X(Y)Z|]]
8967 [[:Bar:X(Y)Z|]]
8968 !! result
8969 [[Article(context)|Article]]
8970 [[Bar:Article(context)|Article]]
8971 [[:Bar:Article(context)|Article]]
8972 [[Article(context)]]
8973 [[Bar:X(Y)Z|X(Y)Z]]
8974 [[:Bar:X(Y)Z|X(Y)Z]]
8975 !! end
8976
8977 !! test
8978 pre-save transform: context links ("pipe trick") with commas (bug 21660)
8979 !! options
8980 pst
8981 !! input
8982 [[Article (context), context|]]
8983 [[Article (context),context|]]
8984 [[Bar:Article (context), context|]]
8985 [[Bar:Article (context),context|]]
8986 [[:Bar:Article (context), context|]]
8987 [[:Bar:Article (context),context|]]
8988 !! result
8989 [[Article (context), context|Article]]
8990 [[Article (context),context|Article]]
8991 [[Bar:Article (context), context|Article]]
8992 [[Bar:Article (context),context|Article]]
8993 [[:Bar:Article (context), context|Article]]
8994 [[:Bar:Article (context),context|Article]]
8995 !! end
8996
8997 !! test
8998 pre-save transform: trim trailing empty lines
8999 !! options
9000 pst
9001 !! input
9002 Empty lines are trimmed
9003
9004
9005
9006
9007 !! result
9008 Empty lines are trimmed
9009 !! end
9010
9011 !! test
9012 pre-save transform: Signature expansion
9013 !! options
9014 pst
9015 !! input
9016 * ~~~
9017 * <noinclude>~~~</noinclude>
9018 * <includeonly>~~~</includeonly>
9019 * <onlyinclude>~~~</onlyinclude>
9020 !! result
9021 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9022 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9023 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9024 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9025 !! end
9026
9027
9028 !! test
9029 pre-save transform: Signature expansion in nowiki tags (bug 93)
9030 !! options
9031 pst disabled
9032 !! input
9033 Shall not expand:
9034
9035 <nowiki>~~~~</nowiki>
9036
9037 <includeonly><nowiki>~~~~</nowiki></includeonly>
9038
9039 <noinclude><nowiki>~~~~</nowiki></noinclude>
9040
9041 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9042
9043 {{subst:Foo}} shall be converted to FOO
9044
9045 As well as inside noinclude/onlyinclude
9046 <noinclude>{{subst:Foo}}</noinclude>
9047 <onlyinclude>{{subst:Foo}}</onlyinclude>
9048
9049 But not inside includeonly
9050 <includeonly>{{subst:Foo}}</includeonly>
9051 !! result
9052 Shall not expand:
9053
9054 <nowiki>~~~~</nowiki>
9055
9056 <includeonly><nowiki>~~~~</nowiki></includeonly>
9057
9058 <noinclude><nowiki>~~~~</nowiki></noinclude>
9059
9060 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9061
9062 FOO shall be converted to FOO
9063
9064 As well as inside noinclude/onlyinclude
9065 <noinclude>FOO</noinclude>
9066 <onlyinclude>FOO</onlyinclude>
9067
9068 But not inside includeonly
9069 <includeonly>{{subst:Foo}}</includeonly>
9070 !! end
9071
9072 !! test
9073 Parsoid: Recognize nowiki with trailing space in tags
9074 !! options
9075 parsoid=wt2html
9076 !! input
9077 <nowiki ><div>[[foo]]</nowiki >
9078
9079 a<nowiki / >b
9080
9081 c<nowiki />d
9082
9083 e<nowiki/ >f
9084 !! result
9085 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9086 <p>ab</p>
9087 <p>cd</p>
9088 <p>ef</p>
9089 !! end
9090
9091 !! test
9092 Parsoid: Recognize nowiki with odd capitalization
9093 !! options
9094 parsoid=wt2html
9095 !! input
9096 <noWikI ><div>[[foo]]</Nowiki >
9097 !! result
9098 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9099 !! end
9100
9101
9102 !! test
9103 Parsoid: Escape nowiki with trailing space in tags
9104 !! options
9105 parsoid=html2wt
9106 !! input
9107 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9108
9109 a&lt;nowiki /&gt;b
9110
9111 c&lt;nowiki/ &gt;d
9112 !! result
9113 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9114 <p>a&lt;nowiki /&gt;b</p>
9115 <p>c&lt;nowiki/ &gt;d</p>
9116 !! end
9117
9118 !! test
9119 Parsoid: Escape weird noWikI capitalizations
9120 !! options
9121 parsoid=html2wt
9122 !! input
9123 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9124 !! result
9125 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9126 !! end
9127
9128 ###
9129 ### Message transform tests
9130 ###
9131 !! test
9132 message transform: magic variables
9133 !! options
9134 msg
9135 !! input
9136 {{SITENAME}}
9137 !! result
9138 MediaWiki
9139 !! end
9140
9141 !! test
9142 message transform: should not transform wiki markup
9143 !! options
9144 msg
9145 !! input
9146 ''test''
9147 !! result
9148 ''test''
9149 !! end
9150
9151 !! test
9152 message transform: <noinclude> in transcluded template (bug 4926)
9153 !! options
9154 msg
9155 !! input
9156 {{Includes}}
9157 !! result
9158 Foobar
9159 !! end
9160
9161 !! test
9162 message transform: <onlyinclude> in transcluded template (bug 4926)
9163 !! options
9164 msg
9165 !! input
9166 {{Includes2}}
9167 !! result
9168 Foo
9169 !! end
9170
9171 !! test
9172 {{#special:}} page name, known
9173 !! options
9174 msg
9175 !! input
9176 {{#special:Recentchanges}}
9177 !! result
9178 Special:RecentChanges
9179 !! end
9180
9181 !! test
9182 {{#special:}} page name with subpage, known
9183 !! options
9184 msg
9185 !! input
9186 {{#special:Recentchanges/param}}
9187 !! result
9188 Special:RecentChanges/param
9189 !! end
9190
9191 !! test
9192 {{#special:}} page name, unknown
9193 !! options
9194 msg
9195 !! input
9196 {{#special:foobar nonexistent}}
9197 !! result
9198 Special:Foobar nonexistent
9199 !! end
9200
9201 !! test
9202 {{#speciale:}} page name, known
9203 !! options
9204 msg
9205 !! input
9206 {{#speciale:Recentchanges}}
9207 !! result
9208 Special:RecentChanges
9209 !! end
9210
9211 !! test
9212 {{#speciale:}} page name with subpage, known
9213 !! options
9214 msg
9215 !! input
9216 {{#speciale:Recentchanges/param}}
9217 !! result
9218 Special:RecentChanges/param
9219 !! end
9220
9221 !! test
9222 {{#speciale:}} page name, unknown
9223 !! options
9224 msg
9225 !! input
9226 {{#speciale:foobar nonexistent}}
9227 !! result
9228 Special:Foobar_nonexistent
9229 !! end
9230
9231 ###
9232 ### Images
9233 ###
9234 ### For Parsoid-specific tests, see
9235 #### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9236
9237 !! test
9238 Simple image (php)
9239 !! options
9240 php
9241 !! input
9242 [[Image:foobar.jpg]]
9243 !! result
9244 <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>
9245 </p>
9246 !! end
9247
9248 !! test
9249 Simple image (parsoid)
9250 !! options
9251 parsoid=wt2html
9252 !! input
9253 [[Image:foobar.jpg]]
9254 !! result
9255 <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>
9256 </p>
9257 !! end
9258
9259 !! test
9260 Simple image (using File: namespace, now canonical) (php)
9261 !! options
9262 php
9263 !! input
9264 [[File:foobar.jpg]]
9265 !! result
9266 <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>
9267 </p>
9268 !! end
9269
9270 !! test
9271 Simple image (using File: namespace, now canonical) (parsoid)
9272 !! options
9273 parsoid
9274 !! input
9275 [[File:Foobar.jpg]]
9276 !! result
9277 <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>
9278 </p>
9279 !! end
9280
9281 !! test
9282 Right-aligned image (php)
9283 !! options
9284 php
9285 !! input
9286 [[Image:foobar.jpg|right]]
9287 !! result
9288 <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>
9289
9290 !! end
9291
9292 !! test
9293 Right-aligned image (parsoid)
9294 !! options
9295 parsoid
9296 !! input
9297 [[File:Foobar.jpg|right]]
9298 !! result
9299 <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>
9300 !! end
9301
9302 !! test
9303 Image with caption (php)
9304 !! options
9305 php
9306 !! input
9307 [[File:Foobar.jpg|right|Caption text]]
9308 !! result
9309 <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>
9310
9311 !! end
9312
9313 !! test
9314 Image with caption (parsoid)
9315 !! options
9316 parsoid
9317 !! input
9318 [[File:Foobar.jpg|right|Caption text]]
9319 !! result
9320 <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>
9321 !! end
9322
9323 !! test
9324 Image with empty attribute (php)
9325 !! options
9326 php
9327 !! input
9328 [[File:Foobar.jpg|right||Caption text]]
9329 !! result
9330 <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>
9331
9332 !! end
9333
9334 !! test
9335 Image with empty attribute (parsoid)
9336 !! options
9337 parsoid=wt2html
9338 !! input
9339 [[File:Foobar.jpg|right||Caption text]]
9340 !! result
9341 <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>
9342 !! end
9343
9344 !! test
9345 Image with attributes from template (php)
9346 !! options
9347 php
9348 !! input
9349 [[File:Foobar.jpg|{{image_attribs}}]]
9350 !! result
9351 <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>
9352
9353 !! end
9354
9355 !! test
9356 Image with attributes from template (parsoid)
9357 !! options
9358 parsoid
9359 !! input
9360 [[File:Foobar.jpg|{{image_attribs}}]]
9361 !! result
9362 <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>
9363 !! end
9364
9365 !! test
9366 Image with link tails (php)
9367 !! options
9368 php
9369 !! input
9370 123[[File:Foobar.jpg]]456
9371 123[[File:Foobar.jpg|right]]456
9372 123[[File:Foobar.jpg|thumb]]456
9373 !! result
9374 <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
9375 </p>
9376 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
9377 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
9378
9379 !! end
9380
9381 !! test
9382 Image with link tails (parsoid)
9383 !! options
9384 parsoid
9385 !! input
9386 123[[File:Foobar.jpg]]456
9387 123[[File:Foobar.jpg|right]]456
9388 123[[File:Foobar.jpg|thumb]]456
9389 !! result
9390 <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>
9391 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
9392 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
9393 !! end
9394
9395 !! test
9396 Image with multiple captions -- only last one is accepted (php)
9397 !! options
9398 php
9399 !! input
9400 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9401 !! result
9402 <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>
9403
9404 !! end
9405
9406 !! test
9407 Image with multiple captions -- only last one is accepted (parsoid)
9408 !! options
9409 parsoid
9410 !! input
9411 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9412 !! result
9413 <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>
9414 !! end
9415
9416 !! test
9417 Image with width attribute at different positions (php)
9418 !! options
9419 php
9420 !! input
9421 [[File:Foobar.jpg|200px|right|Caption]]
9422 [[File:Foobar.jpg|right|200px|Caption]]
9423 [[File:Foobar.jpg|right|Caption|200px]]
9424 !! result
9425 <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>
9426 <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>
9427 <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>
9428
9429 !! end
9430
9431 !! test
9432 Image with width attribute at different positions (parsoid)
9433 !! options
9434 parsoid
9435 !! input
9436 [[File:Foobar.jpg|200px|right|Caption]]
9437 [[File:Foobar.jpg|right|200px|Caption]]
9438 [[File:Foobar.jpg|right|Caption|200px]]
9439 !! result
9440 <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>
9441 <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>
9442 <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>
9443 !! end
9444
9445 !! test
9446 Image with link parameter, wiki target (php)
9447 !! options
9448 php
9449 !! input
9450 [[File:Foobar.jpg|link=Main Page]]
9451 !! result
9452 <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>
9453 </p>
9454 !! end
9455
9456 !! test
9457 Image with link parameter, wiki target (parsoid)
9458 !! options
9459 parsoid
9460 !! input
9461 [[File:Foobar.jpg|link=Main Page]]
9462 !! result
9463 <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>
9464 !! end
9465
9466 !! test
9467 Image with link parameter, URL target (php)
9468 !! options
9469 php
9470 !! input
9471 [[File:Foobar.jpg|link=http://example.com/]]
9472 !! result
9473 <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>
9474 </p>
9475 !! end
9476
9477 # parsoid bug 49293 (part 1)
9478 !! test
9479 Image with link parameter, URL target (parsoid)
9480 !! options
9481 parsoid
9482 !! input
9483 [[File:Foobar.jpg|link=http://example.com/]]
9484 !! result
9485 <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>
9486 !! end
9487
9488 !! test
9489 Image with link parameter, protocol-less URL target (php)
9490 !! options
9491 php
9492 !! input
9493 [[File:Foobar.jpg|link=//example.com/]]
9494 !! result
9495 <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>
9496 </p>
9497 !! end
9498
9499 # parsoid bug 49293 (part 2)
9500 !! test
9501 Image with link parameter, protocol-less URL target (parsoid)
9502 !! options
9503 parsoid
9504 !! input
9505 [[File:Foobar.jpg|link=//example.com/]]
9506 !! result
9507 <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>
9508 !! end
9509
9510 !! test
9511 Image with link parameter, wgExternalLinkTarget
9512 !! input
9513 [[Image:foobar.jpg|link=http://example.com/]]
9514 !! config
9515 wgExternalLinkTarget='foobar'
9516 !! result
9517 <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>
9518 </p>
9519 !! end
9520
9521 !! test
9522 Image with link parameter, wgNoFollowLinks set to false
9523 !! input
9524 [[Image:foobar.jpg|link=http://example.com/]]
9525 !! config
9526 wgNoFollowLinks=false
9527 !! result
9528 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9529 </p>
9530 !! end
9531
9532 !! test
9533 Image with link parameter, wgNoFollowDomainExceptions
9534 !! input
9535 [[Image:foobar.jpg|link=http://example.com/]]
9536 !! config
9537 wgNoFollowDomainExceptions='example.com'
9538 !! result
9539 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
9540 </p>
9541 !! end
9542
9543 !! test
9544 Image with link parameter, wgExternalLinkTarget, unnamed parameter
9545 !! input
9546 [[Image:foobar.jpg|link=http://example.com/|Title]]
9547 !! config
9548 wgExternalLinkTarget='foobar'
9549 !! result
9550 <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>
9551 </p>
9552 !! end
9553
9554 !! test
9555 Image with empty link parameter (php)
9556 !! options
9557 php
9558 !! input
9559 [[File:Foobar.jpg|link=]]
9560 !! result
9561 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
9562 </p>
9563 !! end
9564
9565 !! test
9566 Image with empty link parameter (parsoid)
9567 !! options
9568 parsoid
9569 !! input
9570 [[File:Foobar.jpg|link=]]
9571 !! result
9572 <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>
9573 !! end
9574
9575 !! test
9576 Image with link parameter (wiki target) and unnamed parameter (php)
9577 !! options
9578 php
9579 !! input
9580 [[File:Foobar.jpg|link=Main Page|Title]]
9581 !! result
9582 <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>
9583 </p>
9584 !! end
9585
9586 !! test
9587 Image with link parameter (wiki target) and unnamed parameter (parsoid)
9588 !! options
9589 parsoid
9590 !! input
9591 [[File:Foobar.jpg|link=Main Page|Title]]
9592 !! result
9593 <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>
9594 !! end
9595
9596 !! test
9597 Image with link parameter (URL target) and unnamed parameter (php)
9598 !! options
9599 php
9600 !! input
9601 [[File:Foobar.jpg|link=http://example.com/|Title]]
9602 !! result
9603 <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>
9604 </p>
9605 !! end
9606
9607 !! test
9608 Image with link parameter (URL target) and unnamed parameter (parsoid)
9609 !! options
9610 parsoid
9611 !! input
9612 [[File:Foobar.jpg|link=http://example.com/|Title]]
9613 !! result
9614 <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>
9615 !! end
9616
9617 !! test
9618 Thumbnail image with link parameter
9619 !! options
9620 php
9621 !! input
9622 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
9623 !! result
9624 <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>
9625
9626 !! end
9627
9628 !! test
9629 Manually-specified thumbnail image
9630 !! options
9631 php
9632 !! input
9633 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
9634 !! result
9635 <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>
9636
9637 !! end
9638
9639 !! test
9640 Manually-specified thumbnail image with explicit link to wiki page
9641 !! options
9642 php
9643 !! input
9644 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
9645 !! result
9646 <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>
9647
9648 !! end
9649
9650 !! test
9651 Manually-specified thumbnail image with explicit link to url
9652 !! options
9653 php
9654 !! input
9655 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
9656 !! result
9657 <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>
9658
9659 !! end
9660
9661 !! test
9662 Manually-specified thumbnail image with explicit no link
9663 !! options
9664 php
9665 !! input
9666 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
9667 !! result
9668 <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>
9669
9670 !! end
9671
9672 !! test
9673 Manually-specified thumbnail image with explicit link and alt text
9674 !! options
9675 php
9676 !! input
9677 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
9678 !! result
9679 <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>
9680
9681 !! end
9682
9683 !! test
9684 Image with frame and link
9685 !! input
9686 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
9687 !! result
9688 <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>
9689
9690 !! end
9691
9692 !! test
9693 Image with frame and link and explicit alt
9694 !! input
9695 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
9696 !! result
9697 <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>
9698
9699 !! end
9700
9701 !! test
9702 Image with wiki markup in implicit alt
9703 !! input
9704 [[Image:Foobar.jpg|testing '''bold''' in alt]]
9705 !! result
9706 <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>
9707 </p>
9708 !! end
9709
9710 !! test
9711 Image with wiki markup in explicit alt
9712 !! input
9713 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
9714 !! result
9715 <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>
9716 </p>
9717 !! end
9718
9719 !! test
9720 Link to image page- image page normally doesn't exists, hence edit link
9721 Add test with existing image page
9722 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
9723 !! input
9724 [[:Image:test]]
9725 !! result
9726 <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>
9727 </p>
9728 !! end
9729
9730 !! test
9731 bug 18784 Link to non-existent image page with caption should use caption as link text
9732 !! input
9733 [[:Image:test|caption]]
9734 !! result
9735 <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>
9736 </p>
9737 !! end
9738
9739 !! test
9740 Frameless image caption with a free URL
9741 !! input
9742 [[Image:foobar.jpg|http://example.com]]
9743 !! result
9744 <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>
9745 </p>
9746 !! end
9747
9748 !! test
9749 Thumbnail image caption with a free URL
9750 !! input
9751 [[Image:foobar.jpg|thumb|http://example.com]]
9752 !! result
9753 <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>
9754
9755 !! end
9756
9757 !! test
9758 Thumbnail image caption with a free URL and explicit alt
9759 !! input
9760 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
9761 !! result
9762 <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>
9763
9764 !! end
9765
9766 !! test
9767 SVG thumbnails with no language set
9768 !! options
9769 !! input
9770 [[File:Foobar.svg|thumb|width=200]]
9771 !! result
9772 <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>
9773
9774 !! end
9775
9776 !! test
9777 SVG thumbnails with language de
9778 !! options
9779 !! input
9780 [[File:Foobar.svg|thumb|width=200|lang=de]]
9781 !! result
9782 <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>
9783
9784 !! end
9785
9786 !! test
9787 SVG thumbnails with invalid language code
9788 !! options
9789 !! input
9790 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
9791 !! result
9792 <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>
9793
9794 !! end
9795
9796 !! test
9797 BUG 1887: A ISBN with a thumbnail
9798 !! input
9799 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
9800 !! result
9801 <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>
9802
9803 !! end
9804
9805 !! test
9806 BUG 1887: A RFC with a thumbnail
9807 !! input
9808 [[Image:foobar.jpg|thumb|This is RFC 12354]]
9809 !! result
9810 <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>
9811
9812 !! end
9813
9814 !! test
9815 BUG 1887: A mailto link with a thumbnail
9816 !! input
9817 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
9818 !! result
9819 <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>
9820
9821 !! end
9822
9823 # Pending resolution to bug 368
9824 !! test
9825 BUG 648: Frameless image caption with a link
9826 !! input
9827 [[Image:foobar.jpg|text with a [[link]] in it]]
9828 !! result
9829 <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>
9830 </p>
9831 !! end
9832
9833 !! test
9834 BUG 648: Frameless image caption with a link (suffix)
9835 !! input
9836 [[Image:foobar.jpg|text with a [[link]]foo in it]]
9837 !! result
9838 <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>
9839 </p>
9840 !! end
9841
9842 !! test
9843 BUG 648: Frameless image caption with an interwiki link
9844 !! input
9845 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
9846 !! result
9847 <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>
9848 </p>
9849 !! end
9850
9851 !! test
9852 BUG 648: Frameless image caption with a piped interwiki link
9853 !! input
9854 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
9855 !! result
9856 <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>
9857 </p>
9858 !! end
9859
9860 !! test
9861 Escape HTML special chars in image alt text
9862 !! input
9863 [[Image:foobar.jpg|& < > "]]
9864 !! result
9865 <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>
9866 </p>
9867 !! end
9868
9869 !! test
9870 BUG 499: Alt text should have &#1234;, not &amp;1234;
9871 !! input
9872 [[Image:foobar.jpg|&#9792;]]
9873 !! result
9874 <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>
9875 </p>
9876 !! end
9877
9878 !! test
9879 Broken image caption with link
9880 !! input
9881 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
9882 !! result
9883 <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.
9884 </p>
9885 !! end
9886
9887 !! test
9888 Image caption containing another image
9889 !! input
9890 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
9891 !! result
9892 <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>
9893
9894 !! end
9895
9896 !! test
9897 Image caption containing a newline
9898 !! input
9899 [[Image:Foobar.jpg|This
9900 *is some text]]
9901 !! result
9902 <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>
9903 </p>
9904 !!end
9905
9906 !!test
9907 Parsoid: Image caption containing leading space
9908 (The leading space should not trigger nowiki escaping in wt2wt mode)
9909 !! input
9910 [[Image:Foobar.jpg|thumb| bar]]
9911 !! result
9912 <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>
9913
9914 !!end
9915
9916 !! test
9917 Bug 3090: External links other than http: in image captions
9918 !! input
9919 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
9920 !! result
9921 <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>
9922
9923 !! end
9924
9925 !! test
9926 Custom class
9927 !! input
9928 [[Image:foobar.jpg|a|class=b]]
9929 !! result
9930 <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>
9931 </p>
9932 !! end
9933
9934 !! test
9935 Localized image handling (1).
9936 !! options
9937 language=es
9938 !! input
9939 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
9940 !! result
9941 <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>
9942
9943 !! end
9944
9945 !! test
9946 Localized image handling (2).
9947 !! options
9948 language=es
9949 !! input
9950 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
9951 !! result
9952 <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>
9953
9954 !! end
9955
9956 !! test
9957 "border", "frameless" and "class" attributes on an image.
9958 !! input
9959 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
9960 !! result
9961 <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>
9962 </p>
9963 !! end
9964
9965 !! article
9966 File:Barfoo.jpg
9967 !! text
9968 #REDIRECT [[File:Barfoo.jpg]]
9969 !! endarticle
9970
9971 !! test
9972 Redirected image
9973 !! input
9974 [[Image:Barfoo.jpg]]
9975 !! result
9976 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
9977 </p>
9978 !! end
9979
9980 !! test
9981 Missing image with uploads disabled
9982 !! options
9983 wgEnableUploads=0
9984 !! input
9985 [[Image:Foobaz.jpg]]
9986 !! result
9987 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
9988 </p>
9989 !! end
9990
9991 # Parsoid-specific testing for images
9992 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9993 # Currently imperfect due to a flaw in the Parsoid testrunner
9994 # Work in progress
9995 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
9996 # image tests.
9997
9998 !! test
9999 Parsoid-specific image handling - simple image with size and middle alignment
10000 !! options
10001 parsoid
10002 !! input
10003 [[Image:Foobar.jpg|50px|middle]]
10004 !! result
10005 <p>
10006 <span class="mw-valign-middle" typeof="mw:Image">
10007 <a href="File:Foobar.jpg">
10008 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10009 </a>
10010 </span>
10011 </p>
10012 !! end
10013
10014 !! test
10015 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10016 !! options
10017 parsoid
10018 !! input
10019 [[Image:Foobar.jpg|500x10px|baseline|caption]]
10020 !! result
10021 <p>
10022 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10023 <a href="File:Foobar.jpg">
10024 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
10025 </a>
10026 </span>
10027 </p>
10028 !! end
10029
10030 !! test
10031 Parsoid-specific image handling - simple image with border and size spec
10032 !! options
10033 parsoid
10034 !! input
10035 [[Image:Foobar.jpg|50px|border|caption]]
10036 !! result
10037 <p>
10038 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10039 <a href="File:Foobar.jpg">
10040 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10041 </a>
10042 </span>
10043 </p>
10044 !! end
10045
10046 !! test
10047 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10048 !! options
10049 parsoid
10050 !! input
10051 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
10052 !! result
10053 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10054 <a href="File:Foobar.jpg">
10055 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
10056 </a>
10057 <figcaption>caption content</figcaption>
10058 </figure>
10059 !! end
10060
10061 !! test
10062 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10063 !! options
10064 parsoid
10065 !! input
10066 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10067 !! result
10068 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10069 <a href="File:Foobar.jpg">
10070 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10071 </a>
10072 <figcaption>caption</figcaption>
10073 </figure>
10074 !! end
10075
10076 !! test
10077 Parsoid-specific image handling - framed image with specific size and caption
10078 !! options
10079 parsoid
10080 !! input
10081 [[Image:Foobar.jpg|500x50px|frame|caption]]
10082 !! result
10083 <figure typeof="mw:Image/Frame">
10084 <a href="File:Foobar.jpg">
10085 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10086 </a>
10087 <figcaption>caption</figcaption>
10088 </figure>
10089 !! end
10090
10091 !! test
10092 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10093 !! options
10094 parsoid
10095 !! input
10096 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
10097 !! result
10098 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10099 <a href="File:Foobar.jpg">
10100 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10101 </a>
10102 <figcaption>caption</figcaption>
10103 </figure>
10104 !! end
10105
10106 !! test
10107 Parsoid-specific image handling - frameless image with specific size, border, and caption
10108 !! options
10109 parsoid
10110 !! input
10111 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
10112 !! result
10113 <p>
10114 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
10115 <a href="File:Foobar.jpg">
10116 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
10117 </a>
10118 </p>
10119 !! end
10120
10121 #!! test
10122 #Parsoid-specific image handling - simple image with a formatted caption
10123 #!! options
10124 #parsoid
10125 #!! input
10126 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10127 #!! result
10128 #<p>
10129 #<span typeof="mw:Image">
10130 #<a class="mw-default-size" href="Image:Foobar.jpg">
10131 #<img alt="Foobar.jpg" class="mw-default-size" src="http://example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10132 #</a>
10133 #<span>abc</span>
10134 #</span>
10135 #</p>
10136
10137
10138 ###
10139 ### Subpages
10140 ###
10141 !! article
10142 Subpage test/subpage
10143 !! text
10144 foo
10145 !! endarticle
10146
10147 !! test
10148 Subpage link
10149 !! options
10150 subpage title=[[Subpage test]]
10151 !! input
10152 [[/subpage]]
10153 !! result
10154 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
10155 </p>
10156 !! end
10157
10158 !! test
10159 Subpage noslash link
10160 !! options
10161 subpage title=[[Subpage test]]
10162 !!input
10163 [[/subpage/]]
10164 !! result
10165 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
10166 </p>
10167 !! end
10168
10169 # TODO: make this PHP-parser compatible!
10170 !! test
10171 Relative subpage noslash link
10172 !! options
10173 parsoid=wt2wt,wt2html,html2html
10174 subpage title=[[Subpage test/1/2/3/4]]
10175 !!input
10176 [[../../subpage/]]
10177
10178 [[../../subpage]]
10179 !! result
10180 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
10181 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
10182 !! end
10183
10184 # TODO: make this PHP-parser compatible!
10185 !! test
10186 Parsoid: dot-slash prefixed wikilinks
10187 !! options
10188 parsoid=wt2wt,wt2html,html2html
10189 !!input
10190 [[./foo]]
10191
10192 [[././bar]]
10193
10194 [[././baz/]]
10195 !! result
10196 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
10197 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
10198 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
10199 !! end
10200
10201 !! test
10202 Disabled subpages
10203 !! input
10204 [[/subpage]]
10205 !! result
10206 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
10207 </p>
10208 !! end
10209
10210 !! test
10211 BUG 561: {{/Subpage}}
10212 !! options
10213 subpage title=[[Page]]
10214 !! input
10215 {{/Subpage}}
10216 !! result
10217 <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>
10218 </p>
10219 !! end
10220
10221 ###
10222 ### Categories
10223 ###
10224 !! article
10225 Category:MediaWiki User's Guide
10226 !! text
10227 blah
10228 !! endarticle
10229
10230 !! test
10231 Link to category
10232 !! input
10233 [[:Category:MediaWiki User's Guide]]
10234 !! result
10235 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
10236 </p>
10237 !! end
10238
10239 !! test
10240 Simple category
10241 !! options
10242 cat
10243 !! input
10244 [[Category:MediaWiki User's Guide]]
10245 !! result
10246 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10247 !! end
10248
10249 !! test
10250 PAGESINCATEGORY invalid title fatal (r33546 fix)
10251 !! input
10252 {{PAGESINCATEGORY:<bogus>}}
10253 !! result
10254 <p>0
10255 </p>
10256 !! end
10257
10258 !! test
10259 Category with different sort key
10260 !! options
10261 cat
10262 !! input
10263 [[Category:MediaWiki User's Guide|Foo]]
10264 !! result
10265 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10266 !! end
10267
10268 !! test
10269 Category with identical sort key
10270 !! options
10271 cat
10272 !! input
10273 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10274 !! result
10275 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
10276 !! end
10277
10278 !! test
10279 Category with empty sort key
10280 !! options
10281 cat
10282 pst
10283 !! input
10284 [[Category:MediaWiki User's Guide|]]
10285 !! result
10286 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
10287 !! end
10288
10289 !! test
10290 Category with empty sort key and parentheses
10291 !! options
10292 cat
10293 pst
10294 !! input
10295 [[Category:Foo (bar)|]]
10296 !! result
10297 [[Category:Foo (bar)|Foo]]
10298 !! end
10299
10300 !! test
10301 Category with link tail
10302 !! options
10303 cat
10304 pst
10305 !! input
10306 123[[Category:Foo]]456
10307 !! result
10308 123[[Category:Foo]]456
10309 !! end
10310
10311 !! test
10312 Category with template
10313 !! options
10314 cat
10315 pst
10316 !! input
10317 [[Category:{{echo|Foo}}]]
10318 !! result
10319 [[Category:{{echo|Foo}}]]
10320 !! end
10321
10322 !! test
10323 Category with template in sort key
10324 !! options
10325 cat
10326 pst
10327 !! input
10328 [[Category:Foo|{{echo|Bar}}]]
10329 !! result
10330 [[Category:Foo|{{echo|Bar}}]]
10331 !! end
10332
10333 !! test
10334 Category with template in sort key and title
10335 !! options
10336 cat
10337 pst
10338 !! input
10339 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10340 !! result
10341 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
10342 !! end
10343
10344 !! test
10345 Category / paragraph interactions
10346 !! input
10347 Foo [[Category:Baz]] Bar
10348
10349 Foo [[Category:Baz]]
10350 Bar
10351
10352 Foo
10353 [[Category:Baz]]
10354 Bar
10355
10356 Foo
10357 [[Category:Baz]] Bar
10358
10359 Foo
10360 [[Category:Baz]]
10361 [[Category:Baz]]
10362 [[Category:Baz]]
10363 Bar
10364
10365 [[Category:Baz]]
10366 [[Category:Baz]]
10367 [[Category:Baz]]
10368
10369 [[Category:Baz]]
10370 {{echo|[[Category:Baz]]}}
10371 [[Category:Baz]]
10372 !! result
10373 <p>Foo Bar
10374 </p><p>Foo
10375 Bar
10376 </p><p>Foo
10377 Bar
10378 </p><p>Foo Bar
10379 </p><p>Foo
10380 Bar
10381 </p>
10382 !! end
10383
10384 !! test
10385 Parsoid: Serialize link to category page with colon escape
10386 !! options
10387 parsoid
10388 !! input
10389
10390 [[:Category:Foo]]
10391 [[:Category:Foo|Bar]]
10392 !! result
10393 <p>
10394 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
10395 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
10396 </p>
10397 !! end
10398
10399 !! test
10400 Parsoid: Link prefix/suffixes aren't applied to category links
10401 !! options
10402 parsoid=wt2html,wt2wt,html2html
10403 language=is
10404 !! input
10405 x[[Category:Foo]]y
10406 !! result
10407 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
10408 !! end
10409
10410 !! test
10411 Parsoid: Serialize link to file page with colon escape
10412 !! options
10413 parsoid
10414 !! input
10415
10416 [[:File:Foo.png]]
10417 [[:File:Foo.png|Bar]]
10418 !! result
10419 <p>
10420 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
10421 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
10422 </p>
10423 !! end
10424
10425 !! test
10426 Parsoid: Serialize a genuine category link without colon escape
10427 !! options
10428 parsoid
10429 !! input
10430 [[Category:Foo]]
10431 [[Category:Foo|Bar]]
10432 !! result
10433 <link rel="mw:WikiLink/Category" href="Category:Foo">
10434 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
10435 !! end
10436
10437 ###
10438 ### Inter-language links
10439 ###
10440 !! test
10441 Inter-language links
10442 !! options
10443 ill
10444 !! input
10445 [[es:Alimento]]
10446 [[fr:Nourriture]]
10447 [[zh:&#39135;&#21697;]]
10448 !! result
10449 es:Alimento fr:Nourriture zh:食品
10450 !! end
10451
10452 !! test
10453 Duplicate interlanguage links (bug 24502)
10454 !! options
10455 ill
10456 !! input
10457 [[es:1]]
10458 [[es:2]]
10459 [[fr:1]]
10460 [[fr:2]]
10461 !! result
10462 es:1 fr:1
10463 !! end
10464
10465 ###
10466 ### Sections
10467 ###
10468 !! test
10469 Basic section headings
10470 !! input
10471 == Headline 1 ==
10472 Some text
10473
10474 ==Headline 2==
10475 More
10476 ===Smaller headline===
10477 Blah blah
10478 !! result
10479 <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>
10480 <p>Some text
10481 </p>
10482 <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>
10483 <p>More
10484 </p>
10485 <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>
10486 <p>Blah blah
10487 </p>
10488 !! end
10489
10490 !! test
10491 Section headings with TOC
10492 !! input
10493 == Headline 1 ==
10494 === Subheadline 1 ===
10495 ===== Skipping a level =====
10496 ====== Skipping a level ======
10497
10498 == Headline 2 ==
10499 Some text
10500 ===Another headline===
10501 !! result
10502 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10503 <ul>
10504 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
10505 <ul>
10506 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
10507 <ul>
10508 <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>
10509 <ul>
10510 <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>
10511 </ul>
10512 </li>
10513 </ul>
10514 </li>
10515 </ul>
10516 </li>
10517 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
10518 <ul>
10519 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
10520 </ul>
10521 </li>
10522 </ul>
10523 </div>
10524
10525 <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>
10526 <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>
10527 <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>
10528 <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>
10529 <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>
10530 <p>Some text
10531 </p>
10532 <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>
10533
10534 !! end
10535
10536 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
10537 !! test
10538 Handling of sections up to level 6 and beyond
10539 !! input
10540 = Level 1 Heading=
10541 == Level 2 Heading==
10542 === Level 3 Heading===
10543 ==== Level 4 Heading====
10544 ===== Level 5 Heading=====
10545 ====== Level 6 Heading======
10546 ======= Level 7 Heading=======
10547 ======== Level 8 Heading========
10548 ========= Level 9 Heading=========
10549 ========== Level 10 Heading==========
10550 !! result
10551 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10552 <ul>
10553 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
10554 <ul>
10555 <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>
10556 <ul>
10557 <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>
10558 <ul>
10559 <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>
10560 <ul>
10561 <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>
10562 <ul>
10563 <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>
10564 <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>
10565 <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>
10566 <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>
10567 <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>
10568 </ul>
10569 </li>
10570 </ul>
10571 </li>
10572 </ul>
10573 </li>
10574 </ul>
10575 </li>
10576 </ul>
10577 </li>
10578 </ul>
10579 </div>
10580
10581 <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>
10582 <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>
10583 <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>
10584 <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>
10585 <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>
10586 <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>
10587 <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>
10588 <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>
10589 <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>
10590 <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>
10591
10592 !! end
10593
10594 !! test
10595 TOC regression (bug 9764)
10596 !! input
10597 == title 1 ==
10598 === title 1.1 ===
10599 ==== title 1.1.1 ====
10600 === title 1.2 ===
10601 == title 2 ==
10602 === title 2.1 ===
10603 !! result
10604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10605 <ul>
10606 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10607 <ul>
10608 <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>
10609 <ul>
10610 <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>
10611 </ul>
10612 </li>
10613 <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>
10614 </ul>
10615 </li>
10616 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10617 <ul>
10618 <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>
10619 </ul>
10620 </li>
10621 </ul>
10622 </div>
10623
10624 <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>
10625 <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>
10626 <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>
10627 <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>
10628 <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>
10629 <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>
10630
10631 !! end
10632
10633 !! test
10634 TOC with wgMaxTocLevel=3 (bug 6204)
10635 !! options
10636 wgMaxTocLevel=3
10637 !! input
10638 == title 1 ==
10639 === title 1.1 ===
10640 ==== title 1.1.1 ====
10641 === title 1.2 ===
10642 == title 2 ==
10643 === title 2.1 ===
10644 !! result
10645 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10646 <ul>
10647 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10648 <ul>
10649 <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>
10650 <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>
10651 </ul>
10652 </li>
10653 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
10654 <ul>
10655 <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>
10656 </ul>
10657 </li>
10658 </ul>
10659 </div>
10660
10661 <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>
10662 <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>
10663 <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>
10664 <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>
10665 <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>
10666 <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>
10667
10668 !! end
10669
10670 !! test
10671 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
10672 !! options
10673 wgMaxTocLevel=3
10674 !! input
10675 ==Section 1==
10676 ===Section 1.1===
10677 ====Section 1.1.1====
10678 ====Section 1.1.1.1====
10679 ==Section 2==
10680 !! result
10681 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10682 <ul>
10683 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
10684 <ul>
10685 <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>
10686 </ul>
10687 </li>
10688 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
10689 </ul>
10690 </div>
10691
10692 <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>
10693 <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>
10694 <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>
10695 <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>
10696 <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>
10697
10698 !! end
10699
10700
10701 !! test
10702 Resolving duplicate section names
10703 !! input
10704 == Foo bar ==
10705 == Foo bar ==
10706 !! result
10707 <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>
10708 <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>
10709
10710 !! end
10711
10712 !! test
10713 Resolving duplicate section names with differing case (bug 10721)
10714 !! input
10715 == Foo bar ==
10716 == Foo Bar ==
10717 !! result
10718 <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>
10719 <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>
10720
10721 !! end
10722
10723 !! article
10724 Template:sections
10725 !! text
10726 ===Section 1===
10727 ==Section 2==
10728 !! endarticle
10729
10730 !! test
10731 Template with sections, __NOTOC__
10732 !! input
10733 __NOTOC__
10734 ==Section 0==
10735 {{sections}}
10736 ==Section 4==
10737 !! result
10738 <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>
10739 <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>
10740 <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>
10741 <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>
10742
10743 !! end
10744
10745 !! test
10746 __NOEDITSECTION__ keyword
10747 !! input
10748 __NOEDITSECTION__
10749 ==Section 1==
10750 ==Section 2==
10751 !! result
10752 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
10753 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
10754
10755 !! end
10756
10757 !! test
10758 Link inside a section heading
10759 !! input
10760 ==Section with a [[Main Page|link]] in it==
10761 !! result
10762 <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>
10763
10764 !! end
10765
10766 !! test
10767 TOC regression (bug 12077)
10768 !! input
10769 __TOC__
10770 == title 1 ==
10771 === title 1.1 ===
10772 == title 2 ==
10773 !! result
10774 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10775 <ul>
10776 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
10777 <ul>
10778 <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>
10779 </ul>
10780 </li>
10781 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
10782 </ul>
10783 </div>
10784
10785 <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>
10786 <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>
10787 <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>
10788
10789 !! end
10790
10791 !! test
10792 BUG 1219 URL next to image (good)
10793 !! input
10794 http://example.com [[Image:foobar.jpg]]
10795 !! result
10796 <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>
10797 </p>
10798 !!end
10799
10800 !! test
10801 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
10802 !! input
10803 ===
10804 The line above must have a trailing space!
10805 === <!--
10806 --> <!-- -->
10807 But just in case it doesn't...
10808 !! result
10809 <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>
10810 <p>The line above must have a trailing space!
10811 </p>
10812 <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>
10813 <p>But just in case it doesn't...
10814 </p>
10815 !! end
10816
10817 !! test
10818 Header with special characters (bug 25462)
10819 !! input
10820 The tooltips shall not show entities to the user (ie. be double escaped)
10821
10822 == text > text ==
10823 section 1
10824
10825 == text < text ==
10826 section 2
10827
10828 == text & text ==
10829 section 3
10830
10831 == text ' text ==
10832 section 4
10833
10834 == text " text ==
10835 section 5
10836 !! result
10837 <p>The tooltips shall not show entities to the user (ie. be double escaped)
10838 </p>
10839 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10840 <ul>
10841 <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>
10842 <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>
10843 <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>
10844 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
10845 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
10846 </ul>
10847 </div>
10848
10849 <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>
10850 <p>section 1
10851 </p>
10852 <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>
10853 <p>section 2
10854 </p>
10855 <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>
10856 <p>section 3
10857 </p>
10858 <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>
10859 <p>section 4
10860 </p>
10861 <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>
10862 <p>section 5
10863 </p>
10864 !! end
10865
10866 !! test
10867 Headers with excess '=' characters
10868 (Are similar tests necessary beyond the 1st level?)
10869 !! input
10870 =foo==
10871 ==foo=
10872 =''italic'' heading==
10873 ==''italic'' heading=
10874 !! result
10875 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10876 <ul>
10877 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
10878 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
10879 <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>
10880 <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>
10881 </ul>
10882 </div>
10883
10884 <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>
10885 <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>
10886 <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>
10887 <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>
10888
10889 !! end
10890
10891 !! test
10892 HTML headers vs TOC (bug 23393)
10893 (__NOEDITSECTION__ for clearer output, doesn't matter here)
10894 !! input
10895 <h1>Header 1</h1>
10896 == Header 1.1 ==
10897 == Header 1.2 ==
10898
10899 <h1>Header 2
10900 </h1>
10901 == Header 2.1 ==
10902 == Header 2.2 ==
10903 __NOEDITSECTION__
10904 !! result
10905 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10906 <ul>
10907 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
10908 <ul>
10909 <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>
10910 <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>
10911 </ul>
10912 </li>
10913 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
10914 <ul>
10915 <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>
10916 <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>
10917 </ul>
10918 </li>
10919 </ul>
10920 </div>
10921
10922 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
10923 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
10924 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
10925 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
10926 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
10927 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
10928
10929 !! end
10930
10931 !! test
10932 BUG 1219 URL next to image (broken)
10933 !! input
10934 http://example.com[[Image:foobar.jpg]]
10935 !! result
10936 <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>
10937 </p>
10938 !!end
10939
10940 !! test
10941 Bug 1186 news: in the middle of text
10942 !! input
10943 http://en.wikinews.org/wiki/Wikinews:Workplace
10944 !! result
10945 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
10946 </p>
10947 !!end
10948
10949
10950 !! test
10951 Namespaced link must have a title
10952 !! input
10953 [[Project:]]
10954 !! result
10955 <p>[[Project:]]
10956 </p>
10957 !!end
10958
10959 !! test
10960 Namespaced link must have a title (bad fragment version)
10961 !! input
10962 [[Project:#fragment]]
10963 !! result
10964 <p>[[Project:#fragment]]
10965 </p>
10966 !!end
10967
10968
10969 ###
10970 ### HTML tags and HTML attributes
10971 ###
10972
10973 !! test
10974 div with no attributes
10975 !! input
10976 <div>HTML rocks</div>
10977 !! result
10978 <div>HTML rocks</div>
10979
10980 !! end
10981
10982 !! test
10983 div with double-quoted attribute
10984 !! input
10985 <div id="rock">HTML rocks</div>
10986 !! result
10987 <div id="rock">HTML rocks</div>
10988
10989 !! end
10990
10991 !! test
10992 div with single-quoted attribute
10993 !! input
10994 <div id='rock'>HTML rocks</div>
10995 !! result
10996 <div id="rock">HTML rocks</div>
10997
10998 !! end
10999
11000 !! test
11001 div with unquoted attribute
11002 !! input
11003 <div id=rock>HTML rocks</div>
11004 !! result
11005 <div id="rock">HTML rocks</div>
11006
11007 !! end
11008
11009 !! test
11010 div with illegal double attributes
11011 !! input
11012 <div id="a" id="b">HTML rocks</div>
11013 !! result
11014 <div id="b">HTML rocks</div>
11015
11016 !!end
11017
11018 # FIXME: produce empty string instead of "class" in the PHP parser, following
11019 # the HTML5 spec.
11020 !! test
11021 div with empty attribute value, space before equals
11022 !! options
11023 parsoid
11024 !! input
11025 <div class =>HTML rocks</div>
11026 !! result
11027 <div class="">HTML rocks</div>
11028
11029 !! end
11030
11031 # The PHP parser escapes the opening brace to &#123; for some reason, so
11032 # disabled this test for it.
11033 !! test
11034 div with braces in attribute value
11035 !! options
11036 parsoid
11037 !! input
11038 <div title="{}">Foo</div>
11039 !! result
11040 <div title="{}">Foo</div>
11041 !! end
11042
11043 # This it very inconsistent in the PHP parser: it returns
11044 # class="class" if there is a space between the name and the equal sign (see
11045 # 'div with empty attribute value, space before equals'), but strips the
11046 # attribute completely if the space is missing. We hope that not much content
11047 # depends on this, so are implementing the behavior below in Parsoid for
11048 # consistencies' sake. Disabled for the PHP parser.
11049 # FIXME: fix this behavior in the PHP parser?
11050 !! test
11051 div with empty attribute value, no space before equals
11052 !! options
11053 parsoid
11054 !! input
11055 <div class=>HTML rocks</div>
11056 !! result
11057 <div class="">HTML rocks</div>
11058
11059 !! end
11060
11061 !! test
11062 HTML multiple attributes correction
11063 !! input
11064 <p class="error" class="awesome">Awesome!</p>
11065 !! result
11066 <p class="awesome">Awesome!</p>
11067
11068 !!end
11069
11070 !! test
11071 Table multiple attributes correction
11072 !! input
11073 {|
11074 !+ class="error" class="awesome"| status
11075 |}
11076 !! result
11077 <table>
11078 <tr>
11079 <th class="awesome"> status
11080 </th></tr></table>
11081
11082 !!end
11083
11084 !! test
11085 DIV IN UPPERCASE
11086 !! input
11087 <DIV ID="x">HTML ROCKS</DIV>
11088 !! result
11089 <div id="x">HTML ROCKS</div>
11090
11091 !!end
11092
11093 !! test
11094 Non-ASCII pseudo-tags are rendered as text
11095 !! input
11096 <khyô>
11097 !! result
11098 <p>&lt;khyô&gt;
11099 </p>
11100 !! end
11101
11102 !! test
11103 Pseudo-tag with URL 'name' renders as url link
11104 !! input
11105 <http://example.com/>
11106 !! result
11107 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
11108 </p>
11109 !! end
11110
11111 !! test
11112 text with amp in the middle of nowhere
11113 !! input
11114 Remember AT&T?
11115 !!result
11116 <p>Remember AT&amp;T?
11117 </p>
11118 !! end
11119
11120 !! test
11121 text with character entity: eacute
11122 !! input
11123 I always thought &eacute; was a cute letter.
11124 !! result
11125 <p>I always thought &#233; was a cute letter.
11126 </p>
11127 !! end
11128
11129 !! test
11130 text with entity-escaped character entity-like string: eacute
11131 !! input
11132 I always thought &amp;eacute; was a cute letter.
11133 !! result
11134 <p>I always thought &amp;eacute; was a cute letter.
11135 </p>
11136 !! end
11137
11138 !! test
11139 text with undefined character entity: xacute
11140 !! input
11141 I always thought &xacute; was a cute letter.
11142 !! result
11143 <p>I always thought &amp;xacute; was a cute letter.
11144 </p>
11145 !! end
11146
11147
11148 ###
11149 ### Nesting tests (see bug 41545, 50604, 51081)
11150 ###
11151
11152 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
11153 # Note that html2wt is considerably more difficult if we use <b> in
11154 # the test case, instead of <big>
11155 !! test
11156 Ensure that HTML adoption agency algorithm is properly implemented.
11157 !! input
11158 <big>X<big>Y</big>Z</big>
11159 !! result
11160 <p><big>X<big>Y</big>Z</big>
11161 </p>
11162 !! end
11163
11164 # This was bug 41545 in the PHP parser.
11165 !! test
11166 Nesting of <kbd>
11167 !! input
11168 <kbd>X<kbd>Y</kbd>Z</kbd>
11169 !! result
11170 <p><kbd>X<kbd>Y</kbd>Z</kbd>
11171 </p>
11172 !! end
11173
11174 # The following cases were bug 51081 in the PHP parser.
11175 # Note that there are some other nestable tags (b, i, etc) which are
11176 # not covered; see bug 51081 for discussion.
11177 !! test
11178 Nesting of <em>
11179 !! input
11180 <em>X<em>Y</em>Z</em>
11181 !! result
11182 <p><em>X<em>Y</em>Z</em>
11183 </p>
11184 !! end
11185
11186 !! test
11187 Nesting of <strong>
11188 !! input
11189 <strong>X<strong>Y</strong>Z</strong>
11190 !! result
11191 <p><strong>X<strong>Y</strong>Z</strong>
11192 </p>
11193 !! end
11194
11195 !! test
11196 Nesting of <q>
11197 !! input
11198 <q>X<q>Y</q>Z</q>
11199 !! result
11200 <p><q>X<q>Y</q>Z</q>
11201 </p>
11202 !! end
11203
11204 !! test
11205 Nesting of <ruby>
11206 !! input
11207 <ruby>X<ruby>Y</ruby>Z</ruby>
11208 !! result
11209 <p><ruby>X<ruby>Y</ruby>Z</ruby>
11210 </p>
11211 !! end
11212
11213 !! test
11214 Nesting of <bdo>
11215 !! input
11216 <bdo>X<bdo>Y</bdo>Z</bdo>
11217 !! result
11218 <p><bdo>X<bdo>Y</bdo>Z</bdo>
11219 </p>
11220 !! end
11221
11222
11223 ###
11224 ### Media links
11225 ###
11226
11227 !! test
11228 Media link
11229 !! input
11230 [[Media:Foobar.jpg]]
11231 !! result
11232 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
11233 </p>
11234 !! end
11235
11236 !! test
11237 Media link with text
11238 !! input
11239 [[Media:Foobar.jpg|A neat file to look at]]
11240 !! result
11241 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
11242 </p>
11243 !! end
11244
11245 # FIXME: this is still bad HTML tag nesting
11246 !! test
11247 Media link with nasty text
11248 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
11249 !! input
11250 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
11251 !! result
11252 <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>
11253
11254 !! end
11255
11256 !! test
11257 Media link to nonexistent file (bug 1702)
11258 !! input
11259 [[Media:No such.jpg]]
11260 !! result
11261 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
11262 </p>
11263 !! end
11264
11265 !! test
11266 Image link to nonexistent file (bug 1850 - good)
11267 !! input
11268 [[Image:No such.jpg]]
11269 !! result
11270 <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>
11271 </p>
11272 !! end
11273
11274 !! test
11275 :Image link to nonexistent file (bug 1850 - bad)
11276 !! input
11277 [[:Image:No such.jpg]]
11278 !! result
11279 <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>
11280 </p>
11281 !! end
11282
11283
11284
11285 !! test
11286 Character reference normalization in link text (bug 1938)
11287 !! input
11288 [[Main Page|this&that]]
11289 !! result
11290 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
11291 </p>
11292 !!end
11293
11294 !! article
11295 אַ
11296 !! text
11297 Test for unicode normalization
11298
11299 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
11300 !! endarticle
11301
11302 !! test
11303 (bug 19451) Links should refer to the normalized form.
11304 !! input
11305 [[&#xFB2E;]]
11306 [[&#x5d0;&#x5b7;]]
11307 [[&#x5d0;ַ]]
11308 [[א&#x5b7;]]
11309 [[אַ]]
11310 !! result
11311 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
11312 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
11313 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
11314 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
11315 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
11316 </p>
11317 !! end
11318
11319 !! test
11320 Empty attribute crash test (bug 2067)
11321 !! input
11322 <font color="">foo</font>
11323 !! result
11324 <p><font color="">foo</font>
11325 </p>
11326 !! end
11327
11328 !! test
11329 Empty attribute crash test single-quotes (bug 2067)
11330 !! input
11331 <font color=''>foo</font>
11332 !! result
11333 <p><font color="">foo</font>
11334 </p>
11335 !! end
11336
11337 !! test
11338 Attribute test: equals, then nothing
11339 !! input
11340 <font color=>foo</font>
11341 !! result
11342 <p><font>foo</font>
11343 </p>
11344 !! end
11345
11346 !! test
11347 Attribute test: unquoted value
11348 !! input
11349 <font color=x>foo</font>
11350 !! result
11351 <p><font color="x">foo</font>
11352 </p>
11353 !! end
11354
11355 !! test
11356 Attribute test: unquoted but illegal value (hash)
11357 !! input
11358 <font color=#x>foo</font>
11359 !! result
11360 <p><font color="#x">foo</font>
11361 </p>
11362 !! end
11363
11364 !! test
11365 Attribute test: no value
11366 !! input
11367 <font color>foo</font>
11368 !! result
11369 <p><font color="color">foo</font>
11370 </p>
11371 !! end
11372
11373 !! test
11374 Bug 2095: link with three closing brackets
11375 !! input
11376 [[Main Page]]]
11377 !! result
11378 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
11379 </p>
11380 !! end
11381
11382 !! test
11383 Bug 2095: link with pipe and three closing brackets
11384 !! input
11385 [[Main Page|link]]]
11386 !! result
11387 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
11388 </p>
11389 !! end
11390
11391 !! test
11392 Bug 2095: link with pipe and three closing brackets, version 2
11393 !! input
11394 [[Main Page|[http://example.com/]]]
11395 !! result
11396 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
11397 </p>
11398 !! end
11399
11400
11401 ###
11402 ### Safety
11403 ###
11404
11405 !! article
11406 Template:Dangerous attribute
11407 !! text
11408 " onmouseover="alert(document.cookie)
11409 !! endarticle
11410
11411 !! article
11412 Template:Dangerous style attribute
11413 !! text
11414 border-size: expression(alert(document.cookie))
11415 !! endarticle
11416
11417 !! article
11418 Template:Div style
11419 !! text
11420 <div style="float: right; {{{1}}}">Magic div</div>
11421 !! endarticle
11422
11423 !! test
11424 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
11425 !! input
11426 <div title="{{test}}"></div>
11427 !! result
11428 <div title="This is a test template"></div>
11429
11430 !! end
11431
11432 !! test
11433 Bug 2304: HTML attribute safety (dangerous template; 2309)
11434 !! input
11435 <div title="{{dangerous attribute}}"></div>
11436 !! result
11437 <div title=""></div>
11438
11439 !! end
11440
11441 !! test
11442 Bug 2304: HTML attribute safety (dangerous style template; 2309)
11443 !! input
11444 <div style="{{dangerous style attribute}}"></div>
11445 !! result
11446 <div style="/* insecure input */"></div>
11447
11448 !! end
11449
11450 !! test
11451 Bug 2304: HTML attribute safety (safe parameter; 2309)
11452 !! input
11453 {{div style|width: 200px}}
11454 !! result
11455 <div style="float: right; width: 200px">Magic div</div>
11456
11457 !! end
11458
11459 !! test
11460 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
11461 !! input
11462 {{div style|width: expression(alert(document.cookie))}}
11463 !! result
11464 <div style="/* insecure input */">Magic div</div>
11465
11466 !! end
11467
11468 !! test
11469 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
11470 !! input
11471 {{div style|"><script>alert(document.cookie)</script>}}
11472 !! result
11473 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11474
11475 !! end
11476
11477 !! test
11478 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
11479 !! input
11480 {{div style|" ><script>alert(document.cookie)</script>}}
11481 !! result
11482 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
11483
11484 !! end
11485
11486 !! test
11487 Bug 2304: HTML attribute safety (link)
11488 !! input
11489 <div title="[[Main Page]]"></div>
11490 !! result
11491 <div title="&#91;&#91;Main Page]]"></div>
11492
11493 !! end
11494
11495 !! test
11496 Bug 2304: HTML attribute safety (italics)
11497 !! input
11498 <div title="''foobar''"></div>
11499 !! result
11500 <div title="&#39;&#39;foobar&#39;&#39;"></div>
11501
11502 !! end
11503
11504 !! test
11505 Bug 2304: HTML attribute safety (bold)
11506 !! input
11507 <div title="'''foobar'''"></div>
11508 !! result
11509 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
11510
11511 !! end
11512
11513
11514 !! test
11515 Bug 2304: HTML attribute safety (ISBN)
11516 !! input
11517 <div title="ISBN 1234567890"></div>
11518 !! result
11519 <div title="&#73;SBN 1234567890"></div>
11520
11521 !! end
11522
11523 !! test
11524 Bug 2304: HTML attribute safety (RFC)
11525 !! input
11526 <div title="RFC 1234"></div>
11527 !! result
11528 <div title="&#82;FC 1234"></div>
11529
11530 !! end
11531
11532 !! test
11533 Bug 2304: HTML attribute safety (PMID)
11534 !! input
11535 <div title="PMID 1234567890"></div>
11536 !! result
11537 <div title="&#80;MID 1234567890"></div>
11538
11539 !! end
11540
11541 !! test
11542 Bug 2304: HTML attribute safety (web link)
11543 !! input
11544 <div title="http://example.com/"></div>
11545 !! result
11546 <div title="http&#58;//example.com/"></div>
11547
11548 !! end
11549
11550 !! test
11551 Bug 2304: HTML attribute safety (named web link)
11552 !! input
11553 <div title="[http://example.com/ link]"></div>
11554 !! result
11555 <div title="&#91;http&#58;//example.com/ link]"></div>
11556
11557 !! end
11558
11559 !! test
11560 Bug 3244: HTML attribute safety (extension; safe)
11561 !! input
11562 <div style="<nowiki>background:blue</nowiki>"></div>
11563 !! result
11564 <div style="background:blue"></div>
11565
11566 !! end
11567
11568 !! test
11569 Bug 3244: HTML attribute safety (extension; unsafe)
11570 !! input
11571 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
11572 !! result
11573 <div style="/* insecure input */"></div>
11574
11575 !! end
11576
11577 # More MSIE fun discovered by Tom Gilder
11578
11579 !! test
11580 MSIE CSS safety test: spurious slash
11581 !! input
11582 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
11583 !! result
11584 <div style="/* insecure input */">evil</div>
11585
11586 !! end
11587
11588 !! test
11589 MSIE CSS safety test: hex code
11590 !! input
11591 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
11592 !! result
11593 <div style="/* insecure input */">evil</div>
11594
11595 !! end
11596
11597 !! test
11598 MSIE CSS safety test: comment in url
11599 !! input
11600 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
11601 !! result
11602 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
11603
11604 !! end
11605
11606 !! test
11607 MSIE CSS safety test: comment in expression
11608 !! input
11609 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
11610 !! result
11611 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
11612
11613 !! end
11614
11615
11616 !! test
11617 Table attribute legitimate extension
11618 !! input
11619 {|
11620 !+ style="<nowiki>color:blue</nowiki>"| status
11621 |}
11622 !! result
11623 <table>
11624 <tr>
11625 <th style="color:blue"> status
11626 </th></tr></table>
11627
11628 !!end
11629
11630 !! test
11631 Table attribute safety
11632 !! input
11633 {|
11634 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
11635 |}
11636 !! result
11637 <table>
11638 <tr>
11639 <th style="/* insecure input */"> status
11640 </th></tr></table>
11641
11642 !! end
11643
11644 !! test
11645 CSS line continuation 1
11646 !! input
11647 <div style="background-image: u\&#10;rl(test.jpg);"></div>
11648 !! result
11649 <div style="/* insecure input */"></div>
11650
11651 !! end
11652
11653 !! test
11654 CSS line continuation 2
11655 !! input
11656 <div style="background-image: u\&#13;rl(test.jpg); "></div>
11657 !! result
11658 <div style="/* insecure input */"></div>
11659
11660 !! end
11661
11662 !! article
11663 Template:Identity
11664 !! text
11665 {{{1}}}
11666 !! endarticle
11667
11668 !! test
11669 Expansion of multi-line templates in attribute values (bug 6255)
11670 !! input
11671 <div style="background: {{identity|#00FF00}}">-</div>
11672 !! result
11673 <div style="background: #00FF00">-</div>
11674
11675 !! end
11676
11677
11678 !! test
11679 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
11680 !! input
11681 <div style="background:
11682 #00FF00">-</div>
11683 !! result
11684 <div style="background: #00FF00">-</div>
11685
11686 !! end
11687
11688 !! test
11689 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
11690 !! input
11691 <div style="background: &#10;#00FF00">-</div>
11692 !! result
11693 <div style="background: &#10;#00FF00">-</div>
11694
11695 !! end
11696
11697 ###
11698 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
11699 ###
11700 !! test
11701 Parser hook: empty input
11702 !! input
11703 <tag></tag>
11704 !! result
11705 <pre>
11706 ''
11707 array (
11708 )
11709 </pre>
11710
11711 !! end
11712
11713 !! test
11714 Parser hook: empty input using terminated empty elements
11715 !! input
11716 <tag/>
11717 !! result
11718 <pre>
11719 NULL
11720 array (
11721 )
11722 </pre>
11723
11724 !! end
11725
11726 !! test
11727 Parser hook: empty input using terminated empty elements (space before)
11728 !! input
11729 <tag />
11730 !! result
11731 <pre>
11732 NULL
11733 array (
11734 )
11735 </pre>
11736
11737 !! end
11738
11739 !! test
11740 Parser hook: basic input
11741 !! input
11742 <tag>input</tag>
11743 !! result
11744 <pre>
11745 'input'
11746 array (
11747 )
11748 </pre>
11749
11750 !! end
11751
11752
11753 !! test
11754 Parser hook: case insensitive
11755 !! input
11756 <TAG>input</TAG>
11757 !! result
11758 <pre>
11759 'input'
11760 array (
11761 )
11762 </pre>
11763
11764 !! end
11765
11766
11767 !! test
11768 Parser hook: case insensitive, redux
11769 !! input
11770 <TaG>input</TAg>
11771 !! result
11772 <pre>
11773 'input'
11774 array (
11775 )
11776 </pre>
11777
11778 !! end
11779
11780 !! test
11781 Parser hook: nested tags
11782 !! options
11783 noxml
11784 !! input
11785 <tag><tag></tag></tag>
11786 !! result
11787 <pre>
11788 '<tag>'
11789 array (
11790 )
11791 </pre>&lt;/tag&gt;
11792
11793 !! end
11794
11795 !! test
11796 Parser hook: basic arguments
11797 !! input
11798 <tag width=200 height = "100" depth = '50' square></tag>
11799 !! result
11800 <pre>
11801 ''
11802 array (
11803 'width' => '200',
11804 'height' => '100',
11805 'depth' => '50',
11806 'square' => 'square',
11807 )
11808 </pre>
11809
11810 !! end
11811
11812 !! test
11813 Parser hook: argument containing a forward slash (bug 5344)
11814 !! input
11815 <tag filename='/tmp/bla'></tag>
11816 !! result
11817 <pre>
11818 ''
11819 array (
11820 'filename' => '/tmp/bla',
11821 )
11822 </pre>
11823
11824 !! end
11825
11826 !! test
11827 Parser hook: empty input using terminated empty elements (bug 2374)
11828 !! input
11829 <tag foo=bar/>text
11830 !! result
11831 <pre>
11832 NULL
11833 array (
11834 'foo' => 'bar',
11835 )
11836 </pre>text
11837
11838 !! end
11839
11840 # </tag> should be output literally since there is no matching tag that begins it
11841 !! test
11842 Parser hook: basic arguments using terminated empty elements (bug 2374)
11843 !! input
11844 <tag width=200 height = "100" depth = '50' square/>
11845 other stuff
11846 </tag>
11847 !! result
11848 <pre>
11849 NULL
11850 array (
11851 'width' => '200',
11852 'height' => '100',
11853 'depth' => '50',
11854 'square' => 'square',
11855 )
11856 </pre>
11857 <p>other stuff
11858 &lt;/tag&gt;
11859 </p>
11860 !! end
11861
11862 ###
11863 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
11864 ###
11865
11866 !! test
11867 Parser hook: static parser hook not inside a comment
11868 !! input
11869 <statictag>hello, world</statictag>
11870 <statictag action=flush/>
11871 !! result
11872 <p>hello, world
11873 </p>
11874 !! end
11875
11876
11877 !! test
11878 Parser hook: static parser hook inside a comment
11879 !! input
11880 <!-- <statictag>hello, world</statictag> -->
11881 <statictag action=flush/>
11882 !! result
11883 <p><br />
11884 </p>
11885 !! end
11886
11887 # Nested template calls; this case was broken by Parser.php rev 1.506,
11888 # since reverted.
11889
11890 !! article
11891 Template:One-parameter
11892 !! text
11893 (My parameter is: {{{1}}})
11894 !! endarticle
11895
11896 !! article
11897 Template:Map-one-parameter
11898 !! text
11899 {{{{{1}}}|{{{2}}}}}
11900 !! endarticle
11901
11902 !! test
11903 Nested template calls
11904 !! input
11905 {{Map-one-parameter|One-parameter|param}}
11906 !! result
11907 <p>(My parameter is: param)
11908 </p>
11909 !! end
11910
11911
11912 ###
11913 ### Sanitizer
11914 ###
11915 !! test
11916 Sanitizer: Closing of open tags
11917 !! input
11918 <s></s><table></table>
11919 !! result
11920 <s></s><table></table>
11921
11922 !! end
11923
11924 !! test
11925 Sanitizer: Closing of open but not closed tags
11926 !! input
11927 <s>foo
11928 !! result
11929 <p><s>foo</s>
11930 </p>
11931 !! end
11932
11933 !! test
11934 Sanitizer: Closing of closed but not open tags
11935 !! input
11936 </s>
11937 !! result
11938 <p>&lt;/s&gt;
11939 </p>
11940 !! end
11941
11942 !! test
11943 Sanitizer: Closing of closed but not open table tags
11944 !! input
11945 Table not started</td></tr></table>
11946 !! result
11947 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
11948 </p>
11949 !! end
11950
11951 !! test
11952 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
11953 !! input
11954 <span id="æ: v">byte</span>[[#æ: v|backlink]]
11955 !! result
11956 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
11957 </p>
11958 !! end
11959
11960 !! test
11961 Sanitizer: Validating the contents of the id attribute (bug 4515)
11962 !! options
11963 disabled
11964 !! input
11965 <br id=9 />
11966 !! result
11967 Something, but definitely not <br id="9" />...
11968 !! end
11969
11970 !! test
11971 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
11972 !! options
11973 disabled
11974 !! input
11975 <br id="foo" /><br id="foo" />
11976 !! result
11977 Something need to be done. foo-2 ?
11978 !! end
11979
11980 !! test
11981 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
11982 !! input
11983 <div itemscope>
11984 <meta itemprop="hello" content="world">
11985 <meta http-equiv="refresh" content="5">
11986 <meta itemprop="hello" http-equiv="refresh" content="5">
11987 <link itemprop="hello" href="{{SERVER}}">
11988 <link rel="stylesheet" href="{{SERVER}}">
11989 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
11990 </div>
11991 !! result
11992 <div itemscope="itemscope">
11993 <p> <meta itemprop="hello" content="world" />
11994 &lt;meta http-equiv="refresh" content="5"&gt;
11995 <meta itemprop="hello" content="5" />
11996 </p>
11997 <link itemprop="hello" href="http&#58;//example.org" />
11998 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
11999 <link itemprop="hello" href="http&#58;//example.org" />
12000 </div>
12001
12002 !! end
12003
12004 !! test
12005 Language converter: output gets cut off unexpectedly (bug 5757)
12006 !! options
12007 language=zh
12008 !! input
12009 this bit is safe: }-
12010
12011 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
12012
12013 then we get cut off here: }-
12014
12015 all additional text is vanished
12016 !! result
12017 <p>this bit is safe: }-
12018 </p><p>but if we add a conversion instance: xxx
12019 </p><p>then we get cut off here: }-
12020 </p><p>all additional text is vanished
12021 </p>
12022 !! end
12023
12024 !! test
12025 Self closed html pairs (bug 5487)
12026 !! options
12027 !! input
12028 <center><font id="bug" />Centered text</center>
12029 <div><font id="bug2" />In div text</div>
12030 !! result
12031 <center>&lt;font id="bug" /&gt;Centered text</center>
12032 <div>&lt;font id="bug2" /&gt;In div text</div>
12033
12034 !! end
12035
12036 #
12037 #
12038 #
12039
12040 !! test
12041 Punctuation: nbsp before exclamation
12042 !! input
12043 C'est grave !
12044 !! result
12045 <p>C'est grave&#160;!
12046 </p>
12047 !! end
12048
12049 !! test
12050 Punctuation: CSS !important (bug 11874)
12051 !! input
12052 <div style="width:50% !important">important</div>
12053 !! result
12054 <div style="width:50% !important">important</div>
12055
12056 !!end
12057
12058 !! test
12059 Punctuation: CSS ! important (bug 11874; with space after)
12060 !! input
12061 <div style="width:50% ! important">important</div>
12062 !! result
12063 <div style="width:50% ! important">important</div>
12064
12065 !!end
12066
12067
12068 !! test
12069 HTML bullet list, closed tags (bug 5497)
12070 !! input
12071 <ul>
12072 <li>One</li>
12073 <li>Two</li>
12074 </ul>
12075 !! result
12076 <ul>
12077 <li>One</li>
12078 <li>Two</li>
12079 </ul>
12080
12081 !! end
12082
12083 !! test
12084 HTML bullet list, unclosed tags (bug 5497)
12085 !! options
12086 disabled
12087 !! input
12088 <ul>
12089 <li>One
12090 <li>Two
12091 </ul>
12092 !! result
12093 <ul>
12094 <li>One
12095 </li>
12096 <li>Two
12097 </li>
12098 </ul>
12099
12100 !! end
12101
12102 !! test
12103 HTML ordered list, closed tags (bug 5497)
12104 !! input
12105 <ol>
12106 <li>One</li>
12107 <li>Two</li>
12108 </ol>
12109 !! result
12110 <ol>
12111 <li>One</li>
12112 <li>Two</li>
12113 </ol>
12114
12115 !! end
12116
12117 !! test
12118 HTML ordered list, unclosed tags (bug 5497)
12119 !! options
12120 disabled
12121 !! input
12122 <ol>
12123 <li>One
12124 <li>Two
12125 </ol>
12126 !! result
12127 <ol>
12128 <li>One
12129 </li>
12130 <li>Two
12131 </li>
12132 </ol>
12133
12134 !! end
12135
12136 !! test
12137 HTML nested bullet list, closed tags (bug 5497)
12138 !! input
12139 <ul>
12140 <li>One</li>
12141 <li>Two:
12142 <ul>
12143 <li>Sub-one</li>
12144 <li>Sub-two</li>
12145 </ul>
12146 </li>
12147 </ul>
12148 !! result
12149 <ul>
12150 <li>One</li>
12151 <li>Two:
12152 <ul>
12153 <li>Sub-one</li>
12154 <li>Sub-two</li>
12155 </ul>
12156 </li>
12157 </ul>
12158
12159 !! end
12160
12161 !! test
12162 HTML nested bullet list, open tags (bug 5497)
12163 !! options
12164 disabled
12165 !! input
12166 <ul>
12167 <li>One
12168 <li>Two:
12169 <ul>
12170 <li>Sub-one
12171 <li>Sub-two
12172 </ul>
12173 </ul>
12174 !! result
12175 <ul>
12176 <li>One
12177 </li>
12178 <li>Two:
12179 <ul>
12180 <li>Sub-one
12181 </li>
12182 <li>Sub-two
12183 </li>
12184 </ul>
12185 </li>
12186 </ul>
12187
12188 !! end
12189
12190 !! test
12191 HTML nested ordered list, closed tags (bug 5497)
12192 !! input
12193 <ol>
12194 <li>One</li>
12195 <li>Two:
12196 <ol>
12197 <li>Sub-one</li>
12198 <li>Sub-two</li>
12199 </ol>
12200 </li>
12201 </ol>
12202 !! result
12203 <ol>
12204 <li>One</li>
12205 <li>Two:
12206 <ol>
12207 <li>Sub-one</li>
12208 <li>Sub-two</li>
12209 </ol>
12210 </li>
12211 </ol>
12212
12213 !! end
12214
12215 !! test
12216 HTML nested ordered list, open tags (bug 5497)
12217 !! options
12218 disabled
12219 !! input
12220 <ol>
12221 <li>One
12222 <li>Two:
12223 <ol>
12224 <li>Sub-one
12225 <li>Sub-two
12226 </ol>
12227 </ol>
12228 !! result
12229 <ol>
12230 <li>One
12231 </li>
12232 <li>Two:
12233 <ol>
12234 <li>Sub-one
12235 </li>
12236 <li>Sub-two
12237 </li>
12238 </ol>
12239 </li>
12240 </ol>
12241
12242 !! end
12243
12244 !! test
12245 HTML ordered list item with parameters oddity
12246 !! input
12247 <ol><li id="fragment">One</li>
12248 </ol>
12249 !! result
12250 <ol><li id="fragment">One</li>
12251 </ol>
12252
12253 !! end
12254
12255 !!test
12256 bug 5918: autonumbering
12257 !! input
12258 [http://first/] [http://second] [ftp://ftp]
12259
12260 ftp://inlineftp
12261
12262 [mailto:enclosed@mail.tld With target]
12263
12264 [mailto:enclosed@mail.tld]
12265
12266 mailto:inline@mail.tld
12267 !! result
12268 <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>
12269 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
12270 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
12271 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
12272 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
12273 </p>
12274 !! end
12275
12276
12277 #
12278 # Security and HTML correctness
12279 # From Nick Jenkins' fuzz testing
12280 #
12281
12282 !! test
12283 Fuzz testing: Parser13
12284 !! input
12285 {|
12286 | http://a|
12287 !! result
12288 <table>
12289 <tr>
12290 <td>
12291 </td>
12292 </tr>
12293 </table>
12294
12295 !! end
12296
12297 !! test
12298 Fuzz testing: Parser14
12299 !! input
12300 == onmouseover= ==
12301 http://__TOC__
12302 !! result
12303 <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>
12304 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12305 <ul>
12306 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
12307 </ul>
12308 </div>
12309
12310
12311 !! end
12312
12313 !! test
12314 Fuzz testing: Parser14-table
12315 !! input
12316 ==a==
12317 {| STYLE=__TOC__
12318 !! result
12319 <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>
12320 <table style="&#95;_TOC&#95;_">
12321 <tr><td></td></tr>
12322 </table>
12323
12324 !! end
12325
12326 # Known to produce bogus xml (extra </td>)
12327 !! test
12328 Fuzz testing: Parser16
12329 !! options
12330 noxml
12331 !! input
12332 {|
12333 !https://||||||
12334 !! result
12335 <table>
12336 <tr>
12337 <th>https://</th>
12338 <th></th>
12339 <th></th>
12340 <th>
12341 </td>
12342 </tr>
12343 </table>
12344
12345 !! end
12346
12347 !! test
12348 Fuzz testing: Parser21
12349 !! input
12350 {|
12351 ! irc://{{ftp://a" onmouseover="alert('hello world');"
12352 |
12353 !! result
12354 <table>
12355 <tr>
12356 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
12357 </th>
12358 <td>
12359 </td>
12360 </tr>
12361 </table>
12362
12363 !! end
12364
12365 !! test
12366 Fuzz testing: Parser22
12367 !! input
12368 http://===r:::https://b
12369
12370 {|
12371 !!result
12372 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
12373 </p>
12374 <table>
12375 <tr><td></td></tr>
12376 </table>
12377
12378 !! end
12379
12380 # Known to produce bad XML for now
12381 !! test
12382 Fuzz testing: Parser24
12383 !! options
12384 noxml
12385 !! input
12386 {|
12387 {{{|
12388 <u CLASS=
12389 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
12390 <br style="onmouseover='alert(document.cookie);' " />
12391
12392 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12393 |
12394 !! result
12395 <table>
12396 {{{|
12397 <u class="&#124;">}}}} &gt;
12398 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
12399
12400 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
12401 <tr>
12402 <td></u>
12403 </td>
12404 </tr>
12405 </table>
12406
12407 !! end
12408
12409 # Note: the current result listed for this is not what the original one was,
12410 # but the original bug was JavaScript injection, which is fixed in any case.
12411 # It's not clear that the original result listed was any more correct than the
12412 # current one. Original result:
12413 # <p>{{{|
12414 # </p>
12415 # <li class="&#124;&#124;">
12416 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12417 !!test
12418 Fuzz testing: Parser25 (bug 6055)
12419 !! input
12420 {{{
12421 |
12422 <LI CLASS=||
12423 >
12424 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
12425 !! result
12426 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
12427 </p>
12428 !! end
12429
12430 !!test
12431 Fuzz testing: URL adjacent extension (with space, clean)
12432 !! options
12433 !! input
12434 http://example.com <nowiki>junk</nowiki>
12435 !! result
12436 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
12437 </p>
12438 !!end
12439
12440 !!test
12441 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
12442 !! options
12443 !! input
12444 http://example.com<nowiki>junk</nowiki>
12445 !! result
12446 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
12447 </p>
12448 !!end
12449
12450 !!test
12451 Fuzz testing: URL adjacent extension (no space, dirty; pre)
12452 !! options
12453 !! input
12454 http://example.com<pre>junk</pre>
12455 !! result
12456 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
12457
12458 !!end
12459
12460 !!test
12461 Fuzz testing: image with bogus manual thumbnail
12462 !!input
12463 [[Image:foobar.jpg|thumbnail= ]]
12464 !!result
12465 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
12466
12467 !!end
12468
12469 !! test
12470 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
12471 !! input
12472 <pre dir="&#10;"></pre>
12473 !! result
12474 <pre dir="&#10;"></pre>
12475
12476 !! end
12477
12478 !! test
12479 Parsing optional HTML elements (Bug 6171)
12480 !! options
12481 !! input
12482 <table>
12483 <tr>
12484 <td> Some tabular data</td>
12485 <td> More tabular data ...
12486 <td> And yet som tabular data</td>
12487 </tr>
12488 </table>
12489 !! result
12490 <table>
12491 <tr>
12492 <td> Some tabular data</td>
12493 <td> More tabular data ...
12494 </td><td> And yet som tabular data</td>
12495 </tr>
12496 </table>
12497
12498 !! end
12499
12500 !! test
12501 Correct handling of <td>, <tr> (Bug 6171)
12502 !! options
12503 !! input
12504 <table>
12505 <tr>
12506 <td> Some tabular data</td>
12507 <td> More tabular data ...</td>
12508 <td> And yet som tabular data</td>
12509 </tr>
12510 </table>
12511 !! result
12512 <table>
12513 <tr>
12514 <td> Some tabular data</td>
12515 <td> More tabular data ...</td>
12516 <td> And yet som tabular data</td>
12517 </tr>
12518 </table>
12519
12520 !! end
12521
12522
12523 !! test
12524 Parsing crashing regression (fr:JavaScript)
12525 !! input
12526 </body></x>
12527 !! result
12528 <p>&lt;/body&gt;&lt;/x&gt;
12529 </p>
12530 !! end
12531
12532 !! test
12533 Inline wiki vs wiki block nesting
12534 !! input
12535 '''Bold paragraph
12536
12537 New wiki paragraph
12538 !! result
12539 <p><b>Bold paragraph</b>
12540 </p><p>New wiki paragraph
12541 </p>
12542 !! end
12543
12544 !! test
12545 Inline HTML vs wiki block nesting
12546 !! options
12547 disabled
12548 !! input
12549 <b>Bold paragraph
12550
12551 New wiki paragraph
12552 !! result
12553 <p><b>Bold paragraph</b>
12554 </p><p>New wiki paragraph
12555 </p>
12556 !! end
12557
12558 # Original result was this:
12559 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
12560 # </p>
12561 # While that might be marginally more intuitive, maybe, the six-apostrophe
12562 # construct is clearly pathological and the result stated here (which is what
12563 # the parser actually does) is about as reasonable as anything.
12564 !!test
12565 Mixing markup for italics and bold
12566 !! options
12567 !! input
12568 '''bold''''''bold''bolditalics'''''
12569 !! result
12570 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
12571 </p>
12572 !! end
12573
12574
12575 !! article
12576 Xyzzyx
12577 !! text
12578 Article for special page transclusion test
12579 !! endarticle
12580
12581 !! test
12582 Special page transclusion
12583 !! options
12584 !! input
12585 {{Special:Prefixindex/Xyzzyx}}
12586 !! result
12587 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12588
12589 !! end
12590
12591 !! test
12592 Special page transclusion twice (bug 5021)
12593 !! options
12594 !! input
12595 {{Special:Prefixindex/Xyzzyx}}
12596 {{Special:Prefixindex/Xyzzyx}}
12597 !! result
12598 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12599 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
12600
12601 !! end
12602
12603 !! test
12604 Transclusion of default MediaWiki message
12605 !! input
12606 {{MediaWiki:Mainpage}}
12607 !!result
12608 <p>Main Page
12609 </p>
12610 !! end
12611
12612 !! test
12613 Transclusion of nonexistent MediaWiki message
12614 !! input
12615 {{MediaWiki:Mainpagexxx}}
12616 !!result
12617 <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>
12618 </p>
12619 !! end
12620
12621 !! test
12622 Transclusion of MediaWiki message with underscore
12623 !! input
12624 {{MediaWiki:history_short}}
12625 !! result
12626 <p>History
12627 </p>
12628 !! end
12629
12630 !! test
12631 Transclusion of MediaWiki message with space
12632 !! input
12633 {{MediaWiki:history short}}
12634 !! result
12635 <p>History
12636 </p>
12637 !! end
12638
12639 !! test
12640 Invalid header with following text
12641 !! input
12642 = x = y
12643 !! result
12644 <p>= x = y
12645 </p>
12646 !! end
12647
12648
12649 !! test
12650 Section extraction test (section 0)
12651 !! options
12652 section=0
12653 !! input
12654 start
12655 ==a==
12656 ===aa===
12657 ====aaa====
12658 ==b==
12659 ===ba===
12660 ===bb===
12661 ====bba====
12662 ===bc===
12663 ==c==
12664 ===ca===
12665 !! result
12666 start
12667 !! end
12668
12669 !! test
12670 Section extraction test (section 1)
12671 !! options
12672 section=1
12673 !! input
12674 start
12675 ==a==
12676 ===aa===
12677 ====aaa====
12678 ==b==
12679 ===ba===
12680 ===bb===
12681 ====bba====
12682 ===bc===
12683 ==c==
12684 ===ca===
12685 !! result
12686 ==a==
12687 ===aa===
12688 ====aaa====
12689 !! end
12690
12691 !! test
12692 Section extraction test (section 2)
12693 !! options
12694 section=2
12695 !! input
12696 start
12697 ==a==
12698 ===aa===
12699 ====aaa====
12700 ==b==
12701 ===ba===
12702 ===bb===
12703 ====bba====
12704 ===bc===
12705 ==c==
12706 ===ca===
12707 !! result
12708 ===aa===
12709 ====aaa====
12710 !! end
12711
12712 !! test
12713 Section extraction test (section 3)
12714 !! options
12715 section=3
12716 !! input
12717 start
12718 ==a==
12719 ===aa===
12720 ====aaa====
12721 ==b==
12722 ===ba===
12723 ===bb===
12724 ====bba====
12725 ===bc===
12726 ==c==
12727 ===ca===
12728 !! result
12729 ====aaa====
12730 !! end
12731
12732 !! test
12733 Section extraction test (section 4)
12734 !! options
12735 section=4
12736 !! input
12737 start
12738 ==a==
12739 ===aa===
12740 ====aaa====
12741 ==b==
12742 ===ba===
12743 ===bb===
12744 ====bba====
12745 ===bc===
12746 ==c==
12747 ===ca===
12748 !! result
12749 ==b==
12750 ===ba===
12751 ===bb===
12752 ====bba====
12753 ===bc===
12754 !! end
12755
12756 !! test
12757 Section extraction test (section 5)
12758 !! options
12759 section=5
12760 !! input
12761 start
12762 ==a==
12763 ===aa===
12764 ====aaa====
12765 ==b==
12766 ===ba===
12767 ===bb===
12768 ====bba====
12769 ===bc===
12770 ==c==
12771 ===ca===
12772 !! result
12773 ===ba===
12774 !! end
12775
12776 !! test
12777 Section extraction test (section 6)
12778 !! options
12779 section=6
12780 !! input
12781 start
12782 ==a==
12783 ===aa===
12784 ====aaa====
12785 ==b==
12786 ===ba===
12787 ===bb===
12788 ====bba====
12789 ===bc===
12790 ==c==
12791 ===ca===
12792 !! result
12793 ===bb===
12794 ====bba====
12795 !! end
12796
12797 !! test
12798 Section extraction test (section 7)
12799 !! options
12800 section=7
12801 !! input
12802 start
12803 ==a==
12804 ===aa===
12805 ====aaa====
12806 ==b==
12807 ===ba===
12808 ===bb===
12809 ====bba====
12810 ===bc===
12811 ==c==
12812 ===ca===
12813 !! result
12814 ====bba====
12815 !! end
12816
12817 !! test
12818 Section extraction test (section 8)
12819 !! options
12820 section=8
12821 !! input
12822 start
12823 ==a==
12824 ===aa===
12825 ====aaa====
12826 ==b==
12827 ===ba===
12828 ===bb===
12829 ====bba====
12830 ===bc===
12831 ==c==
12832 ===ca===
12833 !! result
12834 ===bc===
12835 !! end
12836
12837 !! test
12838 Section extraction test (section 9)
12839 !! options
12840 section=9
12841 !! input
12842 start
12843 ==a==
12844 ===aa===
12845 ====aaa====
12846 ==b==
12847 ===ba===
12848 ===bb===
12849 ====bba====
12850 ===bc===
12851 ==c==
12852 ===ca===
12853 !! result
12854 ==c==
12855 ===ca===
12856 !! end
12857
12858 !! test
12859 Section extraction test (section 10)
12860 !! options
12861 section=10
12862 !! input
12863 start
12864 ==a==
12865 ===aa===
12866 ====aaa====
12867 ==b==
12868 ===ba===
12869 ===bb===
12870 ====bba====
12871 ===bc===
12872 ==c==
12873 ===ca===
12874 !! result
12875 ===ca===
12876 !! end
12877
12878 !! test
12879 Section extraction test (nonexistent section 11)
12880 !! options
12881 section=11
12882 !! input
12883 start
12884 ==a==
12885 ===aa===
12886 ====aaa====
12887 ==b==
12888 ===ba===
12889 ===bb===
12890 ====bba====
12891 ===bc===
12892 ==c==
12893 ===ca===
12894 !! result
12895 !! end
12896
12897 !! test
12898 Section extraction test with bogus heading (section 1)
12899 !! options
12900 section=1
12901 !! input
12902 ==a==
12903 ==bogus== not a legal section
12904 ==b==
12905 !! result
12906 ==a==
12907 ==bogus== not a legal section
12908 !! end
12909
12910 !! test
12911 Section extraction test with bogus heading (section 2)
12912 !! options
12913 section=2
12914 !! input
12915 ==a==
12916 ==bogus== not a legal section
12917 ==b==
12918 !! result
12919 ==b==
12920 !! end
12921
12922 !! test
12923 Section extraction test with comment after heading (section 1)
12924 !! options
12925 section=1
12926 !! input
12927 ==a==
12928 ==b== <!-- -->
12929 ==c==
12930 !! result
12931 ==a==
12932 !! end
12933
12934 !! test
12935 Section extraction test with comment after heading (section 2)
12936 !! options
12937 section=2
12938 !! input
12939 ==a==
12940 ==b== <!-- -->
12941 ==c==
12942 !! result
12943 ==b== <!-- -->
12944 !! end
12945
12946 !! test
12947 Section extraction test with bogus <nowiki> heading (section 1)
12948 !! options
12949 section=1
12950 !! input
12951 ==a==
12952 ==bogus== <nowiki>not a legal section</nowiki>
12953 ==b==
12954 !! result
12955 ==a==
12956 ==bogus== <nowiki>not a legal section</nowiki>
12957 !! end
12958
12959 !! test
12960 Section extraction test with bogus <nowiki> heading (section 2)
12961 !! options
12962 section=2
12963 !! input
12964 ==a==
12965 ==bogus== <nowiki>not a legal section</nowiki>
12966 ==b==
12967 !! result
12968 ==b==
12969 !! end
12970
12971
12972 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
12973 # instead of respecting commented sections
12974 !! test
12975 Section extraction prefixed by comment (section 1)
12976 !! options
12977 section=1
12978 !! input
12979 <!-- -->==sec1==
12980 ==sec2==
12981 !!result
12982 ==sec2==
12983 !!end
12984
12985 !! test
12986 Section extraction prefixed by comment (section 2)
12987 !! options
12988 section=2
12989 !! input
12990 <!-- -->==sec1==
12991 ==sec2==
12992 !!result
12993
12994 !!end
12995
12996
12997 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
12998 # instead of respecting HTML-style headings
12999 !! test
13000 Section extraction, mixed wiki and html (section 1)
13001 !! options
13002 section=1
13003 !! input
13004 <h2>unmarked</h2>
13005 unmarked
13006 ==1==
13007 one
13008 ==2==
13009 two
13010 !! result
13011 ==1==
13012 one
13013 !! end
13014
13015 !! test
13016 Section extraction, mixed wiki and html (section 2)
13017 !! options
13018 section=2
13019 !! input
13020 <h2>unmarked</h2>
13021 unmarked
13022 ==1==
13023 one
13024 ==2==
13025 two
13026 !! result
13027 ==2==
13028 two
13029 !! end
13030
13031
13032 # Formerly testing for bug 3342
13033 !! test
13034 Section extraction, heading surrounded by <noinclude>
13035 !! options
13036 section=1
13037 !! input
13038 <noinclude>==unmarked==</noinclude>
13039 ==marked==
13040 !! result
13041 ==marked==
13042 !!end
13043
13044 # Test behavior of bug 19910
13045 !! test
13046 Sectiion with all-equals
13047 !! options
13048 section=2
13049 !! input
13050 ===
13051 The line above must have a trailing space
13052 === <!--
13053 --> <!-- -->
13054 But just in case it doesn't...
13055 !! result
13056 === <!--
13057 --> <!-- -->
13058 But just in case it doesn't...
13059 !! end
13060
13061 !! test
13062 Section replacement test (section 0)
13063 !! options
13064 replace=0,"xxx"
13065 !! input
13066 start
13067 ==a==
13068 ===aa===
13069 ====aaa====
13070 ==b==
13071 ===ba===
13072 ===bb===
13073 ====bba====
13074 ===bc===
13075 ==c==
13076 ===ca===
13077 !! result
13078 xxx
13079
13080 ==a==
13081 ===aa===
13082 ====aaa====
13083 ==b==
13084 ===ba===
13085 ===bb===
13086 ====bba====
13087 ===bc===
13088 ==c==
13089 ===ca===
13090 !! end
13091
13092 !! test
13093 Section replacement test (section 1)
13094 !! options
13095 replace=1,"xxx"
13096 !! input
13097 start
13098 ==a==
13099 ===aa===
13100 ====aaa====
13101 ==b==
13102 ===ba===
13103 ===bb===
13104 ====bba====
13105 ===bc===
13106 ==c==
13107 ===ca===
13108 !! result
13109 start
13110 xxx
13111
13112 ==b==
13113 ===ba===
13114 ===bb===
13115 ====bba====
13116 ===bc===
13117 ==c==
13118 ===ca===
13119 !! end
13120
13121 !! test
13122 Section replacement test (section 2)
13123 !! options
13124 replace=2,"xxx"
13125 !! input
13126 start
13127 ==a==
13128 ===aa===
13129 ====aaa====
13130 ==b==
13131 ===ba===
13132 ===bb===
13133 ====bba====
13134 ===bc===
13135 ==c==
13136 ===ca===
13137 !! result
13138 start
13139 ==a==
13140 xxx
13141
13142 ==b==
13143 ===ba===
13144 ===bb===
13145 ====bba====
13146 ===bc===
13147 ==c==
13148 ===ca===
13149 !! end
13150
13151 !! test
13152 Section replacement test (section 3)
13153 !! options
13154 replace=3,"xxx"
13155 !! input
13156 start
13157 ==a==
13158 ===aa===
13159 ====aaa====
13160 ==b==
13161 ===ba===
13162 ===bb===
13163 ====bba====
13164 ===bc===
13165 ==c==
13166 ===ca===
13167 !! result
13168 start
13169 ==a==
13170 ===aa===
13171 xxx
13172
13173 ==b==
13174 ===ba===
13175 ===bb===
13176 ====bba====
13177 ===bc===
13178 ==c==
13179 ===ca===
13180 !! end
13181
13182 !! test
13183 Section replacement test (section 4)
13184 !! options
13185 replace=4,"xxx"
13186 !! input
13187 start
13188 ==a==
13189 ===aa===
13190 ====aaa====
13191 ==b==
13192 ===ba===
13193 ===bb===
13194 ====bba====
13195 ===bc===
13196 ==c==
13197 ===ca===
13198 !! result
13199 start
13200 ==a==
13201 ===aa===
13202 ====aaa====
13203 xxx
13204
13205 ==c==
13206 ===ca===
13207 !! end
13208
13209 !! test
13210 Section replacement test (section 5)
13211 !! options
13212 replace=5,"xxx"
13213 !! input
13214 start
13215 ==a==
13216 ===aa===
13217 ====aaa====
13218 ==b==
13219 ===ba===
13220 ===bb===
13221 ====bba====
13222 ===bc===
13223 ==c==
13224 ===ca===
13225 !! result
13226 start
13227 ==a==
13228 ===aa===
13229 ====aaa====
13230 ==b==
13231 xxx
13232
13233 ===bb===
13234 ====bba====
13235 ===bc===
13236 ==c==
13237 ===ca===
13238 !! end
13239
13240 !! test
13241 Section replacement test (section 6)
13242 !! options
13243 replace=6,"xxx"
13244 !! input
13245 start
13246 ==a==
13247 ===aa===
13248 ====aaa====
13249 ==b==
13250 ===ba===
13251 ===bb===
13252 ====bba====
13253 ===bc===
13254 ==c==
13255 ===ca===
13256 !! result
13257 start
13258 ==a==
13259 ===aa===
13260 ====aaa====
13261 ==b==
13262 ===ba===
13263 xxx
13264
13265 ===bc===
13266 ==c==
13267 ===ca===
13268 !! end
13269
13270 !! test
13271 Section replacement test (section 7)
13272 !! options
13273 replace=7,"xxx"
13274 !! input
13275 start
13276 ==a==
13277 ===aa===
13278 ====aaa====
13279 ==b==
13280 ===ba===
13281 ===bb===
13282 ====bba====
13283 ===bc===
13284 ==c==
13285 ===ca===
13286 !! result
13287 start
13288 ==a==
13289 ===aa===
13290 ====aaa====
13291 ==b==
13292 ===ba===
13293 ===bb===
13294 xxx
13295
13296 ===bc===
13297 ==c==
13298 ===ca===
13299 !! end
13300
13301 !! test
13302 Section replacement test (section 8)
13303 !! options
13304 replace=8,"xxx"
13305 !! input
13306 start
13307 ==a==
13308 ===aa===
13309 ====aaa====
13310 ==b==
13311 ===ba===
13312 ===bb===
13313 ====bba====
13314 ===bc===
13315 ==c==
13316 ===ca===
13317 !! result
13318 start
13319 ==a==
13320 ===aa===
13321 ====aaa====
13322 ==b==
13323 ===ba===
13324 ===bb===
13325 ====bba====
13326 xxx
13327
13328 ==c==
13329 ===ca===
13330 !!end
13331
13332 !! test
13333 Section replacement test (section 9)
13334 !! options
13335 replace=9,"xxx"
13336 !! input
13337 start
13338 ==a==
13339 ===aa===
13340 ====aaa====
13341 ==b==
13342 ===ba===
13343 ===bb===
13344 ====bba====
13345 ===bc===
13346 ==c==
13347 ===ca===
13348 !! result
13349 start
13350 ==a==
13351 ===aa===
13352 ====aaa====
13353 ==b==
13354 ===ba===
13355 ===bb===
13356 ====bba====
13357 ===bc===
13358 xxx
13359 !! end
13360
13361 !! test
13362 Section replacement test (section 10)
13363 !! options
13364 replace=10,"xxx"
13365 !! input
13366 start
13367 ==a==
13368 ===aa===
13369 ====aaa====
13370 ==b==
13371 ===ba===
13372 ===bb===
13373 ====bba====
13374 ===bc===
13375 ==c==
13376 ===ca===
13377 !! result
13378 start
13379 ==a==
13380 ===aa===
13381 ====aaa====
13382 ==b==
13383 ===ba===
13384 ===bb===
13385 ====bba====
13386 ===bc===
13387 ==c==
13388 xxx
13389 !! end
13390
13391 !! test
13392 Section replacement test with initial whitespace (bug 13728)
13393 !! options
13394 replace=2,"xxx"
13395 !! input
13396 Preformatted initial line
13397 ==a==
13398 ===a===
13399 !! result
13400 Preformatted initial line
13401 ==a==
13402 xxx
13403 !! end
13404
13405
13406 !! test
13407 Section extraction, heading followed by pre with 20 spaces (bug 6398)
13408 !! options
13409 section=1
13410 !! input
13411 ==a==
13412 a
13413 !! result
13414 ==a==
13415 a
13416 !! end
13417
13418 !! test
13419 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
13420 !! options
13421 section=1
13422 !! input
13423 ==a==
13424 a
13425 !! result
13426 ==a==
13427 a
13428 !! end
13429
13430
13431 !! test
13432 Section extraction, <pre> around bogus header (bug 10309)
13433 !! options
13434 noxml section=2
13435 !! input
13436 == Section One ==
13437 <pre>
13438 =======
13439 </pre>
13440
13441 == Section Two ==
13442 stuff
13443 !! result
13444 == Section Two ==
13445 stuff
13446 !! end
13447
13448 !! test
13449 Section replacement, <pre> around bogus header (bug 10309)
13450 !! options
13451 noxml replace=2,"xxx"
13452 !! input
13453 == Section One ==
13454 <pre>
13455 =======
13456 </pre>
13457
13458 == Section Two ==
13459 stuff
13460 !! result
13461 == Section One ==
13462 <pre>
13463 =======
13464 </pre>
13465
13466 xxx
13467 !! end
13468
13469
13470
13471 !! test
13472 Handling of &#x0A; in URLs
13473 !! input
13474 **irc://&#x0A;a
13475 !! result
13476 <ul>
13477 <li><ul>
13478 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
13479 </li>
13480 </ul>
13481 </li>
13482 </ul>
13483
13484 !!end
13485
13486 !! test
13487 5 quotes, code coverage +1 line (php)
13488 !! options
13489 php
13490 !! input
13491 '''''
13492 !! result
13493 !! end
13494 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
13495 !! test
13496 5 quotes, code coverage +1 line (parsoid)
13497 !! options
13498 parsoid
13499 !! input
13500 '''''
13501 !! result
13502 <p><b><i></i></b></p>
13503 !! end
13504
13505 !! test
13506 Special:Search page linking.
13507 !! input
13508 {{Special:search}}
13509 !! result
13510 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
13511 </p>
13512 !! end
13513
13514 !! test
13515 Say the magic word
13516 !! options
13517 title=[[Parser test]]
13518 !! input
13519 * {{PAGENAME}}
13520 * {{PAGENAMEE}}
13521 * {{FULLPAGENAME}}
13522 * {{FULLPAGENAMEE}}
13523 * {{BASEPAGENAME}}
13524 * {{BASEPAGENAMEE}}
13525 * {{SUBPAGENAME}}
13526 * {{SUBPAGENAMEE}}
13527 * {{ROOTPAGENAME}}
13528 * {{ROOTPAGENAMEE}}
13529 * {{TALKPAGENAME}}
13530 * {{TALKPAGENAMEE}}
13531 * {{SUBJECTPAGENAME}}
13532 * {{SUBJECTPAGENAMEE}}
13533 * {{NAMESPACEE}}
13534 * {{NAMESPACE}}
13535 * {{NAMESPACENUMBER}}
13536 * {{TALKSPACE}}
13537 * {{TALKSPACEE}}
13538 * {{SUBJECTSPACE}}
13539 * {{SUBJECTSPACEE}}
13540 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
13541 !! result
13542 <ul>
13543 <li> Parser test
13544 </li>
13545 <li> Parser_test
13546 </li>
13547 <li> Parser test
13548 </li>
13549 <li> Parser_test
13550 </li>
13551 <li> Parser test
13552 </li>
13553 <li> Parser_test
13554 </li>
13555 <li> Parser test
13556 </li>
13557 <li> Parser_test
13558 </li>
13559 <li> Parser test
13560 </li>
13561 <li> Parser_test
13562 </li>
13563 <li> Talk:Parser test
13564 </li>
13565 <li> Talk:Parser_test
13566 </li>
13567 <li> Parser test
13568 </li>
13569 <li> Parser_test
13570 </li>
13571 <li>
13572 </li>
13573 <li>
13574 </li>
13575 <li> 0
13576 </li>
13577 <li> Talk
13578 </li>
13579 <li> Talk
13580 </li>
13581 <li>
13582 </li>
13583 <li>
13584 </li>
13585 <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>
13586 </li>
13587 </ul>
13588
13589 !! end
13590 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
13591
13592 !! test
13593 Gallery
13594 !! input
13595 <gallery>
13596 image1.png |
13597 image2.gif|||||
13598
13599 image3|
13600 image4 |300px| centre
13601 image5.svg| http://///////
13602 [[x|xx]]]]
13603 * image6
13604 </gallery>
13605 !! result
13606 <ul class="gallery mw-gallery-traditional">
13607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13608 <div class="thumb" style="height: 150px;">Image1.png</div>
13609 <div class="gallerytext">
13610 </div>
13611 </div></li>
13612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13613 <div class="thumb" style="height: 150px;">Image2.gif</div>
13614 <div class="gallerytext">
13615 <p>||||
13616 </p>
13617 </div>
13618 </div></li>
13619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13620 <div class="thumb" style="height: 150px;">Image3</div>
13621 <div class="gallerytext">
13622 </div>
13623 </div></li>
13624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13625 <div class="thumb" style="height: 150px;">Image4</div>
13626 <div class="gallerytext">
13627 <p>300px| centre
13628 </p>
13629 </div>
13630 </div></li>
13631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13632 <div class="thumb" style="height: 150px;">Image5.svg</div>
13633 <div class="gallerytext">
13634 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
13635 </p>
13636 </div>
13637 </div></li>
13638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13639 <div class="thumb" style="height: 150px;">* image6</div>
13640 <div class="gallerytext">
13641 </div>
13642 </div></li>
13643 </ul>
13644
13645 !! end
13646
13647 !! test
13648 Gallery (with options)
13649 !! input
13650 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
13651 File:Nonexistant.jpg|caption
13652 File:Nonexistant.jpg
13653 image:foobar.jpg|some '''caption''' [[Main Page]]
13654 image:foobar.jpg
13655 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
13656 </gallery>
13657 !! result
13658 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
13659 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
13660 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13661 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13662 <div class="gallerytext">
13663 <p>caption
13664 </p>
13665 </div>
13666 </div></li>
13667 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13668 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
13669 <div class="gallerytext">
13670 </div>
13671 </div></li>
13672 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13673 <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>
13674 <div class="gallerytext">
13675 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13676 </p>
13677 </div>
13678 </div></li>
13679 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13680 <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>
13681 <div class="gallerytext">
13682 </div>
13683 </div></li>
13684 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
13685 <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>
13686 <div class="gallerytext">
13687 <p>Blabla|blabla.
13688 </p>
13689 </div>
13690 </div></li>
13691 </ul>
13692
13693 !! end
13694
13695 !! test
13696 Gallery with wikitext inside caption
13697 !! input
13698 <gallery>
13699 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
13700 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
13701 </gallery>
13702 !! result
13703 <ul class="gallery mw-gallery-traditional">
13704 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13705 <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>
13706 <div class="gallerytext">
13707 <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>
13708 </p>
13709 </div>
13710 </div></li>
13711 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13712 <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>
13713 <div class="gallerytext">
13714 <p>This is a test template
13715 </p>
13716 </div>
13717 </div></li>
13718 </ul>
13719
13720 !! end
13721
13722 !! test
13723 gallery (with showfilename option)
13724 !! input
13725 <gallery showfilename>
13726 File:Nonexistant.jpg|caption
13727 File:Nonexistant.jpg
13728 image:foobar.jpg|some '''caption''' [[Main Page]]
13729 File:Foobar.jpg
13730 </gallery>
13731 !! result
13732 <ul class="gallery mw-gallery-traditional">
13733 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13734 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13735 <div class="gallerytext">
13736 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13737 caption
13738 </p>
13739 </div>
13740 </div></li>
13741 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13742 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13743 <div class="gallerytext">
13744 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
13745 </p>
13746 </div>
13747 </div></li>
13748 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13749 <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>
13750 <div class="gallerytext">
13751 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13752 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13753 </p>
13754 </div>
13755 </div></li>
13756 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13757 <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>
13758 <div class="gallerytext">
13759 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
13760 </p>
13761 </div>
13762 </div></li>
13763 </ul>
13764
13765 !! end
13766
13767 !! test
13768 Gallery (with namespace-less filenames)
13769 !! input
13770 <gallery>
13771 File:Nonexistant.jpg
13772 Nonexistant.jpg
13773 image:foobar.jpg
13774 foobar.jpg
13775 </gallery>
13776 !! result
13777 <ul class="gallery mw-gallery-traditional">
13778 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13779 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13780 <div class="gallerytext">
13781 </div>
13782 </div></li>
13783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13784 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
13785 <div class="gallerytext">
13786 </div>
13787 </div></li>
13788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13789 <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>
13790 <div class="gallerytext">
13791 </div>
13792 </div></li>
13793 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13794 <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>
13795 <div class="gallerytext">
13796 </div>
13797 </div></li>
13798 </ul>
13799
13800 !! end
13801
13802 !! test
13803 HTML Hex character encoding (spells the word "JavaScript")
13804 !! input
13805 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
13806 !! result
13807 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
13808 </p>
13809 !! end
13810
13811 !! test
13812 HTML Hex character encoding bogus encoding (bug 26437 regression check)
13813 !! input
13814 &#xsee;&#XSEE;
13815 !! result
13816 <p>&amp;#xsee;&amp;#XSEE;
13817 </p>
13818 !! end
13819
13820 !! test
13821 HTML Hex character encoding mixed case
13822 !! input
13823 &#xEE;&#Xee;
13824 !! result
13825 <p>&#xee;&#xee;
13826 </p>
13827 !! end
13828
13829 !! test
13830 __FORCETOC__ override
13831 !! input
13832 __NEWSECTIONLINK__
13833 __FORCETOC__
13834 !! result
13835 <p><br />
13836 </p>
13837 !! end
13838
13839 !! test
13840 ISBN code coverage
13841 !! input
13842 ISBN 978-0-1234-56&#x20;789
13843 !! result
13844 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
13845 </p>
13846 !! end
13847
13848 !! test
13849 ISBN followed by 5 spaces
13850 !! input
13851 ISBN
13852 !! result
13853 <p>ISBN
13854 </p>
13855 !! end
13856
13857 !! test
13858 Double ISBN
13859 !! input
13860 ISBN ISBN 1234567890
13861 !! result
13862 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
13863 </p>
13864 !! end
13865
13866 !! test
13867 Bug 22905: <abbr> followed by ISBN followed by </a>
13868 !! input
13869 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
13870 !! result
13871 <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>
13872 </p>
13873 !! end
13874
13875 !! test
13876 Double RFC
13877 !! input
13878 RFC RFC 1234
13879 !! result
13880 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
13881 </p>
13882 !! end
13883
13884 !! test
13885 Double RFC with a wiki link
13886 !! input
13887 RFC [[RFC 1234]]
13888 !! result
13889 <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>
13890 </p>
13891 !! end
13892
13893 !! test
13894 RFC code coverage
13895 !! input
13896 RFC 983&#x20;987
13897 !! result
13898 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
13899 </p>
13900 !! end
13901
13902 !! test
13903 Centre-aligned image
13904 !! input
13905 [[Image:foobar.jpg|centre]]
13906 !! result
13907 <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>
13908
13909 !!end
13910
13911 !! test
13912 None-aligned image
13913 !! input
13914 [[Image:foobar.jpg|none]]
13915 !! result
13916 <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>
13917
13918 !!end
13919
13920 !! test
13921 Width + Height sized image (using px) (height is ignored)
13922 !! input
13923 [[Image:foobar.jpg|640x480px]]
13924 !! result
13925 <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>
13926 </p>
13927 !!end
13928
13929 !! test
13930 Width-sized image (using px, no following whitespace)
13931 !! input
13932 [[Image:foobar.jpg|640px]]
13933 !! result
13934 <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>
13935 </p>
13936 !!end
13937
13938 !! test
13939 Width-sized image (using px, with following whitespace - test regression from r39467)
13940 !! input
13941 [[Image:foobar.jpg|640px ]]
13942 !! result
13943 <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>
13944 </p>
13945 !!end
13946
13947 !! test
13948 Width-sized image (using px, with preceding whitespace - test regression from r39467)
13949 !! input
13950 [[Image:foobar.jpg| 640px]]
13951 !! result
13952 <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>
13953 </p>
13954 !!end
13955
13956 !! test
13957 Another italics / bold test
13958 !! input
13959 ''' ''x'
13960 !! result
13961 <pre>'<i> </i>x'
13962 </pre>
13963 !!end
13964
13965 # Note the results may be incorrect, as parserTest output included this:
13966 # XML error: Mismatched tag at byte 6120:
13967 # ...<dd> </dt></dl> </dd...
13968 !! test
13969 dt/dd/dl test
13970 !! options
13971 disabled
13972 !! input
13973 :;;;::
13974 !! result
13975 <dl>
13976 <dd><dl>
13977 <dt><dl>
13978 <dt><dl>
13979 <dt><dl>
13980 <dd><dl>
13981 <dd>
13982 </dd>
13983 </dl>
13984 </dd>
13985 </dl>
13986 </dt>
13987 </dl>
13988 </dt>
13989 </dl>
13990 </dt>
13991 </dl>
13992 </dd>
13993 </dl>
13994
13995 !!end
13996
13997
13998 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
13999 !! test
14000 Images with the "|" character in the comment
14001 !! input
14002 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
14003 !! result
14004 <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>
14005
14006 !!end
14007
14008 !! test
14009 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
14010 !! input
14011 <html><script>alert(1);</script></html>
14012 !! result
14013 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
14014 </p>
14015 !! end
14016
14017 !! test
14018 HTML with raw HTML ($wgRawHtml==true)
14019 !! options
14020 wgRawHtml=1
14021 !! input
14022 <html><script>alert(1);</script></html>
14023 !! result
14024 <p><script>alert(1);</script>
14025 </p>
14026 !! end
14027
14028 !! test
14029 Parents of subpages, one level up
14030 !! options
14031 subpage title=[[Subpage test/L1/L2/L3]]
14032 !! input
14033 [[../|L2]]
14034 !! result
14035 <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>
14036 </p>
14037 !! end
14038
14039
14040 !! test
14041 Parents of subpages, one level up, not named
14042 !! options
14043 subpage title=[[Subpage test/L1/L2/L3]]
14044 !! input
14045 [[../]]
14046 !! result
14047 <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>
14048 </p>
14049 !! end
14050
14051
14052
14053 !! test
14054 Parents of subpages, two levels up
14055 !! options
14056 subpage title=[[Subpage test/L1/L2/L3]]
14057 !! input
14058 [[../../|L1]]2
14059
14060 [[../../|L1]]l
14061 !! result
14062 <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
14063 </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>
14064 </p>
14065 !! end
14066
14067 !! test
14068 Parents of subpages, two levels up, without trailing slash or name.
14069 !! options
14070 subpage title=[[Subpage test/L1/L2/L3]]
14071 !! input
14072 [[../..]]
14073 !! result
14074 <p>[[../..]]
14075 </p>
14076 !! end
14077
14078 !! test
14079 Parents of subpages, two levels up, with lots of extra trailing slashes.
14080 !! options
14081 subpage title=[[Subpage test/L1/L2/L3]]
14082 !! input
14083 [[../../////]]
14084 !! result
14085 <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>
14086 </p>
14087 !! end
14088
14089 !! article
14090 Subpage test/L1/L2/L3Sibling
14091 !! text
14092 Sibling article
14093 !! endarticle
14094
14095 !! test
14096 Transclusion of a sibling page (one level up)
14097 !! options
14098 subpage title=[[Subpage test/L1/L2/L3]]
14099 !! input
14100 {{../L3Sibling}}
14101 !! result
14102 <p>Sibling article
14103 </p>
14104 !! end
14105
14106 !! test
14107 Transclusion of a child page
14108 !! options
14109 subpage title=[[Subpage test/L1/L2]]
14110 !! input
14111 {{/L3Sibling}}
14112 !! result
14113 <p>Sibling article
14114 </p>
14115 !! end
14116
14117 !! test
14118 Non-transclusion because of too many up levels
14119 !! options
14120 subpage title=[[Subpage test/L1/L2/L3]]
14121 !! input
14122 {{../../../../More than parent}}
14123 !! result
14124 <p>{{../../../../More than parent}}
14125 </p>
14126 !! end
14127
14128 !! test
14129 Definition list code coverage
14130 !! input
14131 ; title : def
14132 ; title : def
14133 ;title: def
14134 !! result
14135 <dl>
14136 <dt> title &#160;</dt>
14137 <dd> def
14138 </dd>
14139 <dt> title&#160;</dt>
14140 <dd> def
14141 </dd>
14142 <dt>title</dt>
14143 <dd> def
14144 </dd>
14145 </dl>
14146
14147 !! end
14148
14149 !! test
14150 Don't fall for the self-closing div
14151 !! input
14152 <div>hello world</div/>
14153 !! result
14154 <div>hello world</div>
14155
14156 !! end
14157
14158 !! test
14159 MSGNW magic word
14160 !! input
14161 {{MSGNW:msg}}
14162 !! result
14163 <p>&#91;&#91;:Template:Msg&#93;&#93;
14164 </p>
14165 !! end
14166
14167 !! test
14168 RAW magic word
14169 !! input
14170 {{RAW:QUERTY}}
14171 !! result
14172 <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>
14173 </p>
14174 !! end
14175
14176 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
14177 !! test
14178 Always escape literal '>' in output, not just after '<'
14179 !! input
14180 ><>
14181 !! result
14182 <p>&gt;&lt;&gt;
14183 </p>
14184 !! end
14185
14186 !! test
14187 Template caching
14188 !! input
14189 {{Test}}
14190 {{Test}}
14191 !! result
14192 <p>This is a test template
14193 This is a test template
14194 </p>
14195 !! end
14196
14197
14198 !! article
14199 MediaWiki:Fake
14200 !! text
14201 ==header==
14202 !! endarticle
14203
14204 !! test
14205 Inclusion of !userCanEdit() content
14206 !! input
14207 {{MediaWiki:Fake}}
14208 !! result
14209 <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>
14210
14211 !! end
14212
14213
14214 !! test
14215 Out-of-order TOC heading levels
14216 !! input
14217 ==2==
14218 ======6======
14219 ===3===
14220 =1=
14221 =====5=====
14222 ==2==
14223 !! result
14224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14225 <ul>
14226 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
14227 <ul>
14228 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
14229 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
14230 </ul>
14231 </li>
14232 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
14233 <ul>
14234 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
14235 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
14236 </ul>
14237 </li>
14238 </ul>
14239 </div>
14240
14241 <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>
14242 <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>
14243 <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>
14244 <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>
14245 <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>
14246 <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>
14247
14248 !! end
14249
14250
14251 !! test
14252 ISBN with a dummy number
14253 !! input
14254 ISBN ---
14255 !! result
14256 <p>ISBN ---
14257 </p>
14258 !! end
14259
14260
14261 !! test
14262 ISBN with space-delimited number
14263 !! input
14264 ISBN 92 9017 032 8
14265 !! result
14266 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
14267 </p>
14268 !! end
14269
14270
14271 !! test
14272 ISBN with multiple spaces, no number
14273 !! input
14274 ISBN foo
14275 !! result
14276 <p>ISBN foo
14277 </p>
14278 !! end
14279
14280
14281 !! test
14282 ISBN length
14283 !! input
14284 ISBN 123456789
14285
14286 ISBN 1234567890
14287
14288 ISBN 12345678901
14289 !! result
14290 <p>ISBN 123456789
14291 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14292 </p><p>ISBN 12345678901
14293 </p>
14294 !! end
14295
14296
14297 !! test
14298 ISBN with trailing year (bug 8110)
14299 !! input
14300 ISBN 1-234-56789-0 - 2006
14301
14302 ISBN 1 234 56789 0 - 2006
14303 !! result
14304 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
14305 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
14306 </p>
14307 !! end
14308
14309
14310 !! test
14311 anchorencode
14312 !! input
14313 {{anchorencode:foo bar©#%n}}
14314 !! result
14315 <p>foo_bar.C2.A9.23.25n
14316 </p>
14317 !! end
14318
14319 !! test
14320 anchorencode trims spaces
14321 !! input
14322 {{anchorencode: __pretty__please__}}
14323 !! result
14324 <p>pretty_please
14325 </p>
14326 !! end
14327
14328 !! test
14329 anchorencode deals with links
14330 !! input
14331 {{anchorencode: [[hello|world]] [[hi]]}}
14332 !! result
14333 <p>world_hi
14334 </p>
14335 !! end
14336
14337 !! test
14338 anchorencode deals with templates
14339 !! input
14340 {{anchorencode: {{Foo}} }}
14341 !! result
14342 <p>FOO
14343 </p>
14344 !! end
14345
14346 !! test
14347 anchorencode encodes like the TOC generator: (bug 18431)
14348 !! input
14349 === _ +:.3A%3A&&amp;]] ===
14350 {{anchorencode: _ +:.3A%3A&&amp;]] }}
14351 __NOEDITSECTION__
14352 !! result
14353 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
14354 <p>.2B:.3A.253A.26.26.5D.5D
14355 </p>
14356 !! end
14357
14358 !! test
14359 Bug 6200: blockquotes and paragraph formatting
14360 !! input
14361 <blockquote>
14362 foo
14363 </blockquote>
14364
14365 bar
14366
14367 baz
14368 !! result
14369 <blockquote>
14370 <p>foo
14371 </p>
14372 </blockquote>
14373 <p>bar
14374 </p>
14375 <pre>baz
14376 </pre>
14377 !! end
14378
14379 !! test
14380 Bug 8293: Use of center tag ruins paragraph formatting
14381 !! input
14382 <center>
14383 foo
14384 </center>
14385
14386 bar
14387
14388 baz
14389 !! result
14390 <center>
14391 <p>foo
14392 </p>
14393 </center>
14394 <p>bar
14395 </p>
14396 <pre>baz
14397 </pre>
14398 !! end
14399
14400 !!test
14401 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
14402 !!options
14403 php
14404 !!input
14405 <span><s>x</span></s>
14406 !!result
14407 <p><span><s>x&lt;/span&gt;</s></span>
14408 </p>
14409 !!end
14410
14411 !!test
14412 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
14413 !!options
14414 parsoid
14415 !!input
14416 <span><s>x</span></s>
14417 !!result
14418 <p><span><s>x</s></span><s></s>
14419 </p>
14420 !!end
14421
14422 ###
14423 ### Language variants related tests
14424 ###
14425 !! test
14426 Self-link in language variants
14427 !! options
14428 title=[[Dunav]] language=sr
14429 !! input
14430 Both [[Dunav]] and [[Дунав]] are names for this river.
14431 !! result
14432 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
14433 </p>
14434 !!end
14435
14436 !! article
14437 Дуна
14438 !! text
14439 content
14440 !! endarticle
14441
14442 !! test
14443 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
14444 !! options
14445 title=[[Duna]] language=sr
14446 !! input
14447 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
14448 !! result
14449 <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.
14450 </p>
14451 !! end
14452
14453 !! test
14454 Link to a section of a variant of this title shouldn't be parsed as self-link
14455 !! options
14456 title=[[Duna]] language=sr
14457 !! input
14458 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
14459 !! result
14460 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
14461 </p>
14462 !! end
14463
14464 !! test
14465 Link to pages in language variants
14466 !! options
14467 language=sr
14468 !! input
14469 Main Page can be written as [[Маин Паге]]
14470 !! result
14471 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
14472 </p>
14473 !!end
14474
14475
14476 !! test
14477 Multiple links to pages in language variants
14478 !! options
14479 language=sr
14480 !! input
14481 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
14482 !! result
14483 <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>.
14484 </p>
14485 !!end
14486
14487
14488 !! test
14489 Simple template in language variants
14490 !! options
14491 language=sr
14492 !! input
14493 {{тест}}
14494 !! result
14495 <p>This is a test template
14496 </p>
14497 !! end
14498
14499
14500 !! test
14501 Template with explicit namespace in language variants
14502 !! options
14503 language=sr
14504 !! input
14505 {{Template:тест}}
14506 !! result
14507 <p>This is a test template
14508 </p>
14509 !! end
14510
14511
14512 !! test
14513 Basic test for template parameter in language variants
14514 !! options
14515 language=sr
14516 !! input
14517 {{парамтест|param=foo}}
14518 !! result
14519 <p>This is a test template with parameter foo
14520 </p>
14521 !! end
14522
14523
14524 !! test
14525 Simple category in language variants
14526 !! options
14527 language=sr cat
14528 !! input
14529 [[Category:МедиаWики Усер'с Гуиде]]
14530 !! result
14531 <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>
14532 !! end
14533
14534
14535 !! article
14536 Category:分类
14537 !! text
14538 blah
14539 !! endarticle
14540
14541 !! article
14542 Category:分類
14543 !! text
14544 blah
14545 !! endarticle
14546
14547 !! test
14548 Don't convert blue categorylinks to another variant (bug 33210)
14549 !! options
14550 language=zh cat
14551 !! input
14552 [[A]][[Category:分类]]
14553 !! result
14554 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
14555 !! end
14556
14557
14558 !! test
14559 Stripping -{}- tags (language variants)
14560 !! options
14561 language=sr
14562 !! input
14563 Latin proverb: -{Ne nuntium necare}-
14564 !! result
14565 <p>Latin proverb: Ne nuntium necare
14566 </p>
14567 !! end
14568
14569
14570 !! test
14571 Prevent conversion with -{}- tags (language variants)
14572 !! options
14573 language=sr variant=sr-ec
14574 !! input
14575 Latinski: -{Ne nuntium necare}-
14576 !! result
14577 <p>Латински: Ne nuntium necare
14578 </p>
14579 !! end
14580
14581
14582 !! test
14583 Prevent conversion of text with -{}- tags (language variants)
14584 !! options
14585 language=sr variant=sr-ec
14586 !! input
14587 Latinski: -{Ne nuntium necare}-
14588 !! result
14589 <p>Латински: Ne nuntium necare
14590 </p>
14591 !! end
14592
14593
14594 !! test
14595 Prevent conversion of links with -{}- tags (language variants)
14596 !! options
14597 language=sr variant=sr-ec
14598 !! input
14599 -{[[Main Page]]}-
14600 !! result
14601 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14602 </p>
14603 !! end
14604
14605
14606 !! test
14607 -{}- tags within headlines (within html for parserConvert())
14608 !! options
14609 language=sr variant=sr-ec
14610 !! input
14611 == -{Naslov}- ==
14612 !! result
14613 <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>
14614
14615 !! end
14616
14617
14618 !! test
14619 Explicit definition of language variant alternatives
14620 !! options
14621 language=zh variant=zh-tw
14622 !! input
14623 -{zh:China;zh-tw:Taiwan}-, not China
14624 !! result
14625 <p>Taiwan, not China
14626 </p>
14627 !! end
14628
14629
14630 !! test
14631 Conversion around HTML tags
14632 !! options
14633 language=sr variant=sr-ec
14634 !! input
14635 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
14636 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
14637 !! result
14638 <p>
14639 <span title="ЛаCтин">ски</span>
14640 </p>
14641 !! end
14642
14643
14644 !! test
14645 Explicit session-wise language variant mapping (A flag and - flag)
14646 !! options
14647 language=zh variant=zh-tw
14648 !! input
14649 Taiwan is not China.
14650 But -{A|zh:China;zh-tw:Taiwan}- is China,
14651 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
14652 and -{China}- is China.
14653 !! result
14654 <p>Taiwan is not China.
14655 But Taiwan is Taiwan,
14656 (This should be stripped!)
14657 and China is China.
14658 </p>
14659 !! end
14660
14661 !! test
14662 Explicit session-wise language variant mapping (H flag for hide)
14663 !! options
14664 language=zh variant=zh-tw
14665 !! input
14666 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
14667 Taiwan is China.
14668 !! result
14669 <p>(This should be stripped!)
14670 Taiwan is Taiwan.
14671 </p>
14672 !! end
14673
14674 !! test
14675 Adding explicit conversion rule for title (T flag)
14676 !! options
14677 language=zh variant=zh-tw showtitle
14678 !! input
14679 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14680 !! result
14681 Taiwan
14682 <p>Should be stripped!
14683 </p>
14684 !! end
14685
14686 !! test
14687 Testing that changing the language variant here in the tests actually works
14688 !! options
14689 language=zh variant=zh showtitle
14690 !! input
14691 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14692 !! result
14693 China
14694 <p>Should be stripped!
14695 </p>
14696 !! end
14697
14698 !! test
14699 Recursive conversion of alt and title attrs shouldn't clear converter state
14700 !! options
14701 language=zh variant=zh-cn showtitle
14702 !! input
14703 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
14704 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
14705 !! result
14706 China
14707 <p>
14708 Should be stripped<span title="Exclamation">!</span>
14709 </p>
14710 !! end
14711
14712 !! test
14713 Bug 24072: more test on conversion rule for title
14714 !! options
14715 language=zh variant=zh-tw showtitle
14716 !! input
14717 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
14718 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
14719 !! result
14720 Taiwan
14721 <p>This should be stripped!
14722 This won't take interferes with the title rule.
14723 </p>
14724 !! end
14725
14726 !! test
14727 Partly disable title conversion if variant == main language code
14728 !! options
14729 language=zh variant=zh title=[[ZH]] showtitle
14730 !! input
14731 -{T|zh-cn:CN;zh-tw:TW}-
14732 !! result
14733 ZH
14734 <p>
14735 </p>
14736 !! end
14737
14738 !! test
14739 Partly disable title conversion if variant == main language code, more
14740 !! options
14741 language=zh variant=zh title=[[ZH]] showtitle
14742 !! input
14743 -{T|TW}-
14744 !! result
14745 ZH
14746 <p>
14747 </p>
14748 !! end
14749
14750 !! test
14751 Raw output of variant escape tags (R flag)
14752 !! options
14753 language=zh variant=zh-tw
14754 !! input
14755 Raw: -{R|zh:China;zh-tw:Taiwan}-
14756 !! result
14757 <p>Raw: zh:China;zh-tw:Taiwan
14758 </p>
14759 !! end
14760
14761 !! test
14762 Nested using of manual convert syntax
14763 !! options
14764 language=zh variant=zh-hk
14765 !! input
14766 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
14767 !! result
14768 <p>Nested: Hello Hong Kong!
14769 </p>
14770 !! end
14771
14772 !! test
14773 Proper conversion of text in external links
14774 !! options
14775 language=sr variant=sr-ec
14776 !! input
14777 http://www.google.com
14778 gopher://www.google.com
14779 [http://www.google.com http://www.google.com]
14780 [gopher://www.google.com gopher://www.google.com]
14781 [https://www.google.com irc://www.google.com]
14782 [ftp://www.google.com www.google.com/ftp://dir]
14783 [//www.google.com www.google.com]
14784 !! result
14785 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14786 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14787 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
14788 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
14789 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
14790 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
14791 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
14792 </p>
14793 !! end
14794
14795 !! test
14796 Do not convert roman numbers to language variants
14797 !! options
14798 language=sr variant=sr-ec
14799 !! input
14800 Fridrih IV je car.
14801 !! result
14802 <p>Фридрих IV је цар.
14803 </p>
14804 !! end
14805
14806 !! test
14807 Unclosed language converter markup "-{"
14808 !! options
14809 language=sr
14810 !! input
14811 -{T|hello
14812 !! result
14813 <p>-{T|hello
14814 </p>
14815 !! end
14816
14817 !! test
14818 Don't convert raw rule "-{R|=&gt;}-" to "=>"
14819 !! options
14820 language=sr
14821 !! input
14822 -{R|=&gt;}-
14823 !! result
14824 <p>=&gt;
14825 </p>
14826 !!end
14827
14828 !! test
14829 Bug 529: Uncovered bullet
14830 !! input
14831 * Foo {{bullet}}
14832 !! result
14833 <ul>
14834 <li> Foo
14835 </li>
14836 <li> Bar
14837 </li>
14838 </ul>
14839
14840 !! end
14841
14842 # Plain MediaWiki does not remove empty lists, but tidy actually does.
14843 # Templates in Wikipedia rely on this behavior, as tidy has always been
14844 # enabled there. These tests are normally run *without* tidy, so specify the
14845 # full output here.
14846 # To test realistic parsing behavior, apply a tidy-like transformation to both
14847 # the expected output and your parser's output.
14848 !! test
14849 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
14850 !! input
14851 ******* Foo {{bullet}}
14852 !! result
14853 <ul>
14854 <li><ul>
14855 <li><ul>
14856 <li><ul>
14857 <li><ul>
14858 <li><ul>
14859 <li><ul>
14860 <li> Foo
14861 </li>
14862 </ul>
14863 </li>
14864 </ul>
14865 </li>
14866 </ul>
14867 </li>
14868 </ul>
14869 </li>
14870 </ul>
14871 </li>
14872 </ul>
14873 </li>
14874 <li> Bar
14875 </li>
14876 </ul>
14877
14878 !! end
14879
14880 !! test
14881 Bug 529: Uncovered table already at line-start
14882 !! input
14883 x
14884
14885 {{table}}
14886 y
14887 !! result
14888 <p>x
14889 </p>
14890 <table>
14891 <tr>
14892 <td> 1 </td>
14893 <td> 2
14894 </td></tr>
14895 <tr>
14896 <td> 3 </td>
14897 <td> 4
14898 </td></tr></table>
14899 <p>y
14900 </p>
14901 !! end
14902
14903 !! test
14904 Bug 529: Uncovered bullet in parser function result
14905 !! input
14906 * Foo {{lc:{{bullet}} }}
14907 !! result
14908 <ul>
14909 <li> Foo
14910 </li>
14911 <li> bar
14912 </li>
14913 </ul>
14914
14915 !! end
14916
14917 !! test
14918 Bug 5678: Double-parsed template argument
14919 !! input
14920 {{lc:{{{1}}}|hello}}
14921 !! result
14922 <p>{{{1}}}
14923 </p>
14924 !! end
14925
14926 !! test
14927 Bug 5678: Double-parsed template invocation
14928 !! input
14929 {{lc:{{paramtest {{!}} param = hello }} }}
14930 !! result
14931 <p>{{paramtest | param = hello }}
14932 </p>
14933 !! end
14934
14935 !! test
14936 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
14937 !! options
14938 language=cs
14939 title=[[Main Page]]
14940 !! input
14941 {{PRVNÍVELKÉ:ěščř}}
14942 {{prvnívelké:ěščř}}
14943 {{PRVNÍMALÉ:ěščř}}
14944 {{prvnímalé:ěščř}}
14945 {{MALÁ:ěščř}}
14946 {{malá:ěščř}}
14947 {{VELKÁ:ěščř}}
14948 {{velká:ěščř}}
14949 !! result
14950 <p>Ěščř
14951 Ěščř
14952 ěščř
14953 ěščř
14954 ěščř
14955 ěščř
14956 ĚŠČŘ
14957 ĚŠČŘ
14958 </p>
14959 !! end
14960
14961 !! test
14962 Morwen/13: Unclosed link followed by heading
14963 !! input
14964 [[link
14965 ==heading==
14966 !! result
14967 <p>[[link
14968 </p>
14969 <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>
14970
14971 !! end
14972
14973 !! test
14974 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
14975 !! input
14976 {{foo|
14977 =heading=
14978 !! result
14979 <p>{{foo|
14980 </p>
14981 <h1><span class="mw-headline" id="heading">heading</span></h1>
14982
14983 !! end
14984
14985 !! test
14986 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
14987 !! input
14988 {{foo|
14989 ==heading==
14990 !! result
14991 <p>{{foo|
14992 </p>
14993 <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>
14994
14995 !! end
14996
14997 !! test
14998 Tildes in comments
14999 !! options
15000 pst
15001 !! input
15002 <!-- ~~~~ -->
15003 !! result
15004 <!-- ~~~~ -->
15005 !! end
15006
15007 !! test
15008 Paragraphs inside divs (no extra line breaks)
15009 !! input
15010 <div>Line one
15011
15012 Line two</div>
15013 !! result
15014 <div>Line one
15015 Line two</div>
15016
15017 !! end
15018
15019 !! test
15020 Paragraphs inside divs (extra line break on open)
15021 !! input
15022 <div>
15023 Line one
15024
15025 Line two</div>
15026 !! result
15027 <div>
15028 <p>Line one
15029 </p>
15030 Line two</div>
15031
15032 !! end
15033
15034 !! test
15035 Paragraphs inside divs (extra line break on close)
15036 !! input
15037 <div>Line one
15038
15039 Line two
15040 </div>
15041 !! result
15042 <div>Line one
15043 <p>Line two
15044 </p>
15045 </div>
15046
15047 !! end
15048
15049 !! test
15050 Paragraphs inside divs (extra line break on open and close)
15051 !! input
15052 <div>
15053 Line one
15054
15055 Line two
15056 </div>
15057 !! result
15058 <div>
15059 <p>Line one
15060 </p><p>Line two
15061 </p>
15062 </div>
15063
15064 !! end
15065
15066 !! test
15067 Nesting tags, paragraphs on lines which begin with <div>
15068 !! options
15069 disabled
15070 !! input
15071 <div></div><strong>A
15072 B</strong>
15073 !! result
15074 <div></div>
15075 <p><strong>A
15076 B</strong>
15077 </p>
15078 !! end
15079
15080 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
15081 !! test
15082 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
15083 !! input
15084 <blockquote>Line one
15085
15086 Line two</blockquote>
15087 !! result
15088 <blockquote>Line one
15089 Line two</blockquote>
15090
15091 !! end
15092
15093 !! test
15094 Bug 6200: paragraphs inside blockquotes (extra line break on open)
15095 !! input
15096 <blockquote>
15097 Line one
15098
15099 Line two</blockquote>
15100 !! result
15101 <blockquote>
15102 <p>Line one
15103 </p>
15104 Line two</blockquote>
15105
15106 !! end
15107
15108 !! test
15109 Bug 6200: paragraphs inside blockquotes (extra line break on close)
15110 !! input
15111 <blockquote>Line one
15112
15113 Line two
15114 </blockquote>
15115 !! result
15116 <blockquote>Line one
15117 <p>Line two
15118 </p>
15119 </blockquote>
15120
15121 !! end
15122
15123 !! test
15124 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
15125 !! input
15126 <blockquote>
15127 Line one
15128
15129 Line two
15130 </blockquote>
15131 !! result
15132 <blockquote>
15133 <p>Line one
15134 </p><p>Line two
15135 </p>
15136 </blockquote>
15137
15138 !! end
15139
15140 !! test
15141 Paragraphs inside blockquotes/divs (no extra line breaks)
15142 !! input
15143 <blockquote><div>Line one
15144
15145 Line two</div></blockquote>
15146 !! result
15147 <blockquote><div>Line one
15148 Line two</div></blockquote>
15149
15150 !! end
15151
15152 !! test
15153 Paragraphs inside blockquotes/divs (extra line break on open)
15154 !! input
15155 <blockquote><div>
15156 Line one
15157
15158 Line two</div></blockquote>
15159 !! result
15160 <blockquote><div>
15161 <p>Line one
15162 </p>
15163 Line two</div></blockquote>
15164
15165 !! end
15166
15167 !! test
15168 Paragraphs inside blockquotes/divs (extra line break on close)
15169 !! input
15170 <blockquote><div>Line one
15171
15172 Line two
15173 </div></blockquote>
15174 !! result
15175 <blockquote><div>Line one
15176 <p>Line two
15177 </p>
15178 </div></blockquote>
15179
15180 !! end
15181
15182 !! test
15183 Paragraphs inside blockquotes/divs (extra line break on open and close)
15184 !! input
15185 <blockquote><div>
15186 Line one
15187
15188 Line two
15189 </div></blockquote>
15190 !! result
15191 <blockquote><div>
15192 <p>Line one
15193 </p><p>Line two
15194 </p>
15195 </div></blockquote>
15196
15197 !! end
15198
15199 !! test
15200 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
15201 !! options
15202 wgLinkHolderBatchSize=0
15203 !! input
15204 [[meatball:1]]
15205 [[meatball:2]]
15206 [[meatball:3]]
15207 !! result
15208 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
15209 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
15210 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
15211 </p>
15212 !! end
15213
15214 !! test
15215 Free external link invading image caption
15216 !! input
15217 [[Image:Foobar.jpg|thumb|http://x|hello]]
15218 !! result
15219 <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>
15220
15221 !! end
15222
15223 !! test
15224 Bug 15196: localised external link numbers
15225 !! options
15226 language=fa
15227 !! input
15228 [http://en.wikipedia.org/]
15229 !! result
15230 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
15231 </p>
15232 !! end
15233
15234 !! test
15235 Multibyte character in padleft
15236 !! input
15237 {{padleft:-Hello|7|Æ}}
15238 !! result
15239 <p>Æ-Hello
15240 </p>
15241 !! end
15242
15243 !! test
15244 Multibyte character in padright
15245 !! input
15246 {{padright:Hello-|7|Æ}}
15247 !! result
15248 <p>Hello-Æ
15249 </p>
15250 !! end
15251
15252 !!test
15253 formatdate parser function
15254 !!input
15255 {{#formatdate:2009-03-24}}
15256 !! result
15257 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
15258 </p>
15259 !! end
15260
15261 !!test
15262 formatdate parser function, with default format
15263 !!input
15264 {{#formatdate:2009-03-24|mdy}}
15265 !! result
15266 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
15267 </p>
15268 !! end
15269
15270 !! test
15271 Spacing of numbers in formatted dates
15272 !! input
15273 {{#formatdate:January 15}}
15274 !! result
15275 <p><span class="mw-formatted-date" title="01-15">January 15</span>
15276 </p>
15277 !! end
15278
15279 !! test
15280 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
15281 !! options
15282 language=nl title=[[MediaWiki:Common.css]]
15283 !! input
15284 {{#formatdate:2009-03-24|dmy}}
15285 !! result
15286 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
15287 </p>
15288 !! end
15289
15290 #
15291 #
15292 #
15293
15294 #
15295 # Edit comments
15296 #
15297
15298 !! test
15299 Edit comment with link
15300 !! options
15301 comment
15302 !! input
15303 I like the [[Main Page]] a lot
15304 !! result
15305 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
15306 !!end
15307
15308 !! test
15309 Edit comment with link and link text
15310 !! options
15311 comment
15312 !! input
15313 I like the [[Main Page|best pages]] a lot
15314 !! result
15315 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15316 !!end
15317
15318 !! test
15319 Edit comment with link and link text with suffix
15320 !! options
15321 comment
15322 !! input
15323 I like the [[Main Page|best page]]s a lot
15324 !! result
15325 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
15326 !!end
15327
15328 !! test
15329 Edit comment with section link (non-local, eg in history list)
15330 !! options
15331 comment title=[[Main Page]]
15332 !! input
15333 /* External links */ removed bogus entries
15334 !! result
15335 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15336 !!end
15337
15338 !! test
15339 Edit comment with section link and text before it (non-local, eg in history list)
15340 !! options
15341 comment title=[[Main Page]]
15342 !! input
15343 pre-comment text /* External links */ removed bogus entries
15344 !! result
15345 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>
15346 !!end
15347
15348 !! test
15349 Edit comment with section link (local, eg in diff view)
15350 !! options
15351 comment local title=[[Main Page]]
15352 !! input
15353 /* External links */ removed bogus entries
15354 !! result
15355 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
15356 !!end
15357
15358 !! test
15359 Edit comment with subpage link (bug 14080)
15360 !! options
15361 comment
15362 subpage
15363 title=[[Subpage test]]
15364 !! input
15365 Poked at a [[/subpage]] here...
15366 !! result
15367 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
15368 !!end
15369
15370 !! test
15371 Edit comment with subpage link and link text (bug 14080)
15372 !! options
15373 comment
15374 subpage
15375 title=[[Subpage test]]
15376 !! input
15377 Poked at a [[/subpage|neat little page]] here...
15378 !! result
15379 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
15380 !!end
15381
15382 !! test
15383 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
15384 !! options
15385 comment
15386 title=[[Subpage test]]
15387 !! input
15388 Poked at a [[/subpage]] here...
15389 !! result
15390 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...
15391 !!end
15392
15393 !! test
15394 Edit comment with bare anchor link (local, as on diff)
15395 !! options
15396 comment
15397 local
15398 title=[[Main Page]]
15399 !!input
15400 [[#section]]
15401 !! result
15402 <a href="#section">#section</a>
15403 !! end
15404
15405 !! test
15406 Edit comment with bare anchor link (non-local, as on history)
15407 !! options
15408 comment
15409 title=[[Main Page]]
15410 !!input
15411 [[#section]]
15412 !! result
15413 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
15414 !! end
15415
15416 !! test
15417 Anchor starting with underscore
15418 !!input
15419 [[#_ref|One]]
15420 !! result
15421 <p><a href="#_ref">One</a>
15422 </p>
15423 !! end
15424
15425 !! test
15426 Id starting with underscore
15427 !!input
15428 <div id="_ref"></div>
15429 !! result
15430 <div id="_ref"></div>
15431
15432 !! end
15433
15434 !! test
15435 Space normalisation on autocomment (bug 22784)
15436 !! options
15437 comment
15438 title=[[Main Page]]
15439 !!input
15440 /* __hello__world__ */
15441 !! result
15442 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
15443 !! end
15444
15445 !! test
15446 percent-encoding and + signs in comments (Bug 26410)
15447 !! options
15448 comment
15449 !!input
15450 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
15451 !! result
15452 <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>
15453 !! end
15454
15455 !! test
15456 Bad images - basic functionality
15457 !! options
15458 disabled
15459 !! input
15460 [[File:Bad.jpg]]
15461 !! result
15462 !! end
15463
15464 !! test
15465 Bad images - bug 16039: text after bad image disappears
15466 !! options
15467 disabled
15468 !! input
15469 Foo bar
15470 [[File:Bad.jpg]]
15471 Bar foo
15472 !! result
15473 <p>Foo bar
15474 </p><p>Bar foo
15475 </p>
15476 !! end
15477
15478 !! test
15479 Verify that displaytitle works (bug #22501) no displaytitle
15480 !! options
15481 showtitle
15482 !! config
15483 wgAllowDisplayTitle=true
15484 wgRestrictDisplayTitle=false
15485 !! input
15486 this is not the the title
15487 !! result
15488 Parser test
15489 <p>this is not the the title
15490 </p>
15491 !! end
15492
15493 !! test
15494 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
15495 !! options
15496 showtitle
15497 title=[[Screen]]
15498 !! config
15499 wgAllowDisplayTitle=true
15500 wgRestrictDisplayTitle=false
15501 !! input
15502 this is not the the title
15503 {{DISPLAYTITLE:whatever}}
15504 !! result
15505 whatever
15506 <p>this is not the the title
15507 </p>
15508 !! end
15509
15510 !! test
15511 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
15512 !! options
15513 showtitle
15514 title=[[Screen]]
15515 !! config
15516 wgAllowDisplayTitle=true
15517 wgRestrictDisplayTitle=true
15518 !! input
15519 this is not the the title
15520 {{DISPLAYTITLE:whatever}}
15521 !! result
15522 Screen
15523 <p>this is not the the title
15524 </p>
15525 !! end
15526
15527 !! test
15528 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
15529 !! options
15530 showtitle
15531 title=[[Screen]]
15532 !! config
15533 wgAllowDisplayTitle=true
15534 wgRestrictDisplayTitle=true
15535 !! input
15536 this is not the the title
15537 {{DISPLAYTITLE:screen}}
15538 !! result
15539 screen
15540 <p>this is not the the title
15541 </p>
15542 !! end
15543
15544 !! test
15545 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
15546 !! options
15547 showtitle
15548 title=[[Screen]]
15549 !! config
15550 wgAllowDisplayTitle=false
15551 !! input
15552 this is not the the title
15553 {{DISPLAYTITLE:screen}}
15554 !! result
15555 Screen
15556 <p>this is not the the title
15557 <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>
15558 </p>
15559 !! end
15560
15561 !! test
15562 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
15563 !! options
15564 showtitle
15565 title=[[Screen]]
15566 !! config
15567 wgAllowDisplayTitle=false
15568 !! input
15569 this is not the the title
15570 !! result
15571 Screen
15572 <p>this is not the the title
15573 </p>
15574 !! end
15575
15576 !! test
15577 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
15578 !! options
15579 showtitle
15580 title=[[Screen]]
15581 !! config
15582 wgAllowDisplayTitle=true
15583 wgRestrictDisplayTitle=true
15584 !! input
15585 this is not the the title
15586 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
15587 !! result
15588 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
15589 <p>this is not the the title
15590 </p>
15591 !! end
15592
15593 !! test
15594 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
15595 !! options
15596 showtitle
15597 title=[[Screen]]
15598 !! config
15599 wgAllowDisplayTitle=true
15600 wgRestrictDisplayTitle=true
15601 !! input
15602 this is not the the title
15603 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
15604 !! result
15605 <span style="color: red;">s</span>creen
15606 <p>this is not the the title
15607 </p>
15608 !! end
15609
15610 !! test
15611 preload: check <noinclude> and <includeonly>
15612 !! options
15613 preload
15614 !! input
15615 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
15616 !! result
15617 Hello kind world.
15618 !! end
15619
15620 !! test
15621 preload: check <onlyinclude>
15622 !! options
15623 preload
15624 !! input
15625 Goodbye <onlyinclude>Hello world</onlyinclude>
15626 !! result
15627 Hello world
15628 !! end
15629
15630 !! test
15631 preload: can pass tags through if we want to
15632 !! options
15633 preload
15634 !! input
15635 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
15636 !! result
15637 <includeonly>Hello world</includeonly>
15638 !! end
15639
15640 !! test
15641 preload: check that it doesn't try to do tricks
15642 !! options
15643 preload
15644 !! input
15645 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15646 !! result
15647 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
15648 !! end
15649
15650 !! test
15651 Play a bit with r67090 and bug 3158
15652 !! options
15653 disabled
15654 !! input
15655 <div style="width:50% !important">&nbsp;</div>
15656 <div style="width:50%&nbsp;!important">&nbsp;</div>
15657 <div style="width:50%&#160;!important">&nbsp;</div>
15658 <div style="border : solid;">&nbsp;</div>
15659 !! result
15660 <div style="width:50% !important">&nbsp;</div>
15661 <div style="width:50% !important">&nbsp;</div>
15662 <div style="width:50% !important">&nbsp;</div>
15663 <div style="border&#160;: solid;">&nbsp;</div>
15664
15665 !! end
15666
15667 !! test
15668 HTML5 data attributes
15669 !! input
15670 <span data-foo="bar">Baz</span>
15671 <p data-abc-def_hij="">Quuz</p>
15672 !! result
15673 <p><span data-foo="bar">Baz</span>
15674 </p>
15675 <p data-abc-def_hij="">Quuz</p>
15676
15677 !! end
15678
15679 !! test
15680 percent-encoding and + signs in internal links (Bug 26410)
15681 !! input
15682 [[User:+%]] [[Page+title%]]
15683 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
15684 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
15685 [[%33%45]] [[%33%45+]]
15686 !! result
15687 <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>
15688 <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>
15689 <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>
15690 <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>
15691 </p>
15692 !! end
15693
15694 !! test
15695 Special characters in embedded file links (bug 27679)
15696 !! input
15697 [[File:Contains & ampersand.jpg]]
15698 [[File:Does not exist.jpg|Title with & ampersand]]
15699 !! result
15700 <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>
15701 <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>
15702 </p>
15703 !! end
15704
15705
15706 !! test
15707 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
15708 !! input
15709 Text&apos;s been normalized?
15710 !! result
15711 <p>Text&#39;s been normalized?
15712 </p>
15713 !! end
15714
15715 !! test
15716 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
15717 !! input
15718 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
15719 !! result
15720 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
15721 </p>
15722 !! end
15723
15724 !! test
15725 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
15726 !! input
15727 [http://www.example.org/ ideograms]
15728 !! result
15729 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
15730 </p>
15731 !! end
15732
15733 !! test
15734 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
15735 !! input
15736 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
15737 !! result
15738 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
15739 </p>
15740 !! end
15741
15742 !! article
15743 Mediawiki:loop1
15744 !! text
15745 {{Identical|A}}
15746 !! endarticle
15747
15748 !! article
15749 Mediawiki:loop2
15750 !! text
15751 {{Identical|B}}
15752 !! endarticle
15753
15754 !! article
15755 Template:Identical
15756 !! text
15757 {{int:loop1}}
15758 {{int:loop2}}
15759 !! endarticle
15760
15761 !! test
15762 Bug 31098 Template which includes system messages which includes the template
15763 !! input
15764 {{Identical}}
15765 !! result
15766 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15767 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
15768 </p>
15769 !! end
15770
15771 !! test
15772 Bug31490 Turkish: ucfirst 'blah'
15773 !! options
15774 language=tr
15775 !! input
15776 {{ucfirst:blah}}
15777 !! result
15778 <p>Blah
15779 </p>
15780 !! end
15781
15782 !! test
15783 Bug31490 Turkish: ucfirst 'ix'
15784 !! options
15785 language=tr
15786 !! input
15787 {{ucfirst:ix}}
15788 !! result
15789 <p>İx
15790 </p>
15791 !! end
15792
15793 !! test
15794 Bug31490 Turkish: lcfirst 'BLAH'
15795 !! options
15796 language=tr
15797 !! input
15798 {{lcfirst:BLAH}}
15799 !! result
15800 <p>bLAH
15801 </p>
15802 !! end
15803
15804 !! test
15805 Bug31490 Turkish: ucfırst (with a dotless i)
15806 !! options
15807 language=tr
15808 !! input
15809 {{ucfırst:blah}}
15810 !! result
15811 <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>
15812 </p>
15813 !! end
15814
15815 !! test
15816 Bug31490 ucfırst (with a dotless i) with English language
15817 !! options
15818 language=en
15819 !! input
15820 {{ucfırst:blah}}
15821 !! result
15822 <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>
15823 </p>
15824 !! end
15825
15826 !! test
15827 Bug 26375: TOC with italics
15828 !! options
15829 title=[[Main Page]]
15830 !! input
15831 __TOC__
15832 == ''Lost'' episodes ==
15833 !! result
15834 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15835 <ul>
15836 <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>
15837 </ul>
15838 </div>
15839
15840 <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>
15841
15842 !! end
15843
15844 !! test
15845 Bug 26375: TOC with bold
15846 !! options
15847 title=[[Main Page]]
15848 !! input
15849 __TOC__
15850 == '''should be bold''' then normal text ==
15851 !! result
15852 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15853 <ul>
15854 <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>
15855 </ul>
15856 </div>
15857
15858 <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>
15859
15860 !! end
15861
15862 !! test
15863 Bug 33845: Headings become cursive in TOC when they contain an image
15864 !! options
15865 title=[[Main Page]]
15866 !! input
15867 __TOC__
15868 == Image [[Image:foobar.jpg]] ==
15869 !! result
15870 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15871 <ul>
15872 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
15873 </ul>
15874 </div>
15875
15876 <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>
15877
15878 !! end
15879
15880 !! test
15881 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
15882 !! options
15883 title=[[Main Page]]
15884 !! input
15885 __TOC__
15886 == <blockquote>Quote</blockquote> ==
15887 !! result
15888 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15889 <ul>
15890 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
15891 </ul>
15892 </div>
15893
15894 <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>
15895
15896 !! end
15897
15898 !! test
15899 Unclosed tags in TOC
15900 !! options
15901 title=[[Main Page]]
15902 !! input
15903 __TOC__
15904 == Proof: 2 < 3 ==
15905 <small>Hanc marginis exiguitas non caperet.</small>
15906 QED
15907 !! result
15908 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15909 <ul>
15910 <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>
15911 </ul>
15912 </div>
15913
15914 <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>
15915 <p><small>Hanc marginis exiguitas non caperet.</small>
15916 QED
15917 </p>
15918 !! end
15919
15920 !! test
15921 Multiple tags in TOC
15922 !! input
15923 __TOC__
15924 == <i>Foo</i> <b>Bar</b> ==
15925
15926 == <i>Foo</i> <blockquote>Bar</blockquote> ==
15927 !! result
15928 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15929 <ul>
15930 <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>
15931 <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>
15932 </ul>
15933 </div>
15934
15935 <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>
15936 <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>
15937
15938 !! end
15939
15940 !! test
15941 Tags with parameters in TOC
15942 !! input
15943 __TOC__
15944 == <sup class="in-h2">Hello</sup> ==
15945
15946 == <sup class="a > b">Evilbye</sup> ==
15947 !! result
15948 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15949 <ul>
15950 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
15951 <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>
15952 </ul>
15953 </div>
15954
15955 <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>
15956 <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>
15957
15958 !! end
15959
15960 !! test
15961 span tags with directionality in TOC
15962 !! input
15963 __TOC__
15964 == <span dir="ltr">C++</span> ==
15965
15966 == <span dir="rtl">זבנג!</span> ==
15967
15968 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
15969
15970 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
15971
15972 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
15973 !! result
15974 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15975 <ul>
15976 <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>
15977 <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>
15978 <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>
15979 <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>
15980 <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>
15981 </ul>
15982 </div>
15983
15984 <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>
15985 <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>
15986 <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>
15987 <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>
15988 <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>
15989
15990 !! end
15991
15992 !! article
15993 MediaWiki:Bug32057
15994 !! text
15995 == {{int:headline_sample}} ==
15996 !! endarticle
15997
15998 !! test
15999 Bug 32057: Title needed when expanding <h> nodes.
16000 !! options
16001 title=[[Main Page]]
16002 !! input
16003 {{int:Bug32057}}
16004 !! result
16005 <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>
16006
16007 !! end
16008
16009 !! test
16010 Strip marker in urlencode
16011 !! input
16012 {{urlencode:x<nowiki/>y}}
16013 {{urlencode:x<nowiki/>y|wiki}}
16014 {{urlencode:x<nowiki/>y|path}}
16015 !! result
16016 <p>xy
16017 xy
16018 xy
16019 </p>
16020 !! end
16021
16022 !! test
16023 Strip marker in lc
16024 !! input
16025 {{lc:x<nowiki/>y}}
16026 !! result
16027 <p>xy
16028 </p>
16029 !! end
16030
16031 !! test
16032 Strip marker in uc
16033 !! input
16034 {{uc:x<nowiki/>y}}
16035 !! result
16036 <p>XY
16037 </p>
16038 !! end
16039
16040 !! test
16041 Strip marker in formatNum
16042 !! input
16043 {{formatnum:1<nowiki/>2}}
16044 {{formatnum:1<nowiki/>2|R}}
16045 !! result
16046 <p>12
16047 12
16048 </p>
16049 !! end
16050
16051 !! test
16052 Check noCommafy in formatNum
16053 !! options
16054 language=be-tarask
16055 !! input
16056 {{formatnum:123456.78}}
16057 {{formatnum:123456.78|NOSEP}}
16058 !! result
16059 <p>123 456,78
16060 123456.78
16061 </p>
16062 !! end
16063
16064 !! test
16065 Strip marker in grammar
16066 !! options
16067 language=fi
16068 !! input
16069 {{grammar:elative|foo<nowiki/>bar}}
16070 !! result
16071 <p>foobarista
16072 </p>
16073 !! end
16074
16075 !! test
16076 Strip marker in padleft
16077 !! input
16078 {{padleft:|2|x<nowiki/>y}}
16079 !! result
16080 <p>xy
16081 </p>
16082 !! end
16083
16084 !! test
16085 Strip marker in padright
16086 !! input
16087 {{padright:|2|x<nowiki/>y}}
16088 !! result
16089 <p>xy
16090 </p>
16091 !! end
16092
16093 !! test
16094 Strip marker in anchorencode
16095 !! input
16096 {{anchorencode:x<nowiki/>y}}
16097 !! result
16098 <p>xy
16099 </p>
16100 !! end
16101
16102 !! test
16103 nowiki inside link inside heading (bug 18295)
16104 !! input
16105 ==[[foo|x<nowiki>y</nowiki>z]]==
16106 !! result
16107 <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>
16108
16109 !! end
16110
16111 !! test
16112 new support for bdi element (bug 31817)
16113 !! input
16114 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16115 !! result
16116 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
16117
16118 !!end
16119
16120 !! test
16121 Ignore pipe between table row attributes
16122 !! input
16123 {|
16124 | quux
16125 |- id=foo | style='color: red'
16126 | bar
16127 |}
16128 !! result
16129 <table>
16130 <tr>
16131 <td> quux
16132 </td></tr>
16133 <tr id="foo" style="color: red">
16134 <td> bar
16135 </td></tr></table>
16136
16137 !! end
16138
16139 !!test
16140 Gallery override link with WikiLink (bug 34852)
16141 !! input
16142 <gallery>
16143 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
16144 </gallery>
16145 !! result
16146 <ul class="gallery mw-gallery-traditional">
16147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16148 <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>
16149 <div class="gallerytext">
16150 <p>caption
16151 </p>
16152 </div>
16153 </div></li>
16154 </ul>
16155
16156 !! end
16157
16158 !!test
16159 Gallery override link with absolute external link (bug 34852)
16160 !! input
16161 <gallery>
16162 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
16163 </gallery>
16164 !! result
16165 <ul class="gallery mw-gallery-traditional">
16166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16167 <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>
16168 <div class="gallerytext">
16169 <p>caption
16170 </p>
16171 </div>
16172 </div></li>
16173 </ul>
16174
16175 !! end
16176
16177 !!test
16178 Gallery override link with malicious javascript (bug 34852)
16179 !! input
16180 <gallery>
16181 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
16182 </gallery>
16183 !! result
16184 <ul class="gallery mw-gallery-traditional">
16185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16186 <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>
16187 <div class="gallerytext">
16188 <p>caption
16189 </p>
16190 </div>
16191 </div></li>
16192 </ul>
16193
16194 !! end
16195
16196 !!test
16197 Gallery with invalid title as link (bug 43964)
16198 !! input
16199 <gallery>
16200 File:foobar.jpg|link=<
16201 </gallery>
16202 !! result
16203 <ul class="gallery mw-gallery-traditional">
16204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16205 <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>
16206 <div class="gallerytext">
16207 </div>
16208 </div></li>
16209 </ul>
16210
16211 !! end
16212
16213 !!test
16214 Language parser function
16215 !! input
16216 {{#language:ar}}
16217 !! result
16218 <p>العربية
16219 </p>
16220 !! end
16221
16222 !!test
16223 Padleft and padright as substr
16224 !! input
16225 {{padleft:|3|abcde}}
16226 {{padright:|3|abcde}}
16227 !! result
16228 <p>abc
16229 abc
16230 </p>
16231 !! end
16232
16233 !!test
16234 Special parser function
16235 !! input
16236 {{#special:RandomPage}}
16237 {{#special:BaDtItLe}}
16238 {{#special:Foobar}}
16239 !! result
16240 <p>Special:Random
16241 Special:Badtitle
16242 Special:Foobar
16243 </p>
16244 !! end
16245
16246 !!test
16247 Bug 34939 - Case insensitive link parsing ([HttP://])
16248 !! input
16249 [HttP://MediaWiki.Org/]
16250 !! result
16251 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
16252 </p>
16253 !! end
16254
16255 !!test
16256 Bug 34939 - Case insensitive link parsing ([HttP:// title])
16257 !! input
16258 [HttP://MediaWiki.Org/ MediaWiki]
16259 !! result
16260 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
16261 </p>
16262 !! end
16263
16264 !!test
16265 Bug 34939 - Case insensitive link parsing (HttP://)
16266 !! input
16267 HttP://MediaWiki.Org/
16268 !! result
16269 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
16270 </p>
16271 !! end
16272
16273 !!test
16274 Disable TOC
16275 !! options
16276 notoc
16277 !! input
16278 Lead
16279 == Section 1 ==
16280 == Section 2 ==
16281 == Section 3 ==
16282 == Section 4 ==
16283 == Section 5 ==
16284 !! result
16285 <p>Lead
16286 </p>
16287
16288 <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>
16289 <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=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16290 <h2><span class="mw-headline" id="Section_3">Section 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: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16291 <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=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16292 <h2><span class="mw-headline" id="Section_5">Section 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: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16293
16294 !! end
16295
16296
16297 ###
16298 ### Parsoids-specific tests
16299 ### Parsoid-PHP parser incompatibilities
16300 ###
16301 !!test
16302 1. SOL-sensitive wikitext tokens as template-args
16303 !!options
16304 parsoid=wt2html,wt2wt
16305 !!input
16306 {{echo|*a}}
16307 {{echo|#a}}
16308 {{echo|:a}}
16309 !!result
16310 <span about="#mwt1" typeof="mw:Transclusion">
16311 </span><ul about="#mwt1"><li>a</li>
16312 </ul>
16313 <span about="#mwt2" typeof="mw:Transclusion">
16314 </span><ol about="#mwt2"><li>a</li>
16315 </ol>
16316 <span about="#mwt3" typeof="mw:Transclusion">
16317 </span><dl about="#mwt3"><dd>a</dd>
16318 </dl>
16319 !!end
16320
16321 #### ----------------------------------------------------------------
16322 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
16323 #### tags. Parsoid's output for these tags differs from that of the
16324 #### PHP parser.
16325 #### ----------------------------------------------------------------
16326
16327 !!test
16328 Ref: 1. ref-location should be replaced with an index span
16329 !!options
16330 parsoid
16331 !!input
16332 A <ref>foo</ref>
16333 B <ref name="x">foo</ref>
16334 C <ref name="y" />
16335 !!result
16336 <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>
16337 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>
16338 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>
16339 !!end
16340
16341 !!test
16342 Ref: 2. ref-tags with identical names should all get the same index
16343 !!options
16344 parsoid
16345 !!input
16346 A <ref name="x">foo</ref>
16347 B <ref name="x" />
16348 !!result
16349 <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>
16350 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>
16351 !!end
16352
16353 !!test
16354 Ref: 3. spaces in ref-names should be ignored
16355 !!options
16356 parsoid
16357 !!input
16358 A <ref name="x">foo</ref>
16359 B <ref name=" x " />
16360 C <ref name= x />
16361 !!result
16362 <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>
16363 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>
16364 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>
16365 !!end
16366
16367 !!test
16368 Ref: 4. 'constructor' should be accepted as a valid ref-name
16369 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
16370 !!options
16371 parsoid
16372 !!input
16373 A <ref name="constructor">foo</ref>
16374 !!result
16375 <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>
16376 !!end
16377
16378 !!test
16379 Ref: 5. body should accept generic wikitext
16380 !!options
16381 parsoid
16382 !!input
16383 A <ref>
16384 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
16385 </ref>
16386
16387 <references />
16388 !!result
16389 <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>
16390
16391 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
16392 <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>
16393 </li>
16394 </ol>
16395 !!end
16396
16397 !!test
16398 Ref: 6. indent-pres should not be output in ref-body
16399 !!options
16400 parsoid
16401 !!input
16402 A <ref>
16403 foo
16404 bar
16405 baz
16406 </ref>
16407
16408 <references />
16409 !!result
16410 <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>
16411
16412 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
16413 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16414 bar
16415 baz
16416 </li>
16417 </ol>
16418 !!end
16419
16420 !!test
16421 Ref: 7. No p-wrapping in ref-body
16422 !!options
16423 parsoid
16424 !!input
16425 A <ref>
16426 foo
16427
16428 bar
16429
16430
16431 baz
16432
16433
16434
16435 booz
16436 </ref>
16437
16438 <references />
16439 !!result
16440 <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>
16441
16442 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16443 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
16444
16445 bar
16446
16447
16448 baz
16449
16450
16451
16452 booz
16453 </li>
16454 </ol>
16455 !!end
16456
16457 !!test
16458 Ref: 8. transclusion wikitext has lower precedence
16459 !!options
16460 parsoid
16461 !!input
16462 A <ref> foo {{echo|</ref> B C}}
16463
16464 <references />
16465 !!result
16466 <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>
16467
16468 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16469 <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>
16470 </ol>
16471 !!end
16472
16473 !!test
16474 Ref: 9. unclosed comments should not leak out of ref-body
16475 !!options
16476 parsoid
16477 !!input
16478 A <ref> foo <!--</ref> B C
16479
16480 <references />
16481 !!result
16482 <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>
16483
16484 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16485 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
16486 </ol>
16487 !!end
16488
16489 !!test
16490 Ref: 10. Unclosed HTML tags should not leak out of ref-body
16491 !!options
16492 parsoid
16493 !!input
16494 A <ref> <b> foo </ref> B C
16495
16496 <references />
16497 !!result
16498 <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>
16499
16500 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
16501 <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>
16502 </ol>
16503 !!end
16504
16505 !!test
16506 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
16507 !!options
16508 parsoid
16509 !!input
16510 A <ref>foo</ref> B
16511 C <ref>bar</ref> D
16512 !!result
16513 <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
16514 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>
16515 !!end
16516
16517 !!test
16518 Ref: 12. ref-tags act as trailing newline migration barrier
16519 !!options
16520 parsoid
16521 !!input
16522 <!--the newline at the end of this line moves out of the p-tag-->a
16523
16524 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
16525 <ref />
16526
16527 c
16528 !!result
16529 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
16530
16531
16532 <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>
16533 <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>
16534
16535
16536 <p>c</p>
16537 !!end
16538
16539 !!test
16540 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
16541 !!options
16542 parsoid
16543 !!input
16544 <ref>foo</ref> A
16545 <ref>bar
16546 </ref> B
16547 !!result
16548 <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
16549 <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>
16550 !!end
16551
16552 !!test
16553 Ref: 14. A nested ref-tag should be emitted as plain text
16554 !!options
16555 parsoid
16556 !!input
16557 <ref>foo <ref>bar</ref> baz</ref>
16558
16559 <references />
16560 !!result
16561 <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>
16562
16563 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
16564 <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>
16565 </ol>
16566 !!end
16567
16568 !!test
16569 Ref: 15. ref-tags with identical names should get identical indexes
16570 !!options
16571 parsoid
16572 !!input
16573 A1 <ref name="a">foo</ref> A2 <ref name="a" />
16574 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
16575
16576 <references />
16577 !!result
16578 <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>
16579 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>
16580
16581 <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>
16582 </ol>
16583 !!end
16584
16585 !!test
16586 References: 1. references tag without any refs should be handled properly
16587 !!options
16588 parsoid
16589 !!input
16590 <references />
16591 !!result
16592 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
16593 !!end
16594
16595 !!test
16596 References: 2. references tag with group only outputs references from that group
16597 !!options
16598 parsoid
16599 !!input
16600 A <ref group="a">foo</ref>
16601 B <ref group="b">bar</ref>
16602
16603 <references group='a' />
16604 !!result
16605 <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>
16606 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>
16607
16608 <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>
16609 </ol>
16610 !!end
16611
16612 !!test
16613 References: 3. ref list should be cleared after processing references
16614 !!options
16615 parsoid
16616 !!input
16617 A <ref>foo</ref>
16618
16619 <references />
16620
16621 B <ref>bar</ref>
16622
16623 <references />
16624 !!result
16625 <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>
16626
16627 <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>
16628 </ol>
16629
16630 <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>
16631
16632 <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>
16633 </ol>
16634 !!end
16635
16636 !!test
16637 References: 4. only referenced group should be cleared after processing references
16638 !!options
16639 parsoid
16640 !!input
16641 A <ref group="a">afoo</ref>
16642 B <ref>bfoo</ref>
16643
16644 <references group="a"/>
16645
16646 C <ref>cfoo</ref>
16647
16648 <references />
16649 !!result
16650 <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>
16651 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>
16652
16653 <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>
16654 </ol>
16655
16656 <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>
16657
16658 <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>
16659 </ol>
16660 !!end
16661
16662 !!test
16663 References: 5. ref tags in references should be processed while ignoring all other content
16664 !!options
16665 parsoid
16666 !!input
16667 A <ref name="a" />
16668 B <ref name="b">bar</ref>
16669
16670 <references>
16671 <ref name="a">foo</ref>
16672 This should just get lost.
16673 </references>
16674 !!result
16675 <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>
16676 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>
16677
16678 <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>
16679 </ol>
16680 !!end
16681
16682 !!test
16683 References: 6. <references /> from a transclusion
16684 !!options
16685 parsoid
16686 !!input
16687 {{echo|<references />}}
16688 !!result
16689 <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>
16690 !!end
16691
16692 !! test
16693 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
16694 !! options
16695 parsoid
16696 !! input
16697 A <ref>foo bar for a</ref>
16698 B <ref name="b" />
16699
16700 <references />
16701
16702 <references>
16703 <ref name="b">foo</ref>
16704 </references>
16705 !! result
16706 <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>
16707 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>
16708
16709 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
16710 <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>
16711 <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>
16712 </ol>
16713
16714 <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":{}}'>
16715 <li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li>
16716 </ol>
16717 !! end
16718
16719 #### ----------------------------------------------------------------
16720 #### The following section of tests are primarily to test
16721 #### wikitext escaping capabilities of Parsoid. Given that
16722 #### escaping can be done any number of ways, the wikitext (input)
16723 #### is always adjusted to reflect how Parsoid adds nowiki
16724 #### escape tags.
16725 ####
16726 #### We are marking several tests as parsoid-only since the
16727 #### HTML in the result section is different from what the
16728 #### PHP parser generates for it.
16729 #### ----------------------------------------------------------------
16730
16731
16732 #### --------------- Headings ---------------
16733 #### 0. Unnested
16734 #### 1. Nested inside html <h1>=foo=</h1>
16735 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
16736 #### 3. Nested inside html with wikitext split by html tags
16737 #### 4. No escape needed
16738 #### 5. Empty headings <h1></h1>
16739 #### 6. Heading chars in SOL context
16740 #### ----------------------------------------
16741 !! test
16742 Headings: 0. Unnested
16743 !! options
16744 parsoid
16745 !! input
16746 <nowiki>=foo=</nowiki>
16747
16748 <nowiki> =foo= </nowiki>
16749 <!--cmt-->
16750 <nowiki>=foo=</nowiki>
16751
16752 =foo''a''<nowiki>=</nowiki>
16753 !! result
16754 <p><span typeof="mw:Nowiki">=foo=</span></p>
16755
16756 <p><span typeof="mw:Nowiki"> =foo= </span>
16757 <!--cmt-->
16758 <span typeof="mw:Nowiki">=foo=</span></p>
16759
16760 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
16761 !!end
16762
16763 !! test
16764 Headings: 1. Nested inside html
16765 !! options
16766 parsoid
16767 !! input
16768 =<nowiki>=foo=</nowiki>=
16769
16770 ==<nowiki>=foo=</nowiki>==
16771
16772 ===<nowiki>=foo=</nowiki>===
16773
16774 ====<nowiki>=foo=</nowiki>====
16775
16776 =====<nowiki>=foo=</nowiki>=====
16777
16778 ======<nowiki>=foo=</nowiki>======
16779 !! result
16780 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
16781 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
16782 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
16783 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
16784 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
16785 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
16786 !!end
16787
16788 !! test
16789 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
16790 !! options
16791 parsoid
16792 !! input
16793 =foo=
16794 <nowiki>*</nowiki>bar
16795
16796 =foo=
16797 =bar
16798
16799 =foo=
16800 <nowiki>=bar=</nowiki>
16801 !! result
16802 <h1>foo</h1>*bar
16803 <h1>foo</h1>=bar
16804 <h1>foo</h1>=bar=
16805 !!end
16806
16807 !! test
16808 Headings: 3. Nested inside html with wikitext split by html tags
16809 !! options
16810 parsoid
16811 !! input
16812 =='''bold'''<nowiki>foo=</nowiki>=
16813 !! result
16814 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
16815 !!end
16816
16817 !! test
16818 Headings: 4a. No escaping needed (testing just h1 and h2)
16819 !! options
16820 parsoid
16821 !! input
16822 ==foo=
16823
16824 =foo==
16825
16826 = =foo= =
16827
16828 ==foo= bar=
16829
16830 ===foo==
16831
16832 ==foo===
16833
16834 =''=''foo==
16835
16836 =<nowiki>=</nowiki>=
16837 !! result
16838 <h1>=foo</h1>
16839 <h1>foo=</h1>
16840 <h1> =foo= </h1>
16841 <h1>=foo= bar</h1>
16842 <h2>=foo</h2>
16843 <h2>foo=</h2>
16844 <h1><i>=</i>foo=</h1>
16845 <h1><span typeof="mw:Nowiki">=</span></h1>
16846 !!end
16847
16848 !! test
16849 Headings: 4b. No escaping needed (inside p-tags)
16850 !! options
16851 parsoid
16852 !! input
16853 ===
16854 =foo= x
16855 =foo= <s></s>
16856 !! result
16857 <p>===
16858 =foo= x
16859 =foo= <s></s>
16860 </p>
16861 !!end
16862
16863 !! test
16864 Headings: 5. Empty headings
16865 !! options
16866 parsoid
16867 !! input
16868 =<nowiki/>=
16869
16870 ==<nowiki/>==
16871
16872 ===<nowiki/>===
16873
16874 ====<nowiki/>====
16875
16876 =====<nowiki/>=====
16877
16878 ======<nowiki/>======
16879 !! result
16880 <h1></h1>
16881 <h2></h2>
16882 <h3></h3>
16883 <h4></h4>
16884 <h5></h5>
16885 <h6></h6>
16886 !!end
16887
16888 !! test
16889 Headings: 6a. Heading chars in SOL context (with trailing spaces)
16890 !! options
16891 parsoid
16892 !! input
16893 <nowiki>=a=</nowiki>
16894
16895 <nowiki>=a=</nowiki>
16896
16897 <nowiki>=a=</nowiki>
16898
16899 <nowiki>=a=</nowiki>
16900 !! result
16901 <p>=a=</p>
16902 <p>=a= </p>
16903 <p>=a= </p>
16904 <p>=a= </p>
16905 !!end
16906
16907 !! test
16908 Headings: 6b. Heading chars in SOL context (with trailing newlines)
16909 !! options
16910 parsoid
16911 !! input
16912 <nowiki>=a=
16913 b</nowiki>
16914
16915 <nowiki>=a=
16916 b</nowiki>
16917
16918 <nowiki>=a=
16919 b</nowiki>
16920
16921 <nowiki>=a=
16922 b</nowiki>
16923 !! result
16924 <p>=a=
16925 b</p>
16926 <p>=a=
16927 b</p>
16928 <p>=a=
16929 b</p>
16930 <p>=a=
16931 b</p>
16932 </p>
16933 !!end
16934
16935 !! test
16936 Headings: 6c. Heading chars in SOL context (leading newline break)
16937 !! options
16938 parsoid
16939 !! input
16940 a
16941 <nowiki>=b=</nowiki>
16942 !! result
16943 <p>a
16944 =b=</p>
16945 !!end
16946
16947 !! test
16948 Headings: 6d. Heading chars in SOL context (with interspersed comments)
16949 !! options
16950 parsoid
16951 !! input
16952 <!--c0--><nowiki>=a=</nowiki>
16953 <!--c1-->
16954 <nowiki>=a=</nowiki> <!--c2--> <!--c3-->
16955 !! result
16956 <p><!--c0-->=a=</p>
16957 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
16958 !!end
16959
16960 !! test
16961 Headings: 6d. Heading chars in SOL context (No escaping needed)
16962 !! options
16963 parsoid=html2wt
16964 !! input
16965 =a=<div>b</div>
16966 !! result
16967 =a=<div>b</div>
16968 !!end
16969
16970 #### --------------- Lists ---------------
16971 #### 0. Outside nests (*foo, etc.)
16972 #### 1. Nested inside html <ul><li>*foo</li></ul>
16973 #### 2. Inside definition lists
16974 #### 3. Only bullets at start should be escaped
16975 #### 4. No escapes needed
16976 #### 5. No unnecessary escapes
16977 #### 6. Escape bullets in SOL position
16978 #### 7. Escape bullets in a multi-line context
16979 #### ----------------------------------------
16980
16981 !! test
16982 Lists: 0. Outside nests
16983 !! input
16984 <nowiki>*</nowiki>foo
16985
16986 <nowiki>#</nowiki>foo
16987 !! result
16988 <p>*foo
16989 </p><p>#foo
16990 </p>
16991 !!end
16992
16993 !! test
16994 Lists: 1. Nested inside html
16995 !! input
16996 *<nowiki>*foo</nowiki>
16997
16998 *<nowiki>#foo</nowiki>
16999
17000 *<nowiki>:foo</nowiki>
17001
17002 *<nowiki>;foo</nowiki>
17003
17004 #<nowiki>*foo</nowiki>
17005
17006 #<nowiki>#foo</nowiki>
17007
17008 #<nowiki>:foo</nowiki>
17009
17010 #<nowiki>;foo</nowiki>
17011 !! result
17012 <ul>
17013 <li>*foo
17014 </li>
17015 </ul>
17016 <ul>
17017 <li>#foo
17018 </li>
17019 </ul>
17020 <ul>
17021 <li>:foo
17022 </li>
17023 </ul>
17024 <ul>
17025 <li>;foo
17026 </li>
17027 </ul>
17028 <ol>
17029 <li>*foo
17030 </li>
17031 </ol>
17032 <ol>
17033 <li>#foo
17034 </li>
17035 </ol>
17036 <ol>
17037 <li>:foo
17038 </li>
17039 </ol>
17040 <ol>
17041 <li>;foo
17042 </li>
17043 </ol>
17044
17045 !!end
17046
17047 !! test
17048 Lists: 2. Inside definition lists
17049 !! input
17050 ;<nowiki>;foo</nowiki>
17051
17052 ;<nowiki>:foo</nowiki>
17053
17054 ;<nowiki>:foo</nowiki>
17055 :bar
17056
17057 :<nowiki>:foo</nowiki>
17058 !! result
17059 <dl>
17060 <dt>;foo
17061 </dt>
17062 </dl>
17063 <dl>
17064 <dt>:foo
17065 </dt>
17066 </dl>
17067 <dl>
17068 <dt>:foo
17069 </dt>
17070 <dd>bar
17071 </dd>
17072 </dl>
17073 <dl>
17074 <dd>:foo
17075 </dd>
17076 </dl>
17077
17078 !!end
17079
17080 !! test
17081 Lists: 3. Only bullets at start of text should be escaped
17082 !! input
17083 *<nowiki>*foo*bar</nowiki>
17084
17085 *<nowiki>*foo</nowiki>''it''*bar
17086 !! result
17087 <ul>
17088 <li>*foo*bar
17089 </li>
17090 </ul>
17091 <ul>
17092 <li>*foo<i>it</i>*bar
17093 </li>
17094 </ul>
17095
17096 !!end
17097
17098 !! test
17099 Lists: 4. No escapes needed
17100 !! options
17101 parsoid
17102 !! input
17103 *foo*bar
17104
17105 *''foo''*bar
17106
17107 *[[Foo]]: bar
17108 !! result
17109 <ul>
17110 <li>foo*bar
17111 </li>
17112 </ul>
17113 <ul>
17114 <li><i>foo</i>*bar
17115 </li>
17116 </ul>
17117 <ul>
17118 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
17119 </li>
17120 </ul>
17121 !!end
17122
17123 !! test
17124 Lists: 5. No unnecessary escapes
17125 !! input
17126 * bar <span><nowiki>[[foo]]</nowiki></span>
17127
17128 *=bar <span><nowiki>[[foo]]</nowiki></span>
17129
17130 *[[bar <span><nowiki>[[foo]]</nowiki></span>
17131
17132 *]]bar <span><nowiki>[[foo]]</nowiki></span>
17133
17134 *=bar <span>foo]]</span>=
17135
17136 * <s></s>: a
17137 !! result
17138 <ul>
17139 <li> bar <span>[[foo]]</span>
17140 </li>
17141 </ul>
17142 <ul>
17143 <li>=bar <span>[[foo]]</span>
17144 </li>
17145 </ul>
17146 <ul>
17147 <li>[[bar <span>[[foo]]</span>
17148 </li>
17149 </ul>
17150 <ul>
17151 <li>]]bar <span>[[foo]]</span>
17152 </li>
17153 </ul>
17154 <ul>
17155 <li>=bar <span>foo]]</span>=
17156 </li>
17157 </ul>
17158 <ul>
17159 <li> <s></s>: a
17160 </li>
17161 </ul>
17162
17163 !!end
17164
17165 !! test
17166 Lists: 6. Escape bullets in SOL position
17167 !! options
17168 parsoid
17169 !! input
17170 <!--cmt--><nowiki>*foo</nowiki>
17171 !! result
17172 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
17173 !!end
17174
17175 !! test
17176 Lists: 7. Escape bullets in a multi-line context
17177 !! input
17178 a
17179 <nowiki>*</nowiki>b
17180 !! result
17181 <p>a
17182 *b
17183 </p>
17184 !!end
17185
17186 #### --------------- HRs ---------------
17187 #### 1. Single line
17188 #### -----------------------------------
17189
17190 !! test
17191 HRs: 1. Single line
17192 !! options
17193 parsoid
17194 !! input
17195 ----<nowiki>----</nowiki>
17196 ----=foo=
17197 ----*foo
17198 !! result
17199 <hr><span typeof="mw:Nowiki">----</span>
17200 <hr>=foo=
17201 <hr>*foo
17202 !! end
17203
17204 #### --------------- Tables ---------------
17205 #### 1a. Simple example
17206 #### 1b. No escaping needed (!foo)
17207 #### 1c. No escaping needed (|foo)
17208 #### 1d. No escaping needed (|}foo)
17209 ####
17210 #### 2a. Nested in td (<td>foo|bar</td>)
17211 #### 2b. Nested in td (<td>foo||bar</td>)
17212 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
17213 ####
17214 #### 3a. Nested in th (<th>foo!bar</th>)
17215 #### 3b. Nested in th (<th>foo!!bar</th>)
17216 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
17217 ####
17218 #### 4a. Escape -
17219 #### 4b. Escape +
17220 #### 4c. No escaping needed
17221 #### --------------------------------------
17222
17223 !! test
17224 Tables: 1a. Simple example
17225 !! input
17226 <nowiki>{|
17227 |}</nowiki>
17228 !! result
17229 <p>{|
17230 |}
17231 </p>
17232 !! end
17233
17234 !! test
17235 Tables: 1b. No escaping needed
17236 !! input
17237 !foo
17238 !! result
17239 <p>!foo
17240 </p>
17241 !! end
17242
17243 !! test
17244 Tables: 1c. No escaping needed
17245 !! input
17246 |foo
17247 !! result
17248 <p>|foo
17249 </p>
17250 !! end
17251
17252 !! test
17253 Tables: 1d. No escaping needed
17254 !! input
17255 |}foo
17256 !! result
17257 <p>|}foo
17258 </p>
17259 !! end
17260
17261 !! test
17262 Tables: 2a. Nested in td
17263 !! options
17264 parsoid
17265 !! input
17266 {|
17267 |<nowiki>foo|bar</nowiki>
17268 |}
17269 !! result
17270 <table><tbody><tr>
17271 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
17272 !! end
17273
17274 !! test
17275 Tables: 2b. Nested in td
17276 !! options
17277 parsoid
17278 !! input
17279 {|
17280 |<nowiki>foo||bar</nowiki>
17281 |''it''<nowiki>foo||bar</nowiki>
17282 |}
17283 !! result
17284 <table><tbody><tr>
17285 <td><span typeof="mw:Nowiki">foo||bar</span></td>
17286 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
17287 !! end
17288
17289 !! test
17290 Tables: 2c. Nested in td -- no escaping needed
17291 !! options
17292 parsoid
17293 !! input
17294 {|
17295 |foo!!bar
17296 |}
17297 !! result
17298 <table><tbody><tr><td>foo!!bar
17299 </td></tr></tbody></table>
17300
17301 !! end
17302
17303 !! test
17304 Tables: 3a. Nested in th
17305 !! options
17306 parsoid
17307 !! input
17308 {|
17309 !foo!bar
17310 |}
17311 !! result
17312 <table><tbody><tr><th>foo!bar
17313 </th></tr></tbody></table>
17314
17315 !! end
17316
17317 !! test
17318 Tables: 3b. Nested in th
17319 !! options
17320 parsoid
17321 !! input
17322 {|
17323 !<nowiki>foo!!bar</nowiki>
17324 |}
17325 !! result
17326 <table>
17327 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
17328 </tbody></table>
17329 !! end
17330
17331 !! test
17332 Tables: 3c. Nested in th -- no escaping needed
17333 !! options
17334 parsoid
17335 !! input
17336 {|
17337 !<nowiki>foo||bar</nowiki>
17338 |}
17339 !! result
17340 <table><tbody><tr>
17341 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
17342 !! end
17343
17344 !! test
17345 Tables: 4a. Escape -
17346 !! options
17347 parsoid
17348 !! input
17349 {|
17350 !-bar
17351 |-
17352 |<nowiki>-bar</nowiki>
17353 |}
17354 !! result
17355 <table><tbody>
17356 <tr><th>-bar</th></tr>
17357 <tr>
17358 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
17359 !! end
17360
17361 !! test
17362 Tables: 4b. Escape +
17363 !! options
17364 parsoid
17365 !! input
17366 {|
17367 !+bar
17368 |-
17369 |<nowiki>+bar</nowiki>
17370 |}
17371 !! result
17372 <table><tbody>
17373 <tr><th>+bar</th></tr>
17374 <tr>
17375 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
17376 !! end
17377
17378 !! test
17379 Tables: 4c. No escaping needed
17380 !! options
17381 parsoid
17382 !! input
17383 {|
17384 |foo-bar
17385 |foo+bar
17386 |-
17387 |''foo''-bar
17388 |''foo''+bar
17389 |-
17390 |foo
17391 bar|baz
17392 +bar
17393 -bar
17394 |}
17395 !! result
17396 <table><tbody>
17397 <tr><td>foo-bar</td><td>foo+bar</td></tr>
17398 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
17399 <tr><td>foo
17400 <p>bar|baz
17401 +bar
17402 -bar</p></td></tr>
17403 </tbody></table>
17404 !! end
17405
17406 ### SSS FIXME: Disabled right now because accurate html2wt
17407 ### on this snippet requires data-parsoid flags that we've
17408 ### stripped out of these tests. We should scheme how we
17409 ### we want to handle these kind of tests that require
17410 ### data-parsoid flags for accurate html2wt serialization
17411
17412 !! test
17413 Tables: 4d. No escaping needed
17414 !! options
17415 disabled
17416 !! input
17417 {|
17418 ||+1
17419 ||-2
17420 |}
17421 !! result
17422 <table>
17423 <tr>
17424 <td>+1
17425 </td>
17426 <td>-2
17427 </td></tr></table>
17428
17429 !! end
17430
17431 #### --------------- Links ----------------
17432 #### 1. Quote marks in link text
17433 #### 2. Wikilinks: Escapes needed
17434 #### 3. Wikilinks: No escapes needed
17435 #### 4. Extlinks: Escapes needed
17436 #### 5. Extlinks: No escapes needed
17437 #### --------------------------------------
17438 !! test
17439 Links 1. Quote marks in link text
17440 !! options
17441 parsoid
17442 !! input
17443 [[Foo|Foo<nowiki>''boo''</nowiki>]]
17444 !! result
17445 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
17446 !! end
17447
17448 !! test
17449 Links 2. WikiLinks: Escapes needed
17450 !! options
17451 parsoid
17452 !! input
17453 [[Foo|<nowiki>[Foobar]</nowiki>]]
17454 [[Foo|<nowiki>Foobar]</nowiki>]]
17455 [[Foo|x [Foobar] x]]
17456 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
17457 [[Foo|<nowiki>[[Bar]]</nowiki>]]
17458 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
17459 [[Foo|<nowiki>|Bar</nowiki>]]
17460 [[Foo|<nowiki>]]bar</nowiki>]]
17461 [[Foo|<nowiki>[[bar</nowiki>]]
17462 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
17463 !! result
17464 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
17465 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
17466 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
17467 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
17468 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
17469 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
17470 <a href="Foo" rel="mw:WikiLink">|Bar</a>
17471 <a href="Foo" rel="mw:WikiLink">]]bar</a>
17472 <a href="Foo" rel="mw:WikiLink">[[bar</a>
17473 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
17474 !! end
17475
17476 !! test
17477 Links 3. WikiLinks: No escapes needed
17478 !! options
17479 parsoid
17480 !! input
17481 [[Foo|[Foobar]]
17482 [[Foo|foo|bar]]
17483 !! result
17484 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
17485 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
17486 !! end
17487
17488 !! test
17489 Links 4. ExtLinks: Escapes needed
17490 !! options
17491 parsoid
17492 !! input
17493 [http://google.com <nowiki>[google]</nowiki>]
17494 [http://google.com <nowiki>google]</nowiki>]
17495 !! result
17496 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
17497 <a href="http://google.com" rel="mw:ExtLink">google]</a>
17498 !! end
17499
17500 !! test
17501 Links 5. ExtLinks: No escapes needed
17502 !! options
17503 parsoid
17504 !! input
17505 [http://google.com [google]
17506 !! result
17507 <a href="http://google.com" rel="mw:ExtLink">[google</a>
17508 !! end
17509
17510 #### --------------- Quotes ---------------
17511 #### 1. Quotes inside <b> and <i>
17512 #### 2. Link fragments separated by <i> and <b> tags
17513 #### 3. Link fragments inside <i> and <b>
17514 #### 4. No escaping needed
17515 #### --------------------------------------
17516 !! test
17517 1. Quotes inside <b> and <i>
17518 !! options
17519 parsoid=html2wt,wt2wt
17520 !! input
17521 ''<nowiki>'foo'</nowiki>''
17522 ''<nowiki>''foo''</nowiki>''
17523 ''<nowiki>'''foo'''</nowiki>''
17524 ''foo''<nowiki/>'s
17525 '''<nowiki>'foo'</nowiki>'''
17526 '''<nowiki>''foo''</nowiki>'''
17527 '''<nowiki>'''foo'''</nowiki>'''
17528 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
17529 '''foo'''<nowiki/>'s
17530 '''foo''
17531 ''foo''<nowiki/>'
17532 '<nowiki/>''foo''<nowiki/>'
17533 ''''foo'''
17534 '''foo'''<nowiki/>'
17535 '<nowiki/>'''foo'''<nowiki/>'
17536 !! result
17537 <p><i>'foo'</i>
17538 <i>''foo''</i>
17539 <i>'''foo'''</i>
17540 <i>foo</i>'s
17541 <b>'foo'</b>
17542 <b>''foo''</b>
17543 <b>'''foo'''</b>
17544 <b>foo'<i>bar'</i>baz</b>
17545 <b>foo</b>'s
17546 '<i>foo</i>
17547 <i>foo</i>'
17548 '<i>foo</i>'
17549 '<b>foo</b>
17550 <b>foo</b>'
17551 '<b>foo</b>'</p>
17552 !! end
17553
17554 !! test
17555 2. Link fragments separated by <i> and <b> tags
17556 !! input
17557 [[''foo''<nowiki>hello]]</nowiki>
17558
17559 [['''foo'''<nowiki>hello]]</nowiki>
17560 !! result
17561 <p>[[<i>foo</i>hello]]
17562 </p><p>[[<b>foo</b>hello]]
17563 </p>
17564 !! end
17565
17566 !! test
17567 3. Link fragments inside <i> and <b>
17568 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
17569 this is one of the shortcomings of this format)
17570 !! input
17571 ''[[foo''<nowiki>]]</nowiki>
17572
17573 '''[[foo'''<nowiki>]]</nowiki>
17574 !! result
17575 <p><i>[[foo</i>]]
17576 </p><p><b>[[foo</b>]]
17577 </p>
17578 !! end
17579
17580 !! test
17581 4. No escaping needed
17582 !! input
17583 '<span>''bar''</span>'
17584 '<span>'''bar'''</span>'
17585 !! result
17586 <p>'<span><i>bar</i></span>'
17587 '<span><b>bar</b></span>'
17588 </p>
17589 !! end
17590
17591 #### ----------- Paragraphs ---------------
17592 #### 1. No unnecessary escapes
17593 #### --------------------------------------
17594
17595 !! test
17596 1. No unnecessary escapes
17597 !! input
17598 bar <span><nowiki>[[foo]]</nowiki></span>
17599
17600 =bar <span><nowiki>[[foo]]</nowiki></span>
17601
17602 [[bar <span><nowiki>[[foo]]</nowiki></span>
17603
17604 ]]bar <span><nowiki>[[foo]]</nowiki></span>
17605
17606 =bar <span>foo]]</span><nowiki>=</nowiki>
17607 !! result
17608 <p>bar <span>[[foo]]</span>
17609 </p><p>=bar <span>[[foo]]</span>
17610 </p><p>[[bar <span>[[foo]]</span>
17611 </p><p>]]bar <span>[[foo]]</span>
17612 </p><p>=bar <span>foo]]</span>=
17613 </p>
17614 !!end
17615
17616 #### ----------------------- PRE --------------------------
17617 #### 1. Leading whitespace in SOL context should be escaped
17618 #### ------------------------------------------------------
17619 !! test
17620 1. Leading whitespace in SOL context should be escaped
17621 !! options
17622 parsoid
17623 !! input
17624 <nowiki> </nowiki>a
17625
17626 <nowiki> </nowiki> a
17627
17628 <nowiki> </nowiki>a(tab)
17629
17630 <nowiki> </nowiki> a
17631 <!--cmt-->
17632 <nowiki> </nowiki> a
17633
17634 a
17635 <nowiki> </nowiki>b
17636
17637 a
17638 <nowiki> </nowiki>b
17639
17640 a
17641 <nowiki> </nowiki> b
17642 !! result
17643 <p> a</p>
17644 <p> a</p>
17645 <p> a(tab)</p>
17646 <p> a</p>
17647 <p><!--cmt--> a</p>
17648 <p>a
17649 b</p>
17650 <p>a
17651 b</p>
17652 <p>a
17653 b</p>
17654 !! end
17655
17656 #### --------------- Behavior Switches --------------------
17657 !! test
17658 1. Valid behavior switches should be escaped
17659 !! options
17660 parsoid=html2wt
17661 !! input
17662 <nowiki>__TOC__</nowiki>
17663 !! result
17664 __TOC__
17665 !! end
17666
17667 !! test
17668 2. Invalid behavior switches should not be escaped
17669 !! options
17670 parsoid=html2wt
17671 !! input
17672 __TOO__
17673 __|__
17674 !! result
17675 __TOO__
17676 __|__
17677 !! end
17678
17679 #### --------------- HTML tags ---------------
17680 #### 1. a tags
17681 #### 2. other tags
17682 #### 3. multi-line html tag
17683 #### -----------------------------------------
17684 !! test
17685 1. a tags
17686 !! options
17687 parsoid
17688 !! input
17689 <a href="http://google.com">google</a>
17690 !! result
17691 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
17692 !! end
17693
17694 !! test
17695 2. other tags
17696 !! input
17697 <nowiki><div>foo</div>
17698 <div style="color:red">foo</div></nowiki>
17699 !! result
17700 <p>&lt;div&gt;foo&lt;/div&gt;
17701 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
17702 </p>
17703 !! end
17704
17705 !! test
17706 3. multi-line html tag
17707 !! input
17708 <nowiki><div
17709 >foo</div
17710 ></nowiki>
17711 !! result
17712 <p>&lt;div
17713 &gt;foo&lt;/div
17714 &gt;
17715 </p>
17716 !! end
17717
17718 !! test
17719 4. extension tags
17720 !! input
17721 <nowiki><ref>foo</ref></nowiki>
17722 !! result
17723 <p>&lt;ref&gt;foo&lt;/ref&gt;
17724 </p>
17725 !! end
17726
17727 #### --------------- Others ---------------
17728 !! test
17729 Escaping nowikis
17730 !! input
17731 &lt;nowiki&gt;foo&lt;/nowiki&gt;
17732 !! result
17733 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
17734 </p>
17735 !! end
17736
17737 ## The quote-char in the input is necessary for triggering the bug
17738 !! test
17739 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
17740 !! options
17741 parsoid=wt2wt,html2wt
17742 !! input
17743 foo's bar :
17744 !! result
17745 <p>foo's bar :</p>
17746 !! end
17747
17748 !! test
17749
17750 Tag-like HTML structures are passed through as text
17751 !! input
17752 <x y>
17753
17754 <x.y>
17755
17756 <x-y>
17757
17758 1>2
17759
17760 x<y
17761
17762 a>b
17763
17764 1<d e>f
17765 !! result
17766 <p>&lt;x y&gt;
17767 </p><p>&lt;x.y&gt;
17768 </p><p>&lt;x-y&gt;
17769 </p><p>1&gt;2
17770 </p><p>x&lt;y
17771 </p><p>a&gt;b
17772 </p><p>1&lt;d e&gt;f
17773 </p>
17774 !! end
17775
17776
17777 # This was a bug in the PHP parser (see bug 17663 and its dups,
17778 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
17779 !! test
17780 Tag names followed by punctuation should not be recognized as tags
17781 !! input
17782 <s.ome> text
17783 !! result
17784 <p>&lt;s.ome&gt; text
17785 </p>
17786 !! end
17787
17788 !! test
17789 HTML tag with necessary entities in attributes
17790 !! input
17791 <span title="&amp;amp;">foo</span>
17792 !! result
17793 <p><span title="&amp;amp;">foo</span>
17794 </p>
17795 !! end
17796
17797 !! test
17798 HTML tag with 'unnecessary' entity encoding in attributes
17799 !! input
17800 <span title="&amp;">foo</span>
17801 !! result
17802 <p><span title="&amp;">foo</span>
17803 </p>
17804 !! end
17805
17806 !! test
17807 HTML tag with broken attribute value quoting
17808 !! input
17809 <span title="Hello world>Foo</span>
17810 !! result
17811 <p><span>Foo</span>
17812 </p>
17813 !! end
17814
17815 !! test
17816 Parsoid-only: HTML tag with broken attribute value quoting
17817 !! options
17818 parsoid
17819 !! input
17820 <span title="Hello world>Foo</span>
17821 !! result
17822 <p><span title="Hello world">Foo</span>
17823 </p>
17824 !! end
17825
17826 !! test
17827 Table with broken attribute value quoting
17828 !! input
17829 {|
17830 | title="Hello world|Foo
17831 |}
17832 !! result
17833 <table>
17834 <tr>
17835 <td>Foo
17836 </td></tr></table>
17837
17838 !! end
17839
17840 !! test
17841 Table with broken attribute value quoting on consecutive lines
17842 !! input
17843 {|
17844 | title="Hello world|Foo
17845 | style="color:red|Bar
17846 |}
17847 !! result
17848 <table>
17849 <tr>
17850 <td>Foo
17851 </td>
17852 <td>Bar
17853 </td></tr></table>
17854
17855 !! end
17856
17857 !! test
17858 Parsoid-only: Table with broken attribute value quoting on consecutive lines
17859 !! options
17860 parsoid
17861 !! input
17862 {|
17863 | title="Hello world|Foo
17864 | style="color:red|Bar
17865 |}
17866 !! result
17867 <table><tbody>
17868 <tr>
17869 <td title="Hello world">Foo
17870 </td><td style="color: red">Bar
17871 </td></tr></tbody></table>
17872
17873 !! end
17874
17875 !! test
17876 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17877 !! options
17878 parsoid
17879 !! input
17880 {{}}
17881 !! result
17882 {{}}
17883 !! end
17884
17885 !! test
17886 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
17887 !! options
17888 parsoid
17889 !! input
17890 }}{{
17891 !! result
17892 }}{{
17893 !! end
17894
17895 !!test
17896 Accept empty td cell attribute
17897 !!input
17898 {|
17899 | align="center" | foo || |
17900 |}
17901 !!result
17902 <table>
17903 <tr>
17904 <td align="center"> foo </td>
17905 <td>
17906 </td></tr></table>
17907
17908 !!end
17909
17910 !!test
17911 Non-empty attributes in th-cells
17912 !!input
17913 {|
17914 ! Foo !! style="color: red" | Bar
17915 |}
17916 !!result
17917 <table>
17918 <tr>
17919 <th> Foo </th>
17920 <th style="color: red"> Bar
17921 </th></tr></table>
17922
17923 !!end
17924
17925 !!test
17926 Accept empty attributes in th-cells
17927 !!input
17928 {|
17929 !| foo !!| bar
17930 |}
17931 !!result
17932 <table>
17933 <tr>
17934 <th> foo </th>
17935 <th> bar
17936 </th></tr></table>
17937
17938 !!end
17939
17940 !!test
17941 Empty table rows go away
17942 !!input
17943 {|
17944 | Hello
17945 | there
17946 |- class="foo"
17947 |-
17948 |}
17949 !! result
17950 <table>
17951 <tr>
17952 <td> Hello
17953 </td>
17954 <td> there
17955 </td></tr>
17956
17957 </table>
17958
17959 !! end
17960
17961 ###
17962 ### Parsoid-centric tests for testing RTing of inter-element separators
17963 ### Edge cases not tested by existing parser tests and specific to
17964 ### Parsoid-specific serialization strategies.
17965 ###
17966
17967 !!test
17968 RT-ed inter-element separators should be valid separators
17969 !!input
17970 {|
17971 |- [[foo]]
17972 |}
17973 !!result
17974 <table>
17975
17976 </table>
17977
17978 !!end
17979
17980 !!test
17981 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
17982 (Parsoid-only since PHP parser relies on Tidy for correct output)
17983 !!options
17984 parsoid
17985 !!input
17986 {|
17987 |<small>foo
17988 bar
17989 |}
17990
17991 {|
17992 |<small>foo<small>
17993 |}
17994 !!result
17995 !!end
17996
17997 !!test
17998 Empty TD followed by TD with tpl-generated attribute
17999 !!input
18000 {|
18001 |-
18002 |
18003 |{{echo|style='color:red'}}|foo
18004 |}
18005 !!result
18006 <table>
18007
18008 <tr>
18009 <td>
18010 </td>
18011 <td>foo
18012 </td></tr></table>
18013
18014 !!end
18015
18016 !!test
18017 Indented table with an empty td
18018 !!input
18019 {|
18020 |-
18021 |
18022 |foo
18023 |}
18024 !!result
18025 <table>
18026
18027 <tr>
18028 <td>
18029 </td>
18030 <td>foo
18031 </td></tr></table>
18032
18033 !!end
18034
18035 !!test
18036 Empty TR followed by a template-generated TR
18037 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
18038 !!options
18039 parsoid
18040 !!input
18041 {|
18042 |-
18043 {{echo|<tr><td>foo</td></tr>}}
18044 |}
18045 !!result
18046 <table>
18047 <tbody>
18048 <tr></tr>
18049 <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}}]}'>
18050 <td>foo</td></tr>
18051 </tbody></table>
18052 !!end
18053
18054 ## PHP and parsoid output differ for this, and since this is primarily
18055 ## for testing Parsoid's serializer, marking this Parsoid only
18056 !!test
18057 Empty TR followed by mixed-ws-comment line should RT correctly
18058 !!options
18059 parsoid
18060 !!input
18061 {|
18062 |-
18063 <!--c-->
18064 |-
18065 <!--c--> <!--d-->
18066 |}
18067 !!result
18068 <table>
18069 <tbody>
18070 <tr></tr>
18071 <!--c-->
18072 <tr>
18073 <!--c--> </tr><!--d-->
18074 </tbody></table>
18075
18076 !!end
18077
18078 !!test
18079 Multi-line image caption generated by templates with/without trailing newlines
18080 !!options
18081 parsoid
18082 !!input
18083 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
18084 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
18085 !!result
18086 <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>
18087 <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>
18088
18089 !!end
18090
18091 ## PHP emits broken html for this, and since this is primarily
18092 ## a Parsoid serializer test, marking this Parsoid only
18093 !!test
18094 Improperly nested inline or quotes tags with whitespace in between
18095 !!options
18096 parsoid
18097 !!input
18098 <span> <s>x</span> </s>
18099 ''' ''x''' ''
18100 !!result
18101 <p><span> <s>x</s></span><s> </s>
18102 <b> <i>x</i></b><i> </i>
18103 </p>
18104 !!end
18105
18106 !!test
18107 Encapsulate protected attributes from wt
18108 !!options
18109 parsoid
18110 !!input
18111 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
18112 !!result
18113 <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>
18114 </body>
18115 !!end
18116
18117 ## Currently the p-wrapper is fragile in how adds / removes transformations.
18118 ## Having nested or stray pre tags results in the attempt to add duplicates,
18119 ## causing an assertion fail. This test tries to prevent that situation.
18120 !!test
18121 Ensure ParagraphWrapper can deal with stray closing pre tags
18122 !!options
18123 parsoid=wt2html
18124 !!input
18125 plain text</pre>
18126 !!result
18127 plain text
18128 !!end
18129
18130 !!test
18131 Ensure fostered text content is wrapped in spans
18132 !!options
18133 parsoid=wt2html
18134 !!input
18135 <table>hi</table><table>ho</table>
18136 !!result
18137 <span>hi</span>
18138 <table></table>
18139 <span>ho</span>
18140 <table></table>
18141 !!end
18142
18143 !!test
18144 Encapsulation properly handles null DSR information from foster box
18145 !!options
18146 parsoid=wt2html,wt2wt
18147 !!input
18148 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
18149 !!result
18150 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;
18151 <table>foo
18152 <tr>
18153 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18154 <table>
18155 <tbody>
18156 <tr>
18157 <td>bar</td></tr></tbody></table>
18158 !!end
18159
18160 !!test
18161 1. Encapsulate foster-parented transclusion content
18162 !!options
18163 parsoid=wt2wt,wt2html
18164 !!input
18165 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
18166 !!result
18167 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18168 <table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo
18169 <tr>
18170 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
18171 <table>
18172 <tbody>
18173 <tr>
18174 <td>bar</td></tr></tbody></table>
18175 !!end
18176
18177 !!test
18178 2. Encapsulate foster-parented transclusion content
18179 !!options
18180 parsoid=wt2wt,wt2html
18181 !!input
18182 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
18183 !!result
18184 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18185 <table>
18186 <div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div>
18187 <tr>
18188 <td>bar</td></tr></table>&quot;]}">foo</div>
18189 <table>
18190 <tbody>
18191 <tr>
18192 <td>bar</td></tr></tbody></table>
18193 !!end
18194
18195 !!test
18196 3. Encapsulate foster-parented transclusion content
18197 !!options
18198 parsoid=wt2wt,wt2html
18199 !!input
18200 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18201 !!result
18202 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18203 <table>
18204 <div>
18205 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div>
18206 <tr>
18207 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18208 <p>foo</p></div>
18209 <table>
18210 <tbody>
18211 <tr>
18212 <td>bar</td></tr></tbody></table>
18213 !!end
18214
18215 !!test
18216 4. Encapsulate foster-parented transclusion content
18217 !!options
18218 parsoid=wt2wt,wt2html
18219 !!input
18220 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
18221 !!result
18222 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18223 <table>
18224 <div>
18225 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div>
18226 <tr>
18227 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
18228 <p>foo</p></div>
18229 <table>
18230 <tbody>
18231 <tr>
18232 <td>bar</td></tr></tbody></table>
18233 !!end
18234
18235 !!test
18236 5. Encapsulate foster-parented transclusion content
18237 !!options
18238 parsoid=wt2wt,wt2html
18239 !!input
18240 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
18241 !!result
18242 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18243 <table>
18244 <tr>
18245 <td>
18246 <div>
18247 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</span>
18248 <table>
18249 <tbody>
18250 <tr>
18251 <td>
18252 <div>
18253 <p>foo</p></div></td></tr></tbody></table>
18254 !!end
18255
18256 !!test
18257 6. Encapsulate foster-parented transclusion content
18258 !!options
18259 parsoid=wt2wt,wt2html
18260 !!input
18261 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
18262 !!result
18263 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18264 <table>
18265 <tr>
18266 <td>
18267 <div>
18268 <p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
18269 <table>
18270 <tbody>
18271 <tr>
18272 <td>
18273 <div>
18274 <p>foo</p></div></td></tr></tbody></table>
18275 <p>ok</p>
18276 !!end
18277
18278 !!test
18279 7. Encapsulate foster-parented transclusion content
18280 !!options
18281 parsoid=wt2wt,wt2html
18282 !!input
18283 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
18284 !!result
18285 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
18286 <table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;
18287 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
18288 <td>bar</td></table>&quot;]}">foo</p>
18289 <table>
18290 <tbody>
18291 <tr>
18292 <td>bar</td></tr></tbody></table>
18293 !!end
18294
18295 !!test
18296 8. Encapsulate foster-parented transclusion content
18297 !!options
18298 parsoid=wt2wt,wt2html
18299 !!input
18300 {{echo|a
18301 }}{|{{echo|style='color:red'}}
18302 |-
18303 |b
18304 |}
18305 !!result
18306 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a\n&quot;}},&quot;i&quot;:0}}]}">a</p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</span>
18307 <table>
18308 <tbody>
18309 <tr>
18310 <td>b</td></tr></tbody></table>
18311 !!end
18312
18313 # -----------------------------------------------------------------
18314 # The following section of tests are primarily to spec requirements
18315 # around serialization of new/edited content.
18316 #
18317 # All these tests are marked Parsoid html2wt and html2html only
18318 # ----------------------------------------------------------------
18319
18320 !! test
18321 Image: Modifying size of an image
18322 !! options
18323 parsoid=html2wt
18324 !! input
18325 [[Image:Wiki.png|230x230px]]
18326 !! result
18327 <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>
18328 !!end
18329
18330 !! test
18331 Image: New block level image should have \n before and after
18332 !! options
18333 parsoid=html2wt
18334 !! input
18335 123
18336 [[File:Wiki.png|right|thumb|150x150px]]
18337 456
18338 !! result
18339 <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>
18340 !!end
18341
18342 # Wacky -- the leading newline in input is required because
18343 # that is what the serializer emits. To be fixed. Not fixing
18344 # the test because this test is required to test serialization of
18345 # new content and preferred whitespace style.
18346 !! test
18347 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
18348 !! options
18349 parsoid=html2wt
18350 !! input
18351
18352 * foo
18353 !! result
18354 <ul>
18355 <li><p>foo</p></li>
18356 </ul>
18357 !! end
18358
18359 # Wacky -- the leading newline in input is required because
18360 # that is what the serializer emits. To be fixed. Not fixing
18361 # the test because this test is required to test serialization of
18362 # new content and preferred whitespace style.
18363 !! test
18364 Lists: Add space after bullets
18365 !! options
18366 parsoid=html2wt
18367 !! input
18368
18369 * foo
18370 * bar
18371 * <span> baz</span>
18372 !! result
18373 <ul>
18374 <li>foo</li>
18375 <li> bar</li>
18376 <li><span> baz</span></li>
18377 </ul>
18378 !! end
18379
18380 !! test
18381 Parsoid: Serialize positional parameters with = in them as named parameter
18382 !! options
18383 parsoid=html2wt
18384 !! input
18385 {{echo|1 = f=oo}}
18386
18387 {{echo|1 = f=oo|2 = bar}}
18388
18389 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18390 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18391 {{echo|<nowiki>f=oo</nowiki>|bar}}
18392 !! result
18393 <p about="#mwt1" typeof="mw:Transclusion"
18394 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
18395
18396 <p about="#mwt1" typeof="mw:Transclusion"
18397 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
18398
18399 <!--Orig params with data-parsoid has heuristics for handling = chars-->
18400 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
18401 <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>
18402 !! end
18403
18404 !! test
18405 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
18406 !! options
18407 parsoid=html2wt
18408 !! input
18409 <div>a
18410 b
18411 </div>
18412 <div>a
18413 b
18414 </div>
18415 <div>
18416 a
18417
18418 b
18419 </div>
18420 !! result
18421 <div>a<p>b</p></div>
18422 <div>a
18423 <p>b</p></div>
18424 <div>
18425 a
18426 <p>b</p></div>
18427 !! end
18428
18429 #-----------------------------
18430 # I/B quote minimization tests
18431 #-----------------------------
18432
18433 !! test
18434 1. I/B quote minimization: wikitext-only tags should be combined
18435 !! options
18436 parsoid=html2wt
18437 !! input
18438 ''AB''
18439
18440 '''AB'''
18441
18442 ''A'''B'''''
18443
18444 '''A''B'''''
18445
18446 '''A''BC''D'''
18447
18448 '''''AB'''''
18449
18450 '''''AB'''''
18451
18452 '''''AB'''''
18453 !! result
18454 <p><i>A</i><i>B</i></p>
18455 <p><b>A</b><b>B</b></p>
18456 <p><i>A</i><b><i>B</i></b></p>
18457 <p><b>A</b><i><b>B</b></i></p>
18458 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
18459 <p><i><b>A</b></i><i><b>B</b></i></p>
18460 <p><i><b>A</b></i><b><i>B</i></b></p>
18461 <p><b><i>A</i></b><i><b>B</b></i></p>
18462 !! end
18463
18464 !! test
18465 2. I/B quote minimization: wikitext and html tags should not be combined
18466 !! options
18467 parsoid=html2wt
18468 !! input
18469 ''A''<i>B</i>
18470
18471 ''A'''''<i>B</i>'''
18472 !! result
18473 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
18474 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
18475 !! end
18476
18477 !! test
18478 3. I/B quote minimization: templated content stops minimization
18479 !! options
18480 parsoid=html2wt
18481 !! input
18482 ''A''{{echo|''B''}}
18483
18484 ''A''{{echo|'''''B'''''}}
18485 !! result
18486 <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>
18487 <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>
18488 !! end
18489
18490 !! test
18491 4. I/B quote minimization: new content should be mimimized with adjacent old content
18492 !! options
18493 parsoid=html2wt
18494 !! input
18495 ''AB''
18496
18497 '''AB'''
18498
18499 ''A'''B'''''
18500 !! result
18501 <p><i>A</i><i data-parsoid='{}'>B</i></p>
18502 <p><b data-parsoid='{}'>A</b><b>B</b></p>
18503 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
18504 !! end
18505
18506 # -----------------------------------------------------------------
18507 # End of section for Parsoid-only html2wt tests for serialization
18508 # of new content
18509 # -----------------------------------------------------------------
18510
18511 TODO:
18512 more images
18513 more tables
18514 character entities
18515 and much more
18516 Try for 100% code coverage